Bladeren bron

Merge remote-tracking branch 'origin/xuankuang' into xuankuang

HuKang 2 jaren geleden
bovenliggende
commit
e3d33c8079

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -182,6 +182,15 @@ public interface InvLotLocIdMapper {
      */
     int moveInvByTraceId(@Param("locationFrom") Long locationFrom, @Param("locationTo") Long locationTo,@Param("traceid")String traceid);
 
+    /**
+     * 根据库位移动库存
+     * @param locationFrom
+     * @param locationTo
+     * @param traceid
+     * @return
+     */
+    int moveInvByTraceIdOut(@Param("locationFrom") Long locationFrom, @Param("locationTo") Long locationTo,@Param("traceid")String traceid);
+
     /**
      * 更新起始库位库存至目标库位并区分托盘
      *

+ 9 - 1
warewms-ams/src/main/java/com/ruoyi/ams/task/service/IWcsTaskService.java

@@ -162,10 +162,18 @@ public interface IWcsTaskService {
     AjaxResult moveMiddleCacheToDestination(WcsTask wcsTask);
 
     /**
-     * 将起始点库存放到终点位置
+     * 入库将起始点库存放到终点位置
      *
      * @param wcsTask
      * @return
      */
     AjaxResult moveStartingPointToDestination(WcsTask wcsTask);
+
+    /**
+     * 出库将起始点库存放到终点位置
+     *
+     * @param wcsTask
+     * @return
+     */
+    AjaxResult moveStartingPointToDestinationout(WcsTask wcsTask);
 }

