/// <summary>
        /// 核心处理
        /// </summary>
        private void CoreHandle()
        {
            try
            {
                if (timer1.Enabled == false)
                {
                    return;
                }
                //获取需要转换的条码报告  状态为:4
                Hashtable ht = new Hashtable();
                ht.Add("Status", "4");
                List <DAOutspecimen> outSpecimenList = new DAOutSpecimenBLL().GetOutspecimenListTwo(ht);
                if (outSpecimenList.Count == 0)
                {
                    SetTB("没有需要转换图片的条码!");
                    return;
                }

                //for (int i = 0; i < outSpecimenList.Count; i++)
                //{

                //}

                // List<DAOutspecimen> outNewlis = outSpecimenList.Distinct(new item_collection_DistinctBy_item1()).ToList();

                foreach (var DAOutspecimen in outSpecimenList)
                {
                    BindRightData(DAOutspecimen.Hospsampleid, DAOutspecimen.Requestcode);
                }
                SetTB("本次图片转换完毕,等待下次转换......\r\n");
            }
            catch (Exception ex)
            {
                SetTB("查询数据异常:" + ex.Message);
            }
        }
예제 #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);
            }
        }
예제 #3
0
        /// <summary>
        /// 处理条码
        /// </summary>
        /// <param name="BarCodeList">条码列表</param>
        /// <param name="flag">是否反审核条码</param>
        private bool TransactBarcode(List <string> BarCodeList, bool flag)
        {
            bool b = true;

            for (int i = 0; i < BarCodeList.Count; i++)
            {
                if (timer.Enabled == false)
                {
                    break;
                }
                //测试
                //if (BarCodeList[i] != "333336666600" && BarCodeList[i] != "666666666600")
                //{
                //    continue;
                //}
                if (flag)
                {
                    Hashtable hs = new Hashtable();
                    hs.Add("txtRequestcode", BarCodeList[i]);
                    List <DAOutspecimen> list = new DAOutSpecimenBLL().GetOutspecimenList(hs);
                    if (list.Count > 0 && list[0].Status == "5" && list[0].Status == "6" && list[0].Status == "7")
                    {
                        SetTB("条码号[" + BarCodeList[i] + "]:已经传输完毕不更新结果...");
                        continue;
                    }
                }

                //消息集合
                List <string> msglist = new List <string>();

                int status = commonbll.TreatmentResultReport(SID, msglist, BarCodeList[i], config.Model);

                string msg = string.Empty;
                for (int j = 0; j < msglist.Count; j++)
                {
                    msg += msglist[j] + ",";
                }

                if (status == 0)
                {
                    SetTB("条码号[" + BarCodeList[i] + "]:" + msg.TrimEnd(','));
                    if (msg.Contains("MSG0006"))
                    {
                        SetTB("条码号[" + BarCodeList[i] + "]:正在重新获取...");
                        string[] strlogin = commonbll.UserLogin(config);
                        if (strlogin[0] == "0")
                        {
                            SetTB("登录失败:" + strlogin[1]);
                        }
                        else
                        {
                            SID = strlogin[1];
                        }
                        i--;
                    }
                    ResultLog(false, BarCodeList[i], msg);
                    continue;
                }

                SetTB(string.Format("条码号[{0}]:获取结果完毕[{1}]", BarCodeList[i], status == 4 ? "完整获取" : "部分获取"));
                ResultLog(true, BarCodeList[i], status == 4 ? "完整获取" : "部分获取 " + msg);

                if (status < 4)
                {
                    b = false;
                }
            }
            return(b);
        }
        //生成PDF转换成image
        public void BindRightData(string Hospsampleid, string requestcode)
        {
            Createfile();                                                                              //创建PDF文件夹
            string    FilePath            = FileOrPath;
            string    filename            = FilePath + "" + Hospsampleid + "_" + requestcode + ".pdf"; //打包后的PDF文件名称
            bool      isA4                = true;
            ArrayList fileList            = new ArrayList();
            ArrayList fileListrequestcode = new ArrayList();
            Hashtable ha = new Hashtable();

            ha.Add("Requestcode", requestcode);                                          //达安条码
            ha.Add("Hospsampleid", Hospsampleid);
            List <DAReport> da      = new DAReportBLL().SelectDAReportByRequestcode(ha); //是否存在多个报告单
            string          PDFPath = string.Empty;

            if (da.Count == 0)
            {
                #region 没有报告
                return;

                #endregion
            }
            else if (da.Count == 1)
            {
                #region 单个报告
                string pdfFilePath = FileOrPath + Hospsampleid + "_" + requestcode + ".PDF";
                //文件存在则更换名称
                if (File.Exists(pdfFilePath))
                {
                    pdfFilePath = FileOrPath + Hospsampleid + "_" + requestcode + "_1.PDF";
                }
                byte[] buff = da[0].Reportdata;
                if (da[0].Reportdata == null)
                {
                }
                CreatPath(pdfFilePath, buff);
                PDFPath = pdfFilePath;
                #endregion
            }
            else if (da.Count > 1)
            {
                #region 多份报告 合并
                for (int i = 0; i < da.Count; i++)
                {
                    fileList.Add(da[i].Hospsampleid + "_" + requestcode + "_" + i);
                }
                String[] files = new string[fileList.Count];
                for (int i = 0; i < fileList.Count; i++)
                {
                    #region
                    // string FilePath = Application.StartupPath + "\\PDF打印\\";;   //设置PDF路径
                    files[i] = FilePath + fileList[i].ToString() + ".PDF"; //设置PDF文件名称
                    string path = files[i];                                //打开PDF路径
                    if (fileList[i].ToString().Contains("_"))              //设置路径是否包含多个
                    {
                        if (da.Count > 1)
                        {
                            for (int m = 0; m < da.Count; m++)
                            {
                                if (fileList[i].ToString() == da[m].Hospsampleid + "_" + requestcode + "_" + m)
                                {
                                    path = FilePath + da[m].Hospsampleid + "_" + requestcode + "_" + m + ".PDF";
                                    byte[] buff = da[m].Reportdata;
                                    CreatPath(path, buff);
                                }
                            }
                        }
                        else
                        {
                            byte[] buff = da[0].Reportdata;
                            CreatPath(path, buff);
                        }
                    }
                    else
                    {
                        if (da.Count != 0)
                        {
                            byte[] buff = da[0].Reportdata;
                            CreatPath(path, buff);
                        }
                    }
                    #endregion
                }
                mergePDFFiles(files, filename, isA4);
                PDFPath = filename;
                #endregion
            }
            bool falg = ConvertPDF2Image(PDFPath, FileOrPathImages, Hospsampleid + "_" + requestcode, Hospsampleid, 1, 15, ImageFormat.Jpeg, 5);
            bool test;
            if (falg)
            {
                Hashtable ht = new Hashtable();
                ht.Add("Status", 5);
                ht.Add("Hospsampleid", Hospsampleid);
                ht.Add("requestcode", requestcode);
                test = new DAOutSpecimenBLL().UpdateDAOutspecimenByHospsampleid(ht);
                if (test)
                {
                    SetTB("医院条码:" + Hospsampleid + ", 达安条码:" + requestcode + "转换成功!");
                }
            }
        }
