refactor(MES): 更新工作订单导入服务的字段命名和验证逻辑
- 将字段注释从"铸件"改为"成品"和"原材料"以更准确描述业务含义 - 移除对单位、材质和版本字段的非空验证,使其更符合业务需求 - 使用雪花算法替代GUID生成工作订单ID,提高ID生成效率
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user