ldj/Model/wms/tables/WmsPlate.cs

208 lines
5.1 KiB
C#
Raw Normal View History

2023-05-23 16:13:17 +08:00

/// <summary>
///INTERFACE CLASS FOR TABLE t_wmsPlate
///By wm
///on 05/22/2020
/// </summary>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace DeiNiu.wms.Data.Model
{
[Serializable]
public class WmsPlate : WmsPlate_base
{
public WmsPlate()
{
}
2023-09-04 22:41:19 +08:00
public WmsPlate(string plateId)
2023-05-23 16:13:17 +08:00
{
cmdParameters[0] = plateId;
2023-09-04 22:41:19 +08:00
getModel(100);
2023-05-23 16:13:17 +08:00
}
2023-09-04 22:41:19 +08:00
public WmsPlate(int id) : base(id)
2023-05-23 16:13:17 +08:00
{
}
2023-09-04 22:41:19 +08:00
public WmsPlate(DataRow dr) : base(dr)
2023-05-23 16:13:17 +08:00
{
}
2023-09-04 22:41:19 +08:00
protected override void getImp()
2023-05-23 16:13:17 +08:00
{
2023-09-04 22:41:19 +08:00
model_imp = new WmsPlate_Imp();
2023-05-23 16:13:17 +08:00
}
//begin cust db operation, query, excute sql etc.
2023-09-04 22:41:19 +08:00
//begin cust db operation, query, excute sql etc.
public DataTable getPlateById(string plateid)
{
cmdParameters[0] = plateid;
return CustQuery(100).Tables[0];
}
public bool deleteByPlateId(string plateid)
{
cmdParameters[0] = plateid;
return CustOper(200) > 0;
}
public DataSet getPlateWaves()
{
return CustQuery(300);
}
public DataTable getPlatesByWave(string waveOrder, int color)
{
cmdParameters[0] = waveOrder;
if (color > 0)
{
cmdParameters[1] = color;
return CustQuery(500).Tables[0];
}
else return CustQuery(400).Tables[0]; ;
}
public DataTable getPartionPickDetailByPlateId(string plateid)
{
cmdParameters[0] = plateid;
return CustQuery(101).Tables[0];
}
public DataTable getPlatesByPickOrder(string pickOrderNo)
{
cmdParameters[0] = pickOrderNo;
return CustQuery(600).Tables[0];
}
public void setFree()
{
this.waveNo = "";
this.preInOrderNo = "";
this.pickOrderNo = "";
this.customerId = "";
this.transNo = "";
this.partion = 0;
this.locationId = "";
this.terminal = 0;
this.state = 0;
Update();
}
public WmsPlate getParentPlate(string plateId)
{
cmdParameters[0] = plateId;
DataTable dt = CustQuery(700).Tables[0];
foreach (DataRow dr in dt.Rows)
{
return new WmsPlate(dr);
}
return new WmsPlate();
}
public List<WmsPlate> getSubPlates(string plateId)
{
List<WmsPlate> lst = new List<WmsPlate>();
cmdParameters[0] = plateId;
DataTable dt = CustQuery(800).Tables[0];
foreach (DataRow dr in dt.Rows)
{
lst.Add(new WmsPlate(dr));
}
return lst;
}
/// <summary>
/// 迭代取容器里所有商品,包含子容器及其子容器...
/// </summary>
/// <param name="plateId"></param>
/// <returns></returns>
public List<WmsPlateStock_tmp> getPlateStoks(string plateId, bool showSub = false)
{
List<WmsPlateStock_tmp> stks = new List<WmsPlateStock_tmp>();
DataTable dt = new WmsPlateStock_tmp().getStockLst(plateId);
foreach (DataRow dr in dt.Rows)
{
stks.Add(new WmsPlateStock_tmp(dr));
}
if (!showSub)
{
return stks;
}
List<WmsPlate> subPlate = getSubPlates(plateId);
foreach (WmsPlate obj in subPlate)
{
stks.Concat(getPlateStoks(obj.plateId, showSub));
}
return stks;
}
private List<DataTable> getPlateJobsDts(string plateId, bool showSub = false)
{
List<DataTable> dts = new List<DataTable>();
dts.Add(new WmsPlateStock_tmp().getStockLst(plateId));
if (!showSub)
{
return dts;
}
List<WmsPlate> subPlate = getSubPlates(plateId);
foreach (WmsPlate obj in subPlate)
{
dts.Concat(getPlateJobsDts(obj.plateId, showSub));
}
return dts;
}
public DataTable getPateJobsDt(string plateId, bool showSub = false)
{
List<DataTable> dts = getPlateJobsDts(plateId, showSub);
DataTable d = dts[0];
for (int i = 1; i < dts.Count;i++)
{
d= unionTables(d, dts[i],i+"");
}
return d;
}
public static DataTable unionTables(DataTable dt1,DataTable dt2,string newName)
{
DataTable dt = dt1.Copy();
dt.TableName= newName;
foreach(DataRow item in dt2.Rows)
{
DataRow dr = dt.NewRow();
dr.ItemArray =item.ItemArray;
dt.Rows.Add(dr);
}
return dt;
}
2023-05-23 16:13:17 +08:00
}
2023-09-04 22:41:19 +08:00
2023-05-23 16:13:17 +08:00
}
2023-09-04 22:41:19 +08:00
2023-05-23 16:13:17 +08:00