private TempXSDJ_MX GetTempXSDJ_MX(strMingxi MingXi, string Djbh, int Hs) { TempXSDJ_MX pxsdj_mx = new TempXSDJ_MX(); for (int i = MingXi.str.Count; i < 13; i++) { MingXi.str.Add(""); } pxsdj_mx.Hwmc = MingXi.str[0]; pxsdj_mx.Jldw = MingXi.str[1]; pxsdj_mx.Gg = MingXi.str[2]; pxsdj_mx.Sl = CommonTool.TodoubleNew(MingXi.str[3]); pxsdj_mx.Bhsje = CommonTool.TodoubleNew_x(MingXi.str[4]); pxsdj_mx.Slv = CommonTool.ToSlv(MingXi.str[5]); pxsdj_mx.Spsm = MingXi.str[6]; pxsdj_mx.Zkje = new double?(CommonTool.TodoubleNew(MingXi.str[7])); pxsdj_mx.Se = CommonTool.TodoubleNew_x(MingXi.str[8]); pxsdj_mx.Zkse = CommonTool.ToZKSE(MingXi.str[9]); pxsdj_mx.Zkl = CommonTool.ToZKL(MingXi.str[10]); pxsdj_mx.Dj = CommonTool.Todouble(MingXi.str[11]); pxsdj_mx.Jgfs = CommonTool.ToStringBool(MingXi.str[12]); pxsdj_mx.DJBH = Djbh; pxsdj_mx.HangShu = Hs; return(pxsdj_mx); }
public strBiao JieXiShuXing() { strBiao biao = new strBiao(); string[] strArray = File.ReadAllLines(this.path, ToolUtil.GetEncoding()); List <string> list = new List <string>(); for (int i = 0; i < strArray.Length; i++) { if (!((strArray[i].Trim().Trim(new char[1]).Length == 0) || strArray[i].Trim().StartsWith("//"))) { list.Add(strArray[i]); } } int num2 = 0; if (list.Count < 2) { throw new CustomException("001"); } string row = list[num2]; if (row.Contains("~~")) { if (!row.Substring(0, row.IndexOf(this.SplitStr)).Equals(this.BeginStr)) { throw new CustomException("001"); } } else if (row.Contains(" ") | row.Contains(",")) { this.SplitStr = " "; } if (this.SplitStr.Equals("~~")) { biao.str = this.StringSplit(row); } else { num2 = -1; } while (true) { bool flag = true; num2++; if (num2 >= list.Count) { return(biao); } row = list[num2]; strDanju item = new strDanju { str = this.StringSplit(row) }; int result = 0; if (item.str.Count > 1) { if (!int.TryParse(item.str[1], out result)) { base.errorResolver.AddError("单据商品行数有错误", item.str[0], 1, false); } else { base.errorResolver.ImportTotal++; while (0 < result--) { num2++; int lineNum = int.Parse(item.str[1]) - result; if (num2 < list.Count) { strMingxi mingxi = new strMingxi { str = this.StringSplit(list[num2]) }; item.mingxi.Add(mingxi); } else { base.errorResolver.AddError("缺少商品行", item.str[0], lineNum, false); flag = false; } } if (flag) { biao.danju.Add(item); } else { base.errorResolver.AbandonCount++; } } } else { base.errorResolver.AddError("单据仅有单据号", item.str[0], 1, false); } } }