protected void btnSelectDown_Click(object sender, EventArgs e)
 {
     try
     {
         string startDate = this.txtStartDate.Text.Trim();
         string endDate   = this.txtEndDate.Text.Trim();
         if (startDate == "")
         {
             JScript.Instance.ShowMessage(this.UpdatePanel1, "请输入开始日期!");
             return;
         }
         if (endDate == "")
         {
             JScript.Instance.ShowMessage(this.UpdatePanel1, "请输入结束日期!");
             return;
         }
         bll.DownProductInfo();//下载产品信息
         endDate   = Convert.ToDateTime(endDate).AddDays(1).Date.ToString("yyyy-MM-dd");
         startDate = startDate.Substring(0, 4) + startDate.Substring(5, 2) + startDate.Substring(8, 2);
         endDate   = endDate.Substring(0, 4) + endDate.Substring(5, 2) + endDate.Substring(8, 2);
         bool tag = inbill.GetInBill(startDate, endDate, Session["EmployeeCode"].ToString());
         if (!tag)
         {
             JScript.Instance.ShowMessage(this.UpdatePanel1, "选择的日期内,没有单据可以下载!");
         }
         else
         {
             JScript.Instance.ShowMessage(this.UpdatePanel1, "下载完成!");
         }
     }
     catch (Exception exp)
     {
         JScript.Instance.ShowMessage(this.UpdatePanel1, exp.Message);
     }
 }
Example #2
0
        //
        // POST: /StockInBill/DownInBillMaster/
        public ActionResult DownInBillMaster(string beginDate, string endDate, string wareCode, string billType, bool isInDown)
        {
            bool              bResult   = false;
            DownUnitBll       ubll      = new DownUnitBll();
            DownProductBll    pbll      = new DownProductBll();
            DownInBillBll     ibll      = new DownInBillBll();
            DownDecidePlanBll planBll   = new DownDecidePlanBll();
            string            errorInfo = string.Empty;

            try
            {
                beginDate = Convert.ToDateTime(beginDate).ToString("yyyyMMdd");
                endDate   = Convert.ToDateTime(endDate).ToString("yyyyMMdd");
                if (!SystemParameterService.SetSystemParameter())
                {
                    ubll.DownUnitCodeInfo();
                    pbll.DownProductInfo();
                    if (isInDown)
                    {
                        bResult = ibll.GetInBill(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);
                    }
                    else
                    {
                        bResult = planBll.GetInBillMiddle(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);
                    }
                }
                else
                {
                    ubll.DownUnitInfo();
                    pbll.DownProductInfos();
                    if (isInDown)
                    {
                        bResult = ibll.GetInBills(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);
                    }
                    else
                    {
                        bResult = planBll.GetInBillMiddle(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);
                    }
                }
            }
            catch (Exception e)
            {
                errorInfo += e.Message;
            }

            string msg = bResult ? "下载成功" : "下载失败";

            return(Json(JsonMessageHelper.getJsonMessage(bResult, msg, errorInfo), "text", JsonRequestBehavior.AllowGet));
        }