|
|
|
|
using System;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using DSWeb.WMS.Models.WMS_STOREHOUSE;
|
|
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
|
|
using HcUtility.Comm;
|
|
|
|
|
using System.Web.Mvc;//ContentResult
|
|
|
|
|
using DSWeb.TruckMng.Helper.Repository;//ModelObjectRepository
|
|
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
|
|
using DSWeb.Areas.CommMng.DAL;//使用获取权限子句
|
|
|
|
|
using DSWeb.Areas.SysMng.DAL.SysTask;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.WMS.DAL.WMS_STOREHOUSE
|
|
|
|
|
{
|
|
|
|
|
public class WMS_STOREHOUSEDAL
|
|
|
|
|
{
|
|
|
|
|
#region 库存 头表/物理库存/逻辑仓储区
|
|
|
|
|
|
|
|
|
|
static public List<WMS_STOREHOUSEmb> GetDataList ( string strCondition,string USERID, int start, int limit, string sort = "" )
|
|
|
|
|
{
|
|
|
|
|
var strSql = getHeadListStr(strCondition, USERID, start, limit, sort);
|
|
|
|
|
|
|
|
|
|
return SetData(strSql);
|
|
|
|
|
}
|
|
|
|
|
public static WMS_STOREHOUSEmb GetData(string condition, string USERID)
|
|
|
|
|
{
|
|
|
|
|
var dataList = GetDataList(condition, USERID,0,1);
|
|
|
|
|
|
|
|
|
|
var result = new WMS_STOREHOUSEmb();
|
|
|
|
|
|
|
|
|
|
if (dataList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
result = dataList[0];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.getDef(USERID);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
public static string getHeadListStr(string strCondition, string USERID,int start,int limit,string sort="")
|
|
|
|
|
{
|
|
|
|
|
string sql = WMS_STOREHOUSEmb.getSQL();
|
|
|
|
|
|
|
|
|
|
var param = new BasicDataRefDAL.PagedQuaryParam();
|
|
|
|
|
param.strSql = sql.ToString();
|
|
|
|
|
param.strCondition = strCondition;
|
|
|
|
|
param.rangestr = "";
|
|
|
|
|
//if (!string.IsNullOrWhiteSpace(sort))
|
|
|
|
|
//{
|
|
|
|
|
// sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
//}
|
|
|
|
|
param.sortstring = sort;
|
|
|
|
|
param.defaultsortstr = " BSNO ";
|
|
|
|
|
param.start = start;
|
|
|
|
|
param.limit = limit;
|
|
|
|
|
|
|
|
|
|
return BasicDataRefDAL.PagedQuaryStr(param).ToString();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private static List<WMS_STOREHOUSEmb> SetData(string strSql)//, List<HcUtility.Core.Fieldmb> fieldlist
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<WMS_STOREHOUSEmb>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
//string sql = getHeadListStr(strSql.ToString(), USERID);
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
////根据字段名设定同名属性值
|
|
|
|
|
WMS_STOREHOUSEmb data = new WMS_STOREHOUSEmb();
|
|
|
|
|
data.SetExtendValue(reader);
|
|
|
|
|
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string getGoodsListStr(string condition)
|
|
|
|
|
{
|
|
|
|
|
string sql = WMS_STOREHOUSE_GOODSTYPEmb.getSQL() + condition;
|
|
|
|
|
|
|
|
|
|
return sql;
|
|
|
|
|
}
|
|
|
|
|
static public List<WMS_STOREHOUSE_GOODSTYPEmb> getLogicList(string strCondition, string sort = null)
|
|
|
|
|
{
|
|
|
|
|
var strSql = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(strCondition))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" and " + strCondition);
|
|
|
|
|
}
|
|
|
|
|
var sortstring = DatasetSort.Getsortstring(sort);
|
|
|
|
|
if (!string.IsNullOrEmpty(sortstring))
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by " + sortstring);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
strSql.Append(" order by sort ");
|
|
|
|
|
}
|
|
|
|
|
return SetGoodsListData(strSql);
|
|
|
|
|
}
|
|
|
|
|
private static List<WMS_STOREHOUSE_GOODSTYPEmb> SetGoodsListData(StringBuilder strSql)//, List<HcUtility.Core.Fieldmb> fieldlist
|
|
|
|
|
{
|
|
|
|
|
var headList = new List<WMS_STOREHOUSE_GOODSTYPEmb>();
|
|
|
|
|
Database db = DatabaseFactory.CreateDatabase();
|
|
|
|
|
|
|
|
|
|
string sql = getGoodsListStr(strSql.ToString());
|
|
|
|
|
|
|
|
|
|
using (IDataReader reader = db.ExecuteReader(CommandType.Text, sql))
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
////根据字段名设定同名属性值
|
|
|
|
|
WMS_STOREHOUSE_GOODSTYPEmb data = new WMS_STOREHOUSE_GOODSTYPEmb();
|
|
|
|
|
data.SetExtendValue(reader);
|
|
|
|
|
|
|
|
|
|
headList.Add(data);
|
|
|
|
|
}
|
|
|
|
|
reader.Close();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return headList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|