public clsSimuResultByOneGoods GetOneGoodsSimulationXML(string PathAndFileName)
{
clsSimuResultByOneGoods OneGoods = clsSimuResultByOneGoods() baru;//自己定义的一个类
Hashtable AllLocationResult = Hashtable baru();
System.Xml.XmlTextReader r = XmlTextReader baru(PathAndFileName);
string ID Lokasi = "";
DataTable LocationTable = null;
while(r.Baca())
{
if(r.NodeType == XmlNodeType.Element)
{
beralih(r.Nama Lokal)
{
kasus "Hasil":
OneGoods.GoodsCode = r.GetAttribute("GoodsCode");
OneGoods.From = Konversi.ToDateTime(r.GetAttribute("FromDate"));
OneGoods.To = Konversi.ToDateTime(r.GetAttribute("ToDate"));
merusak;
kasus "Lokasi":
LocationID = r.GetAttribute("ID");
LocationTable = DataTable baru();
LocationTable.Columns.Add("Tanggal",typeof(TanggalWaktu));
LocationTable.Columns.Add("SafetyStock",typeof(desimal));
LocationTable.Columns.Add("Permintaan Perkiraan",typeof(desimal));
LocationTable.Columns.Add("FinalOutput",typeof(desimal));
LocationTable.Columns.Add("FinalInput",typeof(desimal));
LocationTable.Columns.Add("SimuStock",typeof(desimal));
LocationTable.Columns.Add("SimuStockTime",typeof(desimal));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
merusak;
kasus "Rekam":
jika(LocationTable != null)
{
DataRow dr = LocationTable.NewRow();
dr["Tanggal"] = Konversi.ToDateTime(r.GetAttribute("Tanggal"));
if(r.GetAttribute("SafetyStock") != null && r.GetAttribute("SafetyStock") != "")
dr["SafetyStock"] = Konversi.ToDecimal(r.GetAttribute("SafetyStock"));
if(r.GetAttribute("Permintaan Perkiraan") != null && r.GetAttribute("Permintaan Perkiraan") != "")
dr["Permintaan Perkiraan"] = Konversi.ToDecimal(r.GetAttribute("Permintaan Perkiraan"));
if(r.GetAttribute("FinalInput") != null && r.GetAttribute("FinalInput") != "")
dr["FinalInput"] = Konversi.ToDecimal(r.GetAttribute("FinalInput"));
if(r.GetAttribute("FinalOutput") != null && r.GetAttribute("FinalOutput") != "")
dr["FinalOutput"] = Konversi.ToDecimal(r.GetAttribute("FinalOutput"));
if(r.GetAttribute("SimuStock") != null && r.GetAttribute("SimuStock") != "")
dr["SimuStock"] = Konversi.ToDecimal(r.GetAttribute("SimuStock"));
if(r.GetAttribute("SimuStockTime") != null && r.GetAttribute("SimuStockTime") != "")
dr["SimuStockTime"] = Konversi.ToDecimal(r.GetAttribute("SimuStockTime"));
if(r.GetAttribute("ImportWorkDay") != null && r.GetAttribute("ImportWorkDay") != "")
dr["ImportWorkDay"] = Konversi.ToBoolean(r.GetAttribute("ImportWorkDay"));
if(r.GetAttribute("ExportWorkDay") != null && r.GetAttribute("ExportWorkDay") != "")
dr["ExportWorkDay"] = Konversi.ToBoolean(r.GetAttribute("ExportWorkDay"));
LocationTable.Rows.Add(dr);
}
merusak;
bawaan:
merusak;
}
}
lain jika(r.NodeType == XmlNodeType.EndElement)
{
beralih(r.Nama Lokal)
{
kasus "Lokasi":
jika(LocationTable != null)
{
LocationTable.AcceptChanges();
AllLocationResult.Add(LocationID,LocationTable);
ID Lokasi = "";
Tabel Lokasi = null;
}
merusak;
bawaan:
merusak;
}
}
}
OneGoods.AllLocationResult = SemuaLocationResult;
kembalikan OneGoods;
}