zhuangpei-mesbackend/DOAN.Service/MES/quality/IPQC/QcTorquedetectionService.cs
qianhao.xu 6583c24f13 1
2025-06-13 16:53:51 +08:00

134 lines
4.7 KiB
C#

using System;
using SqlSugar;
using Infrastructure.Attribute;
using Infrastructure.Extensions;
using DOAN.Model;
using DOAN.Model.Dto;
using DOAN.Repository;
using System.Linq;
using DOAN.Model.MES.quality.IPQC;
using DOAN.Model.MES.quality.IPQC.Dto;
using DOAN.Service.MES.quality.IPQC.IService;
namespace DOAN.Service.MES.quality.IPQC
{
/// <summary>
/// 力矩检测表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IQcTorquedetectionService), ServiceLifetime = LifeTime.Transient)]
public class QcTorquedetectionService : BaseService<QcTorquedetection>, IQcTorquedetectionService
{
/// <summary>
/// 查询力矩检测表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<QcTorquedetectionDto> GetList(QcTorquedetectionQueryDto parm)
{
var predicate = Expressionable.Create<QcTorquedetection>()
.AndIF(parm.Year == null, it => it.Year == DateTime.Now.Year)
.AndIF(parm.Year != null, it => it.Year == parm.Year)
.AndIF(parm.Month == null, it => it.Month == DateTime.Now.Month)
.AndIF(parm.Month != null, it => it.Month == parm.Month)
.AndIF(!string.IsNullOrEmpty(parm.Linecode), it => it.Linecode.Contains(parm.Linecode.Trim()))
.AndIF(!string.IsNullOrEmpty(parm.ProductionName), it => it.ProductionName.Contains(parm.ProductionName.Trim()))
.AndIF(!string.IsNullOrEmpty(parm.CheckName), it => it.CheckName.Contains(parm.CheckName.Trim()))
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<QcTorquedetection, QcTorquedetectionDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public QcTorquedetection GetInfo(int Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加力矩检测表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public QcTorquedetection AddQcTorquedetection(QcTorquedetection model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改力矩检测表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateQcTorquedetection(QcTorquedetection model)
{
//var response = Update(w => w.Id == model.Id, it => new QcTorquedetection()
//{
// Linecode = model.Linecode,
// ProductionName = model.ProductionName,
// CheckName = model.CheckName,
// Year = model.Year,
// Month = model.Month,
// ProcessNo = model.ProcessNo,
// Uplimit = model.Uplimit,
// Lowlimit = model.Lowlimit,
// ScrewdriverNumber = model.ScrewdriverNumber,
// Testingperiod = model.Testingperiod,
// TestTime = model.TestTime,
// No1 = model.No1,
// No2 = model.No2,
// No3 = model.No3,
// No4 = model.No4,
// No5 = model.No5,
// No6 = model.No6,
// No7 = model.No7,
// No8 = model.No8,
// No9 = model.No9,
// No10 = model.No10,
// No11 = model.No11,
// No12 = model.No12,
// No13 = model.No13,
// No14 = model.No14,
// No15 = model.No15,
// No16 = model.No16,
// No17 = model.No17,
// No18 = model.No18,
// No19 = model.No19,
// No20 = model.No20,
// No21 = model.No21,
// No22 = model.No22,
// No23 = model.No23,
// No24 = model.No24,
// No25 = model.No25,
// No26 = model.No26,
// No27 = model.No27,
// No28 = model.No28,
// No29 = model.No29,
// No30 = model.No30,
// No31 = model.No31,
// No32 = model.No32,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
//});
//return response;
return Update(model, true);
}
}
}