Forráskód Böngészése

质检、理货备货bug修复、web优化

zhangxin 1 éve
szülő
commit
eb8ee0421e

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -779,6 +779,17 @@ public class PdaController {
         return AjaxResult.success(pickingListVOS);
     }
 
+    /**
+     * 获取托盘库存数量
+     * @param palletNo
+     * @return
+     */
+    @GetMapping("/getPalletInvCount")
+    public AjaxResult getPalletInvCount(@RequestParam String palletNo){
+        BigDecimal invCount = wmsDocOrderHeaderService.getPalletInvCount(palletNo);
+        return AjaxResult.success(invCount);
+    }
+
     /**
      * 出库货位释放
      * 出库完成后,人工拉走出库位货物,扫描库位码,清除库存解绑托盘

+ 5 - 1
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.ams.asn.service.impl;
 
 import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 import com.ruoyi.ams.asn.form.PaForm;
@@ -657,7 +658,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
      * @param unlockForm
      * @return
      */
-    @Transactional
+    @Transactional(rollbackFor = Exception.class)
     @Override
     public AjaxResult unloadStock(UnlockForm unlockForm) {
         int sum = 0;
@@ -697,6 +698,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             unbindWmsDocAsnHeader(qtt.getLotatt08(), inv.getQty(), inv.getSku(), qtt.getLotatt02());
             //删除库存
             invLotLocIdMapper.deleteInvLotLocIdBy(inv.getLotnum(), inv.getSku(), inv.getLocationId(), inv.getCustomerId());
+            invLotAttService.update(new InvLotAtt(), Wrappers.<InvLotAtt>lambdaUpdate()
+                    .set(InvLotAtt::getRemark, "cause is pda main unbind")
+                    .eq(InvLotAtt::getLotnum, qtt.getLotnum()));
         }
         return AjaxResult.success("解绑成功!" + unlockForm.getSku() + ",数量:" + sum);
     }

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

