瀏覽代碼

测试修改

k 2 年之前
父節點
當前提交
287f904ffb

+ 2 - 2
ruoyi-admin/src/main/resources/application-dev.yml

@@ -66,5 +66,5 @@ testtag:
 # 日志配置
 logging:
     level:
-        com.ruoyi: info
-        org.springframework: info
+        com.ruoyi: debug
+        org.springframework: debug

+ 10 - 0
warewms-ams/src/main/java/com/ruoyi/ams/box/mapper/WmsBoxInfoMapper.java

@@ -77,6 +77,16 @@ public interface WmsBoxInfoMapper
      */
      int updateLocationBind(@Param("locationFrom") Long locationFrom,@Param("locationTo") Long locationTo,@Param("isFull") String isFull);
 
+    /**
+     * 更新托盘库位绑定位置
+     * @param palletNo
+     * @param locationFrom
+     * @param locationTo
+     * @param isFull
+     * @return
+     */
+     int updateLocationBindByPalletNo(@Param("palletNo")String palletNo,@Param("locationFrom") Long locationFrom,@Param("locationTo") Long locationTo,@Param("isFull") String isFull);
+
     /**
      * 接触托盘绑定关系
      * @param locationId

+ 10 - 0
warewms-ams/src/main/java/com/ruoyi/ams/box/service/IWmsBoxInfoService.java

@@ -109,4 +109,14 @@ public interface IWmsBoxInfoService {
      * @return
      */
     int updateLocationBind(Long locationFrom,Long locationTo,String isFull);
+
+    /**
+     * 更新托盘绑定关系
+     * @param palletNo
+     * @param locationFrom
+     * @param locationTo
+     * @param isFull
+     * @return
+     */
+    int updateLocationBind(String palletNo,Long locationFrom,Long locationTo,String isFull);
 }

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/box/service/impl/WmsBoxInfoServiceImpl.java

@@ -182,4 +182,8 @@ public class WmsBoxInfoServiceImpl implements IWmsBoxInfoService {
     public int updateLocationBind(Long locationFrom, Long locationTo, String isFull) {
         return wmsBoxInfoMapper.updateLocationBind(locationFrom, locationTo, isFull);
     }
+    @Override
+    public int updateLocationBind(String palletNo,Long locationFrom, Long locationTo, String isFull) {
+        return wmsBoxInfoMapper.updateLocationBindByPalletNo(palletNo,locationFrom, locationTo, isFull);
+    }
 }

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/service/IActAllocationDetailsService.java

@@ -144,4 +144,13 @@ public interface IActAllocationDetailsService {
      * @return
      */
     AjaxResult modifyAssignmentTaskStatus(String orderNo,Long locationId,String palletNo);
+
+    /**
+     * 修改分配任务为拣货完成,备货(没有备货完成的)
+     * @param orderNo
+     * @param locationId
+     * @param palletNo
+     * @return
+     */
+    AjaxResult modifyAssignmentStockTaskStatus(String orderNo,Long locationId,String palletNo);
 }

+ 37 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/ActAllocationDetailsServiceImpl.java

@@ -6,7 +6,9 @@ import java.util.List;
 import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
+import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
 import com.ruoyi.ams.order.form.ActAllocationDetailsFrom;
+import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
 import com.ruoyi.ams.qc.domain.DocQcDetails;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.base.domain.BaseLocationInfo;
@@ -37,6 +39,8 @@ public class ActAllocationDetailsServiceImpl implements IActAllocationDetailsSer
     private IWmsBoxInfoService wmsBoxInfoService;
     @Autowired
     private IBaseLocationInfoService baseLocationInfoService;
