diff --git a/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx b/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx index e49c91e..be2589c 100644 Binary files a/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx and b/DOAN.Admin.WebApi/wwwroot/ImportTemplate/workorder.xlsx differ diff --git a/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs b/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs index 8dc9614..e6d7b0f 100644 --- a/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs +++ b/DOAN.Model/MES/Product/Dto/ProWorkorderDto.cs @@ -79,10 +79,16 @@ namespace DOAN.Model.MES.product.Dto public string GroupCode { get; set; } + /// - /// 订单号 + /// 进料单号(领料) /// - public string OrderNumber { get; set; } + public string FeedOrder { get; set; } + + /// + /// 客户单号(出货) + /// + public string CustomerOrder { get; set; } public string Remark01 { get; set; } diff --git a/DOAN.Model/MES/Product/ProWorkorder.cs b/DOAN.Model/MES/Product/ProWorkorder.cs index f40d881..c9e177d 100644 --- a/DOAN.Model/MES/Product/ProWorkorder.cs +++ b/DOAN.Model/MES/Product/ProWorkorder.cs @@ -127,11 +127,18 @@ namespace DOAN.Model.MES.product public string GroupCode { get; set; } + /// - /// 订单号 + /// 进料单号(领料) /// - [SugarColumn(ColumnName = "ordernumber")] - public string OrderNumber { get; set; } + [SugarColumn(ColumnName = "feed_order")] + public string FeedOrder { get; set; } + + /// + /// 客户单号(出货) + /// + [SugarColumn(ColumnName = "customer_order")] + public string CustomerOrder { get; set; } /// /// 备注 diff --git a/DOAN.Service/MES/Product/ProWorkorderService.cs b/DOAN.Service/MES/Product/ProWorkorderService.cs index 38e1786..93ecb7e 100644 --- a/DOAN.Service/MES/Product/ProWorkorderService.cs +++ b/DOAN.Service/MES/Product/ProWorkorderService.cs @@ -254,7 +254,8 @@ namespace DOAN.Service.MES.product int result = 0; proWorkorder.Id = XueHua; proWorkorder.WorkorderDate= DOANConvertDate.ConvertLocalDate(proWorkorder.WorkorderDate??DateTime.MinValue); - + // 获取 产品代号 + List ProductCodeList = Context.Queryable().Where(it => it.DictType == "product_code").ToList(); DateTime handleDate = proWorkorder.WorkorderDate.Value; //插入工单 if (!string.IsNullOrEmpty(next_id) && next_id != "-1") @@ -270,8 +271,10 @@ namespace DOAN.Service.MES.product index = Convert.ToInt32(maxs.Workorder.Substring(maxs.Workorder.Length - 3)) + 1; } - proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000"); + // proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000"); + string nickCode = ProductCodeList.Where(it => it.DictLabel == proWorkorder.productionCode).Select(it => it.DictValue).FirstOrDefault(); + proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.RouteCode + proWorkorder.GroupCode + "_" + nickCode + "_" + index.ToString("000"); int sortNum = Context.Queryable().Where(it => it.Id == next_id).Select(it => it.Sort.Value).First(); @@ -323,7 +326,10 @@ namespace DOAN.Service.MES.product index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1; proWorkorder.Sort = maxWorkorder.Sort + 10; } - proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000"); + //proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.RouteCode + "_" + index.ToString("000"); + + string nickCode = ProductCodeList.Where(it => it.DictLabel == proWorkorder.productionCode).Select(it => it.DictValue).FirstOrDefault(); + proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.RouteCode + proWorkorder.GroupCode + "_" + nickCode + "_" + index.ToString("000"); proWorkorder.Status = 1; @@ -411,6 +417,8 @@ namespace DOAN.Service.MES.product int result = 0; List workorderList = new(); DateTime dateValue = DateTime.MinValue; + // 获取 产品代号 + List ProductCodeList= Context.Queryable().Where(it => it.DictType == "product_code").ToList(); using (var stream = formFile.OpenReadStream()) { try @@ -629,10 +637,18 @@ namespace DOAN.Service.MES.product NPOI.SS.UserModel.ICell currentCell_22 = currentRow.GetCell(15); workorder.Beat = (int)currentCell_22?.NumericCellValue; - - //16备注 + //16进料单号(领料) NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16); - workorder.Remark01 = currentCell_010.StringCellValue; + workorder.FeedOrder = currentCell_010.StringCellValue; + + //17 客户单号(出货) + NPOI.SS.UserModel.ICell currentCell_011 = currentRow.GetCell(17); + workorder.CustomerOrder = currentCell_011.StringCellValue; + + + //18备注 + NPOI.SS.UserModel.ICell currentCell_012 = currentRow.GetCell(18); + workorder.Remark01 = currentCell_012.StringCellValue; workorder.Id = XueHua; workorder.CreatedBy = username; @@ -641,8 +657,10 @@ namespace DOAN.Service.MES.product workorder.Status = 1; //工单 2024-9-13-组-线-序号 int index = (row - 3); - workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + index.ToString("000"); + string nickCode= ProductCodeList.Where(it=>it.DictLabel==workorder.productionCode).Select(it=>it.DictValue).FirstOrDefault(); + workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.RouteCode+ workorder.GroupCode + "_" + nickCode + "_" + index.ToString("000"); workorder.Sort = index * 10; + CultureInfo culture = CultureInfo.CurrentCulture; @@ -687,7 +705,8 @@ namespace DOAN.Service.MES.product List workorderList = new(); DateTime dateValue = DateTime.MinValue; - + // 获取 产品代号 + List ProductCodeList = Context.Queryable().Where(it => it.DictType == "product_code").ToList(); using (var stream = formFile.OpenReadStream()) { try @@ -910,9 +929,18 @@ namespace DOAN.Service.MES.product workorder.Beat = (int)currentCell_22?.NumericCellValue; - //16备注 + //16进料单号(领料) NPOI.SS.UserModel.ICell currentCell_010 = currentRow.GetCell(16); - workorder.Remark01 = currentCell_010.StringCellValue; + workorder.FeedOrder = currentCell_010.StringCellValue; + + //17 客户单号(出货) + NPOI.SS.UserModel.ICell currentCell_011 = currentRow.GetCell(17); + workorder.CustomerOrder = currentCell_011.StringCellValue; + + + //18备注 + NPOI.SS.UserModel.ICell currentCell_012 = currentRow.GetCell(18); + workorder.Remark01 = currentCell_012.StringCellValue; #endregion @@ -934,8 +962,10 @@ namespace DOAN.Service.MES.product int flowNum = index + Convert.ToInt16(MaxWorkorder.Workorder.Substring(MaxWorkorder.Workorder.Length - 3, 3)); - workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + flowNum.ToString("000"); + //workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.RouteCode + "_" + flowNum.ToString("000"); + string nickCode = ProductCodeList.Where(it => it.DictLabel == workorder.productionCode).Select(it => it.DictValue).FirstOrDefault(); + workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.RouteCode + workorder.GroupCode + "_" + nickCode + "_" + index.ToString("000"); workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort);