PDA出库交接修改

This commit is contained in:
秦鸿展
2026-03-16 19:19:41 +08:00
parent b738a6719c
commit 9ae80406e2
5 changed files with 85 additions and 5 deletions
@@ -47,7 +47,8 @@ public class DeliveTaskApplicationService {
if (topOrganizationId != null && topOrganizationId != 1){
deliveTaskDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
// operatorsBy 仅由 DeliveTaskImpl 根据 tabType 设置,此处不覆盖,保证条件查询生效
// 只查询下发给当前登录用户的任务
deliveTaskDO.setOperatorsBy(loginUser.getUserid());
}
return deliveTaskDomainService.queryListApp(deliveTaskDO);
}
@@ -394,7 +394,7 @@ public class HandoverTaskOrderDomainService {
inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
if (inventoryAdjustmentRecord.getBarCode().equals("")){
if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
}
inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
@@ -738,18 +738,32 @@ public class ShiftManageDomainService {
shiftQuantity = shiftMaterialDetailPOChildrenList.stream()
.map(c -> c.getShiftQuantity() != null ? c.getShiftQuantity() : BigDecimal.ZERO)
.reduce(BigDecimal.ZERO, BigDecimal::add);
shiftMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailMap.get(shiftMaterialDetailPO.getUniqueId()));
List<MaterialMoreDetailPO> parentMoreDetail = materialMoreDetailMap.get(shiftMaterialDetailPO.getUniqueId());
// 若前端未传批次属性,则从原库存补充
if (CollectionUtils.isEmpty(parentMoreDetail)) {
parentMoreDetail = buildMaterialMoreDetailFromInventory(materialInventoryOldDb);
}
shiftMaterialDetailPO.setMaterialMoreDetailList(parentMoreDetail);
for (ShiftMaterialDetailPO shiftMaterialDetailPOChildren : shiftMaterialDetailPOChildrenList) {
List<MaterialMoreDetailPO> childMoreDetail = materialMoreDetailMap.get(shiftMaterialDetailPOChildren.getUniqueId());
if (childMoreDetail == null) {
if (CollectionUtils.isEmpty(childMoreDetail)) {
childMoreDetail = materialMoreDetailMap.get(shiftMaterialDetailPO.getUniqueId());
}
// 若仍为空,则从原库存补充
if (CollectionUtils.isEmpty(childMoreDetail)) {
childMoreDetail = buildMaterialMoreDetailFromInventory(materialInventoryOldDb);
}
shiftMaterialDetailPOChildren.setMaterialMoreDetailList(childMoreDetail);
materialInventoryNowList.add(genMaterialInventory(shiftMaterialDetailPOChildren));
}
} else {
shiftQuantity = shiftMaterialDetailPO.getShiftQuantity() != null ? shiftMaterialDetailPO.getShiftQuantity() : BigDecimal.ZERO;
shiftMaterialDetailPO.setMaterialMoreDetailList(materialMoreDetailMap.get(shiftMaterialDetailPO.getUniqueId()));
List<MaterialMoreDetailPO> moreDetail = materialMoreDetailMap.get(shiftMaterialDetailPO.getUniqueId());
// 若前端未传批次属性,则从原库存补充
if (CollectionUtils.isEmpty(moreDetail)) {
moreDetail = buildMaterialMoreDetailFromInventory(materialInventoryOldDb);
}
shiftMaterialDetailPO.setMaterialMoreDetailList(moreDetail);
materialInventoryNowList.add(genMaterialInventory(shiftMaterialDetailPO));
}
if (materialInventoryOldDb.getInventoryQuantity().compareTo(shiftQuantity) < 0){
@@ -881,10 +895,69 @@ public class ShiftManageDomainService {
BeanUtils.copyProperties(materialInventoryDb, materialInventoryDONow);
materialInventoryDONow.setInventoryQuantity(shiftMaterialDetailPO.getShiftQuantity());
materialInventoryDONow.setAllocationQuantity(shiftMaterialDetailPO.getShiftQuantity());
// 目标库位已存在时,用 materialMoreDetailList 覆盖批次属性(保证批次属性随移位写入)
BatchAttributeAssignment(materialMoreDetailList, materialInventoryDONow);
return materialInventoryDONow;
}
}
/**
* 从库存对象构建 MaterialMoreDetailList,供前端未传批次属性时兜底使用
*/
private List<MaterialMoreDetailPO> buildMaterialMoreDetailFromInventory(MaterialInventory inv) {
List<MaterialMoreDetailPO> list = new ArrayList<>();
if (inv == null) return list;
if (inv.getProductionDate() != null) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("生产日期");
m.setAttributeValue(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(inv.getProductionDate()));
list.add(m);
}
if (inv.getExpiryDate() != null) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("过期日期");
m.setAttributeValue(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(inv.getExpiryDate()));
list.add(m);
}
if (inv.getInventoryDate() != null) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("存货日期");
m.setAttributeValue(new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(inv.getInventoryDate()));
list.add(m);
}
if (inv.getBatchRefNo() != null && !inv.getBatchRefNo().isEmpty()) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("Batch Ref NO's");
m.setAttributeValue(inv.getBatchRefNo());
list.add(m);
}
if (inv.getSheetRefNo() != null && !inv.getSheetRefNo().isEmpty()) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("Sheet Ref NO's");
m.setAttributeValue(inv.getSheetRefNo());
list.add(m);
}
if (inv.getBoxPalletNo() != null && !inv.getBoxPalletNo().isEmpty()) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("箱号/卡板号");
m.setAttributeValue(inv.getBoxPalletNo());
list.add(m);
}
if (inv.getExtAttr1() != null && !inv.getExtAttr1().isEmpty()) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("扩展属性1");
m.setAttributeValue(inv.getExtAttr1());
list.add(m);
}
if (inv.getExtAttr2() != null && !inv.getExtAttr2().isEmpty()) {
MaterialMoreDetailPO m = new MaterialMoreDetailPO();
m.setBatchLabels("扩展属性2");
m.setAttributeValue(inv.getExtAttr2());
list.add(m);
}
return list;
}
private void BatchAttributeAssignment(List<MaterialMoreDetailPO> materialMoreDetailList, MaterialInventoryDO materialInventoryDONow) {
if (CollectionUtils.isEmpty(materialMoreDetailList)) {
return;
@@ -119,6 +119,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tabType != null and tabType==2">
and operators_by IS NULL
</if>
<if test="tabType == null and operatorsBy != null">
and operators_by = #{operatorsBy}
</if>
<if test="operatorsName != null and operatorsName != ''">
and operators_name like concat('%', #{operatorsName}, '%')
@@ -124,6 +124,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pickingOrderNumber != null and pickingOrderNumber != ''">
and a.picking_order_number = #{pickingOrderNumber}
</if>
<if test="operatorsBy != null">
and a.operators_by = #{operatorsBy}
</if>
<if test="createByName != null and createByName != ''">
and a.create_by_name like concat('%', #{createByName}, '%')
</if>