jx center board log

tags/yfai-mes-ext-v1.0
王杰 1 year ago
parent 972c7d1b10
commit 32f77f8396

@ -11,6 +11,7 @@ import cn.estsh.i3plus.ext.mes.pojo.model.jx.JxMergeTimeSlotsModel;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesShiftProdCenterRecordRepository;
import cn.estsh.i3plus.ext.mes.pojo.repository.SxWorkCellTaktCollectRepository;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
@ -242,10 +243,18 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
Map<String, String> partStandardWorkMap = (Map<String, String>) dataMap.get(MesExtConstWords.STANDARD_WORK);
Double workStandard = (null != curWorkOrder && curWorkOrder.isPresent() && !CollectionUtils.isEmpty(partStandardWorkMap) && partStandardWorkMap.containsKey(curWorkOrder.get().getPartNo())) ? Double.parseDouble(partStandardWorkMap.get(curWorkOrder.get().getPartNo())) : new Double(0);
BigDecimal realTakt = getRealTakt(shiftProdCenterRecordList, completeQty, curTime, lastHourTime);
log.info("嘉兴产线运行看板 --- center03 --- realTakt:{} --- THREAD:{}", realTakt, Thread.currentThread().getName());
BigDecimal standardTakt = getStandardTakt(workStandard, workCenterExtDb);
log.info("嘉兴产线运行看板 --- center03 --- workStandard:{} --- standardTakt:{} --- THREAD:{}", workStandard, standardTakt, Thread.currentThread().getName());
for (MesWorkCell workCell : workCellList) {
if (null == workCell) continue;
List<SxWorkCellTaktCollect> resultList = CollectionUtils.isEmpty(filterMap) ? null : filterMap.get(workCell.getWorkCellCode());
psData.addChartData(workCell.getSeq().toString(), getCellRealTakt(resultList), getRealTakt(shiftProdCenterRecordList, completeQty, curTime, lastHourTime), getStandardTakt(workStandard, workCenterExtDb));
psData.addChartData(workCell.getSeq().toString(), getCellRealTakt(resultList), realTakt, standardTakt);
}
return psData;
@ -312,7 +321,8 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
shiftProdCenterRecordList.addAll(getShiftProdCenterRecordListByTime(workCenterExtDb, lastHourTime, curTime, MesExtConstWords.START_TIME));
shiftProdCenterRecordList.addAll(getShiftProdCenterRecordListByTime(workCenterExtDb, lastHourTime, curTime, MesExtConstWords.END_TIME));
return CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
shiftProdCenterRecordList.stream().filter(o -> null != o).distinct().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MesShiftProdCenterRecord::getId))), ArrayList::new));
shiftProdCenterRecordList.stream().filter(o -> (null != o && (MesExtEnumUtil.SHIFT_PROD_TYPE.NORMAL_STOP_CENTER.getValue() == o.getProdType() || MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_STOP_CENTER.getValue() == o.getProdType())))
.distinct().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(MesShiftProdCenterRecord::getId))), ArrayList::new));
}
private List<MesShiftProdCenterRecord> getShiftProdCenterRecordListByTime(MesWorkCenterExt workCenterExtDb, String lastHourTime, String curTime, String fieldName) {
@ -323,12 +333,14 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
}
private BigDecimal getRealTakt(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, Double completeQty, String curTime, String lastHourTime) {
log.info("嘉兴产线运行看板 --- center03 --- completeQty:{} --- THREAD:{}", completeQty, Thread.currentThread().getName());
if (MathOperation.compareTo(completeQty, new Double(0)) == 0) return format1RounHalfUp(new Double(0));
return format1RounHalfUp(MathOperation.div(MathOperation.mul(MathOperation.sub(new Double(60), getStopTime(shiftProdCenterRecordList, curTime, lastHourTime)), new Double(60)), completeQty));
}
private Double getStopTime(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, String curTime, String lastHourTime) {
if (CollectionUtils.isEmpty(shiftProdCenterRecordList)) return new Double(0);
log.info("嘉兴产线运行看板 --- center03 --- shiftProdCenterRecordList:{} --- THREAD:{}", JSONObject.toJSONString(shiftProdCenterRecordList), Thread.currentThread().getName());
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(MesExtConstWords.DATETIME_FORMAT);
List<JxMergeTimeSlotsModel> timeSlots = new ArrayList<>();
for (MesShiftProdCenterRecord shiftProdCenterRecord : shiftProdCenterRecordList) {
@ -336,8 +348,11 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
timeSlots.add(new JxMergeTimeSlotsModel().convertTime(compareToTimeByFlag(shiftProdCenterRecord.getStartTime(), lastHourTime, true), compareToTimeByFlag(shiftProdCenterRecord.getEndTime(), curTime, false), simpleDateFormat));
}
timeSlots = mergeTimeSlotsService.mergeTimeSlots(timeSlots);
return CollectionUtils.isEmpty(timeSlots) ? new Double(0) :
log.info("嘉兴产线运行看板 --- center03 --- timeSlots:{} --- THREAD:{}", JSONObject.toJSONString(timeSlots), Thread.currentThread().getName());
Double stopTime = CollectionUtils.isEmpty(timeSlots) ? new Double(0) :
timeSlots.stream().filter(o -> null != o).mapToDouble(o -> (MathOperation.div((double)(o.getEndDate().getTime() - o.getStartDate().getTime()), new Double(60000)))).sum();
log.info("嘉兴产线运行看板 --- center03 --- stopTime:{} --- THREAD:{}", stopTime, Thread.currentThread().getName());
return stopTime;
}
private String compareToTimeByFlag(String time, String curTime, boolean flag) {

Loading…
Cancel
Save