From 4bfe08d0c18a9316994e24391d06488fbdb6f9c5 Mon Sep 17 00:00:00 2001 From: git_rabbit Date: Fri, 30 Jan 2026 11:36:40 +0800 Subject: [PATCH] =?UTF-8?q?refactor(MES):=20=E6=9B=B4=E6=96=B0=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E8=AE=A2=E5=8D=95=E5=AF=BC=E5=85=A5=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=9A=84=E5=AD=97=E6=AE=B5=E5=91=BD=E5=90=8D=E5=92=8C=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将字段注释从"铸件"改为"成品"和"原材料"以更准确描述业务含义 - 移除对单位、材质和版本字段的非空验证,使其更符合业务需求 - 使用雪花算法替代GUID生成工作订单ID,提高ID生成效率 --- .../MES/Product/ProWorkorderImportService.cs | 46 ++++++------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/DOAN.Service/MES/Product/ProWorkorderImportService.cs b/DOAN.Service/MES/Product/ProWorkorderImportService.cs index 4689f68..0820365 100644 --- a/DOAN.Service/MES/Product/ProWorkorderImportService.cs +++ b/DOAN.Service/MES/Product/ProWorkorderImportService.cs @@ -62,7 +62,7 @@ namespace DOAN.Service.MES.product { ProWorkorder workorder = new ProWorkorder(); - //00 铸件品名 + //00 成品名称 ICell currentCell_01 = currentRow.GetCell(0); workorder.productionName = currentCell_01?.ToString(); if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName)) @@ -70,7 +70,7 @@ namespace DOAN.Service.MES.product continue; } - //01 铸件型号 + //01 成品型号 ICell currentCell_02 = currentRow.GetCell(1); workorder.productionCode = currentCell_02?.ToString(); if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode)) @@ -81,16 +81,12 @@ namespace DOAN.Service.MES.product //02 单位 ICell currentCell_04 = currentRow.GetCell(2); workorder.Unit = currentCell_04?.ToString(); - if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit)) - { - continue; - } - //3 plan_num + //3 计划数量 ICell currentCell_07 = currentRow.GetCell(3); workorder.PlanNum = (int)currentCell_07?.NumericCellValue; - //4 材质品名 + //4 原材料名称 ICell currentCell_11 = currentRow.GetCell(4); workorder.MaterialName = currentCell_11?.ToString(); if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName)) @@ -98,7 +94,7 @@ namespace DOAN.Service.MES.product continue; } - //5 材质牌号 + //5 原材料编号 ICell currentCell_12 = currentRow.GetCell(5); workorder.MaterialCode = currentCell_12?.ToString(); if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode)) @@ -106,13 +102,9 @@ namespace DOAN.Service.MES.product continue; } - //6 材质 + //6 原材料材质 ICell currentCell_13 = currentRow.GetCell(6); workorder.MaterialtextureCode = currentCell_13?.ToString(); - if (currentCell_13 == null || string.IsNullOrEmpty(workorder.MaterialtextureCode)) - { - continue; - } //7 炉号 ICell currentCell_14 = currentRow.GetCell(7); @@ -133,10 +125,6 @@ namespace DOAN.Service.MES.product //9 版本 ICell currentCell_16 = currentRow.GetCell(9); workorder.Version = currentCell_16?.ToString(); - if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version)) - { - continue; - } //10 指导日期 ICell cell17 = currentRow.GetCell(10); @@ -231,7 +219,7 @@ namespace DOAN.Service.MES.product ICell currentCell_012 = currentRow.GetCell(18); workorder.Remark01 = currentCell_012?.StringCellValue; - workorder.Id = Guid.NewGuid().ToString(); + workorder.Id = SnowFlakeSingle.Instance.NextId().ToString(); workorder.CreatedBy = username; workorder.CreatedTime = DateTime.Now; workorder.WorkorderDate = dateValue; @@ -308,7 +296,7 @@ namespace DOAN.Service.MES.product ProWorkorder workorder = new ProWorkorder(); #region 读取excel - //00 铸件品名 + //00 成品名称 ICell currentCell_01 = currentRow.GetCell(0); workorder.productionName = currentCell_01?.ToString(); if (currentCell_01 == null || string.IsNullOrEmpty(workorder.productionName)) @@ -316,7 +304,7 @@ namespace DOAN.Service.MES.product continue; } - //01 铸件型号 + //01 成品型号 ICell currentCell_02 = currentRow.GetCell(1); workorder.productionCode = currentCell_02?.ToString(); if (currentCell_02 == null || string.IsNullOrEmpty(workorder.productionCode)) @@ -327,16 +315,12 @@ namespace DOAN.Service.MES.product //02 单位 ICell currentCell_04 = currentRow.GetCell(2); workorder.Unit = currentCell_04?.ToString(); - if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Unit)) - { - continue; - } - //3 plan_num + //3 计划数量 ICell currentCell_07 = currentRow.GetCell(3); workorder.PlanNum = (int)currentCell_07?.NumericCellValue; - //4 材质品名 + //4 原材料名称 ICell currentCell_11 = currentRow.GetCell(4); workorder.MaterialName = currentCell_11?.ToString(); if (currentCell_11 == null || string.IsNullOrEmpty(workorder.MaterialName)) @@ -344,7 +328,7 @@ namespace DOAN.Service.MES.product continue; } - //5 材质牌号 + //5 原材料编号 ICell currentCell_12 = currentRow.GetCell(5); workorder.MaterialCode = currentCell_12?.ToString(); if (currentCell_12 == null || string.IsNullOrEmpty(workorder.MaterialCode)) @@ -379,10 +363,6 @@ namespace DOAN.Service.MES.product //9 版本 ICell currentCell_16 = currentRow.GetCell(9); workorder.Version = currentCell_16?.ToString(); - if (currentCell_16 == null || string.IsNullOrEmpty(workorder.Version)) - { - continue; - } //10 指导日期 ICell cell17 = currentRow.GetCell(10); @@ -478,7 +458,7 @@ namespace DOAN.Service.MES.product workorder.Remark01 = currentCell_012?.StringCellValue; #endregion - workorder.Id = Guid.NewGuid().ToString(); + workorder.Id = SnowFlakeSingle.Instance.NextId().ToString(); workorder.CreatedBy = username; workorder.CreatedTime = DateTime.Now; workorder.WorkorderDate = dateValue;