shgx_tz_mom/ZR.Service/mes/wms/WmGoodsNowProductionService.cs
2024-03-23 14:31:59 +08:00

94 lines
3.3 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.wms;
using ZR.Model.MES.wms.Dto;
using ZR.Service.mes.wms.IService;
namespace ZR.Service.mes.wms
{
/// <summary>
/// 成品库当前货物表Service业务层处理
/// </summary>
[AppService(ServiceType = typeof(IWmGoodsNowProductionService), ServiceLifetime = LifeTime.Transient)]
public class WmGoodsNowProductionService : BaseService<WmGoodsNowProduction>, IWmGoodsNowProductionService
{
/// <summary>
/// 查询成品库当前货物表列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public PagedInfo<WmGoodsNowProductionDto> GetList(WmGoodsNowProductionQueryDto parm)
{
var predicate = Expressionable.Create<WmGoodsNowProduction>()
.AndIF(!string.IsNullOrEmpty(parm.Partnumber), it => it.Partnumber.Contains(parm.Partnumber))
.AndIF(!string.IsNullOrEmpty(parm.PackageCodeClient), it => it.PackageCodeClient.Contains(parm.PackageCodeClient))
.AndIF(!string.IsNullOrEmpty(parm.LocationCode), it => it.LocationCode.Contains(parm.LocationCode))
;
var response = Queryable()
.Where(predicate.ToExpression())
.ToPage<WmGoodsNowProduction, WmGoodsNowProductionDto>(parm);
return response;
}
/// <summary>
/// 获取详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
public WmGoodsNowProduction GetInfo(string Id)
{
var response = Queryable()
.Where(x => x.Id == Id)
.First();
return response;
}
/// <summary>
/// 添加成品库当前货物表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public WmGoodsNowProduction AddWmGoodsNowProduction(WmGoodsNowProduction model)
{
return Context.Insertable(model).ExecuteReturnEntity();
}
/// <summary>
/// 修改成品库当前货物表
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public int UpdateWmGoodsNowProduction(WmGoodsNowProduction model)
{
//var response = Update(w => w.Id == model.Id, it => new WmGoodsNowProduction()
//{
// PackageCode = model.PackageCode,
// PackageCodeClient = model.PackageCodeClient,
// PackageCodeOriginal = model.PackageCodeOriginal,
// LocationCode = model.LocationCode,
// Partnumber = model.Partnumber,
// GoodsNumLogic = model.GoodsNumLogic,
// GoodsNumAction = model.GoodsNumAction,
// EntryWarehouseTime = model.EntryWarehouseTime,
// Remark = model.Remark,
// UpdatedBy = model.UpdatedBy,
// UpdatedTime = model.UpdatedTime,
// CreatedBy = model.CreatedBy,
// CreatedTime = model.CreatedTime,
//});
//return response;
return Update(model, true);
}
}
}