@@ -164,7 +164,7 @@ public class InvLotLocIdServiceImpl extends CrudServiceImpl<InvLotLocIdMapper, I
     @Override
     public List<InvLotLocIdLotattVO> selectInvLocIdLotattList(InvLocIdSearchFrom invLocIdSearchFrom) {
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = selectInvLocIdLotattVOList(invLocIdSearchFrom);
-        return supplementInvLotLocIdLotattVO(invLotLocIdLotattVOList);
+        return CollectionUtil.isNotEmpty(invLotLocIdLotattVOList) ? supplementInvLotLocIdLotattVO(invLotLocIdLotattVOList) : Lists.newArrayList();
     }
 
     private List<InvLotLocIdLotattVO> selectInvLocIdLotattVOList(InvLocIdSearchFrom invLocIdSearchFrom) {

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/service/IWmsDocOrderHeaderService.java

@@ -510,4 +510,6 @@ public interface IWmsDocOrderHeaderService {
      * @param orderNo
      */
     Boolean updateWmsDocOrderHeaderStatus(String orderNo);
+
+    BigDecimal getPalletInvCount(String palletNo);
 }

+ 27 - 15
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -280,7 +280,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * @param orderNo
      * @return
      */
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     @Override
     public AjaxResult doAllocation(String orderNo) {
         WmsDocOrderHeader orderHeader = wmsDocOrderHeaderMapper.selectWmsDocOrderHeaderByOrderNo(orderNo);
@@ -332,7 +332,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * @param orderNo
      * @return
      */
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     @Override
     public AjaxResult doAllocationBH(String orderNo) {
         WmsDocOrderHeader orderHeader = wmsDocOrderHeaderMapper.selectWmsDocOrderHeaderByOrderNo(orderNo);
@@ -697,12 +697,13 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
 //            pickingListVOS.add(pickingListVO);
 //        }
         // 二次组盘查询不到
-        if (pickingListVOS.size() == 0) {
+
             InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
             LotattDTO lotattDTO = new LotattDTO();
             lotattDTO.setLotatt07(palletNo);
             invLocIdSearchFrom.setLotattDTO(lotattDTO);
             List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+            if (CollectionUtil.isEmpty(invLotLocIdLotattVOList)) return pickingListVOS;
             for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
                 String orderNo = locIdLotattVO.getLotatt14();
                 WmsDocOrderHeader wmsDocOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
@@ -718,7 +719,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 pickingListVO.setModel(locIdLotattVO.getSkuModel());
                 pickingListVOS.add(pickingListVO);
             }
-        }
+
         return CollectionUtil.isNotEmpty(pickingListVOS) ? pickingListVOS.stream().
                 sorted(Comparator.comparing(PickingListVO::getOrderNo, Comparator.nullsLast(String::compareTo))).collect(Collectors.toList()) : pickingListVOS;
     }
@@ -979,7 +980,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         return endCheckOutVOList;
     }
 
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     @Override
     public AjaxResult doCheckout(CheckOutInfoForm check) {
 //        String orderNo = check.getOrderNo();
@@ -2235,7 +2236,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         return codeSkuRelationshipSoVO;
     }
 
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     @Override
     public AjaxResult addOrUpdateErp(List<ErpOrderList> erpOrderList) {
         try {
@@ -2840,7 +2841,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * 库存匹配
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public Boolean inventoryMatch(String orderNos) {
         List<String> orderList = JSONArray.parseArray(orderNos, String.class);
         List<PalletMatchLog> palletMatchLogList = palletMatchLogService.checkOrderNoAndGetPalletMatchLogList(orderList);
@@ -2852,7 +2853,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * 分拣出库
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public Boolean separatePick(String orderNos) {
         List<String> orderList = JSONArray.parseArray(orderNos, String.class);
         List<WmsDocOrderHeader> wmsDocOrderHeaderList = wmsDocOrderHeaderMapper.selectList(Wrappers.<WmsDocOrderHeader>lambdaQuery().
@@ -2882,7 +2883,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * 反拣出库
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public Boolean reversePickInventoryMatch(String orderNos) {
         List<String> orderList = JSONArray.parseArray(orderNos, String.class);
         palletMatchLogService.checkOrderNoAndGetPalletMatchLogList(orderList);
@@ -2920,7 +2921,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * PDA理货备货/分拣组盘(不传出库单号)
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public AjaxResult pdaGroupDisk(PdaGroupDiskDTO pdaGroupDiskDTO) {
         GroupDiskConvertDTO groupDiskConvertDTO = buildGroupDiskConvertDTO(pdaGroupDiskDTO);
         String locationId = invLotLocGroupDisk(groupDiskConvertDTO);
@@ -2935,7 +2936,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * PDA反拣组盘
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public AjaxResult pdaReversePickGroupDisk(ReversePickGroupDiskDTO reversePickGroupDiskDTO){
         ReversePickConvertDTO reversePickConvertDTO = buildReversePickConvertDTO(reversePickGroupDiskDTO);
         //判断反拣类型为解绑还是扩容
@@ -2963,7 +2964,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
      * PDA解绑物料
      */
     @Override
-    @Transactional(propagation = Propagation.REQUIRES_NEW)
+    @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
     public AjaxResult pdaUnbind(UnbindDTO unbindDTO) {
         InvLotLocId invLotLocId = invLotLocIdService.queryInvLotLocIdByLotnum(unbindDTO.getLotnum());
         Long locationId = unbindWmsBox(unbindDTO.getPalletTo(), unbindDTO.getPalletFrom());
@@ -3173,6 +3174,16 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 .eq(WmsDocOrderHeader::getOrderNo, orderNo))  > 0;
     }
 
+    @Override
+    public BigDecimal getPalletInvCount(String palletNo) {
+        List<InvLotAtt> invLotAttList = invLotAttService.queryInvLotAtt(palletNo);
+        if (CollectionUtil.isEmpty(invLotAttList)) return BigDecimal.ZERO;
+        List<InvLotLocId> invLotLocIdList = invLotLocIdService.queryInvLotLocIdByLotnum(invLotAttList.stream().map(InvLotAtt::getLotnum).collect(Collectors.toList()));
+        if (CollectionUtil.isEmpty(invLotLocIdList)) return BigDecimal.ZERO;
+        long count = invLotLocIdList.stream().filter(item -> Constant.LOC_SORTATION_CACHE.equals(Long.parseLong(item.getLocationId()))).count();
+        return new BigDecimal(count);
+    }
+
     private void unbindWmsDocOrder(String erpNo, String orderNo, BigDecimal qty, String sku, String sn){
         List<WmsDocOrderDetails> wmsDocOrderDetailsList = wmsDocOrderDetailsService.queryWmsDocOrderDetails(orderNo, sku);
         if (CollectionUtil.isEmpty(wmsDocOrderDetailsList)) throw new BaseException("出库单明细为空!");
@@ -3253,10 +3264,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         String asnNo = invLotAttList.stream().filter(item -> item.getLotnum().equals(invLotLocId.getLotnum())).
                 map(InvLotAtt::getLotatt08).findFirst().orElseThrow(() -> new BaseException("此批次入库信息丢失!"));
         String sku = groupDiskConvertDTO.getSku();
-        invLotAttService.insertInvLotAtt(buildInvLotAtt(groupDiskConvertDTO.getLotNum(), groupDiskConvertDTO.getPalletTo(),
-                orderNo, sn, sku, asnNo, "cause is pda group disk"));
         //验证托盘相关信息并获取指向托盘库位信息
         String locationId = verifyInvLotAndGetLocationId(groupDiskConvertDTO.getPalletTo(), sn, orderNo);
+        invLotAttService.insertInvLotAtt(buildInvLotAtt(groupDiskConvertDTO.getLotNum(), groupDiskConvertDTO.getPalletTo(),
+                orderNo, sn, sku, asnNo, "cause is pda group disk"));
         locationId = StringUtils.isNotBlank(locationId) ? locationId : invLotLocId.getLocationId();
         if (CompareUtil.compare(groupDiskConvertDTO.getGroupDiskQty(), invLotLocQty) >= 0) {
             invLotLocIdService.updateInvLotLocId(invLotLocId.getLotnum(), groupDiskConvertDTO.getLotNum(),
@@ -3327,7 +3338,8 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         List<InvLotAtt> palletNoToInvLotAttList = invLotAttService.queryInvLotAtt(palletNoTo);
         if (CollectionUtil.isEmpty(palletNoToInvLotAttList)) return null;
         if (StringUtils.isNotBlank(sn) && CollectionUtil.isNotEmpty(palletNoToInvLotAttList.stream()
-                .filter(item -> item.getLotatt02().equals(sn)).collect(Collectors.toList()))) {
+                .filter(item -> (StringUtils.isNotBlank(orderNo) ? StringUtils.isNotBlank(item.getLotatt14()) : Boolean.TRUE)
+                        && item.getLotatt02().equals(sn)).collect(Collectors.toList()))) {
             throw new BaseException("该条码已生成批次");
         }
         //验证是否已经有不同出库单备货了