From 69cd9f59a0fabf12f8c9147fcba7f69817a870b3 Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期一, 06 十一月 2023 23:40:59 +0800
Subject: [PATCH] 更新仓内抓拍2

---
 igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java |   86 +++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 56 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..cf0c7a3 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;
 
@@ -127,27 +126,7 @@
     }
 
 
-    /**
-     * @param param
-     * @return
-     */
-//    public String noticeWeightDone(ApiInoutData param) {
-//        //鑾峰彇绉伴噸涓绘帶鍣ㄩ厤缃�
-//        InoutConf conf = getWeightGateway(param.getCompanyId(), param.getDeptId(), param.getSort());
-//
-//        if (null == conf) {
-//            return "绉伴噸涓绘帶鏈厤缃紝鏀寔澶辫触";
-//        }
-//
-//        ApiInoutData apiData = new ApiInoutData(conf);
-//        apiData.setPlateNum(param.getPlateNum());
-//        apiData.setTime(new Date());
-//
-//        ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol());
-//
-//        // return inoutApiService.noticeWeightDone(apiData); TODO
-//        return null;
-//    }
+
 
     /**
      * 鍑哄叆搴撴姄鎷�
@@ -277,6 +256,10 @@
         req.setPlayType(conf.getPlayType());
         req.setSerSn(null == snapSer ? null : snapSer.getSn());
         req.setBizId(param.getBizId());
+        //鑻ヤ负鍑哄叆搴撶О閲嶆姄鎷嶏紝鍒欎笉浼犻�掍笟鍔′富閿�傚湪鍑哄叆搴撲笟鍔℃彁浜ゆ椂淇濆瓨鏂囦欢淇℃伅
+        if(InoutConstant.PROGRESS_WEIGHT_TAG.equals(conf.getInoutProgress())){
+            req.setBizId(null);
+        }
         req.setCameraName(conf.getName());
 
         req.setMediaAddr(CameraUtil.updateMediaAddr(conf.getMediaAddr(), conf.getLoginId(),
@@ -372,26 +355,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 +383,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 +438,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 +489,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 +499,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