+ 31 - 1
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -495,7 +495,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
 
 
     /**
-     * 将起始点库存放到终点位置
+     * 入库将起始点库存放到终点位置
      *
      * @param wcsTask
      * @return
@@ -525,6 +525,36 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         return AjaxResult.success();
     }
 
+
+    /**
+     * 出库将起始点库存放到终点位置
+     *
+     * @param wcsTask
+     * @return
+     */
+    @Override
+    @Transactional
+    public AjaxResult moveStartingPointToDestinationout(WcsTask wcsTask) {
+        //起始位置
+        Long locationFrom = Long.valueOf(wcsTask.getLocationFrom());
+        //终点位置
+        Long locationTo = Long.valueOf(wcsTask.getLocationTo());
+
+        //任务号
+        String taskNo = wcsTask.getTaskNo();
+        //检验起点库位库存
+        InvLotLocId invLotLocIdQuery = new InvLotLocId();
+        invLotLocIdQuery.setLocationId(locationFrom.toString());
+        List<InvLotLocId> invLotLocIdList = invLotLocIdService.selectInvLotLocIdList(invLotLocIdQuery);
+        if (invLotLocIdList.size() > 0) {
+            // 转移库存
+            invLotLocIdMapper.moveInvByTraceIdOut(locationFrom, locationTo, taskNo);
+        }
+        //修改目标库位状态为占用
+        baseLocationInfoService.occupyLocation(locationTo, Constant.WAREHOUSE_ID, wcsTask.getUpdateBy());
+        return AjaxResult.success();
+    }
+
     /**
      * 修改库存出入库标记
      *

+ 3 - 0
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/BaseLocationInfoSubService.java

@@ -60,6 +60,9 @@ public class BaseLocationInfoSubService {
         return null;
     }
 
+
+
+
     /**
      * 根据条件查询可分配库位
      *

+ 49 - 39
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WcsTaskSubService.java

@@ -4,6 +4,7 @@ import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 import com.ruoyi.ams.asn.service.IWmsDocAsnDetailsService;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
+import com.ruoyi.ams.asn.vo.SearchStockSkuVO;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
@@ -65,7 +66,8 @@ public class WcsTaskSubService {
         BaseLocationInfo baseLocationInfoFrom = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, 1l);
         BaseLocationInfo baseLocationInfoTo = iBaseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, 1l);
 
-        String taskNo = generateTaskNo();;
+        String taskNo = generateTaskNo();
+        ;
         WcsTask wcsTask = new WcsTask();
         wcsTask.setTaskNo(taskNo);
         wcsTask.setState(10L);
@@ -176,24 +178,32 @@ public class WcsTaskSubService {
                     iBaseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom())
                             , Long.parseLong(wcsTask.getLocationTo())
                             , Constant.WAREHOUSE_ID, updateBy);
-                    // 将起始点库存移动到终点库位
-                    iWcsTaskService.moveStartingPointToDestination(wcsTask);
-                    //  修改入库单收货数量
-                    completeTheCallback(wcsTask);
-
+                    if (wcsTask.getExt1().startsWith("ASN")) {
+                        // 将起始点库存移动到终点库位
+                        iWcsTaskService.moveStartingPointToDestination(wcsTask);
+                        //  修改入库单收货数量
+                        completeTheCallback(wcsTask);
+                    }
+                    if (wcsTask.getExt1().startsWith("SO")) {
+                        // 将起始点库存移动到终点库位
+                        iWcsTaskService.moveStartingPointToDestinationout(wcsTask);
+                        invLotLocIdService.adjLocationIsEmpty(wcsTask.getLocationFrom(), Constant.WAREHOUSE_ID, "Wcs");
+                        //  修改出库单收货数量
+                        completeTheCallbackOut(wcsTask);
+                    }
                     break;
                 case 4:
                     if (wcsTask.getState() == 4) {
                         log.info("不能重复取货," + taskNo);
                         return;
                     }
-                    // 解锁起始库位
-                    iBaseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom())
-                            , Constant.WAREHOUSE_ID, updateBy);
-                    // 将起始点库存移动到中间缓存位
-                    iWcsTaskService.moveStartingPointToMiddleCache(wcsTask);
-                    completeTheCallbackOut(wcsTask);
+//                    // 解锁起始库位
+//                    iBaseLocationInfoService.unLockLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom())
+//                            , Constant.WAREHOUSE_ID, updateBy);
+//                    // 将起始点库存移动到终点位
+//                    iWcsTaskService.moveStartingPointToDestination(wcsTask);
                     break;
+
                 case 7://取消
                     wcsTask.setEndTime(new Date());
                     // 解锁终点和起始库位
@@ -230,29 +240,29 @@ public class WcsTaskSubService {
         WmsDocAsnDetails wmsDocAsnDetails = iWmsDocAsnDetailsService.selectWmsDocAsnDetailsByAsnNoLineNo(asnNo, "1");
         BigDecimal expectedQty = wmsDocAsnDetails.getExpectedQty();
         BigDecimal receivedQty = wmsDocAsnDetails.getReceivedQty();
-        BigDecimal canQty= expectedQty.subtract(receivedQty);
+        BigDecimal canQty = expectedQty.subtract(receivedQty);
         InvLotAtt invLotAtt = new InvLotAtt();
         invLotAtt.setLotatt07(palletNo);
         invLotAtt.setLotatt08(asnNo);
         List<InvLotLocId> invLotLocIds = invLotLocIdService.queryInvByInvLotatt(invLotAtt);
-        for (InvLotLocId invLotLocId:invLotLocIds) {
+        for (InvLotLocId invLotLocId : invLotLocIds) {
             BigDecimal qty = invLotLocId.getQty();
-            if (qty.compareTo(canQty) == 1){
+            if (qty.compareTo(canQty) == 1) {
                 continue;
-            }else if ( qty.compareTo(canQty) == 0){
+            } else if (qty.compareTo(canQty) == 0) {
                 wmsDocAsnDetails.setReceivedQty(expectedQty);
                 int i = iWmsDocAsnDetailsService.updateWmsDocAsnDetails(wmsDocAsnDetails);
-                if ( i > 0){
+                if (i > 0) {
                     wmsDocAsnDetails.setLineStatus(Constant.ASN_STS.STS40.getValue());
                     iWmsDocAsnDetailsService.updateWmsDocAsnDetails(wmsDocAsnDetails);
-                }else {
+                } else {
                     con = false;
                     continue;
                 }
-            }else if (qty.compareTo(canQty) == -1){
+            } else if (qty.compareTo(canQty) == -1) {
                 wmsDocAsnDetails.setReceivedQty(receivedQty.add(qty));
                 int i = iWmsDocAsnDetailsService.updateWmsDocAsnDetails(wmsDocAsnDetails);
-                if ( i > 0){
+                if (i > 0) {
                     wmsDocAsnDetails.setLineStatus(Constant.ASN_STS.STS30.getValue());
                     iWmsDocAsnDetailsService.updateWmsDocAsnDetails(wmsDocAsnDetails);
                     con1 = false;
@@ -276,6 +286,7 @@ public class WcsTaskSubService {
 
     /**
      * 出库完成任务回调
+     *
      * @param wcsTask
      * @return
      */
