2024-11-19 17:15:34 +08:00
|
|
|
using System;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using Infrastructure.Attribute;
|
|
|
|
|
using Infrastructure.Extensions;
|
|
|
|
|
using DOAN.Model;
|
|
|
|
|
using DOAN.Model.Dto;
|
|
|
|
|
using DOAN.Model.MES.exception.Dto;
|
|
|
|
|
using DOAN.Model.MES.exception;
|
|
|
|
|
using DOAN.Repository;
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
2024-12-02 12:41:16 +08:00
|
|
|
using DOAN.Model.MES.product;
|
2024-11-19 17:15:34 +08:00
|
|
|
using DOAN.Service.exception.IService;
|
2024-11-19 17:24:29 +08:00
|
|
|
using Org.BouncyCastle.Asn1;
|
2024-11-19 17:15:34 +08:00
|
|
|
|
|
|
|
|
namespace DOAN.Service.exception.Service
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 工单修改日志表Service业务层处理
|
|
|
|
|
/// </summary>
|
|
|
|
|
[AppService(ServiceType = typeof(IProWorkorderUpdateLogService), ServiceLifetime = LifeTime.Transient)]
|
|
|
|
|
public class ProWorkorderUpdateLogService : BaseService<ProWorkorderUpdateLog>, IProWorkorderUpdateLogService
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询工单修改日志表列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="parm"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public PagedInfo<ProWorkorderUpdateLogDto> GetList(ProWorkorderUpdateLogQueryDto parm)
|
|
|
|
|
{
|
2024-12-02 12:41:16 +08:00
|
|
|
var predicate = Expressionable.Create<ProWorkorderUpdateLog,ProWorkorder>()
|
|
|
|
|
.AndIF(!string.IsNullOrEmpty(parm.Workorder),(it,rw)=>it.Workorder.Contains(parm.Workorder))
|
|
|
|
|
.AndIF(!string.IsNullOrEmpty(parm.ResponsiblePerson),(it,rw)=>it.ResponsiblePerson.Contains(parm.ResponsiblePerson))
|
|
|
|
|
.AndIF(parm.SearchDateTimeArray[0]>DateTime.MinValue,(it,rw)=>it.ChangeTime>=parm.SearchDateTimeArray[0])
|
|
|
|
|
.AndIF(parm.SearchDateTimeArray[1]>DateTime.MinValue,(it,rw)=>it.ChangeTime<=parm.SearchDateTimeArray[1])
|
2024-11-19 17:24:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
;
|
2024-11-19 17:15:34 +08:00
|
|
|
|
2024-12-02 12:41:16 +08:00
|
|
|
var response = Queryable().LeftJoin<ProWorkorder>((it,rw)=>it.Workorder==rw.Workorder)
|
2024-11-19 17:15:34 +08:00
|
|
|
.Where(predicate.ToExpression())
|
2024-12-02 12:46:03 +08:00
|
|
|
.OrderByDescending((it,rw)=>it.ChangeTime)
|
2024-12-02 12:41:16 +08:00
|
|
|
.Select((it,rw)=>new ProWorkorderUpdateLogDto()
|
|
|
|
|
{
|
|
|
|
|
ProductionCode = rw.ProductionCode,
|
|
|
|
|
ProductionName = rw.ProductionName,
|
|
|
|
|
Specification = rw.Specification
|
|
|
|
|
|
|
|
|
|
},true)
|
|
|
|
|
.ToPage<ProWorkorderUpdateLogDto, ProWorkorderUpdateLogDto>(parm);
|
2024-11-19 17:15:34 +08:00
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ProWorkorderUpdateLog GetInfo(string Id)
|
|
|
|
|
{
|
|
|
|
|
var response = Queryable()
|
|
|
|
|
.Where(x => x.Id == Id)
|
|
|
|
|
.First();
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 添加工单修改日志表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public ProWorkorderUpdateLog AddProWorkorderUpdateLog(ProWorkorderUpdateLog model)
|
|
|
|
|
{
|
2024-11-19 17:51:56 +08:00
|
|
|
model.Id = XueHua;
|
2024-11-19 17:15:34 +08:00
|
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 修改工单修改日志表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="model"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public int UpdateProWorkorderUpdateLog(ProWorkorderUpdateLog model)
|
|
|
|
|
{
|
|
|
|
|
//var response = Update(w => w.Id == model.Id, it => new ProWorkorderUpdateLog()
|
|
|
|
|
//{
|
|
|
|
|
// Workorder = model.Workorder,
|
|
|
|
|
// Log = model.Log,
|
|
|
|
|
// ResponsiblePerson = model.ResponsiblePerson,
|
|
|
|
|
// Reason = model.Reason,
|
|
|
|
|
// ChangeTime = model.ChangeTime,
|
|
|
|
|
// Operator = model.Operator,
|
|
|
|
|
// CreatedTime = model.CreatedTime,
|
|
|
|
|
// CreatedBy = model.CreatedBy,
|
|
|
|
|
// UpdatedTime = model.UpdatedTime,
|
|
|
|
|
// UpdatedBy = model.UpdatedBy,
|
|
|
|
|
//});
|
|
|
|
|
//return response;
|
|
|
|
|
return Update(model, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|