PDA移位管理批次属性查询修改,库存查询修改

This commit is contained in:
秦鸿展
2026-03-13 16:57:48 +08:00
parent f7fea55e23
commit d7dd8a4567
8 changed files with 447 additions and 36 deletions
@@ -190,30 +190,158 @@ public class ShiftManageApplicationService {
}
/**
* 物料移位
* 物料移位(PDA),与收货、上架一致:支持 getInfoByApp 的 parent_copy 结构及分批移位
*/
public Boolean appMoveFromShiftManage(ShiftManageDO shiftManageDO){
List<ShiftMaterialDetailDO> shiftMaterialDetailDOList = shiftManageDO.getShiftMaterialDetailList();
shiftMaterialDetailDOList.forEach(shiftMaterialDetailDO -> {
List<ShiftMaterialDetailDO> shiftMaterialDetailDOChildrenList1 = shiftMaterialDetailDO.getChildren();
ShiftMaterialDetailDO shiftMaterialDetailDOChildren = shiftMaterialDetailDOChildrenList1.stream().filter(p -> 1 == p.getLevel()).collect(Collectors.toList()).get(0);
shiftMaterialDetailDO.setShiftIoDetailId(shiftMaterialDetailDOChildren.getShiftIoDetailId());
shiftMaterialDetailDO.setShiftQuantity(shiftMaterialDetailDOChildren.getShiftQuantity());
shiftMaterialDetailDO.setNewWarehouseId(shiftMaterialDetailDOChildren.getNewWarehouseId());
shiftMaterialDetailDO.setNewStorageSectionId(shiftMaterialDetailDOChildren.getNewStorageSectionId());
shiftMaterialDetailDO.setNewStorageLocationId(shiftMaterialDetailDOChildren.getNewStorageLocationId());
shiftMaterialDetailDO.setContainerId(shiftMaterialDetailDOChildren.getContainerId());
shiftMaterialDetailDO.setLevel(shiftMaterialDetailDOChildren.getLevel());
shiftMaterialDetailDO.setMaterialDetailSerialNumberList(shiftMaterialDetailDOChildren.getMaterialDetailSerialNumberList());
//只留二级
List<ShiftMaterialDetailDO> shiftMaterialDetailDOChildrenList2 = shiftMaterialDetailDOChildrenList1.stream().filter(p -> 2 == p.getLevel()).collect(Collectors.toList());
shiftMaterialDetailDO.setChildren(shiftMaterialDetailDOChildrenList2);
});
boolean firstItemHadChildrenBefore = !CollectionUtils.isEmpty(shiftMaterialDetailDOList)
&& !CollectionUtils.isEmpty(shiftMaterialDetailDOList.get(0).getChildren());
// PDA 平铺结构转父子结构(与收货、上架一致)
ensureFirstItemAsParentForShift(shiftManageDO);
if (firstItemHadChildrenBefore) {
// 主项子项结构:将 children 第一条(parent_copy)赋值给主项并删除,与收货 assignFirstChildToParentAndRemove 一致
assignFirstChildToParentAndRemoveForShift(shiftManageDO);
} else {
// 非 getInfoByApp 结构:取第一个子项赋值给主项,保留其余子项
shiftMaterialDetailDOList = shiftManageDO.getShiftMaterialDetailList();
if (!CollectionUtils.isEmpty(shiftMaterialDetailDOList)) {
shiftMaterialDetailDOList.forEach(shiftMaterialDetailDO -> {
List<ShiftMaterialDetailDO> children = shiftMaterialDetailDO.getChildren();
if (children != null && !children.isEmpty()) {
ShiftMaterialDetailDO firstChild = children.get(0);
shiftMaterialDetailDO.setShiftIoDetailId(firstChild.getShiftIoDetailId());
shiftMaterialDetailDO.setShiftQuantity(firstChild.getShiftQuantity());
shiftMaterialDetailDO.setNewWarehouseId(firstChild.getNewWarehouseId());
shiftMaterialDetailDO.setNewStorageSectionId(firstChild.getNewStorageSectionId());
shiftMaterialDetailDO.setNewStorageLocationId(firstChild.getNewStorageLocationId());
shiftMaterialDetailDO.setContainerId(firstChild.getContainerId());
shiftMaterialDetailDO.setLevel(firstChild.getLevel());
shiftMaterialDetailDO.setMaterialDetailSerialNumberList(firstChild.getMaterialDetailSerialNumberList());
List<ShiftMaterialDetailDO> restChildren = new ArrayList<>();
for (int i = 1; i < children.size(); i++) {
ShiftMaterialDetailDO c = children.get(i);
c.setLevel(2);
restChildren.add(c);
}
shiftMaterialDetailDO.setChildren(restChildren);
}
});
}
}
//移位装配参数
ShiftManageDO assembleShiftManageDO = assembleParamByShift(shiftManageDO);
return shiftManageDomainService.appMoveFromShiftManage(assembleShiftManageDO);
}
/**
* PDA 移位回传时,将 shiftMaterialDetailList 的第一项作为主项(level 1),其余项作为其子项(level 2)
* 仅当数据库中第二项为 level 2(真实子项)时才转换,与收货 ensureFirstItemAsParent 逻辑一致
*/
private void ensureFirstItemAsParentForShift(ShiftManageDO shiftManageDO) {
List<ShiftMaterialDetailDO> list = shiftManageDO.getShiftMaterialDetailList();
if (CollectionUtils.isEmpty(list) || list.size() <= 1) {
return;
}
if (!CollectionUtils.isEmpty(list.get(0).getChildren())) {
return;
}
ShiftManagePO shiftManagePO = shiftManageDomainService.getInfo(shiftManageDO.getShiftManageId());
if (shiftManagePO == null) {
return;
}
ShiftMaterialDetailDO shiftMaterialDetailDOByQuery = new ShiftMaterialDetailDO();
shiftMaterialDetailDOByQuery.setShiftNumber(shiftManagePO.getShiftNumber());
List<ShiftMaterialDetailPO> shiftMaterialDetailPODbList = shiftMaterialDetailDomainService.queryList(shiftMaterialDetailDOByQuery);
Map<Long, ShiftMaterialDetailPO> dbMap = shiftMaterialDetailPODbList.stream()
.collect(Collectors.toMap(ShiftMaterialDetailPO::getShiftIoDetailId, Function.identity()));
Map<Long, ShiftMaterialDetailPO> dbMapByUniqueId = shiftMaterialDetailPODbList.stream()
.filter(po -> po.getUniqueId() != null)
.collect(Collectors.toMap(ShiftMaterialDetailPO::getUniqueId, Function.identity()));
ShiftMaterialDetailDO first = list.get(0);
ShiftMaterialDetailPO firstPO = dbMap.get(first.getShiftIoDetailId());
if (firstPO == null && first.getUniqueId() != null) {
firstPO = dbMapByUniqueId.get(first.getUniqueId());
}
if (firstPO == null || firstPO.getUniqueId() == null) {
return;
}
ShiftMaterialDetailDO second = list.get(1);
if (second != null) {
ShiftMaterialDetailPO secondPO = dbMap.get(second.getShiftIoDetailId());
if (secondPO == null && second.getUniqueId() != null) {
secondPO = dbMapByUniqueId.get(second.getUniqueId());
}
if (secondPO != null && secondPO.getLevel() != null && secondPO.getLevel() == 1) {
return;
}
}
Long parentUniqueId = firstPO.getUniqueId();
List<ShiftMaterialDetailDO> children = new ArrayList<>();
for (int i = 1; i < list.size(); i++) {
ShiftMaterialDetailDO child = list.get(i);
child.setLevel(2);
child.setParentUniqueId(parentUniqueId);
children.add(child);
}
first.setLevel(1);
first.setChildren(children);
List<ShiftMaterialDetailDO> newList = new ArrayList<>();
newList.add(first);
shiftManageDO.setShiftMaterialDetailList(newList);
}
/**
* 移位时:将 children 中第一条(parent_copy)的值赋给主项,并删除第一条;与收货 assignFirstChildToParentAndRemove 一致。
* getInfoByApp 有子项时会将 parent_copy 作为 children 第一条,PDA 提交时需将其值回填主项并移除。
*/
private void assignFirstChildToParentAndRemoveForShift(ShiftManageDO shiftManageDO) {
List<ShiftMaterialDetailDO> list = shiftManageDO.getShiftMaterialDetailList();
if (CollectionUtils.isEmpty(list)) {
return;
}
for (ShiftMaterialDetailDO parent : list) {
List<ShiftMaterialDetailDO> children = parent.getChildren();
if (CollectionUtils.isEmpty(children)) {
continue;
}
ShiftMaterialDetailDO firstChild = children.get(0);
if (!isShiftParentCopy(parent, firstChild)) {
continue;
}
BeanUtils.copyProperties(firstChild, parent, "children", "parentUniqueId", "uniqueId", "shiftIoDetailId");
List<ShiftMaterialDetailDO> newChildren = new ArrayList<>();
for (int i = 1; i < children.size(); i++) {
ShiftMaterialDetailDO c = children.get(i);
c.setLevel(2);
newChildren.add(c);
}
parent.setChildren(newChildren);
}
}
/**
* 判断第一条子项是否为 parent_copy(主项拷贝)。与主项同 shiftIoDetailId/uniqueId 则为 parent_copy。
*/
private boolean isShiftParentCopy(ShiftMaterialDetailDO parent, ShiftMaterialDetailDO firstChild) {
Long parentId = parent.getShiftIoDetailId();
Long firstChildId = firstChild.getShiftIoDetailId();
Long parentUniqueId = parent.getUniqueId();
Long firstChildUniqueId = firstChild.getUniqueId();
if (parentId != null && parentId.equals(firstChildId)) {
return true;
}
if (parentUniqueId != null && parentUniqueId.equals(firstChildUniqueId)) {
return true;
}
if (firstChildId != null && parentId != null && !firstChildId.equals(parentId)) {
return false;
}
if (firstChildUniqueId != null && parentUniqueId != null && !firstChildUniqueId.equals(parentUniqueId)) {
return false;
}
return firstChildId == null && firstChildUniqueId == null;
}
/**
* @description PC 完成移位
* @author ZhouGY
@@ -286,11 +414,15 @@ public class ShiftManageApplicationService {
if (shiftMaterialDetailPO == null){
throw new ServiceException("物料明细不存在");
}
//ShiftQuantity前端传过来是0 他那边不好赋值 和Quantity参数统一
shiftMaterialDetailDO.setShiftQuantity(shiftMaterialDetailDO.getQuantity());
if (shiftMaterialDetailDO.getShiftQuantity().compareTo(BigDecimal.ZERO) == 0){
//未进行移位直接跳过
continue;
//ShiftQuantity前端传过来是0 他那边不好赋值 和Quantity参数统一;有子项时父级已从 assignFirstChildToParentAndRemove 合并了 parent_copy,不再覆盖
if (CollectionUtils.isEmpty(shiftMaterialDetailDO.getChildren())) {
shiftMaterialDetailDO.setShiftQuantity(shiftMaterialDetailDO.getQuantity());
}
if (shiftMaterialDetailDO.getShiftQuantity() == null || shiftMaterialDetailDO.getShiftQuantity().compareTo(BigDecimal.ZERO) == 0){
//未进行移位直接跳过(有子项时父级 shiftQuantity 可能为 0,由子项汇总)
if (CollectionUtils.isEmpty(shiftMaterialDetailDO.getChildren())) {
continue;
}
}
if (shiftMaterialDetailPO.getShiftStatus() == 4){
//已完成移位的物料不再支持修改
@@ -298,11 +430,12 @@ public class ShiftManageApplicationService {
}
//设置上架库位、容器信息
setStorageLocationInfo(shiftMaterialDetailDO);
BigDecimal shiftQuantity = shiftMaterialDetailDO.getShiftQuantity();;//当前作业移位数
//判断是否存在子项
// 有子项时:父级(含合并的 parent_copy)+ 子项汇总;无子项时,使用父级数量
BigDecimal shiftQuantity;
List<ShiftMaterialDetailDO> returnShiftMaterialDetailDOChildList = new ArrayList<>();
List<ShiftMaterialDetailDO> shiftMaterialDetailDOChildList = shiftMaterialDetailDO.getChildren();
if (!CollectionUtils.isEmpty(shiftMaterialDetailDOChildList)){
shiftQuantity = shiftMaterialDetailDO.getShiftQuantity() != null ? shiftMaterialDetailDO.getShiftQuantity() : BigDecimal.ZERO;
for (ShiftMaterialDetailDO shiftMaterialDetailDOChild : shiftMaterialDetailDOChildList){
ShiftMaterialDetailDO returnShiftMaterialDetailDOChild = new ShiftMaterialDetailDO();
ShiftMaterialDetailPO shiftMaterialDetailPOChildDb = shiftMaterialDetailPODbMap.get(shiftMaterialDetailDOChild.getShiftIoDetailId());
@@ -329,9 +462,12 @@ public class ShiftManageApplicationService {
}
}
returnShiftMaterialDetailDOChild.setMaterialDetailSerialNumberList(returnShiftMaterialDetailDOChild.getMaterialDetailSerialNumberList());
syncTotalWeightVolumeAreaToNetWeight(returnShiftMaterialDetailDOChild);
returnShiftMaterialDetailDOChildList.add(returnShiftMaterialDetailDOChild);
shiftQuantity = shiftQuantity.add(returnShiftMaterialDetailDOChild.getShiftQuantity());
}
} else {
shiftQuantity = shiftMaterialDetailDO.getShiftQuantity();
}
//记录移位单移位总数
totalShiftQuantity = totalShiftQuantity.add(shiftQuantity);
@@ -346,6 +482,8 @@ public class ShiftManageApplicationService {
ShiftMaterialDetailDO returnShiftMaterialDetailDO = new ShiftMaterialDetailDO();
BeanUtils.copyProperties(shiftMaterialDetailPO, returnShiftMaterialDetailDO);
BeanUtils.copyProperties(shiftMaterialDetailDO, returnShiftMaterialDetailDO, IgnoreNullUtil.getNullPropertyNames(shiftMaterialDetailDO));
// PDA 表单区修改的 totalNetWeight 等需同步到 netWeight,供 shift_material_detail 和 material_inventory 更新
syncTotalWeightVolumeAreaToNetWeight(returnShiftMaterialDetailDO);
//一级列表 首次收货
//是否开启了序列号管理
if (shiftMaterialDetailPO.getSerialNumberManage() == 1){
@@ -397,6 +535,18 @@ public class ShiftManageApplicationService {
shiftManageDO.setWarehouseName(warehouseFeignPO.getWarehouseName());
}
/**
* PDA 表单区修改的 totalNetWeight、totalGrossWeight、totalVolume、totalArea 同步到 netWeight 等,
* 供 shift_material_detail 和 material_inventory 持久化
*/
private void syncTotalWeightVolumeAreaToNetWeight(ShiftMaterialDetailDO d) {
if (d == null) return;
if (d.getTotalNetWeight() != null) d.setNetWeight(d.getTotalNetWeight());
if (d.getTotalGrossWeight() != null) d.setGrossWeight(d.getTotalGrossWeight());
if (d.getTotalVolume() != null) d.setVolume(d.getTotalVolume());
if (d.getTotalArea() != null) d.setArea(d.getTotalArea());
}
/**
* @description 设置上架库位、容器信息
* @author ZhouGY
@@ -16,6 +16,12 @@ import com.mhd.wms.domain.deliveTask.repository.facade.IDeliveTaskService;
import com.mhd.wms.domain.deliveTask.repository.todo.DeliveTaskDO;
import com.mhd.wms.domain.inventoryStandingDetail.repository.facade.IInventoryStandingDetailService;
import com.mhd.wms.domain.inventoryStandingDetail.repository.todo.InventoryStandingDetailDO;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.BatchDetailFeignPO;
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
@@ -68,6 +74,8 @@ public class ShiftManageDomainService {
private IInventoryStandingDetailService inventoryStandingDetailService;
@Autowired
private IDeliveTaskService deliveTaskService;
@Autowired
private SystemServiceFeign systemServiceFeign;
/**
@@ -95,6 +103,10 @@ public class ShiftManageDomainService {
Map<Long, List<OutMaterialDetailSerialNumberPO>> inMaterialDetailSerialNumberMap = outMaterialDetailSerialNumberPOList.stream()
.collect(Collectors.groupingBy(OutMaterialDetailSerialNumberPO::getMaterialDetailUniqueId));
shiftMaterialDetailPOList.forEach(shiftMaterialDetailPO -> {
// PDA移位页面:父级也填充批次属性、净重、毛重、面积、体积,保证顶层结构有值
fillMaterialMoreDetailForShiftDetail(shiftMaterialDetailPO);
// 填充 totalNetWeight 等,供 PDA 表单区(移入数量、移入库位、容器旁)显示
fillTotalWeightVolumeArea(shiftMaterialDetailPO);
List<ShiftMaterialDetailPO> shiftMaterialDetailPOChildrenNowList = new ArrayList<>();
ShiftMaterialDetailPO shiftMaterialDetailPOChildrenNow = new ShiftMaterialDetailPO();
BeanUtils.copyProperties(shiftMaterialDetailPO, shiftMaterialDetailPOChildrenNow, "children");
@@ -104,10 +116,15 @@ public class ShiftManageDomainService {
}else {
shiftMaterialDetailPOChildrenNow.setMaterialDetailSerialNumberList(new ArrayList<>());
}
// 子项副本同步批次属性
shiftMaterialDetailPOChildrenNow.setMaterialMoreDetailList(shiftMaterialDetailPO.getMaterialMoreDetailList());
fillTotalWeightVolumeArea(shiftMaterialDetailPOChildrenNow);
shiftMaterialDetailPOChildrenNowList.add(shiftMaterialDetailPOChildrenNow);
//子集
List<ShiftMaterialDetailPO> shiftMaterialDetailPOChildrenList = shiftMaterialDetailPO.getChildren();
shiftMaterialDetailPOChildrenList.forEach(receiptMaterialDetailPOChildren -> {
fillMaterialMoreDetailForShiftDetail(receiptMaterialDetailPOChildren);
fillTotalWeightVolumeArea(receiptMaterialDetailPOChildren);
List<OutMaterialDetailSerialNumberPO> materialDetailSerialNumberChildrenList = inMaterialDetailSerialNumberMap.get(shiftMaterialDetailPO.getUniqueId());
if (!CollectionUtils.isEmpty(materialDetailSerialNumberChildrenList)){
receiptMaterialDetailPOChildren.setMaterialDetailSerialNumberList(materialDetailSerialNumberChildrenList);
@@ -122,7 +139,202 @@ public class ShiftManageDomainService {
return shiftManagePO;
}
/**
* PDA移位页面:根据物料批次属性动态填充 materialMoreDetailList,有值显示
* 净重、毛重、体积、面积不在此展示,由 totalNetWeight 等在底部表单区显示
*/
private void fillMaterialMoreDetailForShiftDetail(ShiftMaterialDetailPO shiftMaterialDetailPO) {
if (shiftMaterialDetailPO == null || shiftMaterialDetailPO.getMaterialBaseInfoId() == null) {
shiftMaterialDetailPO.setMaterialMoreDetailList(new ArrayList<>());
return;
}
List<MaterialMoreDetailPO> materialMoreDetailList = new ArrayList<>();
AjaxResult ajaxResult = systemServiceFeign.getBatchDetailListByMaterialBaseInfoId(shiftMaterialDetailPO.getMaterialBaseInfoId());
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
List<BatchDetailFeignPO> batchList = JSON.parseArray(JSONObject.toJSONString(ajaxResult.get("data")), BatchDetailFeignPO.class);
materialMoreDetailList = filterAndConvertToMaterialMoreDetail(batchList);
}
// 上面区域不展示净重、毛重、体积、面积,排除这些批次属性
materialMoreDetailList = excludeWeightVolumeAreaFromList(materialMoreDetailList);
fillAttributeValueFromShiftMaterialDetail(shiftMaterialDetailPO, materialMoreDetailList);
// 有值显示:仅保留 attributeValue 非空的批次属性
List<MaterialMoreDetailPO> filtered = materialMoreDetailList.stream()
.filter(m -> m.getAttributeValue() != null && !m.getAttributeValue().trim().isEmpty())
.collect(Collectors.toList());
shiftMaterialDetailPO.setMaterialMoreDetailList(filtered);
}
/**
* 填充 totalNetWeight、totalGrossWeight、totalVolume、totalArea,供 PDA 表单区(移入数量、移入库位、容器旁)显示
* 优先用移位明细,无则用库存
*/
private void fillTotalWeightVolumeArea(ShiftMaterialDetailPO shiftMaterialDetailPO) {
if (shiftMaterialDetailPO == null) {
return;
}
if (shiftMaterialDetailPO.getTotalNetWeight() == null) {
if (shiftMaterialDetailPO.getNetWeight() != null) {
shiftMaterialDetailPO.setTotalNetWeight(shiftMaterialDetailPO.getNetWeight());
} else if (shiftMaterialDetailPO.getMaterialInventoryId() != null) {
MaterialInventory mi = materialInventoryService.getById(shiftMaterialDetailPO.getMaterialInventoryId());
if (mi != null && mi.getNetWeight() != null) {
shiftMaterialDetailPO.setTotalNetWeight(mi.getNetWeight());
}
}
}
if (shiftMaterialDetailPO.getTotalGrossWeight() == null) {
if (shiftMaterialDetailPO.getGrossWeight() != null) {
shiftMaterialDetailPO.setTotalGrossWeight(shiftMaterialDetailPO.getGrossWeight());
} else if (shiftMaterialDetailPO.getMaterialInventoryId() != null) {
MaterialInventory mi = materialInventoryService.getById(shiftMaterialDetailPO.getMaterialInventoryId());
if (mi != null && mi.getGrossWeight() != null) {
shiftMaterialDetailPO.setTotalGrossWeight(mi.getGrossWeight());
}
}
}
if (shiftMaterialDetailPO.getTotalVolume() == null) {
if (shiftMaterialDetailPO.getVolume() != null) {
shiftMaterialDetailPO.setTotalVolume(shiftMaterialDetailPO.getVolume());
} else if (shiftMaterialDetailPO.getMaterialInventoryId() != null) {
MaterialInventory mi = materialInventoryService.getById(shiftMaterialDetailPO.getMaterialInventoryId());
if (mi != null && mi.getVolume() != null) {
shiftMaterialDetailPO.setTotalVolume(mi.getVolume());
}
}
}
if (shiftMaterialDetailPO.getTotalArea() == null) {
if (shiftMaterialDetailPO.getArea() != null) {
shiftMaterialDetailPO.setTotalArea(shiftMaterialDetailPO.getArea());
} else if (shiftMaterialDetailPO.getMaterialInventoryId() != null) {
MaterialInventory mi = materialInventoryService.getById(shiftMaterialDetailPO.getMaterialInventoryId());
if (mi != null && mi.getArea() != null) {
shiftMaterialDetailPO.setTotalArea(mi.getArea());
}
}
}
}
/** 净重、毛重、体积、面积在移位上面区域不展示,从 materialMoreDetailList 中排除 */
private static final String[] WEIGHT_VOLUME_AREA_LABELS = {
"净重(KG)", "净重", "总净重",
"毛重(KG)", "毛重", "总毛重",
"体积(CBM)", "体积", "总体积",
"面积(SQM)", "面积", "总面积"
};
private List<MaterialMoreDetailPO> excludeWeightVolumeAreaFromList(List<MaterialMoreDetailPO> list) {
if (CollectionUtils.isEmpty(list)) {
return list;
}
return list.stream()
.filter(m -> {
String label = m.getBatchLabels();
if (label == null) return true;
for (String exclude : WEIGHT_VOLUME_AREA_LABELS) {
if (exclude.equals(label.trim())) return false;
}
return true;
})
.collect(Collectors.toList());
}
private List<MaterialMoreDetailPO> filterAndConvertToMaterialMoreDetail(List<BatchDetailFeignPO> batchList) {
List<MaterialMoreDetailPO> result = new ArrayList<>();
if (CollectionUtils.isEmpty(batchList)) {
return result;
}
for (BatchDetailFeignPO po : batchList) {
if (po.getIsDisplay() == null || po.getIsDisplay() != 1) {
continue;
}
MaterialMoreDetailPO mpo = new MaterialMoreDetailPO();
mpo.setBatchId(po.getBatchId());
mpo.setBatchDetailId(po.getBatchDetailId());
mpo.setBatchLabels(po.getBatchLabels());
mpo.setInputControl(po.getInputControl());
mpo.setAttributeFormat(po.getAttributeFormat());
mpo.setAttributeOption(po.getAttributeOption());
result.add(mpo);
}
return result;
}
private void fillAttributeValueFromShiftMaterialDetail(ShiftMaterialDetailPO shiftMaterialDetailPO, List<MaterialMoreDetailPO> materialMoreDetailList) {
if (CollectionUtils.isEmpty(materialMoreDetailList)) {
return;
}
MaterialInventory materialInventory = null;
if (shiftMaterialDetailPO.getMaterialInventoryId() != null) {
materialInventory = materialInventoryService.getById(shiftMaterialDetailPO.getMaterialInventoryId());
}
for (MaterialMoreDetailPO materialMoreDetail : materialMoreDetailList) {
if (materialMoreDetail.getAttributeValue() != null && !materialMoreDetail.getAttributeValue().trim().isEmpty()) {
continue;
}
String batchLabels = materialMoreDetail.getBatchLabels();
String attributeOption = materialMoreDetail.getAttributeOption();
String refVal = null;
// 净重、毛重、面积、体积:优先从移位明细,其次从库存
if (StringUtils.isNotBlank(batchLabels)) {
switch (batchLabels.trim()) {
case "总净重":
case "净重(KG)":
case "净重":
refVal = shiftMaterialDetailPO.getNetWeight() != null ? shiftMaterialDetailPO.getNetWeight().toString()
: (materialInventory != null && materialInventory.getNetWeight() != null ? materialInventory.getNetWeight().toString() : null);
break;
case "总毛重":
case "毛重(KG)":
case "毛重":
refVal = shiftMaterialDetailPO.getGrossWeight() != null ? shiftMaterialDetailPO.getGrossWeight().toString()
: (materialInventory != null && materialInventory.getGrossWeight() != null ? materialInventory.getGrossWeight().toString() : null);
break;
case "总体积":
case "体积(CBM)":
case "体积":
refVal = shiftMaterialDetailPO.getVolume() != null ? shiftMaterialDetailPO.getVolume().toString()
: (materialInventory != null && materialInventory.getVolume() != null ? materialInventory.getVolume().toString() : null);
break;
case "总面积":
case "面积(SQM)":
case "面积":
refVal = shiftMaterialDetailPO.getArea() != null ? shiftMaterialDetailPO.getArea().toString()
: (materialInventory != null && materialInventory.getArea() != null ? materialInventory.getArea().toString() : null);
break;
default:
break;
}
}
if (refVal == null && materialInventory != null) {
if ("InvoiceNo".equalsIgnoreCase(attributeOption) || "Invoice No".equalsIgnoreCase(batchLabels) || "发票号".equals(batchLabels)) {
refVal = materialInventory.getExtAttr1();
} else if ("扩展字段1".equals(batchLabels) || "扩展属性1".equals(batchLabels)) {
refVal = materialInventory.getExtAttr1();
} else if ("扩展字段2".equals(batchLabels) || "扩展属性2".equals(batchLabels)) {
refVal = materialInventory.getExtAttr2();
} else if ("BatchRefNo".equalsIgnoreCase(attributeOption) || "Batch Ref NO's".equalsIgnoreCase(batchLabels) || "批次参考号".equals(batchLabels)) {
refVal = materialInventory.getBatchRefNo();
} else if ("SheetRefNo".equalsIgnoreCase(attributeOption) || "Sheet Ref NO's".equalsIgnoreCase(batchLabels) || "单据参考号".equals(batchLabels)) {
refVal = materialInventory.getSheetRefNo();
} else if ("BoxPalletNo".equalsIgnoreCase(attributeOption) || "Box No./Pallet No.".equalsIgnoreCase(batchLabels) || "箱号/卡板号".equals(batchLabels)) {
refVal = materialInventory.getBoxPalletNo();
} else if (materialInventory.getProductionDate() != null && ("生产日期".equals(batchLabels) || "ProductionDate".equalsIgnoreCase(attributeOption))) {
refVal = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialInventory.getProductionDate());
} else if (materialInventory.getExpiryDate() != null && ("过期日期".equals(batchLabels) || "ExpiryDate".equalsIgnoreCase(attributeOption))) {
refVal = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialInventory.getExpiryDate());
} else if (materialInventory.getInventoryDate() != null && ("存货日期".equals(batchLabels) || "InventoryDate".equalsIgnoreCase(attributeOption))) {
refVal = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialInventory.getInventoryDate());
} else if (materialInventory.getExtAttr3() != null && ("扩展字段3".equals(batchLabels) || "扩展属性3".equals(batchLabels))) {
refVal = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialInventory.getExtAttr3());
} else if (materialInventory.getExtAttr4() != null && ("扩展字段4".equals(batchLabels) || "扩展属性4".equals(batchLabels))) {
refVal = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(materialInventory.getExtAttr4());
}
}
if (refVal != null) {
materialMoreDetail.setAttributeValue(refVal);
}
}
}
/**
* 新增移位管理
@@ -259,6 +259,21 @@ public class ShiftMaterialDetailPO extends BaseVOEntity {
@Excel(name = "面积")
private BigDecimal area;
@ApiModelProperty("总净重(KG)PDA 表单区显示")
@Excel(name = "总净重(KG)")
private BigDecimal totalNetWeight;
@ApiModelProperty("总毛重(KG)PDA 表单区显示")
@Excel(name = "总毛重(KG)")
private BigDecimal totalGrossWeight;
@ApiModelProperty("总体积(CBM)PDA 表单区显示")
@Excel(name = "总体积(CBM)")
private BigDecimal totalVolume;
@ApiModelProperty("总面积(SQM)PDA 表单区显示")
@Excel(name = "总面积(SQM)")
private BigDecimal totalArea;
@ApiModelProperty("移位详情")
@TableField(exist = false)
@@ -264,6 +264,15 @@ public class ShiftMaterialDetailDO extends BaseVOEntity {
@Excel(name = "面积")
private BigDecimal area;
@ApiModelProperty("总净重(KG),PDA 表单区修改后回传")
private BigDecimal totalNetWeight;
@ApiModelProperty("总毛重(KG),PDA 表单区修改后回传")
private BigDecimal totalGrossWeight;
@ApiModelProperty("总体积(CBM),PDA 表单区修改后回传")
private BigDecimal totalVolume;
@ApiModelProperty("总面积(SQM),PDA 表单区修改后回传")
private BigDecimal totalArea;
@ApiModelProperty("移位详情")
@TableField(exist = false)
private List<ShiftMaterialDetailDO> children;
@@ -256,6 +256,21 @@ public class ShiftMaterialDetailDTO extends BaseVOEntity {
@Excel(name = "面积")
private BigDecimal area;
@ApiModelProperty("总净重(KG)PDA 表单区显示")
@Excel(name = "总净重(KG)")
private BigDecimal totalNetWeight;
@ApiModelProperty("总毛重(KG)PDA 表单区显示")
@Excel(name = "总毛重(KG)")
private BigDecimal totalGrossWeight;
@ApiModelProperty("总体积(CBM)PDA 表单区显示")
@Excel(name = "总体积(CBM)")
private BigDecimal totalVolume;
@ApiModelProperty("总面积(SQM)PDA 表单区显示")
@Excel(name = "总面积(SQM)")
private BigDecimal totalArea;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
@@ -282,35 +282,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="delFlag" column="del_flag" />
</resultMap>
<!-- 1-按货主 2-按物料 3-按批次 4-按库位 5-按物料/库位 6-按容器 0-全部 -->
<sql id="materialQueryListByGroup">
<choose>
<when test="queryType != null and queryType == 1">
group by b.shipper_id
order by b.shipper_id
group by a.shipper_id, a.shipper_code, a.shipper_name
order by a.shipper_name
</when>
<when test="queryType != null and queryType == 2">
group by b.material_base_info_id
order by b.material_base_info_id
group by b.material_base_info_id, a.shipper_id, b.material_code, b.material_name, a.shipper_code, a.shipper_name
order by b.material_name, a.shipper_name
</when>
<when test="queryType != null and queryType == 3">
group by a.batch_number
order by b.material_name,a.batch_number
group by b.material_base_info_id, a.shipper_id, a.batch_number, b.material_code, b.material_name, a.shipper_code, a.shipper_name
order by b.material_name, a.shipper_name, a.batch_number
</when>
<when test="queryType != null and queryType == 4">
group by a.storage_location_id
order by a.storage_location_id
group by a.storage_location_id, a.storage_location_code, a.storage_location_name, a.storage_section_id, a.storage_code, a.storage_name
order by a.storage_location_code
</when>
<when test="queryType != null and queryType == 5">
group by b.material_base_info_id,a.storage_location_id
order by b.material_name,a.storage_location_id
group by b.material_base_info_id, a.storage_location_id, a.shipper_id, b.material_code, b.material_name, a.storage_location_code, a.storage_location_name, a.shipper_code, a.shipper_name
order by b.material_name, a.storage_location_code, a.shipper_name
</when>
<when test="queryType != null and queryType == 6">
group by a.container_id
order by a.container_type_name,b.material_name,a.storage_location_name
group by a.container_id, a.container_code, a.container_type, a.container_type_name
order by a.container_type_name, b.material_name, a.storage_location_name
</when>
<otherwise>
group by a.material_inventory_id
order by b.shipper_name,b.material_name,a.storage_location_name,a.batch_number
order by a.shipper_name, b.material_name, a.storage_location_name, a.batch_number
</otherwise>
</choose>
</sql>
@@ -38,6 +38,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialDetailUniqueId != null ">
and a.material_detail_unique_id = #{materialDetailUniqueId}
</if>
<if test="orderNumber != null and orderNumber != ''">
and a.order_number = #{orderNumber}
</if>
<if test="type != null ">
and a.type = #{type}
</if>
@@ -54,6 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="containerCode" column="container_code" />
<result property="containerType" column="container_type" />
<result property="containerTypeName" column="container_type_name" />
<result property="level" column="level" />
<result property="parentUniqueId" column="parent_unique_id" />
<result property="netWeight" column="net_weight" />
<result property="grossWeight" column="gross_weight" />
<result property="volume" column="volume" />
<result property="area" column="area" />
<result property="remark" column="remark" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />