package com.ld.igds.inout.manager; import com.ld.igds.constant.Constant; import com.ld.igds.inout.InoutConstant; import com.ld.igds.inout.dto.InoutData; import com.ld.igds.inout.service.InoutService; import com.ld.igds.io.dto.WeightDto; import com.ld.igds.m.service.InoutCommonService; import com.ld.igds.models.DicTrigger; import com.ld.igds.models.InoutConf; import com.ld.igds.models.InoutSysConf; import com.ld.igds.sys.service.DicTriggerService; import com.ld.igds.util.ContextUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.ArrayList; import java.util.List; /** * @Desc: 出入库公共业务管理模块 * @author: andy.jia * @update-time: 2022/11/26 13:20 */ @Component public class InoutCommonManager { @Resource private InoutCommonService inoutCommonService; @Resource private DicTriggerService dicTriggerService; @Resource private InoutService inoutService; /** * 获取出入库的整个流程信息 * * @param companyId * @param deptId * @param inoutType * @return */ public String getInoutProgressConf(String companyId, String deptId, String inoutType) { // 从缓存中获取出入库系统配置信息 InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(companyId, deptId); String progressConf = null; if (inoutSysConf != null) { if (InoutConstant.TYPE_IN.equals(inoutType)) { progressConf = inoutSysConf.getProgressIn(); } if (InoutConstant.TYPE_OUT.equals(inoutType)) { progressConf = inoutSysConf.getProgressOut(); } } return progressConf; } /** * 获取出入库设备配置信息 * * @param companyId * @param deptId * @return */ public List getListInoutConf(String companyId, String deptId) { return inoutCommonService.getCacheInoutConf(companyId, deptId); } /** * 根据配置获取出入库的配置参数 * * @param listInoutConf 配置列表 * @param sort 方案序号 * @param type 设备类型 * @param inoutProgress 出入库流程 * @return 车牌设备配置,没有则返回NULL */ public InoutConf getInoutConf(List listInoutConf, String sort, String type, String inoutProgress, int inOrder) { if (null == listInoutConf) return new InoutConf(sort); if (StringUtils.isEmpty(sort)) sort = "1"; InoutConf result = null; for (InoutConf conf : listInoutConf) { if (sort.equals(conf.getSort()) && type.equals(conf.getType()) && inoutProgress.equals(conf.getInoutProgress())) { if (conf.getInOrder() == inOrder) { result = conf; break; } } } if (null == result) return new InoutConf(sort); return result; } public List getInoutConf(List listInoutConf, String type) { List result = new ArrayList<>(); if (null == listInoutConf) return result; for (InoutConf conf : listInoutConf) { if (type.equals(conf.getType())) { result.add(conf); } } return result; } public InoutConf getInoutConf(List listInoutConf, String sort, String type) { if (null == listInoutConf) return new InoutConf(sort); if (StringUtils.isEmpty(sort)) sort = "1"; InoutConf result = null; for (InoutConf conf : listInoutConf) { if (sort.equals(conf.getSort()) && type.equals(conf.getType())) { return conf; } } if (null == result) return new InoutConf(sort); return result; } /** * 根据类型获取字典表下拉框 * * @param parentCode * @param companyId * @return */ public List getDicTrigger(String parentCode, String companyId) { return dicTriggerService.getCacheDicByParent(companyId, parentCode); } /** * 获取地磅重量编辑标签 * * @param companyId * @param deptId * @return */ public String getWeightEditTag(String companyId, String deptId) { // 从缓存中获取出入库系统配置信息 InoutSysConf inoutSysConf = inoutCommonService.getCacheInoutSysConf(companyId, deptId); String weightEditTag = Constant.YN_N; if (inoutSysConf != null) { weightEditTag = inoutSysConf.getWeightEditTag(); } if (null == weightEditTag) weightEditTag = Constant.YN_N; return weightEditTag; } /** * 出入库大屏初始化通知后端 * * @param 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 getListInoutCache(String deptId) { return inoutService.getListInoutCache(deptId); } public List getCompleteListInoutCache(String deptId) { return inoutService.getCompleteListInoutCache(deptId); } }