@@ -285,33 +296,32 @@ public class WcsTaskSubService {
         String palletNo = wcsTask.getExt2();
         String orderNo = wcsTask.getExt1();
         List<WmsDocOrderDetails> list = iWmsDocOrderDetailsService.selectWmsDocOrderDetailsByOrderNo(orderNo);
-        BigDecimal qtyOrderedEach = list.get(1).getQtyOrderedEach();
-        BigDecimal allocatedEach = list.get(1).getQtyAllocatedEach();
-        BigDecimal canQty= qtyOrderedEach.subtract(allocatedEach);
+        BigDecimal qtyOrderedEach = list.get(0).getQtyOrderedEach();
+        BigDecimal allocatedEach = list.get(0).getQtyAllocated();
+        BigDecimal canQty = qtyOrderedEach.subtract(allocatedEach);
         InvLotAtt invLotAtt = new InvLotAtt();
         invLotAtt.setLotatt07(palletNo);
-        invLotAtt.setLotatt08(orderNo);
         List<InvLotLocId> invLotLocIds = invLotLocIdService.queryInvByInvLotatt(invLotAtt);
-        for (InvLotLocId invLotLocId:invLotLocIds) {
+        for (InvLotLocId invLotLocId : invLotLocIds) {
             BigDecimal qty = invLotLocId.getQty();
-            if (qty.compareTo(canQty) == 1){
+            if (qty.compareTo(canQty) == 1) {
                 continue;
-            }else if ( qty.compareTo(canQty) == 0){
-                list.get(1).setQtyAllocatedEach(qtyOrderedEach);
-                int i = iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(1));
-                if ( i > 0){
-                    list.get(1).setLineStatus(Constant.ASN_STS.STS40.getValue());
-                    iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(1));
-                }else {
+            } else if (qty.compareTo(canQty) == 0) {
+                list.get(0).setQtyAllocated(qtyOrderedEach);
+                int i = iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(0));
+                if (i > 0) {
+                    list.get(0).setLineStatus(Constant.ASN_STS.STS40.getValue());
+                    iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(0));
+                } else {
                     con = false;
                     continue;
                 }
-            }else if (qty.compareTo(canQty) == -1){
-                list.get(1).setQtyAllocatedEach(allocatedEach.add(qty));
-                int i = iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(1));
-                if ( i > 0){
-                    list.get(1).setLineStatus(Constant.ASN_STS.STS30.getValue());
-                    iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(1));
+            } else if (qty.compareTo(canQty) == -1) {
+                list.get(0).setQtyAllocated(allocatedEach.add(qty));
+                int i = iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(0));
+                if (i > 0) {
+                    list.get(0).setLineStatus(Constant.ASN_STS.STS30.getValue());
+                    iWmsDocOrderDetailsService.updateWmsDocOrderDetails(list.get(0));
                     con1 = false;
                 }
             }

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WcsToWmsApiService.java

@@ -65,8 +65,8 @@ public class WcsToWmsApiService {
 
         // 判重
         WcsTask wcsTaskQuery = new WcsTask();
-//        wcsTaskQuery.setExt1(asnNo);
-//        wcsTaskQuery.setExt2(palletNo);
+        wcsTaskQuery.setExt1(asnNo);
+        wcsTaskQuery.setExt2(palletNo);
         wcsTaskQuery.setExt3(wcsNo);
         WcsTask wcsTask = iWcsTaskService.selectWcsTaskByModel(wcsTaskQuery);
         if (wcsTask != null) {

+ 14 - 11
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WmsDocOrderSubService.java

@@ -72,7 +72,7 @@ public class WmsDocOrderSubService {
         //  根据单号,和创建状态为00
         WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
         wmsDocOrderDetails.setOrderNo(orderNo);
-        wmsDocOrderDetails.setLineStatus(Constant.ASN_STS.STS00.getValue());
+        wmsDocOrderDetails.setLineStatus(Constant.ORDER_STS.STS00.getValue());
         List<WmsDocOrderDetails> list = iWmsDocOrderDetailsService.selectWmsDocOrderDetailsList(wmsDocOrderDetails);
 
         // 查询出库单头
@@ -91,7 +91,7 @@ public class WmsDocOrderSubService {
 
             String pallentNo = baseLocationLotattVO.getLotattVO().getLotatt07();
             String locationFrom = baseLocationLotattVO.getLocationNo();
-            String wcsNo = null;// todo 生成唯一标识wcsno
+            String wcsNo = "wcs" + wcsTaskSubService.generateTaskNo();// todo 生成唯一标识wcsno
 
             //Wcs x y z
             String Y = baseLocationLotattVO.getRowNo();
@@ -122,12 +122,12 @@ public class WmsDocOrderSubService {
                 continue;
             }
             // 修改 明细行状态为10
-            wmsDocOrderDetails1.setLineStatus(Constant.ASN_STS.STS10.getValue());
+            wmsDocOrderDetails1.setLineStatus(Constant.ORDER_STS.STS10.getValue());
             iWmsDocOrderDetailsService.updateWmsDocOrderDetails(wmsDocOrderDetails1);
         }
         if (con == true) {
             // 修改 单头10
-            wmsDocOrderHeader.setOrderStatus(Constant.ASN_STS.STS10.getValue());
+            wmsDocOrderHeader.setOrderStatus(Constant.ORDER_STS.STS10.getValue());
             iWmsDocOrderHeaderService.updateWmsDocOrderHeader(wmsDocOrderHeader);
         }
         return AjaxResult.success("",list);
@@ -207,14 +207,17 @@ public class WmsDocOrderSubService {
                     }else if (i > 0){
                         baseLocationLotattVO=baseLocationLotattVO1;
                         return  baseLocationLotattVO;
-                    }else {
-                        BigDecimal qty1 = new BigDecimal(qty);
-                        BigDecimal subtract = qtyAllocatedEach.subtract(qty1);
-                        if (subtract.intValue()==0){
-                            baseLocationLotattVO=baseLocationLotattVO1;
-                            return  baseLocationLotattVO;
+                    }else if (i < 0){
+                        boolean b = true;
+                        while (b){
+                            BigDecimal qty1 = new BigDecimal(qty);
+                            BigDecimal subtract = qtyAllocatedEach.subtract(qty1);
+                            if (subtract.intValue() == 0){
+                                b = false;
+                                baseLocationLotattVO=baseLocationLotattVO1;
+                                return  baseLocationLotattVO;
+                            }
                         }
-                        continue;
                     }
                 }
             }

File diff suppressed because it is too large
+ 594 - 292
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml


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

@@ -24,6 +24,7 @@ public class Constant {
      */
     public static final Long LOC_MIDDLE_CACHE = 99999l;
 
+
     //region WCS智库 工单下发
 //    public static final String WCS_TASK_URL = "http://192.168.100.10:8082/gsjc/wms/bill";
     public static final String WCS_TASK_URL = "http://localhost:8008/test/wcs/test1";