jiazx0107@163.com
2023-06-05 7f5ecaf7dbd07e218fbda575e45d8264a560a1e6
出入库优化-称重页面逻辑优化完成
已修改13个文件
669 ■■■■ 文件已修改
igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/check/dto/CheckUpdateResult.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutDeviceManager.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java 163 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/service/InoutService.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java 151 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/admin/inout/in-weight.js 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/static/admin/inout/inout-print.js 34 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-web/src/main/resources/templates/admin/inout/in-weight.html 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
igds-core/src/main/java/com/ld/igds/check/CheckStandardManager.java
@@ -3,7 +3,6 @@
import com.ld.igds.check.dto.CheckItemData;
import com.ld.igds.check.dto.CheckUpdateResult;
import com.ld.igds.check.service.CoreCheckStandardService;
import com.ld.igds.inout.InoutConstant;
import com.ld.igds.util.ContextUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -65,14 +64,22 @@
                item.setUpperLimit(0.0);
            }
            //水分信息回填
            if (InoutConstant.CHECK_ITEM_C01.equals(item.getStandardId()) || InoutConstant.CHECK_ITEM_C020101.equals(item.getStandardId())) {
                if(null != item.getValue()) result.setWet(Double.valueOf(item.getValue()));
            if (item.getDeNum() > 0) {
                result.setDeSum(result.getDeSum() + item.getDeNum());
            }
            //杂质信息回填
            if (InoutConstant.CHECK_ITEM_C02.equals(item.getStandardId()) || InoutConstant.CHECK_ITEM_C01010301.equals(item.getStandardId())) {
                if(null != item.getValue())  result.setImpurity(Double.valueOf(item.getValue()));
            if (item.getAddNum() > 0) {
                result.setAddSum(result.getAddSum() + item.getAddNum());
            }
            if (item.getAddPrice() > 0) {
                result.setAddPriceSum(result.getAddPriceSum() + item.getAddPrice());
            }
            if (item.getDePrice() > 0) {
                result.setDePriceSum(result.getDePriceSum() + item.getDePrice());
            }
            //先更新,更新失败则新增
            int i = checkStandardService.updateCheckItem(item);
            if (i < 1) {
igds-core/src/main/java/com/ld/igds/check/dto/CheckUpdateResult.java
@@ -11,17 +11,14 @@
@Data
public class CheckUpdateResult {
    /**
     * 水分比例
     */
    private double wet;
    /**
     * 杂质比例
     */
    private double impurity;
    //扣重合计
    private double deSum = 0.0;
    //增重合计
    private double addSum = 0.0;
    //扣价合计
    private double dePriceSum = 0.0;
    //增价合计
    private double addPriceSum = 0.0;
    private String msg;
}
igds-databoard/src/main/java/com/ld/igds/databoard/controller/DataboardController.java
@@ -292,7 +292,19 @@
    @RequestMapping("/init-inout-data")
    @ResponseBody
    public PageResponse<String> initInoutData(@RequestBody BaseParam param) {
        inoutCommonManager.initInoutScreen(param.getDeptId());
        if (null == param.getCompanyId()) {
            IUser user = ContextUtil.getLoginUser();
            param.setCompanyId(user.getCompanyId());
            if (null == param.getDeptId()) {
                param.setDeptId(ContextUtil.subDeptId(user));
            }
        }
        inoutCommonManager.initInoutScreen(param.getCompanyId(),param.getDeptId());
        return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "成功!");
    }
@@ -373,7 +385,21 @@
    @RequestMapping("/init-check-data")
    @ResponseBody
    public PageResponse<String> initCheckData(@RequestBody BaseParam param) {
        inoutCommonManager.initInoutScreen(param.getCompanyId());
        if (null == param.getCompanyId()) {
            IUser user = ContextUtil.getLoginUser();
            param.setCompanyId(user.getCompanyId());
            if (null == param.getDeptId()) {
                param.setDeptId(ContextUtil.subDeptId(user));
            }
        }
        inoutCommonManager.initInoutScreen(param.getCompanyId(),param.getDeptId());
        return new PageResponse<String>(RespCodeEnum.CODE_0000.getCode(), "成功!");
    }
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
@@ -1,6 +1,5 @@
package com.ld.igds.inout.controller;
import ch.qos.logback.classic.pattern.ClassNameOnlyAbbreviator;
import com.bstek.bdf2.core.business.IUser;
import com.bstek.bdf2.core.model.DefaultDept;
import com.ld.igds.check.dto.CheckItemData;
@@ -322,6 +321,7 @@
    /**
     * 出库登记
     *
     * @param sort 表示使用的出入库设备配套号,不传递默认为1
     * @return
     */
@@ -449,7 +449,7 @@
        view.addObject("type", InoutConstant.TYPE_OUT);
        // 仓库列表做下拉框使用
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        //出库流程
@@ -486,15 +486,15 @@
        IUser user = ContextUtil.getLoginUser();
        String deptId =  ContextUtil.subDeptId(user);
        String deptId = ContextUtil.subDeptId(user);
        view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
        view.addObject("bizType", BizType.INOUT_OUT.getCode());
        view.addObject("deptId",deptId);
        view.addObject("deptId", deptId);
        view.addObject("type", InoutConstant.TYPE_OUT);
        // 仓库列表做下拉框使用
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
@@ -528,7 +528,7 @@
     */
    @RequestMapping("/inout-query")
    public PageResponse<InoutData> inoutQuery(@RequestBody InoutParam param) {
        if(null == param.getCompanyId()) param.setCompanyId(ContextUtil.getCompanyId());
        if (null == param.getCompanyId()) param.setCompanyId(ContextUtil.getCompanyId());
        return inoutManager.inoutQuery(param);
    }
@@ -604,6 +604,25 @@
    }
    /**
     * 出入库称重环节提交
     *
     * @param data
     * @return
     */
    @RequestMapping("/submit-weight")
    @Transactional
    public PageResponse<InoutData> submitWeight(@RequestBody InoutData data) throws Exception {
        if(null == data.getJjlx()) data.setJjlx("0");
        if (InoutConstant.TYPE_IN.equals(data.getType())) {
            return inoutManager.submitWeightIn(data);
        } else {
            return inoutManager.submitWeightOut(data);
        }
    }
    /**
     * 卡回收页面提交,如果是正常流程卡回收则走正常完成流程,否则执行删除逻辑并回收卡
     *
     * @param data
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutReportController.java
@@ -18,7 +18,7 @@
 */
@Slf4j
@RestController
@RequestMapping("basic/inout-report")
@RequestMapping("basic/inout/report")
public class InoutReportController {
    @Autowired
@@ -31,7 +31,7 @@
     * @param data
     * @return
     */
    @RequestMapping("/inout-bill-weight")
    @RequestMapping("/bill-weight")
    public PageResponse<String> inoutWeightBill(@RequestBody InoutData data) {
        try {
            String html;
@@ -45,7 +45,7 @@
            return new PageResponse<>(RespCodeEnum.CODE_0000, html);
        } catch (Exception e) {
            log.error("后台异常:{}", e);
            return new PageResponse<String>(RespCodeEnum.CODE_1111.getCode(),
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "后台异常:" + e.getMessage());
        }
    }
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutCommonManager.java
@@ -159,10 +159,10 @@
     *
     * @param deptId
     */
    public void initInoutScreen(String deptId) {
        if (StringUtils.isEmpty(deptId))
            deptId = ContextUtil.subDeptId(null);
        inoutService.initInoutScreen(deptId);
    public void initInoutScreen(String companyId, String deptId) {
        if (StringUtils.isEmpty(companyId)) return;
        if (StringUtils.isEmpty(deptId)) return;
        inoutService.notifyToScreen(companyId, deptId, null);
    }
    public List<InoutData> getListInoutCache(String deptId) {
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutDeviceManager.java
@@ -144,7 +144,7 @@
        ApiInoutService inoutApiService = apiInoutManager.getApiService(conf.getProtocol());
       // return inoutApiService.noticeWeightDone(apiData); TODO
        // return inoutApiService.noticeWeightDone(apiData); TODO
        return null;
    }
@@ -246,7 +246,7 @@
        for (InoutConf conf : list) {
            apiData = new ApiInoutData(conf);
            apiData.setPlateNum(imgDto.getPlateNum());
           // inoutApiService.addWhitePlate(apiData);
            // inoutApiService.addWhitePlate(apiData);
        }
    }
@@ -265,7 +265,7 @@
            apiData = new ApiInoutData(conf);
            apiData.setPlateNum(data.getPlateNum());
           // inoutApiService.delWhitePlate(apiData); TODO
            // inoutApiService.delWhitePlate(apiData); TODO
        }
    }
