|
|
|
|
@ -49,6 +49,7 @@ import org.springblade.core.tool.utils.DateUtil; |
|
|
|
|
import org.springblade.desk.dashboard.constant.DsPartConstant; |
|
|
|
|
import org.springblade.desk.dashboard.pojo.entity.DsPartVersionEntity; |
|
|
|
|
import org.springblade.desk.order.pojo.enums.YieldOrderEnum; |
|
|
|
|
import org.springblade.desk.produce.feign.IDisTaskingClient; |
|
|
|
|
import org.springblade.scheduling.pojo.entity.*; |
|
|
|
|
import org.springblade.scheduling.pojo.enums.WorkOrderEnum; |
|
|
|
|
import org.springblade.scheduling.pojo.vo.WorkOrderVO; |
|
|
|
|
@ -111,6 +112,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
private final ICraftAbilityService craftAbilityService; |
|
|
|
|
private final IPartVersionService partVersionService; |
|
|
|
|
private final IPartRelationService partRelationService; |
|
|
|
|
private final IDisTaskingClient disTaskingClient; |
|
|
|
|
@Resource |
|
|
|
|
private final StGlassCakeOutClient glassCakeOutClient; |
|
|
|
|
|
|
|
|
|
@ -465,10 +467,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
//list = mergeYieldOrderList(list);
|
|
|
|
|
LocalDateTime localDateTime = LocalDateTime.now(); |
|
|
|
|
for (YieldOrderEntity order : list) { |
|
|
|
|
log.info("当前订单id是:" + order.getId()); |
|
|
|
|
log.info("当前订单id是:" + order.getId() + ",开始时间是:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
StringBuilder errorInfo = new StringBuilder(""); |
|
|
|
|
try { |
|
|
|
|
DsPartVersionEntity partVersion = partVersionService.getOne(Wrappers.<DsPartVersionEntity>lambdaQuery().eq(DsPartVersionEntity::getPartCode,order.getPartCode()).eq(DsPartVersionEntity::getPartVersion,order.getPartVersion())); |
|
|
|
|
if(partVersion == null){ |
|
|
|
|
errorInfo.append("订单:"+order.getYoCode()+"未查询到零件号:" + order.getPartCode() +"的版本号:"+order.getPartVersion()+"的对应信息;"); |
|
|
|
|
order.setErrorInfo("订单:"+order.getYoCode()+"未查询到零件号:" + order.getPartCode() +"的版本号:"+order.getPartVersion()+"的对应信息"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
@ -483,7 +487,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
//如果是外协回来的订单
|
|
|
|
|
if(order.getStatus() == YieldOrderEnum.STATUS_OUTSOURCING_WAITING.getCode()){ |
|
|
|
|
WorkOrderEntity oldWorkOrder = this.getOne(Wrappers.<WorkOrderEntity>lambdaQuery().eq(WorkOrderEntity::getYoId,order.getId())); |
|
|
|
|
List<WorkPlanEntity> oldWorkPlanList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery().eq(WorkPlanEntity::getWoId,oldWorkOrder.getId())); |
|
|
|
|
//把加工班组为空的删掉
|
|
|
|
|
List<WorkPlanEntity> emptyWorkPlanList = workPlanService.list(Wrappers.<WorkPlanEntity>lambdaQuery().eq(WorkPlanEntity::getWoId,oldWorkOrder.getId()).isNull(WorkPlanEntity::getMakeTeam).isNull(WorkPlanEntity::getFactStartTime)); |
|
|
|
|
List<Long> ids = emptyWorkPlanList.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
workPlanService.deleteLogic(ids); |
|
|
|
|
//查询已经加工完的
|
|
|
|
|
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()); |
|
|
|
|
craftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery().eq(YieldOrderCraftEntity::getYoId, order.getId()).ne(YieldOrderCraftEntity::getCaId, 27).notIn(YieldOrderCraftEntity::getPpsId,ppsIds).orderByAsc(YieldOrderCraftEntity::getProcessNo)); |
|
|
|
|
} |
|
|
|
|
@ -491,16 +500,17 @@ 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()) { |
|
|
|
|
String errorInfo = craftList1.stream().filter(item -> item.getWorkCenterId() == null) |
|
|
|
|
String errorInfo2 = 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; |
|
|
|
|
errorInfo.append("工序信息不完整,工序:" + errorInfo2 + "未匹配作业中心;"); |
|
|
|
|
// order.setErrorInfo("工序信息不完整,工序:" + errorInfo + "未匹配作业中心");
|
|
|
|
|
// order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode());
|
|
|
|
|
// yieldOrderService.updateById(order);
|
|
|
|
|
// continue;
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//上一道工序结束时间
|
|
|
|
|
@ -510,10 +520,29 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlanList = planMap.get(order.getId()); |
|
|
|
|
prevProcessEnd = prevProcessEnd.compareTo(workPlanList.get(workPlanList.size() - 1).getPlanEndTime()) > 0 ? prevProcessEnd : workPlanList.get(workPlanList.size() - 1).getPlanEndTime(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
boolean isContainsOut = false; |
|
|
|
|
for (int i = 0; i < craftList.size(); i++) { |
|
|
|
|
YieldOrderCraftEntity craft = craftList.get(i); |
|
|
|
|
log.info("当前订单是:" + order.getId() + ",工序是:" + craft.getId()); |
|
|
|
|
//如果上一道工序是外协,那么后面所有工序不需要排班组、时间,只放置空workPlan数据
|
|
|
|
|
if(isContainsOut){ |
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
workPlan.setWoId(order.getId()); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
workPlan.setPpsId(craft.getPpsId()); |
|
|
|
|
workPlan.setWorkQty(0); |
|
|
|
|
workPlan.setWorkCenterId(craft.getWorkCenterId()); |
|
|
|
|
workPlan.setOrders(craft.getProcessNo()); |
|
|
|
|
workPlan.setOem("0"); |
|
|
|
|
workPlan.setTestQty(0); |
|
|
|
|
workPlan.setQualifiedQty(0); |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
workPlan.setScrapQty(0); |
|
|
|
|
workPlan.setOcId(craft.getOcId()); |
|
|
|
|
workPlan.setCruxProcess(mainProcessMap.get(craft.getPpsId())); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//如果是外协的话,去查询外协工序时间,若未查询到先默认3天,跳过该工序的排产
|
|
|
|
|
if (craft.getIsOutsource()) { |
|
|
|
|
OutsourceProcessEntity outsourceProcess = outsourceProcessService.getOne(Wrappers.<OutsourceProcessEntity>lambdaQuery().eq(OutsourceProcessEntity::getProcessId, craft.getPpsId())); |
|
|
|
|
@ -533,7 +562,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlan.setHourQuota(totalTime); |
|
|
|
|
workPlan.setWorkCenterId(craft.getWorkCenterId()); |
|
|
|
|
workPlan.setOrders(craft.getProcessNo()); |
|
|
|
|
workPlan.setOem("0"); |
|
|
|
|
workPlan.setOem("1"); |
|
|
|
|
workPlan.setTestQty(0); |
|
|
|
|
workPlan.setQualifiedQty(0); |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
@ -543,7 +572,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
//下一道工序如果不是外协就只排产到外协工序停止
|
|
|
|
|
if(i!=craftList.size()-1 && !craftList.get(i+1).getIsOutsource()){ |
|
|
|
|
break; |
|
|
|
|
isContainsOut = true; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ("设备".equals(mainProducerMap.get(craft.getPpsId()))) { |
|
|
|
|
@ -580,11 +609,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
equipAbilityList = equipAbilityService.list(Wrappers.<EquipAbilityEntity>lambdaQuery().in(EquipAbilityEntity::getWorkCenterId, craft.getWorkCenterId()).eq(EquipAbilityEntity::getCraftId, craft.getCaId()).eq(EquipAbilityEntity::getProcessId,craft.getPpsId())); |
|
|
|
|
} |
|
|
|
|
if (CollectionUtils.isEmpty(equipAbilityList)) { |
|
|
|
|
order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的设备能力"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
errorInfo.append("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的设备能力;"); |
|
|
|
|
// order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的设备能力");
|
|
|
|
|
// order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode());
|
|
|
|
|
// yieldOrderService.updateById(order);
|
|
|
|
|
isSchecuding = false; |
|
|
|
|
break; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Map<Integer, List<EquipAbilityEntity>> equipAbilityMap = equipAbilityList.stream().collect(Collectors.groupingBy(EquipAbilityEntity::getEquipOrder)); |
|
|
|
|
|
|
|
|
|
@ -621,7 +651,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(equipResourceList)) { |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_APS.getCode()); |
|
|
|
|
order.setErrorInfo("工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的设备资源"); |
|
|
|
|
order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",设备资源已不足"); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
isSchecuding = false; |
|
|
|
|
break; |
|
|
|
|
@ -653,6 +683,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
Boolean isOccupied = false; |
|
|
|
|
List<EquipResourceEntity> resourceList = entry1.getValue(); |
|
|
|
|
for (EquipResourceEntity equipResource : resourceList) { |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
if(equipResource.getStartTime().compareTo(prevProcessEnd) <0){ |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
@ -685,13 +716,17 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
if(order.getYieldType() != YieldOrderEnum.YIELD_TYPE_1.getCode()){ |
|
|
|
|
Double personHours = 0.0; |
|
|
|
|
if("箱式排腊玻化工序".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
personHours = calPersonHoursByXsplbh(capacity.intValue(),part); |
|
|
|
|
hourMap = calPersonHoursByXsplbh(capacity.intValue(),part); |
|
|
|
|
}else if("真空炉灌胶".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
personHours = calPersonHoursByZklgj(capacity.intValue(),part); |
|
|
|
|
hourMap = calPersonHoursByZklgj(capacity.intValue(),part); |
|
|
|
|
}else{ |
|
|
|
|
personHours = calPersonHours(capacity.intValue(),craft,part); |
|
|
|
|
hourMap = calPersonHours(capacity.intValue(),craft,part); |
|
|
|
|
} |
|
|
|
|
personHours = Double.valueOf(hourMap.get("totalTime").toString()); |
|
|
|
|
workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue())); |
|
|
|
|
workPlan.setStandardTime(Double.valueOf(hourMap.get("standartTime").toString())); |
|
|
|
|
workPlan.setPrepareTime(Double.valueOf(hourMap.get("prepareTime").toString())); |
|
|
|
|
workPlan.setHourType(hourMap.get("hourType").toString()); |
|
|
|
|
} |
|
|
|
|
workPlan.setWorkQty(0); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
@ -779,9 +814,16 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} else if ("人".equals(mainProducerMap.get(craft.getPpsId()))) { |
|
|
|
|
//匹配人资源
|
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double totalTime = 0.0; |
|
|
|
|
PersonAbilityEntity ability = personAbilityMap.get(craft.getWorkCenterId() + "-" + craft.getCaId() + "-" + craft.getPpsId()); |
|
|
|
|
log.info("人员能力是:" + craft.getWorkCenterId() + "-" + craft.getCaId() + "-" + craft.getPpsId()); |
|
|
|
|
//如果没有配置相应工艺能力的人员能力,就查一下有没有配置公共的能力
|
|
|
|
|
if(ability == null){ |
|
|
|
|
ability = personAbilityService.getOne(Wrappers.<PersonAbilityEntity>lambdaQuery().eq(PersonAbilityEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
.eq(PersonAbilityEntity::getProcessId,craft.getPpsId()) |
|
|
|
|
.isNull(PersonAbilityEntity::getCraftId)); |
|
|
|
|
} |
|
|
|
|
//镀后检验和镀后接收先按半小时计算
|
|
|
|
|
if (ability != null) { |
|
|
|
|
if ("镀后检验".equals(ability.getProcessName()) || "镀后接收".equals(ability.getProcessName())) { |
|
|
|
|
@ -795,6 +837,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlan.setMakeTeam(Long.valueOf(65)); |
|
|
|
|
} |
|
|
|
|
prevProcessEnd = workPlan.getPlanEndTime(); |
|
|
|
|
hourMap.put("standardTime",30); |
|
|
|
|
hourMap.put("prepareTime",0); |
|
|
|
|
hourMap.put("hourType",1); |
|
|
|
|
} else { |
|
|
|
|
//烧结订单和热表订单不同的计算逻辑
|
|
|
|
|
if(order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode()){ |
|
|
|
|
@ -803,26 +848,30 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} else { |
|
|
|
|
totalTime = Math.ceil(totalTime + Double.parseDouble(ability.getStandardTime()) + ability.getPrepareTime().doubleValue()); |
|
|
|
|
} |
|
|
|
|
hourMap.put("totalTime",totalTime); |
|
|
|
|
hourMap.put("standardTime",ability.getStandardTime()); |
|
|
|
|
hourMap.put("preareTime",ability.getPrepareTime()); |
|
|
|
|
hourMap.put("hourType",ability.getType()); |
|
|
|
|
}else{ |
|
|
|
|
if("玻璃封接组装".equals(processMap.get(craft.getPpsId()))){//玻璃封接组装单独计算
|
|
|
|
|
totalTime = calPersonHoursByBlfjzz(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByBlfjzz(order.getYpQty(),part); |
|
|
|
|
}else if("箱式排腊玻化工序".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByXsplbh(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByXsplbh(order.getYpQty(),part); |
|
|
|
|
}else if("玻璃封接卸模".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByBlfjxm(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByBlfjxm(order.getYpQty(),part); |
|
|
|
|
}else if("玻璃封接灌胶".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByBlfjgj(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByBlfjgj(order.getYpQty(),part); |
|
|
|
|
}else if("真空炉灌胶".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByZklgj(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByZklgj(order.getYpQty(),part); |
|
|
|
|
}else if("单侧折针".equals(processMap.get(craft.getPpsId())) || "双侧折针".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByZz(order.getYpQty(),part,processMap.get(craft.getPpsId())); |
|
|
|
|
hourMap = calPersonHoursByZz(order.getYpQty(),part,processMap.get(craft.getPpsId())); |
|
|
|
|
}else if("玻璃封接电镀上挂".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
totalTime = calPersonHoursByBlfjddsg(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByBlfjddsg(order.getYpQty(),part); |
|
|
|
|
}else{ |
|
|
|
|
totalTime = calPersonHours(order.getYpQty(),craft,part); |
|
|
|
|
hourMap = calPersonHours(order.getYpQty(),craft,part); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
totalTime = Double.valueOf(hourMap.get("totalTime").toString()); |
|
|
|
|
prevProcessEnd = prevProcessEnd.plusMinutes(totalTime.longValue()); |
|
|
|
|
} |
|
|
|
|
LambdaQueryWrapper<PersonResourceEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
@ -839,11 +888,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
if (CollectionUtils.isNotEmpty(personResourceList)) { |
|
|
|
|
workPlan.setMakeTeam(personResourceList.get(0).getTeamId()); |
|
|
|
|
}else{ |
|
|
|
|
order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
errorInfo.append("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力;"); |
|
|
|
|
// order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力");
|
|
|
|
|
// order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode());
|
|
|
|
|
// yieldOrderService.updateById(order);
|
|
|
|
|
isSchecuding = false; |
|
|
|
|
break; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
//需要人员资质的指定到人
|
|
|
|
|
if (StringUtils.isNotEmpty(ability.getProductIdent()) |
|
|
|
|
@ -856,11 +906,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
errorInfo.append("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力;"); |
|
|
|
|
// order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力");
|
|
|
|
|
// order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode());
|
|
|
|
|
// yieldOrderService.updateById(order);
|
|
|
|
|
isSchecuding = false; |
|
|
|
|
break; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
workPlan.setWoId(order.getId()); |
|
|
|
|
@ -876,23 +927,32 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlan.setUnqualifiedQty(0); |
|
|
|
|
workPlan.setScrapQty(0); |
|
|
|
|
workPlan.setCruxProcess(mainProcessMap.get(craft.getPpsId())); |
|
|
|
|
workPlan.setStandardTime(Double.valueOf(hourMap.get("standardTime").toString())); |
|
|
|
|
workPlan.setPrepareTime(Double.valueOf(hourMap.get("prepareTime").toString())); |
|
|
|
|
workPlan.setHourType(hourMap.get("hourType").toString()); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
errorInfo.append("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力和设备能力;"); |
|
|
|
|
log.info("未匹配到设备和人力资源的工序是:" + craft.getPpsId()); |
|
|
|
|
order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力和设备能力"); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
// order.setErrorInfo("作业中心:" + workCenterMap.get(craft.getWorkCenterId()) + ",工艺:" + craftAbilityMap.get(craft.getCaId()) + ",工序:" + processMap.get(craft.getPpsId()) + ",未匹配到对应的人员能力和设备能力");
|
|
|
|
|
// order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode());
|
|
|
|
|
// yieldOrderService.updateById(order);
|
|
|
|
|
isSchecuding = false; |
|
|
|
|
break; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isSchecuding) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
// if (!isSchecuding) {
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
if (!isSchecuding) { |
|
|
|
|
if(errorInfo.length() > 0){ |
|
|
|
|
order.setErrorInfo(errorInfo.toString()); |
|
|
|
|
order.setStatus(YieldOrderEnum.STATUS_PROCESS_ERROR.getCode()); |
|
|
|
|
yieldOrderService.updateById(order); |
|
|
|
|
} |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -937,6 +997,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.save(workOrder); |
|
|
|
|
//生成生产运行记录
|
|
|
|
|
disTaskingClient.saveWorkOrderRun(workOrder.getId().toString()); |
|
|
|
|
}else if(order.getStatus() == YieldOrderEnum.STATUS_OUTSOURCING_WAITING.getCode()){ |
|
|
|
|
workOrder = this.getOne(Wrappers.<WorkOrderEntity>lambdaQuery().eq(WorkOrderEntity::getYoId,order.getId())); |
|
|
|
|
workOrder.setPlanEndDate(workPlanList.get(workPlanList.size() - 1).getPlanEndTime() == null ? null : workPlanList.get(workPlanList.size() - 1).getPlanEndTime().truncatedTo(ChronoUnit.DAYS).toString().substring(0, 10)); |
|
|
|
|
@ -980,7 +1042,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
log.error("报错订单是:" + order.getId() + ",报错信息是:" + sw.toString()); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
log.info("当前订单:" + order.getId() + "结束!"); |
|
|
|
|
log.info("当前订单:" + order.getId() + "结束:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
} |
|
|
|
|
if(CollectionUtils.isNotEmpty(glassCakeOutList)){ |
|
|
|
|
// glassCakeOutClient.batchGeneratePreOutOrder(glassCakeOutList);
|
|
|
|
|
@ -1326,7 +1388,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Map<Long, List<WorkPlanEntity>> dealCommonCraftOrders(Map<Long, String> mainProcessMap) { |
|
|
|
|
log.info("处理前置公共工序开始!"); |
|
|
|
|
log.info("处理前置公共工序开始:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
List<YieldOrderEntity> commonCraftOrderList = yieldOrderService.selectCommonCraftOrderList(); |
|
|
|
|
Map<Long, List<WorkPlanEntity>> planMap = new HashMap<>(); |
|
|
|
|
if (CollectionUtils.isNotEmpty(commonCraftOrderList)) { |
|
|
|
|
@ -1389,7 +1451,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
log.info("处理前置公共工序结束!"); |
|
|
|
|
log.info("处理前置公共工序结束:" + DateFormatUtils.format(new Date(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
return planMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ -1787,6 +1849,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
|
|
for (EquipResourceEntity equipResource : equipResourceList) { |
|
|
|
|
if (equipResource.getRestCapacity().compareTo(sumCapacity) > 0) { |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
//生成车间订单
|
|
|
|
|
WorkPlanEntity workPlan = new WorkPlanEntity(); |
|
|
|
|
workPlan.setPlanStartTime(equipResource.getStartTime()); |
|
|
|
|
@ -1797,12 +1860,13 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
Double personHours = 0.0; |
|
|
|
|
if("箱式排腊玻化工序".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
personHours = calPersonHoursByXsplbh(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByXsplbh(order.getYpQty(),part); |
|
|
|
|
}else if("真空炉灌胶".equals(processMap.get(craft.getPpsId()))){ |
|
|
|
|
personHours = calPersonHoursByZklgj(order.getYpQty(),part); |
|
|
|
|
hourMap = calPersonHoursByZklgj(order.getYpQty(),part); |
|
|
|
|
}else{ |
|
|
|
|
personHours = calPersonHours(order.getYpQty(),craft,part); |
|
|
|
|
hourMap = calPersonHours(order.getYpQty(),craft,part); |
|
|
|
|
} |
|
|
|
|
personHours = Double.valueOf(hourMap.get("totalTime").toString()); |
|
|
|
|
workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue())); |
|
|
|
|
workPlan.setWorkQty(0); |
|
|
|
|
workPlan.setCaId(craft.getCaId()); |
|
|
|
|
@ -1821,6 +1885,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
workPlan.setEquipName(equipResource.getEquipName()); |
|
|
|
|
workPlan.setEquipResourceId(equipResource.getId().toString()); |
|
|
|
|
workPlan.setCruxProcess(mainProcessMap.get(craft.getPpsId())); |
|
|
|
|
workPlan.setStandardTime(Double.valueOf(hourMap.get("standardTime").toString())); |
|
|
|
|
workPlan.setPrepareTime(Double.valueOf(hourMap.get("prepareTime").toString())); |
|
|
|
|
workPlan.setHourType(hourMap.get("hourType").toString()); |
|
|
|
|
workPlanList.add(workPlan); |
|
|
|
|
|
|
|
|
|
equipResource.setRestCapacity(equipResource.getRestCapacity().subtract(sumCapacity)); |
|
|
|
|
@ -1972,7 +2039,11 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
// glassCakeOutClient.batchGeneratePreOutOrder(list);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public Double calPersonHours(Integer qty,YieldOrderCraftEntity craft,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHours(Integer qty,YieldOrderCraftEntity craft,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double standardTime = 0.0; |
|
|
|
|
Double prepareTime = 0.0; |
|
|
|
|
String hourType = "0"; |
|
|
|
|
Double personTime = 0.0; |
|
|
|
|
List<PersonAbilityEntity> personAbilityList = personAbilityService.list(Wrappers.<PersonAbilityEntity>lambdaQuery() |
|
|
|
|
.eq(PersonAbilityEntity::getWorkCenterId,craft.getWorkCenterId()) |
|
|
|
|
@ -1986,6 +2057,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
for(PersonAbilityVO vo : voList){ |
|
|
|
|
if(part.getExternalDiameter() != null && part.getExternalDiameter() > vo.getStartNum() && part.getExternalDiameter() <= vo.getEndNum()){ |
|
|
|
|
personTime = Double.parseDouble(vo.getStandardTime()) * qty + personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
standardTime = Double.valueOf(vo.getStandardTime()); |
|
|
|
|
prepareTime = personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
hourType = personAbility.getType(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -1999,6 +2073,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
for(PersonAbilityVO vo : voList){ |
|
|
|
|
if(part.getBlbDiameter() != null && part.getBlbDiameter() >vo.getStartNum() && part.getBlbDiameter() <= vo.getEndNum()){ |
|
|
|
|
personTime = Double.parseDouble(vo.getStandardTime()) * qty + personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
standardTime = Double.valueOf(vo.getStandardTime()); |
|
|
|
|
prepareTime = personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
hourType = personAbility.getType(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -2023,6 +2100,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
for(PersonAbilityVO vo : voList){ |
|
|
|
|
if(quota > vo.getStartNum() && quota <= vo.getEndNum()){ |
|
|
|
|
personTime = Double.parseDouble(vo.getStandardTime()) * qty + personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
standardTime = Double.valueOf(vo.getStandardTime()); |
|
|
|
|
prepareTime = personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
hourType = personAbility.getType(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -2036,14 +2116,22 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
.eq(PersonAbilityEntity::getCraftId,craft.getCaId()) |
|
|
|
|
.eq(PersonAbilityEntity::getProcessId,craft.getPpsId())); |
|
|
|
|
personTime = Double.parseDouble(personAbility.getStandardTime() == null ? "0" : personAbility.getStandardTime()) * qty + (personAbility.getPrepareTime() == null ? 0 : personAbility.getPrepareTime().doubleValue()); |
|
|
|
|
standardTime = Double.parseDouble(personAbility.getStandardTime() == null ? "0" : personAbility.getStandardTime()); |
|
|
|
|
prepareTime = personAbility.getPrepareTime().doubleValue(); |
|
|
|
|
hourType = personAbility.getType(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(personTime); |
|
|
|
|
hourMap.put("standardTime",standardTime); |
|
|
|
|
hourMap.put("preareTime",prepareTime); |
|
|
|
|
hourMap.put("hourType",hourType); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(personTime)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//玻璃封接组装
|
|
|
|
|
public Double calPersonHoursByBlfjzz(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByBlfjzz(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null) { |
|
|
|
|
List<PartRelationEntity> partRelationList = partRelationService.list(Wrappers.<PartRelationEntity>lambdaQuery().eq(PartRelationEntity::getPartId,part.getId())); |
|
|
|
|
@ -2051,13 +2139,15 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
List<PartEntity> childPartList = partService.list(Wrappers.<PartEntity>lambdaQuery().in(BaseEntity::getId,childIds)); |
|
|
|
|
List<PartEntity> partCz = childPartList.stream().filter(item -> DsPartConstant.SIN_TER_TYPE_CZ.equals(item.getSinTerType())).collect(Collectors.toList()); |
|
|
|
|
List<PartEntity> partBlb = childPartList.stream().filter(item -> DsPartConstant.SIN_TER_TYPE_BLB.equals(item.getSinTerType())).collect(Collectors.toList()); |
|
|
|
|
List<Long> czIds = partCz.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
List<PartRelationEntity> czPartRelationList = partRelationList.stream().filter(czPart ->czIds.contains(czPart.getChildPartId())).collect(Collectors.toList()); |
|
|
|
|
boolean hb = false; |
|
|
|
|
for (PartEntity part1 : partCz) { |
|
|
|
|
hb = part1.getPartName().contains("焊杯"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double sumOfQuota = partCz.stream() |
|
|
|
|
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
double sumOfQuota = czPartRelationList.stream() |
|
|
|
|
.mapToDouble(PartRelationEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
.sum(); |
|
|
|
|
int x = partCz.size(); |
|
|
|
|
int y = partBlb.size(); |
|
|
|
|
@ -2138,11 +2228,16 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",0); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//箱式排腊玻化工序
|
|
|
|
|
public Double calPersonHoursByXsplbh(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByXsplbh(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null && part.getBlbDiameter() != null) { |
|
|
|
|
Double n = part.getBlbDiameter(); |
|
|
|
|
@ -2167,30 +2262,38 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
result = 0.6 + 0.6 * Math.pow(1.2, y); |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty + 19); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",19); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty + 19)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//玻璃封接卸模
|
|
|
|
|
public Double calPersonHoursByBlfjxm(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByBlfjxm(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null) { |
|
|
|
|
List<PartRelationEntity> partRelationList = partRelationService.list(Wrappers.<PartRelationEntity>lambdaQuery().eq(PartRelationEntity::getPartId,part.getId())); |
|
|
|
|
List<Long> childIds = partRelationList.stream().map(PartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
List<PartEntity> childPartList = partService.list(Wrappers.<PartEntity>lambdaQuery().in(BaseEntity::getId,childIds)); |
|
|
|
|
Map<Long,Double> map = partRelationList.stream().collect(Collectors.toMap(PartRelationEntity::getChildPartId,PartRelationEntity::getQuota)); |
|
|
|
|
if (childPartList != null && childPartList.size() > 0) { |
|
|
|
|
double n = 0; |
|
|
|
|
boolean pzm = false; |
|
|
|
|
for (PartEntity childPart : childPartList) { |
|
|
|
|
if (childPart.getPartCode().contains("21E8-716")) { |
|
|
|
|
n = n + childPart.getQuota(); |
|
|
|
|
n = n + map.get(childPart.getId()); |
|
|
|
|
} |
|
|
|
|
pzm = childPart.getSinTerType().equals(DsPartConstant.SIN_TER_TYPE_KT) && childPart.getConfigCode().equals("M4"); |
|
|
|
|
} |
|
|
|
|
if (n <= 2) { |
|
|
|
|
List<PartEntity> partCz = childPartList.stream().filter(item -> DsPartConstant.SIN_TER_TYPE_CZ.equals(item.getSinTerType())).collect(Collectors.toList()); |
|
|
|
|
List<Long> czIds = partCz.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
List<PartRelationEntity> czPartRelationList = partRelationList.stream().filter(czPart ->czIds.contains(czPart.getChildPartId())).collect(Collectors.toList()); |
|
|
|
|
if (partCz != null && partCz.size() > 0) { |
|
|
|
|
double sumOfQuota = partCz.stream() |
|
|
|
|
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
double sumOfQuota = czPartRelationList.stream() |
|
|
|
|
.mapToDouble(PartRelationEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
.sum(); |
|
|
|
|
double y = 0; |
|
|
|
|
if (sumOfQuota <= 5) { |
|
|
|
|
@ -2216,9 +2319,11 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
if (n > 2) { |
|
|
|
|
List<PartEntity> partCz = childPartList.stream().filter(item -> DsPartConstant.SIN_TER_TYPE_CZ.equals(item.getSinTerType())).collect(Collectors.toList()); |
|
|
|
|
List<Long> czIds = partCz.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
List<PartRelationEntity> czPartRelationList = partRelationList.stream().filter(czPart ->czIds.contains(czPart.getChildPartId())).collect(Collectors.toList()); |
|
|
|
|
if (partCz != null && partCz.size() > 0) { |
|
|
|
|
double sumOfQuota = partCz.stream() |
|
|
|
|
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
double sumOfQuota = czPartRelationList.stream() |
|
|
|
|
.mapToDouble(PartRelationEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
.sum(); |
|
|
|
|
double y = 0; |
|
|
|
|
if (sumOfQuota <= 5) { |
|
|
|
|
@ -2252,11 +2357,16 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty + 3); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",3); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty + 3)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//玻璃封接灌胶
|
|
|
|
|
public Double calPersonHoursByBlfjgj(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByBlfjgj(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null&&part.getExternalDiameter() != null) { |
|
|
|
|
Double n = part.getExternalDiameter(); |
|
|
|
|
@ -2295,23 +2405,30 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty + 4); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",4); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty + 4)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//真空炉灌胶
|
|
|
|
|
public Double calPersonHoursByZklgj(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByZklgj(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null && part.getExternalDiameter() != null) { |
|
|
|
|
List<PartRelationEntity> partRelationList = partRelationService.list(Wrappers.<PartRelationEntity>lambdaQuery().eq(PartRelationEntity::getPartId,part.getId())); |
|
|
|
|
List<Long> childIds = partRelationList.stream().map(PartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
List<PartEntity> partCz = partService.list(Wrappers.<PartEntity>lambdaQuery().in(BaseEntity::getId,childIds).eq(PartEntity::getSinTerType,DsPartConstant.SIN_TER_TYPE_CZ)); |
|
|
|
|
List<Long> czIds = partCz.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
List<PartRelationEntity> czPartRelationList = partRelationList.stream().filter(czPart ->czIds.contains(czPart.getChildPartId())).collect(Collectors.toList()); |
|
|
|
|
boolean hb = false; |
|
|
|
|
for (PartEntity childPart : partCz) { |
|
|
|
|
hb = childPart.getPartName().contains("双头"); |
|
|
|
|
} |
|
|
|
|
Double n = part.getExternalDiameter(); |
|
|
|
|
double sumOfQuota = partCz.stream() |
|
|
|
|
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
double sumOfQuota = czPartRelationList.stream() |
|
|
|
|
.mapToDouble(PartRelationEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
.sum(); |
|
|
|
|
if (!hb) { |
|
|
|
|
if (n <= 15) { |
|
|
|
|
@ -2349,20 +2466,27 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
result = result * qty + 10; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",0); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
//单侧折针、双侧折针
|
|
|
|
|
public Double calPersonHoursByZz(Integer qty,PartEntity part,String processName){ |
|
|
|
|
public Map<String,Object> calPersonHoursByZz(Integer qty,PartEntity part,String processName){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null) { |
|
|
|
|
List<PartRelationEntity> partRelationList = partRelationService.list(Wrappers.<PartRelationEntity>lambdaQuery().eq(PartRelationEntity::getPartId,part.getId())); |
|
|
|
|
List<Long> childIds = partRelationList.stream().map(PartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
List<PartEntity> partCz = partService.list(Wrappers.<PartEntity>lambdaQuery().in(BaseEntity::getId,childIds).eq(PartEntity::getSinTerType,DsPartConstant.SIN_TER_TYPE_CZ)); |
|
|
|
|
Map<Long,Double> map = partRelationList.stream().collect(Collectors.toMap(PartRelationEntity::getChildPartId,PartRelationEntity::getQuota)); |
|
|
|
|
|
|
|
|
|
if (partCz != null && partCz.size() > 0) { |
|
|
|
|
double n = 0; |
|
|
|
|
for (PartEntity childPart : partCz) { |
|
|
|
|
if (childPart.getPartCode().contains("21ET8")) { |
|
|
|
|
n = n + childPart.getQuota(); |
|
|
|
|
n = n + map.get(childPart.getId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (processName.equals("单侧折针")) { |
|
|
|
|
@ -2372,24 +2496,36 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty + 2); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",2); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty + 2)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//玻璃封接电镀上挂
|
|
|
|
|
public Double calPersonHoursByBlfjddsg(Integer qty,PartEntity part){ |
|
|
|
|
public Map<String,Object> calPersonHoursByBlfjddsg(Integer qty,PartEntity part){ |
|
|
|
|
Map<String,Object> hourMap = new HashMap<>(); |
|
|
|
|
Double result = 0.0; |
|
|
|
|
if (part != null && part.getId() != null) { |
|
|
|
|
List<PartRelationEntity> partRelationList = partRelationService.list(Wrappers.<PartRelationEntity>lambdaQuery().eq(PartRelationEntity::getPartId,part.getId())); |
|
|
|
|
List<Long> childIds = partRelationList.stream().map(PartRelationEntity::getChildPartId).collect(Collectors.toList()); |
|
|
|
|
List<PartEntity> partCz = partService.list(Wrappers.<PartEntity>lambdaQuery().in(BaseEntity::getId,childIds).eq(PartEntity::getSinTerType,DsPartConstant.SIN_TER_TYPE_CZ)); |
|
|
|
|
List<Long> czIds = partCz.stream().map(BaseEntity::getId).collect(Collectors.toList()); |
|
|
|
|
List<PartRelationEntity> czPartRelationList = partRelationList.stream().filter(czPart ->czIds.contains(czPart.getChildPartId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
if (partCz != null && partCz.size() > 0) { |
|
|
|
|
double sumOfQuota = partCz.stream() |
|
|
|
|
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
double sumOfQuota = czPartRelationList.stream() |
|
|
|
|
.mapToDouble(PartRelationEntity::getQuota) // 调用 getQuota() 方法
|
|
|
|
|
.sum(); |
|
|
|
|
result = (38 + 3 * sumOfQuota) / 60; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return Math.ceil(result * qty + 2); |
|
|
|
|
hourMap.put("standardTime",result); |
|
|
|
|
hourMap.put("preareTime",3); |
|
|
|
|
hourMap.put("hourType","0"); |
|
|
|
|
hourMap.put("totalTime",Math.ceil(result * qty + 3)); |
|
|
|
|
return hourMap; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static List<YieldOrderEntity> mergeYieldOrderList(List<YieldOrderEntity> originalList) { |
|
|
|
|
|