|
|
|
@ -496,8 +496,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
} |
|
|
|
} |
|
|
|
//查询已经加工完的
|
|
|
|
//查询已经加工完的
|
|
|
|
List<WorkPlanEntity> oldWorkPlanList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery().eq(WorkPlanEntity::getWoId,oldWorkOrder.getId()).orderByAsc(WorkPlanEntity::getOrders)); |
|
|
|
List<WorkPlanEntity> oldWorkPlanList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery().eq(WorkPlanEntity::getWoId,oldWorkOrder.getId()).orderByAsc(WorkPlanEntity::getOrders)); |
|
|
|
List<Long> ppsIds = oldWorkPlanList.stream().map(WorkPlanEntity::getPpsId).collect(Collectors.toList()); |
|
|
|
if(CollectionUtils.isNotEmpty(oldWorkPlanList)){ |
|
|
|
craftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery().eq(YieldOrderCraftEntity::getYoId, order.getId()).ne(YieldOrderCraftEntity::getCaId, 27).notIn(YieldOrderCraftEntity::getPpsId,ppsIds).orderByAsc(YieldOrderCraftEntity::getProcessNo)); |
|
|
|
List<Long> ppsIds = oldWorkPlanList.stream().map(WorkPlanEntity::getPpsId).collect(Collectors.toList()); |
|
|
|
|
|
|
|
craftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery().eq(YieldOrderCraftEntity::getYoId, order.getId()).ne(YieldOrderCraftEntity::getCaId, 27).notIn(YieldOrderCraftEntity::getPpsId,ppsIds).orderByAsc(YieldOrderCraftEntity::getProcessNo)); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//过滤非外协工序
|
|
|
|
//过滤非外协工序
|
|
|
|
List<YieldOrderCraftEntity> craftList1 = craftList.stream().filter(item -> item.getIsOutsource() == false).collect(Collectors.toList()); |
|
|
|
List<YieldOrderCraftEntity> craftList1 = craftList.stream().filter(item -> item.getIsOutsource() == false).collect(Collectors.toList()); |
|
|
|
@ -617,6 +619,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
isSchecuding = false; |
|
|
|
isSchecuding = false; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("开始获取设备资源:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
Map<Integer, List<EquipAbilityEntity>> equipAbilityMap = equipAbilityList.stream().collect(Collectors.groupingBy(EquipAbilityEntity::getEquipOrder)); |
|
|
|
Map<Integer, List<EquipAbilityEntity>> equipAbilityMap = equipAbilityList.stream().collect(Collectors.groupingBy(EquipAbilityEntity::getEquipOrder)); |
|
|
|
|
|
|
|
|
|
|
|
//匹配设备资源
|
|
|
|
//匹配设备资源
|
|
|
|
@ -629,8 +632,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
LambdaQueryWrapper<EquipResourceEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
LambdaQueryWrapper<EquipResourceEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(EquipResourceEntity::getCraftId, craft.getCaId()) |
|
|
|
wrapper.eq(EquipResourceEntity::getCraftId, craft.getCaId()) |
|
|
|
.eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId()) |
|
|
|
.eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId()) |
|
|
|
.ge(EquipResourceEntity::getStartTime, dateTime) |
|
|
|
|
|
|
|
.eq(EquipResourceEntity::getIsUsed, 0) |
|
|
|
.eq(EquipResourceEntity::getIsUsed, 0) |
|
|
|
|
|
|
|
.ge(EquipResourceEntity::getStartTime, dateTime) |
|
|
|
.in(EquipResourceEntity::getEquipOrder, entry.getKey()); |
|
|
|
.in(EquipResourceEntity::getEquipOrder, entry.getKey()); |
|
|
|
//返工订单需要原班组加工
|
|
|
|
//返工订单需要原班组加工
|
|
|
|
if(StringUtils.isNotEmpty(order.getReworkCode())){ |
|
|
|
if(StringUtils.isNotEmpty(order.getReworkCode())){ |
|
|
|
@ -658,6 +661,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
isSchecuding = false; |
|
|
|
isSchecuding = false; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("已获取设备资源:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
//设备资源按照时间段分组并按时间排序,然后再每个组内按照剩余产能倒序排序
|
|
|
|
//设备资源按照时间段分组并按时间排序,然后再每个组内按照剩余产能倒序排序
|
|
|
|
Map<LocalDateTime, List<EquipResourceEntity>> equipResourceMap = equipResourceList.stream() |
|
|
|
Map<LocalDateTime, List<EquipResourceEntity>> equipResourceMap = equipResourceList.stream() |
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
@ -677,6 +681,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
) |
|
|
|
) |
|
|
|
)); |
|
|
|
)); |
|
|
|
//计算生产所需产能
|
|
|
|
//计算生产所需产能
|
|
|
|
|
|
|
|
log.info("开始计算所需产能:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
BigDecimal sumCapacity = order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode() ? order.getYpArea().multiply(BigDecimal.valueOf(order.getYpQty())) : BigDecimal.valueOf(order.getYpQty()); |
|
|
|
BigDecimal sumCapacity = order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode() ? order.getYpArea().multiply(BigDecimal.valueOf(order.getYpQty())) : BigDecimal.valueOf(order.getYpQty()); |
|
|
|
//需要判断设备额定生产能力是否满足订单总产能,如果不满足,则需要把总产能进行拆分
|
|
|
|
//需要判断设备额定生产能力是否满足订单总产能,如果不满足,则需要把总产能进行拆分
|
|
|
|
List<BigDecimal> capacityList = capacitySplit(equipResourceMap, sumCapacity); |
|
|
|
List<BigDecimal> capacityList = capacitySplit(equipResourceMap, sumCapacity); |
|
|
|
@ -726,7 +731,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
} |
|
|
|
} |
|
|
|
personHours = Double.valueOf(hourMap.get("totalTime").toString()); |
|
|
|
personHours = Double.valueOf(hourMap.get("totalTime").toString()); |
|
|
|
workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue())); |
|
|
|
workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue())); |
|
|
|
workPlan.setStandardTime(Double.valueOf(hourMap.get("standartTime").toString())); |
|
|
|
workPlan.setStandardTime(Double.valueOf(hourMap.get("standardTime").toString())); |
|
|
|
workPlan.setPrepareTime(Double.valueOf(hourMap.get("prepareTime").toString())); |
|
|
|
workPlan.setPrepareTime(Double.valueOf(hourMap.get("prepareTime").toString())); |
|
|
|
workPlan.setHourType(hourMap.get("hourType").toString()); |
|
|
|
workPlan.setHourType(hourMap.get("hourType").toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -799,6 +804,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("匹配设备资源结束:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
if(CollectionUtils.isNotEmpty(processPlanList)){ |
|
|
|
if(CollectionUtils.isNotEmpty(processPlanList)){ |
|
|
|
log.info("设备排产用到的资源是:" + JSONObject.toJSONString(processPlanList)); |
|
|
|
log.info("设备排产用到的资源是:" + JSONObject.toJSONString(processPlanList)); |
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|