From a195948e2f1db9d413194f7d33c93cca6a796ca8 Mon Sep 17 00:00:00 2001 From: jiazx0107@163.com <jiazx0107@163.com> Date: 星期三, 05 七月 2023 02:42:11 +0800 Subject: [PATCH] 增加海康SDK,整理自动抬干业务逻辑 --- igds-inout/src/main/java/com/ld/igds/inout/manager/InoutEventControlManager.java | 104 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 93 insertions(+), 11 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 8539d8b..3002c16 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 @@ -400,6 +400,69 @@ return null; } + + /** + * 琚姩鏀跺埌杞︾墝璇嗗埆缁撴灉锛屼簨浠� + * + * @param data + */ + @Async + public void onReceivePlateNum(ApiInoutData data) { + + InoutConf conf = this.getInoutConfBySn(data.getCompanyId(), data.getDeptId(), data.getSn()); + + if (null == conf) return; + + if (0 == conf.getInOrder()) return; + + data = new ApiInoutData(conf); + + ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol()); + + //鑾峰彇杞︾墝淇℃伅锛屽紑闂告満 + if (InoutApiConstant.DEVICE_CODE_1002 == data.getDeviceCode()) { + //寮�鍏ュ彛澶勯亾闂� + data.setDeviceCode(InoutApiConstant.DEVICE_CODE_2002); + data.setActionCode(InoutApiConstant.ACTION_CODE_1); + + inoutApiService.gateControl(data); + } + + + if (InoutApiConstant.DEVICE_CODE_1003 == data.getDeviceCode()) { + //寮�鍏ュ彛澶勯亾闂� + data.setDeviceCode(InoutApiConstant.DEVICE_CODE_2003); + data.setActionCode(InoutApiConstant.ACTION_CODE_1); + + inoutApiService.gateControl(data); + } + + } + + /** + * 鍑哄叆搴撶О閲嶉〉闈㈠垵濮嬪寲锛屽鏋滄湁SDK杞︾墝璇嗗埆锛岄渶瑕佽繘琛屽垵濮嬪寲鎿嶄綔 + * + * @param listInoutConf + * @param sort + */ + @Async + public void initInoutWeight(List<InoutConf> listInoutConf, String sort) { + + //鑾峰彇杞︾墝閰嶇疆淇℃伅 + if (null == listInoutConf) return; + + ApiInoutData apiInoutData; + ApiInoutService inoutApiService; + for (InoutConf conf : listInoutConf) { + if (InoutConstant.CONF_TYPE_10.equals(conf.getType()) && sort.equals(conf.getSort())) { + apiInoutData = new ApiInoutData(conf); + inoutApiService = apiInoutManager.getApiService(conf.getProtocol()); + inoutApiService.initLpr(apiInoutData); + } + } + } + + /** * 鍑哄叆搴撶櫥璁板畬鎴愯Е鍙戜簨浠讹紝榛樿涓哄紓姝ュ鐞� * @@ -430,21 +493,21 @@ //1銆侀�氱煡绉伴噸鏄剧ず灞忥紝璁惧缂栧彿6001 ApiInoutData apiData = new ApiInoutData(conf); apiData.setTime(new Date()); - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_6001); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_6001); ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol()); inoutApiService.noticeLed(apiData, data); //2銆佽闊抽�氱煡 - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_8001); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_8001); inoutApiService.noticeRadio(apiData, data); //3銆佸紑闂告満 if (InoutConstant.TYPE_IN.equals(data.getType())) { //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸 if (data.getNetWeight() > 0) { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_1002); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002); } else { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_1003); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003); } apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); @@ -452,9 +515,9 @@ } else { //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸 if (data.getNetWeight() > 0) { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_1003); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003); } else { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_1002); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002); } apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); inoutApiService.gateControl(apiData); @@ -464,9 +527,9 @@ if (InoutConstant.TYPE_IN.equals(data.getType())) { //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸 if (data.getNetWeight() > 0) { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_7001); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7001); } else { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_7002); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7002); } apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); @@ -474,14 +537,14 @@ } else { //缁撶畻閲嶉噺澶т簬0琛ㄧず浜屾绉伴噸 if (data.getNetWeight() > 0) { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_7002); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7002); } else { - apiData.setDeviceId(InoutApiConstant.DEVICE_CODE_7001); + apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7001); } apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); inoutApiService.lightControl(apiData); } - + } @@ -671,5 +734,24 @@ return result; } + private InoutConf getInoutConfBySn(String companyId, String deptId, String sn) { + + if (null == sn) return null; + + // 鑾峰彇鍑哄叆搴撻厤缃俊鎭� + List<InoutConf> listInoutConf = inoutCommonService.getCacheInoutConf(companyId, deptId); + + if (null == listInoutConf) return null; + + for (InoutConf conf : listInoutConf) { + + if (null == conf.getSn()) continue; + + if (sn.equals(conf.getSn())) return conf; + } + + return null; + } + } -- Gitblit v1.9.3