93 lines
3.1 KiB
C#
93 lines
3.1 KiB
C#
using System;
|
|
using SqlSugar;
|
|
using Infrastructure.Attribute;
|
|
using Infrastructure.Extensions;
|
|
using ZR.Model;
|
|
using ZR.Repository;
|
|
|
|
using System.Linq;
|
|
using ZR.Model.MES.dev;
|
|
using ZR.Model.MES.dev.Dto;
|
|
using ZR.Service.MES.dev.IService;
|
|
using System.Xml.Linq;
|
|
|
|
namespace ZR.Service.MES.dev
|
|
{
|
|
/// <summary>
|
|
/// 点检任务Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IDevicePointInspectionPlanService), ServiceLifetime = LifeTime.Transient)]
|
|
public class DevicePointInspectionPlanService : BaseService<DevicePointInspectionPlan>, IDevicePointInspectionPlanService
|
|
{
|
|
/// <summary>
|
|
/// 查询点检任务列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<DevicePointInspectionPlanDto> GetList(DevicePointInspectionPlanQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<DevicePointInspectionPlan>()
|
|
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name.Contains(parm.Name))
|
|
.AndIF(parm.Status > -1, it => it.Status == parm.Status)
|
|
.AndIF(parm.Starttime != null, it => it.CreatedTime >= parm.Starttime)
|
|
.AndIF(parm.Endtime != null, it => it.CreatedTime <= parm.Endtime)
|
|
.AndIF(parm.InnerType > -1, it => it.InnerType == parm.InnerType);
|
|
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<DevicePointInspectionPlan, DevicePointInspectionPlanDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public DevicePointInspectionPlan GetInfo(string Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加点检任务
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public DevicePointInspectionPlan AddDevicePointInspectionPlan(DevicePointInspectionPlan model)
|
|
{
|
|
model.Id = SnowFlakeSingle.Instance.NextId().ToString();
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改点检任务
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateDevicePointInspectionPlan(DevicePointInspectionPlan model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new DevicePointInspectionPlan()
|
|
//{
|
|
// Name = model.Name,
|
|
// Status = model.Status,
|
|
// Type = model.Type,
|
|
// Remark = model.Remark,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |