188 lines
4.7 KiB
C#
188 lines
4.7 KiB
C#
|
|
|||
|
/// <summary>
|
|||
|
///LOGIC CLASS FOR TABLE t_wmslocation
|
|||
|
///By wm with codesmith.
|
|||
|
///on 05/02/2017
|
|||
|
/// </summary>
|
|||
|
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using DeiNiu.wms.Data.Model;
|
|||
|
using System.Data;
|
|||
|
using System.Transactions;
|
|||
|
using DeiNiu.Utils;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
namespace DeiNiu.wms.Logical
|
|||
|
{
|
|||
|
[Serializable]
|
|||
|
public class lWmslocation:lbase
|
|||
|
{
|
|||
|
Wmslocation _obj;
|
|||
|
public lWmslocation()
|
|||
|
{
|
|||
|
initialize();
|
|||
|
}
|
|||
|
|
|||
|
public lWmslocation(int operId) :base(operId)
|
|||
|
{
|
|||
|
initialize();
|
|||
|
}
|
|||
|
|
|||
|
public Wmslocation getWmslocation
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return _obj;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get all data
|
|||
|
/// </summary>
|
|||
|
public DataSet getAllData()
|
|||
|
{
|
|||
|
return _obj.Query();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get all data
|
|||
|
/// </summary>
|
|||
|
public DataSet getAllActiveData()
|
|||
|
{
|
|||
|
return _obj.QueryActived();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id
|
|||
|
/// </summary>
|
|||
|
public void initialize(int id)
|
|||
|
{
|
|||
|
_obj = id != 0 ? new Wmslocation(id) : new Wmslocation();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id 0
|
|||
|
/// </summary>
|
|||
|
public void initialize()
|
|||
|
{
|
|||
|
initialize(0);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// get a record by id
|
|||
|
/// </summary>
|
|||
|
public void initialize(DataRow dr)
|
|||
|
{
|
|||
|
_obj = new Wmslocation(dr);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
//begin cust db operation, query, excute sql etc.
|
|||
|
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// query with like, return talbe and record cnt.
|
|||
|
/// </summary>
|
|||
|
public DataSet Query(string querystr, int rownumStart, int rownumEnd)
|
|||
|
{
|
|||
|
if (rownumEnd > rownumStart && rownumStart > 0)
|
|||
|
{
|
|||
|
_obj.rownumStart = rownumStart;
|
|||
|
_obj.rownumEnd = rownumEnd;
|
|||
|
}
|
|||
|
// DataSet ds = string.IsNullOrEmpty(querystr) ? _obj.Query() : _obj.Query(querystr);
|
|||
|
|
|||
|
if (string.IsNullOrEmpty(querystr))
|
|||
|
{
|
|||
|
return _obj.Query();
|
|||
|
}
|
|||
|
|
|||
|
string condition = "";
|
|||
|
string[] parameters = querystr.Split(";".ToCharArray());
|
|||
|
foreach (string value in parameters)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(value))
|
|||
|
{
|
|||
|
continue;
|
|||
|
}
|
|||
|
|
|||
|
string[] par = value.Split("#".ToCharArray());
|
|||
|
condition += par.Length == 0 ? "" :" and ";
|
|||
|
foreach (string p in par)
|
|||
|
{
|
|||
|
condition += p;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return _obj.Query(condition);
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
public DataSet Query(DataTable dic,string query ,int rownumStart, int rownumEnd)
|
|||
|
{
|
|||
|
DataSet ds = Query(query, rownumStart, rownumEnd);
|
|||
|
if (dic != null)
|
|||
|
{// build new columns from dic.
|
|||
|
|
|||
|
DataTable dt = ds.Tables[0];
|
|||
|
string warehouseGoodsType = Wmslocation.fields.whGoodsType.ToString();
|
|||
|
string WarehouseType = Wmslocation.fields.whType.ToString() ;
|
|||
|
// string warehouseVolume = Wmslocation.fields.whVolType.ToString() ;
|
|||
|
string goodsType = Wmslocation.fields.goodsType.ToString() ;
|
|||
|
string parts = Wmslocation.fields.part.ToString() ;
|
|||
|
string[] fieds = { warehouseGoodsType, WarehouseType, goodsType, parts };
|
|||
|
foreach (string field in fieds)
|
|||
|
{
|
|||
|
dt.Columns.Add(field + "Name");
|
|||
|
}
|
|||
|
|
|||
|
foreach (DataRow dr in dt.Rows){
|
|||
|
|
|||
|
foreach (string field in fieds)
|
|||
|
{
|
|||
|
string filter = "id = " + dr[field].ToString();
|
|||
|
DataRow[] drs = dic.Select(filter);
|
|||
|
|
|||
|
if (drs.Length > 0)
|
|||
|
{
|
|||
|
string v = drs[0]["name"].ToString();
|
|||
|
dr[field + "Name"] = v;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return ds;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// update in a transaction scrop
|
|||
|
/// </summary>
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//public void printLocations(DataTable dt)
|
|||
|
//{
|
|||
|
// string reportName = "wmsLocationCode.rdlc";
|
|||
|
// BillPrint.Run(dt, reportName, PrinterType.code);
|
|||
|
|
|||
|
// // new printUtils().print_report(dt, reportName, null, "code");wmsLocationCode.rdlc
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|