Exemple #1
0
        // 扫描达安条码 插入订单
        private void txtDaanBarcode_KeyPress(object sender, KeyPressEventArgs e)
        {
            //是否回车键
            if (e.KeyChar != (char)Keys.Enter)
            {
                return;
            }
            string barcode = this.txtDaanBarcode.Text.Trim();

            this.txtDaanBarcode.Text = string.Empty;
            if (barcode == "")
            {
                ShowMessageHelper.ShowBoxMsg("达安条码不能为空!"); return;
            }
            Regex r = new Regex(@"^\d*00$|\:");  //正则12位数字尾数必须为0

            //达安条码为12位
            if (barcode.Length != 12)
            {
                ShowMessageHelper.ShowBoxMsg("请核对达安条码为12位数字!"); return;
            }
            //达安条码为数字

            if (!r.IsMatch(barcode))
            {
                ShowMessageHelper.ShowBoxMsg("请核对达安条码后两位为0的12位数字!"); return;
            }


            if (gvLisrequest.RowCount == 0)
            {
                ShowMessageHelper.ShowBoxMsg("无医院相关信息!"); return;
            }

            BindingSource TestData = gvDaLis.DataSource as BindingSource;

            if (TestData.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("没有项目,不能添加!"); return;
            }

            try
            {
                #region >>>> zhouy  添加过滤
                //选中的当前行
                VDaLisrequest vda = (VDaLisrequest)gvLisrequest.Rows[gvLisrequest.CurrentCell.RowIndex].DataBoundItem;
                //是否存在相同的达安条码
                List <DAOutspecimen> daoutlist = outspecimenbll.GetOutspecimenList(new Hashtable()
                {
                    { "txtRequestcode", barcode }
                });

                if (daoutlist.Count > 0)
                {
                    ShowMessageHelper.ShowBoxMsg("已存在相同的达安条码!"); return;
                }


                #endregion

                #region  >>>插入订单主表、从表、结果表


                //项目列表 取列表项目,可见见即可得
                List <VDaLisrequesttest> VTestList = ((BindingCollection <VDaLisrequesttest>)TestData.List).ToList().FindAll(c => c.IsSelect);
                //项目是否匹配
                if (VTestList.FindAll(c => c.Datestcode == "").Count != 0)
                {
                    ShowMessageHelper.ShowBoxMsg("项目不匹配,数据添加失败!"); return;
                }
                SortedList SQLlist = new SortedList(new MySort());

                #region >>>> zhouy 申请单
                DAOutspecimen daoutspecimen = new DAOutspecimen();
                int           age           = 0;
                if (vda.Age != null && vda.Age != "")
                {
                    if (!int.TryParse(vda.Age, out age))
                    {
                        ShowMessageHelper.ShowBoxMsg("年龄格式不对!"); return;
                    }
                    //如果年龄大于200岁
                    if (age > 200 && age < 0 && vda.Ageunit == "0")
                    {
                        ShowMessageHelper.ShowBoxMsg("年龄不能大于200岁!"); return;
                    }
                }

                daoutspecimen.Age          = age;
                daoutspecimen.Requestcode  = barcode;
                daoutspecimen.Hospsampleid = vda.Hospsampleid;
                //  if (chxHosNumer.Checked) {
                daoutspecimen.Hospsamplenumber = vda.Hospsamplenumber;
                //  }
                daoutspecimen.Customercode    = SystemConfig.Config.Username;
                daoutspecimen.Remark          = "";
                daoutspecimen.Patientnumber   = vda.Patientnumber;
                daoutspecimen.Bednumber       = vda.Bednumber;
                daoutspecimen.Samplingdate    = vda.Samplingdate;
                daoutspecimen.Patientsource   = vda.Patientnumber;
                daoutspecimen.Patientname     = vda.Pname;
                daoutspecimen.Bodystyle       = vda.Bodystyle;
                daoutspecimen.Sex             = vda.Sex;
                daoutspecimen.Patienttel      = vda.Patienttel;
                daoutspecimen.Location        = vda.Sectionoffice;
                daoutspecimen.Doctor          = vda.Doctor;
                daoutspecimen.Doctortel       = vda.Doctortel;
                daoutspecimen.Birthday        = vda.Birthday;
                daoutspecimen.Ageunit         = vda.Ageunit;
                daoutspecimen.Diagnostication = vda.Diagnostication;
                daoutspecimen.Status          = "0";
                daoutspecimen.Babycount       = vda.Babycount;
                daoutspecimen.Lmp             = vda.Lmp;
                daoutspecimen.Lmpdate         = vda.Lmpdate;
                daoutspecimen.Uninevolumn     = vda.Uninevolumn.ToString();
                daoutspecimen.Weight          = vda.Weight.ToString();
                daoutspecimen.Height          = vda.Height.ToString();
                daoutspecimen.Bultrasonic     = vda.Bultrasonic;
                daoutspecimen.Pregnant        = vda.Pregnant;
                daoutspecimen.Enterby         = SystemConfig.UserInfo.UserCode; //"";//录单人
                daoutspecimen.Enterbydate     = DateTime.Now;
                daoutspecimen.Lastupdatedate1 = DateTime.Now;
                daoutspecimen.Createdate      = DateTime.Now;
                daoutspecimen.Usertype        = SystemConfig.UserInfo.UserType.ToString();
                #endregion

                //显示校验医院项目是否与达安项目匹配
                List <string> strCoustomercode = new List <string>(); //客户项目代码
                List <string> strCoustomername = new List <string>(); //客户项目名称
                List <string> strDatecode      = new List <string>(); //达安项目代码
                List <string> strDatename      = new List <string>(); //达安项目名称

                //查询系统中 医院中的所有项目
                Hashtable ht = new Hashtable();
                ht.Add("Hospsampleid", daoutspecimen.Hospsampleid);
                List <DAResult> _daresult = new DAResultBLL().GetDAResultList(ht);   //显示基本信息

                foreach (VDaLisrequesttest vdl in VTestList)
                {
                    string[] dacodearr = vdl.Datestcode.Split(',');

                    #region >>>> 申请单项目表

                    for (int i = 0; i < dacodearr.Length; i++)
                    {
                        string dacode = dacodearr[i].Trim();
                        string daname = "";
                        IEnumerable <string> IEdaname = from a in DaTestList
                                                        where a.Datestcode.Trim() == dacode
                                                        select a.Datestname;

                        if (IEdaname.Count() == 0)
                        {
                            //dacode = daname = "";
                            ShowMessageHelper.ShowBoxMsg(string.Format("达安项目中不存在编号为[{0}]的项目!", dacode)); return;
                        }
                        //  else { daname = IEdaname.First(); }



                        DAOutspecimentest daouttest = new DAOutspecimentest();
                        daouttest.Hospsampleid = vda.Hospsampleid;
                        //if (chxHosNumer.Checked) {
                        daouttest.Hospsamplenumber = vda.Hospsamplenumber;
                        //  }
                        daouttest.Requestcode      = barcode;
                        daouttest.Customertestcode = vdl.Testcode;
                        daouttest.Customertestname = vdl.Testname;
                        daouttest.Datestcode       = dacode;
                        daouttest.Datestname       = daname;
                        daouttest.Createdate       = DateTime.Now;
                        SQLlist.Add(new Hashtable()
                        {
                            { "INSERT", "Da.InsertDAOutspecimentest" }
                        }, daouttest);
                    }

                    #endregion

                    //保存重复过的项目名称
                    string testnamelist = "";

                    #region >>>> 插入结果表

                    List <VDAListests> vdalisttest = new VDAListestsBLL().GetVDaListestsresultByCode(new Hashtable()
                    {
                        { "Testcode", vdl.Testcode }
                    });

                    foreach (VDAListests item in vdalisttest)
                    {
                        DAResult daResult = new DAResult();
                        daResult.Requestcode  = barcode;
                        daResult.Hospsampleid = vda.Hospsampleid;
                        //if (chxHosNumer.Checked) {
                        daResult.Hospsamplenumber = vda.Hospsamplenumber;
                        //  }
                        daResult.Testtype          = item.Testtype;
                        daResult.Customergroupcode = item.CustomerGroupCode; //医院组合代码
                        daResult.Customergroupname = item.CustomerGroupName; //医院组合名称
                        daResult.Customertestcode  = item.Subtestcode;       //医院单项代码
                        daResult.Customertestname  = item.Subtestname;       //医院单项名称
                        //不存在单项名 取组合名
                        if (item.Subtestcode == null || item.Subtestcode == "")
                        {
                            daResult.Customertestcode = item.CustomerGroupCode; //医院单项代码
                            daResult.Customertestname = item.CustomerGroupName; //医院单项名称
                        }

                        //如果已经插入系统的项目 再次扫描不允许插入
                        if (_daresult.FindAll(c => c.Customertestcode.Trim() == daResult.Customertestcode.Trim()).Count > 0)
                        {
                            testnamelist += daResult.Customertestname + ",";
                            continue;
                        }


                        daResult.Dagroupcode = string.Empty;
                        daResult.Dagroupname = string.Empty;
                        daResult.Datestcode  = string.Empty;  //达安单项代码
                        daResult.Datestname  = string.Empty;  //达安单项名称
                        SQLlist.Add(new Hashtable()
                        {
                            { "INSERT", "InsertDAResult" }
                        }, daResult);
                    }
                    #endregion

                    //同意医院条码有重复项目
                    if (testnamelist != "")
                    {
                        ShowMessageHelper.ShowBoxMsg(
                            string.Format("送检人【{0}】医院条码[{1}]的项目[{2}]已经添加到系统中,分开条码请先删除已添加的项目,或者去掉勾选",
                                          daoutspecimen.Patientname, daoutspecimen.Hospsampleid, testnamelist.TrimEnd(',')));
                        return;
                    }
                    daoutspecimen.Customertestcodes += vdl.Testcode + ",";
                    daoutspecimen.Customertestnames += vdl.Testname + ",";
                    daoutspecimen.Datestcodes       += vdl.Datestcode + ",";
                    daoutspecimen.Datestnames       += vdl.Datestname + ",";
                }

                daoutspecimen.Customertestcodes = daoutspecimen.Customertestcodes.TrimEnd(',');
                daoutspecimen.Customertestnames = daoutspecimen.Customertestnames.TrimEnd(',');
                daoutspecimen.Datestcodes       = daoutspecimen.Datestcodes.TrimEnd(',');
                daoutspecimen.Datestnames       = daoutspecimen.Datestnames.TrimEnd(',');
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "Da.InsertDAOutspecimen" }
                }, daoutspecimen);

                #region >>>> 写操作日志

                DAOperationlog daoperationlog = new DAOperationlog();
                daoperationlog.Dictuserid   = SystemConfig.UserInfo.UserId == "" ? 0 : Convert.ToDecimal(SystemConfig.UserInfo.UserId);
                daoperationlog.Usercode     = SystemConfig.UserInfo.UserCode;
                daoperationlog.Username     = SystemConfig.UserInfo.UserName;
                daoperationlog.Usertype     = SystemConfig.UserInfo.UserType.ToString();
                daoperationlog.Optype       = "新增订单信息";
                daoperationlog.Createdate   = DateTime.Now;
                daoperationlog.Opcontent    = "生成订单号:" + barcode;
                daoperationlog.Requestcode  = barcode;
                daoperationlog.Hospsampleid = vda.Hospsampleid;
                //  if (chxHosNumer.Checked) {
                daoperationlog.Hospsamplenumber = vda.Hospsamplenumber;
                //  }
                SQLlist.Add(new Hashtable()
                {
                    { "INSERT", "InsertDAOperationlog" }
                }, daoperationlog);

                #endregion


                string errmsg = "";
                if (!outspecimenbll.ExecuteSqlTran(SQLlist, ref errmsg))
                {
                    ShowMessageHelper.ShowBoxMsg("添加失败!:" + errmsg); return;
                }

                DataBind(daoutspecimen);
                this.txtBarcode.Focus();

                #endregion
            }
            catch (Exception Ex)
            {
                ShowMessageHelper.ShowBoxMsg("添加订单异常:" + Ex.Message);
                return;
            }
        }
