YYC
2023-10-08 697ee4ce9d8f49f3597b26b679a9e14f09d64952
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);