|
|
|
@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
* @Modify:
|
|
|
|
|
**/
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoardService {
|
|
|
|
|
public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
|
|
|
|
|
|
|
|
|
|
private IJxCenterWorkingBoardService proxyService;
|
|
|
|
|
|
|
|
|
@ -39,15 +39,10 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
private MesRepairTaskRepository repairTaskRepository;
|
|
|
|
|
|
|
|
|
|
public JxCenterWorkingBoardBusiTwoService(IJxCenterWorkingBoardService proxyService) {
|
|
|
|
|
|
|
|
|
|
this.proxyService = proxyService;
|
|
|
|
|
|
|
|
|
|
this.shiftRepository = (MesShiftRepository) SpringContextsUtil.getBean("mesShiftRepository");
|
|
|
|
|
|
|
|
|
|
this.orderJobRepository = (MesOrderJobRepository) SpringContextsUtil.getBean("mesOrderJobRepository");
|
|
|
|
|
|
|
|
|
|
this.repairTaskRepository = (MesRepairTaskRepository) SpringContextsUtil.getBean("mesRepairTaskRepository");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -115,9 +110,10 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesRepairTask> getRepairTaskList(MesWorkCenterExt workCenterExtDb) {
|
|
|
|
|
return repairTaskRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime()});
|
|
|
|
|
return StringUtils.isEmpty(workCenterExtDb.getWorkTime()) ? null :
|
|
|
|
|
repairTaskRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void statisticsData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, List<MesOutPutStatistics> outPutStatisticsList,
|
|
|
|
@ -162,15 +158,17 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getShiftName(MesWorkCenterExt workCenterExtDb) {
|
|
|
|
|
return shiftRepository.getByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getShiftCode()}).getShiftName();
|
|
|
|
|
return StringUtils.isEmpty(workCenterExtDb.getShiftCode()) ? MesExtConstWords.EMPTY :
|
|
|
|
|
shiftRepository.getByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getShiftCode()}).getShiftName();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getOrderJobStatistics(MesWorkCenterExt workCenterExtDb) {
|
|
|
|
|
List<MesOrderJob> orderJobList = orderJobRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.SHIFT_CODE},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), workCenterExtDb.getShiftCode()});
|
|
|
|
|
List<MesOrderJob> orderJobList = (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) ? null :
|
|
|
|
|
orderJobRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.SHIFT_CODE},
|
|
|
|
|
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), workCenterExtDb.getShiftCode()});
|
|
|
|
|
orderJobList = CollectionUtils.isEmpty(orderJobList)? null :
|
|
|
|
|
orderJobList.stream().filter(o -> (null != o && MesExtEnumUtil.MES_ORJ_ORDER_STATUS.CLOSE.getValue() != o.getOrderStatus())).collect(Collectors.toList());
|
|
|
|
|
List<MesOrderJob> orderJobList4Complete = CollectionUtils.isEmpty(orderJobList)? null :
|
|
|
|
@ -194,8 +192,6 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
return getQtyStr(completeQty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getQtyStr(Double qty) { return qty.intValue() + "台"; }
|
|
|
|
|
|
|
|
|
|
private BigDecimal getCurProdPassthroughRate(List<MesOutPutStatistics> outPutStatisticsList, List<MesRepairTask> repairTaskList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(outPutStatisticsList)) return new BigDecimal(0);
|
|
|
|
|
List<MesOutPutStatistics> filterList = outPutStatisticsList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatisticsList.get(0).getWorkOrderNo()))).collect(Collectors.toList());
|
|
|
|
@ -212,16 +208,11 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
return divThenMul100Format1RoundHalfUp(qty, MathOperation.add(qty, repairQty));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Double getOutPutStatisticsList2AmountQty(List<MesOutPutStatistics> outPutStatisticsList) {
|
|
|
|
|
return CollectionUtils.isEmpty(outPutStatisticsList) ? new Double(0) : outPutStatisticsList.stream().filter(o -> null != o).mapToDouble(MesOutPutStatistics::getQty).sum();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private JxCenterWorkingBoardBusiModel getProductionSchedule(List<MesWorkOrder> workOrderList, List<MesOutPutStatistics> outPutStatisticsList, MesWorkCenterExt workCenterExtDb) {
|
|
|
|
|
|
|
|
|
|
JxCenterWorkingBoardBusiModel psData = new JxCenterWorkingBoardBusiModel().title("生产计划进度");
|
|
|
|
|
|
|
|
|
|
List<MesWorkOrder> workOrderList2Sort = CollectionUtils.isEmpty(workOrderList) ? null :
|
|
|
|
|
workOrderList.stream().filter(o -> (null != o && (o.getStartTime().contains(workCenterExtDb.getWorkTime()) || MesExtEnumUtil.WORK_ORDER_STATUS.CLOSE.getValue() != o.getWorkOrderStatus()))).sorted(Comparator.comparing(MesWorkOrder::getSeq)).collect(Collectors.toList());
|
|
|
|
|
List<MesWorkOrder> workOrderList2Sort = getWorkOrderList2Sort(workOrderList, outPutStatisticsList, workCenterExtDb);
|
|
|
|
|
|
|
|
|
|
Set<String> partNoList = new TreeSet<>();
|
|
|
|
|
if (!CollectionUtils.isEmpty(outPutStatisticsList)) partNoList.add(outPutStatisticsList.get(0).getPartNo());
|
|
|
|
@ -229,7 +220,7 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
if (!CollectionUtils.isEmpty(outPutStatisticsList)) outPutStatisticsList.stream().filter(o -> null != o).forEach(o -> partNoList.add(o.getPartNo()));
|
|
|
|
|
if (CollectionUtils.isEmpty(partNoList)) return psData;
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesWorkOrder>> orderMap = CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrder::getPartNo));
|
|
|
|
|
Map<String, List<MesWorkOrder>> orderMap = CollectionUtils.isEmpty(workOrderList2Sort) ? null : workOrderList2Sort.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrder::getPartNo));
|
|
|
|
|
Map<String, List<MesOutPutStatistics>> outPutMap = CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getPartNo));
|
|
|
|
|
|
|
|
|
|
for (String partNo : partNoList) {
|
|
|
|
@ -240,7 +231,7 @@ public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoard
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesOutPutStatistics>> itemMap2OutPut = CollectionUtils.isEmpty(outPutList) ? null : outPutList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getWorkOrderNo));
|
|
|
|
|
|
|
|
|
|
psData.addChartData(partNo, statisticsPlanQty(orderList, itemMap2OutPut, workCenterExtDb), getOutPutStatisticsList2AmountQty(outPutList), !CollectionUtils.isEmpty(psData.getChartDataList()) ? "#ffffff" : "#00ff00");
|
|
|
|
|
psData.addChartData2ChartDataLists(5, partNo, statisticsPlanQty(orderList, itemMap2OutPut, workCenterExtDb), getOutPutStatisticsList2AmountQty(outPutList), !CollectionUtils.isEmpty(psData.getChartDataList()) ? "#ffffff" : "#00ff00");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|