Commit c600dfa58d08ad275aa9af765a47cf0a4b4243b6
1 parent
1ebc0a08
✨ feat(mes): 新增客户和供应商信息字段
Showing
5 changed files
with
80 additions
and
3 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/client/vo/MesMdClientImportExcelVO.java
| @@ -37,6 +37,39 @@ public class MesMdClientImportExcelVO { | @@ -37,6 +37,39 @@ public class MesMdClientImportExcelVO { | ||
| 37 | @ExcelProperty("客户邮箱地址") | 37 | @ExcelProperty("客户邮箱地址") |
| 38 | private String email; | 38 | private String email; |
| 39 | 39 | ||
| 40 | + @ExcelProperty("客户英文名称") | ||
| 41 | + private String englishName; | ||
| 42 | + | ||
| 43 | + @ExcelProperty("客户简介") | ||
| 44 | + private String description; | ||
| 45 | + | ||
| 46 | + @ExcelProperty("客户地址") | ||
| 47 | + private String address; | ||
| 48 | + | ||
| 49 | + @ExcelProperty("客户官网地址") | ||
| 50 | + private String website; | ||
| 51 | + | ||
| 52 | + @ExcelProperty("联系人1") | ||
| 53 | + private String contact1Name; | ||
| 54 | + | ||
| 55 | + @ExcelProperty("联系人1-电话") | ||
| 56 | + private String contact1Telephone; | ||
| 57 | + | ||
| 58 | + @ExcelProperty("联系人1-邮箱") | ||
| 59 | + private String contact1Email; | ||
| 60 | + | ||
| 61 | + @ExcelProperty("联系人2") | ||
| 62 | + private String contact2Name; | ||
| 63 | + | ||
| 64 | + @ExcelProperty("联系人2-电话") | ||
| 65 | + private String contact2Telephone; | ||
| 66 | + | ||
| 67 | + @ExcelProperty("联系人2-邮箱") | ||
| 68 | + private String contact2Email; | ||
| 69 | + | ||
| 70 | + @ExcelProperty("统一社会信用代码") | ||
| 71 | + private String creditCode; | ||
| 72 | + | ||
| 40 | @ExcelProperty(value = "状态", converter = DictConvert.class) | 73 | @ExcelProperty(value = "状态", converter = DictConvert.class) |
| 41 | @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.COMMON_STATUS) | 74 | @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.COMMON_STATUS) |
| 42 | private Integer status; | 75 | private Integer status; |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/vendor/vo/MesMdVendorImportExcelVO.java
| @@ -37,6 +37,39 @@ public class MesMdVendorImportExcelVO { | @@ -37,6 +37,39 @@ public class MesMdVendorImportExcelVO { | ||
| 37 | @ExcelProperty("供应商邮箱地址") | 37 | @ExcelProperty("供应商邮箱地址") |
| 38 | private String email; | 38 | private String email; |
| 39 | 39 | ||
| 40 | + @ExcelProperty("供应商英文名称") | ||
| 41 | + private String englishName; | ||
| 42 | + | ||
| 43 | + @ExcelProperty("供应商简介") | ||
| 44 | + private String description; | ||
| 45 | + | ||
| 46 | + @ExcelProperty("供应商地址") | ||
| 47 | + private String address; | ||
| 48 | + | ||
| 49 | + @ExcelProperty("供应商官网地址") | ||
| 50 | + private String website; | ||
| 51 | + | ||
| 52 | + @ExcelProperty("联系人1") | ||
| 53 | + private String contact1Name; | ||
| 54 | + | ||
| 55 | + @ExcelProperty("联系人1-电话") | ||
| 56 | + private String contact1Telephone; | ||
| 57 | + | ||
| 58 | + @ExcelProperty("联系人1-邮箱") | ||
| 59 | + private String contact1Email; | ||
| 60 | + | ||
| 61 | + @ExcelProperty("联系人2") | ||
| 62 | + private String contact2Name; | ||
| 63 | + | ||
| 64 | + @ExcelProperty("联系人2-电话") | ||
| 65 | + private String contact2Telephone; | ||
| 66 | + | ||
| 67 | + @ExcelProperty("联系人2-邮箱") | ||
| 68 | + private String contact2Email; | ||
| 69 | + | ||
| 70 | + @ExcelProperty("统一社会信用代码") | ||
| 71 | + private String creditCode; | ||
| 72 | + | ||
| 40 | @ExcelProperty(value = "状态", converter = DictConvert.class) | 73 | @ExcelProperty(value = "状态", converter = DictConvert.class) |
| 41 | @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.COMMON_STATUS) | 74 | @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.COMMON_STATUS) |
| 42 | private Integer status; | 75 | private Integer status; |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
| @@ -18,6 +18,7 @@ public interface ErrorCodeConstants { | @@ -18,6 +18,7 @@ public interface ErrorCodeConstants { | ||
| 18 | ErrorCode MD_ITEM_TYPE_CODE_DUPLICATE = new ErrorCode(1_040_100_005, "同一父分类下已存在该编码的分类"); | 18 | ErrorCode MD_ITEM_TYPE_CODE_DUPLICATE = new ErrorCode(1_040_100_005, "同一父分类下已存在该编码的分类"); |
| 19 | ErrorCode MD_ITEM_TYPE_PARENT_IS_CHILD = new ErrorCode(1_040_100_006, "不能设置自己的子分类为父分类"); | 19 | ErrorCode MD_ITEM_TYPE_PARENT_IS_CHILD = new ErrorCode(1_040_100_006, "不能设置自己的子分类为父分类"); |
| 20 | ErrorCode MD_ITEM_TYPE_EXITS_ITEM = new ErrorCode(1_040_100_007, "该分类下存在物料,无法删除"); | 20 | ErrorCode MD_ITEM_TYPE_EXITS_ITEM = new ErrorCode(1_040_100_007, "该分类下存在物料,无法删除"); |
| 21 | + ErrorCode MD_ITEM_TYPE_NOT_LEAF = new ErrorCode(1_040_100_008, "只能将物料挂载到叶子分类(该分类下存在子分类)"); | ||
| 21 | 22 | ||
| 22 | // ========== MES 基础数据-计量单位(1-040-101-000) ========== | 23 | // ========== MES 基础数据-计量单位(1-040-101-000) ========== |
| 23 | ErrorCode MD_UNIT_MEASURE_NOT_EXISTS = new ErrorCode(1_040_101_000, "计量单位不存在"); | 24 | ErrorCode MD_UNIT_MEASURE_NOT_EXISTS = new ErrorCode(1_040_101_000, "计量单位不存在"); |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/md/autocode/MesMdAutoCodeRuleCodeEnum.java
| @@ -12,6 +12,7 @@ import lombok.Getter; | @@ -12,6 +12,7 @@ import lombok.Getter; | ||
| 12 | @AllArgsConstructor | 12 | @AllArgsConstructor |
| 13 | public enum MesMdAutoCodeRuleCodeEnum { | 13 | public enum MesMdAutoCodeRuleCodeEnum { |
| 14 | 14 | ||
| 15 | + MD_ITEM_TYPE_CODE("MD_ITEM_TYPE_CODE", "物料分类编码"), | ||
| 15 | MD_ITEM_CODE("MD_ITEM_CODE", "物料编码"), | 16 | MD_ITEM_CODE("MD_ITEM_CODE", "物料编码"), |
| 16 | MD_VENDOR_CODE("MD_VENDOR_CODE", "供应商编码"), | 17 | MD_VENDOR_CODE("MD_VENDOR_CODE", "供应商编码"), |
| 17 | MD_CLIENT_CODE("MD_CLIENT_CODE", "客户编码"), | 18 | MD_CLIENT_CODE("MD_CLIENT_CODE", "客户编码"), |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemServiceImpl.java
| @@ -17,8 +17,10 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; | @@ -17,8 +17,10 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; | ||
| 17 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | 17 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| 18 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; | 18 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; |
| 19 | import cn.iocoder.yudao.module.mes.enums.md.MesMdItemTypeEnum; | 19 | import cn.iocoder.yudao.module.mes.enums.md.MesMdItemTypeEnum; |
| 20 | +import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; | ||
| 20 | import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | 21 | import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; |
| 21 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; | 22 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| 23 | +import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; | ||
| 22 | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | 24 | import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; |
| 23 | import jakarta.annotation.Resource; | 25 | import jakarta.annotation.Resource; |
| 24 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
| @@ -59,6 +61,8 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -59,6 +61,8 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 59 | private MesMdProductSipService productSipService; | 61 | private MesMdProductSipService productSipService; |
| 60 | @Resource | 62 | @Resource |
| 61 | private MesWmBarcodeService barcodeService; | 63 | private MesWmBarcodeService barcodeService; |
| 64 | + @Resource | ||
| 65 | + private MesMdAutoCodeRecordService autoCodeRecordService; | ||
| 62 | 66 | ||
| 63 | @Override | 67 | @Override |
| 64 | public Long createItem(MesMdItemSaveReqVO createReqVO) { | 68 | public Long createItem(MesMdItemSaveReqVO createReqVO) { |
| @@ -183,6 +187,11 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -183,6 +187,11 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 183 | if (itemTypeService.getItemType(itemTypeId) == null) { | 187 | if (itemTypeService.getItemType(itemTypeId) == null) { |
| 184 | throw exception(MD_ITEM_TYPE_NOT_EXISTS); | 188 | throw exception(MD_ITEM_TYPE_NOT_EXISTS); |
| 185 | } | 189 | } |
| 190 | + // 校验必须是叶子分类(没有子分类) | ||
| 191 | + List<MesMdItemTypeDO> children = itemTypeService.getItemTypeChildrenList(itemTypeId); | ||
| 192 | + if (CollUtil.isNotEmpty(children)) { | ||
| 193 | + throw exception(MD_ITEM_TYPE_NOT_LEAF); | ||
| 194 | + } | ||
| 186 | } | 195 | } |
| 187 | 196 | ||
| 188 | private void validateUnitMeasureExists(Long unitMeasureId) { | 197 | private void validateUnitMeasureExists(Long unitMeasureId) { |
| @@ -276,11 +285,11 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -276,11 +285,11 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 276 | importItems.forEach(importItem -> { | 285 | importItems.forEach(importItem -> { |
| 277 | int currentIndex = index.getAndIncrement(); | 286 | int currentIndex = index.getAndIncrement(); |
| 278 | // 2.1 校验字段 | 287 | // 2.1 校验字段 |
| 279 | - String key = StrUtil.blankToDefault(importItem.getCode(), "第 " + currentIndex + " 行"); | ||
| 280 | if (StrUtil.isBlank(importItem.getCode())) { | 288 | if (StrUtil.isBlank(importItem.getCode())) { |
| 281 | - respVO.getFailureCodes().put(key, "物料编码不能为空"); | ||
| 282 | - return; | 289 | + // 空编码时自动生成 |
| 290 | + importItem.setCode(autoCodeRecordService.generateAutoCode(MesMdAutoCodeRuleCodeEnum.MD_ITEM_CODE.getCode())); | ||
| 283 | } | 291 | } |
| 292 | + String key = importItem.getCode(); | ||
| 284 | if (StrUtil.isBlank(importItem.getName())) { | 293 | if (StrUtil.isBlank(importItem.getName())) { |
| 285 | respVO.getFailureCodes().put(key, "物料名称不能为空"); | 294 | respVO.getFailureCodes().put(key, "物料名称不能为空"); |
| 286 | return; | 295 | return; |