工单号生成规则调整

This commit is contained in:
2026-01-19 15:45:21 +08:00
parent a587c39f70
commit 908f2604e9

View File

@@ -5,6 +5,7 @@ using System.Linq;
using BarTender; using BarTender;
using DOAN.Infrastructure.Helper; using DOAN.Infrastructure.Helper;
using DOAN.Model; using DOAN.Model;
using DOAN.Model.BZFM;
using DOAN.Model.MES.base_; using DOAN.Model.MES.base_;
using DOAN.Model.MES.base_.Dto; using DOAN.Model.MES.base_.Dto;
using DOAN.Model.MES.product; using DOAN.Model.MES.product;
@@ -145,9 +146,6 @@ namespace DOAN.Service.MES.product
// }, true); // }, true);
//var response = query4.MergeTable().OrderBy(it => it.WorkorderDate).ToPage<ProWorkorderDto3, ProWorkorderDto3>(parm); //var response = query4.MergeTable().OrderBy(it => it.WorkorderDate).ToPage<ProWorkorderDto3, ProWorkorderDto3>(parm);
return response; return response;
} }
@@ -305,9 +303,14 @@ namespace DOAN.Service.MES.product
proWorkorder.WorkorderDate ?? DateTime.MinValue proWorkorder.WorkorderDate ?? DateTime.MinValue
); );
// 获取 产品代号 // 获取 产品代号
List<SysDictData> ProductCodeList = Context /*List<SysDictData> ProductCodeList = Context
.Queryable<SysDictData>() .Queryable<SysDictData>()
.Where(it => it.DictType == "product_code") .Where(it => it.DictType == "product_code")
.ToList();*/
// XXX 改为从物料清单获取信息
List<MmMaterial> mmMaterials = Context
.Queryable<MmMaterial>()
.Where(it => it.Status == "启用")
.ToList(); .ToList();
DateTime handleDate = proWorkorder.WorkorderDate.Value; DateTime handleDate = proWorkorder.WorkorderDate.Value;
//插入工单 //插入工单
@@ -330,9 +333,13 @@ namespace DOAN.Service.MES.product
} }
// 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 /*string nickCode = ProductCodeList
.Where(it => it.DictLabel == proWorkorder.productionCode) .Where(it => it.DictLabel == proWorkorder.productionCode)
.Select(it => it.DictValue) .Select(it => it.DictValue)
.FirstOrDefault();*/
string nickCode = mmMaterials
.Where(it => it.MaterialCode == proWorkorder.productionCode)
.Select(it => it.Type)
.FirstOrDefault(); .FirstOrDefault();
proWorkorder.Workorder = proWorkorder.Workorder =
"K" "K"
@@ -404,9 +411,13 @@ namespace DOAN.Service.MES.product
} }
//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 /*string nickCode = ProductCodeList
.Where(it => it.DictLabel == proWorkorder.productionCode) .Where(it => it.DictLabel == proWorkorder.productionCode)
.Select(it => it.DictValue) .Select(it => it.DictValue)
.FirstOrDefault();*/
string nickCode = mmMaterials
.Where(it => it.MaterialCode == proWorkorder.productionCode)
.Select(it => it.Type)
.FirstOrDefault(); .FirstOrDefault();
proWorkorder.Workorder = proWorkorder.Workorder =
"H" "H"
@@ -494,9 +505,14 @@ namespace DOAN.Service.MES.product
List<ProWorkorder> workorderList = new(); List<ProWorkorder> workorderList = new();
DateTime dateValue = DateTime.MinValue; DateTime dateValue = DateTime.MinValue;
// 获取 产品代号 // 获取 产品代号
List<SysDictData> ProductCodeList = Context /*List<SysDictData> ProductCodeList = Context
.Queryable<SysDictData>() .Queryable<SysDictData>()
.Where(it => it.DictType == "product_code") .Where(it => it.DictType == "product_code")
.ToList();*/
// XXX 改为从物料清单获取信息
List<MmMaterial> mmMaterials = Context
.Queryable<MmMaterial>()
.Where(it => it.Status == "启用")
.ToList(); .ToList();
using (var stream = formFile.OpenReadStream()) using (var stream = formFile.OpenReadStream())
{ {
@@ -638,8 +654,6 @@ namespace DOAN.Service.MES.product
/*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6); /*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/ workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
// 11车间code // 11车间code
NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11); NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
if (currentCell_18 == null) if (currentCell_18 == null)
@@ -742,9 +756,14 @@ namespace DOAN.Service.MES.product
workorder.Status = 1; workorder.Status = 1;
//工单 2024-9-13-组-线-序号 //工单 2024-9-13-组-线-序号
int index = (row - 3); int index = (row - 3);
string nickCode = ProductCodeList /*string nickCode = ProductCodeList
.Where(it => it.DictLabel == workorder.productionCode) .Where(it => it.DictLabel == workorder.productionCode)
.Select(it => it.DictValue) .Select(it => it.DictValue)
.FirstOrDefault();*/
//TODO nickCode改为从物料清单进行获取
string nickCode = mmMaterials
.Where(it => it.MaterialCode == workorder.productionCode)
.Select(it => it.Type)
.FirstOrDefault(); .FirstOrDefault();
workorder.Workorder = workorder.Workorder =
dateValue.ToString("yyyyMMdd") dateValue.ToString("yyyyMMdd")
@@ -795,9 +814,14 @@ namespace DOAN.Service.MES.product
DateTime dateValue = DateTime.MinValue; DateTime dateValue = DateTime.MinValue;
// 获取 产品代号 // 获取 产品代号
List<SysDictData> ProductCodeList = Context /*List<SysDictData> ProductCodeList = Context
.Queryable<SysDictData>() .Queryable<SysDictData>()
.Where(it => it.DictType == "product_code") .Where(it => it.DictType == "product_code")
.ToList();*/
// XXX 改为从物料清单获取信息
List<MmMaterial> mmMaterials = Context
.Queryable<MmMaterial>()
.Where(it => it.Status == "启用")
.ToList(); .ToList();
using (var stream = formFile.OpenReadStream()) using (var stream = formFile.OpenReadStream())
{ {
@@ -939,8 +963,6 @@ namespace DOAN.Service.MES.product
/*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6); /*NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/ workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;*/
// 11车间code // 11车间code
NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11); NPOI.SS.UserModel.ICell currentCell_18 = currentRow.GetCell(11);
if (currentCell_18 == null) if (currentCell_18 == null)
@@ -1066,9 +1088,14 @@ namespace DOAN.Service.MES.product
//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 /*string nickCode = ProductCodeList
.Where(it => it.DictLabel == workorder.productionCode) .Where(it => it.DictLabel == workorder.productionCode)
.Select(it => it.DictValue) .Select(it => it.DictValue)
.FirstOrDefault();*/
//TODO nickCode改为从物料清单进行获取
string nickCode = mmMaterials
.Where(it => it.MaterialCode == workorder.productionCode)
.Select(it => it.Type)
.FirstOrDefault(); .FirstOrDefault();
workorder.Workorder = workorder.Workorder =
dateValue.ToString("yyyyMMdd") dateValue.ToString("yyyyMMdd")
@@ -1193,7 +1220,6 @@ namespace DOAN.Service.MES.product
.ToList(); .ToList();
}*/ }*/
public List<BaseWorkRoute> GetAllRoute() public List<BaseWorkRoute> GetAllRoute()
{ {
return Context.Queryable<BaseWorkRoute>().ToList(); return Context.Queryable<BaseWorkRoute>().ToList();
@@ -1526,9 +1552,7 @@ namespace DOAN.Service.MES.product
/// </summary> /// </summary>
/// <param name="param">工单号列表与打印路径</param> /// <param name="param">工单号列表与打印路径</param>
/// <returns></returns> /// <returns></returns>
public async Task<CustomException> PrintTicketsByTemplate( public async Task<CustomException> PrintTicketsByTemplate(ProWorkorderExportDto param)
ProWorkorderExportDto param
)
{ {
var dataList = await Context var dataList = await Context
.Queryable<ProWorkorder>() .Queryable<ProWorkorder>()