新火炬后端单体项目初始化代码
cuilei
10 小时以前 8d0b466ef4fe497932e15c186688679e55a26f62
Merge remote-tracking branch 'origin/master'
已添加3个文件
已修改22个文件
1163 ■■■■■ 文件已修改
db/双林新火炬MES数据库设计.pdma.json 562 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/controller/LineSideWarehouseController.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/ILineSideWarehouseService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/base/service/impl/LineSideWarehouseServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/controller/CuttingInboundController.java 178 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/mapper/CuttingInboundMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/mapper/xml/CuttingInboundMapper.xml 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/ICuttingInboundDetailService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/ICuttingInboundService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/service/impl/CuttingInboundServiceImpl.java 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/cms/vo/CuttingInboundExportVo.java 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/controller/MesMaterialTransferRequestController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/entity/MesMaterialTransferRequest.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/enums/MaterialTransferPublishStatus.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/enums/MaterialTransferRequestStatus.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/service/IMesMaterialTransferRequestService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/mes/service/impl/MesMaterialTransferRequestServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/pms/controller/PmsProcessBillMaterialsDetailController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/pms/mapper/PmsProcessBillMaterialsDetailMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/pms/mapper/xml/PmsProcessBillMaterialsDetailMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/pms/service/IPmsProcessBillMaterialsDetailService.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/org/jeecg/modules/pms/service/impl/PmsProcessBillMaterialsDetailServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
db/Ë«ÁÖлð¾æMESÊý¾Ý¿âÉè¼Æ.pdma.json
@@ -2,9 +2,9 @@
  "name": "双林新火炬MES数据库设计",
  "describe": "描述双薪新火炬MES数据库设计详情",
  "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": "申请单ID",
          "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"
      ],
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);
     }
}
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);
}
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;
    }
}
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,7 +36,6 @@
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;
@@ -59,6 +57,13 @@
     @Autowired
     private ICuttingInboundDetailService cuttingInboundDetailService;
    
    @Autowired
    private CuttingInboundMapper cuttingInboundMapper;
    @Autowired
    private ICuttingInventoryService cuttingInventoryService;
    @Autowired
    private ICuttingInboundInventoryService cuttingInboundInventoryService;
    /**
     * åˆ†é¡µåˆ—表查询
     *
@@ -179,8 +184,47 @@
    */
    //@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, "刀具入库单");
    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;
    }
    /**
@@ -193,8 +237,32 @@
    //@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 {
                // è§£æž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查询入库明细
@@ -208,4 +276,88 @@
         return Result.ok(list);
     }
    /*
     * ç”Ÿæˆå”¯ä¸€æ¡ç çš„æ–¹æ³•
     */
    private String generateUniqueBarcode(String cuttingId, int index) {
        // æ¡ç ç”Ÿæˆè§„则示例:刀具ID + åºå·(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) {
                // æ ¹æ®æ˜Žç»†ä¸­çš„æ•°é‡ç”Ÿæˆå¯¹åº”数量的库存记录receive_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("正常");
                    // è®¾ç½®å½“前寿命为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());
        }
    }
}
src/main/java/org/jeecg/modules/cms/entity/CuttingInboundDetail.java
@@ -48,7 +48,7 @@
    @ApiModelProperty(value = "入库单")
    private String orderId;
    /**刀具ID*/
    @Excel(name = "刀具ID", width = 15)
    @Excel(name = "刀具ID", width = 15,dictTable = "cms_cutting_tool",dicCode = "id",dicText = "cutting_code")
    @ApiModelProperty(value = "刀具ID")
    private String cuttingId;
    /**入库数量*/
src/main/java/org/jeecg/modules/cms/entity/CuttingInventory.java
@@ -55,6 +55,7 @@
    /**刀具ID*/
    @Excel(name = "刀具ID", width = 15)
    @ApiModelProperty(value = "刀具ID")
    @Dict(dictTable = "cms_cutting_tool",dicCode="id",dicText = "cutting_code")
    private String cuttingId;
    /**刀具条码*/
    @Excel(name = "刀具条码", width = 15)
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);
}
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>
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);
}
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);
}
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());
//
//                // ä¿å­˜ä¸»è¡¨æ•°æ®ä»¥èŽ·å–ID
//                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());
            // ä¿å­˜ä¸»è¡¨æ•°æ®ä»¥èŽ·å–ID
            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("导入成功");
    }
}
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和setter方法...
    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;
    }
}
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";
    /**
     * å²—位编码
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;
@@ -33,6 +35,8 @@
public class MesMaterialTransferRequestController extends JeecgController<MesMaterialTransferRequest, IMesMaterialTransferRequestService> {
   @Autowired
   private IMesMaterialTransferRequestService mesMaterialTransferRequestService;
    @Autowired
    private ISysBusinessCodeRuleService businessCodeRuleService;
   /**
    * åˆ†é¡µåˆ—表查询
@@ -59,15 +63,19 @@
   /**
    *   æ·»åŠ 
    *
    * @param mesMaterialTransferRequest
     * @param request
    * @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);
    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("添加成功!");
   }
@@ -157,6 +165,7 @@
   public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
       return super.importExcel(request, response, MesMaterialTransferRequest.class);
   }
   /*
   * é€šè¿‡workOrderId æŸ¥è¯¢mesMaterialTransferRequest数据
   *@param workOrderId
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;
}
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, //已发布
    ;
}
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, //已入库
    ;
}
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);
}
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;
    }
}
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);
    }
}
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);
}
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>
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);
}
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);
    }
}