【同步】BOOT 和 CLOUD 的功能(mes)
parent
16e095c343
commit
9d2392a81a
|
|
@ -15,7 +15,17 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesCalPlanStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
*
|
||||
* 对应 MesCalPlanService#createPlan 方法
|
||||
*/
|
||||
PREPARE(0, "草稿"),
|
||||
/**
|
||||
* 已确认
|
||||
*
|
||||
* 对应 MesCalPlanService#confirmPlan 方法
|
||||
*/
|
||||
CONFIRMED(1, "已确认");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesCalPlanStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.mes.enums.cal;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
|
@ -17,14 +18,14 @@ import java.util.List;
|
|||
@AllArgsConstructor
|
||||
public enum MesCalShiftTypeEnum implements ArrayValuable<Integer> {
|
||||
|
||||
SINGLE(1, "单白班", List.of(
|
||||
SINGLE(1, "单白班", ListUtil.of(
|
||||
Pair.of("白班", new String[]{"08:00", "17:00"})
|
||||
)),
|
||||
TWO(2, "两班倒", List.of(
|
||||
TWO(2, "两班倒", ListUtil.of(
|
||||
Pair.of("白班", new String[]{"08:00", "20:00"}),
|
||||
Pair.of("夜班", new String[]{"20:00", "08:00"})
|
||||
)),
|
||||
THREE(3, "三班倒", List.of(
|
||||
THREE(3, "三班倒", ListUtil.of(
|
||||
Pair.of("白班", new String[]{"08:00", "16:00"}),
|
||||
Pair.of("中班", new String[]{"16:00", "00:00"}),
|
||||
Pair.of("夜班", new String[]{"00:00", "08:00"})
|
||||
|
|
|
|||
|
|
@ -15,7 +15,17 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesDvCheckPlanStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
*
|
||||
* 对应 MesDvCheckPlanService#createCheckPlan 方法
|
||||
*/
|
||||
PREPARE(0, "草稿"),
|
||||
/**
|
||||
* 已启用
|
||||
*
|
||||
* 对应 MesDvCheckPlanService#enableCheckPlan 方法
|
||||
*/
|
||||
ENABLED(1, "已启用");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesDvCheckPlanStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,17 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesDvCheckRecordStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
*
|
||||
* 对应 MesDvCheckRecordService#createCheckRecord 方法
|
||||
*/
|
||||
DRAFT(10, "草稿"),
|
||||
/**
|
||||
* 已完成
|
||||
*
|
||||
* 对应 MesDvCheckRecordService#submitCheckRecord 方法
|
||||
*/
|
||||
FINISHED(20, "已完成");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesDvCheckRecordStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
|
|
|||
|
|
@ -15,7 +15,17 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesDvMaintenRecordStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
*
|
||||
* 对应 MesDvMaintenRecordService#createMaintenRecord 方法
|
||||
*/
|
||||
PREPARE(1, "草稿"),
|
||||
/**
|
||||
* 已提交
|
||||
*
|
||||
* 对应 MesDvMaintenRecordService#submitMaintenRecord 方法
|
||||
*/
|
||||
SUBMITTED(2, "已提交");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesDvMaintenRecordStatusEnum::getStatus)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,17 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesProAndonStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 未处置
|
||||
*
|
||||
* 对应 MesProAndonRecordService#createAndonRecord 方法
|
||||
*/
|
||||
ACTIVE(0, "未处置"),
|
||||
/**
|
||||
* 已处置
|
||||
*
|
||||
* 对应 MesProAndonRecordService#updateAndonRecord 方法
|
||||
*/
|
||||
HANDLED(1, "已处置");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProAndonStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
|
|
|||
|
|
@ -15,9 +15,29 @@ import java.util.Arrays;
|
|||
@AllArgsConstructor
|
||||
public enum MesProWorkOrderStatusEnum implements ArrayValuable<Integer> {
|
||||
|
||||
/**
|
||||
* 草稿
|
||||
*
|
||||
* 对应 MesProWorkOrderService#createWorkOrder 方法
|
||||
*/
|
||||
PREPARE(0, "草稿"),
|
||||
/**
|
||||
* 已确认
|
||||
*
|
||||
* 对应 MesProWorkOrderService#confirmWorkOrder 方法
|
||||
*/
|
||||
CONFIRMED(1, "已确认"),
|
||||
/**
|
||||
* 已完成
|
||||
*
|
||||
* 对应 MesProWorkOrderService#finishWorkOrder 方法
|
||||
*/
|
||||
FINISHED(2, "已完成"),
|
||||
/**
|
||||
* 已取消
|
||||
*
|
||||
* 对应 MesProWorkOrderService#cancelWorkOrder 方法
|
||||
*/
|
||||
CANCELED(3, "已取消");
|
||||
|
||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesProWorkOrderStatusEnum::getStatus).toArray(Integer[]::new);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.andon;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
|
|
@ -73,7 +74,7 @@ public class MesProAndonConfigController {
|
|||
if (config == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildConfigRespVOList(List.of(config)).get(0));
|
||||
return success(buildConfigRespVOList(ListUtil.of(config)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.andon;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
|
@ -95,7 +96,7 @@ public class MesProAndonRecordController {
|
|||
if (record == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildRecordRespVOList(List.of(record)).get(0));
|
||||
return success(buildRecordRespVOList(ListUtil.of(record)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.card;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
|
@ -116,7 +117,7 @@ public class MesProCardController {
|
|||
if (card == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildCardRespVOList(List.of(card)).get(0));
|
||||
return success(buildCardRespVOList(ListUtil.of(card)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.card;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
|
|
@ -82,7 +83,7 @@ public class MesProCardProcessController {
|
|||
if (cardProcess == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildCardProcessRespVOList(List.of(cardProcess)).get(0));
|
||||
return success(buildCardProcessRespVOList(ListUtil.of(cardProcess)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.feedback;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
|
@ -111,7 +112,7 @@ public class MesProFeedbackController {
|
|||
if (feedback == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildFeedbackRespVOList(List.of(feedback)).get(0));
|
||||
return success(buildFeedbackRespVOList(ListUtil.of(feedback)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.route;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -129,7 +130,7 @@ public class MesProRouteProcessController {
|
|||
if (routeProcess == null) {
|
||||
return null;
|
||||
}
|
||||
return buildRouteProcessRespVOList(List.of(routeProcess)).get(0);
|
||||
return buildRouteProcessRespVOList(ListUtil.of(routeProcess)).get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.route;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -120,7 +121,7 @@ public class MesProRouteProductBomController {
|
|||
if (routeProductBom == null) {
|
||||
return null;
|
||||
}
|
||||
return buildRouteProductBomRespVOList(List.of(routeProductBom)).get(0);
|
||||
return buildRouteProductBomRespVOList(ListUtil.of(routeProductBom)).get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.route;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -112,7 +113,7 @@ public class MesProRouteProductController {
|
|||
if (routeProduct == null) {
|
||||
return null;
|
||||
}
|
||||
return buildRouteProductRespVOList(List.of(routeProduct)).get(0);
|
||||
return buildRouteProductRespVOList(ListUtil.of(routeProduct)).get(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
|
|
@ -110,7 +111,7 @@ public class MesProTaskController {
|
|||
if (task == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildTaskRespVOList(List.of(task)).get(0));
|
||||
return success(buildTaskRespVOList(ListUtil.of(task)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -79,7 +80,7 @@ public class MesProTaskIssueController {
|
|||
if (taskIssue == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildIssueRespVOList(List.of(taskIssue)).get(0));
|
||||
return success(buildIssueRespVOList(ListUtil.of(taskIssue)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
|
||||
|
|
@ -88,7 +89,7 @@ public class MesProWorkOrderBomController {
|
|||
if (workOrderBom == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildWorkOrderBomRespVOList(List.of(workOrderBom)).get(0));
|
||||
return success(buildWorkOrderBomRespVOList(ListUtil.of(workOrderBom)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.controller.admin.pro.workorder;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
|
@ -92,7 +93,7 @@ public class MesProWorkOrderController {
|
|||
if (workOrder == null) {
|
||||
return success(null);
|
||||
}
|
||||
return success(buildWorkOrderRespVOList(List.of(workOrder)).get(0));
|
||||
return success(buildWorkOrderRespVOList(ListUtil.of(workOrder)).get(0));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*;
|
||||
|
|
@ -49,7 +50,7 @@ public class MesDvCheckPlanMachineryServiceImpl implements MesDvCheckPlanMachine
|
|||
// 1.4 跨方案类型唯一性校验(设备不能存在于同类型多个方案中)
|
||||
List<MesDvCheckPlanMachineryDO> existingMachineryList = getCheckPlanMachineryListByMachineryId(createReqVO.getMachineryId());
|
||||
if (CollUtil.isNotEmpty(existingMachineryList)) {
|
||||
List<Long> existingPlanIds = existingMachineryList.stream().map(MesDvCheckPlanMachineryDO::getPlanId).toList();
|
||||
List<Long> existingPlanIds = existingMachineryList.stream().map(MesDvCheckPlanMachineryDO::getPlanId).collect(Collectors.toList());
|
||||
List<MesDvCheckPlanDO> existingPlans = checkPlanService.getCheckPlanList(existingPlanIds);
|
||||
for (MesDvCheckPlanDO existPlan : existingPlans) {
|
||||
// 如果存在不同于当前方案、但类型一致的计划方案,则拦截(一机多计划,但不允许同一机多同类型计划)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.mes.service.tm.tool;
|
||||
|
||||
import java.util.Collections;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -127,9 +128,9 @@ public class MesTmToolServiceImpl implements MesTmToolService {
|
|||
@Override
|
||||
public List<MesTmToolDO> getToolList(Collection<Long> ids) {
|
||||
if (ids == null || ids.isEmpty()) {
|
||||
return List.of();
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return toolMapper.selectBatchIds(ids);
|
||||
return toolMapper.selectByIds(ids);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import java.math.BigDecimal;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
|
|
@ -125,7 +126,7 @@ public class MesWmItemConsumeServiceImpl implements MesWmItemConsumeService {
|
|||
MesWmMaterialStockListReqVO stockQuery = new MesWmMaterialStockListReqVO().setItemId(line.getItemId())
|
||||
.setWarehouseId(warehouse.getId()).setLocationId(location.getId()).setAreaId(area.getId());
|
||||
List<MesWmMaterialStockDO> stocks = materialStockService.getMaterialStockList(stockQuery)
|
||||
.stream().filter(s -> s.getQuantity().compareTo(BigDecimal.ZERO) > 0).toList();
|
||||
.stream().filter(s -> s.getQuantity().compareTo(BigDecimal.ZERO) > 0).collect(Collectors.toList());
|
||||
|
||||
if (CollUtil.isEmpty(stocks)) {
|
||||
// 线边库无该物料库存 → 生成不带批次的明细
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.outsourceissue;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
|
@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -146,7 +148,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic
|
|||
allDetails, MesWmOutsourceIssueDetailDO::getLineId);
|
||||
// 检查每行的明细数量
|
||||
for (MesWmOutsourceIssueLineDO line : lines) {
|
||||
List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details,
|
||||
MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO);
|
||||
// 对比行数量与明细总数量,不满足直接抛出
|
||||
|
|
@ -219,7 +221,7 @@ public class MesWmOutsourceIssueServiceImpl implements MesWmOutsourceIssueServic
|
|||
allDetails, MesWmOutsourceIssueDetailDO::getLineId);
|
||||
// 检查每行的明细数量
|
||||
for (MesWmOutsourceIssueLineDO line : lines) {
|
||||
List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmOutsourceIssueDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details,
|
||||
MesWmOutsourceIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO);
|
||||
// 对比行数量与明细总数量
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
|
@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -165,7 +167,7 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe
|
|||
allDetails, MesWmOutsourceReceiptDetailDO::getLineId);
|
||||
// 检查每行的明细数量
|
||||
for (MesWmOutsourceReceiptLineDO line : lines) {
|
||||
List<MesWmOutsourceReceiptDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmOutsourceReceiptDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details,
|
||||
MesWmOutsourceReceiptDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO);
|
||||
// 对比行数量与明细总数量,不满足直接抛出
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.returnissue;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
|
|
@ -34,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -161,7 +163,7 @@ public class MesWmReturnIssueServiceImpl implements MesWmReturnIssueService {
|
|||
allDetails, MesWmReturnIssueDetailDO::getLineId);
|
||||
// 检查每行的明细数量
|
||||
for (MesWmReturnIssueLineDO line : lines) {
|
||||
List<MesWmReturnIssueDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmReturnIssueDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details,
|
||||
MesWmReturnIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO);
|
||||
// 对比行数量与明细总数量,不满足直接抛出
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.returnsales;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
|
|
@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -163,7 +165,7 @@ public class MesWmReturnSalesServiceImpl implements MesWmReturnSalesService {
|
|||
allDetails, MesWmReturnSalesDetailDO::getLineId);
|
||||
// 检查每行的明细数量
|
||||
for (MesWmReturnSalesLineDO line : lines) {
|
||||
List<MesWmReturnSalesDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmReturnSalesDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
BigDecimal totalDetailQuantity = CollectionUtils.getSumValue(details,
|
||||
MesWmReturnSalesDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO);
|
||||
// 对比行数量与明细总数量,不满足直接抛出
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.transfer;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
|
@ -22,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -186,7 +188,7 @@ public class MesWmTransferServiceImpl implements MesWmTransferService {
|
|||
allDetails, MesWmTransferDetailDO::getLineId);
|
||||
// 2. 遍历行和对应的明细,创建事务
|
||||
for (MesWmTransferLineDO line : lines) {
|
||||
List<MesWmTransferDetailDO> details = detailMap.getOrDefault(line.getId(), List.of());
|
||||
List<MesWmTransferDetailDO> details = detailMap.getOrDefault(line.getId(), Collections.emptyList());
|
||||
for (MesWmTransferDetailDO detail : details) {
|
||||
// 2.1 先执行出库:调拨移出(从源仓库扣减库存),出库数量基于当前明细的数量
|
||||
Long outTransactionId = wmTransactionService.createTransaction(new MesWmTransactionSaveReqDTO()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package cn.iocoder.yudao.module.mes.service.pro.feedback;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO;
|
||||
import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO;
|
||||
|
|
@ -19,11 +20,11 @@ import org.springframework.context.annotation.Import;
|
|||
import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
|
|
@ -78,7 +79,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest {
|
|||
.qualityStatus(MesWmQualityStatusEnum.FAIL.getStatus())
|
||||
.build();
|
||||
when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId()))
|
||||
.thenReturn(List.of(qualifiedLine, unqualifiedLine));
|
||||
.thenReturn(ListUtil.of(qualifiedLine, unqualifiedLine));
|
||||
|
||||
// 调用
|
||||
BigDecimal qualifiedQty = BigDecimal.valueOf(80);
|
||||
|
|
@ -133,7 +134,7 @@ public class MesProFeedbackServiceImplTest extends BaseDbUnitTest {
|
|||
.qualityStatus(MesWmQualityStatusEnum.PASS.getStatus())
|
||||
.build();
|
||||
when(produceLineService.getProductProduceLineListByFeedbackId(feedback.getId()))
|
||||
.thenReturn(List.of(qualifiedLine));
|
||||
.thenReturn(ListUtil.of(qualifiedLine));
|
||||
|
||||
// 调用
|
||||
feedbackService.updateProFeedbackWhenIpqcFinish(feedback.getId(),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
package cn.iocoder.yudao.module.mes.service.wm.itemconsume;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.mes.controller.admin.wm.materialstock.vo.MesWmMaterialStockListReqVO;
|
||||
|
|
@ -43,9 +45,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId
|
|||
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_FEEDBACK_ROUTE_PROCESS_INVALID;
|
||||
import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_ROUTE_NOT_EXISTS;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.argThat;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
|
|
@ -181,7 +181,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
bom.setItemId(bomItemId);
|
||||
bom.setQuantity(new BigDecimal("2")); // 用料比例 = 2
|
||||
when(routeProductBomService.getRouteProductBomList(any(), any(), any()))
|
||||
.thenReturn(List.of(bom));
|
||||
.thenReturn(ListUtil.of(bom));
|
||||
when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class)))
|
||||
.thenReturn(Collections.emptyList());
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
bom.setItemId(bomItemId);
|
||||
bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30
|
||||
when(routeProductBomService.getRouteProductBomList(any(), any(), any()))
|
||||
.thenReturn(List.of(bom));
|
||||
.thenReturn(ListUtil.of(bom));
|
||||
|
||||
Long stockId = randomLongId();
|
||||
Long batchId = randomLongId();
|
||||
|
|
@ -240,7 +240,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
stock.setBatchId(batchId);
|
||||
stock.setBatchCode("BATCH-001");
|
||||
when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class)))
|
||||
.thenReturn(List.of(stock));
|
||||
.thenReturn(ListUtil.of(stock));
|
||||
|
||||
// 调用
|
||||
MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback);
|
||||
|
|
@ -268,7 +268,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
bom.setItemId(bomItemId);
|
||||
bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30
|
||||
when(routeProductBomService.getRouteProductBomList(any(), any(), any()))
|
||||
.thenReturn(List.of(bom));
|
||||
.thenReturn(ListUtil.of(bom));
|
||||
|
||||
Long stockId1 = randomLongId();
|
||||
Long stockId2 = randomLongId();
|
||||
|
|
@ -321,7 +321,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
bom.setItemId(bomItemId);
|
||||
bom.setQuantity(new BigDecimal("3")); // 消耗 = 3 × 10 = 30
|
||||
when(routeProductBomService.getRouteProductBomList(any(), any(), any()))
|
||||
.thenReturn(List.of(bom));
|
||||
.thenReturn(ListUtil.of(bom));
|
||||
|
||||
Long stockId = randomLongId();
|
||||
MesWmMaterialStockDO stock = new MesWmMaterialStockDO();
|
||||
|
|
@ -331,7 +331,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
stock.setBatchId(1L);
|
||||
stock.setBatchCode("BATCH-001");
|
||||
when(materialStockService.getMaterialStockList(any(MesWmMaterialStockListReqVO.class)))
|
||||
.thenReturn(List.of(stock));
|
||||
.thenReturn(ListUtil.of(stock));
|
||||
|
||||
// 调用
|
||||
MesWmItemConsumeDO result = itemConsumeService.generateItemConsume(feedback);
|
||||
|
|
@ -383,7 +383,7 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
|
||||
when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) ->
|
||||
req != null && itemA.equals(req.getItemId()))))
|
||||
.thenReturn(List.of(stockA));
|
||||
.thenReturn(ListUtil.of(stockA));
|
||||
when(materialStockService.getMaterialStockList(argThat((MesWmMaterialStockListReqVO req) ->
|
||||
req != null && itemB.equals(req.getItemId()))))
|
||||
.thenReturn(Collections.emptyList());
|
||||
|
|
@ -406,15 +406,15 @@ public class MesWmItemConsumeServiceImplTest extends BaseDbUnitTest {
|
|||
assertEquals(2, details.size());
|
||||
|
||||
// 物料 A:有批次
|
||||
MesWmItemConsumeDetailDO detailA = details.stream()
|
||||
.filter(d -> itemA.equals(d.getItemId())).findFirst().orElseThrow();
|
||||
MesWmItemConsumeDetailDO detailA = CollUtil.findOne(details,
|
||||
d -> itemA.equals(d.getItemId()));
|
||||
assertEquals(0, new BigDecimal("10").compareTo(detailA.getQuantity()));
|
||||
assertNotNull(detailA.getMaterialStockId());
|
||||
assertEquals("BATCH-A", detailA.getBatchCode());
|
||||
|
||||
// 物料 B:无批次
|
||||
MesWmItemConsumeDetailDO detailB = details.stream()
|
||||
.filter(d -> itemB.equals(d.getItemId())).findFirst().orElseThrow();
|
||||
MesWmItemConsumeDetailDO detailB = CollUtil.findOne(details,
|
||||
d -> itemB.equals(d.getItemId()));
|
||||
assertEquals(0, new BigDecimal("20").compareTo(detailB.getQuantity()));
|
||||
assertNull(detailB.getMaterialStockId());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
|||
import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
|
@ -100,7 +101,7 @@ public class MesWmReturnIssueLineServiceImplTest extends BaseDbUnitTest {
|
|||
assertEquals(0, qualifiedQty.compareTo(originalLine.getQuantity()));
|
||||
|
||||
// 断言:新增了一行不合格品
|
||||
var allLines = returnIssueLineMapper.selectListByIssueId(lineDO.getIssueId());
|
||||
List<MesWmReturnIssueLineDO> allLines = returnIssueLineMapper.selectListByIssueId(lineDO.getIssueId());
|
||||
assertEquals(2, allLines.size());
|
||||
MesWmReturnIssueLineDO newLine = allLines.stream()
|
||||
.filter(l -> !l.getId().equals(lineDO.getId()))
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import org.springframework.test.context.bean.override.mockito.MockitoBean;
|
|||
import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
|
@ -100,7 +101,7 @@ public class MesWmReturnSalesLineServiceImplTest extends BaseDbUnitTest {
|
|||
assertEquals(0, qualifiedQty.compareTo(originalLine.getQuantity()));
|
||||
|
||||
// 断言:新增了一行不合格品
|
||||
var allLines = returnSalesLineMapper.selectListByReturnId(lineDO.getReturnId());
|
||||
List<MesWmReturnSalesLineDO> allLines = returnSalesLineMapper.selectListByReturnId(lineDO.getReturnId());
|
||||
assertEquals(2, allLines.size());
|
||||
MesWmReturnSalesLineDO newLine = allLines.stream()
|
||||
.filter(l -> !l.getId().equals(lineDO.getId()))
|
||||
|
|
|
|||
Loading…
Reference in New Issue