public void OutUndoneJobExl()
        {
            string type = string.Empty;
            AseldQuery asd = new AseldQuery();
            DataTable dt = new DataTable();
            StringBuilder sbJobsNumber = new StringBuilder();
            _iasdMgr = new AseldMgr(mySqlConnectionString);
            try
            {
                //選擇製作總表,還是產生明細報表
                if (Request.Params["radio1"] == "true")
                {
                    type = "0";
                }
                if (Request.Params["radio2"] == "true")
                {
                    type = "1";
                    if (!string.IsNullOrEmpty(Request.Params["assg_id"]))
                    {
                        //asd.assg_id = Request["assg_id"].Replace(",",",");
                        string str = Request["assg_id"].Replace(",", ",");
                        string[] strs = str.Split(',');
                        foreach (string item in strs)
                        {
                            asd.assg_id = item;
                            sbJobsNumber.AppendFormat("'{0}',", asd.assg_id);
                        }
                    }
                }
                DateTime time;
                asd.create_dtim = DateTime.MinValue;
                if (DateTime.TryParse(Request.Params["starttime"].ToString(), out time) && Request.Params["starttime"].Substring(0, 10) != "1970-01-01")
                {

                    asd.create_dtim = DateTime.Parse(Request.Params["starttime"]).ToString("yyyy-MM-dd") == "1970-01-01" ? DateTime.MinValue : DateTime.Parse(Request.Params["starttime"]);
                }
                if (DateTime.TryParse(Request.Params["endtime"].ToString(), out time) && Request.Params["endtime"].Substring(0, 10) != "1970-01-01")
                {
                    asd.create_dtim2 = DateTime.Parse(Request.Params["endtime"]).ToString("yyyy-MM-dd") == "1970-01-01" ? DateTime.MinValue : DateTime.Parse(Request.Params["endtime"]);
                }
                string jobNumbers = sbJobsNumber.ToString().TrimEnd(',');
                string fileName = string.Empty;
                MemoryStream ms = new MemoryStream();
                if (type == "0")
                {
                    fileName = "缺貨總報表_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    ms = ExcelHelperXhf.ExportDT(_iasdMgr.GetDetailOrSimple(type, jobNumbers, asd), "總表~未完成理貨工作_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
                }
                else if (type == "1")
                {
                    fileName = "缺貨明細報表_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                    ms = ExcelHelperXhf.ExportDT(_iasdMgr.GetDetailOrSimple(type, jobNumbers, asd), "缺貨明細~未完成理貨工作_" + DateTime.Now.ToString("yyyyMMddHHmmss"));
                }

                Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
                Response.BinaryWrite(ms.ToArray());
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }
        }