设备管理
This commit is contained in:
93
DOAN.Service/MES/Device/DevicePointInspectionPlanService.cs
Normal file
93
DOAN.Service/MES/Device/DevicePointInspectionPlanService.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using SqlSugar;
|
||||
using Infrastructure.Attribute;
|
||||
using Infrastructure.Extensions;
|
||||
using DOAN.Model;
|
||||
using DOAN.Repository;
|
||||
|
||||
using System.Linq;
|
||||
using DOAN.Model.MES.dev;
|
||||
using DOAN.Model.MES.dev.Dto;
|
||||
using DOAN.Service.MES.dev.IService;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace DOAN.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);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user