package com.ld.igds.inout.manager;
|
|
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<InoutConf> getListInoutConf(String companyId, String deptId) {
|
return inoutCommonService.getCacheInoutConf(companyId, deptId);
|
}
|
|
/**
|
* 根据配置获取出入库的配置参数
|
*
|
* @param listInoutConf 配置列表
|
* @param sort 方案序号
|
* @param type 设备类型
|
* @param inoutProgress 出入库流程
|
* @return 车牌设备配置,没有则返回NULL
|
*/
|
public InoutConf getInoutConf(List<InoutConf> listInoutConf, String sort, String type, String inoutProgress, int inOrder) {
|
if (null == listInoutConf) return null;
|
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 null;
|
|
return result;
|
}
|
|
|
/**
|
* 根据类型获取字典表下拉框
|
*
|
* @param parentCode
|
* @param companyId
|
* @return
|
*/
|
public List<DicTrigger> 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 = null;
|
if (inoutSysConf != null) {
|
weightEditTag = inoutSysConf.getWeightEditTag();
|
}
|
return weightEditTag;
|
}
|
|
public List<WeightDto> getInoutWeightAll(List<InoutConf> listInoutConf, String type) {
|
List<WeightDto> result = new ArrayList<>();
|
if (null == listInoutConf) return result;
|
|
for (InoutConf conf : listInoutConf) {
|
if (type.equals(conf.getType())) {
|
result.add(new WeightDto(conf));
|
}
|
}
|
return result;
|
}
|
|
public WeightDto getInoutCurWeight(List<WeightDto> listWeight, String sort) {
|
if (null == listWeight || listWeight.isEmpty()) return new WeightDto();
|
|
if (listWeight.size() == 1) return listWeight.get(0);
|
|
for (WeightDto weight : listWeight) {
|
if (weight.getSort().equals(sort)) return weight;
|
}
|
return new WeightDto();
|
}
|
|
|
/**
|
* 出入库大屏初始化通知后端
|
*
|
* @param deptId
|
*/
|
public void initInoutScreen(String deptId) {
|
if (StringUtils.isEmpty(deptId))
|
deptId = ContextUtil.subDeptId(null);
|
inoutService.initInoutScreen(deptId);
|
}
|
|
public List<InoutData> getListInoutCache(String deptId) {
|
return inoutService.getListInoutCache(deptId);
|
|
}
|
|
public List<InoutData> getCompleteListInoutCache(String deptId) {
|
return inoutService.getCompleteListInoutCache(deptId);
|
}
|
}
|