Exemple #2
0
        /// <summary>
        /// 上传订单处理
        /// </summary>
        private void SendOrdersHandle()
        {
            try
            {
                DAOutSpecimenBLL bll = new DAOutSpecimenBLL();
                //获取需要获取结果的条码号
                List <DAOutspecimen> BarCodeList = bll.SelectRequestCodeBySendOrders();
                if (BarCodeList.Count == 0)
                {
                    SetTB("没有订单需要上传"); return;
                }

                //获取对照表
                List <DATestmap> datestmap = new DATestmapBLL().GetDATestmapList(null);
                for (int i = 0; i < BarCodeList.Count; i++)
                {
                    DAOutspecimen outspec = BarCodeList[i];
                    string        barcode = outspec.Requestcode;
                    try
                    {
                        Hashtable ht = new Hashtable();
                        ht.Add("Requestcode", barcode);
                        DataTable dt = outspecimenbll.GetOutspecimenTable(ht); //基本信息
                        dt.TableName = "data_row";

                        /* 发送模式:1 组合发送, 0 单项发送(默认)
                         * 组合发送: 发送订单表OutSpecimen的数据
                         * (DATESTCODES AS NaturalItem,CUSTOMERTESTNAMES AS NaturalItemDesc,CUSTOMERTESTCODES AS HospItemCode)
                         *
                         * 单项发送: 发送结果表da_result中的明细数据,获取Customertestcode,customertestname,
                         * 并根据Customertestcode获取对照表的datestcode
                         */
                        #region >>>> zhouy 发送项目拼装

                        string    cuscode = "", cusname = "", daancode = "";
                        DataTable dtTest;
                        if (config.Model == "1")
                        {
                            dtTest = new DAOutSpecimentestBLL().SelectSendGruopCodeByRequestCode(outspec.Requestcode); //组合
                        }
                        else
                        {
                            dtTest = new DAResultBLL().SelectSendTestCodeByRequestCode(outspec.Requestcode); //明细
                        }

                        foreach (DataRow dr in dtTest.Rows)
                        {
                            //没有达安代码,则对照表没有对应
                            if (dr["datestcode"] == null || dr["datestcode"].ToString() == "")
                            {
                                //没对项目跳出进行下一个条码
                                throw new Exception(string.Format("中的医院项目[{0}({1})]未对应好数据,请到项目对照表中对应好"
                                                                  , dr["customertestname"], dr["Customertestcode"]));
                            }

                            cuscode  += dr["Customertestcode"] + ",";
                            cusname  += dr["customertestname"] + ",";
                            daancode += dr["datestcode"] + ",";
                        }

                        dt.Rows[0]["HospItemCode"]    = cuscode.TrimEnd(','); //医院项目代码
                        dt.Rows[0]["NaturalItemDesc"] = cusname.TrimEnd(','); //医院项目名称

                        dt.Rows[0]["NaturalItem"] = daancode.TrimEnd(',');    //达安代码

                        #endregion

                        string[] obj = new string[2] {
                            SID, StringToXML(DataToXml.ConvertDataTableToXML(dt))
                        };

                        string strQueryResult = WebServiceUtils.ExecuteMethod("SendRequestInfo", obj);  //调用webService

                        if (strQueryResult.Contains("无法连接"))
                        {
                            throw new Exception("操作连接超时!" + strQueryResult);
                        }
                        else if (strQueryResult.Contains("MSG0006"))
                        {
                            string[] strlogin = commonbll.UserLogin(config);
                            if (strlogin[0] == "0")
                            {
                                SetTB("登录失败:" + strlogin[1]); continue;
                            }
                            else
                            {
                                SID = strlogin[1]; i--;
                            }
                        }
                        else
                        {
                            #region >>>> zhouy  发送成功记录成功日志,发送失败记录错误日志
                            string msg = strQueryResult; //strQueryResult.TrimEnd(',').Split('|'); 2019.1.29该接口康源系统返回的格式和其他接口不同做特殊处理
                            //0 为正常发送了
                            if (msg.Contains("|0"))
                            {
                                DAOperationlog daoperationlog = new DAOperationlog();
                                daoperationlog.Dictuserid       = user.Dictuserid;
                                daoperationlog.Usercode         = user.Usercode;
                                daoperationlog.Username         = user.Username;
                                daoperationlog.Usertype         = "1";//系统自动上传  写成医院客户
                                daoperationlog.Optype           = "订单已发送";
                                daoperationlog.Createdate       = DateTime.Now;
                                daoperationlog.Opcontent        = "发送订单,订单号:" + outspec.Requestcode;
                                daoperationlog.Requestcode      = outspec.Requestcode;      //达安条码
                                daoperationlog.Hospsampleid     = outspec.Hospsampleid;     //医院条码
                                daoperationlog.Hospsamplenumber = outspec.Hospsamplenumber; //医院样本号
                                if (new DAOperationlogBLL().SaveDAOperationlog(daoperationlog) == true)
                                {
                                    Hashtable htstatus = new Hashtable();
                                    htstatus.Add("Outspecimenid", outspec.Outspecimenid.ToString());
                                    htstatus.Add("status", "2");//已发送 修改状态
                                    new DAOutSpecimenBLL().UpdateStatus(htstatus);
                                }
                                //记录成功的达安条码号
                                SetTB(string.Format("达安条码[{0}]:发送成功", outspec.Requestcode));
                            }
                            else
                            {
                                SetTB(string.Format("达安条码[{0}]:{1}", outspec.Requestcode, msg));

                                //记录失败的异常信息到日志表中
                                DAErrorlog error = new DAErrorlog();
                                error.Dictuserid     = user.Dictuserid;
                                error.Createdate     = DateTime.Now;
                                error.LastUpdateDate = DateTime.Now;
                                error.Opcontent      = "订单发送异常信息: " + msg;
                                error.Usercode       = user.Usercode;
                                error.Usertype       = "1";
                                error.Username       = user.Username;
                                error.Ipaddress      = commonbll.GetHostIP();   //获取本机IP地址
                                error.Machinename    = commonbll.GetHostName(); //获取本机机器名
                                new DAErrorLogBLL().SaveErrorLog(error);
                            }
                            #endregion
                        }
                    }
                    catch (Exception e) { SetTB(string.Format("达安条码[{0}]:{1}", barcode, e.Message)); }
                }
            }
            catch (Exception e)
            {
                SetTB("发送订单出现异常:" + e.Message);
            }
        }
