This commit is contained in:
xiaowei.song
2024-06-11 17:04:49 +08:00
parent be0ce445a4
commit 95103397b1
15 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.ql;
namespace ZR.Service.mes.ql.IService
{
public interface IPLBatchService
{
public (List<PLBatch>, int) GetPLBatchTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize);
public int AddPLBatchRecords(int num, int size);
public int DelPLBatchRecords(string idGroup);
public int UpdatePLBatchRecords(List<PLBatch> list);
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.qc;
using ZR.Model.MES.ql;
namespace ZR.Service.mes.ql.IService
{
public interface IPLRawMaterialService
{
public (List<PLRawMaterial>, int) GetRawMaterialTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize);
public int AddRawMaterialRecords(int num,int size);
public int DelRawMaterialRecords(string idGroup);
public int UpdateRawMaterialRecords(List<PLRawMaterial> list);
}
}

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.ql;
namespace ZR.Service.mes.ql.IService
{
public interface IPLTestService
{
public (List<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize);
public int AddPLTestRecords(int num, int size);
public int DelPLTestRecords(string idGroup);
public int UpdatePLTestRecords(List<PLTest> list);
}
}

View File

@@ -0,0 +1,128 @@
using Infrastructure.Attribute;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.ql;
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();
t1.Value01 = "15°"; t1.Value07 = "加浆"; t1.Value09 = "R1"; t1.Value14 = "底漆";
t2.Value01 = "25°"; t2.Value07 = "加浆"; t2.Value09 = "R2"; t2.Value14 = "色漆";
t3.Value01 = "45°"; t3.Value07 = "加浆"; t3.Value09 = "R3"; t3.Value14 = "云母";
t4.Value01 = "75°"; t4.Value07 = "加浆"; t4.Value09 = "R4"; t4.Value14 = "清漆";
t5.Value01 = "110°"; t5.Value07 = "加浆"; t5.Value09 = "R5"; t5.Value14 = "总膜厚";
t2.IdGroup = t1.IdGroup;
t3.IdGroup = t1.IdGroup;
t4.IdGroup = t1.IdGroup;
t5.IdGroup = t1.IdGroup;
List<PLBatch> lst = new List<PLBatch>();
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5);
int ret = Context.Insertable<PLBatch>(lst).ExecuteReturnIdentity();
return ret;
}
/// <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, int pageNum, int pageSize)
{
int totalNum = 0;
List<PLBatch> data = Context.Queryable<PLBatch>().Where(it => it.Id > 0).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();
}
private PLBatch GetDefaultPLBatch()
{
return new PLBatch()
{
Id = 0,
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
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,
};
}
}
}

View File

@@ -0,0 +1,146 @@
using Infrastructure.Attribute;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.qc;
using ZR.Model.MES.ql;
using ZR.Service.mes.ql.IService;
namespace ZR.Service.mes.ql
{
/// <summary>
/// 查询报表
/// </summary>
[AppService(ServiceType = typeof(IPLRawMaterialService), ServiceLifetime = LifeTime.Transient)]
public class PLRawMaterialService : BaseService<PLRawMaterial>, IPLRawMaterialService
{
/// <summary>
/// 增加一组,数据记录
/// </summary>
/// <param name="num"></param>
/// <param name="size"></param>
/// <returns></returns>
public int AddRawMaterialRecords(int num, int size)
{
PLRawMaterial t1 = GetDefaultPLRawMaterial();
PLRawMaterial t2 = GetDefaultPLRawMaterial();
PLRawMaterial t3 = GetDefaultPLRawMaterial();
PLRawMaterial t4 = GetDefaultPLRawMaterial();
PLRawMaterial t5 = GetDefaultPLRawMaterial();
t1.Value01 = "15°"; t1.Value07 = "底漆";
t2.Value01 = "25°"; t2.Value07 = "色漆";
t3.Value01 = "45°"; t3.Value07 = "云母";
t4.Value01 = "75°"; t4.Value07 = "清漆";
t5.Value01 = "110°"; t5.Value07 = "总膜厚";
t2.IdGroup = t1.IdGroup;
t3.IdGroup = t1.IdGroup;
t4.IdGroup = t1.IdGroup;
t5.IdGroup = t1.IdGroup;
List<PLRawMaterial> lst = new List<PLRawMaterial>();
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5);
int ret = Context.Insertable<PLRawMaterial>(lst).ExecuteReturnIdentity();
return ret;
}
/// <summary>
/// 删除数据记录
/// </summary>
/// <param name="idGroup"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public int DelRawMaterialRecords(string idGroup)
{
return Context.Deleteable<PLRawMaterial>().Where(it => it.IdGroup.Equals(idGroup)).ExecuteCommand();
}
/// <summary>
/// 查询数据记录,要改成分页查询
/// </summary>
/// <returns></returns>
public (List<PLRawMaterial>, int) GetRawMaterialTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize)
{
//starttime = starttime.ToLocalTime();
//endTime = endTime.ToLocalTime();
//int totalNum = 0;
//var predicate = Expressionable.Create<QcQualityStatisticsAgain>()
// //XXX:修改查询日期查询的字段
// .AndIF(starttime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.StartTime >= starttime.ToLocalTime())
// .AndIF(endTime > new DateTime(2023, 1, 1, 0, 0, 0), it => it.StartTime <= endTime.ToLocalTime())
// .AndIF(!string.IsNullOrEmpty(workorderid), it => it.WorkorderId.Contains(workorderid))
// .AndIF(!string.IsNullOrEmpty(partnumber), it => it.FinishedPartNumber.Contains(partnumber))
// .AndIF(!string.IsNullOrEmpty(team), it => it.Team.Equals(team))
// .AndIF(!string.IsNullOrEmpty(product_description), it => it.ProductDescription.Contains(product_description))
// .ToExpression();
//List<QcQualityStatisticsAgain> data = Context.Queryable<QcQualityStatisticsAgain>().Where(predicate).OrderBy(it => it.WorkorderId).OrderBy(it => it.Remark2).ToPageList(pageNum, pageSize, ref totalNum);
//foreach (QcQualityStatisticsAgain item in data)
//{
// WmMaterial material = Context.Queryable<WmMaterial>()
// .Where(it => it.Partnumber == item.FinishedPartNumber)
// .First();
// if (material == null)
// {
// item.ProductDescription = "此零件号不在物料清单内!";
// continue;
// }
// item.ProductDescription = !string.IsNullOrEmpty(material.Description) ? material.Description : material.ProductName;
//}
//return (data, totalNum);
int totalNum = 0;
List<PLRawMaterial> data = Context.Queryable<PLRawMaterial>().Where(it => it.Id > 0).OrderBy(it => it.Id).ToPageList(pageNum, pageSize, ref totalNum);
return (data, totalNum);
//return (Context.Queryable<PLRawMaterial>().Where(it => it.Id > 0).ToList(),100);
}
/// <summary>
/// 更新数据记录
/// </summary>
/// <param name="list"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public int UpdateRawMaterialRecords(List<PLRawMaterial> list)
{
return Context.Updateable<PLRawMaterial>(list).ExecuteCommand();
}
private PLRawMaterial GetDefaultPLRawMaterial()
{
return new PLRawMaterial()
{
Id = 0,
IdGroup=DateTime.Now.ToString("yyyyMMddHHmmssfff"),
Code="",
Pci="",
Value01="",
Value02 = "",
Value03 = "",
Value04 = "",
Value05 = "",
Value06 = "",
Value07 = "",
Value08 = "",
Value09 = "",
Value10 = "",
Value11 = "",
CreatedBy="user",
CreatedTime=DateTime.Now,
UpdatedBy="user",
UpdatedTime=DateTime.Now,
};
}
}
}

