From 3c6efb35ff0ebcca6e7104c20cde64825fddd59d Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期四, 07 九月 2023 19:35:24 +0800
Subject: [PATCH] 添加数据

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java |   60 +++++++++++++++++++++++++-----------------------------------
 1 files changed, 25 insertions(+), 35 deletions(-)

diff --git a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java
index 3c7ba24..7732e83 100644
--- a/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java
+++ b/igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java
@@ -29,7 +29,6 @@
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
@@ -372,26 +371,6 @@
         return inoutCommonService.getCacheInoutConf(ContextUtil.getCompanyId(), ContextUtil.subDeptId(null), id);
     }
 
-
-    /**
-     * @Desc: 鑾峰彇绉伴噸缃戝叧璁惧
-     * @author: Andy
-     * @update-time: 2022/11/26
-     */
-    public List<InoutConf> getWeightGateway(String companyId, String deptId) {
-        List<InoutConf> list = inoutCommonService.getCacheInoutConf(companyId, deptId);
-        if (null == list || list.isEmpty()) return null;
-
-        List<InoutConf> result = new ArrayList<>();
-
-        for (InoutConf conf : list) {
-            if (InoutConstant.CONF_TYPE_70.equals(conf.getType())) {
-                result.add(conf);
-            }
-        }
-        return result;
-    }
-
     /**
      * @Desc: 鑾峰彇绉伴噸缃戝叧璁惧
      * @author: Andy
@@ -420,30 +399,41 @@
     public void onReceivePlateNum(ApiInoutData data) {
 
         InoutConf conf = this.getInoutConfBySn(data.getCompanyId(), data.getDeptId(), data.getSn());
-
-        if (null == conf) return;
-
+        if (null == conf) {
+            log.error("娌℃湁鑾峰彇鍒板嚭鍏ュ簱閰嶇疆CONF锛�"+data.toString());
+            return;
+        }
+        log.info(conf.toString());
         if (0 == conf.getInOrder()) return;
 
         data = new ApiInoutData(conf);
-
-        ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol());
-
+        log.info(data.toString());
+        ApiInoutService inoutApiService = null;
+        InoutConf gateconf = null;
         //鑾峰彇杞︾墝淇℃伅锛屽紑闂告満
         if (InoutApiConstant.DEVICE_CODE_1002 == data.getDeviceCode()) {
+            gateconf = this.getWeightGateway(data.getCompanyId(), data.getDeptId(), null);
+            if (null == gateconf) {
+                log.info("----------娌℃湁鑾峰彇鍒扮О閲嶆帶鍒跺櫒--------------");
+            }
+            data = new ApiInoutData(gateconf);
             //寮�鍏ュ彛澶勯亾闂�
+            inoutApiService = apiInoutManager.getApiService(gateconf.getProtocol());
             data.setDeviceCode(InoutApiConstant.DEVICE_CODE_2002);
             data.setActionCode(InoutApiConstant.ACTION_CODE_1);
-
             inoutApiService.gateControl(data);
         }
 
-
         if (InoutApiConstant.DEVICE_CODE_1003 == data.getDeviceCode()) {
+            gateconf = this.getWeightGateway(data.getCompanyId(), data.getDeptId(), null);
+            if (null == gateconf) {
+                log.info("----------娌℃湁鑾峰彇鍒扮О閲嶆帶鍒跺櫒--------------");
+            }
             //寮�鍏ュ彛澶勯亾闂�
+            data = new ApiInoutData(gateconf);
+            inoutApiService = apiInoutManager.getApiService(gateconf.getProtocol());
             data.setDeviceCode(InoutApiConstant.DEVICE_CODE_2003);
             data.setActionCode(InoutApiConstant.ACTION_CODE_1);
-
             inoutApiService.gateControl(data);
         }
 
@@ -464,7 +454,7 @@
         ApiInoutData apiInoutData;
         ApiInoutService inoutApiService;
         for (InoutConf conf : listInoutConf) {
-            if (InoutConstant.CONF_TYPE_10.equals(conf.getType()) && sort.equals(conf.getSort())) {
+            if (InoutConstant.PROGRESS_WEIGHT_TAG.equals(conf.getInoutProgress())&&InoutConstant.CONF_TYPE_10.equals(conf.getType()) && sort.equals(conf.getSort())) {
                 apiInoutData = new ApiInoutData(conf);
                 inoutApiService = apiInoutManager.getApiService(conf.getProtocol());
                 inoutApiService.initLpr(apiInoutData);
@@ -515,9 +505,9 @@
         if (InoutConstant.TYPE_IN.equals(data.getType())) {
             //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸
             if (data.getNetWeight() > 0) {
-                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002);
+                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_2002);
             } else {
-                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003);
+                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_2003);
             }
             apiData.setActionCode(InoutApiConstant.ACTION_CODE_1);
 
@@ -525,9 +515,9 @@
         } else {
             //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸
             if (data.getNetWeight() > 0) {
-                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003);
+                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_2002);
             } else {
-                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002);
+                apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_2003);
             }
             apiData.setActionCode(InoutApiConstant.ACTION_CODE_1);
             inoutApiService.gateControl(apiData);

--
Gitblit v1.9.3