Browse Source

1.拆包机bug解决 2.桶装空托出库增加日志

ChenYang 1 year ago
parent
commit
80e67c5725

+ 1 - 1
ruoyi-admin/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="../../../logs/ruoyi/logs" />
+	<property name="log.path" value="../../../warewms/logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 10 - 3
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/ProcessLocationTest.java

@@ -11,6 +11,7 @@ import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.service.IInvLotAttService;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+import com.ruoyi.ams.xuankuang.service.IBucketLocInvService;
 import com.ruoyi.ams.xuankuang.service.WmsDocOrderSubService;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.BaseSku;
@@ -266,13 +267,19 @@ public class ProcessLocationTest {
     }
 
 
+
     @Autowired
-    private IBaseSkuService iBaseSkuService;
+    private IBucketLocInvService bucketLocInvService;
 
     @Test
     public void callbackWcsAgvInTask(){
-        BaseSku baseSku = iBaseSkuService.selectBaseSkuByMaterialType("5");
-        System.out.println(JSONObject.toJSONString(baseSku));
+        /*BaseSku baseSku = iBaseSkuService.selectBaseSkuByMaterialType("5");
+        System.out.println(JSONObject.toJSONString(baseSku));*/
+
+
+        System.out.println(JSONObject.toJSONString(bucketLocInvService.allocateLocationInfo()));
+
+
     }
 
 

+ 11 - 10
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderDetailsServiceImpl.java

@@ -1,21 +1,19 @@
 package com.ruoyi.ams.order.service.impl;
 
+import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
+import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
+import com.ruoyi.ams.order.service.IWmsDocOrderDetailsService;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.common.exception.ServiceException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
 
