feat(wms): 完善调拨单明细查询功能
- 新增钢卷信息查询和服务注入 - 新增库房服务依赖以获取库区名称 - 实现调拨单明细详情信息填充功能 - 添加改前后物料信息的完整查询支持 - 扩展VO类以包含物料类型名称和库区名称字段 - 优化查询方法以自动填充关联的物料和库房信息 - 实现物料类型转换显示为中文描述功能 - 添加异常处理确保库房信息查询失败时不影响主流程
This commit is contained in:
@@ -79,5 +79,92 @@ public class WmsTransferOrderItemVo {
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
// ========== 改之前物料信息 ==========
|
||||
/**
|
||||
* 改之前物料类型名称
|
||||
*/
|
||||
private String materialTypeBeforeName;
|
||||
|
||||
/**
|
||||
* 改之前物料名称
|
||||
*/
|
||||
private String materialNameBefore;
|
||||
|
||||
/**
|
||||
* 改之前物料规格
|
||||
*/
|
||||
private String specificationBefore;
|
||||
|
||||
/**
|
||||
* 改之前物料材质
|
||||
*/
|
||||
private String materialBefore;
|
||||
|
||||
/**
|
||||
* 改之前物料表面处理
|
||||
*/
|
||||
private String surfaceTreatmentBefore;
|
||||
|
||||
/**
|
||||
* 改之前物料厂家
|
||||
*/
|
||||
private String manufacturerBefore;
|
||||
|
||||
/**
|
||||
* 改之前物料锌层
|
||||
*/
|
||||
private String zincLayerBefore;
|
||||
|
||||
/**
|
||||
* 改之前逻辑库区名称
|
||||
*/
|
||||
private String warehouseNameBefore;
|
||||
|
||||
// ========== 改之后物料信息 ==========
|
||||
/**
|
||||
* 改之后物料类型名称
|
||||
*/
|
||||
private String materialTypeAfterName;
|
||||
|
||||
/**
|
||||
* 改之后物料名称
|
||||
*/
|
||||
private String materialNameAfter;
|
||||
|
||||
/**
|
||||
* 改之后物料规格
|
||||
*/
|
||||
private String specificationAfter;
|
||||
|
||||
/**
|
||||
* 改之后物料材质
|
||||
*/
|
||||
private String materialAfter;
|
||||
|
||||
/**
|
||||
* 改之后物料表面处理
|
||||
*/
|
||||
private String surfaceTreatmentAfter;
|
||||
|
||||
/**
|
||||
* 改之后物料厂家
|
||||
*/
|
||||
private String manufacturerAfter;
|
||||
|
||||
/**
|
||||
* 改之后物料锌层
|
||||
*/
|
||||
private String zincLayerAfter;
|
||||
|
||||
/**
|
||||
* 改之后逻辑库区名称
|
||||
*/
|
||||
private String warehouseNameAfter;
|
||||
|
||||
// ========== 钢卷信息 ==========
|
||||
|
||||
private WmsMaterialCoilVo coil;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.klp.common.core.domain.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.klp.domain.bo.WmsMaterialCoilBo;
|
||||
import com.klp.domain.vo.WmsMaterialCoilVo;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.klp.domain.bo.WmsTransferOrderItemBo;
|
||||
@@ -20,6 +22,7 @@ import com.klp.mapper.WmsProductMapper;
|
||||
import com.klp.mapper.WmsMaterialCoilMapper;
|
||||
import com.klp.service.IWmsTransferOrderItemService;
|
||||
import com.klp.service.IWmsMaterialCoilService;
|
||||
import com.klp.service.IWmsWarehouseService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,13 +46,19 @@ public class WmsTransferOrderItemServiceImpl implements IWmsTransferOrderItemSer
|
||||
private final WmsRawMaterialMapper rawMaterialMapper;
|
||||
private final WmsProductMapper productMapper;
|
||||
private final WmsMaterialCoilMapper coilMapper;
|
||||
private final IWmsMaterialCoilService coilService;
|
||||
private final IWmsWarehouseService warehouseService;
|
||||
|
||||
/**
|
||||
* 查询调拨单明细
|
||||
*/
|
||||
@Override
|
||||
public WmsTransferOrderItemVo queryById(Long itemId){
|
||||
return baseMapper.selectVoById(itemId);
|
||||
WmsTransferOrderItemVo vo = baseMapper.selectVoById(itemId);
|
||||
if (vo != null) {
|
||||
fillDetailInfo(vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,6 +68,12 @@ public class WmsTransferOrderItemServiceImpl implements IWmsTransferOrderItemSer
|
||||
public TableDataInfo<WmsTransferOrderItemVo> queryPageList(WmsTransferOrderItemBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<WmsTransferOrderItem> lqw = buildQueryWrapper(bo);
|
||||
Page<WmsTransferOrderItemVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
List<WmsTransferOrderItemVo> records = result.getRecords();
|
||||
if (records != null && !records.isEmpty()) {
|
||||
for (WmsTransferOrderItemVo vo : records) {
|
||||
fillDetailInfo(vo);
|
||||
}
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -68,7 +83,77 @@ public class WmsTransferOrderItemServiceImpl implements IWmsTransferOrderItemSer
|
||||
@Override
|
||||
public List<WmsTransferOrderItemVo> queryList(WmsTransferOrderItemBo bo) {
|
||||
LambdaQueryWrapper<WmsTransferOrderItem> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
List<WmsTransferOrderItemVo> list = baseMapper.selectVoList(lqw);
|
||||
if (list != null && !list.isEmpty()) {
|
||||
for (WmsTransferOrderItemVo vo : list) {
|
||||
fillDetailInfo(vo);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private void fillDetailInfo(WmsTransferOrderItemVo vo) {
|
||||
// 查询钢卷信息
|
||||
if (vo.getCoilId() != null) {
|
||||
WmsMaterialCoilVo coil = coilService.queryById(vo.getCoilId());
|
||||
if (coil != null) {
|
||||
vo.setCoil(coil);
|
||||
}
|
||||
}
|
||||
|
||||
// 填充改之前物料信息
|
||||
fillMaterialInfo(vo, vo.getItemIdBefore(), vo.getMaterialTypeBefore(), "Before");
|
||||
|
||||
// 填充改之后物料信息
|
||||
fillMaterialInfo(vo, vo.getItemIdAfter(), vo.getMaterialTypeAfter(), "After");
|
||||
|
||||
// 填充库区名称
|
||||
if (vo.getWarehouseIdBefore() != null) {
|
||||
try {
|
||||
vo.setWarehouseNameBefore(warehouseService.queryById(vo.getWarehouseIdBefore()).getWarehouseName());
|
||||
} catch (Exception e) {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
if (vo.getWarehouseIdAfter() != null) {
|
||||
try {
|
||||
vo.setWarehouseNameAfter(warehouseService.queryById(vo.getWarehouseIdAfter()).getWarehouseName());
|
||||
} catch (Exception e) {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
|
||||
// 填充物料类型名称
|
||||
vo.setMaterialTypeBeforeName(vo.getMaterialTypeBefore() != null ? (vo.getMaterialTypeBefore() == 1 ? "原料" : "成品") : null);
|
||||
vo.setMaterialTypeAfterName(vo.getMaterialTypeAfter() != null ? (vo.getMaterialTypeAfter() == 1 ? "原料" : "成品") : null);
|
||||
}
|
||||
|
||||
private void fillMaterialInfo(WmsTransferOrderItemVo vo, Long itemId, Long materialType, String suffix) {
|
||||
if (itemId == null || materialType == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (materialType == 1) {
|
||||
WmsRawMaterial raw = rawMaterialMapper.selectById(itemId);
|
||||
if (raw != null) {
|
||||
vo.setMaterialNameBefore(raw.getRawMaterialName());
|
||||
vo.setSpecificationBefore(raw.getSpecification());
|
||||
vo.setMaterialBefore(raw.getMaterial());
|
||||
vo.setSurfaceTreatmentBefore(raw.getSurfaceTreatmentDesc());
|
||||
vo.setManufacturerBefore(raw.getManufacturer());
|
||||
vo.setZincLayerBefore(raw.getZincLayer());
|
||||
}
|
||||
} else if (materialType == 2) {
|
||||
WmsProduct product = productMapper.selectById(itemId);
|
||||
if (product != null) {
|
||||
vo.setMaterialNameAfter(product.getProductName());
|
||||
vo.setSpecificationAfter(product.getSpecification());
|
||||
vo.setMaterialAfter(product.getMaterial());
|
||||
vo.setSurfaceTreatmentAfter(product.getSurfaceTreatmentDesc());
|
||||
vo.setManufacturerAfter(product.getManufacturer());
|
||||
vo.setZincLayerAfter(product.getZincLayer());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WmsTransferOrderItem> buildQueryWrapper(WmsTransferOrderItemBo bo) {
|
||||
|
||||
Reference in New Issue
Block a user