View File

@@ -0,0 +1,125 @@
using Infrastructure.Attribute;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.IdentityModel.Tokens;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using ZR.Model.MES.ql;
using ZR.Service.mes.ql.IService;
namespace ZR.Service.mes.ql
{
/// <summary>
/// 查询报表
/// </summary>
[AppService(ServiceType = typeof(IPLTestService), ServiceLifetime = LifeTime.Transient)]
public class PLTestService : BaseService<PLTest>, IPLTestService
{
/// <summary>
/// 增加调试数据记录
/// </summary>
/// <param name="num"></param>
/// <param name="size"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public int AddPLTestRecords(int num, int size)
{
PLTest t1 = GetDefaultPLTest();
PLTest t2 = GetDefaultPLTest();
PLTest t3 = GetDefaultPLTest();
PLTest t4 = GetDefaultPLTest();
PLTest t5 = GetDefaultPLTest();
t1.Value01 = "15°"; t1.Value07 = "加浆"; t1.Value09 = "R1"; t1.Value14 = "底漆";
t2.Value01 = "25°"; t2.Value07 = "加浆"; t2.Value09 = "R2"; t2.Value14 = "色漆";
t3.Value01 = "45°"; t3.Value07 = "加浆"; t3.Value09 = "R3"; t3.Value14 = "云母";
t4.Value01 = "75°"; t4.Value07 = "加浆"; t4.Value09 = "R4"; t4.Value14 = "清漆";
t5.Value01 = "110°"; t5.Value07 = "加浆"; t5.Value09 = "R5"; t5.Value14 = "总膜厚";
t2.IdGroup = t1.IdGroup;
t3.IdGroup = t1.IdGroup;
t4.IdGroup = t1.IdGroup;
t5.IdGroup = t1.IdGroup;
List<PLTest> lst = new List<PLTest>();
lst.Add(t1); lst.Add(t2); lst.Add(t3); lst.Add(t4); lst.Add(t5);
int ret = Context.Insertable<PLTest>(lst).ExecuteReturnIdentity();
return ret;
}
/// <summary>
/// 删除调试数据记录
/// </summary>
/// <param name="idGroup"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public int DelPLTestRecords(string idGroup)
{
return Context.Deleteable<PLTest>().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<PLTest>, int) GetPLTestTable(DateTime starttime, DateTime endTime, int pageNum, int pageSize)
{
int totalNum = 0;
List<PLTest> data = Context.Queryable<PLTest>().Where(it => it.Id > 0).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 UpdatePLTestRecords(List<PLTest> list)
{
return Context.Updateable<PLTest>(list).ExecuteCommand();
}
private PLTest GetDefaultPLTest()
{
return new PLTest()
{
Id = 0,
IdGroup = DateTime.Now.ToString("yyyyMMddHHmmssfff"),
Dt = "",
Code = "",
Value01 = "",
Value02 = "",
Value03 = "",
Value04 = "",
Value05 = "",
Value06 = "",
Value07 = "",
Value08 = "",
Value09 = "",
Value10 = "",
Value11 = "",
Value12 = "",
Value13 = "",
Value14 = "",
Value15 = "",
Value16 = "",
CreatedBy = "user",
CreatedTime = DateTime.Now,
UpdatedBy = "user",
UpdatedTime = DateTime.Now,
};
}
}
}