jiazx0107@163.com
2023-05-31 607e62cd6ec91d53bac549299d986c23e5143d28
igds-inout/src/main/java/com/ld/igds/inout/controller/InoutController.java
@@ -9,13 +9,11 @@
import com.ld.igds.data.BaseParam;
import com.ld.igds.data.Page;
import com.ld.igds.data.PageResponse;
import com.ld.igds.data.SimpleDepot;
import com.ld.igds.inout.InoutConstant;
import com.ld.igds.inout.dto.InoutData;
import com.ld.igds.inout.dto.InoutGateDto;
import com.ld.igds.inout.dto.InoutParam;
import com.ld.igds.inout.dto.*;
import com.ld.igds.inout.manager.InoutCommonManager;
import com.ld.igds.inout.manager.InoutManager;
import com.ld.igds.io.dto.WeightDto;
import com.ld.igds.models.Depot;
import com.ld.igds.models.DicTrigger;
import com.ld.igds.models.InoutConf;
@@ -173,7 +171,6 @@
        }
        ModelAndView view = new ModelAndView();
        IUser user = ContextUtil.getLoginUser();
        view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
@@ -183,59 +180,52 @@
        view.addObject("deptId", deptId);
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listInDepot();
        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        // 当前流程标签
        view.addObject("progress", InoutConstant.PROGRESS_WEIGHT_TAG);
        //入库流程
        //入库流程配置
        String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(), deptId, InoutConstant.TYPE_IN);
        view.addObject("inoutProgress", inoutProgress);
        //称重结果是否可修改
        String weightEditTag = inoutCommonManager.getWeightEditTag(user.getCompanyId(), ContextUtil.subDeptId(user));
        //称重是否可编辑标签
        String weightEditTag = inoutCommonManager.getWeightEditTag(user.getCompanyId(), deptId);
        view.addObject("weightEditTag", weightEditTag);
        // 粮食品种下拉框
        List<DicTrigger> listFoodVariety = inoutCommonManager.getDicTrigger(Constant.TRIGGER_PARENT_FOOD_VARIETY, user.getCompanyId());
        view.addObject("listFoodVariety", listFoodVariety);
        // 获取出入库配置信息
        // 获取出入库设备配置信息
        List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
        //获取所有的地磅列表用于页面用户选择
        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
        //根据出入库设备信息筛选地磅配置信息,所有地磅,支持用户手动选择
        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
        view.addObject("listWeight", listWeight);
        // 获取当前地磅信息
        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
        // 获取当前地磅
        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
        view.addObject("weightDto", weightDto);
        // 过程摄像头1
        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
                InoutConstant.PROGRESS_WEIGHT_TAG, 1);
        InoutConf conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 1);
        view.addObject("snapDto1", conf);
        // 过程摄像头2
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
                InoutConstant.PROGRESS_WEIGHT_TAG, 2);
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 2);
        view.addObject("snapDto2", conf);
        // 过程摄像头3
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60,
                InoutConstant.PROGRESS_WEIGHT_TAG, 3);
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_60, InoutConstant.PROGRESS_WEIGHT_TAG, 3);
        view.addObject("snapDto3", conf);
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_70,
                InoutConstant.PROGRESS_WEIGHT_TAG, 1);
        view.addObject("gateDto", conf);
        // 智慧卡
        // 远程智慧卡
        conf = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_80, InoutConstant.PROGRESS_WEIGHT_TAG, 1);
        if (null != conf) conf.setSort(sort);
        view.addObject("cardDto", conf);
        view.setViewName("admin/inout/in-weight");
        return view;
@@ -254,12 +244,13 @@
        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("deptId", ContextUtil.subDeptId(user));
        view.addObject("deptId", deptId);
        view.addObject("type", InoutConstant.TYPE_IN);
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listInDepot();
        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        //入库流程
@@ -296,12 +287,13 @@
        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("deptId", ContextUtil.subDeptId(user));
        view.addObject("deptId", deptId);
        view.addObject("type", InoutConstant.TYPE_IN);
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listInDepot();
        List<SimpleDepot> listDepot = commonManager.getCacheDeptIn(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        //入库流程
@@ -389,7 +381,7 @@
        view.addObject("deptId", deptId);
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listInDepot();
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(), deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        // 当前流程标签
@@ -411,11 +403,11 @@
        List<InoutConf> listInoutConf = inoutCommonManager.getListInoutConf(user.getCompanyId(), deptId);
        //获取所有的地磅列表用于页面用户选择
        List<WeightDto> listWeight = inoutCommonManager.getInoutWeightAll(listInoutConf, InoutConstant.CONF_TYPE_30);
        List<InoutConf> listWeight = inoutCommonManager.getInoutConf(listInoutConf, InoutConstant.CONF_TYPE_30);
        view.addObject("listWeight", listWeight);
        // 获取当前地磅信息
        WeightDto weightDto = inoutCommonManager.getInoutCurWeight(listWeight, sort);
        InoutConf weightDto = inoutCommonManager.getInoutConf(listInoutConf, sort, InoutConstant.CONF_TYPE_30);
        view.addObject("weightDto", weightDto);
        // 过程摄像头1
@@ -456,7 +448,7 @@
        view.addObject("type", InoutConstant.TYPE_OUT);
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listOutDepot();
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        //出库流程
@@ -491,15 +483,19 @@
        ModelAndView view = new ModelAndView();
        // 仓库列表做下拉框使用
        List<Depot> listDepot = commonManager.listOutDepot();
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        IUser user = ContextUtil.getLoginUser();
        String deptId =  ContextUtil.subDeptId(user);
        view.addObject(Constant.MODEL_KEY_LOGIN_USER, user);
        view.addObject("bizType", BizType.INOUT_OUT.getCode());
        view.addObject("deptId", ContextUtil.subDeptId(user));
        view.addObject("deptId",deptId);
        view.addObject("type", InoutConstant.TYPE_OUT);
        // 仓库列表做下拉框使用
        List<SimpleDepot> listDepot = commonManager.getCacheDeptOut(user.getCompanyId(),deptId);
        view.addObject(Constant.MODEL_KEY_DEPOT_LIST, listDepot);
        //出库流程
        String inoutProgress = inoutCommonManager.getInoutProgressConf(user.getCompanyId(),
@@ -716,4 +712,90 @@
                    "后台异常:" + e.getMessage());
        }
    }
    /**
     * 扦样页面
     *
     * @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);
        //入库流程
        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 param
     * @return
     */
    @RequestMapping("/page-sample-data")
    public PageResponse<Page<InoutCheckData>> pageSampleData(@RequestBody InoutCheckParam param) {
        return inoutManager.pageSampleData(param);
    }
    /**
     * 扦样页面提交
     *
     * @param data
     * @return
     */
    @RequestMapping("/update-sample")
    public PageResponse<InoutCheckData> updateSample(@RequestBody InoutCheckData data) {
        try {
            return inoutManager.updateSampleData(data);
        } catch (Exception e) {
            log.error("后台异常:{}", e);
            return new PageResponse<>(RespCodeEnum.CODE_1111.getCode(),
                    "后台异常:" + e.getMessage(), null);
        }
    }
}