예제 #5
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);
            }
        }
예제 #6
0
        /// <summary>
        /// 删除订单信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            //当前GridView是否存在数据
            if (dgvReport.Rows.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("没有要删除的订单!");
                return;
            }
            //已经选择的记录   记录数为0 则不往下执行
            List <DAOutspecimen> SelectList = (bgSource.DataSource as BindingCollection <DAOutspecimen>).ToList <DAOutspecimen>().FindAll(c => c.IsSelect);

            if (SelectList.Count == 0)
            {
                ShowMessageHelper.ShowBoxMsg("没有选择要删除的数据!");
                return;
            }
            if (MessageBox.Show("您确定要删除吗?", DefaultConfig.MSGTITLE, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            SortedList    SQLlist = new SortedList(new MySort());
            StringBuilder sb      = new StringBuilder();
            StringBuilder strb    = new StringBuilder();
            StringBuilder bacode  = new StringBuilder();

            for (int i = 0; i < SelectList.Count; i++)
            {
                //状态为已申请的可以删除,其它状态不能删除 (admin可以删除任何单据)
                if (SelectList[i].Status == "0" || (SystemConfig.UserInfo.UserCode == "admin"))
                {
                    sb.Append(SelectList[i].Outspecimenid); //获取主键信息
                    sb.Append(",");
                    strb.Append(SelectList[i].Requestcode); //获取达安条码信息
                    strb.Append(",");
                    //插入节点信息表
                    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        = "删除订单号:" + SelectList[i].Requestcode.ToString();
                    daoperationlog.Requestcode      = SelectList[i].Requestcode.ToString();
                    daoperationlog.Hospsampleid     = SelectList[i].Hospsampleid.ToString();
                    daoperationlog.Hospsamplenumber = SelectList[i].Hospsamplenumber;
                    SQLlist.Add(new Hashtable()
                    {
                        { "INSERT", "InsertDAOperationlog" }
                    }, daoperationlog);
                }
                else
                {
                    if (SelectList[i].Status != "0" && SystemConfig.UserInfo.UserCode == "admin")
                    {
                    }
                    else
                    {
                        bacode.Append(SelectList[i].Requestcode);
                        bacode.Append(",");
                    }
                }
            }
            if (strb.ToString() == "")
            {
                ShowMessageHelper.ShowBoxMsg("没有需要删除的数据!");
                return;
            }

            var library = new DAOutSpecimenBLL();

            //    SQLlist.Add(new Hashtable() { { "DELETE", "DeleteDAResult" } }, "'"+strb.ToString().TrimEnd(',').Replace(",","','")+"'");
            //    SQLlist.Add(new Hashtable() { { "DELETE", "DeleteDAOutspecimentest" } }, "'" + strb.ToString().TrimEnd(',').Replace(",", "','") + "'");
            SQLlist.Add(new Hashtable()
            {
                { "DELETE", "DeleteDAResult" }
            }, strb.ToString().TrimEnd(','));
            SQLlist.Add(new Hashtable()
            {
                { "DELETE", "DeleteDAOutspecimentest" }
            }, strb.ToString().TrimEnd(','));
            SQLlist.Add(new Hashtable()
            {
                { "DELETE", "Da.DeleteDAOutspecimen" }
            }, sb.ToString().TrimEnd(','));
            if (library.ExecuteSqlTran(SQLlist)) //删除3张表的订单相关信息
            {
                if (strb.ToString() != "")
                {
                    ShowMessageHelper.ShowBoxMsg(string.Format("{0}" + "条码成功删除", strb.ToString().TrimEnd(',')));
                }
                if (bacode.ToString() != "")
                {
                    ShowMessageHelper.ShowBoxMsg(string.Format("{0}" + "条码不能删除", bacode.ToString().TrimEnd(',')));
                }
                HeaderCheckBox.Checked = false;
                DataBind();
            }
            else
            {
                ShowMessageHelper.ShowBoxMsg("数据删除失败!");
                HeaderCheckBox.Checked = false;
                DataBind();
            }
        }