Exemple #3
0
        /// <summary>
        /// 发送订单信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSend_Click(object sender, EventArgs e)
        {
            try
            {
                #region >>>> zhouy 数据检查
                //当前GridView是否存在数据
                if (dgvReport.Rows.Count == 0)
                {
                    ShowMessageHelper.ShowBoxMsg("没有选择要发送的订单!");
                    return;
                }
                //选择要发送的订单条数
                List <DAOutspecimen> SelectList = (bgSource.DataSource as BindingCollection <DAOutspecimen>).ToList <DAOutspecimen>().FindAll(c => c.IsSelect);
                if (SelectList.Count == 0)
                {
                    ShowMessageHelper.ShowBoxMsg("没有选择要发送的订单!");
                    return;
                }
                if (SystemConfig.Config == null)
                {
                    ShowMessageHelper.ShowBoxMsg("获取系统配置失败,请重新登陆!");
                    return;
                }
                #endregion

                string strM         = ""; //成功条码号
                string errorMessage = ""; //错误信息
                int    num          = 0;  //记录符合发送状态的条码条数
                string bacode       = "";


                //登录失败需要倒回上次一循环,不使用foreach
                for (int m = 0; m < SelectList.Count; m++)
                {
                    DAOutspecimen _outs = SelectList[m];

                    //记录发送失败或不能发送的条码信息
                    if (_outs.Status != "0" && _outs.Status != "2")
                    {
                        bacode += _outs.Requestcode + ","; continue;
                    }

                    #region >>>> zhouy 发送订单
                    num++;
                    Hashtable ht = new Hashtable();
                    ht.Add("Requestcode", _outs.Requestcode);
                    DataTable dt = new DAOutSpecimenBLL().GetOutspecimenTable(ht); //基本信息
                    dt.TableName = "data_row";

                    /* 发送模式:1 组合发送, 0 单项发送
                     * 组合发送: 发送订单表OutSpecimen的数据
                     * (DATESTCODES AS NaturalItem,CUSTOMERTESTNAMES AS NaturalItemDesc,CUSTOMERTESTCODES AS HospItemCode)
                     *
                     * 单项发送: 发送结果表da_result中的明细数据,获取Customertestcode,customertestname,
                     * 并根据Customertestcode获取对照表的datestcode
                     */
                    #region >>>> zhouy 发送项目拼装

                    string    cuscode = "", cusname = "", daancode = "";
                    DataTable dtTest;
                    if (SystemConfig.Config.Model == "1")
                    {
                        dtTest = new DAOutSpecimentestBLL().SelectSendGruopCodeByRequestCode(_outs.Requestcode); //组合
                    }
                    else
                    {
                        dtTest = new DAResultBLL().SelectSendTestCodeByRequestCode(_outs.Requestcode); //明细
                    }

                    foreach (DataRow dr in dtTest.Rows)
                    {
                        //没有达安代码,则对照表没有对应
                        if (dr["datestcode"] == null || dr["datestcode"].ToString() == "")
                        {
                            errorMessage += string.Format("达安条码[{0}]中的医院项目[{1}({2})]未对应好数据,请到项目对照表中对应好\n"
                                                          , _outs.Requestcode, dr["customertestname"], dr["Customertestcode"]);
                        }

                        cuscode  += dr["Customertestcode"] + ",";
                        cusname  += dr["customertestname"] + ",";
                        daancode += dr["datestcode"] + ",";
                    }

                    dt.Rows[0]["HospItemCode"]    = cuscode.TrimEnd(','); //医院项目代码
                    dt.Rows[0]["NaturalItemDesc"] = cusname.TrimEnd(','); //医院项目名称
                    if (daancode.TrimEnd(',') == "")                      //判断达安项目是否为空,也就是是否有对照
                    {
                        ShowMessageHelper.ShowBoxMsg("医院项目代码:" + cuscode.TrimEnd(',') + "没有和达安项目对照!");
                        return;
                    }
                    dt.Rows[0]["NaturalItem"] = daancode.TrimEnd(',');//达安代码

                    #endregion

                    // string str = StringToXML("<NewDataSet><data_row><Outspecimenid>31</Outspecimenid><RequestCode>440590096900</RequestCode><HospSampleid>1307261704</HospSampleid><HospSamplenumber>1307262509</HospSamplenumber><PatientNumber>01158055</PatientNumber><BedNumber /><SamplingDate>2013-07-26T16:33:07+08:00</SamplingDate><PatientName>王钊</PatientName><Sex>M</Sex><Age>7岁</Age><PatientTel /><SectionOffice>儿童保健科</SectionOffice><Doctor>程双喜</Doctor><DoctorTel /><Diagnostication /><Lmp /><Lmpdate /><BabyCount /><UnineVolumn /><Bodystyle /><Weight /><Height /><Bultrasonic /><Pregnant /><Programid>5</Programid><NaturalItem /><NaturalItemDesc>类胰岛素样生长因子测定</NaturalItemDesc><HospItemCode>09589</HospItemCode><Remark /><operateby>100191</operateby><userName>44170340</userName></data_row></NewDataSet>");
                    string[] obj = new string[2] {
                        SystemConfig.UserInfo.SID, StringToXML(DataToXml.ConvertDataTableToXML(dt))
                    };                                                                              // StringToXML(DataToXml.ConvertDataTableToXML(dt))

                    string strQueryResult = WebServiceUtils.ExecuteMethod("SendRequestInfo", obj);  //调用webService
                    //ShowMessageHelper.ShowBoxMsg("接口调试:" + strQueryResult);
                    #region >>>> zhouy  处理发送结果
                    if (strQueryResult.Contains("MSG0006")) //登陆超时
                    {
                        #region >>>> zhouy 登录超时,重新的登录
                        string strSideCode = SystemConfig.Config.Sitecode;
                        string strUrl      = SystemConfig.Config.Address;                                                       //调用webservice地址
                        string username    = SystemConfig.Config.Username == string.Empty ? "无" : SystemConfig.Config.Username; //登录用户名
                        string password    = SystemConfig.Config.Password;                                                      //登录用户密码
                        //设置调用webservice登录方法的参数
                        string[] par = new string[] { strSideCode, username, password, SystemConfig.UserInfo.UserName };
                        //返回登录验证信息:1|SID,0|errorMsg
                        string[] loginMsg = WebServiceUtils.ExecuteMethod("Login", par).Split('|');
                        if (loginMsg[0] == "0") //登录失败
                        {
                            ShowMessageHelper.ShowBoxMsg("登陆失败!" + loginMsg[1].ToString());
                            return;
                        }
                        else if (loginMsg[0] == "1")
                        {
                            SystemConfig.UserInfo.SID = loginMsg[1].ToString();
                            m--;//返回继续发送,不弹出消息 zhouy
                            // ShowMessageHelper.ShowBoxMsg("发送条码[" + _outs.Requestcode + "]超时,请重新发送该条订单!");
                        }
                        #endregion
                    }
                    else if (strQueryResult.Contains("无法连接"))
                    {
                        ShowMessageHelper.ShowBoxMsg("操作连接超时!" + strQueryResult.ToString());
                        return;
                    }
                    //else if (strQueryResult.Contains("未上传任何达安代码!"))
                    //{
                    //    ShowMessageHelper.ShowBoxMsg("项目匹配有误:" + _outs.Requestcode +"条码"+ strQueryResult.ToString());
                    //    return;
                    //}
                    else
                    {
                        #region >>>> zhouy  发送成功记录成功日志,发送失败记录错误日志
                        string[] _messg = strQueryResult.TrimEnd(',').Split('|');
                        //0 为正常发送了
                        if (_messg[3] == "0")
                        {
                            DAOperationlog daoperationlog = new DAOperationlog();
                            daoperationlog.Dictuserid       = SystemConfig.UserInfo.UserId == "" ? 0 : Convert.ToDecimal(SystemConfig.UserInfo.UserId);
                            daoperationlog.Usercode         = SystemConfig.UserInfo.UserCode;
                            daoperationlog.Username         = SystemConfig.UserInfo.UserName;
                            daoperationlog.Usertype         = SystemConfig.UserInfo.UserType.ToString();
                            daoperationlog.Optype           = "订单已发送";
                            daoperationlog.Createdate       = DateTime.Now;
                            daoperationlog.Opcontent        = "发送订单,订单号:" + _messg[0];
                            daoperationlog.Requestcode      = _messg[0]; //达安条码
                            daoperationlog.Hospsampleid     = _messg[1]; //医院条码
                            daoperationlog.Hospsamplenumber = _messg[2]; //医院样本号
                            if (new DAOperationlogBLL().SaveDAOperationlog(daoperationlog) == true)
                            {
                                Hashtable htstatus = new Hashtable();
                                htstatus.Add("Outspecimenid", _outs.Outspecimenid.ToString());
                                htstatus.Add("status", "2");//已发送 修改状态
                                new DAOutSpecimenBLL().UpdateStatus(htstatus);
                            }
                            strM += _messg[0] + ",";  //记录成功的达安条码号
                        }
                        else
                        {
                            errorMessage += string.Format("达安条码[{0}]:{1}\n", _messg[0], _messg[3]);
                            //记录失败的异常信息到日志表中
                            DAErrorlog error = new DAErrorlog();
                            error.Dictuserid     = Convert.ToDecimal(SystemConfig.UserInfo.UserId);
                            error.Createdate     = DateTime.Now;
                            error.LastUpdateDate = DateTime.Now;
                            error.Opcontent      = "订单发送异常信息: " + _messg[0];
                            error.Usercode       = SystemConfig.UserInfo.UserCode;
                            error.Usertype       = SystemConfig.UserInfo.UserType.ToString();
                            error.Username       = SystemConfig.UserInfo.UserName;
                            error.Ipaddress      = common.GetHostIP();   //获取本机IP地址
                            error.Machinename    = common.GetHostName(); //获取本机机器名
                            new DAErrorLogBLL().SaveErrorLog(error);
                        }
                        #endregion
                    }
                    #endregion

                    #endregion
                }
                if (num == 0)  //记录符合发送状态的条码条数
                {
                    ShowMessageHelper.ShowBoxMsg(string.Format("达安条码[{0}]状态为报告已出或部分结果的条码不能发送!", bacode.TrimEnd(',')));
                    return;
                }
                if (bacode.ToString() != "")  //记录不能发送的条码号
                {
                    ShowMessageHelper.ShowBoxMsg(string.Format("达安条码[{0}]状态为报告已出或部分结果的条码不能发送!", bacode.TrimEnd(',')));
                }
                if (errorMessage != "")  //错误信息反馈
                {
                    ShowMessageHelper.ShowBoxMsg(errorMessage);
                }
                if (strM != "")
                {
                    ShowMessageHelper.ShowBoxMsg(string.Format("达安条码[{0}] 发送成功!", strM.TrimEnd(',')));
                    HeaderCheckBox.Checked = false;
                    DataBind();
                }
            }
            catch (Exception ex)
            {
                ShowMessageHelper.ShowBoxMsg(ex.Message);
            }
        }