jiazx0107@163.com
2023-06-22 a4d556ff6f8191637be669e7884fc3e500021516
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
@@ -25,7 +25,6 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@@ -100,9 +99,69 @@
        view.setViewName("admin/inout/in-register");
        return view;
    }
    /**
     * 扦样页面
     *
     * @param sort 表示使用的出入库设备配套号,不传递默认为1
     * @return
     */
    @RequestMapping("/in-sample")
    public ModelAndView inSample(HttpServletRequest httpRequest, @RequestParam(value = "sort", required = false) String sort) {
        if (StringUtils.isEmpty(sort)) {
            sort = commonManager.getInoutWeightByClient(httpRequest);
        }
        ModelAndView view = new ModelAndView();
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listDepot(true);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        IUser user = ContextUtil.getLoginUser();
        view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
        String deptId = ContextUtil.subDeptId(user);
        view.addObject("bizType", BizType.INOUT_IN.getCode());
        view.addObject("type", InoutConstant.TYPE_IN);
        view.addObject("deptId", deptId);
        DefaultDept dept = commonManager.getSubDept(user, deptId);
        view.addObject("deptName", dept.getName());
        //入库流程
        String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(), deptId, InoutConstant.TYPE_IN);
        view.addObject("inoutProgress", inoutProgress);
        // 当前流程节点
        view.addObject("progress", InoutConstant.PROGRESS_CHECK);
        // 粮食品种下拉框
        List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
        view.addObject("listFoodVariety", listFoodVariety);
        // 粮食等级下拉框
        List<DicTrigger> listFoodLevel = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_LEVEL, user.getCompanyId());
        view.addObject("listFoodLevel", listFoodLevel);
        view.addObject("endTime",
                DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
        view.addObject("startTime", DateFormatUtils.format(
                DateUtil.getNewByDay(null, -10), "yyyy-MM-dd"));
        // 获取出入库配置信息
        List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
        // 获取扦样机信息
        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_20, InoutConstant.PROGRESS_CHECK, 1);
        view.addObject("checkDto", conf);
        view.setViewName("admin/inout/in-sample");
        return view;
    }
    /**
     * 扦样化验页面
     * 质检页面
     *
     * @param sort 表示使用的出入库设备配套号,不传递默认为1
     * @return
@@ -309,15 +368,6 @@
        // 当前流程节点
        view.addObject("progress", InoutConstant.PROGRESS_CARD_BACK);
        // 粮食品种下拉框
        List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
        view.addObject("listFoodVariety", listFoodVariety);
        // 粮食等级下拉框
        List<DicTrigger> listFoodLevel = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_LEVEL, user.getCompanyId());
        view.addObject("listFoodLevel", listFoodLevel);
        view.setViewName("admin/inout/in-card-back");
        return view;
@@ -537,7 +587,7 @@
    }
    /**
     * 卡回收数据查询,没有流程状态的数据直接返回
     * 出库收卡信息查询
     *
     * @param param
     * @return
@@ -545,41 +595,7 @@
    @RequestMapping("/inout-query-back")
    public PageResponse<InoutData> inoutQueryBack(@RequestBody InoutParam param) {
        param.setProgress(null);
        return inoutManager.inoutQuery(param);
    }
    /**
     * 出入库数据更新,提交到下个流程
     *
     * @param data
     * @return
     */
    @RequestMapping("/inout-next-step")
    @Transactional
    public PageResponse<InoutData> inoutNextStep(@RequestBody InoutData data) {
        try {
            IUser user = ContextUtil.getLoginUser();
            if (StringUtils.isEmpty(data.getCompanyId())) {
                data.setCompanyId(user.getCompanyId());
            }
            if (StringUtils.isEmpty(data.getDeptId())) {
                data.setDeptId(ContextUtil.subDeptId(user));
            }
            if (InoutConstant.TYPE_IN.equals(data.getType())) {
                return inoutManager.inNextStep(data);
            } else {
                return inoutManager.outNextStep(data);
            }
        } catch (Exception e) {
            log.error("后台异常:{}", e);
            //手动回滚
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "后台异常:" + e.getMessage());
        }
        return inoutManager.inoutQueryBack(param);
    }
    /**
@@ -605,6 +621,18 @@
        }
        return inoutManager.submitRegisterInout(data);
    }
    /**
     * 扦样页面提交更新
     *
     * @param data
     * @return
     */
    @RequestMapping("/submit-sample")
    @Transactional
    public PageResponse<InoutCheckData> submitSample(@RequestBody InoutCheckData data) throws Exception {
        return inoutManager.submitSample(data);
    }
    /**
@@ -639,32 +667,16 @@
    }
    /**
     * 卡回收页面提交,如果是正常流程卡回收则走正常完成流程,否则执行删除逻辑并回收卡
     * 出入库卡回收提交,如果数据已经是完成,直接不做更新,如果未完成则执行完成
     *
     * @param data
     * @return
     */
    @RequestMapping("/inout-back-submit")
    public PageResponse<InoutData> inoutBackSubmit(@RequestBody InoutData data) {
        return inoutManager.inoutBack(data);
    @RequestMapping("/submit-card-back")
    @Transactional
    public PageResponse<InoutData> submitCardBack(@RequestBody InoutData data) throws Exception {
        return inoutManager.submitCardBack(data);
    }
//    /**
//     * 化验页面数据提交
//     *
//     * @param data
//     * @return
//     */
//    @RequestMapping("/update-check")
//    public PageResponse<InoutData> updateCheck(@RequestBody InoutData data) {
//        try {
//            return inoutManager.updateCheck(data);
//        } catch (Exception e) {
//            log.error("后台异常:{}", e);
//            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
//                    "后台异常:" + e.getMessage(), null);
//        }
//    }
    /**
     * 根据卡号和类型,直接完成当前流程
@@ -672,57 +684,10 @@
     * @param data
     * @return
     */
    @RequestMapping("/inout-to-complete")
    public PageResponse<InoutData> inoutComplete(@RequestBody InoutData data) {
        try {
            return inoutManager.inoutComplete(data);
        } catch (Exception e) {
            log.error("后台异常:{}", e);
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "后台异常:" + e.getMessage(), data);
        }
    }
