forked from I3-YF/i3plus-mes-yfai
jx pmc 看板
parent
f5eb7928c8
commit
76d68b5860
@ -0,0 +1,36 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.api.base.IProdOrgExtService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : wangjie
|
||||||
|
* @CreateDate : 2022-02-15
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
public class JxCenterWorkingBoardProxyAllCenterService implements IJxCenterWorkingBoardService {
|
||||||
|
|
||||||
|
private IProdOrgExtService prodOrgExtService;
|
||||||
|
|
||||||
|
public JxCenterWorkingBoardProxyAllCenterService() {
|
||||||
|
this.prodOrgExtService = (IProdOrgExtService) SpringContextsUtil.getBean("prodOrgExtService");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||||
|
List<MesWorkCenterExt> workCenterExtDbList = prodOrgExtService.queryWorkCenterExtList((String) dataMap.get(MesExtConstWords.ORGANIZE_CODE));
|
||||||
|
if (CollectionUtils.isEmpty(workCenterExtDbList)) return dataMap;
|
||||||
|
dataMap.put(MesWorkCenterExt.class.getSimpleName(), workCenterExtDbList);
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesRepairTask;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.repository.MesRepairTaskRepository;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||||
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||||
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||||
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||||
|
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : wangjie
|
||||||
|
* @CreateDate : 2022-02-15
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
public class JxCenterWorkingBoardProxyRepairService implements IJxCenterWorkingBoardService {
|
||||||
|
|
||||||
|
private IJxCenterWorkingBoardService proxyService;
|
||||||
|
|
||||||
|
private MesRepairTaskRepository repairTaskRepository;
|
||||||
|
|
||||||
|
public JxCenterWorkingBoardProxyRepairService(IJxCenterWorkingBoardService proxyService) {
|
||||||
|
this.proxyService = proxyService;
|
||||||
|
this.repairTaskRepository = (MesRepairTaskRepository) SpringContextsUtil.getBean("mesRepairTaskRepository");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||||
|
|
||||||
|
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
|
||||||
|
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
|
||||||
|
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
|
||||||
|
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
|
||||||
|
String endTime = (String) dataMap.get(MesExtConstWords.END_TIME);
|
||||||
|
|
||||||
|
List<MesRepairTask> repairTaskDbList = null;
|
||||||
|
if (!StringUtils.isEmpty(workCenterCode) && !StringUtils.isEmpty(workTime))
|
||||||
|
repairTaskDbList = repairTaskRepository.findByProperty(
|
||||||
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME},
|
||||||
|
new Object[]{orgainzeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime});
|
||||||
|
else if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) {
|
||||||
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
|
||||||
|
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
|
||||||
|
repairTaskDbList = repairTaskRepository.findByHqlWhere(packBean);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtils.isEmpty(repairTaskDbList)) return dataMap;
|
||||||
|
|
||||||
|
dataMap.put(MesRepairTask.class.getSimpleName(), repairTaskDbList);
|
||||||
|
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||||
|
|
||||||
|
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.bean.MesShiftProdCenterRecord;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||||
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.StringJoiner;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author : wangjie
|
||||||
|
* @CreateDate : 2022-02-15
|
||||||
|
* @Modify:
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
public class JxCenterWorkingBoardProxyWorkingStatusService implements IJxCenterWorkingBoardService {
|
||||||
|
|
||||||
|
private IJxCenterWorkingBoardService proxyService;
|
||||||
|
|
||||||
|
public JxCenterWorkingBoardProxyWorkingStatusService() {}
|
||||||
|
|
||||||
|
public JxCenterWorkingBoardProxyWorkingStatusService(IJxCenterWorkingBoardService proxyService) {
|
||||||
|
this.proxyService = proxyService;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||||
|
|
||||||
|
if (null != proxyService) proxyService.queryCenterWorkingBoardData(dataMap);
|
||||||
|
|
||||||
|
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
|
||||||
|
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
|
||||||
|
String shiftCode = (String) dataMap.get(MesExtConstWords.SHIFT_CODE);
|
||||||
|
String curTime = (String) dataMap.get("curTime");
|
||||||
|
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
|
||||||
|
|
||||||
|
List<MesShiftProdCenterRecord> filterList = (CollectionUtils.isEmpty(shiftProdCenterRecordList) || StringUtils.isEmpty(workTime) || StringUtils.isEmpty(shiftCode)) ? null :
|
||||||
|
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && o.getShiftCode().equals(shiftCode) &&
|
||||||
|
MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_PROD.getValue() >= o.getProdType() && o.getStartTime().compareTo(curTime) <= 0 && o.getEndTime().compareTo(curTime) >= 0)).collect(Collectors.toList());
|
||||||
|
MesShiftProdCenterRecord filterData = CollectionUtils.isEmpty(filterList) ? null :
|
||||||
|
filterList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesShiftProdCenterRecord::getModifyDatetime).reversed()).collect(Collectors.toList()).get(0);
|
||||||
|
|
||||||
|
SHIFT_PROD_TYPE_COLOR enumItem;
|
||||||
|
if (null == filterData) enumItem = SHIFT_PROD_TYPE_COLOR.NO_WORKING;
|
||||||
|
else enumItem = SHIFT_PROD_TYPE_COLOR.getByValue(filterData.getProdType());
|
||||||
|
|
||||||
|
dataMap.put("生产状态", new StringJoiner(MesExtConstWords.COMMA).add(enumItem.workingStatusName).add(enumItem.color).toString());
|
||||||
|
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum SHIFT_PROD_TYPE_COLOR {
|
||||||
|
//System.out.println(String.format("#%02x%02x%02x", Color.white.getRed(), Color.white.getGreen(), Color.white.getBlue()));
|
||||||
|
NO_WORKING(0, "无生产", "无生产", "#808080", "gray"),
|
||||||
|
NORMAL_STOP_CENTER(10, "常规停机", "常规停机", "#808080", "gray"),
|
||||||
|
UNNORMAL_STOP_CENTER(20, "非常规停机", "异常停机", "#ff0000", "red"),
|
||||||
|
NORMAL_PROD(30, "常规生产", "正常生产", "#00ff00", "green"),
|
||||||
|
UNNORMAL_PROD(40, "非常规生产", "加班生产", "#ff0000", "red");
|
||||||
|
|
||||||
|
private int value;
|
||||||
|
private String description;
|
||||||
|
private String workingStatusName;
|
||||||
|
private String color;
|
||||||
|
private String colorName;
|
||||||
|
|
||||||
|
SHIFT_PROD_TYPE_COLOR(int value, String description, String workingStatusName, String color, String colorName) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
this.workingStatusName = workingStatusName;
|
||||||
|
this.color = color;
|
||||||
|
this.colorName = colorName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SHIFT_PROD_TYPE_COLOR getByValue(int value) {
|
||||||
|
for (SHIFT_PROD_TYPE_COLOR matchType : values()) {
|
||||||
|
if (matchType.getValue() == value) {
|
||||||
|
return matchType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue