private bool AutoUploadFile(DataTable dt, DataRow headerDr) { double?Orderfileheaderid = Convert.ToDouble(headerDr["Orderfileheaderid"]); double?enterby = Convert.ToDouble(headerDr["enterby"]); double?dictcustormer = Convert.ToDouble(headerDr["dictcustormer"]); double?dictlabid = Convert.ToDouble(headerDr["dictlabid"]); string province = headerDr["province"].ToString(); string city = headerDr["city"].ToString(); string county = headerDr["county"].ToString(); bool isunifiedpost = false; if (headerDr["isunifiedpost"].ToString() == "1") { isunifiedpost = true; } string postaddress = headerDr["postaddress"].ToString(); string recipient = headerDr["recipient"].ToString(); string contactnumber = headerDr["contactnumber"].ToString(); DictuserService userService = new DictuserService(); string username = userService.GetDictuserInfoAuto(enterby).Username; Orderfiledetail filedetail = new Orderfiledetail(); Orderfileheader fileheader = new Orderfileheader() { Orderfileheaderid = Orderfileheaderid, Status = 1 }; //bool isCacheData = true; //string conTestCode = ConfigurationManager.AppSettings["NoCacheTestCode"]; //List<Dicttestitem> TestItemList = loginservice.GetLoginDicttestitemListNoCache();//项目字典表 List <Dictproductdetail> ProductDetail = loginservice.GetLoginDictproductdetailNoCache(); //套餐组合字典 List <Dicttestitem> productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(dictcustormer, 0)); //查询分点+公用套餐 string _productname = string.Empty; for (int i = (dt.Rows.Count - 1); i >= 0; i--) { bool b = false;//添加是否成功 string errstr = ""; DataRow dr = dt.Rows[i]; string productTestCode = dr["套餐代码"].ToString().Replace('_', ' ').Trim(); string detailbarcode = string.Empty; try { detailbarcode = dr["条码号"].ToString().Replace('_', ' ').Trim(); if (detailbarcode != string.Empty) { Convert.ToDouble(detailbarcode); } } catch (Exception) { } string mobile = dr["手机"].ToString().Trim(); string idnumber = dr["身份证"].ToString().Trim(); string realname = dr["姓名"].ToString().Trim(); if (string.IsNullOrEmpty(realname) || string.IsNullOrEmpty(productTestCode)) { filedetail.Reason = "姓名、套餐代码不可以为空!"; filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } #region 条码号检查 if (detailbarcode != string.Empty && detailbarcode.Length != 12)//条码号非12位 { filedetail.Reason = string.Format("条码号[{0}]必须为12位数字,可以为空!", detailbarcode); filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } if (detailbarcode != string.Empty && detailbarcode.Substring(detailbarcode.Length - 2) != "00")//条码号不以00结尾 { filedetail.Reason = string.Format("此条码号[{0}]不是以00结尾,请更改条码号!", detailbarcode); filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } if (barcodeservice.CheckBarCode(detailbarcode))//条码号存在 { filedetail.Reason = string.Format("此条码号[{0}]已在本系统内生成,请更改条码号!", detailbarcode); filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } #endregion string sex = "U"; if (dr["性别"] != DBNull.Value && !string.IsNullOrEmpty(dr["性别"].ToString())) { //if (dr["性别"].ToString() == "女") // sex = "F"; //else if (dr["性别"].ToString() == "男") // sex = "M"; sex = dr["性别"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["性别"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U"); } List <Dicttestitem> productList = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex.ToUpper() == sex.ToUpper() || c.Forsex.ToUpper() == "B")).ToList <Dicttestitem>(); List <Dicttestitem> grouptestList = new List <Dicttestitem>(); Dicttestitem productinfo = null; if (productList.Count == 0) { filedetail.Reason = String.Format("套餐代码[{0}]无匹配项,请查看性别是否匹配或者是否有该套餐。", productTestCode); filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } else if (productList.Count > 1) { filedetail.Reason = String.Format("存在多个套餐代码为[{0}]的套餐", productTestCode); filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } else { productinfo = productList[0]; if (productinfo.Testtype == "2")//公用套餐 { _productname = productinfo.Testname.ToString().Replace("(公用套餐)", ""); } else { _productname = productinfo.Testname; } //检验套餐中项目组合信息(性别是否相符;是否重复添加项目组合;项目是否维护分管原则、科室和标本类型) string msg = registerservice.AddProductAuto(sex, productinfo, detailbarcode); if (msg != string.Empty) { filedetail.Reason = msg; filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } //套餐下组合项目 IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid); bool iscontinue = true; string msgdetail = string.Empty; foreach (Dictproductdetail item in IEgroup) { Dicttestitem groupinfo = registerservice.SelectDicttestitemByDicttestitemid(item.Testgroupid); if (groupinfo == null) { msgdetail += string.Format("没有找到套餐[{0}]下ID为[{1}]的{2}[{3}]!", _productname, item.Testgroupid, groupinfo.Testtype == "0" ? "单项" : "组合", groupinfo.Testname) + ";"; iscontinue = false; continue; } groupinfo.Productid = productinfo.Dicttestitemid; groupinfo.Productname = productinfo.Testname; ///套餐名 groupinfo.IsActive = "1"; //是否停止测试 groupinfo.Isadd = "0"; ///是否追加 groupinfo.Billed = "0"; groupinfo.Sendbilled = "0"; groupinfo.Adduserid = null;//追加人ID if (detailbarcode == string.Empty) { IEnumerable <Dicttestitem> IEtempbarcodeList = grouptestList.Where <Dicttestitem>(c => c.Tubegroup == groupinfo.Tubegroup); if (IEtempbarcodeList.Count() > 0) { groupinfo.Barcode = IEtempbarcodeList.First <Dicttestitem>().Barcode; } else { groupinfo.Barcode = registerservice.GetBarCode(); } } else { groupinfo.Barcode = detailbarcode; } //获取外包客户 Dictproductdetail detail = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid && c.Testgroupid == groupinfo.Dicttestitemid).First <Dictproductdetail>(); groupinfo.Sendoutcustomerid = detail.Sendoutcustomerid; grouptestList.Add(groupinfo); } if (!iscontinue) { if (!string.IsNullOrEmpty(msgdetail)) { filedetail.Reason = msgdetail; filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); } continue; } } #region >>>> 不存在此会员添加会员 Dictmember member = new Dictmember() { Realname = realname, Idnumber = idnumber }; //检查会员 errstr = registerservice.checkmember(null, ref member); if (errstr != string.Empty) { filedetail.Reason = errstr; filedetail.Status = 0; filedetail.Barcode = detailbarcode; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } member.Nickname = member.Realname; member.Sex = sex; DateTime datebirthday; bool dateb = DateTime.TryParse(dr["出生日期"].ToString(), out datebirthday); if (dateb) { member.Birthday = datebirthday; } member.Addres = dr["住址"].ToString().Trim(); member.Phone = dr["电话"].ToString().Trim(); if (!string.IsNullOrWhiteSpace(dr["手机"].ToString().Trim())) { double a; bool mobileb = double.TryParse(dr["手机"].ToString().Trim(), out a); if (!mobileb) { filedetail.Reason = "手机号码填写不正确,不要有特殊字符,[-]也不能包含"; filedetail.Barcode = detailbarcode; filedetail.Status = 0; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } } member.Mobile = dr["手机"].ToString().Trim(); member.Email = dr["邮箱"].ToString().Trim(); #endregion #region >>>> insert Orders double year = 0, month = 0, day = 0; double hours = 0;//小时 double age = 0; string agestr = dr["年龄"].ToString().Replace('_', ' ').Trim(); string ageFiled = string.Empty; bool ageb = double.TryParse(agestr, out age); if (member.Birthday == null) { if (agestr != string.Empty && ageb) { year = age; day = age * 365; member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day)); } else { filedetail.Reason = "生日和年龄必须填写一项或者两项均填写错误"; filedetail.Barcode = detailbarcode; filedetail.Status = 0; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } } TimeSpan ts = DateTime.Now - Convert.ToDateTime(member.Birthday);//时间差 year = Math.Truncate((double)(ts.Days / 365)); month = (ts.Days % 365) / 30; day = (ts.Days % 365) % 30; hours = ts.TotalHours; ageFiled = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0);; //年龄字符串拼接 岁月日时 Orders _orders = new Orders(); _orders.Ordernum = new ProRegisterService().GetOrderNum();; //体检流水号 _orders.Remarks = dr["备注"].ToString().Trim(); //备注 _orders.Dictmemberid = member.Dictmemberid; //会员ID _orders.Dictcustomerid = dictcustormer; //所属客户ID 界面选择 _orders.Realname = member.Realname; _orders.Sex = member.Sex; //性别 对应INITBASIC表 _orders.Caculatedage = hours; //计算后的年龄(小时为单位) _orders.Age = ageFiled; _orders.Enterby = username; //录入人 _orders.Ordertestlst = _productname + ","; //项目清单(冗余字段) _orders.Dictlabid = dictlabid; //实验室分点 _orders.Ordersource = "1"; //单位上传 全是单位来源 _orders.Ismarried = dr["婚否"].ToString() == "未婚" ? "0" : (dr["婚否"].ToString() == "已婚" ? "1" : "2"); _orders.Section = dr["部门"].ToString().Trim(); _orders.Status = ((int)ParamStatus.OrdersStatus.BarCodePrint).ToString(); DateTime samplingdate; bool s = DateTime.TryParse(dr["采样日期"].ToString(), out samplingdate); if (s) { TimeSpan timespan = DateTime.Now - samplingdate; if (Math.Abs(timespan.Days) > 30) { filedetail.Reason = "采样时间与当前时间相差不能超过一个月"; filedetail.Barcode = detailbarcode; filedetail.Status = 0; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); continue; } _orders.SamplingDate = samplingdate; } _orders.Province = province; _orders.City = city; _orders.County = county; if (isunifiedpost) { _orders.PostAddress = postaddress; _orders.Recipient = recipient; _orders.ContactNumber = contactnumber; } else { _orders.PostAddress = dr["住址"].ToString().Trim(); _orders.Recipient = realname; _orders.ContactNumber = dr["手机"].ToString().Trim(); } _orders.Area = dr["营业区"].ToString().Replace('_', ' ').Trim(); _orders.BatchNumber = dr["场次号"].ToString().Replace('_', ' ').Trim(); //add 20160530 增加客户经理字段 if (dt.Columns.Contains("客户经理")) { _orders.AccountManager = dr["客户经理"].ToString().Replace('_', ' ').Trim(); } //add 20160612 增加本批标本总数字段 if (dt.Columns.Contains("本批标本总数")) { _orders.SpecimenCount = dr["本批标本总数"].ToString().Replace('_', ' ').Trim(); } #endregion System.Collections.Hashtable htScan = new System.Collections.Hashtable(); htScan.Add("isScan", true); htScan.Add("EnterByID", enterby); htScan.Add("EnterBy", username); b = registerservice.insertUpdateOrdersAuto("单位批量上传", "", true, productList, grouptestList, member, _orders, "", ref errstr, htScan); if (b) { filedetail.Barcode = detailbarcode; filedetail.Reason = ""; filedetail.Status = 1; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); } else { filedetail.Barcode = detailbarcode; filedetail.Reason = errstr + " 【Excel格式参照导入模版说明】"; filedetail.Status = 0; filedetail.Orderfileheaderid = Orderfileheaderid; filedetail.Createdate = DateTime.Now; filedetail.Realname = realname; filedetail.Mobile = mobile; filedetail.Idnumber = idnumber; detailservice.InsertOrderfiledetail(filedetail); } } return(headerservice.UpdateOrderfileheader(fileheader)); }
//导入 protected void btnImport_Click(object sender, EventArgs e) { if (DropDictLab.SelectedValue == null) { MessageBoxShow("请先选择分点!"); return; } if (DropCustomer.SelectedIndex == 0) { MessageBoxShow("请先选择单位!"); return; } if (dpProvince.SelectedValue == "-1" || dpCity.SelectedValue == "-1") { MessageBoxShow("请选择省、市"); return; } string fileType = fileExcel.PostedFile.ContentType; if (fileType != "application/octet-stream" && fileType != "application/vnd.ms-excel" && fileType != "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && fileType != "application/kset") { MessageBoxShow("请上传指定格式的Excel文件"); return; } if (ck1.Checked) { if (string.IsNullOrEmpty(txtAddress.Text.Trim()) || string.IsNullOrEmpty(txtRecName.Text.Trim()) || string.IsNullOrEmpty(txtTelphone.Text.Trim())) { MessageBoxShow("邮寄地址、收件人、联系电话不能为空"); return; } } string fileName = fileExcel.ShortFileName; fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_"); fileName = String.Format("{0}_{1}", DateTime.Now.Ticks, fileName); string savePath = Server.MapPath("~/upload/ExcelFiles/" + fileName); if (fileExcel.HasFile) { if (!Directory.Exists(Server.MapPath("~/upload/ExcelFiles"))) { Directory.CreateDirectory(Server.MapPath("~/upload/ExcelFiles")); } try { fileExcel.SaveAs(savePath); } catch (Exception ex) { MessageBoxShow("上传错误:" + ex.Message); return; } } DataTable dt; try { dt = RenderDataTableFromExcel(savePath); if (dt == null || dt.Rows.Count == 0) { MessageBoxShow("上传的文件数据不能为空!"); return; } //验证上传的excel是否符合模板标准,否则不让上传订单并删除上传的文件 string str = CheckDate(dt, fileName); if (!string.IsNullOrEmpty(str)) { MessageBoxShow(str); File.Delete(savePath);//删除文件 return; } } catch (Exception ex) { MessageBoxShow("请上传指定格式的Excel文件!\r\n提示信息:" + ex.Message); return; } List <Dicttestitem> TestItemList = loginservice.GetLoginDicttestitemList(); //项目字典表 List <Dictproductdetail> ProductDetail = loginservice.GetLoginDictproductdetail(); //套餐组合字典 //查询分点+公用套餐 List <Dicttestitem> productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(DropCustomer.SelectedValue, 0)); string _productname = string.Empty; #region 读取excel数据并上传订单 try { for (int i = (dt.Rows.Count - 1); i >= 0; i--) { bool b = false;//添加是否成功 string errstr = ""; DataRow dr = dt.Rows[i]; string productTestCode = dr["套餐代码"].ToString().Replace('_', ' ').Trim(); string sex = dr["性别"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["性别"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U"); List <Dicttestitem> productList = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex == sex || c.Forsex == "B")).ToList <Dicttestitem>(); List <Dicttestitem> grouptestList = new List <Dicttestitem>(); Dicttestitem productinfo = null; if (productList.Count == 0) { errstr = String.Format("套餐代码[{0}]无匹配项,请查看性别是否匹配或者是否有该套餐。", productTestCode); SetTableValue(false, errstr, dr); continue; } else if (productList.Count > 1) { errstr = String.Format("存在多个套餐代码为[{0}]的套餐", productTestCode); SetTableValue(false, errstr, dr); continue; } else { productinfo = productList.First <Dicttestitem>(); List <OrderRegister> _gridtestList = null; string msg = registerservice.AddProduct(ref _gridtestList, sex, productinfo.Dicttestitemid, false, Userinfo, ref _productname, null); if (msg != string.Empty) { //错误 SetTableValue(false, msg, dr); continue; } string barcode = dr["条码号"].ToString().Replace('_', ' ').Trim(); if (barcode != string.Empty && barcode.Length != 12) { errstr = string.Format("条码号[{0}]必须为12位数字,可以为空!", barcode); SetTableValue(false, errstr, dr); continue; } if (barcode != string.Empty && barcode.Substring(barcode.Length - 2) != "00") { errstr = string.Format("条码号[{0}]必须以00结尾!", barcode); SetTableValue(false, errstr, dr); continue; } if (barcodeservice.CheckBarCode(barcode))//条码号存在 { errstr = string.Format("此条码号[{0}]已在本系统内生成,请更改条码号!", barcode); SetTableValue(false, errstr, dr); continue; } //套餐下组合项目 IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid); bool iscontinue = true; foreach (Dictproductdetail item in IEgroup) { IEnumerable <Dicttestitem> IEgruptest = TestItemList.Where <Dicttestitem>(c => c.Dicttestitemid == item.Testgroupid); if (IEgruptest.Count() <= 0) { errstr = string.Format("没有找到套餐[{0}]下ID为[{1}]的组合!", _productname, item.Testgroupid); SetTableValue(false, errstr, dr); continue; } Dicttestitem groupinfo = IEgruptest.First <Dicttestitem>(); //校验性别是否符合 string str = registerservice.checkSex(groupinfo.Dicttestitemid, sex); if (str != string.Empty) { SetTableValue(false, str, dr); iscontinue = false; break; } groupinfo.Productid = productinfo.Dicttestitemid; groupinfo.Productname = productinfo.Testname; ///套餐名 groupinfo.IsActive = "1"; //是否停止测试 groupinfo.Isadd = "0"; ///是否追加 groupinfo.Billed = "0"; groupinfo.Sendbilled = "0"; groupinfo.Adduserid = null;//追加人ID if (barcode == string.Empty) { IEnumerable <Dicttestitem> IEtempbarcodeList = grouptestList.Where <Dicttestitem>(c => c.Tubegroup == groupinfo.Tubegroup); if (IEtempbarcodeList.Count() > 0) { groupinfo.Barcode = IEtempbarcodeList.First <Dicttestitem>().Barcode; } else { groupinfo.Barcode = registerservice.GetBarCode(); } } else { groupinfo.Barcode = barcode; } //获取外包客户 Dictproductdetail detail = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid && c.Testgroupid == groupinfo.Dicttestitemid).First <Dictproductdetail>(); groupinfo.Sendoutcustomerid = detail.Sendoutcustomerid; grouptestList.Add(groupinfo); } if (!iscontinue) { continue; } } #region >>>> zhouy 不存在此会员添加会员 string realname = dr["姓名"].ToString().Trim(); Dictmember member = new Dictmember() { Realname = realname }; string idnumber = dr["身份证"].ToString().Trim(); member.Idnumber = idnumber; //检查会员 errstr = registerservice.checkmember(null, ref member); if (errstr != string.Empty) { SetTableValue(false, errstr, dr); continue; } //List<Dictmember> memberList = memberservice.GetDictmemberList(member); //if (memberList.Count == 1)//存在此会员记录且只有一条 //{ // member = memberList[0]; // member.isAdd = false;//标识是否添加 //} //else //{ // member.Dictmemberid = loginservice.getSeqID("SEQ_DICTMEMBER"); // member.Islock = "F";//是否锁定 // member.isAdd = true; //} member.Nickname = member.Realname; member.Sex = sex; DateTime datebirthday; bool dateb = DateTime.TryParse(dr["出生日期"].ToString(), out datebirthday); if (dateb) { member.Birthday = datebirthday; } member.Addres = dr["住址"].ToString().Trim(); member.Phone = dr["电话"].ToString().Trim(); if (!string.IsNullOrWhiteSpace(dr["手机"].ToString().Trim())) { double a; bool mobileb = double.TryParse(dr["手机"].ToString().Trim(), out a); if (!mobileb) { SetTableValue(false, "手机号码填写不正确,不要有特殊字符,[-]也不能包含", dr); continue; } } member.Mobile = dr["手机"].ToString().Trim(); member.Email = dr["邮箱"].ToString().Trim(); #endregion double year = 0, month = 0, day = 0; double hours = 0;//小时 double age = 0; string agestr = dr["年龄"].ToString().Replace('_', ' ').Trim(); bool ageb = double.TryParse(agestr, out age); if (member.Birthday == null) { if (agestr != string.Empty && ageb) { year = age; day = age * 365; member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day)); } else { SetTableValue(false, "生日和年龄必须填写一项或者两项均填写错误", dr); continue; } } TimeSpan ts = DateTime.Now - Convert.ToDateTime(member.Birthday);//时间差 year = Math.Truncate((double)(ts.Days / 365)); month = (ts.Days % 365) / 30; day = (ts.Days % 365) % 30; hours = ts.TotalHours; Orders _orders = new Orders(); _orders.Ordernum = new ProRegisterService().GetOrderNum();; //体检流水号 _orders.Remarks = dr["备注"].ToString().Trim(); //备注 _orders.Dictmemberid = member.Dictmemberid; //会员ID _orders.Dictcustomerid = Convert.ToDouble(DropCustomer.SelectedValue); //所属客户ID 界面选择 _orders.Realname = member.Realname; _orders.Sex = member.Sex; //性别 对应INITBASIC表 _orders.Caculatedage = hours; //计算后的年龄(小时为单位) _orders.Age = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0); //年龄字符串拼接 岁月日时 _orders.Enterby = Userinfo.userName; //录入人 _orders.Ordertestlst = _productname + ","; //项目清单(冗余字段) _orders.Dictlabid = Convert.ToDouble(DropDictLab.SelectedValue); //实验室分点 _orders.Ordersource = "1"; //单位上传 全是单位来源 _orders.Ismarried = dr["婚否"].ToString() == "未婚" ? "0" : (dr["婚否"].ToString() == "已婚" ? "1" : "2"); _orders.Section = dr["部门"].ToString().Trim(); _orders.Status = ((int)ParamStatus.OrdersStatus.BarCodePrint).ToString(); DateTime samplingdate; bool s = DateTime.TryParse(dr["采样日期"].ToString(), out samplingdate); if (s) { TimeSpan timespan = DateTime.Now - samplingdate; if (Math.Abs(timespan.Days) > 30) { SetTableValue(false, "采样时间与当前时间相差不能超过一个月", dr); continue; } _orders.SamplingDate = samplingdate; } _orders.Province = dpProvince.SelectedValue == "-1" ? "" : dpProvince.SelectedText; _orders.City = dpCity.SelectedValue == "-1" ? "" : dpCity.SelectedText; _orders.County = dpCounty.SelectedValue == "-1" ? "" : dpCounty.SelectedText; if (ck1.Checked) { _orders.PostAddress = Regex.Replace(txtAddress.Text, @"\s", ""); _orders.ContactNumber = Regex.Replace(txtTelphone.Text, @"\s", ""); _orders.Recipient = Regex.Replace(txtRecName.Text, @"\s", ""); } else { _orders.PostAddress = dr["住址"].ToString().Trim(); _orders.Recipient = realname; _orders.ContactNumber = dr["手机"].ToString().Trim(); } //add 20160421 增加营业区、场次号 _orders.Area = dr["营业区"].ToString().Replace('_', ' ').Trim(); _orders.BatchNumber = dr["场次号"].ToString().Replace('_', ' ').Trim(); //add 20160530 增加客户经理字段 if (dt.Columns.Contains("客户经理")) { _orders.AccountManager = dr["客户经理"].ToString().Replace('_', ' ').Trim(); } //add 20160612 增加本批标本总数字段 if (dt.Columns.Contains("本批标本总数")) { _orders.SpecimenCount = dr["本批标本总数"].ToString().Replace('_', ' ').Trim(); } b = registerservice.insertUpdateOrders("单位批量上传", "", true, productList, grouptestList, member, _orders, "", ref errstr); SetTableValue(b, errstr, dr); } GridUpload.DataSource = dt; GridUpload.DataBind(); } catch (Exception ee) { string str = string.Format("导入失败,异常信息:{0}【Excel格式请严格参照导入模版说明】\n\n导入过程中如有疑问,请将异常信息截图后发与系统管理员。", ee.Message); MessageBoxShow(str); } #endregion }
/// <summary>上传体检订单 /// /// </summary> /// <param name="xmlStr"></param> /// <returns></returns> public static string UploadOrderInfo(string xmlStr) { xmlStr = xmlStr.TrimStart(''); string str = "<?xml version='1.0' encoding='utf-8'?>" + StringToXML(xmlStr); string strMessage = string.Empty; DataTable dt = new DataTable(); try { dt = GetDataTable(str); } catch (Exception ex) { return(String.Format("{0} {1}", ErrorCode.Up_0001, ex.Message)); } if (dt == null || dt.Rows.Count == 0 || dt.Columns.Count != 20) { return(ErrorCode.Up_0002); } List <Dicttestitem> TestItemList = loginservice.GetLoginDicttestitemList(); //项目字典表 List <Dictproductdetail> ProductDetail = loginservice.GetLoginDictproductdetail(); //套餐组合字典 string _productname = string.Empty; foreach (DataRow dr in dt.Rows) { #region 必填项 //套餐代码 string productTestCode = dr["uniquecode"].ToString().Replace('_', ' ').Trim(); //客户代码 string dictcustomerid = dr["dictcustomerid"].ToString().Trim(); //姓名 string realname = dr["realname"].ToString().Trim(); //性别 string sex = dr["sex"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["sex"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U"); //婚否 string ismarried = dr["ismarried"].ToString().Trim(); //手机 string mobile = dr["mobile"].ToString().Trim(); //住址 string address = dr["address"].ToString().Trim(); //省 string province = dr["province"].ToString().Trim(); //市 string city = dr["city"].ToString().Trim(); //分点实验室 string dictlabid = dr["dictlabid"].ToString().Trim(); //条码号 string barcode = dr["barcode"].ToString().Trim(); if (string.IsNullOrEmpty(productTestCode) || string.IsNullOrEmpty(dictcustomerid) || string.IsNullOrEmpty(dictlabid) || string.IsNullOrEmpty(barcode) || string.IsNullOrEmpty(realname) || string.IsNullOrEmpty(sex) || string.IsNullOrEmpty(ismarried) || string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address) || string.IsNullOrEmpty(province) || string.IsNullOrEmpty(city)) { strMessage = ErrorCode.Up_0003; break; } #endregion #region 二者不可都为空 //出生日期 string birthday = dr["birthday"].ToString().Trim(); //年龄 string age = dr["age"].ToString().Trim(); if (string.IsNullOrEmpty(birthday) && string.IsNullOrEmpty(age)) { strMessage = ErrorCode.Up_0004; break; } #endregion #region 可空字段 //身份证 string idnumber = dr["idnumber"].ToString().Trim(); //部门 string section = dr["section"].ToString().Trim(); //备注 string remark = dr["remark"].ToString().Trim(); //电话 string phone = dr["phone"].ToString().Trim(); //邮箱 string email = dr["email"].ToString().Trim(); //采样日期 string samplingdate = dr["samplingdate"].ToString().Trim(); //区 string county = dr["county"].ToString().Trim(); #endregion DateTime datebirthday; bool datebirthdayb = DateTime.TryParse(birthday, out datebirthday); DateTime datesamplingdate; bool datesamplingdateb = DateTime.TryParse(samplingdate, out datesamplingdate); if ((birthday != string.Empty && !datebirthdayb) || (samplingdate != string.Empty && !datesamplingdateb)) { strMessage = ErrorCode.Up_0010; break; } //检查单位是否在体检系统中有维护 try { using (DataTable d = customerservice.CheckHasCustomer(dictcustomerid)) { if (d == null || d.Rows.Count == 0 || d.Rows.Count > 1) { strMessage = ErrorCode.Up_0011; break; } } } catch (Exception ee) { strMessage = ErrorCode.Up_0015 + " " + ee.Message; break; } #region 添加套餐 //查询分点+公用套餐 List <Dicttestitem> productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(dictcustomerid, 0)); List <Dicttestitem> productList = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex == sex || c.Forsex == "B")).ToList <Dicttestitem>(); List <Dicttestitem> grouptestList = new List <Dicttestitem>(); Dicttestitem productinfo = null; if (productList.Count == 0) { strMessage = ErrorCode.Up_0005; break; } else if (productList.Count > 1) { strMessage = ErrorCode.Up_0006; break; } else { productinfo = productList.First <Dicttestitem>(); List <OrderRegister> _gridtestList = null; #region 添加套餐 string msg = registerservice.AddProduct(ref _gridtestList, sex, productinfo.Dicttestitemid, false, null, ref _productname, null); if (msg != string.Empty) { strMessage = ErrorCode.Up_0014; break; } #endregion if (barcode != string.Empty && barcode.Length != 12)//条码号必须为12位数字 { strMessage = ErrorCode.Up_0007; break; } if (barcode != string.Empty && barcode.Substring(barcode.Length - 2) != "00")//条码号必须以00结尾 { strMessage = ErrorCode.Up_0008; break; } //检验条码号是否合格且存在于体检系统 DataTable dtBarcode = barcodeservice.CheckBarCode2(barcode); if (dtBarcode != null && dtBarcode.Rows.Count > 0) { //判断已存在的条码是否来自大众平台 if (!dtBarcode.Rows[0]["enterby"].ToString().Contains("大众平台")) { //条码已存在且不是通过大众平台上传 strMessage = ErrorCode.Up_0009; break; } else { //判断该条码是否已经上传到康源系统,否则不允许修改; if (dtBarcode.Rows[0]["transed"].ToString() == "1") { strMessage = ErrorCode.Update_0005; break; } //删除该体检系统中订单 string ordernum = dtBarcode.Rows[0]["ordernum"].ToString(); Hashtable ht = new Hashtable(); ht["ordernum"] = ordernum; new ProCentralizedManagementService().DeleteOrders(ht); } } //套餐下组合项目 IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid); bool iscontinue = true; int count = IEgroup.Count <Dictproductdetail>(); int k = 0; foreach (Dictproductdetail item in IEgroup) { IEnumerable <Dicttestitem> IEgruptest = TestItemList.Where <Dicttestitem>(c => c.Dicttestitemid == item.Testgroupid); if (IEgruptest.Count() <= 0) { //没有找到套餐下组合 k++; continue; } Dicttestitem groupinfo = IEgruptest.First <Dicttestitem>(); //校验性别是否符合 string res = registerservice.checkSex(groupinfo.Dicttestitemid, sex); if (res != string.Empty) { //性别项目不合 strMessage = ErrorCode.Up_0012; iscontinue = false; break; } groupinfo.Productid = productinfo.Dicttestitemid; groupinfo.Productname = productinfo.Testname; ///套餐名 groupinfo.IsActive = "1"; //是否停止测试 groupinfo.Isadd = "0"; ///是否追加 groupinfo.Billed = "0"; groupinfo.Sendbilled = "0"; groupinfo.Adduserid = null;//追加人ID if (barcode == string.Empty) { IEnumerable <Dicttestitem> IEtempbarcodeList = grouptestList.Where <Dicttestitem>(c => c.Tubegroup == groupinfo.Tubegroup); if (IEtempbarcodeList.Count() > 0) { groupinfo.Barcode = IEtempbarcodeList.First <Dicttestitem>().Barcode; } else { groupinfo.Barcode = registerservice.GetBarCode(); } } else { groupinfo.Barcode = barcode; } //获取外包客户 Dictproductdetail detail = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid && c.Testgroupid == groupinfo.Dicttestitemid).First <Dictproductdetail>(); groupinfo.Sendoutcustomerid = detail.Sendoutcustomerid; grouptestList.Add(groupinfo); } if (!iscontinue) { continue; } else { if (k >= count) { strMessage = ErrorCode.Up_0013; break; } } } #endregion #region 添加会员信息 Dictmember member = new Dictmember() { Realname = realname, Idnumber = idnumber }; registerservice.checkmember(null, ref member); if (datebirthdayb) { member.Birthday = datebirthday; } member.Nickname = member.Realname; member.Sex = sex; member.Addres = address; member.Phone = phone; member.Mobile = mobile; member.Email = email; #endregion #region 添加订单 double year = 0, month = 0, day = 0; double hours = 0; double aged = 0; string agestr = age; bool ageb = double.TryParse(agestr, out aged); if (member.Birthday == null) { if (agestr != string.Empty && ageb) { year = aged; day = aged * 365; member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day)); } else { strMessage = ErrorCode.Up_0004; break; } } TimeSpan ts = DateTime.Now - Convert.ToDateTime(member.Birthday);//时间差 year = Math.Truncate((double)(ts.Days / 365)); month = (ts.Days % 365) / 30; day = (ts.Days % 365) % 30; hours = ts.TotalHours; Orders _orders = new Orders() { Ordernum = new ProRegisterService().GetOrderNum(), Dictmemberid = member.Dictmemberid, Dictcustomerid = Convert.ToDouble(dictcustomerid), Realname = realname, Sex = sex, Caculatedage = hours, Remarks = remark, Age = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0), Enterby = enterby, Ordertestlst = _productname + ",", Dictlabid = Convert.ToDouble(dictlabid), Ordersource = "1", Ismarried = ismarried == "未婚" ? "0" : (ismarried == "已婚" ? "1" : "2"), Section = section, Status = ((int)daan.service.common.ParamStatus.OrdersStatus.BarCodePrint).ToString(), Province = province, City = city, County = county }; if (datesamplingdateb) { _orders.SamplingDate = datesamplingdate; } string errstr = string.Empty; System.Collections.Hashtable htScan = new System.Collections.Hashtable(); htScan.Add("isScan", true); htScan.Add("EnterByID", enterbyID); htScan.Add("EnterBy", enterby); bool b = registerservice.insertUpdateOrders("大众健康平台对接订单", "", true, productList, grouptestList, member, _orders, "", ref errstr, htScan); if (!b) { strMessage = String.Format("{0} {1}", ErrorCode.Up_0015, errstr); break; } #endregion } return(strMessage); }
/// <summary> /// 接收数据 /// </summary> /// <param name="SID"></param> /// <param name="XML"></param> /// <returns></returns> public static string ReceiveXMLData(string SID, string xmlStr) { xmlStr = xmlStr.TrimStart(''); // if (xmlStr == string.Empty) // { // xmlStr = @" // <data><datarow> // <uniquecode >TY0008</uniquecode > // <dictcustomerid>1396</dictcustomerid> // <barcode>380003772900</barcode> // <realname>马昌武3</realname> // <sex>男</sex> // <birthday></birthday> // <age>41</age> // <ismarried>未知</ismarried> // <mobile>13096786113</mobile> // <idnumber></idnumber> // <address>地址</address> // <section>遵义</section> // <remark>备注</remark> // <phone></phone> // <email></email> // <samplingdate>2014-12-18</samplingdate> // <province>广东</province> // <city>广州市</city> // <county>天河区</county> // <dictlabid>3</dictlabid> // </datarow></data> // "; // } string str = "<?xml version='1.0' encoding='utf-8'?>" + StringToXML(xmlStr); string strMessage = string.Empty; //缓存取登录用户 Cache cache = new Cache(); CacheInfo info = cache.GetCacheData(SID); DataTable dt = new DataTable(); try { dt = GetDataTable(str); } catch (Exception ex) { return(String.Format("{0} {1}", ErrorCode.Rec_1002, ex.Message)); } if (dt == null || dt.Rows.Count == 0 || dt.Columns.Count != 20) { return(ErrorCode.Rec_1003); } List <Dicttestitem> TestItemList = loginservice.GetLoginDicttestitemList(); //项目字典表 List <Dictproductdetail> ProductDetail = loginservice.GetLoginDictproductdetail(); //套餐组合字典 string _productname = string.Empty; foreach (DataRow dr in dt.Rows) { #region 必填项 //套餐代码 string productTestCode = dr["uniquecode"].ToString().Replace('_', ' ').Trim(); //客户代码 string dictcustomercode = dr["dictcustomerid"].ToString().Trim(); //条码号 string barcode = dr["barcode"].ToString().Trim(); //姓名 string realname = dr["realname"].ToString().Trim(); //性别 string sex = dr["sex"].ToString().Replace('_', ' ').Trim() == "女" ? "F" : (dr["sex"].ToString().Replace('_', ' ').Trim() == "男" ? "M" : "U"); //婚否 string ismarried = dr["ismarried"].ToString().Trim(); //手机 string mobile = dr["mobile"].ToString().Trim(); //住址 string address = dr["address"].ToString().Trim(); //省 string province = dr["province"].ToString().Trim(); //市 string city = dr["city"].ToString().Trim(); //分点实验室 string dictlabid = dr["dictlabid"].ToString().Trim(); if (string.IsNullOrEmpty(productTestCode) || string.IsNullOrEmpty(dictcustomercode) || string.IsNullOrEmpty(dictlabid) || string.IsNullOrEmpty(realname) || string.IsNullOrEmpty(sex) || string.IsNullOrEmpty(ismarried) || string.IsNullOrEmpty(mobile) || string.IsNullOrEmpty(address) || string.IsNullOrEmpty(province) || string.IsNullOrEmpty(city)) { strMessage = ErrorCode.Rec_1005; break; } #endregion #region 二者不可都为空 //出生日期 string birthday = dr["birthday"].ToString().Trim(); //年龄 string age = dr["age"].ToString().Trim(); if (string.IsNullOrEmpty(birthday) && string.IsNullOrEmpty(age)) { strMessage = ErrorCode.Rec_1006; break; } #endregion #region 可空字段 //身份证 string idnumber = dr["idnumber"].ToString().Trim(); //部门 string section = dr["section"].ToString().Trim(); //备注 string remark = dr["remark"].ToString().Trim(); //电话 string phone = dr["phone"].ToString().Trim(); //邮箱 string email = dr["email"].ToString().Trim(); //采样日期 string samplingdate = dr["samplingdate"].ToString().Trim(); //区 string county = dr["county"].ToString().Trim(); #endregion DateTime datebirthday; bool datebirthdayb = DateTime.TryParse(birthday, out datebirthday); DateTime datesamplingdate; bool datesamplingdateb = DateTime.TryParse(samplingdate, out datesamplingdate); if ((birthday != string.Empty && !datebirthdayb) || (samplingdate != string.Empty && !datesamplingdateb)) { strMessage = ErrorCode.Rec_1013; break; } //检查单位是否在体检系统中有维护 string dictcustomerid = string.Empty; try { using (DataTable d = customerservice.CheckHasCustomer(dictcustomercode)) { if (d == null || d.Rows.Count == 0 || d.Rows.Count > 1) { strMessage = ErrorCode.Up_0011; break; } else { dictcustomerid = d.Rows[0][0].ToString(); } } } catch (Exception ee) { strMessage = ErrorCode.Up_0015 + " " + ee.Message; break; } #region 添加套餐 //查询分点+公用套餐 List <Dicttestitem> productlistTemp = new DicttestitemService().GetProduct(TypeParse.StrToDouble(dictcustomerid, 0)); List <Dicttestitem> productList = productlistTemp.Where <Dicttestitem>(c => c.Testcode == productTestCode && (c.Forsex == sex || c.Forsex == "B")).ToList <Dicttestitem>(); List <Dicttestitem> grouptestList = new List <Dicttestitem>(); Dicttestitem productinfo = null; if (productList.Count == 0) { strMessage = ErrorCode.Rec_1008; break; } else if (productList.Count > 1) { strMessage = ErrorCode.Rec_1009; break; } else { productinfo = productList.First <Dicttestitem>(); List <OrderRegister> _gridtestList = null; #region 添加套餐 string msg = registerservice.AddProduct(ref _gridtestList, sex, productinfo.Dicttestitemid, false, null, ref _productname, null); if (msg != string.Empty) { strMessage = ErrorCode.Rec_1017; break; } #endregion if (barcode != string.Empty && barcode.Length != 12)//条码号必须为12位数字 { strMessage = ErrorCode.Rec_1010; break; } if (barcode != string.Empty && barcode.Substring(barcode.Length - 2) != "00")//条码号必须以00结尾 { strMessage = ErrorCode.Rec_1011; break; } if (barcodeservice.CheckBarCode(barcode))//条码号已在系统中存在 { strMessage = ErrorCode.Rec_1012; break; } //套餐下组合项目 IEnumerable <Dictproductdetail> IEgroup = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid); bool iscontinue = true; int count = IEgroup.Count <Dictproductdetail>(); int k = 0; foreach (Dictproductdetail item in IEgroup) { IEnumerable <Dicttestitem> IEgruptest = TestItemList.Where <Dicttestitem>(c => c.Dicttestitemid == item.Testgroupid); if (IEgruptest.Count() <= 0) { //没有找到套餐下组合 k++; continue; } Dicttestitem groupinfo = IEgruptest.First <Dicttestitem>(); //校验性别是否符合 string res = registerservice.checkSex(groupinfo.Dicttestitemid, sex); if (res != string.Empty) { //性别项目不合 strMessage = ErrorCode.Rec_1015; iscontinue = false; break; } groupinfo.Productid = productinfo.Dicttestitemid; groupinfo.Productname = productinfo.Testname; ///套餐名 groupinfo.IsActive = "1"; //是否停止测试 groupinfo.Isadd = "0"; ///是否追加 groupinfo.Billed = "0"; groupinfo.Sendbilled = "0"; groupinfo.Adduserid = null;//追加人ID if (barcode == string.Empty) { IEnumerable <Dicttestitem> IEtempbarcodeList = grouptestList.Where <Dicttestitem>(c => c.Tubegroup == groupinfo.Tubegroup); if (IEtempbarcodeList.Count() > 0) { groupinfo.Barcode = IEtempbarcodeList.First <Dicttestitem>().Barcode; } else { groupinfo.Barcode = registerservice.GetBarCode(); } } else { groupinfo.Barcode = barcode; } //获取外包客户 Dictproductdetail detail = ProductDetail.Where <Dictproductdetail>(c => c.Productid == productinfo.Dicttestitemid && c.Testgroupid == groupinfo.Dicttestitemid).First <Dictproductdetail>(); groupinfo.Sendoutcustomerid = detail.Sendoutcustomerid; grouptestList.Add(groupinfo); } if (!iscontinue) { continue; } else { if (k >= count) { strMessage = ErrorCode.Rec_1016; break; } } } #endregion #region 添加会员 Dictmember member = new Dictmember() { Realname = realname, Idnumber = idnumber, Nickname = realname, Sex = sex, Addres = address, Phone = phone, Mobile = mobile, Email = email }; if (datebirthdayb) { member.Birthday = datebirthday; } registerservice.checkmember(null, ref member); #endregion #region 添加订单 double year = 0, month = 0, day = 0; double hours = 0; double aged = 0; string agestr = age; bool ageb = double.TryParse(agestr, out aged); if (member.Birthday == null) { if (agestr != string.Empty && ageb) { year = aged; day = aged * 365; member.Birthday = datebirthday = DateTime.Now.AddDays((0 - day)); } else { strMessage = ErrorCode.Rec_1006; break; } } TimeSpan ts = DateTime.Now - Convert.ToDateTime(member.Birthday);//时间差 year = Math.Truncate((double)(ts.Days / 365)); month = (ts.Days % 365) / 30; day = (ts.Days % 365) % 30; hours = ts.TotalHours; Orders _orders = new Orders() { Ordernum = new ProRegisterService().GetOrderNum(), Dictmemberid = member.Dictmemberid, Dictcustomerid = Convert.ToDouble(dictcustomerid), Realname = realname, Sex = sex, Caculatedage = hours, Remarks = remark, Age = string.Format("{0}岁{1}月{2}日{3}时", year, month, day, 0), Enterby = "admin", Ordertestlst = _productname + ",", Dictlabid = Convert.ToDouble(dictlabid), Ordersource = "1", Ismarried = ismarried == "未婚" ? "0" : (ismarried == "已婚" ? "1" : "2"), Section = section, Status = ((int)daan.service.common.ParamStatus.OrdersStatus.BarCodePrint).ToString(), Province = province, City = city, County = county }; if (datesamplingdateb) { _orders.SamplingDate = datesamplingdate; } string errstr = string.Empty; bool b = registerservice.insertUpdateOrders("易感基因对接订单", "", true, productList, grouptestList, member, _orders, "", ref errstr); if (!b) { strMessage = String.Format("{0} {1}", ErrorCode.Rec_1018, errstr); } #endregion } return(strMessage); }