czt
2023-06-12 1b60f1df51e1824154018a5b6a7159b09b44c8b1
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;
@@ -239,7 +238,12 @@
     * @return
     */
    @RequestMapping("/in-handle")
    public ModelAndView inHandle() {
    public ModelAndView inHandle(HttpServletRequest httpRequest, @RequestParam(value = "sort", required = false) String sort) {
        //如果没有指定地磅,从用户上一个选择中获取
        if (StringUtils.isEmpty(sort)) {
            sort = commonManager.getInoutWeightByClient(httpRequest);
        }
        ModelAndView view = new ModelAndView();
@@ -263,15 +267,13 @@
        // 当前流程节点
        view.addObject("progress", InoutConstant.PROGRESS_HANDLE);
        // 粮食品种下拉框
        List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
        view.addObject("listFoodVariety", listFoodVariety);
        // 远程智慧卡
        // 获取出入库设备配置信息
        List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_80, InoutConstant.PROGRESS_WEIGHT_TAG, 1);
        if (null != conf) conf.setSort(sort);
        view.addObject("cardDto", conf);
        // 粮食等级下拉框
        List<DicTrigger> listFoodLevel = inoutCommonManager.getDicTrigger(
                Constant.TRIGGER_PARENT_FOOD_LEVEL, user.getCompanyId());
        view.addObject("listFoodLevel", listFoodLevel);
        view.setViewName("admin/inout/in-handle");
        return view;
@@ -322,6 +324,7 @@
    /**
     * 出库登记
     *
     * @param sort 表示使用的出入库设备配套号,不传递默认为1
     * @return
     */
@@ -449,7 +452,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 +489,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 +531,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 +607,38 @@
    }
    /**
     * 出入库称重环节提交
     *
     * @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);
        }
    }
    /**
     * 出入库称重环节提交,请注意:值仓挑提交的数据非出入库流水完整信息,不能直接调用update方法
     *
     * @param data
     * @return
     */
    @RequestMapping("/submit-handle")
    @Transactional
    public PageResponse<InoutData> submitHandle(@RequestBody InoutData data) throws Exception {
        return inoutManager.submitHandle(data);
    }
    /**
     * 卡回收页面提交,如果是正常流程卡回收则走正常完成流程,否则执行删除逻辑并回收卡
     *
     * @param data
@@ -614,22 +649,22 @@
        return inoutManager.inoutBack(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);
        }
    }
//    /**
//     * 化验页面数据提交
//     *
//     * @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);
//        }
//    }
    /**
     * 根据卡号和类型,直接完成当前流程
@@ -648,34 +683,34 @@
        }
    }
    /**
     * 根据入库数据信息,获取检查项信息,如果当前数据已经检测完成,查询检测结果,如果没有检测完成则根据检测项配置获取需要检测的项目信息
     *
     * @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 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("/page-check-data")
//    public PageResponse<Page<InoutData>> pageCheckData(
//            @RequestBody InoutParam param) {
//        return inoutManager.pageCheckData(param);
//    }
    /**
     * 道闸控制
@@ -776,7 +811,7 @@
    }
    /**
     * 分页获取扦样记录信息
     * 分页获取扦样数据
     *
     * @param param
     * @return
@@ -787,7 +822,7 @@
    }
    /**
     * 扦样页面提交
     * 扦样页面提交更新
     *
     * @param data
     * @return
@@ -797,4 +832,38 @@
        return inoutManager.updateSampleData(data);
    }
    /**
     * 分页获取化验数据
     *
     * @param param
     * @return
     */
    @RequestMapping("/page-check-data")
    public PageResponse<Page<InoutCheckData>> pageCheckData(@RequestBody InoutCheckParam param) {
        return inoutManager.pageCheckData(param);
    }
    /**
     * 获取化验项信息
     *
     * @param param
     * @return
     */
    @RequestMapping("/get-check-item")
    public PageResponse<List<CheckItemData>> getCheckItem(@RequestBody InoutCheckParam param) {
        return inoutManager.getCheckItemData(param);
    }
    /**
     * 化验页面提交更新
     *
     * @param data
     * @return
     */
    @RequestMapping("/update-check")
    public PageResponse<InoutCheckData> updateCheck1(@RequestBody InoutCheckData data) {
        return inoutManager.updateCheckData(data);
    }
}