Commit 138b5d3f2264c57504ebdbca8d9eac4442cfdae0
1 parent
e52fda8e
✨ feat(mes): 添加工具精简列表接口及条码自动生成逻辑
新增工具精简列表接口,支持获取工具的简化信息。同时,在创建工具、客户、设备等时,自动生成对应的条码,提升条码管理的效率。
Showing
17 changed files
with
170 additions
and
19 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/tm/tool/MesTmToolController.java
| @@ -109,6 +109,14 @@ public class MesTmToolController { | @@ -109,6 +109,14 @@ public class MesTmToolController { | ||
| 109 | ExcelUtils.write(response, "工具台账.xls", "数据", MesTmToolRespVO.class, voList); | 109 | ExcelUtils.write(response, "工具台账.xls", "数据", MesTmToolRespVO.class, voList); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | + @GetMapping("/simple-list") | ||
| 113 | + @Operation(summary = "获得工具精简列表") | ||
| 114 | + @PreAuthorize("@ss.hasPermission('mes:tm-tool:query')") | ||
| 115 | + public CommonResult<List<MesTmToolRespVO>> getToolSimpleList() { | ||
| 116 | + List<MesTmToolDO> list = toolService.getToolSimpleList(); | ||
| 117 | + return success(BeanUtils.toBean(list, MesTmToolRespVO.class)); | ||
| 118 | + } | ||
| 119 | + | ||
| 112 | // ==================== 拼接 VO ==================== | 120 | // ==================== 拼接 VO ==================== |
| 113 | 121 | ||
| 114 | @SuppressWarnings("CodeBlock2Expr") | 122 | @SuppressWarnings("CodeBlock2Expr") |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/MesBizTypeConstants.java
| @@ -56,5 +56,6 @@ public final class MesBizTypeConstants { | @@ -56,5 +56,6 @@ public final class MesBizTypeConstants { | ||
| 56 | public static final int MD_WORKSTATION = 602; // 工作站:MesMdWorkstationDO | 56 | public static final int MD_WORKSTATION = 602; // 工作站:MesMdWorkstationDO |
| 57 | public static final int MD_WORKSHOP = 603; // 车间:MesMdWorkshopDO | 57 | public static final int MD_WORKSHOP = 603; // 车间:MesMdWorkshopDO |
| 58 | public static final int MD_USER = 604; // 人员:系统用户 | 58 | public static final int MD_USER = 604; // 人员:系统用户 |
| 59 | + public static final int MD_CLIENT = 605; // 客户:MesMdClientDO | ||
| 59 | 60 | ||
| 60 | } | 61 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/BarcodeBizTypeEnum.java
| @@ -16,6 +16,8 @@ import java.util.Arrays; | @@ -16,6 +16,8 @@ import java.util.Arrays; | ||
| 16 | @AllArgsConstructor | 16 | @AllArgsConstructor |
| 17 | public enum BarcodeBizTypeEnum implements ArrayValuable<Integer> { | 17 | public enum BarcodeBizTypeEnum implements ArrayValuable<Integer> { |
| 18 | 18 | ||
| 19 | + WAREHOUSE(MesBizTypeConstants.WM_WAREHOUSE, "仓库"), | ||
| 20 | + LOCATION(MesBizTypeConstants.WM_LOCATION, "库区"), | ||
| 19 | AREA(MesBizTypeConstants.WM_AREA, "库位"), | 21 | AREA(MesBizTypeConstants.WM_AREA, "库位"), |
| 20 | PACKAGE(MesBizTypeConstants.WM_PACKAGE, "装箱单"), | 22 | PACKAGE(MesBizTypeConstants.WM_PACKAGE, "装箱单"), |
| 21 | STOCK(MesBizTypeConstants.WM_STOCK, "库存"), | 23 | STOCK(MesBizTypeConstants.WM_STOCK, "库存"), |
| @@ -24,8 +26,10 @@ public enum BarcodeBizTypeEnum implements ArrayValuable<Integer> { | @@ -24,8 +26,10 @@ public enum BarcodeBizTypeEnum implements ArrayValuable<Integer> { | ||
| 24 | WORKORDER(MesBizTypeConstants.PRO_WORKORDER, "工单"), | 26 | WORKORDER(MesBizTypeConstants.PRO_WORKORDER, "工单"), |
| 25 | TRANSORDER(MesBizTypeConstants.PRO_TRANS_ORDER, "流转单"), | 27 | TRANSORDER(MesBizTypeConstants.PRO_TRANS_ORDER, "流转单"), |
| 26 | MACHINERY(MesBizTypeConstants.DV_MACHINERY, "设备"), | 28 | MACHINERY(MesBizTypeConstants.DV_MACHINERY, "设备"), |
| 29 | + TOOL(MesBizTypeConstants.TM_TOOL, "工具"), | ||
| 27 | ITEM(MesBizTypeConstants.MD_ITEM, "物料"), | 30 | ITEM(MesBizTypeConstants.MD_ITEM, "物料"), |
| 28 | VENDOR(MesBizTypeConstants.MD_VENDOR, "供应商"), | 31 | VENDOR(MesBizTypeConstants.MD_VENDOR, "供应商"), |
| 32 | + CLIENT(MesBizTypeConstants.MD_CLIENT, "客户"), | ||
| 29 | WORKSTATION(MesBizTypeConstants.MD_WORKSTATION, "工作站"), | 33 | WORKSTATION(MesBizTypeConstants.MD_WORKSTATION, "工作站"), |
| 30 | WORKSHOP(MesBizTypeConstants.MD_WORKSHOP, "车间"), | 34 | WORKSHOP(MesBizTypeConstants.MD_WORKSHOP, "车间"), |
| 31 | USER(MesBizTypeConstants.MD_USER, "人员"); | 35 | USER(MesBizTypeConstants.MD_USER, "人员"); |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/machinery/MesDvMachineryServiceImpl.java
| @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachine | @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachine | ||
| 8 | import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachinerySaveReqVO; | 8 | import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachinerySaveReqVO; |
| 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; |
| 10 | import cn.iocoder.yudao.module.mes.dal.mysql.dv.machinery.MesDvMachineryMapper; | 10 | import cn.iocoder.yudao.module.mes.dal.mysql.dv.machinery.MesDvMachineryMapper; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 11 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkshopService; | 12 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkshopService; |
| 13 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 12 | import jakarta.annotation.Resource; | 14 | import jakarta.annotation.Resource; |
| 13 | import org.springframework.context.annotation.Lazy; | 15 | import org.springframework.context.annotation.Lazy; |
| 14 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| @@ -41,6 +43,9 @@ public class MesDvMachineryServiceImpl implements MesDvMachineryService { | @@ -41,6 +43,9 @@ public class MesDvMachineryServiceImpl implements MesDvMachineryService { | ||
| 41 | @Lazy | 43 | @Lazy |
| 42 | private MesMdWorkshopService workshopService; | 44 | private MesMdWorkshopService workshopService; |
| 43 | 45 | ||
| 46 | + @Resource | ||
| 47 | + private MesWmBarcodeService barcodeService; | ||
| 48 | + | ||
| 44 | @Override | 49 | @Override |
| 45 | public Long createMachinery(MesDvMachinerySaveReqVO createReqVO) { | 50 | public Long createMachinery(MesDvMachinerySaveReqVO createReqVO) { |
| 46 | // 校验设备类型存在 | 51 | // 校验设备类型存在 |
| @@ -53,6 +58,10 @@ public class MesDvMachineryServiceImpl implements MesDvMachineryService { | @@ -53,6 +58,10 @@ public class MesDvMachineryServiceImpl implements MesDvMachineryService { | ||
| 53 | // 插入 | 58 | // 插入 |
| 54 | MesDvMachineryDO machinery = BeanUtils.toBean(createReqVO, MesDvMachineryDO.class); | 59 | MesDvMachineryDO machinery = BeanUtils.toBean(createReqVO, MesDvMachineryDO.class); |
| 55 | machineryMapper.insert(machinery); | 60 | machineryMapper.insert(machinery); |
| 61 | + | ||
| 62 | + // 自动生成条码 | ||
| 63 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.MACHINERY.getValue(), | ||
| 64 | + machinery.getId(), machinery.getCode(), machinery.getName()); | ||
| 56 | return machinery.getId(); | 65 | return machinery.getId(); |
| 57 | } | 66 | } |
| 58 | 67 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/client/MesMdClientServiceImpl.java
| @@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientPage | @@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientPage | ||
| 12 | import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientSaveReqVO; | 12 | import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientSaveReqVO; |
| 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; | 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; |
| 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.client.MesMdClientMapper; | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.client.MesMdClientMapper; |
| 15 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 15 | import jakarta.annotation.Resource; | 17 | import jakarta.annotation.Resource; |
| 16 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
| @@ -39,6 +41,9 @@ public class MesMdClientServiceImpl implements MesMdClientService { | @@ -39,6 +41,9 @@ public class MesMdClientServiceImpl implements MesMdClientService { | ||
| 39 | @Resource | 41 | @Resource |
| 40 | private MesMdClientMapper clientMapper; | 42 | private MesMdClientMapper clientMapper; |
| 41 | 43 | ||
| 44 | + @Resource | ||
| 45 | + private MesWmBarcodeService barcodeService; | ||
| 46 | + | ||
| 42 | @Override | 47 | @Override |
| 43 | public Long createClient(MesMdClientSaveReqVO createReqVO) { | 48 | public Long createClient(MesMdClientSaveReqVO createReqVO) { |
| 44 | // 校验编码唯一 | 49 | // 校验编码唯一 |
| @@ -51,7 +56,10 @@ public class MesMdClientServiceImpl implements MesMdClientService { | @@ -51,7 +56,10 @@ public class MesMdClientServiceImpl implements MesMdClientService { | ||
| 51 | // 插入 | 56 | // 插入 |
| 52 | MesMdClientDO client = BeanUtils.toBean(createReqVO, MesMdClientDO.class); | 57 | MesMdClientDO client = BeanUtils.toBean(createReqVO, MesMdClientDO.class); |
| 53 | clientMapper.insert(client); | 58 | clientMapper.insert(client); |
| 54 | - // TODO @芋艿:客户创建后自动生成条码,依赖 WM 条码模块 | 59 | + |
| 60 | + // 自动生成条码 | ||
| 61 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.CLIENT.getValue(), | ||
| 62 | + client.getId(), client.getCode(), client.getName()); | ||
| 55 | return client.getId(); | 63 | return client.getId(); |
| 56 | } | 64 | } |
| 57 | 65 | ||
| @@ -185,6 +193,9 @@ public class MesMdClientServiceImpl implements MesMdClientService { | @@ -185,6 +193,9 @@ public class MesMdClientServiceImpl implements MesMdClientService { | ||
| 185 | } | 193 | } |
| 186 | MesMdClientDO client = BeanUtils.toBean(importClient, MesMdClientDO.class); | 194 | MesMdClientDO client = BeanUtils.toBean(importClient, MesMdClientDO.class); |
| 187 | clientMapper.insert(client); | 195 | clientMapper.insert(client); |
| 196 | + // 自动生成条码 | ||
| 197 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.CLIENT.getValue(), | ||
| 198 | + client.getId(), client.getCode(), client.getName()); | ||
| 188 | respVO.getCreateCodes().add(importClient.getCode()); | 199 | respVO.getCreateCodes().add(importClient.getCode()); |
| 189 | } else if (updateSupport) { | 200 | } else if (updateSupport) { |
| 190 | // 2.2.2 更新 | 201 | // 2.2.2 更新 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/item/MesMdItemServiceImpl.java
| @@ -15,7 +15,9 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | @@ -15,7 +15,9 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 15 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; | 15 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemTypeDO; |
| 16 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | 16 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| 17 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; | 17 | import cn.iocoder.yudao.module.mes.dal.mysql.md.item.MesMdItemMapper; |
| 18 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 18 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; | 19 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| 20 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 19 | import jakarta.annotation.Resource; | 21 | import jakarta.annotation.Resource; |
| 20 | import org.springframework.stereotype.Service; | 22 | import org.springframework.stereotype.Service; |
| 21 | import org.springframework.transaction.annotation.Transactional; | 23 | import org.springframework.transaction.annotation.Transactional; |
| @@ -53,6 +55,8 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -53,6 +55,8 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 53 | private MesMdProductSopService productSopService; | 55 | private MesMdProductSopService productSopService; |
| 54 | @Resource | 56 | @Resource |
| 55 | private MesMdProductSipService productSipService; | 57 | private MesMdProductSipService productSipService; |
| 58 | + @Resource | ||
| 59 | + private MesWmBarcodeService barcodeService; | ||
| 56 | 60 | ||
| 57 | @Override | 61 | @Override |
| 58 | public Long createItem(MesMdItemSaveReqVO createReqVO) { | 62 | public Long createItem(MesMdItemSaveReqVO createReqVO) { |
| @@ -69,6 +73,10 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -69,6 +73,10 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 69 | MesMdItemDO item = BeanUtils.toBean(createReqVO, MesMdItemDO.class); | 73 | MesMdItemDO item = BeanUtils.toBean(createReqVO, MesMdItemDO.class); |
| 70 | clearStockIfNotSafe(item); // 如果未启用安全库存,清零库存上下限 | 74 | clearStockIfNotSafe(item); // 如果未启用安全库存,清零库存上下限 |
| 71 | itemMapper.insert(item); | 75 | itemMapper.insert(item); |
| 76 | + | ||
| 77 | + // 自动生成条码 | ||
| 78 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.ITEM.getValue(), | ||
| 79 | + item.getId(), item.getCode(), item.getName()); | ||
| 72 | return item.getId(); | 80 | return item.getId(); |
| 73 | } | 81 | } |
| 74 | 82 | ||
| @@ -300,6 +308,9 @@ public class MesMdItemServiceImpl implements MesMdItemService { | @@ -300,6 +308,9 @@ public class MesMdItemServiceImpl implements MesMdItemService { | ||
| 300 | item.setUnitMeasureId(unitMeasure.getId()); | 308 | item.setUnitMeasureId(unitMeasure.getId()); |
| 301 | clearStockIfNotSafe(item); | 309 | clearStockIfNotSafe(item); |
| 302 | itemMapper.insert(item); | 310 | itemMapper.insert(item); |
| 311 | + // 自动生成条码 | ||
| 312 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.ITEM.getValue(), | ||
| 313 | + item.getId(), item.getCode(), item.getName()); | ||
| 303 | respVO.getCreateCodes().add(importItem.getCode()); | 314 | respVO.getCreateCodes().add(importItem.getCode()); |
| 304 | } else if (updateSupport) { | 315 | } else if (updateSupport) { |
| 305 | // 2.3.2 更新 | 316 | // 2.3.2 更新 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/vendor/MesMdVendorServiceImpl.java
| @@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.vendor.vo.MesMdVendorPage | @@ -12,6 +12,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.md.vendor.vo.MesMdVendorPage | ||
| 12 | import cn.iocoder.yudao.module.mes.controller.admin.md.vendor.vo.MesMdVendorSaveReqVO; | 12 | import cn.iocoder.yudao.module.mes.controller.admin.md.vendor.vo.MesMdVendorSaveReqVO; |
| 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; | 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; |
| 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.vendor.MesMdVendorMapper; | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.vendor.MesMdVendorMapper; |
| 15 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 15 | import jakarta.annotation.Resource; | 17 | import jakarta.annotation.Resource; |
| 16 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
| 17 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
| @@ -39,6 +41,9 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | @@ -39,6 +41,9 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | ||
| 39 | @Resource | 41 | @Resource |
| 40 | private MesMdVendorMapper vendorMapper; | 42 | private MesMdVendorMapper vendorMapper; |
| 41 | 43 | ||
| 44 | + @Resource | ||
| 45 | + private MesWmBarcodeService barcodeService; | ||
| 46 | + | ||
| 42 | @Override | 47 | @Override |
| 43 | public Long createVendor(MesMdVendorSaveReqVO createReqVO) { | 48 | public Long createVendor(MesMdVendorSaveReqVO createReqVO) { |
| 44 | // 校验编码唯一 | 49 | // 校验编码唯一 |
| @@ -51,6 +56,10 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | @@ -51,6 +56,10 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | ||
| 51 | // 插入 | 56 | // 插入 |
| 52 | MesMdVendorDO vendor = BeanUtils.toBean(createReqVO, MesMdVendorDO.class); | 57 | MesMdVendorDO vendor = BeanUtils.toBean(createReqVO, MesMdVendorDO.class); |
| 53 | vendorMapper.insert(vendor); | 58 | vendorMapper.insert(vendor); |
| 59 | + | ||
| 60 | + // 自动生成条码 | ||
| 61 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.VENDOR.getValue(), | ||
| 62 | + vendor.getId(), vendor.getCode(), vendor.getName()); | ||
| 54 | return vendor.getId(); | 63 | return vendor.getId(); |
| 55 | } | 64 | } |
| 56 | 65 | ||
| @@ -182,6 +191,9 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | @@ -182,6 +191,9 @@ public class MesMdVendorServiceImpl implements MesMdVendorService { | ||
| 182 | } | 191 | } |
| 183 | MesMdVendorDO vendor = BeanUtils.toBean(importVendor, MesMdVendorDO.class); | 192 | MesMdVendorDO vendor = BeanUtils.toBean(importVendor, MesMdVendorDO.class); |
| 184 | vendorMapper.insert(vendor); | 193 | vendorMapper.insert(vendor); |
| 194 | + // 自动生成条码 | ||
| 195 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.VENDOR.getValue(), | ||
| 196 | + vendor.getId(), vendor.getCode(), vendor.getName()); | ||
| 185 | respVO.getCreateCodes().add(importVendor.getCode()); | 197 | respVO.getCreateCodes().add(importVendor.getCode()); |
| 186 | } else if (updateSupport) { | 198 | } else if (updateSupport) { |
| 187 | // 2.2.2 更新 | 199 | // 2.2.2 更新 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/workstation/MesMdWorkshopServiceImpl.java
| @@ -10,6 +10,8 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkshopDO | @@ -10,6 +10,8 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkshopDO | ||
| 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| 11 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkshopMapper; | 11 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkshopMapper; |
| 12 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMapper; | 12 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMapper; |
| 13 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 13 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| 14 | import org.springframework.context.annotation.Lazy; | 16 | import org.springframework.context.annotation.Lazy; |
| 15 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| @@ -38,6 +40,9 @@ public class MesMdWorkshopServiceImpl implements MesMdWorkshopService { | @@ -38,6 +40,9 @@ public class MesMdWorkshopServiceImpl implements MesMdWorkshopService { | ||
| 38 | @Lazy | 40 | @Lazy |
| 39 | private MesMdWorkstationMapper workstationMapper; | 41 | private MesMdWorkstationMapper workstationMapper; |
| 40 | 42 | ||
| 43 | + @Resource | ||
| 44 | + private MesWmBarcodeService barcodeService; | ||
| 45 | + | ||
| 41 | @Override | 46 | @Override |
| 42 | public Long createWorkshop(MesMdWorkshopSaveReqVO createReqVO) { | 47 | public Long createWorkshop(MesMdWorkshopSaveReqVO createReqVO) { |
| 43 | // 校验编码唯一 | 48 | // 校验编码唯一 |
| @@ -48,6 +53,10 @@ public class MesMdWorkshopServiceImpl implements MesMdWorkshopService { | @@ -48,6 +53,10 @@ public class MesMdWorkshopServiceImpl implements MesMdWorkshopService { | ||
| 48 | // 插入 | 53 | // 插入 |
| 49 | MesMdWorkshopDO workshop = BeanUtils.toBean(createReqVO, MesMdWorkshopDO.class); | 54 | MesMdWorkshopDO workshop = BeanUtils.toBean(createReqVO, MesMdWorkshopDO.class); |
| 50 | workshopMapper.insert(workshop); | 55 | workshopMapper.insert(workshop); |
| 56 | + | ||
| 57 | + // 自动生成条码 | ||
| 58 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.WORKSHOP.getValue(), | ||
| 59 | + workshop.getId(), workshop.getCode(), workshop.getName()); | ||
| 51 | return workshop.getId(); | 60 | return workshop.getId(); |
| 52 | } | 61 | } |
| 53 | 62 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/md/workstation/MesMdWorkstationServiceImpl.java
| @@ -14,6 +14,8 @@ import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMach | @@ -14,6 +14,8 @@ import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMach | ||
| 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMapper; | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationMapper; |
| 15 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationToolMapper; | 15 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationToolMapper; |
| 16 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationWorkerMapper; | 16 | import cn.iocoder.yudao.module.mes.dal.mysql.md.workstation.MesMdWorkstationWorkerMapper; |
| 17 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 17 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; | 19 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| 18 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; | 20 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; |
| 19 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; | 21 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; |
| @@ -62,6 +64,9 @@ public class MesMdWorkstationServiceImpl implements MesMdWorkstationService { | @@ -62,6 +64,9 @@ public class MesMdWorkstationServiceImpl implements MesMdWorkstationService { | ||
| 62 | @Resource | 64 | @Resource |
| 63 | private MesWmWarehouseAreaService areaService; | 65 | private MesWmWarehouseAreaService areaService; |
| 64 | 66 | ||
| 67 | + @Resource | ||
| 68 | + private MesWmBarcodeService barcodeService; | ||
| 69 | + | ||
| 65 | @Override | 70 | @Override |
| 66 | public Long createWorkstation(MesMdWorkstationSaveReqVO createReqVO) { | 71 | public Long createWorkstation(MesMdWorkstationSaveReqVO createReqVO) { |
| 67 | // 校验编码唯一 | 72 | // 校验编码唯一 |
| @@ -76,6 +81,10 @@ public class MesMdWorkstationServiceImpl implements MesMdWorkstationService { | @@ -76,6 +81,10 @@ public class MesMdWorkstationServiceImpl implements MesMdWorkstationService { | ||
| 76 | // 插入 | 81 | // 插入 |
| 77 | MesMdWorkstationDO workstation = BeanUtils.toBean(createReqVO, MesMdWorkstationDO.class); | 82 | MesMdWorkstationDO workstation = BeanUtils.toBean(createReqVO, MesMdWorkstationDO.class); |
| 78 | workstationMapper.insert(workstation); | 83 | workstationMapper.insert(workstation); |
| 84 | + | ||
| 85 | + // 自动生成条码 | ||
| 86 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.WORKSTATION.getValue(), | ||
| 87 | + workstation.getId(), workstation.getCode(), workstation.getName()); | ||
| 79 | return workstation.getId(); | 88 | return workstation.getId(); |
| 80 | } | 89 | } |
| 81 | 90 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/card/MesProCardServiceImpl.java
| @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveRe | @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.pro.card.vo.MesProCardSaveRe | ||
| 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; | 10 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.card.MesProCardProcessMapper; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 11 | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; | 12 | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| 13 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 12 | import jakarta.annotation.Resource; | 14 | import jakarta.annotation.Resource; |
| 13 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 14 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
| @@ -35,6 +37,9 @@ public class MesProCardServiceImpl implements MesProCardService { | @@ -35,6 +37,9 @@ public class MesProCardServiceImpl implements MesProCardService { | ||
| 35 | @Resource | 37 | @Resource |
| 36 | private MesProWorkOrderService workOrderService; | 38 | private MesProWorkOrderService workOrderService; |
| 37 | 39 | ||
| 40 | + @Resource | ||
| 41 | + private MesWmBarcodeService barcodeService; | ||
| 42 | + | ||
| 38 | @Override | 43 | @Override |
| 39 | public Long createCard(MesProCardSaveReqVO createReqVO) { | 44 | public Long createCard(MesProCardSaveReqVO createReqVO) { |
| 40 | // 1.1 校验编码唯一 | 45 | // 1.1 校验编码唯一 |
| @@ -45,7 +50,10 @@ public class MesProCardServiceImpl implements MesProCardService { | @@ -45,7 +50,10 @@ public class MesProCardServiceImpl implements MesProCardService { | ||
| 45 | // 2. 插入 | 50 | // 2. 插入 |
| 46 | MesProCardDO card = BeanUtils.toBean(createReqVO, MesProCardDO.class); | 51 | MesProCardDO card = BeanUtils.toBean(createReqVO, MesProCardDO.class); |
| 47 | cardMapper.insert(card); | 52 | cardMapper.insert(card); |
| 48 | - // TODO @芋艿:条码生成(barcode_url),需等条码模块(wm_barcode)迁移后再对接 | 53 | + |
| 54 | + // 3. 自动生成条码 | ||
| 55 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.PROCARD.getValue(), | ||
| 56 | + card.getId(), card.getCode(), card.getCode()); | ||
| 49 | return card.getId(); | 57 | return card.getId(); |
| 50 | } | 58 | } |
| 51 | 59 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/workorder/MesProWorkorderServiceImpl.java
| @@ -14,9 +14,11 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderD | @@ -14,9 +14,11 @@ import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderD | ||
| 14 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.workorder.MesProWorkOrderBomMapper; | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.workorder.MesProWorkOrderBomMapper; |
| 15 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.workorder.MesProWorkOrderMapper; | 15 | import cn.iocoder.yudao.module.mes.dal.mysql.pro.workorder.MesProWorkOrderMapper; |
| 16 | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderStatusEnum; | 16 | import cn.iocoder.yudao.module.mes.enums.pro.MesProWorkOrderStatusEnum; |
| 17 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 17 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemBatchConfigService; | 18 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemBatchConfigService; |
| 18 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | 19 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| 19 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdProductBomService; | 20 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdProductBomService; |
| 21 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 20 | import jakarta.annotation.Resource; | 22 | import jakarta.annotation.Resource; |
| 21 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 22 | import org.springframework.transaction.annotation.Transactional; | 24 | import org.springframework.transaction.annotation.Transactional; |
| @@ -43,6 +45,7 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | @@ -43,6 +45,7 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | ||
| 43 | @Resource | 45 | @Resource |
| 44 | private MesProWorkOrderMapper workOrderMapper; | 46 | private MesProWorkOrderMapper workOrderMapper; |
| 45 | 47 | ||
| 48 | + // TODO @AI:不应该直接这么调用,调用对应的 service | ||
| 46 | @Resource | 49 | @Resource |
| 47 | private MesProWorkOrderBomMapper workOrderBomMapper; | 50 | private MesProWorkOrderBomMapper workOrderBomMapper; |
| 48 | 51 | ||
| @@ -55,6 +58,9 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | @@ -55,6 +58,9 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | ||
| 55 | @Resource | 58 | @Resource |
| 56 | private MesMdItemBatchConfigService itemBatchConfigService; | 59 | private MesMdItemBatchConfigService itemBatchConfigService; |
| 57 | 60 | ||
| 61 | + @Resource | ||
| 62 | + private MesWmBarcodeService barcodeService; | ||
| 63 | + | ||
| 58 | @Override | 64 | @Override |
| 59 | @Transactional(rollbackFor = Exception.class) | 65 | @Transactional(rollbackFor = Exception.class) |
| 60 | public Long createWorkOrder(MesProWorkOrderSaveReqVO createReqVO) { | 66 | public Long createWorkOrder(MesProWorkOrderSaveReqVO createReqVO) { |
| @@ -78,6 +84,10 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | @@ -78,6 +84,10 @@ public class MesProWorkOrderServiceImpl implements MesProWorkOrderService { | ||
| 78 | 84 | ||
| 79 | // 3. 自动生成 BOM:根据产品 BOM 生成工单 BOM | 85 | // 3. 自动生成 BOM:根据产品 BOM 生成工单 BOM |
| 80 | generateWorkOrderBom(workOrder.getId(), createReqVO.getProductId(), createReqVO.getQuantity()); | 86 | generateWorkOrderBom(workOrder.getId(), createReqVO.getProductId(), createReqVO.getQuantity()); |
| 87 | + | ||
| 88 | + // 4. 自动生成条码 | ||
| 89 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.WORKORDER.getValue(), | ||
| 90 | + workOrder.getId(), workOrder.getCode(), workOrder.getName()); | ||
| 81 | return workOrder.getId(); | 91 | return workOrder.getId(); |
| 82 | } | 92 | } |
| 83 | 93 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/tm/tool/MesTmToolService.java
| @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolSaveReqV | @@ -6,6 +6,8 @@ import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolSaveReqV | ||
| 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.tm.tool.MesTmToolDO; | 6 | import cn.iocoder.yudao.module.mes.dal.dataobject.tm.tool.MesTmToolDO; |
| 7 | import jakarta.validation.Valid; | 7 | import jakarta.validation.Valid; |
| 8 | 8 | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 9 | /** | 11 | /** |
| 10 | * MES 工具台账 Service 接口 | 12 | * MES 工具台账 Service 接口 |
| 11 | * | 13 | * |
| @@ -51,4 +53,11 @@ public interface MesTmToolService { | @@ -51,4 +53,11 @@ public interface MesTmToolService { | ||
| 51 | */ | 53 | */ |
| 52 | PageResult<MesTmToolDO> getToolPage(MesTmToolPageReqVO pageReqVO); | 54 | PageResult<MesTmToolDO> getToolPage(MesTmToolPageReqVO pageReqVO); |
| 53 | 55 | ||
| 56 | + /** | ||
| 57 | + * 获得工具精简列表 | ||
| 58 | + * | ||
| 59 | + * @return 工具列表 | ||
| 60 | + */ | ||
| 61 | + List<MesTmToolDO> getToolSimpleList(); | ||
| 62 | + | ||
| 54 | } | 63 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/tm/tool/MesTmToolServiceImpl.java
| 1 | package cn.iocoder.yudao.module.mes.service.tm.tool; | 1 | package cn.iocoder.yudao.module.mes.service.tm.tool; |
| 2 | 2 | ||
| 3 | +import cn.hutool.core.util.ObjUtil; | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 5 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 5 | import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolPageReqVO; | 6 | import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolPageReqVO; |
| @@ -7,17 +8,19 @@ import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolSaveReqV | @@ -7,17 +8,19 @@ import cn.iocoder.yudao.module.mes.controller.admin.tm.tool.vo.MesTmToolSaveReqV | ||
| 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.tm.tool.MesTmToolDO; | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.tm.tool.MesTmToolDO; |
| 8 | import cn.iocoder.yudao.module.mes.dal.mysql.tm.tool.MesTmToolMapper; | 9 | import cn.iocoder.yudao.module.mes.dal.mysql.tm.tool.MesTmToolMapper; |
| 9 | import cn.iocoder.yudao.module.mes.enums.tm.MesTmMaintenTypeEnum; | 10 | import cn.iocoder.yudao.module.mes.enums.tm.MesTmMaintenTypeEnum; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 10 | import jakarta.annotation.Resource; | 13 | import jakarta.annotation.Resource; |
| 11 | import org.springframework.context.annotation.Lazy; | 14 | import org.springframework.context.annotation.Lazy; |
| 12 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| 13 | import org.springframework.validation.annotation.Validated; | 16 | import org.springframework.validation.annotation.Validated; |
| 14 | 17 | ||
| 15 | -import cn.hutool.core.util.ObjUtil; | ||
| 16 | - | 18 | +import java.util.List; |
| 17 | import java.util.Objects; | 19 | import java.util.Objects; |
| 18 | 20 | ||
| 19 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | 21 | import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 20 | -import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | 22 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.TM_TOOL_CODE_DUPLICATE; |
| 23 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.TM_TOOL_NOT_EXISTS; | ||
| 21 | 24 | ||
| 22 | /** | 25 | /** |
| 23 | * MES 工具台账 Service 实现类 | 26 | * MES 工具台账 Service 实现类 |
| @@ -35,6 +38,9 @@ public class MesTmToolServiceImpl implements MesTmToolService { | @@ -35,6 +38,9 @@ public class MesTmToolServiceImpl implements MesTmToolService { | ||
| 35 | @Lazy // 延迟加载,避免循环依赖 | 38 | @Lazy // 延迟加载,避免循环依赖 |
| 36 | private MesTmToolTypeService toolTypeService; | 39 | private MesTmToolTypeService toolTypeService; |
| 37 | 40 | ||
| 41 | + @Resource | ||
| 42 | + private MesWmBarcodeService barcodeService; | ||
| 43 | + | ||
| 38 | @Override | 44 | @Override |
| 39 | public Long createTool(MesTmToolSaveReqVO createReqVO) { | 45 | public Long createTool(MesTmToolSaveReqVO createReqVO) { |
| 40 | // 校验工具类型存在 | 46 | // 校验工具类型存在 |
| @@ -45,6 +51,10 @@ public class MesTmToolServiceImpl implements MesTmToolService { | @@ -45,6 +51,10 @@ public class MesTmToolServiceImpl implements MesTmToolService { | ||
| 45 | // 插入 | 51 | // 插入 |
| 46 | MesTmToolDO tool = BeanUtils.toBean(createReqVO, MesTmToolDO.class); | 52 | MesTmToolDO tool = BeanUtils.toBean(createReqVO, MesTmToolDO.class); |
| 47 | toolMapper.insert(tool); | 53 | toolMapper.insert(tool); |
| 54 | + | ||
| 55 | + // 自动生成条码 | ||
| 56 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.TOOL.getValue(), | ||
| 57 | + tool.getId(), tool.getCode(), tool.getName()); | ||
| 48 | return tool.getId(); | 58 | return tool.getId(); |
| 49 | } | 59 | } |
| 50 | 60 | ||
| @@ -104,4 +114,9 @@ public class MesTmToolServiceImpl implements MesTmToolService { | @@ -104,4 +114,9 @@ public class MesTmToolServiceImpl implements MesTmToolService { | ||
| 104 | return toolMapper.selectPage(pageReqVO); | 114 | return toolMapper.selectPage(pageReqVO); |
| 105 | } | 115 | } |
| 106 | 116 | ||
| 117 | + @Override | ||
| 118 | + public List<MesTmToolDO> getToolSimpleList() { | ||
| 119 | + return toolMapper.selectList(); | ||
| 120 | + } | ||
| 121 | + | ||
| 107 | } | 122 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/barcode/MesWmBarcodeServiceImpl.java
| @@ -43,6 +43,7 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | @@ -43,6 +43,7 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // 2.1 生成条码内容(根据配置模板) | 45 | // 2.1 生成条码内容(根据配置模板) |
| 46 | + // TODO @AI:MesWmBarcodeSaveReqVO 增加一个 content 字段;如果为空,才进行生成; | ||
| 46 | String content = generateBarcodeContent(config.getContentFormat(), createReqVO.getBizCode()); | 47 | String content = generateBarcodeContent(config.getContentFormat(), createReqVO.getBizCode()); |
| 47 | // 2.2 校验条码内容唯一性 | 48 | // 2.2 校验条码内容唯一性 |
| 48 | MesWmBarcodeDO contentBarcode = barcodeMapper.selectByContent(content); | 49 | MesWmBarcodeDO contentBarcode = barcodeMapper.selectByContent(content); |
| @@ -57,11 +58,29 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | @@ -57,11 +58,29 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | ||
| 57 | return barcode.getId(); | 58 | return barcode.getId(); |
| 58 | } | 59 | } |
| 59 | 60 | ||
| 61 | + // TODO @AI:后端提供一个接口,用于 generateBarcodeContent 的生成;前端需要调用这个接口; | ||
| 62 | + | ||
| 63 | + /** | ||
| 64 | + * 生成条码内容 | ||
| 65 | + * | ||
| 66 | + * @param contentFormat 内容格式模板 | ||
| 67 | + * @param bizCode 业务编码 | ||
| 68 | + * @return 条码内容 | ||
| 69 | + */ | ||
| 70 | + private String generateBarcodeContent(String contentFormat, String bizCode) { | ||
| 71 | + if (StrUtil.isBlank(contentFormat)) { | ||
| 72 | + return bizCode; | ||
| 73 | + } | ||
| 74 | + return contentFormat.replace(MesWmBarcodeConfigDO.PLACEHOLDER_BUSINESS_CODE, bizCode); | ||
| 75 | + } | ||
| 76 | + | ||
| 60 | @Override | 77 | @Override |
| 61 | public void updateBarcode(MesWmBarcodeSaveReqVO updateReqVO) { | 78 | public void updateBarcode(MesWmBarcodeSaveReqVO updateReqVO) { |
| 62 | // 校验存在 | 79 | // 校验存在 |
| 63 | validateBarcodeExists(updateReqVO.getId()); | 80 | validateBarcodeExists(updateReqVO.getId()); |
| 64 | 81 | ||
| 82 | + // TODO @AI:content 可以更新;更新需要校验唯一; | ||
| 83 | + | ||
| 65 | // 更新 | 84 | // 更新 |
| 66 | MesWmBarcodeDO updateObj = BeanUtils.toBean(updateReqVO, MesWmBarcodeDO.class); | 85 | MesWmBarcodeDO updateObj = BeanUtils.toBean(updateReqVO, MesWmBarcodeDO.class); |
| 67 | barcodeMapper.updateById(updateObj); | 86 | barcodeMapper.updateById(updateObj); |
| @@ -119,18 +138,4 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | @@ -119,18 +138,4 @@ public class MesWmBarcodeServiceImpl implements MesWmBarcodeService { | ||
| 119 | createBarcode(createReqVO); | 138 | createBarcode(createReqVO); |
| 120 | } | 139 | } |
| 121 | 140 | ||
| 122 | - /** | ||
| 123 | - * 生成条码内容 | ||
| 124 | - * | ||
| 125 | - * @param contentFormat 内容格式模板 | ||
| 126 | - * @param bizCode 业务编码 | ||
| 127 | - * @return 条码内容 | ||
| 128 | - */ | ||
| 129 | - private String generateBarcodeContent(String contentFormat, String bizCode) { | ||
| 130 | - if (StrUtil.isBlank(contentFormat)) { | ||
| 131 | - return bizCode; | ||
| 132 | - } | ||
| 133 | - return contentFormat.replace(MesWmBarcodeConfigDO.PLACEHOLDER_BUSINESS_CODE, bizCode); | ||
| 134 | - } | ||
| 135 | - | ||
| 136 | } | 141 | } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/warehouse/MesWmWarehouseAreaServiceImpl.java
| @@ -9,7 +9,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.area.MesWmWa | @@ -9,7 +9,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.area.MesWmWa | ||
| 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; |
| 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; |
| 11 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseAreaMapper; | 11 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseAreaMapper; |
| 12 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 12 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | 13 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| 14 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 13 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; | 15 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| 14 | import jakarta.annotation.Resource; | 16 | import jakarta.annotation.Resource; |
| 15 | import org.springframework.context.annotation.Lazy; | 17 | import org.springframework.context.annotation.Lazy; |
| @@ -41,6 +43,8 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | @@ -41,6 +43,8 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | ||
| 41 | @Resource | 43 | @Resource |
| 42 | @Lazy | 44 | @Lazy |
| 43 | private MesWmWarehouseLocationService locationService; | 45 | private MesWmWarehouseLocationService locationService; |
| 46 | + @Resource | ||
| 47 | + private MesWmBarcodeService barcodeService; | ||
| 44 | 48 | ||
| 45 | @Override | 49 | @Override |
| 46 | public Long createWarehouseArea(MesWmWarehouseAreaSaveReqVO createReqVO) { | 50 | public Long createWarehouseArea(MesWmWarehouseAreaSaveReqVO createReqVO) { |
| @@ -51,8 +55,13 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | @@ -51,8 +55,13 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | ||
| 51 | // 校验名称唯一 | 55 | // 校验名称唯一 |
| 52 | validateWarehouseAreaNameUnique(null, createReqVO.getLocationId(), createReqVO.getName()); | 56 | validateWarehouseAreaNameUnique(null, createReqVO.getLocationId(), createReqVO.getName()); |
| 53 | 57 | ||
| 58 | + // 插入 | ||
| 54 | MesWmWarehouseAreaDO area = BeanUtils.toBean(createReqVO, MesWmWarehouseAreaDO.class); | 59 | MesWmWarehouseAreaDO area = BeanUtils.toBean(createReqVO, MesWmWarehouseAreaDO.class); |
| 55 | areaMapper.insert(area); | 60 | areaMapper.insert(area); |
| 61 | + | ||
| 62 | + // 自动生成条码 | ||
| 63 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.AREA.getValue(), | ||
| 64 | + area.getId(), area.getCode(), area.getName()); | ||
| 56 | return area.getId(); | 65 | return area.getId(); |
| 57 | } | 66 | } |
| 58 | 67 | ||
| @@ -67,6 +76,7 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | @@ -67,6 +76,7 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | ||
| 67 | // 校验名称唯一 | 76 | // 校验名称唯一 |
| 68 | validateWarehouseAreaNameUnique(updateReqVO.getId(), updateReqVO.getLocationId(), updateReqVO.getName()); | 77 | validateWarehouseAreaNameUnique(updateReqVO.getId(), updateReqVO.getLocationId(), updateReqVO.getName()); |
| 69 | 78 | ||
| 79 | + // 更新 | ||
| 70 | MesWmWarehouseAreaDO updateObj = BeanUtils.toBean(updateReqVO, MesWmWarehouseAreaDO.class); | 80 | MesWmWarehouseAreaDO updateObj = BeanUtils.toBean(updateReqVO, MesWmWarehouseAreaDO.class); |
| 71 | areaMapper.updateById(updateObj); | 81 | areaMapper.updateById(updateObj); |
| 72 | } | 82 | } |
| @@ -84,6 +94,7 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | @@ -84,6 +94,7 @@ public class MesWmWarehouseAreaServiceImpl implements MesWmWarehouseAreaService | ||
| 84 | throw exception(WM_WAREHOUSE_AREA_HAS_MATERIAL_STOCK); | 94 | throw exception(WM_WAREHOUSE_AREA_HAS_MATERIAL_STOCK); |
| 85 | } | 95 | } |
| 86 | 96 | ||
| 97 | + // 删除 | ||
| 87 | areaMapper.deleteById(id); | 98 | areaMapper.deleteById(id); |
| 88 | } | 99 | } |
| 89 | 100 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/warehouse/MesWmWarehouseLocationServiceImpl.java
| @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.location.Mes | @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.location.Mes | ||
| 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.location.MesWmWarehouseLocationSaveReqVO; | 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.location.MesWmWarehouseLocationSaveReqVO; |
| 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; |
| 10 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseLocationMapper; | 10 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseLocationMapper; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 11 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | 12 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| 13 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 12 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; | 14 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| 13 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| 14 | import org.springframework.context.annotation.Lazy; | 16 | import org.springframework.context.annotation.Lazy; |
| @@ -42,6 +44,8 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | @@ -42,6 +44,8 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | ||
| 42 | @Resource | 44 | @Resource |
| 43 | @Lazy | 45 | @Lazy |
| 44 | private MesWmWarehouseService warehouseService; | 46 | private MesWmWarehouseService warehouseService; |
| 47 | + @Resource | ||
| 48 | + private MesWmBarcodeService barcodeService; | ||
| 45 | 49 | ||
| 46 | @Override | 50 | @Override |
| 47 | public Long createWarehouseLocation(MesWmWarehouseLocationSaveReqVO createReqVO) { | 51 | public Long createWarehouseLocation(MesWmWarehouseLocationSaveReqVO createReqVO) { |
| @@ -52,8 +56,13 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | @@ -52,8 +56,13 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | ||
| 52 | // 校验名称唯一 | 56 | // 校验名称唯一 |
| 53 | validateWarehouseLocationNameUnique(null, createReqVO.getWarehouseId(), createReqVO.getName()); | 57 | validateWarehouseLocationNameUnique(null, createReqVO.getWarehouseId(), createReqVO.getName()); |
| 54 | 58 | ||
| 59 | + // 插入 | ||
| 55 | MesWmWarehouseLocationDO location = BeanUtils.toBean(createReqVO, MesWmWarehouseLocationDO.class); | 60 | MesWmWarehouseLocationDO location = BeanUtils.toBean(createReqVO, MesWmWarehouseLocationDO.class); |
| 56 | locationMapper.insert(location); | 61 | locationMapper.insert(location); |
| 62 | + | ||
| 63 | + // 自动生成条码 | ||
| 64 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.LOCATION.getValue(), | ||
| 65 | + location.getId(), location.getCode(), location.getName()); | ||
| 57 | return location.getId(); | 66 | return location.getId(); |
| 58 | } | 67 | } |
| 59 | 68 | ||
| @@ -68,6 +77,7 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | @@ -68,6 +77,7 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | ||
| 68 | // 校验名称唯一 | 77 | // 校验名称唯一 |
| 69 | validateWarehouseLocationNameUnique(updateReqVO.getId(), updateReqVO.getWarehouseId(), updateReqVO.getName()); | 78 | validateWarehouseLocationNameUnique(updateReqVO.getId(), updateReqVO.getWarehouseId(), updateReqVO.getName()); |
| 70 | 79 | ||
| 80 | + // 更新 | ||
| 71 | MesWmWarehouseLocationDO updateObj = BeanUtils.toBean(updateReqVO, MesWmWarehouseLocationDO.class); | 81 | MesWmWarehouseLocationDO updateObj = BeanUtils.toBean(updateReqVO, MesWmWarehouseLocationDO.class); |
| 72 | locationMapper.updateById(updateObj); | 82 | locationMapper.updateById(updateObj); |
| 73 | } | 83 | } |
| @@ -89,6 +99,7 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | @@ -89,6 +99,7 @@ public class MesWmWarehouseLocationServiceImpl implements MesWmWarehouseLocation | ||
| 89 | throw exception(WM_WAREHOUSE_LOCATION_HAS_MATERIAL_STOCK); | 99 | throw exception(WM_WAREHOUSE_LOCATION_HAS_MATERIAL_STOCK); |
| 90 | } | 100 | } |
| 91 | 101 | ||
| 102 | + // 删除 | ||
| 92 | locationMapper.deleteById(id); | 103 | locationMapper.deleteById(id); |
| 93 | } | 104 | } |
| 94 | 105 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/warehouse/MesWmWarehouseServiceImpl.java
| @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.MesWmWarehou | @@ -8,7 +8,9 @@ import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.MesWmWarehou | ||
| 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.MesWmWarehouseSaveReqVO; | 8 | import cn.iocoder.yudao.module.mes.controller.admin.wm.warehouse.vo.MesWmWarehouseSaveReqVO; |
| 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; |
| 10 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseMapper; | 10 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.warehouse.MesWmWarehouseMapper; |
| 11 | +import cn.iocoder.yudao.module.mes.enums.wm.BarcodeBizTypeEnum; | ||
| 11 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | 12 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| 13 | +import cn.iocoder.yudao.module.mes.service.wm.barcode.MesWmBarcodeService; | ||
| 12 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; | 14 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| 13 | import jakarta.annotation.Resource; | 15 | import jakarta.annotation.Resource; |
| 14 | import org.springframework.context.annotation.Lazy; | 16 | import org.springframework.context.annotation.Lazy; |
| @@ -39,6 +41,8 @@ public class MesWmWarehouseServiceImpl implements MesWmWarehouseService { | @@ -39,6 +41,8 @@ public class MesWmWarehouseServiceImpl implements MesWmWarehouseService { | ||
| 39 | private MesMdWorkstationService workstationService; | 41 | private MesMdWorkstationService workstationService; |
| 40 | @Resource | 42 | @Resource |
| 41 | private MesWmMaterialStockService materialStockService; | 43 | private MesWmMaterialStockService materialStockService; |
| 44 | + @Resource | ||
| 45 | + private MesWmBarcodeService barcodeService; | ||
| 42 | 46 | ||
| 43 | @Override | 47 | @Override |
| 44 | public Long createWarehouse(MesWmWarehouseSaveReqVO createReqVO) { | 48 | public Long createWarehouse(MesWmWarehouseSaveReqVO createReqVO) { |
| @@ -50,6 +54,10 @@ public class MesWmWarehouseServiceImpl implements MesWmWarehouseService { | @@ -50,6 +54,10 @@ public class MesWmWarehouseServiceImpl implements MesWmWarehouseService { | ||
| 50 | // 插入 | 54 | // 插入 |
| 51 | MesWmWarehouseDO warehouse = BeanUtils.toBean(createReqVO, MesWmWarehouseDO.class); | 55 | MesWmWarehouseDO warehouse = BeanUtils.toBean(createReqVO, MesWmWarehouseDO.class); |
| 52 | warehouseMapper.insert(warehouse); | 56 | warehouseMapper.insert(warehouse); |
| 57 | + | ||
| 58 | + // 自动生成条码 | ||
| 59 | + barcodeService.autoGenerateBarcode(BarcodeBizTypeEnum.WAREHOUSE.getValue(), | ||
| 60 | + warehouse.getId(), warehouse.getCode(), warehouse.getName()); | ||
| 53 | return warehouse.getId(); | 61 | return warehouse.getId(); |
| 54 | } | 62 | } |
| 55 | 63 |