Commit f709822c2f21e2e5569ebc96361812d759e5f987

Authored by YunaiV
1 parent 89ae4e1c

♻️ refactor(mes): 移除流转卡相关的状态和时间字段,简化请求和响应对象

yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/vo/MesProCardPageReqVO.java
@@ -5,11 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; @@ -5,11 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
5 import lombok.Data; 5 import lombok.Data;
6 import lombok.EqualsAndHashCode; 6 import lombok.EqualsAndHashCode;
7 import lombok.ToString; 7 import lombok.ToString;
8 -import org.springframework.format.annotation.DateTimeFormat;  
9 -  
10 -import java.time.LocalDateTime;  
11 -  
12 -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;  
13 8
14 @Schema(description = "管理后台 - MES 生产流转卡分页 Request VO") 9 @Schema(description = "管理后台 - MES 生产流转卡分页 Request VO")
15 @Data 10 @Data
@@ -29,11 +24,5 @@ public class MesProCardPageReqVO extends PageParam { @@ -29,11 +24,5 @@ public class MesProCardPageReqVO extends PageParam {
29 @Schema(description = "批次号", example = "BATCH-001") 24 @Schema(description = "批次号", example = "BATCH-001")
30 private String batchCode; 25 private String batchCode;
31 26
32 - @Schema(description = "状态", example = "0")  
33 - private Integer status;  
34 -  
35 - @Schema(description = "创建时间")  
36 - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)  
37 - private LocalDateTime[] createTime;  
38 27
39 } 28 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/vo/MesProCardRespVO.java
1 package cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo; 1 package cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo;
2 2
3 -import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;  
4 -import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;  
5 -import cn.iocoder.yudao.module.mes.enums.DictTypeConstants;  
6 import cn.idev.excel.annotation.ExcelIgnoreUnannotated; 3 import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
7 import cn.idev.excel.annotation.ExcelProperty; 4 import cn.idev.excel.annotation.ExcelProperty;
8 import io.swagger.v3.oas.annotations.media.Schema; 5 import io.swagger.v3.oas.annotations.media.Schema;
@@ -61,18 +58,10 @@ public class MesProCardRespVO { @@ -61,18 +58,10 @@ public class MesProCardRespVO {
61 @ExcelProperty("单位") 58 @ExcelProperty("单位")
62 private String unitMeasureName; 59 private String unitMeasureName;
63 60
64 - @Schema(description = "条码地址", example = "https://xxx")  
65 - private String barcodeUrl;  
66 -  
67 @Schema(description = "流转数量", example = "100.00") 61 @Schema(description = "流转数量", example = "100.00")
68 @ExcelProperty("流转数量") 62 @ExcelProperty("流转数量")
69 private BigDecimal transferedQuantity; 63 private BigDecimal transferedQuantity;
70 64
71 - @Schema(description = "状态", example = "0")  
72 - @ExcelProperty(value = "状态", converter = DictConvert.class)  
73 - @DictFormat(DictTypeConstants.MES_PRO_WORK_ORDER_STATUS)  
74 - private Integer status;  
75 -  
76 @Schema(description = "备注", example = "备注") 65 @Schema(description = "备注", example = "备注")
77 @ExcelProperty("备注") 66 @ExcelProperty("备注")
78 private String remark; 67 private String remark;
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/pro/card/vo/MesProCardSaveReqVO.java
@@ -33,10 +33,7 @@ public class MesProCardSaveReqVO { @@ -33,10 +33,7 @@ public class MesProCardSaveReqVO {
33 @NotNull(message = "流转数量不能为空") 33 @NotNull(message = "流转数量不能为空")
34 private BigDecimal transferedQuantity; 34 private BigDecimal transferedQuantity;
35 35
36 - @Schema(description = "状态", example = "0")  
37 - private Integer status;  
38 -  
39 @Schema(description = "备注", example = "备注") 36 @Schema(description = "备注", example = "备注")
40 private String remark; 37 private String remark;
41 38
42 - } 39 +}
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/pro/card/MesProCardDO.java
@@ -41,25 +41,20 @@ public class MesProCardDO extends BaseDO { @@ -41,25 +41,20 @@ public class MesProCardDO extends BaseDO {
41 */ 41 */
42 private Long workOrderId; 42 private Long workOrderId;
43 /** 43 /**
44 - * 批次号  
45 - */  
46 - private String batchCode;  
47 - /**  
48 * 产品物料编号 44 * 产品物料编号
49 * 45 *
50 * 关联 {@link MesMdItemDO#getId()} 46 * 关联 {@link MesMdItemDO#getId()}
51 */ 47 */
52 private Long itemId; 48 private Long itemId;
53 /** 49 /**
54 - * 条码地址  
55 - *  
56 - * TODO @芋艿:条码生成功能,需等条码模块(wm_barcode)迁移后再对接 50 + * 批次号
57 */ 51 */
58 - private String barcodeUrl; 52 + private String batchCode;
59 /** 53 /**
60 * 流转数量 54 * 流转数量
61 */ 55 */
62 private BigDecimal transferedQuantity; 56 private BigDecimal transferedQuantity;
  57 + // TODO @芋艿:预留字段,暂未使用;
63 /** 58 /**
64 * 状态 59 * 状态
65 * 60 *
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/pro/card/MesProCardMapper.java
@@ -21,8 +21,6 @@ public interface MesProCardMapper extends BaseMapperX<MesProCardDO> { @@ -21,8 +21,6 @@ public interface MesProCardMapper extends BaseMapperX<MesProCardDO> {
21 .eqIfPresent(MesProCardDO::getWorkOrderId, reqVO.getWorkOrderId()) 21 .eqIfPresent(MesProCardDO::getWorkOrderId, reqVO.getWorkOrderId())
22 .eqIfPresent(MesProCardDO::getItemId, reqVO.getItemId()) 22 .eqIfPresent(MesProCardDO::getItemId, reqVO.getItemId())
23 .likeIfPresent(MesProCardDO::getBatchCode, reqVO.getBatchCode()) 23 .likeIfPresent(MesProCardDO::getBatchCode, reqVO.getBatchCode())
24 - .eqIfPresent(MesProCardDO::getStatus, reqVO.getStatus())  
25 - .betweenIfPresent(MesProCardDO::getCreateTime, reqVO.getCreateTime())  
26 .orderByDesc(MesProCardDO::getId)); 24 .orderByDesc(MesProCardDO::getId));
27 } 25 }
28 26
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardProcessService.java
@@ -51,4 +51,11 @@ public interface MesProCardProcessService { @@ -51,4 +51,11 @@ public interface MesProCardProcessService {
51 */ 51 */
52 PageResult<MesProCardProcessDO> getCardProcessPage(MesProCardProcessPageReqVO pageReqVO); 52 PageResult<MesProCardProcessDO> getCardProcessPage(MesProCardProcessPageReqVO pageReqVO);
53 53
  54 + /**
  55 + * 根据流转卡编号,删除工序记录
  56 + *
  57 + * @param cardId 流转卡编号
  58 + */
  59 + void deleteCardProcessByCardId(Long cardId);
  60 +
54 } 61 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardProcessServiceImpl.java
@@ -80,4 +80,9 @@ public class MesProCardProcessServiceImpl implements MesProCardProcessService { @@ -80,4 +80,9 @@ public class MesProCardProcessServiceImpl implements MesProCardProcessService {
80 } 80 }
81 } 81 }
82 82
  83 + @Override
  84 + public void deleteCardProcessByCardId(Long cardId) {
  85 + cardProcessMapper.deleteByCardId(cardId);
  86 + }
  87 +
83 } 88 }
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardServiceImpl.java
@@ -7,17 +7,18 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardPageRe @@ -7,17 +7,18 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardPageRe
7 import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveReqVO; 7 import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveReqVO;
8 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.card.MesProCardDO; 8 import cn.iocoder.yudao.module.mes.dal.dataobject.pro.card.MesProCardDO;
9 import cn.iocoder.yudao.module.mes.dal.mysql.pro.card.MesProCardMapper; 9 import cn.iocoder.yudao.module.mes.dal.mysql.pro.card.MesProCardMapper;
10 -import cn.iocoder.yudao.module.mes.dal.mysql.pro.card.MesProCardProcessMapper;  
11 import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; 10 import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum;
12 import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; 11 import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService;
13 import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; 12 import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService;
14 import jakarta.annotation.Resource; 13 import jakarta.annotation.Resource;
  14 +import org.springframework.context.annotation.Lazy;
