|
|
|
|
@ -122,14 +122,43 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void scheduling() { |
|
|
|
|
//处理参数不全的订单,更新为异常订单
|
|
|
|
|
List<YieldOrderEntity> errorlist1 = yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery() |
|
|
|
|
.in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode()) |
|
|
|
|
.isNull(YieldOrderEntity::getWorkCenterId)); |
|
|
|
|
errorlist1.forEach(item -> { |
|
|
|
|
item.setErrorInfo("作业中心为空"); |
|
|
|
|
item.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(item); |
|
|
|
|
}); |
|
|
|
|
List<YieldOrderEntity> errorlist2 = yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery() |
|
|
|
|
.in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode()) |
|
|
|
|
.isNull(YieldOrderEntity::getReleaseDate)); |
|
|
|
|
errorlist2.forEach(item -> { |
|
|
|
|
item.setErrorInfo("计划下达时间为空"); |
|
|
|
|
item.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(item); |
|
|
|
|
}); |
|
|
|
|
List<YieldOrderEntity> errorlist3 = yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery() |
|
|
|
|
.in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode()) |
|
|
|
|
.isNull(YieldOrderEntity::getDemandDate)); |
|
|
|
|
errorlist3.forEach(item -> { |
|
|
|
|
item.setErrorInfo("需求交期为空"); |
|
|
|
|
item.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(item); |
|
|
|
|
}); |
|
|
|
|
//查询待排产订单,状态是3
|
|
|
|
|
List<YieldOrderEntity> list = |
|
|
|
|
yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery().in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode(),YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()).isNotNull(YieldOrderEntity::getWorkCenterId).isNotNull(YieldOrderEntity::getReleaseDate).isNotNull(YieldOrderEntity::getDemandDate)); |
|
|
|
|
yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery() |
|
|
|
|
.in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode()) |
|
|
|
|
.isNotNull(YieldOrderEntity::getWorkCenterId) |
|
|
|
|
.isNotNull(YieldOrderEntity::getReleaseDate) |
|
|
|
|
.isNotNull(YieldOrderEntity::getDemandDate)); |
|
|
|
|
log.info("待排产订单数量为:" + list.size()); |
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
|
//校验已排产订单
|
|
|
|
|
checkSchedulingOrder(list); |
|
|
|
|
list = yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery().in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode(),YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()).isNotNull(YieldOrderEntity::getWorkCenterId).isNotNull(YieldOrderEntity::getReleaseDate).isNotNull(YieldOrderEntity::getDemandDate)); |
|
|
|
|
list = yieldOrderService.list(Wrappers.<YieldOrderEntity>lambdaQuery().in(BaseEntity::getStatus, YieldOrderEnum.STATUS_APS.getCode()).isNotNull(YieldOrderEntity::getWorkCenterId).isNotNull(YieldOrderEntity::getReleaseDate).isNotNull(YieldOrderEntity::getDemandDate)); |
|
|
|
|
//初始化人员能力
|
|
|
|
|
List<PersonAbilityEntity> personAbilityEntityList = personAbilityService.list(Wrappers.<PersonAbilityEntity>lambdaQuery().isNotNull(PersonAbilityEntity::getWorkCenterId).isNotNull(PersonAbilityEntity::getProcessId).isNotNull(PersonAbilityEntity::getCraftId)); |
|
|
|
|
Map<String, PersonAbilityEntity> personAbilityMap = new HashMap<>(); |
|
|
|
|
@ -331,7 +360,13 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
List<YieldOrderCraftEntity> craftList1 = craftList.stream().filter(item -> item.getIsOutsource() == false).collect(Collectors.toList()); |
|
|
|
|
List<Long> workCenterList = craftList1.stream().filter(item -> item.getWorkCenterId() != null).map(YieldOrderCraftEntity::getWorkCenterId).collect(Collectors.toList()); |
|
|
|
|
if (workCenterList.size() != craftList1.size()) { |
|
|
|
|
order.setErrorInfo("工序信息不完整,含有未匹配作业中心的工序"); |
|
|
|
|
String errorInfo = craftList1.stream().filter(item -> item.getWorkCenterId() == null) |
|
|
|
|
.map(YieldOrderCraftEntity::getPpsId) |
|
|
|
|
.filter(ppsId -> ppsId != null) |
|
|
|
|
.map(ppsId -> processMap.get(ppsId)) |
|
|
|
|
.filter(chineseName -> chineseName != null && !chineseName.isEmpty()) |
|
|
|
|
.collect(Collectors.joining(",")); |
|
|
|
|
order.setErrorInfo("工序信息不完整,工序:"+errorInfo+"未匹配作业中心"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
continue; |
|
|
|
|
@ -385,88 +420,19 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
}else{ |
|
|
|
|
if ("设备".equals(mainProducerMap.get(craft.getPpsId()))) { |
|
|
|
|
|
|
|
|
|
//热表同槽
|
|
|
|
|
Boolean isSameTrough = sameTrough(order,craft,prevProcessEnd,workPlanList); |
|
|
|
|
//同槽就不需要继续匹配了
|
|
|
|
|
if(isSameTrough){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
String glassCodeStr = null; |
|
|
|
|
//烧结
|
|
|
|
|
//烧结同炉
|
|
|
|
|
if(sintMap.containsKey(craft.getPpsId())){ |
|
|
|
|
if(order.getYieldType() == 2 || order.getYieldType() == 3){//烧结订单
|
|
|
|
|
//获取当前工序的所有温度曲线
|
|
|
|
|
List<SintTempCurveEntity> sintList = sintMap.get(craft.getPpsId()); |
|
|
|
|
List<List<String>> sintMaterialList = new ArrayList<>(); |
|
|
|
|
sintList.stream().map(SintTempCurveEntity::getGlassCode).collect(Collectors.toList()).forEach(item -> sintMaterialList.add(Arrays.asList(item.split(",")))); |
|
|
|
|
|
|
|
|
|
//根据零件号获取子件信息
|
|
|
|
|
PartEntity part = new PartEntity(); |
|
|
|
|
part.setPartCode(order.getPartCode()); |
|
|
|
|
List<PartEntity> childPartList = partService.selectChildPart(part); |
|
|
|
|
if(CollectionUtils.isNotEmpty(childPartList)){ |
|
|
|
|
//获取子件的所有玻璃粉牌号
|
|
|
|
|
List<String> materialList = childPartList.stream().filter(item -> StringUtils.isNotEmpty(item.getMaterial())).map(PartEntity::getMaterial).collect(Collectors.toList()); |
|
|
|
|
List<String> maxMatchList = null; |
|
|
|
|
int maxCount = 0; |
|
|
|
|
for(List<String> glassCodeList : sintMaterialList){ |
|
|
|
|
int currentCount = (int) glassCodeList.stream().filter(materialList::contains).count(); |
|
|
|
|
if (currentCount > maxCount) { |
|
|
|
|
maxCount = currentCount; |
|
|
|
|
maxMatchList = glassCodeList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(maxMatchList != null){ |
|
|
|
|
glassCodeStr = maxMatchList.stream().collect(Collectors.joining(",")); |
|
|
|
|
log.info("订单:"+order.getYoCode()+",温度曲线是:"+glassCodeStr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//包含说明之前有过这个温度曲线的订单
|
|
|
|
|
//根据当前时间查询包含玻璃粉牌号的设备资源
|
|
|
|
|
List<EquipResourceEntity> equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery() |
|
|
|
|
.eq(EquipResourceEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
.eq(EquipResourceEntity::getCraftId,craft.getCaId()) |
|
|
|
|
.ge(EquipResourceEntity::getStartTime,prevProcessEnd) |
|
|
|
|
.eq(EquipResourceEntity::getGlassCode,glassCodeStr)); |
|
|
|
|
if(CollectionUtils.isNotEmpty(equipResourceList)){ |
|
|
|
|
//计算生产所需产能,需将m2换算成dm2
|
|
|
|
|
BigDecimal sumCapacity = order.getYpArea().multiply(BigDecimal.valueOf(order.getYpQty())); |
|
|
|
|
Boolean isSameFurnace = false; |
|
|
|
|
for(EquipResourceEntity equipResource : equipResourceList){ |
|
|
|
|
if(equipResource.getRestCapacity().compareTo(sumCapacity) > 0){ |
|
|
|
|
//生成车间订单
|
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
workPlan.setStartTime(equipResource.getStartTime()); |
|
|
|
|
if ("0".equals(equipResource.getEquipType())) { |
|
|
|
|
workPlan.setEndTime(equipResource.getStartTime().plusMinutes(equipResource.getStandardTime().longValue())); |
|
|
|
|
} else { |
|
|
|
|
workPlan.setEndTime(equipResource.getEndTime()); |
|
|
|
|
} |
|
|
|
|
workPlan.setWorkQty(order.getYpQty()); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
workPlan.setPpsId(craft.getPpsId()); |
|
|
|
|
workPlan.setMakeTeam(equipResource.getTeamId()); |
|
|
|
|
workPlan.setWorkCenterId(craft.getWorkCenterId()); |
|
|
|
|
workPlan.setOrders(craft.getProcessNo()); |
|
|
|
|
workPlan.setWoId(order.getId()); |
|
|
|
|
workPlan.setOem("0"); |
|
|
|
|
workPlan.setTestQty(0); |
|
|
|
|
workPlan.setQualifiedQty(0); |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
workPlan.setScrapQty(0); |
|
|
|
|
workPlan.setHourQuota(BigDecimal.valueOf(ChronoUnit.MINUTES.between(workPlan.getStartTime(), workPlan.getEndTime()))); |
|
|
|
|
workPlan.setEquipCode(equipResource.getEquipCode()); |
|
|
|
|
workPlan.setEquipName(equipResource.getEquipName()); |
|
|
|
|
workPlan.setEquipResourceId(equipResource.getId()); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
|
|
|
|
|
equipResource.setRestCapacity(equipResource.getRestCapacity().subtract(sumCapacity)); |
|
|
|
|
equipResourceService.updateById(equipResource); |
|
|
|
|
isSameFurnace = true; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
//同炉的话就不用走下面的匹配了,直接下一工序
|
|
|
|
|
if(isSameFurnace){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Boolean isSameFurnace = sameFurnace(order,craft,workPlanList,prevProcessEnd,glassCodeStr,sintMap); |
|
|
|
|
//同炉的话就不用走下面的匹配了,直接下一工序
|
|
|
|
|
if(isSameFurnace){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -493,7 +459,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
.eq(EquipResourceEntity::getIsUsed, 0) |
|
|
|
|
.in(EquipResourceEntity::getEquipOrder, entry.getKey())); |
|
|
|
|
if (CollectionUtils.isEmpty(equipResourceList)) { |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_APS.getCode()); |
|
|
|
|
order.setErrorInfo("工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的设备资源"); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
isSchecuding = false; |
|
|
|
|
@ -622,6 +588,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} else { |
|
|
|
|
totalTime = totalTime.add(ability.getStandardTime()).add(ability.getPrepareTime()); |
|
|
|
|
} |
|
|
|
|
prevProcessEnd = prevProcessEnd.plusMinutes(totalTime.longValue()); |
|
|
|
|
} |
|
|
|
|
List<PersonResourceEntity> personResourceList = personResourceService.list(Wrappers.<PersonResourceEntity>lambdaQuery() |
|
|
|
|
.eq(PersonResourceEntity::getWorkCenterId, craft.getWorkCenterId()) |
|
|
|
|
@ -632,7 +599,16 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
if(CollectionUtils.isNotEmpty(personResourceList)){ |
|
|
|
|
workPlan.setMakeTeam(personResourceList.get(0).getTeamId()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//需要人员资质的指定到人
|
|
|
|
|
if(StringUtils.isNotEmpty(ability.getProductIdent()) |
|
|
|
|
&& StringUtils.isNotEmpty(order.getProductIdent()) |
|
|
|
|
&& ability.getProductIdent().equals(order.getProductIdent()) |
|
|
|
|
&& workPlan.getMakeTeam() != null){ |
|
|
|
|
List<String> memberList = baseMapper.selectTeamMember(workPlan.getMakeTeam(),ability.getCertificateId()); |
|
|
|
|
if(CollectionUtils.isNotEmpty(memberList)){ |
|
|
|
|
workPlan.setTeamMembers(memberList.stream().collect(Collectors.joining(","))); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
prevProcessEnd = prevProcessEnd.plusMinutes(30); |
|
|
|
|
totalTime = BigDecimal.valueOf(30); |
|
|
|
|
@ -1176,17 +1152,224 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/*public void sameTrough(YieldOrderCraftEntity yieldOrderCraft,LocalDateTime dateTime){ |
|
|
|
|
SameTroughEntity sameTrough =sameTroughService.getOne(Wrappers.<SameTroughEntity>lambdaQuery().eq(SameTroughEntity::getWorkCenterId,yieldOrderCraft.getWorkCenterId()).eq(SameTroughEntity::getCraftId,yieldOrderCraft.getCaId()).eq(SameTroughEntity::getProcessId,yieldOrderCraft.getPpsId())); |
|
|
|
|
public Boolean sameTrough(YieldOrderEntity order,YieldOrderCraftEntity craft,LocalDateTime dateTime,List<WorkPlanEntity> workPlanList){ |
|
|
|
|
Boolean isSameTrough = false; |
|
|
|
|
SameTroughEntity sameTrough =sameTroughService.getOne(Wrappers.<SameTroughEntity>lambdaQuery() |
|
|
|
|
.eq(SameTroughEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
.eq(SameTroughEntity::getCraftId,craft.getCaId()) |
|
|
|
|
.eq(SameTroughEntity::getProcessId,craft.getPpsId())); |
|
|
|
|
if(sameTrough != null){ |
|
|
|
|
//查询是否有已经排产的计划
|
|
|
|
|
List<WorkPlanEntity> workPlanList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery().eq(WorkPlanEntity::getWorkCenterId,yieldOrderCraft.getWorkCenterId()).eq(WorkPlanEntity::getCaId,yieldOrderCraft.getCaId()).eq(WorkPlanEntity::getPpsId,yieldOrderCraft.getPpsId())); |
|
|
|
|
if(CollectionUtils.isNotEmpty(workPlanList)){ |
|
|
|
|
Map<> |
|
|
|
|
List<WorkPlanEntity> workPlanOldList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery() |
|
|
|
|
.eq(WorkPlanEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
.eq(WorkPlanEntity::getCaId,craft.getCaId()) |
|
|
|
|
.eq(WorkPlanEntity::getPpsId,craft.getPpsId()) |
|
|
|
|
.ge(WorkPlanEntity::getStartTime,dateTime).orderByAsc(WorkPlanEntity::getStartTime)); |
|
|
|
|
if(CollectionUtils.isNotEmpty(workPlanOldList)){ |
|
|
|
|
//总生产量
|
|
|
|
|
BigDecimal sumCapacity = order.getYpArea().multiply(BigDecimal.valueOf(order.getYpQty())); |
|
|
|
|
//可能有多个订单符合要求,按照车间订单、时间分组排序
|
|
|
|
|
Map<Long,List<WorkPlanEntity>> workPlanMap = workPlanOldList.stream().collect(Collectors.groupingBy(WorkPlanEntity::getWoId)); |
|
|
|
|
for(Map.Entry<Long,List<WorkPlanEntity>> entry : workPlanMap.entrySet()){ |
|
|
|
|
List<WorkPlanEntity> planList = entry.getValue(); |
|
|
|
|
Boolean isEnough = true; |
|
|
|
|
List<Long> resourceList = new ArrayList<>(); |
|
|
|
|
for(WorkPlanEntity workPlan : planList){ |
|
|
|
|
if(workPlan.getEquipResourceId() != null){ |
|
|
|
|
EquipResourceEntity equipResource = equipResourceService.getById(workPlan.getEquipResourceId()); |
|
|
|
|
//判断剩余产能是否满足总产能
|
|
|
|
|
if(sumCapacity.compareTo(equipResource.getRestCapacity()) > 0){ |
|
|
|
|
isEnough = false; |
|
|
|
|
resourceList.clear(); |
|
|
|
|
break; |
|
|
|
|
}else{ |
|
|
|
|
resourceList.add(workPlan.getEquipResourceId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//如果产能满足,再判断是否满足同槽条件
|
|
|
|
|
if(isEnough){ |
|
|
|
|
WorkOrderEntity workOrder = this.getById(workPlanOldList.get(0).getWoId()); |
|
|
|
|
YieldOrderEntity yieldOrderEntity = yieldOrderService.getById(workOrder.getYoId()); |
|
|
|
|
List<YieldOrderCraftEntity> orderCraftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery() |
|
|
|
|
.eq(YieldOrderCraftEntity::getYoId,yieldOrderEntity.getId()) |
|
|
|
|
.eq(YieldOrderCraftEntity::getPpsId,craft.getPpsId()) |
|
|
|
|
.eq(YieldOrderCraftEntity::getCaId,craft.getCaId()) |
|
|
|
|
.eq(YieldOrderCraftEntity::getWorkCenterId,craft.getWorkCenterId())); |
|
|
|
|
SameTroughVO voNew = sameTroughService.selectSameTroughInfo(craft.getId()); |
|
|
|
|
SameTroughVO voOld = sameTroughService.selectSameTroughInfo(orderCraftList.get(0).getId()); |
|
|
|
|
//根据同槽因素进行比对
|
|
|
|
|
Boolean isSameTrough2 = true; |
|
|
|
|
//键位
|
|
|
|
|
if("1".equals(sameTrough.getKeyBinding()) && voNew.getPartCode().equals(voOld.getPartCode()) && StringUtils.isNotEmpty(voNew.getKeyBinding()) && StringUtils.isNotEmpty(voOld.getKeyBinding()) && !voNew.getKeyBinding().equals(voOld.getKeyBinding())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//生产厂家
|
|
|
|
|
if("1".equals(sameTrough.getProducter()) && voNew.getPartCode().equals(voOld.getPartCode()) && StringUtils.isNotEmpty(voNew.getProducter()) && StringUtils.isNotEmpty(voOld.getProducter()) && !voNew.getProducter().equals(voOld.getProducter())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//检验编号
|
|
|
|
|
if("1".equals(sameTrough.getInspectionCode()) && voNew.getPartCode().equals(voOld.getPartCode()) && StringUtils.isNotEmpty(voNew.getInspectionCode()) && StringUtils.isNotEmpty(voOld.getInspectionCode()) && !voNew.getInspectionCode().equals(voOld.getInspectionCode())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//材料
|
|
|
|
|
if("1".equals(sameTrough.getMaterial()) && StringUtils.isNotEmpty(voNew.getMaterial()) && StringUtils.isNotEmpty(voOld.getMaterial()) && !voNew.getMaterial().equals(voOld.getMaterial())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//厚度
|
|
|
|
|
if("1".equals(sameTrough.getThickness()) && StringUtils.isNotEmpty(voNew.getThickness()) && StringUtils.isNotEmpty(voOld.getThickness()) && !voNew.getThickness().equals(voOld.getThickness())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//钝化
|
|
|
|
|
if("1".equals(sameTrough.getPassivation())){ |
|
|
|
|
if(StringUtils.isNotEmpty(voNew.getPlate()) |
|
|
|
|
&& StringUtils.isNotEmpty(voOld.getPlate()) |
|
|
|
|
&& ((voNew.getPlate().contains("不钝化") |
|
|
|
|
&& !voOld.getPlate().contains("不钝化")) |
|
|
|
|
|| (voOld.getPlate().contains("不钝化") |
|
|
|
|
&& !voNew.getPlate().contains("不钝化")))){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//硬度
|
|
|
|
|
if("1".equals(sameTrough.getHardness()) && StringUtils.isNotEmpty(voNew.getHardness()) && StringUtils.isNotEmpty(voOld.getHardness()) && !voNew.getHardness().equals(voOld.getHardness())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
//生产标识
|
|
|
|
|
if("1".equals(sameTrough.getProductIdent())){ |
|
|
|
|
List<String> highIdentList = Arrays.asList(new String[]{"JHT","JI","JIX","YH","CC","SATA"}); |
|
|
|
|
if(StringUtils.isNotEmpty(order.getProductIdent()) && highIdentList.contains(order.getProductIdent())){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
if(!(voNew.getPartCode().equals(voOld.getPartCode()) |
|
|
|
|
&& StringUtils.isNotEmpty(voNew.getProductIdent()) |
|
|
|
|
&& StringUtils.isNotEmpty(voOld.getProductIdent()) |
|
|
|
|
&& voNew.getProductIdent().equals(voOld.getProductIdent()))){ |
|
|
|
|
isSameTrough2 = false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
if(isSameTrough2){ |
|
|
|
|
for(Long resourceId : resourceList){ |
|
|
|
|
EquipResourceEntity equipResource = equipResourceService.getById(resourceId); |
|
|
|
|
//生成车间订单
|
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
workPlan.setStartTime(equipResource.getStartTime()); |
|
|
|
|
if ("0".equals(equipResource.getEquipType())) { |
|
|
|
|
workPlan.setEndTime(equipResource.getStartTime().plusMinutes(equipResource.getStandardTime().longValue())); |
|
|
|
|
} else { |
|
|
|
|
workPlan.setEndTime(equipResource.getEndTime()); |
|
|
|
|
} |
|
|
|
|
workPlan.setWorkQty(order.getYpQty()); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
workPlan.setPpsId(craft.getPpsId()); |
|
|
|
|
workPlan.setMakeTeam(equipResource.getTeamId()); |
|
|
|
|
workPlan.setWorkCenterId(craft.getWorkCenterId()); |
|
|
|
|
workPlan.setOrders(craft.getProcessNo()); |
|
|
|
|
workPlan.setWoId(order.getId()); |
|
|
|
|
workPlan.setOem("0"); |
|
|
|
|
workPlan.setTestQty(0); |
|
|
|
|
workPlan.setQualifiedQty(0); |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
workPlan.setScrapQty(0); |
|
|
|
|
workPlan.setHourQuota(BigDecimal.valueOf(ChronoUnit.MINUTES.between(workPlan.getStartTime(), workPlan.getEndTime()))); |
|
|
|
|
workPlan.setEquipCode(equipResource.getEquipCode()); |
|
|
|
|
workPlan.setEquipName(equipResource.getEquipName()); |
|
|
|
|
workPlan.setEquipResourceId(equipResource.getId()); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
|
|
|
|
|
equipResource.setRestCapacity(equipResource.getRestCapacity().subtract(sumCapacity)); |
|
|
|
|
equipResourceService.updateById(equipResource); |
|
|
|
|
isSameTrough = true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return isSameTrough; |
|
|
|
|
} |
|
|
|
|
public Boolean sameFurnace(YieldOrderEntity order,YieldOrderCraftEntity craft,List<WorkPlanEntity> workPlanList,LocalDateTime prevProcessEnd,String glassCodeStr,Map<Long, List<SintTempCurveEntity>> sintMap){ |
|
|
|
|
Boolean isSameFurnace = false; |
|
|
|
|
if(order.getYieldType() == 2 || order.getYieldType() == 3){//烧结订单
|
|
|
|
|
//获取当前工序的所有温度曲线
|
|
|
|
|
List<SintTempCurveEntity> sintList = sintMap.get(craft.getPpsId()); |
|
|
|
|
List<List<String>> sintMaterialList = new ArrayList<>(); |
|
|
|
|
sintList.stream().map(SintTempCurveEntity::getGlassCode).collect(Collectors.toList()).forEach(item -> sintMaterialList.add(Arrays.asList(item.split(",")))); |
|
|
|
|
|
|
|
|
|
//根据零件号获取子件信息
|
|
|
|
|
PartEntity part = new PartEntity(); |
|
|
|
|
part.setPartCode(order.getPartCode()); |
|
|
|
|
List<PartEntity> childPartList = partService.selectChildPart(part); |
|
|
|
|
if(CollectionUtils.isNotEmpty(childPartList)){ |
|
|
|
|
//获取子件的所有玻璃粉牌号
|
|
|
|
|
List<String> materialList = childPartList.stream().filter(item -> StringUtils.isNotEmpty(item.getMaterial())).map(PartEntity::getMaterial).collect(Collectors.toList()); |
|
|
|
|
List<String> maxMatchList = null; |
|
|
|
|
int maxCount = 0; |
|
|
|
|
for(List<String> glassCodeList : sintMaterialList){ |
|
|
|
|
int currentCount = (int) glassCodeList.stream().filter(materialList::contains).count(); |
|
|
|
|
if (currentCount > maxCount) { |
|
|
|
|
maxCount = currentCount; |
|
|
|
|
maxMatchList = glassCodeList; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if(maxMatchList != null){ |
|
|
|
|
glassCodeStr = maxMatchList.stream().collect(Collectors.joining(",")); |
|
|
|
|
log.info("订单:"+order.getYoCode()+",温度曲线是:"+glassCodeStr); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//包含说明之前有过这个温度曲线的订单
|
|
|
|
|
//根据当前时间查询包含玻璃粉牌号的设备资源
|
|
|
|
|
List<EquipResourceEntity> equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery() |
|
|
|
|
.eq(EquipResourceEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
.eq(EquipResourceEntity::getCraftId,craft.getCaId()) |
|
|
|
|
.ge(EquipResourceEntity::getStartTime,prevProcessEnd) |
|
|
|
|
.eq(EquipResourceEntity::getGlassCode,glassCodeStr)); |
|
|
|
|
if(CollectionUtils.isNotEmpty(equipResourceList)){ |
|
|
|
|
//计算生产所需产能,需将m2换算成dm2
|
|
|
|
|
BigDecimal sumCapacity = order.getYpArea().multiply(BigDecimal.valueOf(order.getYpQty())); |
|
|
|
|
|
|
|
|
|
for(EquipResourceEntity equipResource : equipResourceList){ |
|
|
|
|
if(equipResource.getRestCapacity().compareTo(sumCapacity) > 0){ |
|
|
|
|
//生成车间订单
|
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
workPlan.setStartTime(equipResource.getStartTime()); |
|
|
|
|
if ("0".equals(equipResource.getEquipType())) { |
|
|
|
|
workPlan.setEndTime(equipResource.getStartTime().plusMinutes(equipResource.getStandardTime().longValue())); |
|
|
|
|
} else { |
|
|
|
|
workPlan.setEndTime(equipResource.getEndTime()); |
|
|
|
|
} |
|
|
|
|
workPlan.setWorkQty(order.getYpQty()); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
workPlan.setPpsId(craft.getPpsId()); |
|
|
|
|
workPlan.setMakeTeam(equipResource.getTeamId()); |
|
|
|
|
workPlan.setWorkCenterId(craft.getWorkCenterId()); |
|
|
|
|
workPlan.setOrders(craft.getProcessNo()); |
|
|
|
|
workPlan.setWoId(order.getId()); |
|
|
|
|
workPlan.setOem("0"); |
|
|
|
|
workPlan.setTestQty(0); |
|
|
|
|
workPlan.setQualifiedQty(0); |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
workPlan.setScrapQty(0); |
|
|
|
|
workPlan.setHourQuota(BigDecimal.valueOf(ChronoUnit.MINUTES.between(workPlan.getStartTime(), workPlan.getEndTime()))); |
|
|
|
|
workPlan.setEquipCode(equipResource.getEquipCode()); |
|
|
|
|
workPlan.setEquipName(equipResource.getEquipName()); |
|
|
|
|
workPlan.setEquipResourceId(equipResource.getId()); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
|
|
|
|
|
equipResource.setRestCapacity(equipResource.getRestCapacity().subtract(sumCapacity)); |
|
|
|
|
equipResourceService.updateById(equipResource); |
|
|
|
|
isSameFurnace = true; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
SameTroughVO vo = sameTroughService.selectSameTroughInfo(yieldOrderCraft.getId()); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
return isSameFurnace; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|