shgx_tz_mom/ZR.Service/mes/wms/WMlocationInfoService.cs

47 lines
1.7 KiB
C#

using Infrastructure.Attribute;
using SqlSugar;
using System;
using ZR.Model.MES.wms;
using ZR.Service.mes.wms.IService;
namespace ZR.Service.mes.wms
{
[AppService(ServiceType = typeof(IWMlocationInfoService), ServiceLifetime = LifeTime.Transient)]
public class WMlocationInfoService : BaseService<WmInfo>, IWMlocationInfoService
{
/// <summary>
/// 查询库位信息
/// </summary>
/// <param name="warehouse_num"></param>
/// <param name="locationcode"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public WmInfo Getlocationinfo(int warehouse_num, string locationcode)
{
return Context.Queryable<WmInfo>().Where(it => it.WarehouseNum == warehouse_num && it.Location == locationcode).First();
}
/// <summary>
/// 获取成品库库位信息
/// </summary>
/// <param name="shelf"></param>
/// <param name="layer"></param>
/// <param name="pageNum"></param>
/// <param name="pageSize"></param>
/// <returns></returns>
public (List<WmInfo>, int) Getwminfo_product(string shelf, int layer, int pageNum, int pageSize)
{
int totalNum = 0;
var predicate = Expressionable.Create<WmInfo>()
.AndIF(!string.IsNullOrEmpty(shelf), it => it.Shelf.Contains(shelf))
.AndIF(layer > 0, it => it.Layer == layer)
.ToExpression();
List<WmInfo> product_wminfoList = Context.Queryable<WmInfo>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
return (product_wminfoList, totalNum);
}
}
}