Files
U8-Import/NX.ERP.U8/Base/BinDAL.cs

66 lines
1.6 KiB
C#
Raw 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
{
using (var conn = new System.Data.SqlClient.SqlConnection(U8LoginContext.Instance.Constr4Net))
{
2021-01-19 10:19:10 +08:00
var sql = @"select cPosCode as BinCode,cPosName as BinName,iPosGrade,bPosEnd,cWhCode as WarehouseCode,
2021-01-05 11:11:28 +08:00
iMaxCubage as VolumeLimit, iMaxweight as WeightLimit,cMemo,cBarCode 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-01-18 11:38:02 +08:00
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}%",
WarehouseCode=$"%{Param.WarehouseCode}%"
});
}
2021-01-18 11:38:02 +08:00
2021-01-05 11:11:28 +08:00
}
}