11
This commit is contained in:
parent
dd40e03282
commit
c2fc6f6569
@ -33,6 +33,7 @@ using Mapster;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using System.Reflection;
|
||||
using Infrastructure;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace DOAN.Service.MES.product
|
||||
{
|
||||
@ -72,8 +73,8 @@ namespace DOAN.Service.MES.product
|
||||
.LeftJoin<BaseMaterialList>((q, m, m2) => q.ProductionName == m2.Name)
|
||||
.LeftJoin<BaseWorkRoute>((q, m, m2, r) => q.LineCode == r.Code)
|
||||
.LeftJoin<BaseGroup>((q, m, m2, r, g) => q.GroupCode == g.GroupCode)
|
||||
.LeftJoin<BaseUnit>((q,m,m2,r,g,u)=>q.Unit==u.UnitCode)
|
||||
.Select((q, m, m2, r, g,u) => new ProWorkorderDto3()
|
||||
.LeftJoin<BaseUnit>((q, m, m2, r, g, u) => q.Unit == u.UnitCode)
|
||||
.Select((q, m, m2, r, g, u) => new ProWorkorderDto3()
|
||||
{
|
||||
IsMatch_material_code = m.Code,
|
||||
IsMatch_material_name = m2.Name,
|
||||
@ -248,7 +249,7 @@ namespace DOAN.Service.MES.product
|
||||
index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
|
||||
|
||||
}
|
||||
proWorkorder.Workorder = "K"+handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.LineCode + "_" + index.ToString("000") ;
|
||||
proWorkorder.Workorder = "K" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.LineCode + "_" + index.ToString("000");
|
||||
|
||||
|
||||
|
||||
@ -262,7 +263,7 @@ namespace DOAN.Service.MES.product
|
||||
proWorkorder.Sort = sortNum;
|
||||
proWorkorder.Status = 1;
|
||||
|
||||
|
||||
|
||||
|
||||
//增加日志
|
||||
ProWorkorderUpdateLog logObj = new ProWorkorderUpdateLog();
|
||||
@ -285,10 +286,10 @@ namespace DOAN.Service.MES.product
|
||||
int sortNum = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == handleDate).Max(it => it.Sort.Value);
|
||||
|
||||
ProWorkorder maxWorkorder = Context.Queryable<ProWorkorder>().Where(it => it.WorkorderDate == handleDate)
|
||||
.OrderByDescending(it => SqlFunc.Substring(it.Workorder, it.Workorder.Length-3,3)).First();
|
||||
|
||||
.OrderByDescending(it => SqlFunc.Substring(it.Workorder, it.Workorder.Length - 3, 3)).First();
|
||||
|
||||
int index = 0;
|
||||
if (maxWorkorder==null)
|
||||
if (maxWorkorder == null)
|
||||
{
|
||||
index = 1;
|
||||
proWorkorder.Sort = 10;
|
||||
@ -296,11 +297,11 @@ namespace DOAN.Service.MES.product
|
||||
else
|
||||
{
|
||||
string maxs = maxWorkorder.Workorder;
|
||||
index= Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
|
||||
index = Convert.ToInt32(maxs.Substring(maxs.Length - 3)) + 1;
|
||||
proWorkorder.Sort = maxWorkorder.Sort + 10;
|
||||
}
|
||||
proWorkorder.Workorder = "H"+handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.LineCode + "_" + index.ToString("000");
|
||||
|
||||
proWorkorder.Workorder = "H" + handleDate.ToString("yyyyMMdd") + "_" + proWorkorder.GroupCode + "_" + proWorkorder.LineCode + "_" + index.ToString("000");
|
||||
|
||||
|
||||
proWorkorder.Status = 1;
|
||||
|
||||
@ -611,27 +612,27 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
//存货编码
|
||||
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
|
||||
workorder.ProductionCode = currentCell_01.ToString();
|
||||
workorder.ProductionCode = currentCell_01?.ToString();
|
||||
|
||||
//产品名称
|
||||
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
|
||||
workorder.ProductionName = currentCell_02.ToString();
|
||||
workorder.ProductionName = currentCell_02?.ToString();
|
||||
|
||||
|
||||
|
||||
//规格型号
|
||||
NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
|
||||
workorder.Specification = currentCell_04.ToString();
|
||||
workorder.Specification = currentCell_04?.ToString();
|
||||
|
||||
|
||||
|
||||
//单位
|
||||
NPOI.SS.UserModel.ICell currentCell_06 = currentRow.GetCell(3);
|
||||
workorder.Unit = currentCell_06.ToString();
|
||||
workorder.Unit = currentCell_06?.ToString();
|
||||
|
||||
//交货数量
|
||||
NPOI.SS.UserModel.ICell currentCell_07 = currentRow.GetCell(4);
|
||||
workorder.DeliveryNum = (int)currentCell_07.NumericCellValue;
|
||||
workorder.DeliveryNum = (int)currentCell_07?.NumericCellValue;
|
||||
|
||||
//是否是纸箱
|
||||
NPOI.SS.UserModel.ICell currentCell_08 = currentRow.GetCell(5);
|
||||
@ -639,18 +640,22 @@ namespace DOAN.Service.MES.product
|
||||
{
|
||||
workorder.IsCarton = 0;
|
||||
}
|
||||
if (currentCell_08.ToString() == "是")
|
||||
else
|
||||
{
|
||||
workorder.IsCarton = 1;
|
||||
}
|
||||
else if (currentCell_08.ToString() == "否" || string.IsNullOrEmpty(currentCell_08.ToString()))
|
||||
{
|
||||
workorder.IsCarton = 0;
|
||||
if (currentCell_08.ToString() == "是")
|
||||
{
|
||||
workorder.IsCarton = 1;
|
||||
}
|
||||
else if (currentCell_08.ToString() == "否" || string.IsNullOrEmpty(currentCell_08.ToString()))
|
||||
{
|
||||
workorder.IsCarton = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//装箱容积
|
||||
NPOI.SS.UserModel.ICell currentCell_0811 = currentRow.GetCell(6);
|
||||
workorder.PackageCapacity = (int)currentCell_0811.NumericCellValue;
|
||||
workorder.PackageCapacity = (int)currentCell_0811?.NumericCellValue;
|
||||
|
||||
|
||||
|
||||
@ -659,32 +664,49 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
// 组别code
|
||||
NPOI.SS.UserModel.ICell currentCell_09 = currentRow.GetCell(7);
|
||||
if (currentCell_09.CellType == CellType.Numeric)
|
||||
if (currentCell_09 == null)
|
||||
{
|
||||
workorder.GroupCode = currentCell_09.NumericCellValue.ToString();
|
||||
|
||||
workorder.GroupCode = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
workorder.GroupCode = currentCell_09.StringCellValue;
|
||||
if (currentCell_09.CellType == CellType.Numeric)
|
||||
{
|
||||
workorder.GroupCode = currentCell_09.NumericCellValue.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
workorder.GroupCode = currentCell_09.StringCellValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 线别code
|
||||
NPOI.SS.UserModel.ICell currentCell_10 = currentRow.GetCell(8);
|
||||
|
||||
|
||||
if (currentCell_10.CellType == CellType.Numeric)
|
||||
if (currentCell_10 == null)
|
||||
{
|
||||
workorder.LineCode = currentCell_10.NumericCellValue.ToString();
|
||||
|
||||
workorder.LineCode = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
workorder.LineCode = currentCell_10.StringCellValue;
|
||||
if (currentCell_10.CellType == CellType.Numeric)
|
||||
{
|
||||
workorder.LineCode = currentCell_10.NumericCellValue.ToString();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
workorder.LineCode = currentCell_10.StringCellValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 优先级
|
||||
NPOI.SS.UserModel.ICell currentCell_11 = currentRow.GetCell(9);
|
||||
if (currentCell_11.StringCellValue == "紧急")
|
||||
@ -692,15 +714,18 @@ namespace DOAN.Service.MES.product
|
||||
workorder.Priority = 3;
|
||||
|
||||
}
|
||||
else if (currentCell_11.StringCellValue == "插单")
|
||||
else
|
||||
{
|
||||
workorder.Priority = 2;
|
||||
if (currentCell_11.StringCellValue == "插单")
|
||||
{
|
||||
workorder.Priority = 2;
|
||||
|
||||
}
|
||||
else if (currentCell_11.StringCellValue == "正常" || string.IsNullOrEmpty(currentCell_11.StringCellValue))
|
||||
{
|
||||
workorder.Priority = 1;
|
||||
}
|
||||
else if (currentCell_11.StringCellValue == "正常" || string.IsNullOrEmpty(currentCell_11.StringCellValue))
|
||||
{
|
||||
workorder.Priority = 1;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user