//
        // 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);
        }
 //
 // POST: /StockInBill/Delete/
 public ActionResult Delete(string BillNo)
 {
     DownDecidePlanBll planBll = new DownDecidePlanBll();
     string strResult = string.Empty;
     bool bResult = InBillMasterService.Delete(BillNo, out strResult);
     if (bResult)
         planBll.DeleteMiddleBill(BillNo);
     string msg = bResult ? "删除成功" : "删除失败";
     return Json(JsonMessageHelper.getJsonMessage(bResult, msg, strResult), "text", JsonRequestBehavior.AllowGet);
 }
        //
        // POST: /StockInBill/DownInBillMaster/
        public ActionResult DownInBillMaster(string beginDate, string endDate, string wareCode, string billType)
        {
            DownUnitBll ubll = new DownUnitBll();
            DownProductBll pbll = new DownProductBll();
            DownInBillBll ibll = new DownInBillBll();
            DownDecidePlanBll planBll = new DownDecidePlanBll();
            string errorInfo = string.Empty;
            if (beginDate == string.Empty || endDate == string.Empty)
            {
                beginDate = DateTime.Now.ToString("yyyyMMdd");
                endDate = DateTime.Now.AddDays(1).Date.ToString("yyyyMMdd");
            }
            else
            {
                beginDate = Convert.ToDateTime(beginDate).ToString("yyyyMMdd");
                endDate = Convert.ToDateTime(endDate).AddDays(1).Date.ToString("yyyyMMdd");
            }

            ubll.DownUnitCodeInfo();
            pbll.DownProductInfo();

            bool bResult = planBll.GetInBillMiddle(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);

            //bool bResult = ibll.GetInBill(beginDate, endDate, this.User.Identity.Name.ToString(), wareCode, billType, out errorInfo);

            //bool bResult = InBillMasterService.DownInBillMaster(beginDate, endDate, out errorInfo);
            string msg = bResult ? "下载成功" : "下载失败";
            return Json(JsonMessageHelper.getJsonMessage(bResult, msg, errorInfo), "text", JsonRequestBehavior.AllowGet);
        }