15 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
16 import org.springframework.transaction.annotation.Transactional; 16 import org.springframework.transaction.annotation.Transactional;
17 import org.springframework.validation.annotation.Validated; 17 import org.springframework.validation.annotation.Validated;
18 18
19 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 19 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
20 -import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; 20 +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_CARD_CODE_DUPLICATE;
  21 +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.PRO_CARD_NOT_EXISTS;
21 22
22 /** 23 /**
23 * MES 生产流转卡 Service 实现类 24 * MES 生产流转卡 Service 实现类
@@ -31,12 +32,13 @@ public class MesProCardServiceImpl implements MesProCardService { @@ -31,12 +32,13 @@ public class MesProCardServiceImpl implements MesProCardService {
31 @Resource 32 @Resource
32 private MesProCardMapper cardMapper; 33 private MesProCardMapper cardMapper;
33 34
  35 + // DONE @AI:会用对应的 service
34 @Resource 36 @Resource
35 - private MesProCardProcessMapper cardProcessMapper; 37 + @Lazy
  38 + private MesProCardProcessService cardProcessService;
36 39
37 @Resource 40 @Resource
38 private MesProWorkOrderService workOrderService; 41 private MesProWorkOrderService workOrderService;
39 -  
40 @Resource 42 @Resource
41 private MesWmBarcodeService barcodeService; 43 private MesWmBarcodeService barcodeService;
42 44
@@ -77,7 +79,7 @@ public class MesProCardServiceImpl implements MesProCardService { @@ -77,7 +79,7 @@ public class MesProCardServiceImpl implements MesProCardService {
77 79
78 // 2. 删除流转卡 + 级联删除工序记录 80 // 2. 删除流转卡 + 级联删除工序记录
79 cardMapper.deleteById(id); 81 cardMapper.deleteById(id);
80 - cardProcessMapper.deleteByCardId(id); 82 + cardProcessService.deleteCardProcessByCardId(id);
81 } 83 }
82 84
83 @Override 85 @Override