@@ -427,4 +427,16 @@
    }
    /**
     * 根据出入库信息,控制出入库控制器
     *
     * @param data
     * @param curProgress
     * @param nextProgress
     */
    public void controlWeight(InoutData data, String curProgress, String nextProgress) {
        //TODO
    }
}
igds-inout/src/main/java/com/ld/igds/inout/manager/InoutManager.java
@@ -397,14 +397,20 @@
        return data;
    }
    /**
     * 更新质检信息
     *
     * @param data
     * @return
     */
    private CheckUpdateResult updateCheckItems(InoutData data) {
        CheckUpdateResult result = new CheckUpdateResult();
        if (null == data.getCheckItems())
            return result;
        if (null == data.getCheckItems()) return result;
        try {
            // 更新检验项数据
            result = checkStandardManager.updateCheckItems(data.getCheckId(),
                    data.getCompanyId(), data.getCheckItems());
            result = checkStandardManager.updateCheckItems(data.getCheckId(), data.getCompanyId(), data.getCheckItems());
            // 将化验数据存入缓存中
            inoutService.setCheckCache(data);
@@ -858,7 +864,6 @@
        // 更新数据
        inoutService.updateData(data);
        // this.autoCheckByUpdate(data, record);
        return null;
    }
@@ -972,9 +977,6 @@
        if (StringUtils.isEmpty(data.getDepotId())) {
            return "请填写仓库信息!";
        }
//        if (StringUtils.isEmpty(data.getCustomerId())) {
//            return "请填写往来单位信息!";
//        }
        if (StringUtils.isEmpty(data.getFoodYear())) {
            return "请填写粮食年份信息!";
        }
@@ -997,28 +999,6 @@
    public void initLpr(InoutConf conf) {
        inoutDeviceManager.initLpr(conf);
    }
    /**
     * 获取出入库设备配置信息
     *
     * @param companyId
     * @param deptId
     * @return
     */
    public List<InoutConf> getListInoutConf(String companyId, String deptId) {
        return inoutManagerService.getCacheInoutConf(companyId, deptId);
    }
    /**
     * 操作道闸设备
     *
     * @param param
     * @return
     */
    public PageResponse<List<CheckItemData>> gateCtrl(InoutGateDto param) {
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "", null);
    }
    /**
@@ -1074,6 +1054,116 @@
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data);
    }
    public PageResponse<InoutData> submitWeightIn(InoutData data) throws Exception {
        //获取系统参数配置
        InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
        if (null == inoutSysConf) {
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "提示:当前系统中流程配置异常,请联系管理员", data);
        }
        String curProgress = data.getProgress();
        //获取下一个流程状态
        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
        if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) {
            data.setEmptyWeightTime(new Date());
            data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) {
            data.setFullWeightTime(new Date());
            data.setFullWeightUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        //如果下一个数据状态=流程结束
        if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) {
            data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
            data.setCompleteUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        //入库称重可能调整质检单
        CheckUpdateResult checkUpdateResult = updateCheckItems(data);
        if (data.getDeCheck() == 0) {
            data.setDeCheck(checkUpdateResult.getDeSum());
        }
        if (data.getAddCheck() == 0) {
            data.setAddCheck(checkUpdateResult.getAddSum());
        }
        //执行数据更新
        String msg = inoutService.updateData(data);
        if (null != msg) {
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
        }
        // 执行附件信息
        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
        //称重完成,调用出入库控制逻辑处理
        inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data);
    }
    public PageResponse<InoutData> submitWeightOut(InoutData data) throws Exception {
        //获取系统参数配置
        InoutSysConf inoutSysConf = inoutManagerService.getCacheInoutSysConf(data.getCompanyId(), data.getDeptId());
        if (null == inoutSysConf) {
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "提示:当前系统中流程配置异常,请联系管理员", data);
        }
        String curProgress = data.getProgress();
        //获取下一个流程状态
        String nextProgress = getNextProgress(curProgress, data.getType(), inoutSysConf);
        if (InoutConstant.PROGRESS_WEIGHT_EMPTY.equals(curProgress)) {
            data.setEmptyWeightTime(new Date());
            data.setEmptyWeightUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        if (InoutConstant.PROGRESS_WEIGHT_FULL.equals(nextProgress)) {
            data.setFullWeightTime(new Date());
            data.setFullWeightUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        //如果下一个数据状态=流程结束
        if (InoutConstant.PROGRESS_RECORD.equals(nextProgress)) {
            data.setCompleteTime(DateUtils.addMinutes(new Date(), 2));
            data.setCompleteUser(ContextUtil.getLoginUserCName());
            data.setProgress(nextProgress);
        }
        //执行数据更新
        String msg = inoutService.updateData(data);
        if (null != msg) {
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(), msg, data);
        }
        // 执行附件信息
        fileService.saveInoutFiles(data.getFiles(), data.getCompanyId(), data.getId(), curProgress);
        //称重完成,调用出入库控制逻辑处理
        inoutDeviceManager.controlWeight(data, curProgress, nextProgress);
        return new PageResponse<>(RespCodeEnum.CODE_0000.getCode(), "执行成功", data);
    }
    /**
     * 根据条件获取扦样数据
@@ -1107,7 +1197,7 @@
    }
    @Transactional(rollbackFor = Exception.class)
    public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data){
    public PageResponse<InoutCheckData> updateSampleData(InoutCheckData data) {
        try {
            // 获取业务数据信息
@@ -1125,10 +1215,10 @@
            }
            //扦样时间和扦样人
            if(StringUtils.isEmpty(data.getSampleUser())){
            if (StringUtils.isEmpty(data.getSampleUser())) {
                data.setSampleUser(ContextUtil.getLoginUserCName());
            }
            if(null == data.getSampleTime()){
            if (null == data.getSampleTime()) {
                data.setSampleTime(new Date());
            }
            String msg = inoutService.updateSampleData(data);
@@ -1192,7 +1282,7 @@
    }
    @Transactional(rollbackFor = Exception.class)
    public PageResponse<InoutCheckData> updateCheckData(InoutCheckData data){
    public PageResponse<InoutCheckData> updateCheckData(InoutCheckData data) {
        try {
            // 获取业务数据信息
@@ -1221,10 +1311,10 @@
            data.setCheckStatus(curData.getCheckStatus());
            //化验人、化验时间
            if(StringUtils.isEmpty(data.getCheckUser())){
            if (StringUtils.isEmpty(data.getCheckUser())) {
                data.setCheckUser(ContextUtil.getLoginUserCName());
            }
            if(null == data.getCheckTime()){
            if (null == data.getCheckTime()) {
                data.setCheckTime(new Date());
            }
@@ -1243,4 +1333,5 @@
    }
}
igds-inout/src/main/java/com/ld/igds/inout/service/InoutService.java
@@ -101,28 +101,12 @@
    String toComplete(InoutParam param) throws Exception;
    /**
     * 将出入库信息存放到临时缓存中,这个缓存默认只保留2天时间
     *
     * @param data
     */
    void addInoutCache(InoutData data);
    /**
     * 更新出入库缓存信息
     * 将出入库流水信息放到缓存中,包括进行中的和已经完成的
     *
     * @param data
     */
    void updateInoutCache(InoutData data);
    /**
     * 从缓存中删除出入库缓存
     *
     * @param deptId
     * @param type
     * @param id
     * @param addToComplete
     */
    void delInoutFromCache(String deptId, String type, String id, boolean addToComplete);
    /**
     * 获取出入库列表信息,缓存时间是48小时
@@ -140,13 +124,6 @@
     */
    InoutData getFromInoutCache(InoutParam param);
    /**
     * 初始化出入库大屏数据,仅仅发送
     *
     * @param deptId
     */
    void initInoutScreen(String deptId);
    /**
     * 根据数据进行推送
@@ -154,6 +131,16 @@
     * @param result
     */
    void notifyWeb(InoutData result);
    /**
     * 推送大屏
     *
     * @param companyId
     * @param deptId
     * @param progress  可以为空
     */
    void notifyToScreen(String companyId, String deptId, String progress);
    /**
     * 快速完成流程中的订单
@@ -255,6 +242,7 @@
    /**
     * 更新扦样信息
     *
     * @param data
     * @return
     * @throws Exception
@@ -271,6 +259,7 @@
    /**
     * 更新化验信息
     *
     * @param data
     * @return
     * @throws Exception
igds-inout/src/main/java/com/ld/igds/inout/service/impl/InoutServiceImpl.java
@@ -5,6 +5,7 @@
import com.ld.igds.common.CoreCommonService;
import com.ld.igds.constant.BizType;
import com.ld.igds.constant.Constant;
import com.ld.igds.constant.FoodType;
import com.ld.igds.constant.RedisConst;
import com.ld.igds.data.CommonData;
import com.ld.igds.data.Page;
@@ -100,10 +101,9 @@
            return "没有获取到被删除数据的ID,无法删除!";
        }
        // 缓存中删除
        this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId(), false);
        inoutMapper.deleteData(param);
        delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
        return null;
    }
@@ -113,8 +113,9 @@
        if (StringUtils.isEmpty(param.getCompanyId())) {
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        // 缓存中删除
        this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId(), false);
        delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
        param.setProgress(InoutConstant.PROGRESS_RECORD);
        param.setRecordStatus(InoutConstant.RECORD_STATUS_ERROR);
@@ -157,7 +158,7 @@
            inoutMapper.insertData(data);
            this.addInoutCache(data);
            updateInoutCache(data);
        } catch (Exception e) {
            log.error("------------出入库执行保存出错---{}", e);
@@ -183,17 +184,8 @@
        inoutMapper.updateData(newData);
        //如果是完成状态不在进行后期处理,单独走complete方法
        if (InoutConstant.PROGRESS_RECORD.equals(newData.getProgress())) {
            return null;
        }
        // 更新緩存
        if (InoutConstant.PROGRESS_RECORD.equals(newData.getProgress())) {
            this.delInoutFromCache(newData.getDeptId(), newData.getType(), newData.getId(), true);
        } else {
            this.updateInoutCache(newData);
        }
        //更新缓存
        updateInoutCache(newData);
        return null;
    }
@@ -249,16 +241,6 @@
        return records;
    }
//    @Override
//    public InoutData getLastRecord(InoutParam param) {
//        return inoutMapper.getLastRecord(param);
//    }
//    @Override
//    public int updateCuStorage(InoutParam param) {
//        return inoutMapper.updateCuStorage(param);
//    }
    @Override
    public String validate(String intelCard, String plateNum) {
        InoutParam param = new InoutParam();
@@ -281,16 +263,11 @@
            param.setCompanyId(ContextUtil.getCompanyId());
        }
        if (null == param.getFoodType()) {
            // 根据仓库信息获取缓存
            Depot depot = commonService.getCacheDepot(param.getCompanyId(), param.getDepotId());
            param.setFoodType(depot.getFoodType());
        }
        // 清除缓存
        this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId(), true);
        this.delInoutFromCache(param.getDeptId(), param.getType(), param.getId());
        inoutMapper.toComplete(param);
        return null;
    }
@@ -344,43 +321,34 @@
            data.setFoodType(depot.getFoodType());
        }
        // 清除缓存
        this.delInoutFromCache(data.getDeptId(), data.getType(), data.getId(), false);
        inoutMapper.updateData(data);
        updateInoutCache(data);
        return null;
    }
    @Override
    public void addInoutCache(InoutData data) {
        data.setFiles(null);
        data.setCheckItems(null);
        this.setInoutCache(data.getDeptId(), data);
        // 推送到大屏
        List<InoutData> list = this.getListInoutCache(data.getDeptId());
        this.notifyToScreen(data.getDeptId(), list, null);
    }
    @Override
    public void updateInoutCache(InoutData data) {
        data.setFiles(null);
        data.setCheckItems(null);
        this.setInoutCache(data.getDeptId(), data);
        if (InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
        // 推送到大屏
        List<InoutData> list = this.getListInoutCache(data.getDeptId());
        List<InoutData> completeList = this.getCompleteListInoutCache(data.getDeptId());
            delInoutFromCache(data.getDeptId(), data.getType(), data.getId());
        this.notifyToScreen(data.getCompanyId(), list, completeList);
            setCompleteInoutCache(data.getDeptId(), data);
        } else {
            setInoutCache(data.getDeptId(), data);
        }
        //推送大屏
        notifyToScreen(data.getCompanyId(), data.getDeptId(), data.getProgress());
    }
    @Override
    public void delInoutFromCache(String deptId, String type, String id, boolean addToComplete) {
    public void delInoutFromCache(String deptId, String type, String id) {
        if (StringUtils.isEmpty(deptId)) {
            return;
        }
@@ -390,44 +358,14 @@
        if (StringUtils.isEmpty(id)) {
            return;
        }
        //删除未完成流程的缓存
        //从未完成列表中删除
        String key = this.buildInoutKey(deptId, InoutConstant.KEY_INOUT_LIST, type, id);
        InoutData inoutData = (InoutData) redisUtil.get(key);
        redisUtil.del(key);
        List<InoutData> list = this.getListInoutCache(deptId);
        //删除已完成流程的缓存
        key = this.buildInoutKey(deptId, InoutConstant.KEY_INOUT_COMPLETE_LIST, type, id);
        redisUtil.del(key);
        List<InoutData> completeList = this.getCompleteListInoutCache(deptId);
        if (addToComplete) {
            addInoutCompleteCache(inoutData);
            completeList = this.getCompleteListInoutCache(deptId);
        }
        // 通知到大屏
        notifyToScreen(deptId, list, completeList);
    }
    /**
     * 添加到已经完成的队列中
     *
     * @param data
     */
    public void addInoutCompleteCache(InoutData data) {
        if (null == data.getCompleteTime()) {
            data.setCompleteTime(new Date());
        }
        if (!InoutConstant.PROGRESS_RECORD.equals(data.getProgress())) {
            data.setProgress(InoutConstant.PROGRESS_RECORD);
        }
        this.setCompleteInoutCache(data.getDeptId(), data);
    }
    @Override
    public List<InoutData> getListInoutCache(String deptId) {
        String pattern = RedisConst.buildKey(deptId, InoutConstant.KEY_INOUT_LIST);
        Set<String> keys = redisUtil.keys(pattern);
        if (null == keys || keys.isEmpty()) {
@@ -484,19 +422,6 @@
            }
        }
        return null;
    }
    @Override
    public void initInoutScreen(String deptId) {
        if (null == deptId) {
            deptId = ContextUtil.subDeptId(null);
        }
        List<InoutData> curList = this.getListInoutCache(deptId);
        List<InoutData> complateList = this.getCompleteListInoutCache(deptId);
        notifyToScreen(deptId, curList, complateList);
    }
    @Override
