| | |
| | | import com.ld.igds.file.CoreFileService; |
| | | import com.ld.igds.inout.ApiInoutManager; |
| | | import com.ld.igds.inout.ApiInoutService; |
| | | import com.ld.igds.inout.InoutApiConstant; |
| | | import com.ld.igds.inout.InoutConstant; |
| | | import com.ld.igds.inout.dto.*; |
| | | import com.ld.igds.inout.service.InoutService; |
| | |
| | | apiData.setMsg("称重已完成"); |
| | | |
| | | // apiInoutManager.getApiService(apiData.getProtocol()).noticeWeightDone(apiData); |
| | | // apiInoutManager.getApiService(apiData.getProtocol()).noticeRadio(apiData); |
| | | // apiInoutManager.getApiService(apiData.getProtocol()).noticeRadio(apiData); |
| | | } |
| | | |
| | | /** |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 出入库登记完成触发事件,默认为异步处理 |
| | | * |
| | |
| | | */ |
| | | @Async |
| | | public void onInoutWeight(InoutData data, String curProgress, String nextProgress) { |
| | | //获取地磅控制器 |
| | | InoutConf conf = this.getWeightGateway(data.getCompanyId(), data.getDeptId(), null); |
| | | if (null == conf) { |
| | | log.info("----------称重完成事件,没有获取到称重控制器--------------"); |
| | | } |
| | | |
| | | //1、通知称重显示屏 |
| | | //1、通知称重显示屏,设备编号6001 |
| | | ApiInoutData apiData = new ApiInoutData(conf); |
| | | apiData.setTime(new Date()); |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_6001); |
| | | ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol()); |
| | | inoutApiService.noticeLed(apiData, data); |
| | | |
| | | //2、语音通知 |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_8001); |
| | | inoutApiService.noticeRadio(apiData, data); |
| | | |
| | | //3、开闸机 |
| | | if (InoutConstant.TYPE_IN.equals(data.getType())) { |
| | | //结算重量大于0表示二次称重 |
| | | if (data.getNetWeight() > 0) { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002); |
| | | } else { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003); |
| | | } |
| | | apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); |
| | | |
| | | inoutApiService.gateControl(apiData); |
| | | } else { |
| | | //结算重量大于0表示二次称重 |
| | | if (data.getNetWeight() > 0) { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1003); |
| | | } else { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_1002); |
| | | } |
| | | apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); |
| | | inoutApiService.gateControl(apiData); |
| | | } |
| | | |
| | | //4、开红绿灯 |
| | | if (InoutConstant.TYPE_IN.equals(data.getType())) { |
| | | //结算重量大于0表示二次称重 |
| | | if (data.getNetWeight() > 0) { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7001); |
| | | } else { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7002); |
| | | } |
| | | apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); |
| | | |
| | | inoutApiService.lightControl(apiData); |
| | | } else { |
| | | //结算重量大于0表示二次称重 |
| | | if (data.getNetWeight() > 0) { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7002); |
| | | } else { |
| | | apiData.setDeviceCode(InoutApiConstant.DEVICE_CODE_7001); |
| | | } |
| | | apiData.setActionCode(InoutApiConstant.ACTION_CODE_1); |
| | | inoutApiService.lightControl(apiData); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | | |
| | | } |