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 { public IEnumerable GetList(string strwhere = "", object Params = null) { using (var conn = U8LoginContext.Instance.Connection) { var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode, iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode,CONVERT(BIGINT,pubufts) AS pubufts from Position"; if (!string.IsNullOrEmpty(strwhere)) { sql += $" where {strwhere}"; } return conn.Query(sql, Params); } } public IEnumerable GetList(long Pubufts) { return this.GetList("CONVERT(BIGINT,pubufts) > @Pubufts", new { Pubufts }); } public IEnumerable GetListByWhCode(string Code) { return this.GetList(" cWhCode=@Code", new { Code }); } public IEnumerable GetList(NX.ERP.Model.Request.Bin Param) { List where = new List(); 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}%", WarehouseCode = $"%{Param.WarehouseCode}%" }); } } }