From 8d0b466ef4fe497932e15c186688679e55a26f62 Mon Sep 17 00:00:00 2001 From: cuilei <ray_tsu1@163.com> Date: 星期五, 22 八月 2025 10:45:59 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java | 10 src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java | 5 src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java | 13 src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java | 6 src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java | 6 src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java | 29 + src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java | 8 src/main/java/org/jeecg/modules/mes/enums/MaterialTransferRequestStatus.java | 11 src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java | 1 src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java | 80 ++ src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml | 9 src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java | 2 src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java | 14 src/main/java/org/jeecg/modules/cms/vo/CuttingInboundExportVo.java | 117 ++++ src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java | 13 db/双林新火炬MES数据库设计.pdma.json | 562 +++++------------- src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java | 2 src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java | 12 src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java | 33 src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java | 1 src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java | 464 ++++++++++----- src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java | 6 src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml | 18 src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java | 267 ++++---- src/main/java/org/jeecg/modules/mes/enums/MaterialTransferPublishStatus.java | 10 25 files changed, 993 insertions(+), 706 deletions(-) diff --git "a/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" "b/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" index 5e069ee..f04ecb8 100644 --- "a/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" +++ "b/db/\345\217\214\346\236\227\346\226\260\347\201\253\347\202\254MES\346\225\260\346\215\256\345\272\223\350\256\276\350\256\241.pdma.json" @@ -2,9 +2,9 @@ "name": "鍙屾灄鏂扮伀鐐琈ES鏁版嵁搴撹璁�", "describe": "鎻忚堪鍙岃柂鏂扮伀鐐琈ES鏁版嵁搴撹璁¤鎯�", "avatar": "", - "version": "4.9.4", + "version": "4.9.2", "createdTime": "2025-3-10 16:38:19", - "updatedTime": "2025-8-20 16:04:03", + "updatedTime": "2025-8-20 15:14:16", "dbConns": [], "profile": { "default": { @@ -64779,6 +64779,24 @@ "id": "FC8D8EFD-EDAD-42FD-81CA-B2B3962BD05F" }, { + "defKey": "publish_time", + "defName": "鍙戝竷鏃堕棿", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "refDict": "", + "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098", + "extProps": {}, + "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC", + "id": "7BC5A8E6-31E0-4B70-BAC5-87EFF639FE63" + }, + { "defKey": "request_status", "defName": "璇锋眰鐘舵��", "comment": "", @@ -64816,7 +64834,7 @@ }, { "defKey": "original_warehouse_id", - "defName": "鍘熷簱瀛樺湴", + "defName": "璧峰搴撳瓨鍦�", "comment": "", "type": "", "len": "", @@ -64826,7 +64844,7 @@ "autoIncrement": false, "defaultValue": "", "hideInGraph": false, - "domain": "16120F75-6AA7-4483-868D-F07F511BB081", + "domain": "73FD2BAD-2358-4336-B96D-45DC897BD792", "refDict": "", "extProps": {}, "notes": {}, @@ -64871,8 +64889,8 @@ "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" }, { - "defKey": "priority", - "defName": "浼樺厛绾э紙鎷夊姩绫诲瀷锛�", + "defKey": "material_transfer_category", + "defName": "鎷夊姩绫诲瀷", "comment": "", "type": "", "len": "", @@ -64905,6 +64923,146 @@ "extProps": {}, "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC", "id": "F0CEC477-F5FE-4622-83DB-FBFDA4344E30" + }, + { + "defKey": "material_number", + "defName": "鐗╂枡缂栫爜", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "0B5A2CD6-7472-4E18-ACB1-6418C2A8A109", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" + }, + { + "defKey": "material_name", + "defName": "鐗╂枡鍚嶇О", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": true, + "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "AFBDF9D2-3B49-4620-9541-C15731785905", + "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" + }, + { + "defKey": "specified_quantity", + "defName": "鐞嗚鎷夊姩鏁伴噺", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "60A2C50B-3F37-4319-B53A-72AE3E55CAFC", + "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E" + }, + { + "defKey": "actual_quantity", + "defName": "瀹為檯鎷夊姩鏁伴噺", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "AE123111-CDE3-4CFE-96ED-EFA3D3115CD2", + "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E" + }, + { + "defKey": "remaining_quantity", + "defName": "杞﹂棿鍓╀綑鏁伴噺", + "comment": "", + "type": "", + "len": "", + "scale": "", + "primaryKey": false, + "notNull": false, + "autoIncrement": false, + "defaultValue": "", + "hideInGraph": false, + "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", + "refDict": "", + "extProps": {}, + "notes": {}, + "attr1": "", + "attr2": "", + "attr3": "", + "attr4": "", + "attr5": "", + "attr6": "", + "attr7": "", + "attr8": "", + "attr9": "", + "id": "12249855-7F62-4734-B5B8-1AACBE2A50CC", + "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E" } ], "correlations": [], @@ -65743,397 +65901,6 @@ "attr9": "", "id": "4B21EDEF-B9C4-48C7-BF6A-AC5ABA159B8A", "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E" - } - ], - "correlations": [], - "indexes": [], - "type": "P" - }, - { - "id": "2FF92658-07FE-49BC-A690-E24FA5226BB3", - "env": { - "base": { - "nameSpace": "", - "codeRoot": "" - } - }, - "defKey": "mes_material_transfer_detail", - "defName": "鐗╂枡鎷夊姩鏄庣粏", - "comment": "", - "properties": { - "partitioned by": "(date string)", - "row format delimited": "", - "fields terminated by ','": "", - "collection items terminated by '-'": "", - "map keys terminated by ':'": "", - "store as textfile;": "" - }, - "sysProps": { - "nameTemplate": "{defKey}[{defName}]" - }, - "notes": {}, - "headers": [ - { - "refKey": "hideInGraph", - "hideInGraph": true - }, - { - "refKey": "defKey", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "defName", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "primaryKey", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "notNull", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "autoIncrement", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "domain", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "type", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "len", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "scale", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "comment", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "refDict", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "defaultValue", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "isStandard", - "freeze": false, - "hideInGraph": false - }, - { - "refKey": "uiHint", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "extProps", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr1", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr2", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr3", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr4", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr5", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr6", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr7", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr8", - "freeze": false, - "hideInGraph": true - }, - { - "refKey": "attr9", - "freeze": false, - "hideInGraph": true - } - ], - "fields": [ - { - "defKey": "id", - "defName": "涓婚敭", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": true, - "notNull": true, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", - "extProps": {}, - "domain": "16120F75-6AA7-4483-868D-F07F511BB081", - "id": "F7E0BFAE-F178-43E0-8482-2DCE7CEFB184" - }, - { - "defKey": "create_by", - "defName": "鍒涘缓浜�", - "comment": "", - "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": true, - "refDict": "", - "uiHint": "", - "id": "F445F433-E877-4D2A-8ECE-03043F0ACB7D", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" - }, - { - "defKey": "create_time", - "defName": "鍒涘缓鏃堕棿", - "comment": "", - "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": true, - "refDict": "", - "uiHint": "", - "id": "E690295E-8BFF-49DA-8966-6A3FE3824883", - "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098" - }, - { - "defKey": "update_by", - "defName": "鏇存柊浜�", - "comment": "", - "domain": "54611CCC-CA4B-42E1-9F32-4944C85B85A6", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": true, - "refDict": "", - "uiHint": "", - "id": "E3C7E33A-8B8C-4F70-BA59-3B5A10C50734", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" - }, - { - "defKey": "update_time", - "defName": "鏇存柊鏃堕棿", - "comment": "", - "domain": "7CFFA0D3-6A93-4DDC-BC10-DF21211064DC", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": true, - "refDict": "", - "uiHint": "", - "id": "93258189-F627-4142-BC39-0295E3A52033", - "baseType": "89D69E81-EA34-42EE-9FA2-93B8BD27E098" - }, - { - "defKey": "del_flag", - "defName": "鍒犻櫎鏍囪", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "1D764C4A-6F9F-421E-B11A-6F3E23B51811", - "extProps": {}, - "domain": "6BC8F04B-6CFA-4995-98D3-318F5CDD774E", - "id": "F80D66E7-8670-4B1C-9940-041DBAD0580A" - }, - { - "defKey": "request_id", - "defName": "鐢宠鍗旾D", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64", - "extProps": {}, - "domain": "16120F75-6AA7-4483-868D-F07F511BB081", - "id": "850A2C7A-D321-4283-B735-7BCC56DF7933" - }, - { - "defKey": "material_number", - "defName": "鐗╂枡缂栫爜", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "domain": "BE09D493-E183-402D-ACC4-EEA21EB35B8E", - "refDict": "", - "extProps": {}, - "notes": {}, - "attr1": "", - "attr2": "", - "attr3": "", - "attr4": "", - "attr5": "", - "attr6": "", - "attr7": "", - "attr8": "", - "attr9": "", - "id": "E77D6EFA-7408-4891-888B-D6FC2CF8E6E5", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" - }, - { - "defKey": "material_name", - "defName": "鐗╂枡鍚嶇О", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": true, - "domain": "9092C4E0-1A54-4859-ABBB-5B62DBC27573", - "refDict": "", - "extProps": {}, - "notes": {}, - "attr1": "", - "attr2": "", - "attr3": "", - "attr4": "", - "attr5": "", - "attr6": "", - "attr7": "", - "attr8": "", - "attr9": "", - "id": "270E5417-96C7-4540-AC29-07C8FCC3CD38", - "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64" - }, - { - "defKey": "specified_quantity", - "defName": "鐞嗚鎷夊姩鏁伴噺", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E", - "extProps": {}, - "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", - "id": "D7028092-5311-4FC1-B6F2-19B1FFBFA85B" - }, - { - "defKey": "actual_quantity", - "defName": "瀹為檯鎷夊姩鏁伴噺", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E", - "extProps": {}, - "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", - "id": "4E9708B3-14B0-45A0-A3B8-351D759C7B47" - }, - { - "defKey": "remaining_quantity", - "defName": "杞﹂棿鍓╀綑鏁伴噺", - "comment": "", - "type": "", - "len": "", - "scale": "", - "primaryKey": false, - "notNull": false, - "autoIncrement": false, - "defaultValue": "", - "hideInGraph": false, - "refDict": "", - "baseType": "1A0BDC09-0792-4174-9E8E-80BE8DF44B8E", - "extProps": {}, - "domain": "FF4459C5-6B45-4DBF-8FC0-E06239BC05B4", - "id": "FE041E9A-5D05-42EE-AA33-C563B66B99A5" } ], "correlations": [], @@ -70054,7 +69821,6 @@ "70FEB6D0-FC18-42C5-8608-34E8BBB4A406", "D16FD5E0-8B16-4C0E-AD67-6E5C2FED1A65", "5835D3E9-4B10-48DC-B116-584E447AA201", - "2FF92658-07FE-49BC-A690-E24FA5226BB3", "23C6B8F0-0010-4453-B3C2-9305746C37AB", "D3263A0C-1D6A-453A-B933-86651B5566FE" ], diff --git a/src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java b/src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java index 0379a86..0f5d3c9 100644 --- a/src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java +++ b/src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java @@ -191,4 +191,16 @@ return Result.ok("鎿嶄綔鎴愬姛锛�"); } + + //@AutoLog(value = "绾胯竟浠撳簱淇℃伅-閫氳繃id鏌ヨ") + @ApiOperation(value="绾胯竟浠撳簱淇℃伅-閫氳繃id鏌ヨ", notes="绾胯竟浠撳簱淇℃伅-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryByFactoryId") + public Result<LineSideWarehouse> queryByFactoryId(@RequestParam(name="factoryId") String factoryId) { + LineSideWarehouse lineSideWarehouse = lineSideWarehouseService.queryByFactoryId(factoryId); + if(lineSideWarehouse==null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(lineSideWarehouse); + } + } diff --git a/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java b/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java index 202b90d..5d89f62 100644 --- a/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java +++ b/src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java @@ -11,4 +11,10 @@ */ public interface ILineSideWarehouseService extends IService<LineSideWarehouse> { + /** + * 鏍规嵁鏌ヨID鏌ヨ绾胯竟搴� + * @param factoryId + * @return + */ + LineSideWarehouse queryByFactoryId(String factoryId); } diff --git a/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java b/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java index a430910..8b205e9 100644 --- a/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java +++ b/src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java @@ -1,11 +1,11 @@ package org.jeecg.modules.base.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.jeecg.modules.base.entity.LineSideWarehouse; import org.jeecg.modules.base.mapper.LineSideWarehouseMapper; import org.jeecg.modules.base.service.ILineSideWarehouseService; import org.springframework.stereotype.Service; - -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; /** * @Description: 绾胯竟浠撳簱淇℃伅 @@ -16,4 +16,14 @@ @Service public class LineSideWarehouseServiceImpl extends ServiceImpl<LineSideWarehouseMapper, LineSideWarehouse> implements ILineSideWarehouseService { + @Override + public LineSideWarehouse queryByFactoryId(String factoryId) { + LambdaQueryWrapper<LineSideWarehouse> wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LineSideWarehouse::getFactoryId, factoryId); + LineSideWarehouse entity = this.getBaseMapper().selectOne(wrapper); + if(entity != null) { + entity.setWarehouseName(entity.getWarehouseName() + "(" + entity.getWarehouseCode() + ")"); + } + return entity; + } } diff --git a/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java b/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java index fea2c84..173d574 100644 --- a/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java +++ b/src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java @@ -1,13 +1,7 @@ package org.jeecg.modules.cms.controller; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.io.IOException; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; +import java.math.BigDecimal; +import java.util.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -15,10 +9,13 @@ import com.alibaba.fastjson.JSONObject; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.query.QueryGenerator; -import org.jeecg.common.util.oConvertUtils; import org.jeecg.modules.cms.entity.CuttingInbound; import org.jeecg.modules.cms.entity.CuttingInboundDetail; +import org.jeecg.modules.cms.entity.CuttingInboundInventory; +import org.jeecg.modules.cms.entity.CuttingInventory; +import org.jeecg.modules.cms.mapper.CuttingInboundMapper; import org.jeecg.modules.cms.service.ICuttingInboundDetailService; +import org.jeecg.modules.cms.service.ICuttingInboundInventoryService; import org.jeecg.modules.cms.service.ICuttingInboundService; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -26,6 +23,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import lombok.extern.slf4j.Slf4j; +import org.jeecg.modules.cms.service.ICuttingInventoryService; +import org.jeecg.modules.cms.vo.CuttingInboundExportVo; import org.jeecgframework.poi.excel.ExcelImportUtil; import org.jeecgframework.poi.excel.def.NormalExcelConstants; import org.jeecgframework.poi.excel.entity.ExportParams; @@ -37,175 +36,328 @@ import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.servlet.ModelAndView; -import com.alibaba.fastjson.JSON; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.jeecg.common.aspect.annotation.AutoLog; - /** +/** * @Description: 鍒�鍏峰叆搴撳崟 * @Author: jeecg-boot - * @Date: 2025-07-28 + * @Date: 2025-07-28 * @Version: V1.0 */ -@Api(tags="鍒�鍏峰叆搴撳崟") +@Api(tags = "鍒�鍏峰叆搴撳崟") @RestController @RequestMapping("/cms/cuttingInbound") @Slf4j public class CuttingInboundController extends JeecgController<CuttingInbound, ICuttingInboundService> { - @Autowired - private ICuttingInboundService cuttingInboundService; + @Autowired + private ICuttingInboundService cuttingInboundService; - @Autowired - private ICuttingInboundDetailService cuttingInboundDetailService; - - /** - * 鍒嗛〉鍒楄〃鏌ヨ - * - * @param cuttingInbound - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ", notes="鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ") - @GetMapping(value = "/list") - public Result<IPage<CuttingInbound>> queryPageList(CuttingInbound cuttingInbound, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper<CuttingInbound> queryWrapper = QueryGenerator.initQueryWrapper(cuttingInbound, req.getParameterMap()); - Page<CuttingInbound> page = new Page<CuttingInbound>(pageNo, pageSize); - IPage<CuttingInbound> pageList = cuttingInboundService.page(page, queryWrapper); - return Result.OK(pageList); - } - - /** - * 娣诲姞 - * - * @param jSONObject - * @return - */ - @AutoLog(value = "鍒�鍏峰叆搴撳崟-娣诲姞") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-娣诲姞", notes="鍒�鍏峰叆搴撳崟-娣诲姞") - //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:add") - @PostMapping(value = "/add") - public Result<String> add(@RequestBody JSONObject jSONObject) { - CuttingInbound cuttingInbound = jSONObject.toJavaObject(CuttingInbound.class); - cuttingInbound.setOrderStatus("1"); - cuttingInboundService.saveOrUpdate(cuttingInbound); - //鍒犻櫎鍘熷叧鑱旀暟鎹� - List<CuttingInboundDetail> cuttingInboundDetailList = cuttingInboundDetailService.lambdaQuery().eq(CuttingInboundDetail::getOrderId,cuttingInbound.getId()).list(); - cuttingInboundDetailService.removeBatchByIds(cuttingInboundDetailList); - //娣诲姞鏂板叧鑱旀暟鎹� - JSONArray jsonArray = jSONObject.getJSONArray("detailData"); - List<CuttingInboundDetail> list = jsonArray.toJavaList(CuttingInboundDetail.class); - for (int i = 0; i < list.size(); i++) { - CuttingInboundDetail temp = list.get(i); - temp.setOrderId(cuttingInbound.getId()); - cuttingInboundDetailService.save(temp); - } - return Result.OK("鍏ュ簱鎴愬姛锛�"); - } - - /** - * 缂栬緫 - * - * @param cuttingInbound - * @return - */ - @AutoLog(value = "鍒�鍏峰叆搴撳崟-缂栬緫") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-缂栬緫", notes="鍒�鍏峰叆搴撳崟-缂栬緫") - //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result<String> edit(@RequestBody CuttingInbound cuttingInbound) { - cuttingInboundService.updateById(cuttingInbound); - return Result.OK("缂栬緫鎴愬姛!"); - } - - /** - * 閫氳繃id鍒犻櫎 - * - * @param id - * @return - */ - @AutoLog(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎", notes="鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:delete") - @DeleteMapping(value = "/delete") - public Result<String> delete(@RequestParam(name="id",required=true) String id) { - cuttingInboundService.removeById(id); - return Result.OK("鍒犻櫎鎴愬姛!"); - } - - /** - * 鎵归噺鍒犻櫎 - * - * @param ids - * @return - */ - @AutoLog(value = "鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎", notes="鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.cuttingInboundService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); - } - - /** - * 閫氳繃id鏌ヨ - * - * @param id - * @return - */ - //@AutoLog(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ") - @ApiOperation(value="鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ", notes="鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ") - @GetMapping(value = "/queryById") - public Result<CuttingInbound> queryById(@RequestParam(name="id",required=true) String id) { - CuttingInbound cuttingInbound = cuttingInboundService.getById(id); - if(cuttingInbound==null) { - return Result.error("鏈壘鍒板搴旀暟鎹�"); - } - return Result.OK(cuttingInbound); - } + @Autowired + private ICuttingInboundDetailService cuttingInboundDetailService; + @Autowired + private CuttingInboundMapper cuttingInboundMapper; + + @Autowired + private ICuttingInventoryService cuttingInventoryService; + @Autowired + private ICuttingInboundInventoryService cuttingInboundInventoryService; /** - * 瀵煎嚭excel - * - * @param request - * @param cuttingInbound - */ - //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:exportXls") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, CuttingInbound cuttingInbound) { - return super.exportXls(request, cuttingInbound, CuttingInbound.class, "鍒�鍏峰叆搴撳崟"); + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param cuttingInbound + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ", notes = "鍒�鍏峰叆搴撳崟-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<CuttingInbound>> queryPageList(CuttingInbound cuttingInbound, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<CuttingInbound> queryWrapper = QueryGenerator.initQueryWrapper(cuttingInbound, req.getParameterMap()); + Page<CuttingInbound> page = new Page<CuttingInbound>(pageNo, pageSize); + IPage<CuttingInbound> pageList = cuttingInboundService.page(page, queryWrapper); + return Result.OK(pageList); } /** - * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ + * 娣诲姞 + * + * @param jSONObject + * @return + */ + @AutoLog(value = "鍒�鍏峰叆搴撳崟-娣诲姞") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-娣诲姞", notes = "鍒�鍏峰叆搴撳崟-娣诲姞") + //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:add") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody JSONObject jSONObject) { + CuttingInbound cuttingInbound = jSONObject.toJavaObject(CuttingInbound.class); + cuttingInbound.setOrderStatus("1"); + cuttingInboundService.saveOrUpdate(cuttingInbound); + //鍒犻櫎鍘熷叧鑱旀暟鎹� + List<CuttingInboundDetail> cuttingInboundDetailList = cuttingInboundDetailService.lambdaQuery().eq(CuttingInboundDetail::getOrderId, cuttingInbound.getId()).list(); + cuttingInboundDetailService.removeBatchByIds(cuttingInboundDetailList); + //娣诲姞鏂板叧鑱旀暟鎹� + JSONArray jsonArray = jSONObject.getJSONArray("detailData"); + List<CuttingInboundDetail> list = jsonArray.toJavaList(CuttingInboundDetail.class); + for (int i = 0; i < list.size(); i++) { + CuttingInboundDetail temp = list.get(i); + temp.setOrderId(cuttingInbound.getId()); + cuttingInboundDetailService.save(temp); + } + return Result.OK("鍏ュ簱鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param cuttingInbound + * @return + */ + @AutoLog(value = "鍒�鍏峰叆搴撳崟-缂栬緫") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-缂栬緫", notes = "鍒�鍏峰叆搴撳崟-缂栬緫") + //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<String> edit(@RequestBody CuttingInbound cuttingInbound) { + cuttingInboundService.updateById(cuttingInbound); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎", notes = "鍒�鍏峰叆搴撳崟-閫氳繃id鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:delete") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name = "id", required = true) String id) { + cuttingInboundService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎", notes = "鍒�鍏峰叆搴撳崟-鎵归噺鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.cuttingInboundService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + //@AutoLog(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ") + @ApiOperation(value = "鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ", notes = "鍒�鍏峰叆搴撳崟-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<CuttingInbound> queryById(@RequestParam(name = "id", required = true) String id) { + CuttingInbound cuttingInbound = cuttingInboundService.getById(id); + if (cuttingInbound == null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(cuttingInbound); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param cuttingInbound + */ + //@RequiresPermissions("org.jeecg.modules:cms_cutting_inbound:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(CuttingInbound cuttingInbound, HttpServletRequest request) { +// return super.exportXls(request, cuttingInbound, CuttingInbound.class, "鍒�鍏峰叆搴撳崟"); + // 鑾峰彇鏌ヨ鏉′欢 + QueryWrapper<CuttingInbound> queryWrapper = QueryGenerator.initQueryWrapper(cuttingInbound, request.getParameterMap()); + + // 鏌ヨ涓昏〃鏁版嵁 + List<CuttingInbound> pageList = cuttingInboundService.list(queryWrapper); + + // 涓烘瘡涓富琛ㄦ暟鎹缃槑缁嗘暟鎹� + List<CuttingInboundExportVo> exportList = new ArrayList<>(); + for (CuttingInbound item : pageList) { + CuttingInboundExportVo exportVo = new CuttingInboundExportVo(); + // 澶嶅埗涓昏〃瀛楁 + exportVo.setId(item.getId()); + exportVo.setReceiver(item.getReceiver()); + exportVo.setReceiveTime(item.getReceiveTime()); + exportVo.setReceiveComment(item.getReceiveComment()); + exportVo.setConfirmer(item.getConfirmer()); + exportVo.setConfirmTime(item.getConfirmTime()); + exportVo.setConfirmComment(item.getConfirmComment()); + exportVo.setOrderStatus(item.getOrderStatus()); + + // 鏌ヨ骞惰缃槑缁嗘暟鎹� + List<CuttingInboundDetail> details = cuttingInboundDetailService.lambdaQuery() + .eq(CuttingInboundDetail::getOrderId, item.getId()) + .list(); + exportVo.setDetailList(details); + + exportList.add(exportVo); + } + + // 璁剧疆瀵煎嚭鍙傛暟 + ExportParams params = new ExportParams("鍒�鍏峰叆搴撳崟", "瀵煎嚭鏁版嵁"); + + // 杩斿洖Excel瑙嗗浘 + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + mv.addObject(NormalExcelConstants.PARAMS, params); + mv.addObject(NormalExcelConstants.DATA_LIST, exportList); + mv.addObject(NormalExcelConstants.CLASS, CuttingInboundExportVo.class); + + return mv; + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ //@RequiresPermissions("cms_cutting_inbound:importExcel") @RequestMapping(value = "/importExcel", method = RequestMethod.POST) public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, CuttingInbound.class); +// return super.importExcel(request, response, CuttingInbound.class); + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; + Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); + + for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { + MultipartFile file = entity.getValue(); + ImportParams params = new ImportParams(); + params.setTitleRows(1); + params.setHeadRows(1); + try { + // 瑙f瀽Excel鏂囦欢 + List<CuttingInboundExportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), CuttingInboundExportVo.class, params); + + // 璋冪敤Service灞傚鐞嗗鍏ラ�昏緫 + return cuttingInboundService.importExcelData(list); + } catch (org.jeecgframework.poi.exception.excel.ExcelImportException e) { + log.error("Excel瀵煎叆寮傚父", e); + return Result.error("Excel鏁版嵁鏍煎紡閿欒锛岃妫�鏌ユ暟鎹槸鍚︾鍚堟ā鏉胯姹�"); + } catch (Exception e) { + log.error("瀵煎叆澶辫触", e); + return Result.error("瀵煎叆澶辫触: " + e.getMessage()); + } + } + return Result.error("瀵煎叆澶辫触"); } - /** - * 鏍规嵁鍏ュ簱id鏌ヨ鍏ュ簱鏄庣粏 - * - * @param orderId - * @return - */ - @GetMapping("/detailList") - public Result<?> detailList(@RequestParam("orderId") String orderId) { - List<Map<String, Object>> list = cuttingInboundDetailService.detailList(orderId); - return Result.ok(list); - } + /** + * 鏍规嵁鍏ュ簱id鏌ヨ鍏ュ簱鏄庣粏 + * + * @param orderId + * @return + */ + @GetMapping("/detailList") + public Result<?> detailList(@RequestParam("orderId") String orderId) { + List<Map<String, Object>> list = cuttingInboundDetailService.detailList(orderId); + return Result.ok(list); + } + + + /* + * 鐢熸垚鍞竴鏉$爜鐨勬柟娉� + */ + private String generateUniqueBarcode(String cuttingId, int index) { + // 鏉$爜鐢熸垚瑙勫垯绀轰緥锛氬垁鍏稩D + 搴忓彿(4浣�) + 闅忔満鏁� + return cuttingId + String.format("%04d", index + 1) + (int) (Math.random() * 10000); + } + @GetMapping("/submit") + public Result<?> submit(@RequestParam("orderId") String orderId) { + // cuttingInboundService.submit(orderId); + // return Result.ok("鎻愪氦鎴愬姛"); + try { + // 1. 鏇存柊鍏ュ簱鍗曠姸鎬� + CuttingInbound cuttingInbound = cuttingInboundService.getById(orderId); + if (cuttingInbound == null) { + return Result.error("鏈壘鍒板搴旂殑鍏ュ簱鍗�"); + } + + // 妫�鏌ュ叆搴撳崟鐘舵�侊紝鍙厑璁哥姸鎬佷负"1"鐨勫叆搴撳崟鎻愪氦 + if (!"1".equals(cuttingInbound.getOrderStatus())) { + return Result.error("鍙湁鐘舵�佷负鏈彁浜ょ殑鍏ュ簱鍗曟墠鑳芥墽琛屾彁浜ゆ搷浣�"); + } + + // 2. 鏇存柊鐘舵�佷负宸叉彁浜� + cuttingInbound.setOrderStatus("2"); + boolean updateResult = cuttingInboundService.updateById(cuttingInbound); + if (!updateResult) { + return Result.error("鏇存柊鍏ュ簱鍗曠姸鎬佸け璐�"); + } + + // 3. 鑾峰彇鍏ュ簱鏄庣粏 + List<CuttingInboundDetail> detailList = cuttingInboundDetailService.lambdaQuery() + .eq(CuttingInboundDetail::getOrderId, orderId) + .list(); + + // 鐢ㄤ簬缁熻鎬绘暟閲� + + // 4. 鏍规嵁鏄庣粏鏁伴噺鐢熸垚搴撳瓨璁板綍鍜屾潯鐮� + int totalSubmitted = 0; + for (CuttingInboundDetail detail : detailList) { + // 鏍规嵁鏄庣粏涓殑鏁伴噺鐢熸垚瀵瑰簲鏁伴噺鐨勫簱瀛樿褰時eceive_number + int quantity = detail.getReceiveNumber() != null ? detail.getReceiveNumber() : 0; + totalSubmitted = 0; + for (int i = 0; i < quantity; i++) { + totalSubmitted += quantity; + // 涓烘瘡涓垁鍏风敓鎴愮嫭绔嬬殑搴撳瓨璁板綍 + CuttingInventory cuttingInventory = new CuttingInventory(); + cuttingInventory.setCuttingId(detail.getCuttingId()); + // 涓烘瘡涓垁鍏风敓鎴愬敮涓�鏉$爜 + cuttingInventory.setCuttingBarcode(generateUniqueBarcode(detail.getCuttingId(), i)); + // 璁剧疆搴撳瓨鐘舵�佷负鍦ㄥ簱 + cuttingInventory.setInventoryStatus("姝e父"); + // 璁剧疆褰撳墠瀵垮懡涓�100 + cuttingInventory.setCurrentLife(BigDecimal.valueOf(100)); + // 淇濆瓨鍒板簱瀛樿〃 + boolean saveResult = cuttingInventoryService.save(cuttingInventory); + if (!saveResult) { + return Result.error("淇濆瓨搴撳瓨璁板綍澶辫触"); + } + + // 寤虹珛鍏ュ簱鍗曚笌搴撳瓨鐨勫叧鑱斿叧绯� + CuttingInboundInventory cuttingInboundInventory = new CuttingInboundInventory(); + cuttingInboundInventory.setOrderId(orderId); + cuttingInboundInventory.setInventoryId(cuttingInventory.getId()); + + // 淇濆瓨鍏宠仈鍏崇郴 + boolean relationSaveResult = cuttingInboundInventoryService.save(cuttingInboundInventory); + if (!relationSaveResult) { + return Result.error("淇濆瓨鍏宠仈鍏崇郴澶辫触"); + } + } + } + Map<String, Object> result = new HashMap<>(); + result.put("message", "鎻愪氦鎴愬姛"); + result.put("totalSubmitted", totalSubmitted); + return Result.ok("鎻愪氦鎴愬姛"); + } catch (Exception e) { + log.error("鎻愪氦鍏ュ簱鍗曞け璐ワ紝orderId: " + orderId, e); + return Result.error("鎻愪氦澶辫触: " + e.getMessage()); + } + } } + + diff --git a/src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java b/src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java index fd987e0..76e228b 100644 --- a/src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java +++ b/src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java @@ -48,7 +48,7 @@ @ApiModelProperty(value = "鍏ュ簱鍗�") private String orderId; /**鍒�鍏稩D*/ - @Excel(name = "鍒�鍏稩D", width = 15) + @Excel(name = "鍒�鍏稩D", width = 15,dictTable = "cms_cutting_tool",dicCode = "id",dicText = "cutting_code") @ApiModelProperty(value = "鍒�鍏稩D") private String cuttingId; /**鍏ュ簱鏁伴噺*/ diff --git a/src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java b/src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java index 4b6649c..f9c7d7b 100644 --- a/src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java +++ b/src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java @@ -55,6 +55,7 @@ /**鍒�鍏稩D*/ @Excel(name = "鍒�鍏稩D", width = 15) @ApiModelProperty(value = "鍒�鍏稩D") + @Dict(dictTable = "cms_cutting_tool",dicCode="id",dicText = "cutting_code") private String cuttingId; /**鍒�鍏锋潯鐮�*/ @Excel(name = "鍒�鍏锋潯鐮�", width = 15) diff --git a/src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java b/src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java index 5090cd9..e0afd0b 100644 --- a/src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java +++ b/src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java @@ -2,9 +2,12 @@ import java.util.List; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.cms.entity.CuttingInbound; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.cms.vo.CuttingInboundExportVo; /** * @Description: 鍒�鍏峰叆搴撳崟 @@ -14,4 +17,6 @@ */ public interface CuttingInboundMapper extends BaseMapper<CuttingInbound> { + List<CuttingInboundExportVo> exportList(@Param(Constants.WRAPPER) QueryWrapper<CuttingInboundExportVo> queryWrapper); + } diff --git a/src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml b/src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml index 9745da6..8a3b768 100644 --- a/src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml +++ b/src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml @@ -2,4 +2,22 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.cms.mapper.CuttingInboundMapper"> + <select id="exportList" resultType="org.jeecg.modules.cms.vo.CuttingInboundExportVo"> + SELECT + t1.id, + t1.order_status AS oderStatus, + t1.receiver AS receiver, + t1.receive_time AS receiveTime, + t1.receive_comment AS receiveComment, + t1.confirmer AS confirmer, + t1.confirm_time AS confirmTime, + t1.confirm_comment AS confirmComment, + t2.order_id AS orderId, + t2.cutting_id AS cuttingId, + t2.receive_number AS receiveNumber + FROM + cms_cutting_inbound t1 + LEFT JOIN + cms_cutting_inbound_detail t2 on t1.id=t2.order_id + </select> </mapper> \ No newline at end of file diff --git a/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java b/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java index c34fa1d..836a042 100644 --- a/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java +++ b/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java @@ -15,4 +15,5 @@ public interface ICuttingInboundDetailService extends IService<CuttingInboundDetail> { public List<Map<String, Object>> detailList(String orderId); + } diff --git a/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java b/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java index 3cdc08a..c01d8f1 100644 --- a/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java +++ b/src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java @@ -1,7 +1,11 @@ package org.jeecg.modules.cms.service; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.cms.entity.CuttingInbound; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.cms.vo.CuttingInboundExportVo; + +import java.util.List; /** * @Description: 鍒�鍏峰叆搴撳崟 @@ -10,5 +14,5 @@ * @Version: V1.0 */ public interface ICuttingInboundService extends IService<CuttingInbound> { - + Result<?> importExcelData(List<CuttingInboundExportVo> list); } diff --git a/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java b/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java index 4ca9708..991f67f 100644 --- a/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java +++ b/src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java @@ -1,11 +1,20 @@ package org.jeecg.modules.cms.service.impl; +import org.jeecg.common.api.vo.Result; import org.jeecg.modules.cms.entity.CuttingInbound; +import org.jeecg.modules.cms.entity.CuttingInboundDetail; import org.jeecg.modules.cms.mapper.CuttingInboundMapper; import org.jeecg.modules.cms.service.ICuttingInboundService; +import org.jeecg.modules.cms.service.ICuttingInboundDetailService; +import org.jeecg.modules.cms.vo.CuttingInboundExportVo; import org.springframework.stereotype.Service; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; /** * @Description: 鍒�鍏峰叆搴撳崟 @@ -15,5 +24,76 @@ */ @Service public class CuttingInboundServiceImpl extends ServiceImpl<CuttingInboundMapper, CuttingInbound> implements ICuttingInboundService { + @Autowired + private ICuttingInboundDetailService cuttingInboundDetailService; // 娉ㄥ叆浠庤〃鏈嶅姟 + /** + * 閫氳繃Excel瀵煎叆鍒�鍏峰叆搴撳崟鏁版嵁 + * + * @param list 寰呭鍏ョ殑鏁版嵁鍒楄〃 + * @return 瀵煎叆缁撴灉 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public Result<?> importExcelData(List<CuttingInboundExportVo> list) { +// try { +// for (CuttingInboundExportVo exportVo : list) { +// // 淇濆瓨涓昏〃鏁版嵁 +// CuttingInbound cuttingInbound = new CuttingInbound(); +// cuttingInbound.setReceiver(exportVo.getReceiver()); +// cuttingInbound.setReceiveTime(exportVo.getReceiveTime()); +// cuttingInbound.setReceiveComment(exportVo.getReceiveComment()); +// cuttingInbound.setConfirmer(exportVo.getConfirmer()); +// cuttingInbound.setConfirmTime(exportVo.getConfirmTime()); +// cuttingInbound.setConfirmComment(exportVo.getConfirmComment()); +// cuttingInbound.setOrderStatus(exportVo.getOrderStatus()); +// +// // 淇濆瓨涓昏〃鏁版嵁浠ヨ幏鍙朓D +// this.save(cuttingInbound); +// +// // 鑾峰彇涓昏〃ID +// String orderId = cuttingInbound.getId(); +// +// // 澶勭悊浠庤〃鏁版嵁 +// List<CuttingInboundDetail> detailList = exportVo.getDetailList(); +// if (detailList != null && !detailList.isEmpty()) { +// for (CuttingInboundDetail detail : detailList) { +// detail.setOrderId(orderId); // 璁剧疆澶栭敭鍏宠仈 +// cuttingInboundDetailService.save(detail); +// } +// } +// } +// return Result.ok("瀵煎叆鎴愬姛"); +// } catch (Exception e) { +// log.error("瀵煎叆澶辫触", e); +// return Result.error("瀵煎叆澶辫触: " + e.getMessage()); +// } +// } + for (CuttingInboundExportVo exportVo : list) { + // 淇濆瓨涓昏〃鏁版嵁 + CuttingInbound cuttingInbound = new CuttingInbound(); + cuttingInbound.setReceiver(exportVo.getReceiver()); + cuttingInbound.setReceiveTime(exportVo.getReceiveTime()); + cuttingInbound.setReceiveComment(exportVo.getReceiveComment()); + cuttingInbound.setConfirmer(exportVo.getConfirmer()); + cuttingInbound.setConfirmTime(exportVo.getConfirmTime()); + cuttingInbound.setConfirmComment(exportVo.getConfirmComment()); + cuttingInbound.setOrderStatus(exportVo.getOrderStatus()); + // 淇濆瓨涓昏〃鏁版嵁浠ヨ幏鍙朓D + this.save(cuttingInbound); + + // 鑾峰彇涓昏〃ID + String orderId = cuttingInbound.getId(); + + // 澶勭悊浠庤〃鏁版嵁 + List<CuttingInboundDetail> detailList = exportVo.getDetailList(); + if (detailList != null && !detailList.isEmpty()) { + for (CuttingInboundDetail detail : detailList) { + detail.setOrderId(orderId); // 璁剧疆澶栭敭鍏宠仈 + cuttingInboundDetailService.save(detail); + } + } + } + return Result.ok("瀵煎叆鎴愬姛"); + } } diff --git a/src/main/java/org/jeecg/modules/cms/vo/CuttingInboundExportVo.java b/src/main/java/org/jeecg/modules/cms/vo/CuttingInboundExportVo.java new file mode 100644 index 0000000..6bbbf44 --- /dev/null +++ b/src/main/java/org/jeecg/modules/cms/vo/CuttingInboundExportVo.java @@ -0,0 +1,117 @@ +package org.jeecg.modules.cms.vo; + +import org.jeecg.modules.cms.entity.CuttingInboundDetail; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.jeecgframework.poi.excel.annotation.ExcelCollection; +import java.util.List; + +public class CuttingInboundExportVo { + /** 涓婚敭 */ + @Excel(name = "鍏ュ簱鍗�", width = 15) + private String id; + + /** 鍏ュ簱浜� */ + @Excel(name = "鍏ュ簱浜�", width = 15,dictTable = "sys_user",dicCode = "id",dicText = "realname") + private String receiver; + + /** 鍏ュ簱鏃堕棿 */ + @Excel(name = "鍏ュ簱鏃堕棿", width = 20, format = "yyyy-MM-dd HH:mm:ss") + private java.util.Date receiveTime; + + /** 鍏ュ簱璇存槑 */ + @Excel(name = "鍏ュ簱璇存槑", width = 15) + private String receiveComment; + + /** 纭浜� */ + @Excel(name = "纭浜�", width = 15,dictTable = "sys_user",dicCode = "id",dicText = "realname") + private String confirmer; + + /** 纭鏃堕棿 */ + @Excel(name = "纭鏃堕棿", width = 20, format = "yyyy-MM-dd HH:mm:ss") + private java.util.Date confirmTime; + + /** 纭鎰忚 */ + @Excel(name = "纭鎰忚", width = 15) + private String confirmComment; + + /** 璁㈠崟鐘舵�� */ + @Excel(name = "璁㈠崟鐘舵��", width = 15) + private String orderStatus; + + // 鏄庣粏闆嗗悎 + @ExcelCollection(name = "鍏ュ簱鏄庣粏") + private List<CuttingInboundDetail> detailList; + + // getter鍜宻etter鏂规硶... + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getReceiver() { + return receiver; + } + + public void setReceiver(String receiver) { + this.receiver = receiver; + } + + public java.util.Date getReceiveTime() { + return receiveTime; + } + + public void setReceiveTime(java.util.Date receiveTime) { + this.receiveTime = receiveTime; + } + + public String getReceiveComment() { + return receiveComment; + } + + public void setReceiveComment(String receiveComment) { + this.receiveComment = receiveComment; + } + + public String getConfirmer() { + return confirmer; + } + + public void setConfirmer(String confirmer) { + this.confirmer = confirmer; + } + + public java.util.Date getConfirmTime() { + return confirmTime; + } + + public void setConfirmTime(java.util.Date confirmTime) { + this.confirmTime = confirmTime; + } + + public String getConfirmComment() { + return confirmComment; + } + + public void setConfirmComment(String confirmComment) { + this.confirmComment = confirmComment; + } + + public String getOrderStatus() { + return orderStatus; + } + + public void setOrderStatus(String orderStatus) { + this.orderStatus = orderStatus; + } + + public List<CuttingInboundDetail> getDetailList() { + return detailList; + } + + public void setDetailList(List<CuttingInboundDetail> detailList) { + this.detailList = detailList; + } +} diff --git a/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java b/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java index c03d5e4..fa8ba2a 100644 --- a/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java +++ b/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java @@ -15,6 +15,8 @@ String MAINTENANCE_CODE_RULE = "MaintenanceCodeRule"; // 缁翠慨宸ュ崟缂栫爜瑙勫垯 String REPAIR_ORDER_CODE_RULE = "RepairOrderCodeRule"; + // 鐗╂枡鎷夊姩缂栫爜瑙勫垯 + String MATERIAL_TRANSFER_CODE_RULE = "MaterialTransferCodeRule"; /** * 宀椾綅缂栫爜 diff --git a/src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java b/src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java index a2fe846..461882f 100644 --- a/src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java +++ b/src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java @@ -10,8 +10,10 @@ import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; +import org.jeecg.modules.eam.constant.BusinessCodeConst; import org.jeecg.modules.mes.entity.MesMaterialTransferRequest; import org.jeecg.modules.mes.service.IMesMaterialTransferRequestService; +import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; @@ -21,149 +23,156 @@ import java.util.Arrays; /** -* @Description: 鐗╂枡鎷夊姩鐢宠 -* @Author: jeecg-boot -* @Date: 2025-07-04 -* @Version: V1.0 -*/ -@Api(tags="鐗╂枡鎷夊姩鐢宠") + * @Description: 鐗╂枡鎷夊姩鐢宠 + * @Author: jeecg-boot + * @Date: 2025-07-04 + * @Version: V1.0 + */ +@Api(tags = "鐗╂枡鎷夊姩鐢宠") @RestController @RequestMapping("/mes/mesMaterialTransferRequest") @Slf4j public class MesMaterialTransferRequestController extends JeecgController<MesMaterialTransferRequest, IMesMaterialTransferRequestService> { - @Autowired - private IMesMaterialTransferRequestService mesMaterialTransferRequestService; + @Autowired + private IMesMaterialTransferRequestService mesMaterialTransferRequestService; + @Autowired + private ISysBusinessCodeRuleService businessCodeRuleService; - /** - * 鍒嗛〉鍒楄〃鏌ヨ - * - * @param mesMaterialTransferRequest - * @param pageNo - * @param pageSize - * @param req - * @return - */ - //@AutoLog(value = "鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ", notes="鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ") - @GetMapping(value = "/list") - public Result<IPage<MesMaterialTransferRequest>> queryPageList(MesMaterialTransferRequest mesMaterialTransferRequest, - @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, - @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, - HttpServletRequest req) { - QueryWrapper<MesMaterialTransferRequest> queryWrapper = QueryGenerator.initQueryWrapper(mesMaterialTransferRequest, req.getParameterMap()); - Page<MesMaterialTransferRequest> page = new Page<MesMaterialTransferRequest>(pageNo, pageSize); - IPage<MesMaterialTransferRequest> pageList = mesMaterialTransferRequestService.page(page, queryWrapper); - return Result.OK(pageList); - } + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param mesMaterialTransferRequest + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ", notes = "鐗╂枡鎷夊姩鐢宠-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<MesMaterialTransferRequest>> queryPageList(MesMaterialTransferRequest mesMaterialTransferRequest, + @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, + @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<MesMaterialTransferRequest> queryWrapper = QueryGenerator.initQueryWrapper(mesMaterialTransferRequest, req.getParameterMap()); + Page<MesMaterialTransferRequest> page = new Page<MesMaterialTransferRequest>(pageNo, pageSize); + IPage<MesMaterialTransferRequest> pageList = mesMaterialTransferRequestService.page(page, queryWrapper); + return Result.OK(pageList); + } - /** - * 娣诲姞 - * - * @param mesMaterialTransferRequest - * @return - */ - @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-娣诲姞") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-娣诲姞", notes="鐗╂枡鎷夊姩鐢宠-娣诲姞") - //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:add") - @PostMapping(value = "/add") - public Result<String> add(@RequestBody MesMaterialTransferRequest mesMaterialTransferRequest) { - mesMaterialTransferRequestService.save(mesMaterialTransferRequest); - return Result.OK("娣诲姞鎴愬姛锛�"); - } + /** + * 娣诲姞 + * + * @param request + * @return + */ + @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-娣诲姞") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-娣诲姞", notes = "鐗╂枡鎷夊姩鐢宠-娣诲姞") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody MesMaterialTransferRequest request) { + String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MATERIAL_TRANSFER_CODE_RULE); + request.setRequestCode(codeSeq); + boolean b = mesMaterialTransferRequestService.addMaterialTransferRequest(request); + if(!b) { + return Result.error("娣诲姞澶辫触锛�"); + } + return Result.OK("娣诲姞鎴愬姛锛�"); + } - /** - * 缂栬緫 - * - * @param mesMaterialTransferRequest - * @return - */ - @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-缂栬緫") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-缂栬緫", notes="鐗╂枡鎷夊姩鐢宠-缂栬緫") - //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:edit") - @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) - public Result<String> edit(@RequestBody MesMaterialTransferRequest mesMaterialTransferRequest) { - mesMaterialTransferRequestService.updateById(mesMaterialTransferRequest); - return Result.OK("缂栬緫鎴愬姛!"); - } + /** + * 缂栬緫 + * + * @param mesMaterialTransferRequest + * @return + */ + @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-缂栬緫") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-缂栬緫", notes = "鐗╂枡鎷夊姩鐢宠-缂栬緫") + //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST}) + public Result<String> edit(@RequestBody MesMaterialTransferRequest mesMaterialTransferRequest) { + mesMaterialTransferRequestService.updateById(mesMaterialTransferRequest); + return Result.OK("缂栬緫鎴愬姛!"); + } - /** - * 閫氳繃id鍒犻櫎 - * - * @param id - * @return - */ - @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎", notes="鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:delete") - @DeleteMapping(value = "/delete") - public Result<String> delete(@RequestParam(name="id",required=true) String id) { - mesMaterialTransferRequestService.removeById(id); - return Result.OK("鍒犻櫎鎴愬姛!"); - } + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎", notes = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:delete") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name = "id", required = true) String id) { + mesMaterialTransferRequestService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } - /** - * 鎵归噺鍒犻櫎 - * - * @param ids - * @return - */ - @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎", notes="鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎") - //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:deleteBatch") - @DeleteMapping(value = "/deleteBatch") - public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { - this.mesMaterialTransferRequestService.removeByIds(Arrays.asList(ids.split(","))); - return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); - } + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎", notes = "鐗╂枡鎷夊姩鐢宠-鎵归噺鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { + this.mesMaterialTransferRequestService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); + } - /** - * 閫氳繃id鏌ヨ - * - * @param id - * @return - */ - //@AutoLog(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ") - @ApiOperation(value="鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ", notes="鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ") - @GetMapping(value = "/queryById") - public Result<MesMaterialTransferRequest> queryById(@RequestParam(name="id",required=true) String id) { - MesMaterialTransferRequest mesMaterialTransferRequest = mesMaterialTransferRequestService.getById(id); - if(mesMaterialTransferRequest==null) { - return Result.error("鏈壘鍒板搴旀暟鎹�"); - } - return Result.OK(mesMaterialTransferRequest); - } + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + //@AutoLog(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ") + @ApiOperation(value = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ", notes = "鐗╂枡鎷夊姩鐢宠-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<MesMaterialTransferRequest> queryById(@RequestParam(name = "id", required = true) String id) { + MesMaterialTransferRequest mesMaterialTransferRequest = mesMaterialTransferRequestService.getById(id); + if (mesMaterialTransferRequest == null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(mesMaterialTransferRequest); + } - /** - * 瀵煎嚭excel - * - * @param request - * @param mesMaterialTransferRequest - */ - //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:exportXls") - @RequestMapping(value = "/exportXls") - public ModelAndView exportXls(HttpServletRequest request, MesMaterialTransferRequest mesMaterialTransferRequest) { - return super.exportXls(request, mesMaterialTransferRequest, MesMaterialTransferRequest.class, "鐗╂枡鎷夊姩鐢宠"); - } + /** + * 瀵煎嚭excel + * + * @param request + * @param mesMaterialTransferRequest + */ + //@RequiresPermissions("org.jeecg.modules:mes_material_transfer_request:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, MesMaterialTransferRequest mesMaterialTransferRequest) { + return super.exportXls(request, mesMaterialTransferRequest, MesMaterialTransferRequest.class, "鐗╂枡鎷夊姩鐢宠"); + } - /** + /** * 閫氳繃excel瀵煎叆鏁版嵁 - * - * @param request - * @param response - * @return - */ - //@RequiresPermissions("mes_material_transfer_request:importExcel") - @RequestMapping(value = "/importExcel", method = RequestMethod.POST) - public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { - return super.importExcel(request, response, MesMaterialTransferRequest.class); - } - /* - * 閫氳繃workOrderId 鏌ヨmesMaterialTransferRequest鏁版嵁 - *@param workOrderId - * */ + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("mes_material_transfer_request:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, MesMaterialTransferRequest.class); + } + + /* + * 閫氳繃workOrderId 鏌ヨmesMaterialTransferRequest鏁版嵁 + *@param workOrderId + * */ @GetMapping(value = "/queryMaterialTransferRequestByWorkOrderId") - public Result<?> queryMaterialTransferRequestByWorkOrderId(@RequestParam(name="workOrderId",required=true) String workOrderId) { - return Result.OK(mesMaterialTransferRequestService.queryMaterialTransferRequestByWorkOrderId(workOrderId)); + public Result<?> queryMaterialTransferRequestByWorkOrderId(@RequestParam(name = "workOrderId", required = true) String workOrderId) { + return Result.OK(mesMaterialTransferRequestService.queryMaterialTransferRequestByWorkOrderId(workOrderId)); } } diff --git a/src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java b/src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java index af2443c..8adcc8e 100644 --- a/src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java +++ b/src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java @@ -57,16 +57,22 @@ private String requestCode; /**宸ュ崟ID*/ @ApiModelProperty(value = "宸ュ崟ID") + @Dict(dictTable = "mes_production_work_order", dicText = "work_order_code", dicCode = "id") private String workOrderId; /**SAP棰勭暀鍙�*/ @ApiModelProperty(value = "SAP棰勭暀鍙�") private String reservationCode; /**鍙戝竷鐘舵��*/ - @Dict(dicCode = "publish_status") + @Dict(dicCode = "material_transfer_publish_status") @ApiModelProperty(value = "鍙戝竷鐘舵��") private String publishStatus; + /**鍙戝竷鏃堕棿*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鍙戝竷鏃堕棿") + private Date publishTime; /**璇锋眰鐘舵��*/ - @Dict(dicCode = "request_status") + @Dict(dicCode = "material_transfer_request_status") @ApiModelProperty(value = "璇锋眰鐘舵��") private String requestStatus; /**璇锋眰鏃堕棿*/ @@ -74,19 +80,21 @@ @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "璇锋眰鏃堕棿") private Date requestTime; - /**鍘熷簱瀛樺湴*/ - @ApiModelProperty(value = "鍘熷簱瀛樺湴") + /**璧疯繍搴撳瓨鍦�*/ + @ApiModelProperty(value = "璧疯繍搴撳瓨鍦�") + @Dict(dicCode = "original_warehouse_list") private String originalWarehouseId; /**鐩爣搴撳瓨鍦�*/ @ApiModelProperty(value = "鐩爣搴撳瓨鍦�") + @Dict(dictTable = "base_line_side_warehouse", dicText = "warehouse_name", dicCode = "id") private String targetWarehouseId; /**浼樺厛绾э紙鎷夊姩绫诲瀷锛�*/ @Dict(dicCode = "material_transfer_category") @ApiModelProperty(value = "鎷夊姩绫诲瀷") private String materialTransferCategory; /**鏈�鏅氶厤閫佹椂闂�*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") - @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") @ApiModelProperty(value = "鏈�鏅氶厤閫佹椂闂�") private Date latestDeliveryTime; /**鐗╂枡缂栫爜*/ @@ -101,17 +109,4 @@ /**瀹為檯鎷夊姩鏁伴噺*/ @ApiModelProperty(value = "瀹為檯鎷夊姩鏁伴噺") private Double actualQuantity; - /**杞﹂棿鍓╀綑鏁伴噺*/ - @ApiModelProperty(value = "杞﹂棿鍓╀綑鏁伴噺") - private Double remainingQuantity; - - @TableField(exist = false) - @ApiModelProperty(value = "宸ュ崟鍙�") - private String workOrderCode; - @TableField(exist = false) - @ApiModelProperty(value = "鐩爣搴撳瓨鍦�") - private String targetWarehouseName; - @TableField(exist = false) - @ApiModelProperty(value = "鍘熷簱瀛樺湴") - private String originalWarehouseName; } diff --git a/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferPublishStatus.java b/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferPublishStatus.java new file mode 100644 index 0000000..b084ceb --- /dev/null +++ b/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferPublishStatus.java @@ -0,0 +1,10 @@ +package org.jeecg.modules.mes.enums; + +/** + * 鐗╂枡鎷夊姩 鍙戝竷鐘舵�� + */ +public enum MaterialTransferPublishStatus { + WAIT_PUBLISH, //寰呭彂甯� + PUBLISHED, //宸插彂甯� + ; +} diff --git a/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferRequestStatus.java b/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferRequestStatus.java new file mode 100644 index 0000000..a6b226b --- /dev/null +++ b/src/main/java/org/jeecg/modules/mes/enums/MaterialTransferRequestStatus.java @@ -0,0 +1,11 @@ +package org.jeecg.modules.mes.enums; + +/** + * 鐗╂枡鎷夊姩璇锋眰鐘舵�� + */ +public enum MaterialTransferRequestStatus { + WAIT_REQUEST, //寰呰姹� + REQUESTED, //宸茶姹� + CHECKED_IN, //宸插叆搴� + ; +} diff --git a/src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java b/src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java index d84cc33..cae934a 100644 --- a/src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java +++ b/src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java @@ -13,4 +13,10 @@ */ public interface IMesMaterialTransferRequestService extends IService<MesMaterialTransferRequest> { List<MesMaterialTransferRequest> queryMaterialTransferRequestByWorkOrderId(String workOrderId); + + /** + * 鐗╂枡鎷夊姩鏂板 + * @param request + */ + boolean addMaterialTransferRequest(MesMaterialTransferRequest request); } diff --git a/src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java b/src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java index fb4b473..87c4ad6 100644 --- a/src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java +++ b/src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java @@ -1,10 +1,19 @@ package org.jeecg.modules.mes.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.jeecg.common.constant.CommonConstant; +import org.jeecg.common.exception.JeecgBootException; import org.jeecg.modules.mes.entity.MesMaterialTransferRequest; +import org.jeecg.modules.mes.entity.MesProductionWorkOrder; +import org.jeecg.modules.mes.enums.MaterialTransferPublishStatus; +import org.jeecg.modules.mes.enums.MaterialTransferRequestStatus; +import org.jeecg.modules.mes.enums.ProductionWorkOrderStatus; import org.jeecg.modules.mes.mapper.MesMaterialTransferRequestMapper; import org.jeecg.modules.mes.service.IMesMaterialTransferRequestService; +import org.jeecg.modules.mes.service.IMesProductionWorkOrderService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -17,8 +26,28 @@ @Service public class MesMaterialTransferRequestServiceImpl extends ServiceImpl<MesMaterialTransferRequestMapper, MesMaterialTransferRequest> implements IMesMaterialTransferRequestService { + @Autowired + private IMesProductionWorkOrderService productionWorkOrderService; + @Override public List<MesMaterialTransferRequest> queryMaterialTransferRequestByWorkOrderId(String workOrderId) { return baseMapper.queryMaterialTransferRequestByWorkOrderId(workOrderId); } + + @Override + @Transactional(rollbackFor = Exception.class) + public boolean addMaterialTransferRequest(MesMaterialTransferRequest request) { + MesProductionWorkOrder order = productionWorkOrderService.getById(request.getWorkOrderId()); + if(order == null){ + throw new JeecgBootException("鎺掍骇宸ュ崟涓嶅瓨鍦�"); + } + if(!ProductionWorkOrderStatus.PUBLISHED.name().equals(order.getWorkOrderStatus())){ + throw new JeecgBootException("鍙湁鍙戝竷鐘舵�佺殑鎺掍骇宸ュ崟鎵嶅彲鐢宠鐗╂枡"); + } + request.setPublishStatus(MaterialTransferPublishStatus.WAIT_PUBLISH.name()); + request.setRequestStatus(MaterialTransferRequestStatus.WAIT_REQUEST.name()); + request.setDelFlag(CommonConstant.DEL_FLAG_0); + this.getBaseMapper().insert(request); + return true; + } } diff --git a/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java b/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java index 583065a..c712f31 100644 --- a/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java +++ b/src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java @@ -36,4 +36,17 @@ return Result.OK(list); } + /** + * 鐗╂枡鎷夊姩閫夋嫨鐗╂枡浣跨敤 + * 鏍规嵁鎴愬搧銆佸崐鎴愬搧鐗╂枡鍙� 鏌ヨ鍙�夋嫨鐨勭墿鏂欐暟鎹� + * @param materialNumber 鎴愬搧銆佸崐鎴愬搧鐗╂枡缂栫爜 + * @return + */ + @ApiOperation(value = "鐗╂枡娓呭崟-閫氳繃鐗╂枡鍙锋煡璇�", notes = "鐗╂枡娓呭崟-閫氳繃鐗╂枡鍙锋煡璇�") + @GetMapping(value = "/queryByMaterialNumber") + public Result<?> queryByMaterialNumber(@RequestParam(name = "materialNumber") String materialNumber) { + List<PmsProcessBillMaterialsDetail> list = pmsProcessBillMaterialsDetailService.queryByMaterialNumber(materialNumber); + return Result.OK(list); + } + } diff --git a/src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java b/src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java index 802724a..319825a 100644 --- a/src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java +++ b/src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java @@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; +import java.util.List; import java.util.Map; /** @@ -16,4 +17,11 @@ public interface PmsProcessBillMaterialsDetailMapper extends BaseMapper<PmsProcessBillMaterialsDetail> { PmsProcessBillMaterialsDetail queryByMaterialId(@Param("materialId") String materialId); IPage<Map<String, Object>> getpmsProcessBillMaterialsDetailListData(IPage<Map> pageData, @Param("params")Map<String, String> paramMap); + /** + * 鐗╂枡鎷夊姩閫夋嫨鐗╂枡浣跨敤 + * 鏍规嵁鎴愬搧銆佸崐鎴愬搧鐗╂枡鍙� 鏌ヨ鍙�夋嫨鐨勭墿鏂欐暟鎹� + * @param materialNumber 鎴愬搧銆佸崐鎴愬搧鐗╂枡缂栫爜 + * @return + */ + List<PmsProcessBillMaterialsDetail> queryByMaterialNumber(String materialNumber); } diff --git a/src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml b/src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml index 3d45db9..c569fbd 100644 --- a/src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml +++ b/src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml @@ -14,4 +14,13 @@ AND material_name LIKE CONCAT('%', #{params.materialName}, '%') </if> </select> + <select id="queryByMaterialNumber" resultType="org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail"> + select DISTINCT t1.material_number, t1.material_name, t1.production_unit + from pms_process_bill_materials_detail t1 + where EXISTS(select t2.id + from pms_process_bill_materials t2 + where t2.material_number = #{materialNumber} + and t1.material_id = t2.id) + + </select> </mapper> \ No newline at end of file diff --git a/src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java b/src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java index 4a5e867..ec7809e 100644 --- a/src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java +++ b/src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java @@ -13,6 +13,11 @@ * @Version: V1.0 */ public interface IPmsProcessBillMaterialsDetailService extends IService<PmsProcessBillMaterialsDetail> { + /** + * 鏍规嵁鐗╂枡Id鏌ヨ鏄庣粏 + * @param materialId + * @return + */ List<PmsProcessBillMaterialsDetail> queryByMaterialId(String materialId); /** @@ -27,4 +32,12 @@ * @param collect */ void saveBatchDetail(String materialsId, List<OrderBomDTO> collect); + + /** + * 鐗╂枡鎷夊姩閫夋嫨鐗╂枡浣跨敤 + * 鏍规嵁鎴愬搧銆佸崐鎴愬搧鐗╂枡鍙� 鏌ヨ鍙�夋嫨鐨勭墿鏂欐暟鎹� + * @param materialNumber 鎴愬搧銆佸崐鎴愬搧鐗╂枡缂栫爜 + * @return + */ + List<PmsProcessBillMaterialsDetail> queryByMaterialNumber(String materialNumber); } diff --git a/src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java b/src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java index d8480a8..feec4a1 100644 --- a/src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java +++ b/src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java @@ -3,6 +3,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.pms.entity.PmsProcessBillMaterialsDetail; import org.jeecg.modules.pms.mapper.PmsProcessBillMaterialsDetailMapper; import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsDetailService; @@ -10,6 +11,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -46,4 +48,12 @@ List<PmsProcessBillMaterialsDetail> list = collect.stream().map(orderBomDTO -> new PmsProcessBillMaterialsDetail(materialsId, orderBomDTO)).collect(Collectors.toList()); super.saveBatch(list); } + + @Override + public List<PmsProcessBillMaterialsDetail> queryByMaterialNumber(String materialNumber) { + if (StringUtils.isBlank(materialNumber)) { + return Collections.emptyList(); + } + return this.getBaseMapper().queryByMaterialNumber(materialNumber); + } } -- Gitblit v1.9.3