96 lines
3.4 KiB
C#
96 lines
3.4 KiB
C#
using Infrastructure.Attribute;
|
|
using SqlSugar;
|
|
using System;
|
|
using ZR.Model;
|
|
using ZR.Model.MES.wms;
|
|
using ZR.Model.MES.wms.Dto;
|
|
using ZR.Repository;
|
|
using ZR.Service.mes.wms.IService;
|
|
|
|
namespace ZR.Service.mes.wms
|
|
{
|
|
/// <summary>
|
|
/// 成品库数据变动表Service业务层处理
|
|
/// </summary>
|
|
[AppService(ServiceType = typeof(IWmGoodsRecordService), ServiceLifetime = LifeTime.Transient)]
|
|
public class WmGoodsRecordService : BaseService<WmGoodsRecord>, IWmGoodsRecordService
|
|
{
|
|
/// <summary>
|
|
/// 查询成品库数据变动表列表
|
|
/// </summary>
|
|
/// <param name="parm"></param>
|
|
/// <returns></returns>
|
|
public PagedInfo<WmGoodsRecordDto> GetList(WmGoodsRecordQueryDto parm)
|
|
{
|
|
var predicate = Expressionable.Create<WmGoodsRecord>()
|
|
.AndIF(parm.ChangeType > 0, it => it.ChangeType == parm.ChangeType)
|
|
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code.Contains(parm.Code))
|
|
.AndIF(!string.IsNullOrEmpty(parm.Remark), it => it.Remark.Contains(parm.Remark))
|
|
.AndIF(!string.IsNullOrEmpty(parm.CreatedBy), it => it.CreatedBy.Contains(parm.CreatedBy))
|
|
// 当天0点
|
|
.AndIF(parm.StartActionTime > DateTime.MinValue, it => it.ActionTime >= parm.StartActionTime.Value.ToLocalTime())
|
|
// 当天23点59分59秒
|
|
.AndIF(parm.EndActionTime > DateTime.MinValue, it => it.ActionTime <= parm.EndActionTime.Value.ToLocalTime())
|
|
;
|
|
|
|
var response = Queryable()
|
|
.Where(predicate.ToExpression())
|
|
.ToPage<WmGoodsRecord, WmGoodsRecordDto>(parm);
|
|
|
|
return response;
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取详情
|
|
/// </summary>
|
|
/// <param name="Id"></param>
|
|
/// <returns></returns>
|
|
public WmGoodsRecord GetInfo(string Id)
|
|
{
|
|
var response = Queryable()
|
|
.Where(x => x.Id == Id)
|
|
.First();
|
|
|
|
return response;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加成品库数据变动表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public WmGoodsRecord AddWmGoodsRecord(WmGoodsRecord model)
|
|
{
|
|
return Context.Insertable(model).ExecuteReturnEntity();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改成品库数据变动表
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
public int UpdateWmGoodsRecord(WmGoodsRecord model)
|
|
{
|
|
//var response = Update(w => w.Id == model.Id, it => new WmGoodsRecord()
|
|
//{
|
|
// Code = model.Code,
|
|
// Partnumber = model.Partnumber,
|
|
// BlankNum = model.BlankNum,
|
|
// ChangeType = model.ChangeType,
|
|
// ChangeQuantity = model.ChangeQuantity,
|
|
// ActionTime = model.ActionTime,
|
|
// Status = model.Status,
|
|
// Remark = model.Remark,
|
|
// CreatedBy = model.CreatedBy,
|
|
// CreatedTime = model.CreatedTime,
|
|
// UpdatedBy = model.UpdatedBy,
|
|
// UpdatedTime = model.UpdatedTime,
|
|
//});
|
|
//return response;
|
|
return Update(model, true);
|
|
}
|
|
|
|
}
|
|
} |