PDA收货查询修改1111

This commit is contained in:
秦鸿展
2026-03-16 15:24:50 +08:00
parent 5aaef4db70
commit 17103690aa
5 changed files with 66 additions and 13 deletions
@@ -339,13 +339,17 @@ public class HandoverTaskOrderDomainService {
//库存数量
BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
//冻结数量
//可用数量
BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
//冻结数量(出库交接不变动冻结数量)
BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
//分配后库存数量
//扣减后库存数量
BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(checkQuantity);
//分配后冻结数量
BigDecimal newFreezeQuantity = oldFreezeQuantity.subtract(checkQuantity);
//扣减后可用数量
BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(checkQuantity);
BigDecimal newFreezeQuantity = oldFreezeQuantity;
@@ -366,6 +370,7 @@ public class HandoverTaskOrderDomainService {
BigDecimal newNetWeight = oldNetWeight.subtract(checkNetWeight);
materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
materialInventoryPO.setAllocationQuantity(newAllocationQuantity);
materialInventoryPO.setFreezeQuantity(newFreezeQuantity);
materialInventoryPO.setArea(newArea);
materialInventoryPO.setVolume(newVolume);
@@ -415,8 +420,8 @@ public class HandoverTaskOrderDomainService {
UserPo userPo = loginUser.getUserPo();
if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
inventoryAdjustmentRecord.setCreateTime(new Date());
inventoryAdjustmentRecord.setAllocationAfterQuantity(materialInventoryPO.getAllocationQuantity());
inventoryAdjustmentRecord.setAllocationBeforeQuantity(materialInventoryPO.getAllocationQuantity());
inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
inventoryAdjustmentRecord.setAllocationAfterQuantity(newAllocationQuantity);
inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity);
inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
@@ -523,4 +528,4 @@ public class HandoverTaskOrderDomainService {
}
}
@@ -417,7 +417,9 @@ public class PickingOrderDomainService {
.map(PickingOrder::getQuantity).filter(java.util.Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
BigDecimal thresholdQuantity = (totalPickingPlanQuantity != null && totalPickingPlanQuantity.compareTo(BigDecimal.ZERO) > 0)
? totalPickingPlanQuantity : (stockOutOrderDb.getQuantity() != null ? stockOutOrderDb.getQuantity() : BigDecimal.ZERO);
if (pickingQuantity.compareTo(thresholdQuantity) >= 0){
// 所有拣货单都已完成(status=3)时直接视为拣货完成,不依赖数量比较
boolean allPickingOrdersDone = allPickingOrders.stream().allMatch(o -> o.getStatus() != null && o.getStatus() == 3);
if (allPickingOrdersDone || pickingQuantity.compareTo(thresholdQuantity) >= 0){
status = 7;
if (pickingOrderPODb.getReview() == 2){
status = 9;
@@ -627,6 +629,8 @@ public class PickingOrderDomainService {
.set(PickingOrder::getUpdateByName, loginUser.getUsername())
.set(PickingOrder::getUpdateTime, new Date())
.eq(PickingOrder::getPickingOrderId, pickingOrderDO.getPickingOrderId()));
// 同步内存状态,确保后续 updateStockOutOrder 查DB时该单已是 status=3
pickingOrderPO.setStatus(3);
if (pickingOrderPO.getType() == 2){
//将分配数量分给子单
pickingMaterialDetailService.waveAssignUpdate(pickingOrderPO.getOrderNumber(), 2);
@@ -641,6 +645,20 @@ public class PickingOrderDomainService {
outOrderAbnormalService.genOutOrderAbnormal(outOrderAbnormalBaseDO, 1);
//更新出库单状态
updateStockOutOrder(pickingOrderPO);
// 点击完成拣货时,不管数量多少,强制将出库单状态推进到拣货完成(7)或已出库(9)
if (1 == pickingOrderPO.getType()) {
StockOutOrder forceUpdate = new StockOutOrder();
forceUpdate.setOutOrderNumber(pickingOrderPO.getOrderNumber());
int forceStatus = (pickingOrderPO.getReview() != null && pickingOrderPO.getReview() == 2) ? 9 : 7;
forceUpdate.setStatus(forceStatus);
forceUpdate.setUpdateBy(loginUser.getUserid());
forceUpdate.setUpdateByName(loginUser.getUsername());
forceUpdate.setUpdateTime(new Date());
stockOutOrderService.update(forceUpdate, new com.baomidou.mybatisplus.core.conditions.query.QueryWrapper<StockOutOrder>().lambda().eq(StockOutOrder::getOutOrderNumber, pickingOrderPO.getOrderNumber()));
if (pickingOrderPO.getReview() != null && pickingOrderPO.getReview() == 2) {
genHandoverTaskOrder(pickingOrderPO);
}
}
//同步BMS结算系统,生成业务单据
//这里只有不需要复核的时候才推送,需要复核的在复核流程推送
if(stockOutOrder.getReview()==2){
@@ -811,4 +829,4 @@ public class PickingOrderDomainService {
}
deliveTaskService.batchInsert(deliveTaskDOList);
}
}
}
@@ -737,7 +737,15 @@ public class ShiftMaterialDetailImpl extends ServiceImpl<ShiftMaterialDetailMapp
inventoryAdjustmentRecord.setMaterialBaseInfoId(shiftMaterialDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(shiftMaterialDetailDO.getMaterialCode());
inventoryAdjustmentRecord.setMaterialName(shiftMaterialDetailDO.getMaterialName());
inventoryAdjustmentRecord.setBarCode(shiftMaterialDetailDO.getBarCode());
// 按单移位明细中 barCode 可能未写入,当为空时从物料基础信息补充
String barCodeVal = shiftMaterialDetailDO.getBarCode();
if ((barCodeVal == null || barCodeVal.isEmpty()) && shiftMaterialDetailDO.getMaterialBaseInfoId() != null) {
MaterialBaseInfoPO materialBaseInfoPO = materialBaseInfoService.getInfo(shiftMaterialDetailDO.getMaterialBaseInfoId());
if (materialBaseInfoPO != null && materialBaseInfoPO.getBarCode() != null) {
barCodeVal = materialBaseInfoPO.getBarCode();
}
}
inventoryAdjustmentRecord.setBarCode(barCodeVal);
inventoryAdjustmentRecord.setMaterialBaseInfoId(shiftMaterialDetailDO.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setAdjustType(1L);
inventoryAdjustmentRecord.setOrganizationId(shiftMaterialDetailDO.getOrganizationId());
@@ -368,8 +368,7 @@ public class StockOutTaskOrderDomainService {
}
stockOutTaskOrderDO.setTaskNumber(stockOutTaskOrderPODb.getTaskNumber());
StockOutTaskOrderPO stockOutTaskOrderPO = taskPickingMaterialDetailService.batchPickingUpdate(stockOutTaskOrderDO);
//修改库存
updateMaterialInventory(stockOutTaskOrderDO);
// 拣货阶段不扣减库存库存在出库交接完成时统一扣减completeHandover -> xgkc
//设置拣货单拣货需要更新的数据数据
updateStockOutTaskOrder(stockOutTaskOrderPO, stockOutTaskOrderPODb, 2);
return true;
@@ -33,6 +33,8 @@ import com.mhd.wms.domain.inMaterialDetailSerialNumber.repository.todo.InMateria
import com.mhd.wms.domain.inOrderAbnormal.repository.facade.IInOrderAbnormalService;
import com.mhd.wms.domain.inOrderAbnormal.repository.todo.InOrderAbnormalBaseDO;
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
import com.mhd.wms.domain.materialBarCode.repository.facade.IMaterialBarCodeService;
import com.mhd.wms.domain.materialBarCode.repository.po.MaterialBarCodePO;
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.mapper.InventoryAdjustmentRecordMapper;
import com.mhd.wms.domain.inventoryStandingDetail.repository.facade.IInventoryStandingDetailService;
import com.mhd.wms.domain.inventoryStandingDetail.repository.todo.InventoryStandingDetailDO;
@@ -118,6 +120,8 @@ public class StockShelfOrderDomainService {
@Autowired
private MaterialInventoryMapper materialInventoryMapper;
@Autowired
private IMaterialBarCodeService materialBarCodeService;
@Autowired
private IMaterialGoodsRuleService materialGoodsRuleService;
@Autowired
private InventoryAdjustmentRecordMapper inventoryAdjustmentRecordMapper;
@@ -718,7 +722,26 @@ public class StockShelfOrderDomainService {
inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setMaterialCode(shelfMaterialDetail.getMaterialCode());
inventoryAdjustmentRecord.setMaterialName(shelfMaterialDetail.getMaterialName());
inventoryAdjustmentRecord.setBarCode(shelfMaterialDetail.getBarCode());
// 条码优先取上架明细上的条码如果为空则根据物料基础信息ID从物料条码表中获取单位代码为EA的条码
String shelfBarCode = shelfMaterialDetail.getBarCode();
if (StringUtils.isBlank(shelfBarCode) && shelfMaterialDetail.getMaterialBaseInfoId() != null) {
try {
java.util.List<MaterialBarCodePO> barCodeList = materialBarCodeService.getInfoByMaterialBaseInfoIds(shelfMaterialDetail.getMaterialBaseInfoId());
if (barCodeList != null && !barCodeList.isEmpty()) {
// 优先选择单位代码为EA的条码若不存在则取第一条
MaterialBarCodePO eaBarCode = barCodeList.stream()
.filter(po -> "EA".equals(po.getUnitCode()))
.findFirst()
.orElse(barCodeList.get(0));
if (eaBarCode != null && StringUtils.isNotBlank(eaBarCode.getBarCode())) {
shelfBarCode = eaBarCode.getBarCode();
}
}
} catch (Exception e) {
log.warn("根据物料基础信息ID获取条码失败,materialBaseInfoId={},错误:{}", shelfMaterialDetail.getMaterialBaseInfoId(), e.getMessage());
}
}
inventoryAdjustmentRecord.setBarCode(shelfBarCode);
inventoryAdjustmentRecord.setMaterialBaseInfoId(shelfMaterialDetail.getMaterialBaseInfoId());
inventoryAdjustmentRecord.setOrganizationId(stockReceiptOrderDO.getOrganizationId());
inventoryAdjustmentRecord.setOrganizationName(stockReceiptOrderDO.getOrganizationName());