public clsSimuResultByOneGoods GetOneGoodsSimulationXML(string PathAndFileName)
{
clsSimuResultByOneGoods OneGoods = new clsSimuResultByOneGoods();//自己決定的一種類
Hashtable AllLocationResult = new Hashtable();
System.Xml.XmlTextReader r = 新しい XmlTextReader(PathAndFileName);
文字列ロケーションID = "";
DataTable LocationTable = null;
while(r.Read())
{
if(r.NodeType == XmlNodeType.Element)
{
スイッチ(r.ローカル名)
{
ケース「結果」:
OneGoods.GoodsCode = r.GetAttribute("GoodsCode");
OneGoods.From = Convert.ToDateTime(r.GetAttribute("FromDate"));
OneGoods.To = Convert.ToDateTime(r.GetAttribute("ToDate"));
壊す;
ケース「場所」:
LocationID = r.GetAttribute("ID");
LocationTable = 新しい DataTable();
LocationTable.Columns.Add("日付",typeof(DateTime));
LocationTable.Columns.Add("SafetyStock",typeof(10 進数));
LocationTable.Columns.Add("予測需要",typeof(10 進数));
LocationTable.Columns.Add("最終出力",typeof(10 進数));
LocationTable.Columns.Add("最終入力",typeof(10 進数));
LocationTable.Columns.Add("SimuStock",typeof(10 進数));
LocationTable.Columns.Add("SimuStockTime",typeof(10 進数));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
LocationTable.Columns.Add("ImportWorkDay",typeof(bool));
壊す;
ケース「レコード」:
if(ロケーションテーブル != null)
{
DataRow dr = LocationTable.NewRow();
dr["日付"] = Convert.ToDateTime(r.GetAttribute("日付"));
if(r.GetAttribute("SafetyStock") != null && r.GetAttribute("SafetyStock") != "")
dr["SafetyStock"] = Convert.ToDecimal(r.GetAttribute("SafetyStock"));
if(r.GetAttribute("ForecastDemand") != null && r.GetAttribute("ForecastDemand") != "")
dr["予測需要"] = Convert.ToDecimal(r.GetAttribute("予測需要"));
if(r.GetAttribute("FinalInput") != null && r.GetAttribute("FinalInput") != "")
dr["FinalInput"] = Convert.ToDecimal(r.GetAttribute("FinalInput"));
if(r.GetAttribute("FinalOutput") != null && r.GetAttribute("FinalOutput") != "")
dr["FinalOutput"] = Convert.ToDecimal(r.GetAttribute("FinalOutput"));
if(r.GetAttribute("SimuStock") != null && r.GetAttribute("SimuStock") != "")
dr["SimuStock"] = Convert.ToDecimal(r.GetAttribute("SimuStock"));
if(r.GetAttribute("SimuStockTime") != null && r.GetAttribute("SimuStockTime") != "")
dr["SimuStockTime"] = Convert.ToDecimal(r.GetAttribute("SimuStockTime"));
if(r.GetAttribute("ImportWorkDay") != null && r.GetAttribute("ImportWorkDay") != "")
dr["ImportWorkDay"] = Convert.ToBoolean(r.GetAttribute("ImportWorkDay"));
if(r.GetAttribute("ExportWorkDay") != null && r.GetAttribute("ExportWorkDay") != "")
dr["ExportWorkDay"] = Convert.ToBoolean(r.GetAttribute("ExportWorkDay"));
LocationTable.Rows.Add(dr);
}
壊す;
デフォルト:
壊す;
}
}
else if(r.NodeType == XmlNodeType.EndElement)
{
スイッチ(r.ローカル名)
{
ケース「場所」:
if(ロケーションテーブル != null)
{
LocationTable.AcceptChanges();
AllLocationResult.Add(LocationID,LocationTable);
場所ID = "";
LocationTable = null;
}
壊す;
デフォルト:
壊す;
}
}
}
OneGoods.AllLocationResult = AllLocationResult;
OneGoods を返品する。
}