油漆实验室
This commit is contained in:
@@ -7,7 +7,7 @@ namespace ZR.Service.mes.ql.IService
|
||||
public interface IPLBatchService
|
||||
{
|
||||
|
||||
public (List<PLBatch>, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize);
|
||||
public (List<PLBatch>, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize,int dateType, string workOrder);
|
||||
|
||||
public int AddPLBatchRecords(int num, int size);
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace ZR.Service.mes.ql.IService
|
||||
public interface IPLTestService
|
||||
{
|
||||
|
||||
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize);
|
||||
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize,int dateType);
|
||||
|
||||
public int AddPLTestRecords(int num, int size);
|
||||
|
||||
|
||||
@@ -9,285 +9,288 @@ using ZR.Service.mes.ql.IService;
|
||||
|
||||
namespace ZR.Service.mes.ql
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询报表
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IPLBatchService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class PLBatchService : BaseService<PLBatch>, IPLBatchService
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加批处理数据
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int AddPLBatchRecords(int num, int size)
|
||||
{
|
||||
PLBatch t1 = GetDefaultPLBatch();
|
||||
PLBatch t2 = GetDefaultPLBatch();
|
||||
PLBatch t3 = GetDefaultPLBatch();
|
||||
PLBatch t4 = GetDefaultPLBatch();
|
||||
PLBatch t5 = GetDefaultPLBatch();
|
||||
PLBatch t6 = GetDefaultPLBatch();
|
||||
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
|
||||
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
|
||||
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
|
||||
t4.Value01 = "75°"; t4.Value07 = "0"; t4.Value09 = "R4"; t4.Value14 = "清漆"; t4.Value19 = "2";
|
||||
t5.Value01 = "110°"; t5.Value07 = "0"; t5.Value09 = "R5"; t5.Value14 = "总膜厚"; t5.Value19 = "2";
|
||||
t6.Value01 = ""; t6.Value07 = "0"; t6.Value09 = "R6"; t6.Value14 = ""; t6.Value19 = "2";
|
||||
t2.IdGroup = t1.IdGroup;
|
||||
t3.IdGroup = t1.IdGroup;
|
||||
t4.IdGroup = t1.IdGroup;
|
||||
t5.IdGroup = t1.IdGroup;
|
||||
t6.IdGroup = t1.IdGroup;
|
||||
List<PLBatch> lst = new List<PLBatch>();
|
||||
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5); lst.Add(t6);
|
||||
/// <summary>
|
||||
/// 查询报表
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IPLBatchService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class PLBatchService : BaseService<PLBatch>, IPLBatchService
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加批处理数据
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int AddPLBatchRecords(int num, int size)
|
||||
{
|
||||
PLBatch t1 = GetDefaultPLBatch();
|
||||
PLBatch t2 = GetDefaultPLBatch();
|
||||
PLBatch t3 = GetDefaultPLBatch();
|
||||
PLBatch t4 = GetDefaultPLBatch();
|
||||
PLBatch t5 = GetDefaultPLBatch();
|
||||
PLBatch t6 = GetDefaultPLBatch();
|
||||
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
|
||||
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
|
||||
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
|
||||
t4.Value01 = "75°"; t4.Value07 = "0"; t4.Value09 = "R4"; t4.Value14 = "清漆"; t4.Value19 = "2";
|
||||
t5.Value01 = "110°"; t5.Value07 = "0"; t5.Value09 = "R5"; t5.Value14 = "总膜厚"; t5.Value19 = "2";
|
||||
t6.Value01 = ""; t6.Value07 = "0"; t6.Value09 = "R6"; t6.Value14 = ""; t6.Value19 = "2";
|
||||
t2.IdGroup = t1.IdGroup;
|
||||
t3.IdGroup = t1.IdGroup;
|
||||
t4.IdGroup = t1.IdGroup;
|
||||
t5.IdGroup = t1.IdGroup;
|
||||
t6.IdGroup = t1.IdGroup;
|
||||
List<PLBatch> lst = new List<PLBatch>();
|
||||
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5); lst.Add(t6);
|
||||
|
||||
int ret = Context.Insertable<PLBatch>(lst).ExecuteReturnIdentity();
|
||||
int ret = Context.Insertable<PLBatch>(lst).ExecuteReturnIdentity();
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据生成日期,自动更新
|
||||
/// </summary>
|
||||
/// <param name="actionDate">操作日期</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int CreatePLBatchRecordsByWorkOrder(DateTime actionDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
Context.Ado.BeginTran();
|
||||
// 查询工单
|
||||
int year = actionDate.Year;
|
||||
int week = GetWeekOfYear(actionDate);
|
||||
int date = ConvertDayOfWeekToCustomFormat(actionDate.DayOfWeek);
|
||||
var predicate = Expressionable
|
||||
.Create<ProWorkorder_v2>()
|
||||
.And(it => it.Year == year)
|
||||
.And(it => it.Week == week)
|
||||
.And(it => it.Date == date)
|
||||
//.And(it => it.Remark2.Contains("调试"))
|
||||
.And(it => it.Remark3 == "是")
|
||||
.ToExpression();
|
||||
List<ProWorkorder_v2> workOrderList = Context.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.OrderByDescending(it => it.Sort)
|
||||
.ToList();
|
||||
foreach(ProWorkorder_v2 workorder in workOrderList)
|
||||
{
|
||||
List<PLBatch> pLBatches = CreatePLBatchRecordsByWorkOrder(workorder);
|
||||
int res = Context.Insertable<PLBatch>(pLBatches).ExecuteCommand();
|
||||
if (res == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入批量检测记录异常,异常工单:" + workorder.ClientWorkorder);
|
||||
}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return 1;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 根据生成日期,自动更新
|
||||
/// </summary>
|
||||
/// <param name="actionDate">操作日期</param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int CreatePLBatchRecordsByWorkOrder(DateTime actionDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
Context.Ado.BeginTran();
|
||||
// 查询工单
|
||||
int year = actionDate.Year;
|
||||
int week = GetWeekOfYear(actionDate);
|
||||
int date = ConvertDayOfWeekToCustomFormat(actionDate.DayOfWeek);
|
||||
var predicate = Expressionable
|
||||
.Create<ProWorkorder_v2>()
|
||||
.And(it => it.Year == year)
|
||||
.And(it => it.Week == week)
|
||||
.And(it => it.Date == date)
|
||||
//.And(it => it.Remark2.Contains("调试"))
|
||||
.And(it => it.Remark3 == "是")
|
||||
.ToExpression();
|
||||
List<ProWorkorder_v2> workOrderList = Context.Queryable<ProWorkorder_v2>()
|
||||
.Where(predicate)
|
||||
.OrderByDescending(it => it.Sort)
|
||||
.ToList();
|
||||
foreach (ProWorkorder_v2 workorder in workOrderList)
|
||||
{
|
||||
List<PLBatch> pLBatches = CreatePLBatchRecordsByWorkOrder(workorder);
|
||||
int res = Context.Insertable<PLBatch>(pLBatches).ExecuteCommand();
|
||||
if (res == 0)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw new Exception("插入批量检测记录异常,异常工单:" + workorder.ClientWorkorder);
|
||||
}
|
||||
}
|
||||
Context.Ado.CommitTran();
|
||||
return 1;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
Context.Ado.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据工单创建批量检测数据
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public List<PLBatch> CreatePLBatchRecordsByWorkOrder(ProWorkorder_v2 workorder)
|
||||
{
|
||||
PLBatch t1 = GetDefaultPLBatch();
|
||||
PLBatch t2 = GetDefaultPLBatch();
|
||||
PLBatch t3 = GetDefaultPLBatch();
|
||||
PLBatch t4 = GetDefaultPLBatch();
|
||||
PLBatch t5 = GetDefaultPLBatch();
|
||||
PLBatch t6 = GetDefaultPLBatch();
|
||||
/// <summary>
|
||||
/// 根据工单创建批量检测数据
|
||||
/// </summary>
|
||||
/// <param name="num"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public List<PLBatch> CreatePLBatchRecordsByWorkOrder(ProWorkorder_v2 workorder)
|
||||
{
|
||||
PLBatch t1 = GetDefaultPLBatch();
|
||||
PLBatch t2 = GetDefaultPLBatch();
|
||||
PLBatch t3 = GetDefaultPLBatch();
|
||||
PLBatch t4 = GetDefaultPLBatch();
|
||||
PLBatch t5 = GetDefaultPLBatch();
|
||||
PLBatch t6 = GetDefaultPLBatch();
|
||||
|
||||
// 工单信息录入
|
||||
t1.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t1.Description = workorder.ProductDescription;
|
||||
t1.Code = workorder.Colour;
|
||||
t1.Workorder = workorder.ClientWorkorder;
|
||||
// 工单信息录入
|
||||
t1.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t1.Description = workorder.ProductDescription;
|
||||
t1.Code = workorder.Colour;
|
||||
t1.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t2.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t2.Description = workorder.ProductDescription;
|
||||
t2.Code = workorder.Colour;
|
||||
t2.Workorder = workorder.ClientWorkorder;
|
||||
t2.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t2.Description = workorder.ProductDescription;
|
||||
t2.Code = workorder.Colour;
|
||||
t2.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t3.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t3.Description = workorder.ProductDescription;
|
||||
t3.Code = workorder.Colour;
|
||||
t3.Workorder = workorder.ClientWorkorder;
|
||||
t3.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t3.Description = workorder.ProductDescription;
|
||||
t3.Code = workorder.Colour;
|
||||
t3.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t4.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t4.Description = workorder.ProductDescription;
|
||||
t4.Code = workorder.Colour;
|
||||
t4.Workorder = workorder.ClientWorkorder;
|
||||
t4.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t4.Description = workorder.ProductDescription;
|
||||
t4.Code = workorder.Colour;
|
||||
t4.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t5.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t5.Description = workorder.ProductDescription;
|
||||
t5.Code = workorder.Colour;
|
||||
t5.Workorder = workorder.ClientWorkorder;
|
||||
t5.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t5.Description = workorder.ProductDescription;
|
||||
t5.Code = workorder.Colour;
|
||||
t5.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
t6.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t6.Description = workorder.ProductDescription;
|
||||
t6.Code = workorder.Colour;
|
||||
t6.Workorder = workorder.ClientWorkorder;
|
||||
t6.Dt = DateTime.Now.ToString("yyyy.MM.dd");
|
||||
t6.Description = workorder.ProductDescription;
|
||||
t6.Code = workorder.Colour;
|
||||
t6.Workorder = workorder.ClientWorkorder;
|
||||
|
||||
|
||||
|
||||
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
|
||||
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
|
||||
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
|
||||
t4.Value01 = "75°"; t4.Value07 = "0"; t4.Value09 = "R4"; t4.Value14 = "清漆"; t4.Value19 = "2";
|
||||
t5.Value01 = "110°"; t5.Value07 = "0"; t5.Value09 = "R5"; t5.Value14 = "总膜厚"; t5.Value19 = "2";
|
||||
t6.Value01 = ""; t6.Value07 = "0"; t6.Value09 = "R6"; t6.Value14 = ""; t6.Value19 = "2";
|
||||
t2.IdGroup = t1.IdGroup;
|
||||
t3.IdGroup = t1.IdGroup;
|
||||
t4.IdGroup = t1.IdGroup;
|
||||
t5.IdGroup = t1.IdGroup;
|
||||
t6.IdGroup = t1.IdGroup;
|
||||
List<PLBatch> list = new()
|
||||
{
|
||||
t1,
|
||||
t2,
|
||||
t3,
|
||||
t4,
|
||||
t5,
|
||||
t6
|
||||
};
|
||||
return list;
|
||||
}
|
||||
t1.Value01 = "15°"; t1.Value07 = "0"; t1.Value09 = "R1"; t1.Value14 = "底漆"; t1.Value19 = "2";
|
||||
t2.Value01 = "25°"; t2.Value07 = "0"; t2.Value09 = "R2"; t2.Value14 = "色漆"; t2.Value19 = "2";
|
||||
t3.Value01 = "45°"; t3.Value07 = "0"; t3.Value09 = "R3"; t3.Value14 = "云母"; t3.Value19 = "2";
|
||||
t4.Value01 = "75°"; t4.Value07 = "0"; t4.Value09 = "R4"; t4.Value14 = "清漆"; t4.Value19 = "2";
|
||||
t5.Value01 = "110°"; t5.Value07 = "0"; t5.Value09 = "R5"; t5.Value14 = "总膜厚"; t5.Value19 = "2";
|
||||
t6.Value01 = ""; t6.Value07 = "0"; t6.Value09 = "R6"; t6.Value14 = ""; t6.Value19 = "2";
|
||||
t2.IdGroup = t1.IdGroup;
|
||||
t3.IdGroup = t1.IdGroup;
|
||||
t4.IdGroup = t1.IdGroup;
|
||||
t5.IdGroup = t1.IdGroup;
|
||||
t6.IdGroup = t1.IdGroup;
|
||||
List<PLBatch> list = new()
|
||||
{
|
||||
t1,
|
||||
t2,
|
||||
t3,
|
||||
t4,
|
||||
t5,
|
||||
t6
|
||||
};
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除批处理数据
|
||||
/// </summary>
|
||||
/// <param name="idGroup"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int DelPLBatchRecords(string idGroup)
|
||||
{
|
||||
return Context.Deleteable<PLBatch>().Where(it => it.IdGroup.Equals(idGroup)).ExecuteCommand();
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除批处理数据
|
||||
/// </summary>
|
||||
/// <param name="idGroup"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int DelPLBatchRecords(string idGroup)
|
||||
{
|
||||
return Context.Deleteable<PLBatch>().Where(it => it.IdGroup.Equals(idGroup)).ExecuteCommand();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取批处理数据
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<PLBatch>, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize)
|
||||
{
|
||||
starttime = starttime.ToLocalTime();
|
||||
endTime = endTime.ToLocalTime();
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<PLBatch>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
|
||||
.AndIF(!string.IsNullOrEmpty(description), it => it.Description.Contains(description))
|
||||
.ToExpression();
|
||||
/// <summary>
|
||||
/// 获取批处理数据
|
||||
/// </summary>
|
||||
/// <param name="starttime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<PLBatch>, int) GetPLBatchTable(DateTime starttime, DateTime endTime, string code, string description, int pageNum, int pageSize, int dateType, string workOrder)
|
||||
{
|
||||
//starttime = starttime.ToLocalTime();
|
||||
//endTime = endTime.ToLocalTime();
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<PLBatch>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 1, it => it.CreatedTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 1, it => it.CreatedTime <= endTime)
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 2, it => Convert.ToDateTime(it.Dt) >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 2, it => Convert.ToDateTime(it.Dt) <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(workOrder), it => it.Workorder.Contains(workOrder))
|
||||
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
|
||||
.AndIF(!string.IsNullOrEmpty(description), it => it.Description.Contains(description))
|
||||
.ToExpression();
|
||||
|
||||
//int totalNum = 0;
|
||||
List<PLBatch> data = Context.Queryable<PLBatch>()
|
||||
.Where(predicate)
|
||||
.OrderByDescending(it => it.IdGroup)
|
||||
.OrderBy(it => it.Id)
|
||||
.ToPageList(pageNum, pageSize, ref totalNum);
|
||||
return (data, totalNum);
|
||||
}
|
||||
//int totalNum = 0;
|
||||
List<PLBatch> data = Context.Queryable<PLBatch>()
|
||||
.Where(predicate)
|
||||
.OrderByDescending(it => it.IdGroup)
|
||||
.OrderBy(it => it.Id)
|
||||
.ToPageList(pageNum, pageSize, ref totalNum);
|
||||
return (data, totalNum);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新批处理数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int UpdatePLBatchRecords(List<PLBatch> list)
|
||||
{
|
||||
return Context.Updateable<PLBatch>(list).ExecuteCommand();
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新批处理数据
|
||||
/// </summary>
|
||||
/// <param name="list"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public int UpdatePLBatchRecords(List<PLBatch> list)
|
||||
{
|
||||
return Context.Updateable<PLBatch>(list).ExecuteCommand();
|
||||
}
|
||||
|
||||
private PLBatch GetDefaultPLBatch()
|
||||
{
|
||||
return new PLBatch()
|
||||
{
|
||||
Id = 0,
|
||||
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
|
||||
Workorder = "",
|
||||
Description = "",
|
||||
Dt = "",
|
||||
Code = "",
|
||||
Value01 = "",
|
||||
Value02 = "",
|
||||
Value03 = "",
|
||||
Value04 = "",
|
||||
Value05 = "",
|
||||
Value06 = "",
|
||||
Value07 = "",
|
||||
Value08 = "",
|
||||
Value09 = "",
|
||||
Value10 = "",
|
||||
Value11 = "",
|
||||
Value12 = "",
|
||||
Value13 = "",
|
||||
Value14 = "",
|
||||
Value15 = "",
|
||||
Value16 = "",
|
||||
Value17 = "",
|
||||
Value18 = "",
|
||||
Value19 = "",
|
||||
CreatedBy = "user",
|
||||
CreatedTime = DateTime.Now,
|
||||
UpdatedBy = "user",
|
||||
UpdatedTime = DateTime.Now,
|
||||
};
|
||||
}
|
||||
private PLBatch GetDefaultPLBatch()
|
||||
{
|
||||
return new PLBatch()
|
||||
{
|
||||
Id = 0,
|
||||
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
|
||||
Workorder = "",
|
||||
Description = "",
|
||||
Dt = "",
|
||||
Code = "",
|
||||
Value01 = "",
|
||||
Value02 = "",
|
||||
Value03 = "",
|
||||
Value04 = "",
|
||||
Value05 = "",
|
||||
Value06 = "",
|
||||
Value07 = "",
|
||||
Value08 = "",
|
||||
Value09 = "",
|
||||
Value10 = "",
|
||||
Value11 = "",
|
||||
Value12 = "",
|
||||
Value13 = "",
|
||||
Value14 = "",
|
||||
Value15 = "",
|
||||
Value16 = "",
|
||||
Value17 = "",
|
||||
Value18 = "",
|
||||
Value19 = "",
|
||||
CreatedBy = "user",
|
||||
CreatedTime = DateTime.Now,
|
||||
UpdatedBy = "user",
|
||||
UpdatedTime = DateTime.Now,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取今天是本年的第几周
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
static int GetWeekOfYear(DateTime date)
|
||||
{
|
||||
// 使用ISO 8601标准计算一年中的第几周
|
||||
return CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(
|
||||
date,
|
||||
CalendarWeekRule.FirstFourDayWeek, // 每年的第一周必须至少有4天属于该年
|
||||
DayOfWeek.Monday
|
||||
); // 设置一周的第一天为星期一
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取今天是本年的第几周
|
||||
/// </summary>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
static int GetWeekOfYear(DateTime date)
|
||||
{
|
||||
// 使用ISO 8601标准计算一年中的第几周
|
||||
return CultureInfo.InvariantCulture.Calendar.GetWeekOfYear(
|
||||
date,
|
||||
CalendarWeekRule.FirstFourDayWeek, // 每年的第一周必须至少有4天属于该年
|
||||
DayOfWeek.Monday
|
||||
); // 设置一周的第一天为星期一
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取星期几的数字(7为周日)
|
||||
/// </summary>
|
||||
/// <param name="dayOfWeek"></param>
|
||||
/// <returns></returns>
|
||||
static int ConvertDayOfWeekToCustomFormat(DayOfWeek dayOfWeek)
|
||||
{
|
||||
// 将 DayOfWeek 枚举值转换为自定义格式:周一为1,周日为7
|
||||
if (dayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)dayOfWeek;
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取星期几的数字(7为周日)
|
||||
/// </summary>
|
||||
/// <param name="dayOfWeek"></param>
|
||||
/// <returns></returns>
|
||||
static int ConvertDayOfWeekToCustomFormat(DayOfWeek dayOfWeek)
|
||||
{
|
||||
// 将 DayOfWeek 枚举值转换为自定义格式:周一为1,周日为7
|
||||
if (dayOfWeek == DayOfWeek.Sunday)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (int)dayOfWeek;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,15 +66,17 @@ namespace ZR.Service.mes.ql
|
||||
/// <param name="pageSize"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize)
|
||||
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, string code,string description, int pageNum, int pageSize, int dateType)
|
||||
{
|
||||
starttime = starttime.ToLocalTime();
|
||||
endTime = endTime.ToLocalTime();
|
||||
//starttime = starttime.ToLocalTime();
|
||||
//endTime = endTime.ToLocalTime();
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<PLTest>()
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime >= starttime.ToLocalTime())
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.CreatedTime <= endTime.ToLocalTime())
|
||||
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0)&&dateType==1, it => it.CreatedTime >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 1, it => it.CreatedTime <= endTime)
|
||||
.AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 2, it =>Convert.ToDateTime(it.Dt) >= starttime)
|
||||
.AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0) && dateType == 2, it => Convert.ToDateTime(it.Dt) <= endTime)
|
||||
.AndIF(!string.IsNullOrEmpty(code), it => it.Code.Contains(code))
|
||||
.AndIF(!string.IsNullOrEmpty(description), it => it.Description.Contains(description))
|
||||
.ToExpression();
|
||||
|
||||
|
||||
@@ -11,245 +11,257 @@ using ZR.Service.mes.wms.IService;
|
||||
|
||||
namespace ZR.Service.mes.wms
|
||||
{
|
||||
/// <summary>
|
||||
/// 毛坯库存表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(
|
||||
ServiceType = typeof(IWmBlankInventoryService),
|
||||
ServiceLifetime = LifeTime.Transient
|
||||
)]
|
||||
public class WmBlankInventoryService : BaseService<WmBlankInventory>, IWmBlankInventoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询毛坯库存表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmBlankInventoryDto> GetList(WmBlankInventoryQueryDto parm)
|
||||
{
|
||||
var predicate = Expressionable
|
||||
.Create<WmBlankInventory>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.BlankNum),
|
||||
it => it.BlankNum.Contains(parm.BlankNum)
|
||||
)
|
||||
.AndIF(parm.Status > -1, it => it.Status == parm.Status)
|
||||
.AndIF(parm.Type > 0, it => it.Type == parm.Type);
|
||||
/// <summary>
|
||||
/// 毛坯库存表Service业务层处理
|
||||
/// </summary>
|
||||
[AppService(
|
||||
ServiceType = typeof(IWmBlankInventoryService),
|
||||
ServiceLifetime = LifeTime.Transient
|
||||
)]
|
||||
public class WmBlankInventoryService : BaseService<WmBlankInventory>, IWmBlankInventoryService
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询毛坯库存表列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<WmBlankInventoryDto> GetList(WmBlankInventoryQueryDto parm)
|
||||
{
|
||||
List<string> blankNums = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Type == 2)
|
||||
.Where(it => it.Status == 1).WhereIF(!string.IsNullOrEmpty(parm.Description), it => it.Description.Contains(parm.Description) || it.ProductName.Contains(parm.Description)).Select(o => o.BlankNum).ToList();
|
||||
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
.OrderByDescending(it => it.UpdatedTime)
|
||||
.ToPage<WmBlankInventory, WmBlankInventoryDto>(parm);
|
||||
if (response.Result.Count > 0)
|
||||
{
|
||||
foreach (WmBlankInventoryDto item in response.Result)
|
||||
{
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.BlankNum == item.BlankNum)
|
||||
.Where(it => it.Type == 2)
|
||||
.Where(it => it.Status == 1)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
item.Description = "此毛坯号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.Color = material.Color;
|
||||
item.Unit = material.Unit;
|
||||
item.Version = material.Version;
|
||||
item.Specification = material.Specification;
|
||||
item.Description = !string.IsNullOrEmpty(material.Description)
|
||||
? material.Description
|
||||
: material.ProductName;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
var predicate = Expressionable
|
||||
.Create<WmBlankInventory>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.BlankNum),
|
||||
it => it.BlankNum.Contains(parm.BlankNum)
|
||||
)
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(parm.Description),
|
||||
it => blankNums.Contains(it.BlankNum)
|
||||
)
|
||||
.AndIF(parm.Status > -1, it => it.Status == parm.Status)
|
||||
.AndIF(parm.Type > 0, it => it.Type == parm.Type);
|
||||
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmBlankInventory GetInfo(string Id)
|
||||
{
|
||||
var response = Queryable().Where(x => x.Id == Id).First();
|
||||
var response = Queryable()
|
||||
.Where(predicate.ToExpression())
|
||||
|
||||
return response;
|
||||
}
|
||||
.OrderByDescending(it => it.UpdatedTime)
|
||||
.ToPage<WmBlankInventory, WmBlankInventoryDto>(parm);
|
||||
if (response.Result.Count > 0)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 添加毛坯库存表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmBlankInventory AddWmBlankInventory(WmBlankInventory model)
|
||||
{
|
||||
bool hasRecord = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.BlankNum == model.BlankNum)
|
||||
.Where(it => it.Type == model.Type)
|
||||
.Any();
|
||||
if (hasRecord)
|
||||
{
|
||||
throw new Exception("毛坯仓库已有相同类别的毛坯号记录");
|
||||
}
|
||||
model.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改毛坯库存表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmBlankInventory(WmBlankInventory model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmBlankInventory()
|
||||
//{
|
||||
// BlankNum = model.BlankNum,
|
||||
// Quantity = model.Quantity,
|
||||
// MaxNum = model.MaxNum,
|
||||
// MinNum = model.MinNum,
|
||||
// WarnNum = model.WarnNum,
|
||||
// Type = model.Type,
|
||||
// Status = model.Status,
|
||||
// Remark = model.Remark,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
foreach (WmBlankInventoryDto item in response.Result)
|
||||
{
|
||||
WmMaterial material = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.BlankNum == item.BlankNum)
|
||||
.Where(it => it.Type == 2)
|
||||
.Where(it => it.Status == 1)
|
||||
.First();
|
||||
if (material == null)
|
||||
{
|
||||
item.Description = "此毛坯号不在物料清单内!";
|
||||
continue;
|
||||
}
|
||||
item.Color = material.Color;
|
||||
item.Unit = material.Unit;
|
||||
item.Version = material.Version;
|
||||
item.Specification = material.Specification;
|
||||
item.Description = !string.IsNullOrEmpty(material.Description)
|
||||
? material.Description
|
||||
: material.ProductName;
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
public int SynchronousMaterial(WmBlankInventory parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
List<WmMaterial> materials = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Type == 2)
|
||||
.Where(it => !string.IsNullOrEmpty(it.BlankNum))
|
||||
.OrderBy(it => it.BlankNum)
|
||||
.ToList();
|
||||
var uniqueBlankNums = materials.Select(m => m.BlankNum).Distinct().ToList();
|
||||
var wmBlankInventories = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => uniqueBlankNums.Contains(it.BlankNum))
|
||||
.ToList()
|
||||
.GroupBy(it => it.BlankNum)
|
||||
.ToDictionary(g => g.Key, g => g.FirstOrDefault());
|
||||
foreach (WmMaterial item in materials)
|
||||
{
|
||||
int result = 0;
|
||||
if (
|
||||
!wmBlankInventories.TryGetValue(item.BlankNum, out WmBlankInventory wmBlank)
|
||||
)
|
||||
{
|
||||
// 没有找到匹配的BlankNum,添加两种类型的库存
|
||||
result += AddBlankInventory(
|
||||
item.BlankNum,
|
||||
1,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
result += AddBlankInventory(
|
||||
item.BlankNum,
|
||||
2,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 找到了匹配的BlankNum,根据Type添加库存
|
||||
if (wmBlank.Type == 1)
|
||||
{
|
||||
result = AddBlankInventory(
|
||||
item.BlankNum,
|
||||
2,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = AddBlankInventory(
|
||||
item.BlankNum,
|
||||
1,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
}
|
||||
if (result > 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("同步异常:" + ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取详情
|
||||
/// </summary>
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
public WmBlankInventory GetInfo(string Id)
|
||||
{
|
||||
var response = Queryable().Where(x => x.Id == Id).First();
|
||||
|
||||
/// <summary>
|
||||
/// 自动添加毛坯库存记录
|
||||
/// </summary>
|
||||
/// <param name="blankNum"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public int AddBlankInventory(
|
||||
string blankNum,
|
||||
int type,
|
||||
string createBy = "",
|
||||
DateTime? createTime = null
|
||||
)
|
||||
{
|
||||
bool hasRecord = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.BlankNum == blankNum)
|
||||
.Where(it => it.Type == type)
|
||||
.Any();
|
||||
if (hasRecord)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
WmBlankInventory wmBlank =
|
||||
new()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
||||
FkPaintId = string.Empty,
|
||||
BlankNum = blankNum,
|
||||
Quantity = 0,
|
||||
MaxNum = 0,
|
||||
MinNum = 0,
|
||||
WarnNum = 0,
|
||||
Type = type,
|
||||
Status = 1,
|
||||
Remark = string.Empty,
|
||||
CreatedBy = createBy,
|
||||
CreatedTime = createTime,
|
||||
UpdatedBy = createBy,
|
||||
UpdatedTime = createTime,
|
||||
};
|
||||
return response;
|
||||
}
|
||||
|
||||
return Context.Insertable(wmBlank).ExecuteCommand();
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加毛坯库存表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public WmBlankInventory AddWmBlankInventory(WmBlankInventory model)
|
||||
{
|
||||
bool hasRecord = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.BlankNum == model.BlankNum)
|
||||
.Where(it => it.Type == model.Type)
|
||||
.Any();
|
||||
if (hasRecord)
|
||||
{
|
||||
throw new Exception("毛坯仓库已有相同类别的毛坯号记录");
|
||||
}
|
||||
model.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
||||
return Context.Insertable(model).ExecuteReturnEntity();
|
||||
}
|
||||
|
||||
// 获取毛坯仓库零件数量
|
||||
public int GetPartNumber()
|
||||
{
|
||||
return Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.Status == 1)
|
||||
.Sum(it => it.Quantity) ?? 0;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 修改毛坯库存表
|
||||
/// </summary>
|
||||
/// <param name="model"></param>
|
||||
/// <returns></returns>
|
||||
public int UpdateWmBlankInventory(WmBlankInventory model)
|
||||
{
|
||||
//var response = Update(w => w.Id == model.Id, it => new WmBlankInventory()
|
||||
//{
|
||||
// BlankNum = model.BlankNum,
|
||||
// Quantity = model.Quantity,
|
||||
// MaxNum = model.MaxNum,
|
||||
// MinNum = model.MinNum,
|
||||
// WarnNum = model.WarnNum,
|
||||
// Type = model.Type,
|
||||
// Status = model.Status,
|
||||
// Remark = model.Remark,
|
||||
// CreatedBy = model.CreatedBy,
|
||||
// CreatedTime = model.CreatedTime,
|
||||
// UpdatedBy = model.UpdatedBy,
|
||||
// UpdatedTime = model.UpdatedTime,
|
||||
//});
|
||||
//return response;
|
||||
return Update(model, true);
|
||||
}
|
||||
|
||||
public int SynchronousMaterial(WmBlankInventory parm)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
List<WmMaterial> materials = Context
|
||||
.Queryable<WmMaterial>()
|
||||
.Where(it => it.Type == 2)
|
||||
.Where(it => !string.IsNullOrEmpty(it.BlankNum))
|
||||
.OrderBy(it => it.BlankNum)
|
||||
.ToList();
|
||||
var uniqueBlankNums = materials.Select(m => m.BlankNum).Distinct().ToList();
|
||||
var wmBlankInventories = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => uniqueBlankNums.Contains(it.BlankNum))
|
||||
.ToList()
|
||||
.GroupBy(it => it.BlankNum)
|
||||
.ToDictionary(g => g.Key, g => g.FirstOrDefault());
|
||||
foreach (WmMaterial item in materials)
|
||||
{
|
||||
int result = 0;
|
||||
if (
|
||||
!wmBlankInventories.TryGetValue(item.BlankNum, out WmBlankInventory wmBlank)
|
||||
)
|
||||
{
|
||||
// 没有找到匹配的BlankNum,添加两种类型的库存
|
||||
result += AddBlankInventory(
|
||||
item.BlankNum,
|
||||
1,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
result += AddBlankInventory(
|
||||
item.BlankNum,
|
||||
2,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 找到了匹配的BlankNum,根据Type添加库存
|
||||
if (wmBlank.Type == 1)
|
||||
{
|
||||
result = AddBlankInventory(
|
||||
item.BlankNum,
|
||||
2,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
result = AddBlankInventory(
|
||||
item.BlankNum,
|
||||
1,
|
||||
parm.CreatedBy,
|
||||
parm.CreatedTime
|
||||
);
|
||||
}
|
||||
}
|
||||
if (result > 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("同步异常:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动添加毛坯库存记录
|
||||
/// </summary>
|
||||
/// <param name="blankNum"></param>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public int AddBlankInventory(
|
||||
string blankNum,
|
||||
int type,
|
||||
string createBy = "",
|
||||
DateTime? createTime = null
|
||||
)
|
||||
{
|
||||
bool hasRecord = Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.BlankNum == blankNum)
|
||||
.Where(it => it.Type == type)
|
||||
.Any();
|
||||
if (hasRecord)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
WmBlankInventory wmBlank =
|
||||
new()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
||||
FkPaintId = string.Empty,
|
||||
BlankNum = blankNum,
|
||||
Quantity = 0,
|
||||
MaxNum = 0,
|
||||
MinNum = 0,
|
||||
WarnNum = 0,
|
||||
Type = type,
|
||||
Status = 1,
|
||||
Remark = string.Empty,
|
||||
CreatedBy = createBy,
|
||||
CreatedTime = createTime,
|
||||
UpdatedBy = createBy,
|
||||
UpdatedTime = createTime,
|
||||
};
|
||||
|
||||
return Context.Insertable(wmBlank).ExecuteCommand();
|
||||
}
|
||||
|
||||
// 获取毛坯仓库零件数量
|
||||
public int GetPartNumber()
|
||||
{
|
||||
return Context
|
||||
.Queryable<WmBlankInventory>()
|
||||
.Where(it => it.Status == 1)
|
||||
.Sum(it => it.Quantity) ?? 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user