工单号修改

This commit is contained in:
qianhao.xu
2024-12-10 16:03:49 +08:00
parent c6936453ba
commit 7f0031707f
4 changed files with 59 additions and 16 deletions

View File

@@ -254,7 +254,8 @@ namespace DOAN.Service.MES.product
int result = 0;
proWorkorder.Id = XueHua;
proWorkorder.WorkorderDate= DOANConvertDate.ConvertLocalDate(proWorkorder.WorkorderDate??DateTime.MinValue);
// 获取 产品代号
List<SysDictData> ProductCodeList = Context.Queryable<SysDictData>().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<ProWorkorder>().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<ProWorkorder> workorderList = new();
DateTime dateValue = DateTime.MinValue;
// 获取 产品代号
List<SysDictData> ProductCodeList= Context.Queryable<SysDictData>().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<ProWorkorder> workorderList = new();
DateTime dateValue = DateTime.MinValue;
// 获取 产品代号
List<SysDictData> ProductCodeList = Context.Queryable<SysDictData>().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);