Quellcode durchsuchen

组盘库存分配、出库单明细数量调整

zhangxin vor 1 Jahr
Ursprung
Commit
f5b2731a29

+ 2 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -444,9 +444,10 @@ public interface IInvLotLocIdService {
      * @param lotNum
      * @param lotNumTo
      * @param locationId
+     * @param qtyAllocated
      * @return
      */
-    Boolean updateInvLotLocIdLotNum(String lotNum, String lotNumTo, String locationId);
+    Boolean updateInvLotLocIdLotNum(String lotNum, String lotNumTo, String locationId, BigDecimal qtyAllocated);
 
     /**
      * 修改库位库存信息

+ 2 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -1172,11 +1172,12 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
      * @return
      */
     @Override
-    public Boolean updateInvLotLocIdLotNum(String lotNum, String lotNumTo, String locationId) {
+    public Boolean updateInvLotLocIdLotNum(String lotNum, String lotNumTo, String locationId, BigDecimal qtyAllocated) {
         return invLotLocIdMapper.update(new InvLotLocId(), Wrappers.<InvLotLocId>lambdaUpdate()
                 .eq(InvLotLocId::getLotnum, lotNum)
                 .set(StringUtils.isNotBlank(lotNumTo), InvLotLocId::getLotnum, lotNumTo)
                 .set(StringUtils.isNotBlank(locationId), InvLotLocId::getLocationId, locationId)
+                .set(InvLotLocId::getQtyallocated, qtyAllocated)
         ) > 0;
     }
 

+ 2 - 3
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -2769,7 +2769,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         invLotAttService.insertInvLotAtt(buildInvLotAtt(lotNum, unbindWmsBoxDTO.getPalletFrom(), null, invLotAtt.getLotatt02()
                 , unbindWmsBoxDTO.getSku(), StringUtils.isNotBlank(invLotAtt.getLotatt08()) ? invLotAtt.getLotatt08() : null));
         //修改库存
-        invLotLocIdService.updateInvLotLocIdLotNum(invLotLocId.getLotnum(), lotNum, String.valueOf(locationId));
+        invLotLocIdService.updateInvLotLocIdLotNum(invLotLocId.getLotnum(), lotNum, String.valueOf(locationId), BigDecimal.ZERO);
         if (StringUtils.isBlank(unbindWmsBoxDTO.getErpNo())) return AjaxResult.success("托盘:" + unbindWmsBoxDTO.getPalletTo() + "解绑成功!");
 
         WmsDocOrderHeader wmsDocOrderHeader = selectWmsDocOrderHeaderByErpNo(unbindWmsBoxDTO.getErpNo());
@@ -2779,8 +2779,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         if (CollectionUtil.isEmpty(wmsDocOrderDetailsList)) throw new BaseException("出库单明细为空!");
         wmsDocOrderDetailsList = ListUtil.reverse(wmsDocOrderDetailsList.stream().filter(item -> ObjectUtil.isNotNull(item.getQtyAllocated())
                 || !NumberUtil.equals(item.getQtyAllocated(), BigDecimal.ZERO)).collect(Collectors.toList()));
-        BigDecimal qtyAllocated = ObjectUtil.isNotNull(invLotLocId.getQtyallocated()) ? invLotLocId.getQtyallocated() : BigDecimal.ZERO;
-        BigDecimal qty = invLotLocId.getQty().subtract(qtyAllocated);
+        BigDecimal qty = invLotLocId.getQty();
 
         for (WmsDocOrderDetails wmsDocOrderDetails : wmsDocOrderDetailsList) {
             Boolean flag = CompareUtil.compare(qty, wmsDocOrderDetails.getQtyAllocated()) >= 0;