日志打印零件生产组生成工单时的时间

tags/yfai-mes-ext-v1.2
臧学普 9 months ago
parent fad2cb5c66
commit 9c7a954f2b

@ -54,7 +54,7 @@ public class MesBtoJobServiceImpl implements IMesBtoJobService {
continue; continue;
} }
//6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参 //6. 根据零件生产组的RoundnessType 去做策略,现在只做 窗口时间 策略; 入参
String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundType()); String roundnessService = MesExtEnumUtil.SHIPPING_GROUP_ROUND_METHOD.valueOfService(prodGroup.getRoundMethod());
IRoundnessStrategy roundnessStrategy = (IRoundnessStrategy)SpringContextsUtil.getBean(roundnessService); IRoundnessStrategy roundnessStrategy = (IRoundnessStrategy)SpringContextsUtil.getBean(roundnessService);
roundnessStrategy.execute(prodGroup,sortInfoList, details); roundnessStrategy.execute(prodGroup,sortInfoList, details);
} }

@ -74,6 +74,11 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
log.info("当前零件生产组:{} 没有到达生产工单的窗口", partProdGroup.getPartProdGroupName()); log.info("当前零件生产组:{} 没有到达生产工单的窗口", partProdGroup.getPartProdGroupName());
return; return;
} }
String lastRunTime = TimeTool.getNowTime(true);
log.info("当前零件生产组:{},更新本次执行时间:{}",partProdGroup.getPartProdGroupName(),lastRunTime);
ConvertBean.saveOrUpdate(time, "JOB");
time.setLastRunTime(lastRunTime);
windowTimeRao.update(time);
DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
long createSeq = Long.parseLong(dateFormat.format(new Date())); long createSeq = Long.parseLong(dateFormat.format(new Date()));
Map<String, List<MesCustSortInfo>> sortInfoMap = sortInfoList.stream().collect(Collectors.groupingBy(MesCustSortInfo::getCustPartNo)); Map<String, List<MesCustSortInfo>> sortInfoMap = sortInfoList.stream().collect(Collectors.groupingBy(MesCustSortInfo::getCustPartNo));
@ -236,9 +241,7 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
} }
} }
ConvertBean.saveOrUpdate(time, "JOB");
time.setLastRunTime(TimeTool.getNowTime(true));
windowTimeRao.update(time);
} catch (Exception e) { } catch (Exception e) {
log.error("创建工单报错:{}", Arrays.toString(e.getStackTrace())); log.error("创建工单报错:{}", Arrays.toString(e.getStackTrace()));
} }
@ -265,7 +268,7 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
//使用降序 //使用降序
List<MesPartProdGroupWindowTime> sortedTime = windowTimeList.stream().sorted(Comparator.comparing(MesPartProdGroupWindowTime::getWindowTime,Comparator.reverseOrder())).collect(Collectors.toList()); List<MesPartProdGroupWindowTime> sortedTime = windowTimeList.stream().sorted(Comparator.comparing(MesPartProdGroupWindowTime::getWindowTime,Comparator.reverseOrder())).collect(Collectors.toList());
for (MesPartProdGroupWindowTime time : sortedTime) { for (MesPartProdGroupWindowTime time : sortedTime) {
if(Integer.parseInt(time.getWindowTime().replace(":","")) > Integer.parseInt(nowTime.replace(":",""))){ if (Integer.parseInt(time.getWindowTime().replace(":", "")) > Integer.parseInt(nowTime.replace(":", ""))) {
continue; continue;
} }
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time.getWindowTime().substring(0, 2))); calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(time.getWindowTime().substring(0, 2)));
@ -274,6 +277,7 @@ public class MesTimeRoundnessService implements IRoundnessStrategy {
if (Objects.isNull(time.getLastRunTime())) { if (Objects.isNull(time.getLastRunTime())) {
return time; return time;
} }
//校验lastRuntime 是否已经在当前圆整时区已经生成完了工单
Date lastRunTime = sdf.parse(time.getLastRunTime()); Date lastRunTime = sdf.parse(time.getLastRunTime());
if (dateCreateOrder.before(lastRunTime)) { if (dateCreateOrder.before(lastRunTime)) {
continue; continue;

Loading…
Cancel
Save