Files

71 lines
1.8 KiB
C#
Raw Permalink Normal View History

2021-01-05 11:11:28 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dapper;
using NX.ERP.Model;
namespace NX.ERP.U8.Base
{
public class BinDAL
{
2021-01-18 11:38:02 +08:00
public IEnumerable<Bin> GetList(string strwhere = "", object Params = null)
2021-01-05 11:11:28 +08:00
{
2021-01-25 09:47:41 +08:00
using (var conn = U8LoginContext.Instance.Connection)
2021-01-05 11:11:28 +08:00
{
2021-01-19 10:19:10 +08:00
var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode,
2021-06-04 11:22:42 +08:00
iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode,CONVERT(BIGINT,pubufts) AS pubufts from Position";
2021-01-11 09:07:29 +08:00
if (!string.IsNullOrEmpty(strwhere))
{
sql += $" where {strwhere}";
}
return conn.Query<Bin>(sql, Params);
2021-01-05 11:11:28 +08:00
}
}
2021-01-13 10:21:56 +08:00
2021-06-04 11:22:42 +08:00
public IEnumerable<Bin> GetList(long Pubufts)
{
return this.GetList("CONVERT(BIGINT,pubufts) > @Pubufts", new { Pubufts });
}
2021-01-13 10:21:56 +08:00
public IEnumerable<Bin> GetListByWhCode(string Code)
{
return this.GetList(" cWhCode=@Code", new { Code });
}
2021-01-19 10:19:10 +08:00
public IEnumerable<Bin> GetList(NX.ERP.Model.Request.Bin Param)
{
List<string> where = new List<string>();
if (!string.IsNullOrEmpty(Param.BinCode))
{
where.Add(" cPosCode like @BinCode");
}
if (!string.IsNullOrEmpty(Param.WarehouseCode))
{
where.Add(" cWhCode like @WarehouseCode");
}
return this.GetList(string.Join(" and ", where.ToArray()), new
{
BinCode = $"%{Param.BinCode}%",
2021-06-04 11:22:42 +08:00
WarehouseCode = $"%{Param.WarehouseCode}%"
2021-01-19 10:19:10 +08:00
});
}
2021-01-18 11:38:02 +08:00
2021-01-05 11:11:28 +08:00
}
}