@@ -695,7 +620,6 @@
     */
    private void setCompleteInoutCache(String deptId, InoutData data) {
        String key = this.buildInoutKey(deptId, InoutConstant.KEY_INOUT_COMPLETE_LIST, data.getType(), data.getId());
        //设置缓存到第二天凌晨(计算当前时间到第二天凌晨的时间差秒数)
        redisUtil.set(key, data, DateUtil.getNowToNextDaySeconds());
    }
@@ -703,12 +627,17 @@
    /**
     * 推送到大屏,判断只有当大屏在线时候才处理当前逻辑,避免页面卡顿,调用子任务完成推送
     *
     * @param deptId
     * @param curList      未完成流程个数
     * @param completeList 已经完成流程个数
     * @param companyId 组织编号
     * @param deptId    分库编号
     * @param progress  流转节点
     */
    private void notifyToScreen(String deptId, List<InoutData> curList,
                                List<InoutData> completeList) {
    public void notifyToScreen(String companyId, String deptId, String progress) {
        // 推送到大屏
        List<InoutData> curList = this.getListInoutCache(deptId);
        List<InoutData> completeList = this.getCompleteListInoutCache(deptId);
        if (null == WebSocketServer.contextOnLineMap.get(BizType.SCREEN
                .getCode())) {
@@ -732,13 +661,11 @@
                || WebSocketServer.contextOnLineMap.get(BizType.SCREEN_CHECK
                .getCode())) {
            if (null == completeList) {
                completeList = this.getCompleteListInoutCache(deptId);
            }
            // 创建一个子任务进行推送信息
            FutureTask<String> futureTask = new FutureTask<>(
                    new NotifyScreenTask(curList, completeList, deptId));
            FutureTask<String> futureTask = new FutureTask<>(new NotifyScreenTask(curList, completeList, deptId));
            ExecutorService executorService = Executors.newCachedThreadPool();
            executorService.submit(futureTask);
            executorService.shutdown();
igds-web/src/main/resources/static/admin/inout/in-weight.js
@@ -285,7 +285,7 @@
// 点击打印,系统判断是否已经执行完成,如果已经完成,直接打印,如果未完成则先执行完成
function printBill() {
    if (!recordData) {
        layer.alert("没有获取到业务数据,不支持打印!");
        alertError("没有获取到业务数据,打印被拒绝!");
        return;
    }
    // 从后台获取模版并打印
@@ -293,34 +293,25 @@
    // 合并更新當前编辑数据
    Object.assign(recordData, data);
    printBillStep2();
}
// 点击打印,先执行系统默认执行完成卡回收
function printBillStep2() {
    var index = layer.load();
    $.ajax({
        type: "POST",
        url: "../../basic/inout-report/inout-bill-weight",
        url: "../../basic/inout/report/bill-weight",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(recordData),
        success: function (result) {
            layer.close(index);
            if (result.code != "0000") {
                layer.msg(result.msg);
                alertError(result.msg);
            } else {
                layer.msg("开始渲染打印单……");
                if (companyId && companyId == "5016") {
                    print5016Weight(result.data);
                } else {
                    printWeight(result.data);
                }
                printWeight(result.data);
            }
        },
        error: function () {
            layer.close(index);
            layer.msg("获取打印模版失败,请联系管理员查看原因!!");
            alertError("获取打印模版失败,请联系管理员查看原因");
        }
    });
}
@@ -331,19 +322,13 @@
    form.render();
    recordData = null;
    weightDto.weight = 0.0;
    $("#weightValue").text("0.0");
    $("#img_scale_statule").attr("src", "../../static/images/icon-red.png");
    //称重可以复用
    $("#btn-weight").removeClass("layui-btn-disabled");
    $("#btn-weight").attr("disabled", false);
}
function flushPage() {
    layer.confirm('确定要刷新页面吗?', {icon: 3, title: '提示'}, function (index) {
        resetForm();
        layer.msg("页面重置完成,请重新操作……");
        layer.close(index);
    });
}
@@ -424,41 +409,49 @@
// 当前完成
function submit() {
    if (null == recordData) {
        notify("没有数据可以提交", null);
    if (!recordData) {
        alertError("没有业务数据信息,执行被拒绝");
        return;
    }
    var data = form.val("form-data");
    if (!data.depotId) {
        notify("装卸仓库必须填写", null);
        alertError("提示:装卸仓库必填");
        return;
    }
    if (!data.customerName) {
        alertError("提示:客户名称必填");
        return;
    }
    // 校验-入库满车称重
    if (InoutProgress.WEIGHT_FULL == recordData.progress) {
        if (data.fullWeight <= 0.0) {
            notify("满车称重信息必填!!", null);
            return;
        }
        if (!data.customerName) {
            notify("客户名称必填!!", null);
            return;
        }
    } else {
        if (data.emptyWeight <= 0.0) {
            notify("空车称重信息必填!!", null);
            return;
        }
        if (!data.foodVariety) {
            notify("粮食品种必填!!", null);
            return;
        }
        if (!data.settleWeight || data.settleWeight <= 0.0) {
            notify("结算重量合规,请核对!!", null);
            alertError("提示:满车称重信息必填");
            return;
        }
    }
    // 合并更新當前编辑数据
    if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
        if (data.emptyWeight <= 0.0) {
            alertError("提示:空车称重信息必填");
            return;
        }
        if (!data.foodVariety) {
            alertError("提示:粮食品种必填");
            return;
        }
        if (!data.settleWeight || data.settleWeight <= 0.0) {
            alertError("结算重量不合规,请核对");
            return;
        }
        if (!data.recordWeight || data.recordWeight <= 0.0) {
            alertError("入库重量不合规,请核对");
            return;
        }
    }
    //合并数据
    Object.assign(recordData, data);
    // 获取照片
@@ -474,7 +467,7 @@
    var index = layer.load();
    $.ajax({
        type: "POST",
        url: "../../basic/inout/inout-next-step",
        url: "../../basic/inout/submit-weight",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(recordData),
@@ -488,29 +481,8 @@
        },
        error: function () {
            layer.close(index);
            notify("提交失败,请重新尝试", null);
            alertError("提交失败,请重新尝试");
        }
    });
    //以下逻辑为增加一个语音通知的调用方法,不考虑返回结果--后台调用
    var curWeight = recordData.fullWeight;
    if (InoutProgress.WEIGHT_EMPTY == recordData.progress) {
        curWeight = recordData.emptyWeight;
    }
    var param = {
        sort: $("#scaleName").val(),
        weight: curWeight,
        inoutProgress: recordData.progress,
        deptId: recordData.deptId,
        companyId: recordData.companyId,
        plateNum: recordData.plateNum
    };
    $.ajax({
        type: "POST",
        url: "../../inout/api/notice-weight-done",
        dataType: "json",
        contentType: "application/json;charset=UTF-8",
        data: JSON.stringify(param)
    });
}
igds-web/src/main/resources/static/admin/inout/inout-print.js
@@ -1,23 +1,21 @@
/**
 * 打印过磅单
 */
printWeight = function(htmlStr) {
    var LODOP = CLODOP;
    LODOP.PRINT_INIT("过磅单");
    //LODOP.SET_PRINT_PAGESIZE(1, 0, '90mm', "A4");
    LODOP.SET_PRINT_PAGESIZE(1,2100,1400, "A4");
    //LODOP.SET_PRINT_PAGESIZE(3, 2100, '45', "A4");
    LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", htmlStr);
    LODOP.PREVIEW();
    //LODOP.PRINT_DESIGN();
};
print5016Weight = function(htmlStr) {
    var LODOP = CLODOP;
    LODOP.PRINT_INIT("称重单");
    LODOP.SET_PRINT_PAGESIZE(1, 1050, 1400, "");
    LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", htmlStr);
    LODOP.PREVIEW();
printWeight = function (htmlStr) {
    var LODOP = CLODOP;
    if ("5016" == companyId) {
        LODOP.PRINT_INIT("称重单");
        LODOP.SET_PRINT_PAGESIZE(1, 1050, 1400, "");
        LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", htmlStr);
        LODOP.PREVIEW();
    } else {
        LODOP.PRINT_INIT("过磅单");
        //LODOP.SET_PRINT_PAGESIZE(1, 0, '90mm', "A4");
        LODOP.SET_PRINT_PAGESIZE(1, 2100, 1400, "A4");
        //LODOP.SET_PRINT_PAGESIZE(3, 2100, '45', "A4");
        LODOP.ADD_PRINT_HTM(0, 0, "100%", "100%", htmlStr);
        LODOP.PREVIEW();
        //LODOP.PRINT_DESIGN();
    }
};
igds-web/src/main/resources/templates/admin/inout/in-weight.html
@@ -138,22 +138,20 @@
        <div class="qyzj-btnbox layui-clear">
            <div class="rkbk-quick fl">
                <button class="rkbk-quick-btn layui-btn" onclick="showCheck()">
                    <i><img th:src="@{../../static/images/icon-hyd.png}"/></i>质检信息
                </button>
                <button id="btn-weight" class="rkbk-quick-btn layui-btn btn-blue"
                        onclick="weight()">
                    <i><img th:src="@{../../static/images/icon-chengzhong.png}"/></i>称重确认
                    <i><img th:src="@{../../static/images/icon-chengzhong.png}"/></i>步骤1:称重确认
                </button>
                <button id="btn-submit"
                        class="rkbk-quick-btn layui-btn btn-green"
                        disabled=true onclick="submit()">
                    <i><img th:src="@{../../static/images/icon-ok.png}"/></i>完成称重
                        class="rkbk-quick-btn layui-btn btn-green" onclick="submit()">
                    <i><img th:src="@{../../static/images/icon-ok.png}"/></i>步骤2:完成称重
                </button>
                <button id="btn-printBill"
                        class="rkbk-quick-btn layui-btn btn-blue"
                        disabled=true onclick="printBill()">
                    <i><img th:src="@{../../static/images/icon-dayin.png}"/></i>打印过磅单
                        class="rkbk-quick-btn layui-btn btn-blue" onclick="printBill()">
                    <i><img th:src="@{../../static/images/icon-dayin.png}"/></i>步骤3:打印过磅单
                </button>
                <button class="rkbk-quick-btn layui-btn" onclick="showCheck()">
                    <i><img th:src="@{../../static/images/icon-hyd.png}"/></i>质检详细
                </button>
                <button class="rkbk-quick-btn layui-btn btn-violet"
                        onclick="flushPage()">
@@ -520,16 +518,6 @@
                            <!-- 补充字段默认隐藏 -->
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">检斤类型</label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="jjlx" value="0" title="称重入库" checked>
                                        <input type="radio" name="jjlx" value="1" title="标准包入库">
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">包装物</label>
                                    <div class="layui-input-block">
                                        <input type="radio" name="bzw" value="1" title="麻袋">
@@ -548,6 +536,16 @@
                                        <input type="text" name="dePackage" autocomplete="off"
                                               placeholder="请输入" class="layui-input weight"> <em
                                            class="kccz-data-dw">KG</em>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">单价</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="price" placeholder="请输入"
                                               class="layui-input"> <em class="kccz-data-dw">元/公斤</em>
                                    </div>
                                </div>
                            </div>
@@ -573,17 +571,6 @@
                                    </div>
                                </div>
                            </div>
                            <div class="layui-col-xs4">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">单价</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="price" placeholder="请输入"
                                               class="layui-input"> <em class="kccz-data-dw">元/公斤</em>
                                    </div>
                                </div>
                            </div>
                        </form>
                    </div>