|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.station;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdShiftRecordService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesShiftService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionCustomContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionDispatchContextStepService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionProcessContextStepService;
|
|
|
|
@ -32,10 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.StringJoiner;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description : 展示组件:非排序生产
|
|
|
|
@ -63,6 +61,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesFileRepository mesFileRepository;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesShiftService mesShiftService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void init(StationRequestBean reqBean) {
|
|
|
|
|
// 获取工单信息
|
|
|
|
@ -83,6 +84,9 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
MesPcnException.throwBusiException("请先开班!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//班次开始时间 ,班次结束时间
|
|
|
|
|
getShiftTimeStationKvBean(reqBean, prodShiftDataContext);
|
|
|
|
|
|
|
|
|
|
// 发送班次班组和工单
|
|
|
|
|
StationResultBean resultBean = getStationResultBean(reqBean, moduleContentContext, prodShiftDataContext);
|
|
|
|
|
this.sendMessage(reqBean, resultBean);
|
|
|
|
@ -109,6 +113,24 @@ public class MesProductionNoSortModuleService extends BaseModuleService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void getShiftTimeStationKvBean(StationRequestBean reqBean, List<StationKvBean> prodShiftDataContext) {
|
|
|
|
|
List<MesShift> shiftList = mesShiftService.queryMesShift(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode());
|
|
|
|
|
if (CollectionUtils.isEmpty(shiftList)){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Optional<StationKvBean> shiftCodeOptional = prodShiftDataContext.stream().filter(shift -> MesPcnExtConstWords.SHIFT_CODE.equals(shift.getKey())).findFirst();
|
|
|
|
|
if (!shiftCodeOptional.isPresent()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Optional<MesShift> shiftOptional = shiftList.stream().filter(t -> t.getShiftCode().equals(shiftCodeOptional.get().getValue())).findFirst();
|
|
|
|
|
if (!shiftOptional.isPresent()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
StationKvBeanUtil.addStationKvBeanList(prodShiftDataContext,
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.START_TIME, "班次开始时间", shiftOptional.get().getStartTime()),
|
|
|
|
|
new StationKvBean(MesPcnExtConstWords.END_TIME, "班次结束时间", shiftOptional.get().getEndTime()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<StationKvBean> getShiftRecordStationKvBeans(StationRequestBean reqBean) {
|
|
|
|
|
// 获取班次信息 redis
|
|
|
|
|
List<StationKvBean> prodShiftDataContext = productionCustomContextStepService.getProdShiftDataContext(reqBean.getOrganizeCode(), reqBean.getWorkCenterCode());
|
|
|
|
|