-import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
-import com.ruoyi.base.constant.Constant;
-import com.ruoyi.base.domain.BaseSku;
-import com.ruoyi.common.exception.ServiceException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
-import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
-import com.ruoyi.ams.order.service.IWmsDocOrderDetailsService;
-
 /**
  * 出库单Service业务层处理
  *
@@ -163,7 +161,10 @@ public class WmsDocOrderDetailsServiceImpl implements IWmsDocOrderDetailsService
         wmsDocOrderDetails.setOrderLineNo(lineNo);
         wmsDocOrderDetails.setSku(sku);
         wmsDocOrderDetails.setLineStatus(Constant.ORDER_STS.STS00.getValue());
+        wmsDocOrderDetails.setQtyOrdered(quantityDecimal);
         wmsDocOrderDetails.setQtyOrderedEach(quantityDecimal);
+        wmsDocOrderDetails.setQtyAllocated(quantityDecimal);
+        wmsDocOrderDetails.setQtyPicked(BigDecimal.ZERO);
         wmsDocOrderDetails.setCreateTime(new Date());
         wmsDocOrderDetails.setQtyOrdered(quantityDecimal);
         wmsDocOrderDetailsMapper.insertWmsDocOrderDetails(wmsDocOrderDetails);

+ 23 - 14
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/WcsTaskSubService.java

@@ -265,6 +265,7 @@ public class WcsTaskSubService {
                     break;
             }
         } catch (Exception e) {
+            log.error("excute callBack exception was happened, taskNo is {}, cause by {}, ", taskNo, e);
             throw new BaseException(wcsTask.getTaskNo() + "-----" + "回调状态:" + state + "异常");
         }
         wcsTask.setState(state.longValue());
@@ -342,8 +343,10 @@ public class WcsTaskSubService {
         String orderNo = wcsTask.getExt1();
         List<WmsDocOrderDetails> wmsDocOrderDetailList = iWmsDocOrderDetailsService.selectWmsDocOrderDetailsByOrderNo(orderNo);
         WmsDocOrderDetails docOrderDetail = wmsDocOrderDetailList.get(0);
-        BigDecimal qtyAllocated = docOrderDetail.getQtyAllocated();
-        BigDecimal qtyPicked = docOrderDetail.getQtyPicked();
+        BigDecimal qtyAllocated = ObjectUtil.isNull(docOrderDetail.getQtyAllocated())
+                ? BigDecimal.ZERO : docOrderDetail.getQtyAllocated();
+        BigDecimal qtyPicked = ObjectUtil.isNull(docOrderDetail.getQtyPicked())
+                ? BigDecimal.ZERO : docOrderDetail.getQtyPicked() ;
         BigDecimal stillNeedQty = qtyAllocated.subtract(qtyPicked);
 
         Long locationId = StringUtils.isNotBlank(wcsTask.getLocationFrom()) ? Long.parseLong(wcsTask.getLocationFrom()) : -1L;
@@ -369,7 +372,10 @@ public class WcsTaskSubService {
 
         if (ObjectUtil.equal(Boolean.TRUE, isComplete)) {
             updateWmsDocOrderHeader(orderNo, docOrderDetail.getSku());
-        }else {
+            if(!StringUtils.equals(Constant.TaskType.RGV.getDesc(), wcsTask.getWhTypeFrom())){
+                turnOffTheUnpacker(docOrderDetail.getSku());
+            }
+        } else {
             WmsDocOrderHeader wmsDocOrderHeader = iWmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
             // 修改 单头30
             wmsDocOrderHeader.setOrderStatus(Constant.ORDER_STS.STS30.getValue());
@@ -378,6 +384,20 @@ public class WcsTaskSubService {
         return AjaxResult.success("success");
     }
 
+    private void turnOffTheUnpacker(String sku) {
+        if (sku.equals("Na2CO3")) {
+            wcsToWmsApiService.turnOffTheUnpacker();
+        } else if (sku.equals("C5H10OS2")) {
+            wcsToWmsApiService.turnOffTheUnpacker1();
+        } else if (sku.equals("(NaPO3)6")) {
+            wcsToWmsApiService.turnOffTheUnpacker2();
+        } else if (sku.equals("(NH4)2SO4")) {
+            wcsToWmsApiService.turnOffTheUnpacker3();
+        } else if (sku.equals("CH3CH2OCS2Na")) {
+            wcsToWmsApiService.turnOffTheUnpacker4();
+        }
+    }
+
     private Boolean updateWmsDocOrderDetails(WmsDocOrderDetails docOrderDetail) {
         return iWmsDocOrderDetailsService.updateWmsDocOrderDetails(docOrderDetail) > 0;
     }
@@ -428,17 +448,6 @@ public class WcsTaskSubService {
         WmsDocOrderHeader wmsDocOrderHeader = iWmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(orderNo);
         wmsDocOrderHeader.setOrderStatus(Constant.ORDER_STS.STS40.getValue());
         iWmsDocOrderHeaderService.updateWmsDocOrderHeader(wmsDocOrderHeader);
-        if (sku.equals("Na2CO3")) {
-            wcsToWmsApiService.turnOffTheUnpacker();
-        } else if (sku.equals("C5H10OS2")) {
-            wcsToWmsApiService.turnOffTheUnpacker1();
-        } else if (sku.equals("(NaPO3)6")) {
-            wcsToWmsApiService.turnOffTheUnpacker2();
-        } else if (sku.equals("(NH4)2SO4")) {
-            wcsToWmsApiService.turnOffTheUnpacker3();
-        } else if (sku.equals("CH3CH2OCS2Na")) {
-            wcsToWmsApiService.turnOffTheUnpacker4();
-        }
     }
 
     /**

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

@@ -63,7 +63,7 @@ public class Constant {
     // WCS智库 agv回调wcs卸货完成
     public static final String WCS_TASK_URL5 = "http://localhost:8082/adaptor/agv/callback/intask?taskNo=";
     // WCS智库 agv回调wcs取货完成
-    public static final String WCS_TASK_URL6 = "http://localhost:8082/adaptor/agv/callback/outtask?wcsId=";
+    public static final String WCS_TASK_URL6 = "http://localhost:8082/adaptor/agv/callback/outtask?taskNo=";
 
 
     public enum TaskType{