공개 clsSimuResultByOneGoods GetOneGoodsSimulationXML(문자열 PathAndFileName)
{
clsSimuResultByOneGoods OneGoods = 새로운 clsSimuResultByOneGoods();//자체적으로 결정된 일종
Hashtable AllLocationResult = new Hashtable();
System.Xml.XmlTextReader r = new XmlTextReader(PathAndFileName);
문자열 LocationID = "";
DataTable LocationTable = null;
동안(r.읽기())
{
if(r.NodeType == XmlNodeType.Element)
{
스위치(r.LocalName)
{
"결과"의 경우:
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(decimal));
LocationTable.Columns.Add("ForecastDemand",typeof(decimal));
LocationTable.Columns.Add("FinalOutput",typeof(decimal));
LocationTable.Columns.Add("FinalInput",typeof(decimal));
LocationTable.Columns.Add("SimuStock",typeof(decimal));
LocationTable.Columns.Add("SimuStockTime",typeof(decimal));
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["ForecastDemand"] = Convert.ToDecimal(r.GetAttribute("ForecastDemand"));
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"));
위치테이블.행.추가(dr);
}
부서지다;
기본:
부서지다;
}
}
else if(r.NodeType == XmlNodeType.EndElement)
{
스위치(r.LocalName)
{
사례 "위치":
if(위치테이블 != null)
{
LocationTable.AcceptChanges();
AllLocationResult.Add(LocationID,LocationTable);
위치ID = "";
위치 테이블 = null;
}
부서지다;
기본:
부서지다;
}
}
}
OneGoods.AllLocationResult = AllLocationResult;
OneGoods를 반환합니다.
}