forked from I3-YF/i3plus-mes-yfai
tags/yfai-mes-ext-v1.0
parent
79232c522f
commit
202fca78c0
@ -0,0 +1,56 @@
|
||||
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.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesShift;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesShiftRepository;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardProxyShiftService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private MesShiftRepository shiftRepository;
|
||||
|
||||
public JxCenterWorkingBoardProxyShiftService() {
|
||||
this.shiftRepository = (MesShiftRepository) SpringContextsUtil.getBean("mesShiftRepository");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
|
||||
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
|
||||
String shiftCode = (String) dataMap.get(MesExtConstWords.SHIFT_CODE);
|
||||
|
||||
if (StringUtils.isEmpty(shiftCode)) return dataMap;
|
||||
|
||||
String item = new StringJoiner(MesExtConstWords.AND).add("SHIFT").add(workCenterCode).add(shiftCode).toString();
|
||||
String shift4Cached = (String) execCachedCenterWorkingBoardData(organizeCode, MesExtConstWords.ZERO_STR, item, null);
|
||||
MesShift shift = !StringUtils.isEmpty(shift4Cached) ? JSONObject.parseObject(shift4Cached, MesShift.class) : execShift(organizeCode, workCenterCode, shiftCode, item);
|
||||
if (null == shift) return dataMap;
|
||||
|
||||
dataMap.put(MesShift.class.getSimpleName(), shift);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
private MesShift execShift(String organizeCode, String workCenterCode, String shiftCode, String item) {
|
||||
MesShift shiftDb = shiftRepository.getByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
|
||||
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, shiftCode});
|
||||
if (null != shiftDb) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), item, JSONObject.toJSONString(shiftDb));
|
||||
return shiftDb;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
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.MesOutPutStatistics;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesShiftProdCenterPm;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesShiftProdCenterRecord;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesShift;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardWorkDailyService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService0;
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService1;
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
public JxCenterWorkingBoardWorkDailyService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService1, IJxCenterWorkingBoardService proxyService) {
|
||||
this.proxyService0 = proxyService0;
|
||||
this.proxyService1 = proxyService1;
|
||||
this.proxyService = proxyService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
proxyService0.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
proxyService1.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
proxyService.queryCenterWorkingBoardData(packProxyCondition(dataMap));
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
MesShift shift = (MesShift) dataMap.get(MesShift.class.getSimpleName());
|
||||
MesShiftProdCenterPm shiftProdCenterPm = (MesShiftProdCenterPm) dataMap.get(MesShiftProdCenterPm.class.getSimpleName());
|
||||
|
||||
dataMap.put("生产线名称", workCenterExtDb.getWorkCenterName());
|
||||
dataMap.put("班次名称", null == shift ? MesExtConstWords.EMPTY : shift.getShiftName());
|
||||
|
||||
dataMap.put("日期", dataMap.get(MesExtConstWords.WORK_TIME));
|
||||
dataMap.put("上班时间", null == shiftProdCenterPm ? MesExtConstWords.EMPTY : shiftProdCenterPm.getWorkStartTime());
|
||||
dataMap.put("下班时间", null == shiftProdCenterPm ? MesExtConstWords.EMPTY : shiftProdCenterPm.getWorkEndTime());
|
||||
dataMap.put("定时", "");
|
||||
|
||||
return clearUselessData(dataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> clearUselessData(Map<String, Object> dataMap) {
|
||||
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
|
||||
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
|
||||
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
|
||||
dataMap.remove(MesShiftProdCenterPm.class.getSimpleName());
|
||||
dataMap.remove(MesExtConstWords.SHIFT_NAME);
|
||||
dataMap.remove("hasShiftCode");
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
private Map<String, Object> packProxyCondition(Map<String, Object> dataMap) {
|
||||
dataMap.put("hasShiftCode", dataMap.get(MesExtConstWords.SHIFT_CODE));
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue