From c9d3f6285440719077a2ff48e922f94b0258fbc3 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期三, 20 八月 2025 16:54:21 +0800
Subject: [PATCH] 报工接口完善

---
 src/main/java/org/jeecg/modules/mes/service/impl/MesWorkReportingServiceImpl.java |   43 +++
 db/双林新火炬MES数据库设计.pdma.json                                                        |  560 ++++++++++++++++++++++++++++++++++++--------------
 src/main/java/org/jeecg/modules/mes/controller/MesWorkReportingController.java    |    6 
 src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java            |    2 
 src/main/java/org/jeecg/modules/mes/service/IMesWorkReportingService.java         |    2 
 src/main/java/org/jeecg/modules/qms/enums/PlanCategoryEnum.java                   |   16 +
 src/main/java/org/jeecg/modules/mes/entity/MesWorkReporting.java                  |    6 
 7 files changed, 463 insertions(+), 172 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 9295952..5e069ee 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.2",
+  "version": "4.9.4",
   "createdTime": "2025-3-10 16:38:19",
-  "updatedTime": "2025-8-18 15:02:20",
+  "updatedTime": "2025-8-20 16:04:03",
   "dbConns": [],
   "profile": {
     "default": {
@@ -632,7 +632,7 @@
       "#DDE5FF"
     ],
     "DDLToggleCase": "L",
-    "menuWidth": "364px"
+    "menuWidth": "304px"
   },
   "entities": [
     {
@@ -64779,24 +64779,6 @@
           "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": "",
@@ -64807,7 +64789,7 @@
           "notNull": false,
           "autoIncrement": false,
           "defaultValue": "",
-          "hideInGraph": true,
+          "hideInGraph": false,
           "refDict": "",
           "baseType": "FC9790A7-36B8-4A48-8F9A-BC1042BCFE64",
           "extProps": {},
@@ -64834,7 +64816,7 @@
         },
         {
           "defKey": "original_warehouse_id",
-          "defName": "璧峰搴撳瓨鍦�",
+          "defName": "鍘熷簱瀛樺湴",
           "comment": "",
           "type": "",
           "len": "",
@@ -64923,146 +64905,6 @@
           "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": [],
@@ -65901,6 +65743,397 @@
           "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": [],
@@ -69821,6 +70054,7 @@
         "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/mes/controller/MesWorkReportingController.java b/src/main/java/org/jeecg/modules/mes/controller/MesWorkReportingController.java
index e9b0225..c4cb1ad 100644
--- a/src/main/java/org/jeecg/modules/mes/controller/MesWorkReportingController.java
+++ b/src/main/java/org/jeecg/modules/mes/controller/MesWorkReportingController.java
@@ -67,9 +67,9 @@
    @ApiOperation(value="宸ュ崟鎶ュ伐-鏂板鎶ュ伐", notes="宸ュ崟鎶ュ伐-鏂板鎶ュ伐")
    //@RequiresPermissions("org.jeecg.modules:mes_work_reporting:add")
    @PostMapping(value = "/add")
-   public Result<String> add(@RequestBody MesWorkReporting mesWorkReporting) {
-       mesWorkReportingService.addReporting(mesWorkReporting);
-       return Result.OK("娣诲姞鎴愬姛锛�");
+   public Result<MesWorkReporting> add(@RequestBody MesWorkReporting mesWorkReporting) {
+       MesWorkReporting workReporting = mesWorkReportingService.addReporting(mesWorkReporting);
+       return Result.OK("娣诲姞鎴愬姛锛�", workReporting);
    }
 
    /**
diff --git a/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java b/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
index a153d3a..48ca5e5 100644
--- a/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
+++ b/src/main/java/org/jeecg/modules/mes/entity/MesProductionWorkOrder.java
@@ -115,7 +115,7 @@
 	/**瀹為檯鎶ュ伐鏁伴噺*/
 	@Excel(name = "瀹為檯鎶ュ伐鏁伴噺", width = 15)
     @ApiModelProperty(value = "瀹為檯鎶ュ伐鏁伴噺")
-    private BigDecimal actualQuantity;
+    private BigDecimal actualQuantity = BigDecimal.ZERO;
     /**宸茬敓浜ф墭鏁帮紙褰撳墠鐝宸茬敓浜х殑鎵樻暟閲忥紝姣忔鎶ュ伐鏃舵洿鏂帮級*/
     @Excel(name = "宸茬敓浜ф墭鏁�", width = 15)
     @ApiModelProperty(value = "宸茬敓浜ф墭鏁�")
diff --git a/src/main/java/org/jeecg/modules/mes/entity/MesWorkReporting.java b/src/main/java/org/jeecg/modules/mes/entity/MesWorkReporting.java
index d281e7e..60d4545 100644
--- a/src/main/java/org/jeecg/modules/mes/entity/MesWorkReporting.java
+++ b/src/main/java/org/jeecg/modules/mes/entity/MesWorkReporting.java
@@ -114,5 +114,11 @@
     @TableField(exist = false)
     @ApiModelProperty(value = "浠撳簱鍚嶇О")
     private String warehouseName;
+    @TableField(exist = false)
+    @ApiModelProperty(value = "浠撳簱缂栫爜")
+    private String warehouseCode;
+    @TableField(exist = false)
+    @ApiModelProperty(value = "鎶ュ伐绫诲瀷(鎴愬搧FINISHED銆佸崐鎴愬搧HALF)")
+    private String reportType;
 
 }
diff --git a/src/main/java/org/jeecg/modules/mes/service/IMesWorkReportingService.java b/src/main/java/org/jeecg/modules/mes/service/IMesWorkReportingService.java
index 08505bf..1ac5542 100644
--- a/src/main/java/org/jeecg/modules/mes/service/IMesWorkReportingService.java
+++ b/src/main/java/org/jeecg/modules/mes/service/IMesWorkReportingService.java
@@ -15,5 +15,5 @@
     List<MesWorkReporting> queryWorkReportingByWorkOrderId(String workOrderId);
     List<MesWorkReporting> queryWorkReportingByOrderId(String orderId);
 
-    void addReporting(MesWorkReporting mesWorkReporting);
+    MesWorkReporting addReporting(MesWorkReporting mesWorkReporting);
 }
diff --git a/src/main/java/org/jeecg/modules/mes/service/impl/MesWorkReportingServiceImpl.java b/src/main/java/org/jeecg/modules/mes/service/impl/MesWorkReportingServiceImpl.java
index 271c5aa..d5f8a99 100644
--- a/src/main/java/org/jeecg/modules/mes/service/impl/MesWorkReportingServiceImpl.java
+++ b/src/main/java/org/jeecg/modules/mes/service/impl/MesWorkReportingServiceImpl.java
@@ -34,6 +34,11 @@
 import org.jeecg.modules.pms.service.IPmsMaterialProcessService;
 import org.jeecg.modules.pms.service.IPmsProcessBillMaterialsService;
 import org.jeecg.modules.pms.vo.ProcessBillMaterialsDetailVo;
+import org.jeecg.modules.qms.entity.InspectionPlan;
+import org.jeecg.modules.qms.entity.InspectionPlanItem;
+import org.jeecg.modules.qms.enums.PlanCategoryEnum;
+import org.jeecg.modules.qms.service.IInspectionPlanItemService;
+import org.jeecg.modules.qms.service.IInspectionPlanService;
 import org.jeecg.modules.sap.request.OrderLoadRequest;
 import org.jeecg.modules.sap.request.OrderReportRequest;
 import org.jeecg.modules.sap.service.OrderLoadService;
@@ -88,6 +93,10 @@
     private OrderReportService orderReportService;
     @Autowired
     private OrderLoadService orderLoadService;
+    @Autowired
+    private IInspectionPlanService inspectionPlanService;
+    @Autowired
+    private IInspectionPlanItemService inspectionPlanItemService;
 
     @Override
     public List<MesWorkReporting> queryWorkReportingByWorkOrderId(String workOrderId) {
@@ -101,7 +110,7 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void addReporting(MesWorkReporting mesWorkReporting) {
+    public MesWorkReporting addReporting(MesWorkReporting mesWorkReporting) {
         MesProductionWorkOrder workOrder = mesProductionWorkOrderService.getById(mesWorkReporting.getWorkOrderId());
         if (workOrder == null) {
             throw new JeecgBootException("宸ュ崟涓嶅瓨鍦紒");
@@ -134,7 +143,9 @@
         int currentPallets = workOrder.getFinishedPallets() + 1;
         String batchNumber = yearLastTwo + dayOfYearStr + shiftGroup.getGroupCode() + currentPallets;
         mesWorkReporting.setBatchNumber(batchNumber)
+                .setWorkOrderCode(workOrder.getWorkOrderCode())
                 .setWarehouseId(lineSideWarehouse.getId())
+                .setWarehouseCode(lineSideWarehouse.getWarehouseCode())
                 .setReporter(Objects.requireNonNull(CommonUtils.getCurrentUser()).getUsername())
                 .setReportTime(new Date());
         String date = today.format(DateTimeFormatter.ofPattern("yyMMdd"));
@@ -144,11 +155,12 @@
             case FINISHED_PRODUCT:
                 //鎴愬搧鎶ュ伐
                 productReport(mesWorkReporting, workOrder, lineSideWarehouse);
+                //鐢熸垚妫�楠屽伐鍗�
+                generateInspectionOrder(mesWorkReporting, workOrder);
                 //鎷兼帴鎴愬搧鎶ュ伐鎵樺彿
                 String palletNumber4 = sysBusinessCodeRuleService.generateBusinessCodeSeq("WorkReportingPalletNumber4");
                 String finishedPalletNumber = material.getMaterialNumber() + date + palletNumber4;
-                mesWorkReporting.setPalletNumber(finishedPalletNumber);
-                //todo 鎵撳嵃鎴愬搧鎵樻爣绛俱�佹楠屾爣璇嗗崱銆佺Щ搴撳崟銆佸畬宸ユ楠屽伐鍗�
+                mesWorkReporting.setPalletNumber(finishedPalletNumber).setReportType("FINISHED");
                 break;
             case INNER_FLANGE:
             case OUTER_FLANGE:
@@ -158,7 +170,7 @@
                 Shift shift = shiftService.getById(workOrder.getShiftId());
                 String palletNumber6 = sysBusinessCodeRuleService.generateBusinessCodeSeq("WorkReportingPalletNumber6");
                 String halfPalletNumber = factory.getFactoryCode() + material.getMaterialNumber() + date + shift.getShiftCode() + palletNumber6;
-                mesWorkReporting.setPalletNumber(halfPalletNumber);
+                mesWorkReporting.setPalletNumber(halfPalletNumber).setReportType("HALF");
                 break;
         }
         //鏂板鎶ュ伐璁板綍
@@ -169,6 +181,8 @@
                 .setActualQuantity(workOrder.getActualQuantity().add(mesWorkReporting.getQuantity()))
                 .setFinishedPallets(workOrder.getFinishedPallets() + 1);
         mesProductionWorkOrderService.updateById(productionWorkUpdateOrder);
+        //杩斿洖鎶ュ伐璁板綍锛岀敤浜庢墭鏍囩鎵撳嵃
+        return mesWorkReporting;
     }
 
     //鍗婃垚鍝�(鍐呮硶鍏般�佸娉曞叞)銆佹垚鍝佹姤宸�
@@ -246,6 +260,27 @@
         }
     }
 
+    //鏍规嵁妫�楠屾柟妗堢敓鎴愭楠屽伐鍗�
+    private void generateInspectionOrder(MesWorkReporting mesWorkReporting, MesProductionWorkOrder workOrder) {
+        //1.鏍规嵁鐗╂枡缂栫爜鏌ヨ妫�楠屾柟妗�
+        InspectionPlan inspectionPlan = inspectionPlanService.list(new LambdaQueryWrapper<InspectionPlan>()
+                .eq(InspectionPlan::getMaterialNumber, workOrder.getMaterialNumber())
+                .eq(InspectionPlan::getPlanCategory, PlanCategoryEnum.COMPLETION_INSPECTION.name())
+                .eq(InspectionPlan::getPlanStatus, CommonConstant.STATUS_1)
+                .eq(InspectionPlan::getDelFlag, CommonConstant.DEL_FLAG_0)).stream().findFirst().orElse(null);
+        if (inspectionPlan == null) {
+            throw new JeecgBootException("鏈壘鍒拌鐗╂枡鐨勬楠屾柟妗堬紒");
+        }
+        List<InspectionPlanItem> inspectionPlanItemList = inspectionPlanItemService.list(new LambdaQueryWrapper<InspectionPlanItem>()
+                .eq(InspectionPlanItem::getPlanId, inspectionPlan.getId())
+                .orderByAsc(InspectionPlanItem::getSorter));
+        if (inspectionPlanItemList.isEmpty()) {
+            throw new JeecgBootException("鏈壘鍒拌鐗╂枡鐨勬楠屾柟妗堟楠岄」鏄庣粏锛�");
+        }
+        //2.鐢熸垚妫�楠屽伐鍗�
+        //todo 妫�楠屽伐鍗曠洰鍓嶈繕娌℃湁鐢熸垚浠g爜锛屾病鏈夊姛鑳�
+    }
+
     private List<MesMaterialLoading> deductQuantity(List<MesMaterialLoading> materialLoadingRecordList, BigDecimal quantity) {
         for (MesMaterialLoading mesMaterialLoading : materialLoadingRecordList) {
             if (mesMaterialLoading.getRemainingQuantity().compareTo(quantity) >= 0) {
diff --git a/src/main/java/org/jeecg/modules/qms/enums/PlanCategoryEnum.java b/src/main/java/org/jeecg/modules/qms/enums/PlanCategoryEnum.java
new file mode 100644
index 0000000..5a8024d
--- /dev/null
+++ b/src/main/java/org/jeecg/modules/qms/enums/PlanCategoryEnum.java
@@ -0,0 +1,16 @@
+package org.jeecg.modules.qms.enums;
+
+public enum PlanCategoryEnum {
+    FIRST_INSPECTION, //棣栨
+    ROUTING_INSPECTION, //宸℃
+    COMPLETION_INSPECTION; //瀹屽伐妫�
+
+    public static PlanCategoryEnum fromName(String name) {
+        for (PlanCategoryEnum category : PlanCategoryEnum.values()) {
+            if (category.name().equals(name)) {
+                return category;
+            }
+        }
+        return null;
+    }
+}

--
Gitblit v1.9.3