//    /**
//     * 根据入库数据信息,获取检查项信息,如果当前数据已经检测完成,查询检测结果,如果没有检测完成则根据检测项配置获取需要检测的项目信息
//     *
//     * @param data
//     * @return
//     */
//    @RequestMapping("/get-check-item")
//    public PageResponse<List<CheckItemData>> getCheckItem(@RequestBody InoutData data) {
//        try {
//            return inoutManager.getCheckItem(data);
//        } catch (Exception e) {
//            log.error("后台异常:{}", e);
//            return new PageResponse<List<CheckItemData>>(
//                    RespCodeEnum.CODE_1111.getCode(), "后台异常:" + e.getMessage());
//        }
//    }
//    /**
//     * 分页获取数据信息
//     *
//     * @param param
//     * @return
//     */
//    @RequestMapping("/page-check-data")
//    public PageResponse<Page<InoutData>> pageCheckData(
//            @RequestBody InoutParam param) {
//        return inoutManager.pageCheckData(param);
//    }
    /**
     * 道闸控制
     *
     * @param param
     * @return
     */
    @RequestMapping("/gate-ctrl")
    public PageResponse<String> gateCtrl(
            @RequestBody InoutGateDto param) {
        return null;
    @RequestMapping("/submit-complete")
    @Transactional
    public PageResponse<InoutData> submitComplete(@RequestBody InoutData data) throws Exception {
        return inoutManager.submitComplete(data);
    }
    /**
@@ -751,64 +716,7 @@
    }
    /**
     * 扦样页面
     *
     * @param sort 表示使用的出入库设备配套号,不传递默认为1
     * @return
     */
    @RequestMapping("/in-sample")
    public ModelAndView inSample(HttpServletRequest httpRequest, @RequestParam(value = "sort", required = false) String sort) {
        if (StringUtils.isEmpty(sort)) {
            sort = commonManager.getInoutWeightByClient(httpRequest);
        }
        ModelAndView view = new ModelAndView();
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listDepot(true);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        IUser user = ContextUtil.getLoginUser();
        view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
        String deptId = ContextUtil.subDeptId(user);
        view.addObject("bizType", BizType.INOUT_IN.getCode());
        view.addObject("type", InoutConstant.TYPE_IN);
        view.addObject("deptId", deptId);
        DefaultDept dept = commonManager.getSubDept(user, deptId);
        view.addObject("deptName", dept.getName());
        //入库流程
        String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(), deptId, InoutConstant.TYPE_IN);
        view.addObject("inoutProgress", inoutProgress);
        // 当前流程节点
        view.addObject("progress", InoutConstant.PROGRESS_CHECK);
        // 粮食品种下拉框
        List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
        view.addObject("listFoodVariety", listFoodVariety);
        // 粮食等级下拉框
        List<DicTrigger> listFoodLevel = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_LEVEL, user.getCompanyId());
        view.addObject("listFoodLevel", listFoodLevel);
        view.addObject("endTime",
                DateFormatUtils.format(new Date(), "yyyy-MM-dd"));
        view.addObject("startTime", DateFormatUtils.format(
                DateUtil.getNewByDay(null, -10), "yyyy-MM-dd"));
        // 获取出入库配置信息
        List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
        // 获取扦样机信息
        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_20, InoutConstant.PROGRESS_CHECK, 1);
        view.addObject("checkDto", conf);
        view.setViewName("admin/inout/in-sample");
        return view;
    }
    /**
     * 分页获取扦样数据
@@ -821,17 +729,7 @@
        return inoutManager.pageSampleData(param);
    }
    /**
     * 扦样页面提交更新
     *
     * @param data
     * @return
     */
    @RequestMapping("/update-sample")
    public PageResponse<InoutCheckData> updateSample(@RequestBody InoutCheckData data) {
        return inoutManager.updateSampleData(data);
    }
    /**
     * 分页获取化验数据
@@ -869,6 +767,7 @@
    /**
     * 根据粮食等级及粮食品种获取粮食定价
     *
     * @param param
     * @return
     */