Browse Source

测试修改

k 2 years ago
parent
commit
b71d0f244c

+ 9 - 14
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -53,6 +53,7 @@ import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.system.service.ISysDictDataService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
@@ -148,6 +149,7 @@ public class PdaController {
      * @param paForm
      * @return
      */
+    @Transactional
     @PostMapping("/docAsn/doPa")
     public AjaxResult doPa(@RequestBody PaForm paForm) {
         if (StringUtils.isEmpty(paForm.getPalletNo())) {
@@ -169,6 +171,7 @@ public class PdaController {
      * @param lineCallForm
      * @return
      */
+    @Transactional
     @PostMapping("/lineCall/pulling")
     public AjaxResult pulling(@RequestBody LineCallForm lineCallForm) {
         //查询所属流程
@@ -196,7 +199,7 @@ public class PdaController {
                 paForm.setLocationFrom(Constant.LOC_STAGE_CACHE.toString());
                 paForm.setLocationTo(lform.getLocationFrom());
                 paForm.setFlowId(lineCallForm.getFlowId().intValue());
-                AjaxResult ajaxResult = doPa(paForm);
+                AjaxResult ajaxResult = wmsDocAsnHeaderService.doPa(paForm);
                 if (!ajaxResult.isSuccess()) {
                     return ajaxResult;
                 }
@@ -343,7 +346,6 @@ public class PdaController {
     //endregion
 
 
-
     //region PDA出库
 
     /**
@@ -414,14 +416,10 @@ public class PdaController {
      * @return
      */
     @PostMapping("/docOrder/groupDisk")
-    public AjaxResult groupDisk(GroupDiskFrom groupDiskFrom) {
-        if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
-            String orderNo = wmsDocOrderHeaderService.changeErpNoToOrderNo(groupDiskFrom.getOrderNo());
-            if (StringUtils.isEmpty(orderNo)) {
-                return AjaxResult.error("请扫描正确的出库单号");
-            }
-            groupDiskFrom.setOrderNo(orderNo);
-        }
+    public AjaxResult groupDisk(@RequestBody GroupDiskFrom groupDiskFrom) {
+        // 可以不传出库单号
+        String orderNo = wmsDocOrderHeaderService.changeErpNoToOrderNo(groupDiskFrom.getOrderNo());
+        groupDiskFrom.setOrderNo(orderNo);
         return wmsDocOrderHeaderService.groupDisk(groupDiskFrom);
     }
 
@@ -497,6 +495,7 @@ public class PdaController {
     //endregion
 
     //region 基础操作
+
     /**
      * PDA扫码查询库位信息
      *
@@ -519,10 +518,6 @@ public class PdaController {
     //endregion
 
 
-
-
-
-
     /**
      * 初始化托盘
      *

+ 6 - 0
ruoyi-ui/src/views/wms/docOrder/docOrderDetails.vue

@@ -45,6 +45,12 @@
         align="center"
         label="分配数量">
       </el-table-column>
+      <el-table-column
+        prop="qtySoftAllocated"
+        header-align="center"
+        align="center"
+        label="备货数量">
+      </el-table-column>
       <el-table-column
         prop="qtyPicked"
         header-align="center"

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

@@ -28,6 +28,7 @@ import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
 import com.ruoyi.ams.order.dto.WmsDocOrderDTO;
 import com.ruoyi.ams.order.form.ActAllocationDetailsFrom;
 import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
+import com.ruoyi.ams.order.mapper.WmsDocOrderHeaderMapper;
 import com.ruoyi.ams.order.service.IActAllocationDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.base.constant.Constant;
@@ -75,6 +76,8 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
     @Autowired
     private WmsDocOrderDetailsMapper wmsDocOrderDetailsMapper;
     @Autowired
+    private WmsDocOrderHeaderMapper wmsDocOrderHeaderMapper;
+    @Autowired
     private IBaseSkuService baseSkuService;
     @Autowired
     private IWmsBoxInfoService wmsBoxInfoService;
@@ -480,7 +483,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
                             //生成库存
                             LotattDTO lotattDTO = new LotattDTO();
 //                            if (codeSkuRelationshipVO.isProduct()) {
-                                lotattDTO.setLotatt02(stockForm.getSkuSn());
+                            lotattDTO.setLotatt02(stockForm.getSkuSn());
 //                            }
                             lotattDTO.setLotatt05("90");
                             lotattDTO.setLotatt07(stockForm.getPalletNo());
@@ -546,20 +549,71 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             // 判断上架的库存是否已经上架
             BaseLocationInfo baseLocInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(inv.getLocationId(), Constant.WAREHOUSE_ID);
             if (baseLocInfo.getZoneId().equals(Constant.ZONE_TYPE.ZONE_INV.getValue())) {
-                return AjaxResult.error("库存已经在货架上:" + baseLocInfo.getLocationNo());
+                return AjaxResult.error("托盘已经在货架上:" + baseLocInfo.getLocationNo());
             }
 
             InvLotAtt invLotAtt = invLotAttService.selectInvLotAttByLotnum(inv.getLotnum());
             invLotAtt.setLotatt12("Y");
             invLotAttService.updateInvLotAtt(invLotAtt);
 
-            //更新库位状态
             //更新托盘库存到起始库位
-            //invLotLocIdMapper.updateInvLotLocIdLocationId(Long.parseLong(inv.getLocationId()), Long.parseLong(paForm.getLocationTo()));
-            invLotLocIdMapper.updateInvLotLocIdToByLotnum(inv.getLotnum(), locationTo.getId());
+            invLotLocIdMapper.updateInvLotLocIdToByLotnum(inv.getLotnum(), inv.getSku(), inv.getCustomerId(), inv.getLocationId()
+                    , locationTo.getId());
 
             // 回库不修改入库单据
             if (flowId == Constant.FLOW_ID_RSO) {
+                // 修改备货状态
+                if (StringUtils.isNotEmpty(invLotAtt.getLotatt14())) {
+                    String orderNo = invLotAtt.getLotatt14();
+                    WmsDocOrderHeader docOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+                    if (docOrderHeader == null || !docOrderHeader.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())) {
+                        continue;
+                    }
+                    String sku = inv.getSku();
+                    BigDecimal qty = inv.getQty();
+                    // 明细
+                    List<WmsDocOrderDetails> wmsDocOrderDetails = wmsDocOrderDetailsMapper.selectWmsDocOrderDetailsByOrderNo(orderNo);
+                    for (WmsDocOrderDetails wmsDocOrderDetail : wmsDocOrderDetails) {
+                        if (wmsDocOrderDetail.getLineStatus().equals(Constant.ORDER_STS.STS10.getValue())
+                                || wmsDocOrderDetail.getLineStatus().equals(Constant.ORDER_STS.STS20.getValue())
+                                || wmsDocOrderDetail.getLineStatus().equals(Constant.ORDER_STS.STS22.getValue())) {
+                            if (sku.equals(wmsDocOrderDetail.getSku())) {
+                                BigDecimal toQty = wmsDocOrderDetail.getQtyAllocated().subtract(wmsDocOrderDetail.getQtySoftAllocated());
+                                WmsDocOrderDetails detailsUpdate = new WmsDocOrderDetails();
+                                detailsUpdate.setOrderNo(wmsDocOrderDetail.getOrderNo());
+                                detailsUpdate.setOrderLineNo(wmsDocOrderDetail.getOrderLineNo());
+                                if (qty.compareTo(toQty) == 0) {
+                                    detailsUpdate.setQtySoftAllocated(wmsDocOrderDetail.getQtyAllocated());
+                                    detailsUpdate.setLineStatus(Constant.ORDER_STS.STS23.getValue());
+                                } else if (qty.compareTo(toQty) == 1) {
+                                    qty = qty.subtract(toQty);
+                                    detailsUpdate.setQtySoftAllocated(wmsDocOrderDetail.getQtyAllocated());
+                                    detailsUpdate.setLineStatus(Constant.ORDER_STS.STS23.getValue());
+                                } else {
+                                    detailsUpdate.setQtySoftAllocated(wmsDocOrderDetail.getQtySoftAllocated().add(qty));
+                                    detailsUpdate.setLineStatus(Constant.ORDER_STS.STS22.getValue());
+                                }
+                                wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(detailsUpdate);
+                                //修改头单状态
+                                String soStatus = Constant.ORDER_STS.STS23.getValue();
+                                List<WmsDocOrderDetails> wmsDocOrderDetailsList = wmsDocOrderDetailsMapper.selectWmsDocOrderDetailsByOrderNo(orderNo);
+                                for (WmsDocOrderDetails d : wmsDocOrderDetailsList) {
+                                    if (!d.getLineStatus().equals(Constant.ORDER_STS.STS23.getValue())) {
+                                        soStatus = Constant.ORDER_STS.STS22.getValue();
+                                        break;
+                                    }
+                                }
+                                WmsDocOrderHeader headerUpdate = new WmsDocOrderHeader();
+                                headerUpdate.setOrderNo(orderNo);
+                                headerUpdate.setOrderStatus(soStatus);
+                                headerUpdate.setUpdateBy(loginUser.getUsername());
+                                headerUpdate.setUpdateTime(new Date());
+                                wmsDocOrderHeaderMapper.updateWmsDocOrderHeader(headerUpdate);
+                            }
+                        }
+                    }
+
+                }
                 continue;
             }
 

+ 3 - 1
warewms-ams/src/main/java/com/ruoyi/ams/box/service/impl/WmsBoxInfoServiceImpl.java

@@ -147,7 +147,9 @@ public class WmsBoxInfoServiceImpl implements IWmsBoxInfoService {
             InvLotAtt queryAtt = new InvLotAtt();
             queryAtt.setLotatt07(addBoxForm.getBoxNo());
             List<InvLotLocId> invLotLocIds = invLotLocIdMapper.queryInvByInvLotatt(queryAtt);
-            invLotLocIdMapper.updateInvLotLocIdToByLotnum(invLotLocIds.get(0).getLotnum(), Long.parseLong(addBoxForm.getLocationId()));
+            InvLotLocId locId = invLotLocIds.get(0);
+            invLotLocIdMapper.updateInvLotLocIdToByLotnum(locId.getLotnum(), locId.getSku(), locId.getCustomerId(), locId.getLocationId()
+                    , Long.parseLong(addBoxForm.getLocationId()));
 
             return AjaxResult.error("操作成功");
         } else {

+ 3 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -195,7 +195,9 @@ public interface InvLotLocIdMapper {
      * @param locationTo
      * @return
      */
-    int updateInvLotLocIdToByLotnum(@Param("lotnum") String lotnum, @Param("locationTo") Long locationTo);
+    int updateInvLotLocIdToByLotnum(@Param("lotnum") String lotnum,@Param("sku") String sku
+            ,@Param("customerId") String customerId,@Param("locationId") String locationId
+            , @Param("locationTo") Long locationTo);
 
     /**
      * 清除库位库存信息

+ 60 - 30
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -298,6 +298,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             return AjaxResult.error("出库明细为创建状态才可以分配!");
         }
         LotattDTO lotattDTO = new LotattDTO();
+        // 备货分配
         if (!StringUtils.isEmpty(header.getUserdefine1())) {
             //如果备货的只能查询属于该出库单的库存
             lotattDTO.setLotatt14(header.getOrderNo());
@@ -406,6 +407,19 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             pickingListVO.setToBePickQty(de.getQty().subtract(de.getPickQty()).doubleValue());
             pickingListVOS.add(pickingListVO);
         }
+        // 二次组盘查询不到
+        if (pickingListVOS.size() == 0) {
+            InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+            List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLocIdSearchFrom);
+            for (InvLotLocIdLotattVO locIdLotattVO : invLotLocIdLotattVOList) {
+                PickingListVO pickingListVO = new PickingListVO();
+                pickingListVO.setOrderNo("");
+                pickingListVO.setSku(locIdLotattVO.getSku());
+                pickingListVO.setPickQty(locIdLotattVO.getQty());
+                pickingListVO.setToBePickQty(locIdLotattVO.getQty());
+                pickingListVOS.add(pickingListVO);
+            }
+        }
         return pickingListVOS;
     }
 
@@ -541,7 +555,17 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 wmsDocOrderDetails.setLineStatus(Constant.ORDER_STS.STS99.getValue());
                 wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(wmsDocOrderDetails);
             }
-            // todo 备货
+            // 备货 修改出库单为备货状态
+//            if (header != null && header.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())) {
+//                    WmsDocOrderHeader docOrderHeader = new WmsDocOrderHeader();
+//                    docOrderHeader.setOrderNo(check.getOrderNo());
+//                    docOrderHeader.setOrderStatus(Constant.ORDER_STS.STS99.getValue());
+//                    wmsDocOrderHeaderMapper.updateWmsDocOrderHeader(docOrderHeader);
+//                    WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
+//                    wmsDocOrderDetails.setOrderNo(check.getOrderNo());
+//                    wmsDocOrderDetails.setLineStatus(Constant.ORDER_STS.STS99.getValue());
+//                    wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(wmsDocOrderDetails);
+//            }
 
         }
 
@@ -593,6 +617,8 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             wmsDocOrderDetails.setOrderLineNo(BigDecimal.valueOf(lineNo + 1));
             wmsDocOrderDetails.setQtyOrderedEach(wmsDocOrderDetails.getQtyOrdered());
             wmsDocOrderDetails.setQtyAllocatedEach(wmsDocOrderDetails.getQtyAllocated());
+            wmsDocOrderDetails.setQtySoftAllocated(BigDecimal.ZERO);
+            wmsDocOrderDetails.setQtySoftallocatedEach(BigDecimal.ZERO);
         }
         return wmsDocOrderDetailsMapper.insertWmsDocOrderDetails(wmsDocOrderDetails);
     }
@@ -620,7 +646,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         String orderNo = ""; // 出库单号(备货才会传入)
         String sku = ""; // 物料编码
         if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
-            groupDiskFrom.getOrderNo();
+            orderNo = groupDiskFrom.getOrderNo();
         }
         /// 根据条码获取物料号
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
@@ -648,38 +674,40 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 lotnumAndInvLocIdMap.put(v.getLotnum(), locIdLotattVOList);
             }
         });
-        if (palletNoFrom.equals(palletNoTo) && orderNo.equals("")) {
-            // 起始托盘和目标托盘一样,并且出库单传入为空,不做操作
-            return AjaxResult.success("起始和目标托盘一致,不用组盘!");
+//        if (palletNoFrom.equals(palletNoTo) && orderNo.equals("")) {
+        // 起始托盘和目标托盘一样,并且出库单传入为空,不做操作
+//            return AjaxResult.success("起始和目标托盘一致,不用组盘!");
 
-        } else {
-            // 根据老Lotnum创建新的Lotnum
-            for (Map.Entry<String, List<InvLotLocIdLotattVO>> lotnumToInvLocId : lotnumAndInvLocIdMap.entrySet()) {
-                String lotnum = lotnumToInvLocId.getKey();
-                List<InvLotLocIdLotattVO> invLocIdList = lotnumToInvLocId.getValue();
-                InvLotAtt invLotAtt = invLotAttMapper.selectInvLotAttByLotnum(lotnum);
-                String newLotnum = idSequenceUtils.generateId("LOTNUMBER");
-                invLotAtt.setLotnum(newLotnum);
-                invLotAtt.setLotatt07(palletNoTo);
-                if (!orderNo.equals("")) {
-                    invLotAtt.setLotatt14(orderNo); // 备货对应的出库单号
+//        } else {
+        // 根据老Lotnum创建新的Lotnum
+        for (Map.Entry<String, List<InvLotLocIdLotattVO>> lotnumToInvLocId : lotnumAndInvLocIdMap.entrySet()) {
+            String lotnum = lotnumToInvLocId.getKey();
+            List<InvLotLocIdLotattVO> invLocIdList = lotnumToInvLocId.getValue();
+            InvLotAtt invLotAtt = invLotAttMapper.selectInvLotAttByLotnum(lotnum);
+            String newLotnum = idSequenceUtils.generateId("LOTNUMBER");
+            invLotAtt.setLotnum(newLotnum);
+            invLotAtt.setLotatt07(palletNoTo);
+            if (!orderNo.equals("")) {
+                invLotAtt.setLotatt14(orderNo); // 备货对应的出库单号
+            } else {
+                invLotAtt.setLotatt14(""); // 备货对应的出库单号
+            }
+            invLotAtt.setLotatt15(lotnum); // 老批次
+            invLotAtt.setCreateTime(DateUtils.getNowDate());
+            if (invLotAttMapper.insertInvLotAtt(invLotAtt) > 0) {
+                for (InvLotLocIdLotattVO v : invLocIdList) {
+                    InvLotLocIdForm invLotLocIdUpdate = new InvLotLocIdForm();
+                    invLotLocIdUpdate.setLotnum(lotnum);
+                    invLotLocIdUpdate.setLocationId(v.getLocationId().toString());
+                    invLotLocIdUpdate.setCustomerId(v.getCustomerId());
+                    invLotLocIdUpdate.setSku(v.getSku());
+                    invLotLocIdUpdate.setLotnumTo(newLotnum);
+                    invLotLocIdService.updateInvLotLocId(invLotLocIdUpdate);
                 }
-                invLotAtt.setLotatt15(lotnum); // 老批次
-                invLotAtt.setCreateTime(DateUtils.getNowDate());
-                if (invLotAttMapper.insertInvLotAtt(invLotAtt) > 0) {
-                    for (InvLotLocIdLotattVO v : invLocIdList) {
-                        InvLotLocIdForm invLotLocIdUpdate = new InvLotLocIdForm();
-                        invLotLocIdUpdate.setLotnum(lotnum);
-                        invLotLocIdUpdate.setLocationId(v.getLocationId().toString());
-                        invLotLocIdUpdate.setCustomerId(v.getCustomerId());
-                        invLotLocIdUpdate.setSku(v.getSku());
-                        invLotLocIdUpdate.setLotnumTo(newLotnum);
-                        invLotLocIdService.updateInvLotLocId(invLotLocIdUpdate);
-                    }
 
-                }
             }
         }
+//        }
         return AjaxResult.success("组盘成功!");
     }
 
@@ -919,7 +947,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         ActAllocationDetailsFrom query = new ActAllocationDetailsFrom();
         query.setOrderNo(snCheckSoForm.getOrderNo());
         query.setLotatt02(snCheckSoForm.getSn());
-        query.setStatus(Constant.ORDER_STS.STS20.getValue());
+        query.setStatus(Constant.ORDER_STS.STS21.getValue());
         ActAllocationDetailsFrom actAllocationDetailsFrom = actAllocationDetailsService.selectActAllocationDetailsInvLotAttByModel(query);
         if (actAllocationDetailsFrom == null) {
             query.setStatus(Constant.ORDER_STS.STS30.getValue());
@@ -952,6 +980,8 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             details.setQtyOrderedEach(erpOrder.getQty());
             details.setQtyAllocatedEach(BigDecimal.ZERO);
             details.setQtyAllocated(BigDecimal.ZERO);
+            details.setQtySoftAllocated(BigDecimal.ZERO);
+            details.setQtySoftallocatedEach(BigDecimal.ZERO);
             details.setCustomerId(Constant.CUSTOMER_ID);
             details.setQtyShippedEach(BigDecimal.ZERO);
             details.setQtyShipped(BigDecimal.ZERO);

+ 4 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -202,6 +202,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateInvLotLocId" parameterType="InvLotLocId">
         update inv_lot_loc_id
         <trim prefix="SET" suffixOverrides=",">
+            <if test="lotnumTo != null">lotnum = #{lotnumTo},</if>
             <if test="locationId != null">location_id = #{locationId},</if>
             <if test="traceid != null">traceid = #{traceid},</if>
             <if test="customerId != null">customer_id = #{customerId},</if>
@@ -410,6 +411,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateInvLotLocIdToByLotnum">
         update inv_lot_loc_id set location_id = #{locationTo}
         where lotnum = #{lotnum}
+          and location_id = #{locationId}
+          and customer_id = #{customerId}
+          and sku = #{sku}
     </update>
 
     <update id="clearInvByLocationId">

+ 8 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -192,6 +192,14 @@ public class Constant {
          * 任务生成
          */
         STS21("21"),
+        /**
+         * 部分备货
+         */
+        STS22("22"),
+        /**
+         * 备货完成
+         */
+        STS23("23"),
         /**
          * 部分拣货
          */