+    @Autowired
+    private IWmsDocOrderHeaderService wmsDocOrderHeaderService;
 
     /**
      * 查询分配查询
@@ -231,6 +235,16 @@ public class ActAllocationDetailsServiceImpl implements IActAllocationDetailsSer
 
     @Override
     public AjaxResult modifyAssignmentTaskStatus(String orderNo,Long locationId,String palletNo) {
+        WmsDocOrderHeader header = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+        // 备货单完全备货之前单和库内理货不需要改
+        if (header != null
+                && header.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())
+                && !header.getOrderStatus().equals(Constant.ORDER_STS.STS23.getValue())) {
+            return AjaxResult.success();
+        }
+        if (header != null && header.getOrderType().equals(Constant.ORDER_TYP.LH.getValue())) {
+            return AjaxResult.success();
+        }
         ActAllocationDetailsFrom actAllocationQuery = new ActAllocationDetailsFrom();
         actAllocationQuery.setOrderNo(orderNo);
         actAllocationQuery.setLocationId(locationId);
@@ -245,4 +259,27 @@ public class ActAllocationDetailsServiceImpl implements IActAllocationDetailsSer
         }
         return AjaxResult.success();
     }
+
+    @Override
+    public AjaxResult modifyAssignmentStockTaskStatus(String orderNo, Long locationId, String palletNo) {
+        WmsDocOrderHeader header = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+        // 备货单备货之前单分配明细都可以改为拣货完成
+        if (header != null
+                && header.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())
+                && !header.getOrderStatus().equals(Constant.ORDER_STS.STS23.getValue())) {
+            ActAllocationDetailsFrom actAllocationQuery = new ActAllocationDetailsFrom();
+            actAllocationQuery.setOrderNo(orderNo);
+            actAllocationQuery.setLocationId(locationId);
+            actAllocationQuery.setLotatt07(palletNo);
+            actAllocationQuery.setStatus(Constant.ORDER_STS.STS21.getValue());
+            List<ActAllocationDetailsFrom> actAllocationDetailsFromList = this.selectActAllocationDetailsInvLotAttList(actAllocationQuery);
+            for (ActAllocationDetailsFrom allocationDetails : actAllocationDetailsFromList) {
+                ActAllocationDetails allocationDetailsUpdate = new ActAllocationDetails();
+                allocationDetailsUpdate.setAllocationId(allocationDetails.getAllocationId());
+                allocationDetailsUpdate.setStatus(Constant.ORDER_STS.STS40.getValue());
+                this.updateActAllocationDetails(allocationDetailsUpdate);
+            }
+        }
+        return AjaxResult.success();
+    }
 }

+ 38 - 12
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -590,6 +590,19 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         // 验证sn
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.snCheck(sn);
         WmsDocOrderHeader docOrderHeader = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+        if (docOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS40.getValue())) {
+            return AjaxResult.error("已经全部分拣完成!");
+        }
+        // 验证备货单 没有备货完成 不能分拣出库
+        if (docOrderHeader.getOrderType().equals(Constant.ORDER_TYP.BH.getValue())
+                && !docOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS23.getValue())
+                && !docOrderHeader.getOrderStatus().equals(Constant.ORDER_STS.STS30.getValue())) {
+            return AjaxResult.error("没有备货完成不能分拣出库!");
+        }
+        // 库内理货单不能分拣出库
+        if (docOrderHeader.getOrderType().equals(Constant.ORDER_TYP.LH.getValue())) {
+            return AjaxResult.error("库内理货单不能分拣出库!");
+        }
         // 查询出分配明细
         List<ActAllocationDetailsFrom> actAllocationDetailsFromList = new ArrayList<>();
         ActAllocationDetailsFrom actAllocationQuery = new ActAllocationDetailsFrom();
@@ -632,21 +645,15 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         if (endActAllocation == null) {
             return AjaxResult.error("没有可以拣货的分配明细!");
         }
-        // 更新分配明细
-        ActAllocationDetails allocationUpdate = new ActAllocationDetails();
-        allocationUpdate.setAllocationId(endActAllocation.getAllocationId());
-        allocationUpdate.setPickQty(endActAllocation.getPickQty().add(qty));
-        allocationUpdate.setStatus(Constant.ORDER_STS.STS30.getValue());
-        if (endActAllocation.getQty().compareTo(allocationUpdate.getPickQty()) == 0) {
-            allocationUpdate.setStatus(Constant.ORDER_STS.STS40.getValue());
-        }
-        actAllocationDetailsService.updateActAllocationDetails(allocationUpdate);
         // 更新库存数量
         String lotnum = endActAllocation.getLotnum();
         Long locationId = Constant.LOC_SORTATION_CACHE;
         String sku = endActAllocation.getMaterial();
         String customerId = Constant.CUSTOMER_ID;
         InvLotLocId invLotLocId = invLotLocIdService.selectInvLotLocIdById(locationId.toString(), customerId, sku, lotnum);
+        if (invLotLocId == null) {
+            return AjaxResult.error("没有可以分拣的库存!");
+        }
         invLotLocId.setQty(invLotLocId.getQty().subtract(qty));
         invLotLocId.setQtyEach(invLotLocId.getQty());
         invLotLocId.setQtyallocated(invLotLocId.getQtyallocated().subtract(qty));
@@ -654,6 +661,15 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         invLotLocIdService.updateInvLotLocId(invLotLocId);
         // 删除0库存
         invLotLocIdService.clearZeroInventory(locationId.toString(), customerId, sku, lotnum);
+        // 更新分配明细
+        ActAllocationDetails allocationUpdate = new ActAllocationDetails();
+        allocationUpdate.setAllocationId(endActAllocation.getAllocationId());
+        allocationUpdate.setPickQty(endActAllocation.getPickQty().add(qty));
+        allocationUpdate.setStatus(Constant.ORDER_STS.STS30.getValue());
+        if (endActAllocation.getQty().compareTo(allocationUpdate.getPickQty()) == 0) {
+            allocationUpdate.setStatus(Constant.ORDER_STS.STS40.getValue());
+        }
+        actAllocationDetailsService.updateActAllocationDetails(allocationUpdate);
         // 更新出库单拣货数量
         WmsDocOrderDetails wmsDocOrderDetails = wmsDocOrderDetailsMapper.selectWmsDocOrderDetailsByNoLineNo(endActAllocation.getOrderNo(), endActAllocation.getLineNo());
         wmsDocOrderDetails.setQtyPicked(wmsDocOrderDetails.getQtyPicked().add(qty));
@@ -784,6 +800,16 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
             orderNo = groupDiskFrom.getOrderNo();
         }
+        // 验证出库单
+        if (StringUtils.isNotEmpty(orderNo)) {
+            WmsDocOrderHeader header = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
+            if (header != null
+                    && !header.getOrderStatus().equals(Constant.ORDER_STS.STS10.getValue())
+                    && !header.getOrderStatus().equals(Constant.ORDER_STS.STS20.getValue())
+                    && !header.getOrderStatus().equals(Constant.ORDER_STS.STS21.getValue())) {
+                return AjaxResult.error("出库单状态不可组盘!");
+            }
+        }
         // 根据条码获取物料号
         CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
         sku = codeSkuRelationshipVO.getSku();
@@ -805,7 +831,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         }
         // 产品的话基本只能查出有一条库存 但是物料可能会多条 但是我们只处理一条库存
         List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = new ArrayList<>();
-        InvLotLocIdLotattVO endLotattVO = new InvLotLocIdLotattVO();
+        InvLotLocIdLotattVO endLotattVO = null;
         List<InvLotLocIdLotattVO> equalInv = invLotLocIdLotattList.stream().filter(v -> v.getQty().compareTo(toQty) == 0).collect(Collectors.toList());
         if (equalInv.size() > 0) {
             endLotattVO = equalInv.get(0);
@@ -1184,7 +1210,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             codeSkuRelationshipSoVO.setSkuName(actAllocationDetailsFrom.getSkuName());
             codeSkuRelationshipSoVO.setSkuType(codeSkuRelationshipVO.getSkuType());
             codeSkuRelationshipSoVO.setSn(actAllocationDetailsFrom.getLotatt02());
-            codeSkuRelationshipSoVO.setProduct(codeSkuRelationshipSoVO.isProduct());
+            codeSkuRelationshipSoVO.setProduct(codeSkuRelationshipVO.isProduct());
             BigDecimal qty = actAllocationDetailsFrom.getQty().subtract(actAllocationDetailsFrom.getPickQty());
             codeSkuRelationshipSoVO.setQty(qty.doubleValue());
         }
@@ -1297,7 +1323,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             for (ActAllocationDetailsFrom allocationDetails : actAllocationDetailsFromList) {
                 ActAllocationDetails allocationDetailsUpdate = new ActAllocationDetails();
                 allocationDetailsUpdate.setAllocationId(allocationDetails.getAllocationId());
-                allocationDetailsUpdate.setStatus(Constant.ORDER_STS.STS30.getValue());
+                allocationDetailsUpdate.setStatus(Constant.ORDER_STS.STS40.getValue());
                 actAllocationDetailsService.updateActAllocationDetails(allocationDetailsUpdate);
                 // 出库单明细改为完成
                 WmsDocOrderDetails wmsDocOrderDetails = wmsDocOrderDetailsMapper.selectWmsDocOrderDetailsByNoLineNo(allocationDetails.getOrderNo(), allocationDetails.getLineNo());

+ 16 - 6
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -8,6 +8,7 @@ import com.ruoyi.ams.agv.ndc.domain.AmsTask;
 import com.ruoyi.ams.agv.ndc.entity.CallbackResult;
 import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
+import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.config.domain.FlowConfigEvent;
 import com.ruoyi.ams.config.service.IFlowConfigEventService;
@@ -183,7 +184,12 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
 
     @Override
     public void callBackPickup(WcsTask wcsTask) {
-
+        if (!StringUtils.isEmpty(wcsTask.getLocationFrom())
+                && !StringUtils.isEmpty(wcsTask.getExt5())) {
+            //更新托盘绑定关系
+            wmsBoxInfoService.updateLocationBind(wcsTask.getExt5(),Long.parseLong(wcsTask.getLocationFrom())
+                    ,Constant.LOC_MIDDLE_CACHE, null);
+        }
     }
 
     /**
@@ -208,7 +214,10 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                 // 修改分配明细为任务完成
                 actAllocationDetailsService.modifyAssignmentTaskStatus(wcsTask.getExt6()
                         ,Long.valueOf(wcsTask.getLocationFrom()), wcsTask.getExt5());
-                // 修改库内理货为任务完成
+                // 修改分配明细为拣货完成,备货(没有备货完成)
+                actAllocationDetailsService.modifyAssignmentStockTaskStatus(wcsTask.getExt6()
+                        ,Long.valueOf(wcsTask.getLocationFrom()), wcsTask.getExt5());
+                // 修改库内理货为拣货完成
                 wmsDocOrderHeaderService.modifyTheTallyStatusInTheWarehouse(wcsTask.getExt6()
                         ,Long.valueOf(wcsTask.getLocationFrom()), wcsTask.getExt5());
                 break;
@@ -220,9 +229,11 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                 break;
         }
 
-        if (!StringUtils.isEmpty(wcsTask.getLocationFrom()) && !StringUtils.isEmpty(wcsTask.getLocationTo())) {
+        if (!StringUtils.isEmpty(wcsTask.getLocationTo())
+                && !StringUtils.isEmpty(wcsTask.getExt5())) {
             //更新托盘绑定关系
-            wmsBoxInfoService.updateLocationBind(Long.parseLong(wcsTask.getLocationFrom()), Long.parseLong(wcsTask.getLocationTo()), null);
+            wmsBoxInfoService.updateLocationBind(wcsTask.getExt5(),Constant.LOC_MIDDLE_CACHE
+                    , Long.parseLong(wcsTask.getLocationTo()), null);
         }
 
     }
@@ -417,7 +428,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
                             redisCache.unlockCacheObject(Long.parseLong(wcsTask.getExt8()));
                         }
                         // 取消任务删除中间缓存库存
-                        cancelTaskDelMiddleCache(wcsTask);
+//                        cancelTaskDelMiddleCache(wcsTask);
                         break;
                     case 8:
                         log.error("任务异常状态------------" + wcsTask.getTaskNo());
@@ -464,7 +475,6 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         }
         // 修改起始库位状态为空闲无货
         baseLocationInfoService.updateLocationIdleAndEmpty(locationFrom, Constant.WAREHOUSE_ID, wcsTask.getUpdateBy());
-
         return AjaxResult.success();
     }
 

+ 9 - 0
warewms-ams/src/main/resources/mapper/box/WmsBoxInfoMapper.xml

@@ -135,6 +135,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where location_id = #{locationFrom}
     </update>
 
+    <update id="updateLocationBindByPalletNo">
+        update wms_box_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="locationTo != null">location_id = #{locationTo},</if>
+            <if test="isFull != null">is_full = #{isFull},</if>
+        </trim>
+        where location_id = #{locationFrom} and box_no =#{palletNo}
+    </update>
+
     <update id="unbindBox">
         update wms_box_info set location_id = '',is_full = 'N',is_empty='Y'
         where location_id = #{locationId}

+ 9 - 7
warewms-ams/src/main/resources/mapper/docOrder/ActAllocationDetailsMapper.xml

@@ -135,6 +135,7 @@
                 AND date_format(t1.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
             </if>
         </where>
+        order by t1.create_time desc
     </select>
 
     <select id="selectActAllocationDetailsInvLotAttList" parameterType="object" resultMap="ActAllocationDetailsInvLotAttResult">
@@ -146,14 +147,14 @@
         left join inv_lot_att t2 ON t2.lotnum = t1.lotnum
         left join base_sku t3 on t3.sku = t1.material and t3.customer_id = t3.customer_id
         <where>
-            <if test="allocationId != null  and allocationId != ''"> and allocation_id = #{allocationId}</if>
-            <if test="locationId != null  and locationId != ''"> and location_id = #{locationId}</if>
-            <if test="orderNo != null  and orderNo != ''"> and order_no = #{orderNo}</if>
-            <if test="lineNo != null  and lineNo != ''"> and line_no = #{lineNo}</if>
-            <if test="material != null  and material != ''"> and material = #{material}</if>
+            <if test="allocationId != null  and allocationId != ''"> and t1.allocation_id = #{allocationId}</if>
+            <if test="locationId != null  and locationId != ''"> and t1.location_id = #{locationId}</if>
+            <if test="orderNo != null  and orderNo != ''"> and t1.order_no = #{orderNo}</if>
+            <if test="lineNo != null  and lineNo != ''"> and t1.line_no = #{lineNo}</if>
+            <if test="material != null  and material != ''"> and t1.material = #{material}</if>
             <if test="lotnum != null  and lotnum != ''"> and t1.lotnum = #{lotnum}</if>
-            <if test="userdefine1 != null  and userdefine1 != ''"> and userdefine1 = #{userdefine1}</if>
-            <if test="status != null  and status != ''"> and status = #{status}</if>
+            <if test="userdefine1 != null  and userdefine1 != ''"> and t1.userdefine1 = #{userdefine1}</if>
+            <if test="status != null  and status != ''"> and t1.status = #{status}</if>
             <if test="lotatt01 != null  and lotatt01 != ''"> and lotatt01 = #{lotatt01}</if>
             <if test="lotatt02 != null  and lotatt02 != ''"> and lotatt02 = #{lotatt02}</if>
             <if test="lotatt03 != null  and lotatt03 != ''"> and lotatt03 = #{lotatt03}</if>
@@ -173,6 +174,7 @@
             <if test="lotatt17 != null  and lotatt17 != ''"> and lotatt17 = #{lotatt17}</if>
             <if test="lotatt18 != null  and lotatt18 != ''"> and lotatt18 = #{lotatt18}</if>
         </where>
+        order by t1.create_time desc
     </select>
 
     <select id="selectActAllocationDetailsByAllocationId" parameterType="String" resultMap="ActAllocationDetailsResult">