Compare commits

..

No commits in common. '5402fb78f2d362ec1cbbdac31a1547c07d2eab08' and '4477be1b89e188b2557e385a114c0466c285d46c' have entirely different histories.

  1. 2
      blade-service-api/blade-wms-api/src/main/java/org/springblade/wms/pojo/dto/StPdmPartDTO.java
  2. 2
      blade-service/blade-scheduling/src/main/java/org/springblade/scheduling/scheduling/controller/WorkOrderController.java
  3. 4
      blade-service/blade-scheduling/src/main/java/org/springblade/scheduling/scheduling/mapper/EquipAbilityMapper.xml
  4. 4
      blade-service/blade-scheduling/src/main/java/org/springblade/scheduling/scheduling/mapper/SameTroughMapper.xml
  5. 2
      blade-service/blade-scheduling/src/main/java/org/springblade/scheduling/scheduling/mapper/WorkOrderMapper.xml
  6. 91
      blade-service/blade-scheduling/src/main/java/org/springblade/scheduling/scheduling/service/impl/WorkOrderServiceImpl.java

@ -1,7 +1,6 @@
package org.springblade.wms.pojo.dto; package org.springblade.wms.pojo.dto;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data; import lombok.Data;
import java.io.Serial; import java.io.Serial;
@ -17,7 +16,6 @@ import java.util.Date;
* @create 2025-12-16 13:09 * @create 2025-12-16 13:09
**/ **/
@Data @Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class StPdmPartDTO implements Serializable { public class StPdmPartDTO implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -8392387759431929168L; private static final long serialVersionUID = -8392387759431929168L;

@ -168,7 +168,7 @@ public class WorkOrderController extends BladeController {
/** /**
* 车间订单表 排产 * 车间订单表 排产
*/ */
@GetMapping("/scheduling") @PostMapping("/scheduling")
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
@Operation(summary = "排产", description = "传入WorkOrder") @Operation(summary = "排产", description = "传入WorkOrder")
public void scheduling() { public void scheduling() {

@ -31,8 +31,8 @@
select * from MES_EQUIP_ABILITY select * from MES_EQUIP_ABILITY
<where> <where>
is_deleted = 0 is_deleted = 0
<if test="param2.workCenterName !=null and param2.workCenterName != ''"> <if test="param2.workCenterId !=null">
and work_center_name LIKE CONCAT('%', CONCAT(#{param2.workCenterName}, '%')) and work_center_id = #{param2.workCenterId}
</if> </if>
<if test="param2.equipCode !=null and param2.equipCode !=''"> <if test="param2.equipCode !=null and param2.equipCode !=''">
and equip_code = #{param2.equipCode} and equip_code = #{param2.equipCode}

@ -55,8 +55,8 @@
FROM FROM
MES_YIELD_ORDER a MES_YIELD_ORDER a
LEFT JOIN DS_PART b ON a.PART_CODE = b.PART_CODE LEFT JOIN DS_PART b ON a.PART_CODE = b.PART_CODE
INNER JOIN DS_PART_VERSION d ON b.ID = d.PART_ID AND a.PART_VERSION = d.PART_VERSION AND a.PART_CODE = d.PART_CODE LEFT JOIN DS_PART_VERSION d ON b.ID = d.PART_ID AND a.PART_VERSION = d.PART_VERSION AND a.PART_CODE = d.PART_CODE
INNER JOIN MES_YIELD_ORDER_CRAFT c ON a.id = c.yo_id LEFT JOIN MES_YIELD_ORDER_CRAFT c ON a.id = c.yo_id
<where> <where>
a.is_deleted = 0 AND c.WORK_CENTER_ID IS NOT NULL a.is_deleted = 0 AND c.WORK_CENTER_ID IS NOT NULL
<if test="id != null"> <if test="id != null">

@ -291,7 +291,7 @@
AND cm.is_deleted = 0 AND cm.is_deleted = 0
LEFT JOIN MES_CERTIFICATE_TYPE ct ON cm.certificate_id = ct.id LEFT JOIN MES_CERTIFICATE_TYPE ct ON cm.certificate_id = ct.id
AND ct.is_deleted = 0 AND ct.is_deleted = 0
LEFT JOIN BS_REL_TEAM_SET_USER tu ON ph.user_id = tu.user_id LEFT JOIN BA_REL_TEAM_SET_USER tu ON ph.user_id = tu.user_id
LEFT JOIN BS_TEAM_SET ts ON tu.team_set_id = ts.id LEFT JOIN BS_TEAM_SET ts ON tu.team_set_id = ts.id
WHERE WHERE
ph.is_deleted = 0 AND ph.staff_type != 1 ph.is_deleted = 0 AND ph.staff_type != 1

@ -63,8 +63,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.ParseException; import java.text.ParseException;
@ -208,7 +206,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
Map<Long, List<SintTempCurveEntity>> sintMap = sintList.stream().collect(Collectors.groupingBy(SintTempCurveEntity::getProcessId)); Map<Long, List<SintTempCurveEntity>> sintMap = sintList.stream().collect(Collectors.groupingBy(SintTempCurveEntity::getProcessId));
//计算cr值 //计算cr值
//calculateCr(list); calculateCr(list);
//根据作业中心将订单分组,并根据优先级、cr值、订单需求数量、计划下达时间4个维度进行组内排序 //根据作业中心将订单分组,并根据优先级、cr值、订单需求数量、计划下达时间4个维度进行组内排序
Map<Long, List<YieldOrderEntity>> map = Map<Long, List<YieldOrderEntity>> map =
list.stream() list.stream()
@ -220,7 +218,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
list1 -> { list1 -> {
// 排序逻辑:优先级升序 → CR值降序 → 数量降序 → 时间升序 // 排序逻辑:优先级升序 → CR值降序 → 数量降序 → 时间升序
list1.sort(Comparator.comparingInt(YieldOrderEntity::getPriorityAps).reversed() list1.sort(Comparator.comparingInt(YieldOrderEntity::getPriorityAps).reversed()
//.thenComparing((e1, e2) -> e2.getCrValue().compareTo(e1.getCrValue())) .thenComparing((e1, e2) -> e2.getCrValue().compareTo(e1.getCrValue()))
.thenComparingInt(YieldOrderEntity::getYpQty).reversed() .thenComparingInt(YieldOrderEntity::getYpQty).reversed()
.thenComparing(YieldOrderEntity::getReleaseDate)); .thenComparing(YieldOrderEntity::getReleaseDate));
return list1; return list1;
@ -228,7 +226,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
) )
)); ));
//处理带有公共前置工序的订单 //处理带有公共前置工序的订单
Map<Long, List<WorkPlanEntity>> planMap = dealCommonCraftOrders(); Map<String, List<WorkPlanEntity>> planMap = dealCommonCraftOrders();
//多线程排产 //多线程排产
ExecutorService threadPool = new ThreadPoolExecutor( ExecutorService threadPool = new ThreadPoolExecutor(
map.size(), map.size(), 0L, TimeUnit.MILLISECONDS, map.size(), map.size(), 0L, TimeUnit.MILLISECONDS,
@ -422,7 +420,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
public void allocateResources(List<YieldOrderEntity> list, public void allocateResources(List<YieldOrderEntity> list,
Map<String, PersonAbilityEntity> personAbilityMap, Map<String, PersonAbilityEntity> personAbilityMap,
Map<Long, String> mainProducerMap, Map<Long, String> mainProducerMap,
Map<Long, List<WorkPlanEntity>> planMap, Map<String, List<WorkPlanEntity>> planMap,
Map<Long, String> processMap, Map<Long, String> processMap,
Map<Long, List<SintTempCurveEntity>> sintMap, Map<Long, List<SintTempCurveEntity>> sintMap,
Map<Long, String> workCenterMap, Map<Long, String> workCenterMap,
@ -473,8 +471,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//上一道工序结束时间 //上一道工序结束时间
LocalDateTime prevProcessEnd = LocalDateTime.now(); LocalDateTime prevProcessEnd = LocalDateTime.now();
//判断是否有公共工序已经处理了,如果有则重新定义workPlanList,获取公共工序的最后结束时间和当前时间做比较,取大的作为上一道工序结束时间 //判断是否有公共工序已经处理了,如果有则重新定义workPlanList,获取公共工序的最后结束时间和当前时间做比较,取大的作为上一道工序结束时间
if (planMap.containsKey(order.getId())) { if (planMap.containsKey(order.getYoCode())) {
workPlanList = planMap.get(order.getId()); workPlanList = planMap.get(order.getYoCode());
prevProcessEnd = prevProcessEnd.compareTo(workPlanList.get(workPlanList.size() - 1).getPlanEndTime()) > 0 ? prevProcessEnd : workPlanList.get(workPlanList.size() - 1).getPlanEndTime(); prevProcessEnd = prevProcessEnd.compareTo(workPlanList.get(workPlanList.size() - 1).getPlanEndTime()) > 0 ? prevProcessEnd : workPlanList.get(workPlanList.size() - 1).getPlanEndTime();
} }
@ -496,7 +494,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
workPlan.setWoId(order.getId()); workPlan.setWoId(order.getId());
workPlan.setCaId(craft.getCaId()); workPlan.setCaId(craft.getCaId());
workPlan.setPpsId(craft.getPpsId()); workPlan.setPpsId(craft.getPpsId());
workPlan.setWorkQty(0); workPlan.setWorkQty(order.getYpQty());
workPlan.setHourQuota(totalTime); workPlan.setHourQuota(totalTime);
workPlan.setWorkCenterId(craft.getWorkCenterId()); workPlan.setWorkCenterId(craft.getWorkCenterId());
workPlan.setOrders(craft.getProcessNo()); workPlan.setOrders(craft.getProcessNo());
@ -518,7 +516,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//同炉同槽 //同炉同槽
if(order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode()){ if(order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode()){
//热表同槽 //热表同槽
Boolean isSameTrough = sameTrough(order, craft, localDateTime, workPlanList); Boolean isSameTrough = sameTrough(order, craft, prevProcessEnd, workPlanList);
//同槽就不需要继续匹配了 //同槽就不需要继续匹配了
if (isSameTrough) { if (isSameTrough) {
continue; continue;
@ -556,17 +554,17 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//获取下一个整数点 //获取下一个整数点
LocalDateTime dateTime = getNextIntegerTime(prevProcessEnd); LocalDateTime dateTime = getNextIntegerTime(prevProcessEnd);
for (Map.Entry<Integer, List<EquipAbilityEntity>> entry : equipAbilityMap.entrySet()) { for (Map.Entry<Integer, List<EquipAbilityEntity>> entry : equipAbilityMap.entrySet()) {
int partType = entry.getValue().get(0).getPartType();
//根据时间点获取所有设备资源 //根据时间点获取所有设备资源
List<EquipResourceEntity> equipResourceList = new ArrayList<>(); List<EquipResourceEntity> equipResourceList = new ArrayList<>();
if(partType == 0){ if(order.getYieldType() == YieldOrderEnum.YIELD_TYPE_1.getCode()){
equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery() equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery()
.eq(EquipResourceEntity::getCraftId, craft.getCaId()) .eq(EquipResourceEntity::getCraftId, craft.getCaId())
.eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId()) .eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId())
.ge(EquipResourceEntity::getStartTime, dateTime) .ge(EquipResourceEntity::getStartTime, dateTime)
.eq(EquipResourceEntity::getIsUsed, 0) .eq(EquipResourceEntity::getIsUsed, 0)
.in(EquipResourceEntity::getEquipOrder, entry.getKey())); .in(EquipResourceEntity::getEquipOrder, entry.getKey()));
}else if(partType == 1){ }else{
if(order.getYieldType() == YieldOrderEnum.YIELD_TYPE_3.getCode()){
equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery() equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery()
.eq(EquipResourceEntity::getCraftId, craft.getCaId()) .eq(EquipResourceEntity::getCraftId, craft.getCaId())
.eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId()) .eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId())
@ -574,9 +572,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
.ge(EquipResourceEntity::getStartTime, dateTime) .ge(EquipResourceEntity::getStartTime, dateTime)
.eq(EquipResourceEntity::getIsUsed, 0) .eq(EquipResourceEntity::getIsUsed, 0)
.in(EquipResourceEntity::getEquipOrder, entry.getKey()) .in(EquipResourceEntity::getEquipOrder, entry.getKey())
.lt(EquipResourceEntity::getStartNum,part.getExternalDiameter()) .lt(EquipResourceEntity::getStartNum,part.getBlbDiameter())
.ge(EquipResourceEntity::getEndNum,part.getExternalDiameter())); .ge(EquipResourceEntity::getEndNum,part.getBlbDiameter()));
}else if(partType == 2){ }else{
equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery() equipResourceList = equipResourceService.list(Wrappers.<EquipResourceEntity>lambdaQuery()
.eq(EquipResourceEntity::getCraftId, craft.getCaId()) .eq(EquipResourceEntity::getCraftId, craft.getCaId())
.eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId()) .eq(EquipResourceEntity::getWorkCenterId, craft.getWorkCenterId())
@ -584,8 +582,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
.ge(EquipResourceEntity::getStartTime, dateTime) .ge(EquipResourceEntity::getStartTime, dateTime)
.eq(EquipResourceEntity::getIsUsed, 0) .eq(EquipResourceEntity::getIsUsed, 0)
.in(EquipResourceEntity::getEquipOrder, entry.getKey()) .in(EquipResourceEntity::getEquipOrder, entry.getKey())
.lt(EquipResourceEntity::getStartNum,part.getBlbDiameter()) .lt(EquipResourceEntity::getStartNum,part.getExternalDiameter())
.ge(EquipResourceEntity::getEndNum,part.getBlbDiameter())); .ge(EquipResourceEntity::getEndNum,part.getExternalDiameter()));
}
} }
if (CollectionUtils.isEmpty(equipResourceList)) { if (CollectionUtils.isEmpty(equipResourceList)) {
@ -766,8 +766,6 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
totalTime = calPersonHoursByZklgj(order,part); totalTime = calPersonHoursByZklgj(order,part);
}else if("单侧折针".equals(processMap.get(craft.getPpsId())) || "双侧折针".equals(processMap.get(craft.getPpsId()))){ }else if("单侧折针".equals(processMap.get(craft.getPpsId())) || "双侧折针".equals(processMap.get(craft.getPpsId()))){
totalTime = calPersonHoursByZz(order,part,processMap.get(craft.getPpsId())); totalTime = calPersonHoursByZz(order,part,processMap.get(craft.getPpsId()));
}else if("玻璃封接电镀上挂".equals(processMap.get(craft.getPpsId()))){
totalTime = calPersonHoursByBlfjddsg(order,part);
}else{ }else{
totalTime = calPersonHours(order,craft,part); totalTime = calPersonHours(order,craft,part);
} }
@ -802,7 +800,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
workPlan.setWoId(order.getId()); workPlan.setWoId(order.getId());
workPlan.setCaId(craft.getCaId()); workPlan.setCaId(craft.getCaId());
workPlan.setPpsId(craft.getPpsId()); workPlan.setPpsId(craft.getPpsId());
workPlan.setWorkQty(0); workPlan.setWorkQty(order.getYpQty());
workPlan.setHourQuota(totalTime); workPlan.setHourQuota(totalTime);
workPlan.setWorkCenterId(craft.getWorkCenterId()); workPlan.setWorkCenterId(craft.getWorkCenterId());
workPlan.setOrders(craft.getProcessNo()); workPlan.setOrders(craft.getProcessNo());
@ -906,11 +904,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
} }
} catch (Exception e) { } catch (Exception e) {
StringWriter sw = new StringWriter(); log.error("报错订单是:" + order.getId() + ",报错信息是:" + e.getMessage());
PrintWriter pw = new PrintWriter(sw); throw new RuntimeException(e);
e.printStackTrace(pw);
log.error("报错订单是:" + order.getId() + ",报错信息是:" + sw.toString());
continue;
} }
log.info("当前订单:" + order.getId() + "结束!"); log.info("当前订单:" + order.getId() + "结束!");
} }
@ -1257,10 +1252,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return batches; return batches;
} }
public Map<Long, List<WorkPlanEntity>> dealCommonCraftOrders() { public Map<String, List<WorkPlanEntity>> dealCommonCraftOrders() {
log.info("处理前置公共工序开始!"); log.info("处理前置公共工序开始!");
List<YieldOrderEntity> commonCraftOrderList = yieldOrderService.selectCommonCraftOrderList(); List<YieldOrderEntity> commonCraftOrderList = yieldOrderService.selectCommonCraftOrderList();
Map<Long, List<WorkPlanEntity>> planMap = new HashMap<>(); Map<String, List<WorkPlanEntity>> planMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(commonCraftOrderList)) { if (CollectionUtils.isNotEmpty(commonCraftOrderList)) {
//对订单进行排序,每5个相同workCenterId的为一组,实现负载均衡 //对订单进行排序,每5个相同workCenterId的为一组,实现负载均衡
commonCraftOrderList = sortByWorkcenterIdPer5Group(commonCraftOrderList); commonCraftOrderList = sortByWorkcenterIdPer5Group(commonCraftOrderList);
@ -1268,7 +1263,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//获取公共工序设备能力,根据工艺能力查询,写死ID是27 //获取公共工序设备能力,根据工艺能力查询,写死ID是27
EquipAbilityEntity equipAbility = equipAbilityService.getOne(Wrappers.<EquipAbilityEntity>lambdaQuery().eq(EquipAbilityEntity::getCraftId, 27)); EquipAbilityEntity equipAbility = equipAbilityService.getOne(Wrappers.<EquipAbilityEntity>lambdaQuery().eq(EquipAbilityEntity::getCraftId, 27));
BigDecimal standardProcessAbility = BigDecimal.valueOf(Integer.parseInt(equipAbility.getStandardProcessAbility())); BigDecimal standardProcessAbility = BigDecimal.valueOf(Integer.parseInt(equipAbility.getStandardProcessAbility()));
//获取所有空闲的公共工序资源
List<EquipResourceEntity> equipResourceList = equipResourceService.selectCommonCraftList();
for (YieldOrderEntity order : commonCraftOrderList) { for (YieldOrderEntity order : commonCraftOrderList) {
List<WorkPlanEntity> workPlanList = new ArrayList<>(); List<WorkPlanEntity> workPlanList = new ArrayList<>();
//获取相关工序 //获取相关工序
@ -1282,8 +1278,6 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
int period = sumCapacity.divide(standardProcessAbility, 0, RoundingMode.CEILING).intValue(); int period = sumCapacity.divide(standardProcessAbility, 0, RoundingMode.CEILING).intValue();
for (int i = 0; i < period; i++) { for (int i = 0; i < period; i++) {
//获取所有空闲的公共工序资源
List<EquipResourceEntity> equipResourceList = equipResourceService.selectCommonCraftList();
for (int j = 0; j < equipResourceList.size(); j++) { for (int j = 0; j < equipResourceList.size(); j++) {
if (i == j) { if (i == j) {
EquipResourceEntity equipResource = equipResourceList.get(j); EquipResourceEntity equipResource = equipResourceList.get(j);
@ -1292,7 +1286,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
WorkPlanEntity workPlan = new WorkPlanEntity(); WorkPlanEntity workPlan = new WorkPlanEntity();
workPlan.setPlanStartTime(equipResource.getStartTime()); workPlan.setPlanStartTime(equipResource.getStartTime());
workPlan.setPlanEndTime(equipResource.getStartTime().plusMinutes(equipResource.getStandardTime().setScale(0, RoundingMode.CEILING).longValue())); workPlan.setPlanEndTime(equipResource.getStartTime().plusMinutes(equipResource.getStandardTime().setScale(0, RoundingMode.CEILING).longValue()));
workPlan.setWorkQty(0); workPlan.setWorkQty(order.getYpQty());
workPlan.setCaId(craft.getCaId()); workPlan.setCaId(craft.getCaId());
workPlan.setPpsId(craft.getPpsId()); workPlan.setPpsId(craft.getPpsId());
workPlan.setMakeTeam(equipResource.getTeamId()); workPlan.setMakeTeam(equipResource.getTeamId());
@ -1313,7 +1307,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
} }
} }
} }
planMap.put(order.getId(), workPlanList); planMap.put(order.getYoCode(), workPlanList);
} }
@ -1401,16 +1395,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//可能有多个订单符合要求,按照车间订单、时间分组排序 //可能有多个订单符合要求,按照车间订单、时间分组排序
Map<Long, List<WorkPlanEntity>> workPlanMap = workPlanOldList.stream().collect(Collectors.groupingBy(WorkPlanEntity::getWoId)); Map<Long, List<WorkPlanEntity>> workPlanMap = workPlanOldList.stream().collect(Collectors.groupingBy(WorkPlanEntity::getWoId));
for (Map.Entry<Long, List<WorkPlanEntity>> entry : workPlanMap.entrySet()) { for (Map.Entry<Long, List<WorkPlanEntity>> entry : workPlanMap.entrySet()) {
Long woId = entry.getKey();
List<WorkPlanEntity> planList = entry.getValue(); List<WorkPlanEntity> planList = entry.getValue();
Boolean isEnough = true; Boolean isEnough = true;
List<Long> resourceList = new ArrayList<>(); List<Long> resourceList = new ArrayList<>();
for (WorkPlanEntity workPlan : planList) { for (WorkPlanEntity workPlan : planList) {
if (workPlan.getEquipResourceId() != null) { if (workPlan.getEquipResourceId() != null) {
EquipResourceEntity equipResource = equipResourceService.getById(workPlan.getEquipResourceId()); EquipResourceEntity equipResource = equipResourceService.getById(workPlan.getEquipResourceId());
if(equipResource == null){
continue;
}
//判断剩余产能是否满足总产能 //判断剩余产能是否满足总产能
if (sumCapacity.compareTo(equipResource.getRestCapacity()) > 0) { if (sumCapacity.compareTo(equipResource.getRestCapacity()) > 0) {
isEnough = false; isEnough = false;
@ -1423,7 +1413,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
} }
//如果产能满足,再判断是否满足同槽条件 //如果产能满足,再判断是否满足同槽条件
if (isEnough) { if (isEnough) {
WorkOrderEntity workOrder = this.getById(woId); WorkOrderEntity workOrder = this.getById(workPlanOldList.get(0).getWoId());
YieldOrderEntity yieldOrderEntity = yieldOrderService.getById(workOrder.getYoId()); YieldOrderEntity yieldOrderEntity = yieldOrderService.getById(workOrder.getYoId());
List<YieldOrderCraftEntity> orderCraftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery() List<YieldOrderCraftEntity> orderCraftList = yieldOrderCraftService.list(Wrappers.<YieldOrderCraftEntity>lambdaQuery()
.eq(YieldOrderCraftEntity::getYoId, yieldOrderEntity.getId()) .eq(YieldOrderCraftEntity::getYoId, yieldOrderEntity.getId())
@ -1432,7 +1422,6 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
.eq(YieldOrderCraftEntity::getWorkCenterId, craft.getWorkCenterId())); .eq(YieldOrderCraftEntity::getWorkCenterId, craft.getWorkCenterId()));
SameTroughVO voNew = sameTroughService.selectSameTroughInfo(craft.getId()); SameTroughVO voNew = sameTroughService.selectSameTroughInfo(craft.getId());
SameTroughVO voOld = sameTroughService.selectSameTroughInfo(orderCraftList.get(0).getId()); SameTroughVO voOld = sameTroughService.selectSameTroughInfo(orderCraftList.get(0).getId());
if(voNew != null && voOld != null){
//根据同槽因素进行比对 //根据同槽因素进行比对
Boolean isSameTrough2 = true; Boolean isSameTrough2 = true;
//键位 //键位
@ -1495,7 +1484,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
} else { } else {
workPlan.setPlanEndTime(equipResource.getEndTime()); workPlan.setPlanEndTime(equipResource.getEndTime());
} }
workPlan.setWorkQty(0); workPlan.setWorkQty(order.getYpQty());
workPlan.setCaId(craft.getCaId()); workPlan.setCaId(craft.getCaId());
workPlan.setPpsId(craft.getPpsId()); workPlan.setPpsId(craft.getPpsId());
workPlan.setMakeTeam(equipResource.getTeamId()); workPlan.setMakeTeam(equipResource.getTeamId());
@ -1517,9 +1506,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
equipResourceService.updateById(equipResource); equipResourceService.updateById(equipResource);
isSameTrough = true; isSameTrough = true;
} }
}
}
}
} }
} }
@ -1614,7 +1602,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
personHours = calPersonHours(order,craft,part); personHours = calPersonHours(order,craft,part);
} }
workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue())); workPlan.setPlanEndTime(workPlan.getPlanEndTime().plusMinutes(personHours.longValue()));
workPlan.setWorkQty(0); workPlan.setWorkQty(order.getYpQty());
workPlan.setCaId(craft.getCaId()); workPlan.setCaId(craft.getCaId());
workPlan.setPpsId(craft.getPpsId()); workPlan.setPpsId(craft.getPpsId());
workPlan.setMakeTeam(equipResource.getTeamId()); workPlan.setMakeTeam(equipResource.getTeamId());
@ -2184,23 +2172,6 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return Math.ceil(result * order.getYpQty() + 2); return Math.ceil(result * order.getYpQty() + 2);
} }
//玻璃封接电镀上挂
public Double calPersonHoursByBlfjddsg(YieldOrderEntity order,PartEntity part){
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));
if (partCz != null && partCz.size() > 0) {
double sumOfQuota = partCz.stream()
.mapToDouble(PartEntity::getQuota) // 调用 getQuota() 方法
.sum();
result = (38 + 3 * sumOfQuota) / 60;
}
}
return Math.ceil(result * order.getYpQty() + 2);
}
public static List<YieldOrderEntity> mergeYieldOrderList(List<YieldOrderEntity> originalList) { public static List<YieldOrderEntity> mergeYieldOrderList(List<YieldOrderEntity> originalList) {
// 空值校验 // 空值校验
if (originalList == null || originalList.isEmpty()) { if (originalList == null || originalList.isEmpty()) {

Loading…
Cancel
Save