diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsCraftAbilityEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsCraftAbilityEntity.java index 1c84e82af..1d6909e02 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsCraftAbilityEntity.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsCraftAbilityEntity.java @@ -1,31 +1,5 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ package org.springblade.desk.dashboard.pojo.entity; -import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonInclude; import io.swagger.v3.oas.annotations.media.Schema; @@ -35,7 +9,6 @@ import org.springblade.core.mp.base.BaseEntity; import java.io.Serial; import java.math.BigDecimal; -import java.util.List; /** * 工艺能力表 实体类 diff --git a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsProcessSetEntity.java b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsProcessSetEntity.java index 324b3b005..e2a2560a2 100644 --- a/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsProcessSetEntity.java +++ b/blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/dashboard/pojo/entity/BsProcessSetEntity.java @@ -1,28 +1,3 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ package org.springblade.desk.dashboard.pojo.entity; import lombok.Data; @@ -76,9 +51,9 @@ public class BsProcessSetEntity extends BaseEntity { @Schema(description = "特殊") private String isSpecial; /** - * 是否分派 + * 是否不分派 */ - @Schema(description = "不分派") + @Schema(description = "是否不分派") private String isDispatch; /** * 备注 diff --git a/blade-service-api/blade-scheduling-api/src/main/java/org/springblade/scheduling/pojo/entity/ProcessSetEntity.java b/blade-service-api/blade-scheduling-api/src/main/java/org/springblade/scheduling/pojo/entity/ProcessSetEntity.java index 8d04926a7..f926676c8 100644 --- a/blade-service-api/blade-scheduling-api/src/main/java/org/springblade/scheduling/pojo/entity/ProcessSetEntity.java +++ b/blade-service-api/blade-scheduling-api/src/main/java/org/springblade/scheduling/pojo/entity/ProcessSetEntity.java @@ -1,28 +1,3 @@ -/** - * BladeX Commercial License Agreement - * Copyright (c) 2018-2099, https://bladex.cn. All rights reserved. - *

- * Use of this software is governed by the Commercial License Agreement - * obtained after purchasing a license from BladeX. - *

- * 1. This software is for development use only under a valid license - * from BladeX. - *

- * 2. Redistribution of this software's source code to any third party - * without a commercial license is strictly prohibited. - *

- * 3. Licensees may copyright their own code but cannot use segments - * from this software for such purposes. Copyright of this software - * remains with BladeX. - *

- * Using this software signifies agreement to this License, and the software - * must not be used for illegal purposes. - *

- * THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is - * not liable for any claims arising from secondary or illegal development. - *

- * Author: Chill Zhuang (bladejava@qq.com) - */ package org.springblade.scheduling.pojo.entity; import lombok.Data; @@ -97,9 +72,9 @@ public class ProcessSetEntity extends BaseEntity { @Schema(description = "是否特殊") private String isSpecial; /** - * 是否分派 + * 是否不分派 */ - @Schema(description = "是否分派") + @Schema(description = "是否不分派") private String isDispatch; /** * 备注 diff --git a/blade-service/blade-desk/src/main/java/org/springblade/desk/order/service/impl/YieldOrderServiceImpl.java b/blade-service/blade-desk/src/main/java/org/springblade/desk/order/service/impl/YieldOrderServiceImpl.java index 732151534..8e6b43858 100644 --- a/blade-service/blade-desk/src/main/java/org/springblade/desk/order/service/impl/YieldOrderServiceImpl.java +++ b/blade-service/blade-desk/src/main/java/org/springblade/desk/order/service/impl/YieldOrderServiceImpl.java @@ -1,6 +1,5 @@ package org.springblade.desk.order.service.impl; -import cn.hutool.core.collection.CollUtil; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; @@ -10,10 +9,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.ehcache.core.util.CollectionUtil; import org.springblade.common.constant.CommonConstant; import org.springblade.common.exception.BusinessException; import org.springblade.common.utils.StringPrefixUtils; @@ -60,11 +57,9 @@ import org.springblade.desk.produce.pojo.entity.WorkOrder; import org.springblade.desk.produce.pojo.vo.SjCompleteVO; import org.springblade.erpdata.feign.IErpMesRbWoClient; import org.springblade.erpdata.feign.IErpYieldOrderClient; -import org.springblade.scheduling.pojo.entity.PartRelationEntity; import org.springblade.scheduling.pojo.entity.QualityGradeEntity; import org.springblade.system.feign.IUserClient; import org.springblade.system.pojo.entity.User; -import org.springblade.system.pojo.entity.UserInfo; import org.springblade.wms.feign.WmsTaskClient; import org.springblade.wms.pojo.dto.StGraphiteMoldOutDTO; import org.springblade.wms.pojo.entity.StGraphiteMoldOut; @@ -102,8 +97,8 @@ public class YieldOrderServiceImpl extends BaseServiceImpl craftList = yieldOrderCraftService.listByYoId(yieldOrder.getId()); try { - yieldOrderCraftService.automaticDispatch(craftList, yieldOrder, null, null); + // 获取所有工序基础信息 + List ppsIdSet = craftList.stream().map(YieldOrderCraft::getPpsId).filter(Objects::nonNull).toList(); + List processSetList = processSetService.listByIds(ppsIdSet); + Map processSetMap = processSetList.stream().collect(Collectors.toMap(BsProcessSetEntity::getId, process -> process)); + // 区分是否需要分派工序 + List dispatch = new ArrayList<>(); + List noDispatch = new ArrayList<>(); + craftList.forEach(craft -> { + BsProcessSetEntity processSet = processSetMap.get(craft.getPpsId()); + if (processSet != null && "0".equals(processSet.getIsDispatch())) { + dispatch.add(craft); + } else { + noDispatch.add(craft); + } + }); + // 按照工艺能力分组 + Map> dispatchMap = dispatch.stream().collect(Collectors.groupingBy(YieldOrderCraft::getCaId)); + // 将需要分派的工序全部分派作业中心或外协商,按照工艺能力循环处理 + for (Map.Entry> entry : dispatchMap.entrySet()) { + yieldOrderCraftService.automaticDispatch(entry.getValue(), yieldOrder, null, null); + } + // 处理不参与分派的工序(设置为不分派的工序) + this.handleNoAutomaticWorkPlan(noDispatch, yieldOrder); } catch (Exception e) { yieldOrder.setValidationResult(YieldOrderEnum.VALIDATION_RESULT_LESS_RESOURCE.getCode()); yieldOrder.setValidationTime(DateUtil.now()); @@ -987,6 +1004,23 @@ public class YieldOrderServiceImpl extends BaseServiceImpl noDispatch, YieldOrder yieldOrder) { + if (CollectionUtils.isEmpty(noDispatch)) { + return; + } + WorkCenter workCenter; + for (YieldOrderCraft dispatch : noDispatch) { + // 根据工艺能力ID查询作业中心,获取第一个作业中心 + workCenter = workCenterService.getOne(Wrappers.lambdaQuery(WorkCenter.class) + .apply("INSTR(',' || CRAFT_ABILITY_ID || ',', ',' || {0} || ',') > 0", dispatch.getCaId()), false); + if (workCenter != null) { + dispatch.setWorkCenterId(workCenter.getId()); + dispatch.setIsOutsource(Boolean.FALSE); + } + } + yieldOrderCraftService.saveOrUpdateBatch(noDispatch); + } + @Override public Boolean verifyYieldOrderDelivery(YieldOrder yieldOrder) { // 根据工艺, 计算订单的额定加工时长