public ImportResult ImportData(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{费用项目编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行费用项目编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合费用项目编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); string str4 = this.TuiJianBM(""); string str5 = ""; bool flag2 = false; for (int i = index; i < strArray.Length; i++) { BMFYXMModel model; string lineText = strArray[i].Trim(); if (((lineText.Length == 0) || lineText.StartsWith("//")) || !lineText.Contains(str)) { continue; } string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } model = new BMFYXMModel { BM = strArray2[0], MC = strArray2[1], JM = strArray2[2], }; model.KJM = CommonFunc.GenerateKJM(model.MC); string str7 = ""; string str8 = ""; ResultType none = ResultType.None; while (true) { if (stack.Count <= 0) { break; } flag2 = false; if (model.BM.Length > stack.Peek().BM.Length) { if (!model.BM.StartsWith(stack.Peek().BM)) { goto Label_02B0; } model.SJBM = stack.Peek().BM; model.WJ = 1; if (stack.Peek().Result == ResultType.Invalid) { str7 = "无效"; str8 = "上级编码无效"; none = ResultType.Invalid; result.Invalid++; } else if (stack.Peek().Result == ResultType.Failed) { str7 = "失败"; str8 = "上级编码失败"; none = ResultType.Failed; result.Failed++; } else { if (stack.Peek().Result != ResultType.Duplicated) { goto Label_02B0; } str5 = this.TuiJianBM(stack.Peek().BM); if (model.BM.Length == str5.Length) { goto Label_02B0; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_03B0; } stack.Pop(); } flag2 = true; Label_02B0: if ((flag2 && (str4 != "001")) && (model.BM.Length != str4.Length)) { str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } else if (this.bmfyxmDAL.ExistExpense(model)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else { StringUtils.GetSpellCode(model.MC); if (this.bmfyxmDAL.AddExpense(model) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_03B0 :; result.DtResult.Rows.Add(new object[] { model.BM, model.MC, str7, str8 }); stack.Push(new lastBMJG(model.BM, none)); } result.ImportTable = "费用项目编码.DB"; result2 = result; } catch { throw; } return(result2); }
public ImportResult ImportData(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{销货单位编码}") || strArray[index].StartsWith("{发货人编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行销货单位编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合销货单位编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); string str4 = this.TuiJianBM(""); string str5 = ""; bool flag2 = false; for (int i = index; i < strArray.Length; i++) { BMXHDWModel model; string lineText = strArray[i].Trim(); if (((lineText.Length == 0) || lineText.StartsWith("//")) || !lineText.Contains(str)) { continue; } string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } model = new BMXHDWModel { BM = strArray2[0], MC = strArray2[1], JM = strArray2[2], }; model.KJM = CommonFunc.GenerateKJM(model.MC); string str7 = ""; string str8 = ""; ResultType none = ResultType.None; if (strArray2.Length > 3) { if (strArray2.Length < 7) { continue; } model.SH = strArray2[3].ToUpper(); model.WJ = 1; string str9 = ""; if (str == "~~") { str9 = strArray2[4].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str9 = strArray2[4].Replace("#|#", "\r\n"); } else { str9 = strArray2[4]; } model.DZDH = str9; string str10 = ""; if (str == "~~") { str10 = strArray2[5].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str10 = strArray2[5].Replace("#|#", "\r\n"); } else { str10 = strArray2[5]; } model.YHZH = str10; string str11 = ""; if (str == "~~") { str11 = strArray2[6].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str11 = strArray2[6].Replace("#|#", "\r\n"); } else { str11 = strArray2[6]; } model.YZBM = str11; } while (stack.Count > 0) { flag2 = false; if (model.BM.Length > stack.Peek().BM.Length) { if (!model.BM.StartsWith(stack.Peek().BM)) { goto Label_0430; } model.SJBM = stack.Peek().BM; if (stack.Peek().Result == ResultType.Invalid) { str7 = "无效"; str8 = "上级编码无效"; none = ResultType.Invalid; result.Invalid++; } else if (stack.Peek().Result == ResultType.Failed) { str7 = "失败"; str8 = "上级编码失败"; none = ResultType.Failed; result.Failed++; } else { if (stack.Peek().Result != ResultType.Duplicated) { goto Label_0430; } str5 = this.TuiJianBM(stack.Peek().BM); if (model.BM.Length == str5.Length) { goto Label_0430; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_06AF; } stack.Pop(); } flag2 = true; Label_0430: if ((flag2 && (str4 != "001")) && (model.BM.Length != str4.Length)) { str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } else if ("0" != this.CheckCustomer(model)) { str7 = "无效"; str8 = "编码或名称为空"; result.Invalid++; none = ResultType.Invalid; } else if (!Regex.IsMatch(model.BM, "^[0-9a-z]{1,16}$")) { str7 = "无效"; str8 = "编码需小于16位,且仅由数字和小写字母组成"; result.Invalid++; none = ResultType.Invalid; } if (this.bmsfhrDAL.ExistCusMC(model.BM, model.MC, model.SJBM)) { str7 = "失败"; str8 = "同级同族已存在同名销货单位" + model.SH; result.Failed++; none = ResultType.Failed; } else if (this.bmsfhrDAL.ExistCustomer(model)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else if (((model.SH != null) && (model.SH.Length != 0)) && (((model.SH.Length < 6) || (model.SH.Length > 20)) || (((model.WJ == 1) && (model.SH.Length != 0)) && ("0000" != this.jyCustomer.CheckTaxCode(model.SH, (FPLX)12))))) { str7 = "失败"; str8 = "销货单位税号错误" + model.SH; result.Failed++; none = ResultType.Failed; } else { string[] spellCode = StringUtils.GetSpellCode(model.MC); for (int j = 0; j < spellCode.Length; j++) { string text1 = spellCode[j]; } if (this.bmsfhrDAL.AddCustomer(model) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_06AF :; result.DtResult.Rows.Add(new object[] { model.BM, model.MC, str7, str8 }); stack.Push(new lastBMJG(model.BM, none)); } result.ImportTable = "销货单位编码.DB"; result2 = result; } catch { throw; } return(result2); }
public ImportResult ImportDistrict(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{行政区编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行行政区编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合行政区编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); this.TuiJianBM(""); for (int i = index; i < strArray.Length; i++) { string lineText = strArray[i].Trim(); if (((lineText.Length != 0) && !lineText.StartsWith("//")) && lineText.Contains(str)) { string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } string str5 = ""; string str6 = ""; ResultType none = ResultType.None; BMXZQYModel xzqEntity = new BMXZQYModel { BM = strArray2[0], MC = strArray2[1] }; if (this.bmkhDAL.ExistDistrict(xzqEntity)) { if (str5.Length == 0) { str5 = "重复"; result.Duplicated++; } if (str6.Length == 0) { str6 = "编码重复"; none = ResultType.Duplicated; } else { str6 = str6 + "且编码重复"; none = ResultType.Invalid; } } else if (this.bmkhDAL.AddDistrict(xzqEntity) == "0") { str5 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str5 = "失败"; result.Failed++; none = ResultType.Failed; } result.DtResult.Rows.Add(new object[] { xzqEntity.BM, xzqEntity.MC, str5, str6 }); stack.Push(new lastBMJG(xzqEntity.BM, none)); } } result.ImportTable = "XZQBM"; result2 = result; } catch { throw; } return(result2); }
public ImportResult ImportData(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{车辆编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行车辆编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合车辆编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); string str4 = this.TuiJianBM(""); string str5 = ""; bool flag2 = false; for (int i = index; i < strArray.Length; i++) { BMCLModel model; string lineText = strArray[i].Trim(); if (((lineText.Length == 0) || lineText.StartsWith("//")) || !lineText.Contains(str)) { continue; } string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } model = new BMCLModel { BM = strArray2[0], MC = strArray2[1], JM = strArray2[2], }; model.KJM = CommonFunc.GenerateKJM(model.MC); string str7 = ""; string str8 = ""; ResultType none = ResultType.None; if (strArray2.Length > 3) { if (strArray2.Length < 6) { throw new CustomException(string.Format("第{0}行数据不全", i)); } model.WJ = 1; string str9 = ""; if (str == "~~") { str9 = strArray2[3].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str9 = strArray2[3].Replace("#|#", "\r\n"); } else { str9 = strArray2[3]; } model.CPXH = str9; string str10 = ""; if (str == "~~") { str10 = strArray2[4].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str10 = strArray2[4].Replace("#|#", "\r\n"); } else { str10 = strArray2[4]; } model.CD = str10; string str11 = ""; if (str == "~~") { str11 = strArray2[5].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str11 = strArray2[5].Replace("#|#", "\r\n"); } else { str11 = strArray2[5]; } model.SCCJMC = str11; if (Flbm.IsYM() && (strArray2.Length > 6)) { DAL.BMSPFLManager manager = new DAL.BMSPFLManager(); string bm = ""; if (str == "~~") { bm = strArray2[6].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { bm = strArray2[6].Replace("#|#", "\r\n"); } else { bm = strArray2[6]; } if (strArray2.Length > 7) { string str13 = ""; if (str == "~~") { str13 = strArray2[7].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str13 = strArray2[7].Replace("#|#", "\r\n"); } else { str13 = strArray2[7]; } if (manager.CanUseThisSPFLBM(bm, false, false)) { model.SPFL = bm; model.SPFLMC = manager.GetSPFLMCBYBM(bm); if (manager.CanUseThisYHZC(bm)) { if ((str13.Trim() == "是") || (str13.Trim() == "否")) { model.YHZC = str13; if (model.YHZC == "否") { model.YHZCMC = ""; } } else { model.YHZC = "否"; model.YHZCMC = ""; } if (strArray2.Length > 9) { bool flag3 = false; if (str13.Trim() == "是") { object[] objArray = ServiceFactory.InvokePubService("Aisino.Fwkp.Bmgl.GetSLV_BY_BM", new object[] { model.SPFL }); if ((objArray != null) && (objArray.Length > 0)) { string[] strArray3 = (objArray[0] as DataTable).Rows[0]["ZZSTSGL"].ToString().Split(new char[] { ',', '、', ';', ',', ';' }); if (strArray3.Length > 0) { foreach (string str14 in strArray3) { if (strArray2[9].Trim() == str14) { model.YHZC = "是"; string str15 = ""; if (str == "~~") { str15 = strArray2[9].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str15 = strArray2[9].Replace("#|#", "\r\n"); } else { str15 = strArray2[9]; } model.YHZCMC = str15; flag3 = true; } if (!Flbm.IsDK() && strArray2[9].Trim().Contains("1.5%")) { model.YHZC = "否"; model.YHZCMC = ""; } } } } if (!flag3) { model.YHZC = "否"; model.YHZCMC = ""; } } else if (str13.Trim() == "否") { model.YHZC = "否"; model.YHZCMC = ""; } else { model.YHZC = "否"; model.YHZCMC = ""; } } } else { model.YHZC = "否"; model.YHZCMC = ""; } } } } } while (stack.Count > 0) { flag2 = false; if (model.BM.Length > stack.Peek().BM.Length) { if (!model.BM.StartsWith(stack.Peek().BM)) { goto Label_07AE; } model.SJBM = stack.Peek().BM; if (stack.Peek().Result == ResultType.Invalid) { str7 = "无效"; str8 = "上级编码无效"; none = ResultType.Invalid; result.Invalid++; } else if (stack.Peek().Result == ResultType.Failed) { str7 = "失败"; str8 = "上级编码失败"; none = ResultType.Failed; result.Failed++; } else { if (stack.Peek().Result != ResultType.Duplicated) { goto Label_07AE; } str5 = this.TuiJianBM(stack.Peek().BM); if (model.BM.Length == str5.Length) { goto Label_07AE; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_0940; } stack.Pop(); } flag2 = true; Label_07AE: if ((flag2 && (str4 != "001")) && (model.BM.Length != str4.Length)) { str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } else if ("0" != this.CheckCustomer(model)) { str7 = "无效"; str8 = "编码或名称为空"; result.Invalid++; none = ResultType.Invalid; } else if (!Regex.IsMatch(model.BM, "^[0-9a-z]{1,16}$")) { str7 = "无效"; str8 = "编码需小于16位,且仅由数字和小写字母组成"; result.Invalid++; none = ResultType.Invalid; } else if (this.bmclDAL.ExistCustomer(model)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else { string[] spellCode = StringUtils.GetSpellCode(model.MC); for (int j = 0; j < spellCode.Length; j++) { string text1 = spellCode[j]; } if (this.bmclDAL.AddCustomer(model) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_0940 :; result.DtResult.Rows.Add(new object[] { model.BM, model.MC, str7, str8 }); stack.Push(new lastBMJG(model.BM, none)); } result.ImportTable = "车辆编码.DB"; result2 = result; } catch { throw; } return(result2); }
public ImportResult ImportGoodsTax(string codeFile) { ImportResult result2; try { string[] strArray = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (strArray.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (strArray[index].StartsWith("{商品税目编码}")) { string str2 = strArray[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行商品税目编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == strArray.Length) { throw new CustomException("此文件不符合商品税目编码文本格式"); } } } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); this.TuiJianBM(""); for (int i = index; i < strArray.Length; i++) { string lineText = strArray[i].Trim(); if (((lineText.Length != 0) && !lineText.StartsWith("//")) && lineText.Contains(str)) { string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } string str5 = ""; string str6 = ""; ResultType none = ResultType.None; BMSPSMModel spsmEntity = new BMSPSMModel { SZ = strArray2[0], BM = strArray2[1], MC = strArray2[2] }; double num3 = 0.0; if (!double.TryParse(strArray2[3], out num3)) { throw new CustomException(string.Format("第{0}行数据格式不正确", i)); } spsmEntity.SLV = num3; if (!double.TryParse(strArray2[4], out num3)) { throw new CustomException(string.Format("第{0}行数据格式不正确", i)); } spsmEntity.ZSL = num3; spsmEntity.SLJS = (strArray2[5] == "false") ? byte.Parse("0") : byte.Parse("1"); spsmEntity.JSDW = strArray2[6]; double num4 = 0.0; if (!double.TryParse(strArray2[7], out num4)) { throw new CustomException(string.Format("第{0}行数据格式不正确", i)); } spsmEntity.SE = num4; bool flag3 = false; if (!bool.TryParse(strArray2[8], out flag3)) { throw new CustomException(string.Format("第{0}行数据格式不正确", i)); } spsmEntity.FHDBZ = flag3; if (this.bmkhDAL.ExistGoodsTax(spsmEntity)) { if (str5.Length == 0) { str5 = "重复"; result.Duplicated++; } if (str6.Length == 0) { str6 = "编码重复"; none = ResultType.Duplicated; } else { str6 = str6 + "且编码重复"; none = ResultType.Invalid; } } else if (this.bmkhDAL.AddGoodsTax(spsmEntity) == "0") { str5 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str5 = "失败"; result.Failed++; none = ResultType.Failed; } result.DtResult.Rows.Add(new object[] { spsmEntity.BM, spsmEntity.MC, str5, str6 }); stack.Push(new lastBMJG(spsmEntity.BM, none)); } } result.ImportTable = "SPSMBM.DB"; result2 = result; } catch { throw; } return(result2); }
public ImportResult ImportData(string codeFile) { ImportResult result2; try { string[] array = File.ReadAllLines(codeFile, ToolUtil.GetEncoding()); if (array.Length == 0) { throw new CustomException("此文件没有内容"); } string str = ""; int index = 0; bool flag = true; while (flag) { if (array[index].StartsWith("{客户编码}")) { string str2 = array[index]; if (!str2.Contains("\"")) { throw new CustomException("此文件首行客户编码没有指定分隔符,分隔符使用双引号标注"); } str = str2.Substring(str2.IndexOf("\"")).Trim().Trim(new char[] { '"' }); flag = false; index++; } else { index++; if (index == array.Length) { throw new CustomException("此文件不符合客户编码文本格式"); } } } if (TaxCardFactory.CreateTaxCard().SoftVersion == "FWKP_V2.0_Svr_Client") { Array.Sort <string>(array, index, array.Length - index); } ImportResult result = new ImportResult(); Stack <lastBMJG> stack = new Stack <lastBMJG>(); string str4 = this.TuiJianBM(""); string str5 = ""; bool flag2 = false; for (int i = index; i < array.Length; i++) { string lineText = array[i].Trim(); if (((lineText.Length == 0) || lineText.StartsWith("//")) || !lineText.Contains(str)) { continue; } string[] strArray2 = GetSafeData.Split(lineText, str); if (strArray2.Length < 3) { throw new CustomException("文本首行指定的分隔符与实际分隔符不一致,\n格式不正确等原因导致不能导入此文件!"); } BMKHModel customer = new BMKHModel { BM = strArray2[0], MC = strArray2[1], JM = strArray2[2] }; string str7 = ""; string str8 = ""; ResultType none = ResultType.None; customer.KJM = CommonFunc.GenerateKJM(customer.MC); if (strArray2.Length > 3) { if (strArray2.Length < 7) { continue; } customer.SH = strArray2[3].ToUpper(); customer.WJ = 1; string str9 = ""; if (str == "~~") { str9 = strArray2[4].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str9 = strArray2[4].Replace("#|#", "\r\n"); } else { str9 = strArray2[4]; } customer.DZDH = str9; string str10 = ""; if (str == "~~") { str10 = strArray2[5].Replace(",", "\r\n").Replace("#|#", "\r\n"); } else if (str == " ") { str10 = strArray2[5].Replace("#|#", "\r\n"); } else { str10 = strArray2[5]; } customer.YHZH = str10; customer.YJDZ = strArray2[6]; customer.BZ = strArray2[7]; } while (stack.Count > 0) { flag2 = false; if (customer.BM.Length > stack.Peek().BM.Length) { if (!customer.BM.StartsWith(stack.Peek().BM)) { goto Label_03EA; } customer.SJBM = stack.Peek().BM; if (stack.Peek().Result == ResultType.Invalid) { str7 = "无效"; str8 = "上级编码无效"; none = ResultType.Invalid; result.Invalid++; } else if (stack.Peek().Result == ResultType.Failed) { str7 = "失败"; str8 = "上级编码失败"; none = ResultType.Failed; result.Failed++; } else { if (stack.Peek().Result != ResultType.Duplicated) { goto Label_03EA; } str5 = this.TuiJianBM(stack.Peek().BM); if (customer.BM.Length == str5.Length) { goto Label_03EA; } str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } goto Label_068B; } stack.Pop(); } flag2 = true; Label_03EA: if ((flag2 && (str4 != "001")) && (customer.BM.Length != str4.Length)) { str7 = "无效"; str8 = "编码长度必须与原有同级编码长度一致"; result.Invalid++; none = ResultType.Invalid; } else if ("0" != this.CheckCustomer(customer)) { str7 = "无效"; str8 = "编码或名称为空"; result.Invalid++; none = ResultType.Invalid; } else if (!Regex.IsMatch(customer.BM, "^[0-9a-z]{1,16}$")) { str7 = "无效"; str8 = "编码需小于16位,且仅由数字和小写字母组成"; result.Invalid++; none = ResultType.Invalid; } else if (this.bmkhDAL.ExistCustomer(customer)) { if (str7.Length == 0) { str7 = "重复"; result.Duplicated++; } if (str8.Length == 0) { str8 = "编码重复"; none = ResultType.Duplicated; } else { str8 = str8 + "且编码重复"; none = ResultType.Invalid; } } else if (((customer.SH != null) && (customer.SH.Length != 0)) && (((customer.SH.Length < 6) || (customer.SH.Length > 20)) || (((customer.WJ == 1) && (customer.SH.Length != 0)) && ("0000" != this.jyCustomer.CheckTaxCode(customer.SH, 0))))) { str7 = "失败"; str8 = "客户税号错误" + customer.SH; result.Failed++; none = ResultType.Failed; } else if (this.bmkhDAL.ExistCusMC(customer.BM, customer.MC, customer.SJBM)) { str7 = "失败"; str8 = "客户名称与其同级单位名称重复" + customer.SH; result.Failed++; none = ResultType.Failed; } else { foreach (string str11 in StringUtils.GetSpellCode(customer.MC)) { customer.KJM = customer.KJM + str11; } if (this.bmkhDAL.AddCustomer(customer) == "0") { str7 = "正确传入"; result.Correct++; none = ResultType.Correct; } else { str7 = "失败"; result.Failed++; none = ResultType.Failed; } } Label_068B :; result.DtResult.Rows.Add(new object[] { customer.BM, customer.MC, str7, str8 }); stack.Push(new lastBMJG(customer.BM, none)); } result.ImportTable = "客户编码.DB"; result2 = result; } catch { throw; } return(result2); }