//修改审核状态
        public ActionResult UpdtStatus(InStorage i, string status)
        {
            var ss = inStorage.GetByWhere(item => item.Id == i.Id).SingleOrDefault();

            i.InSNum     = ss.InSNum;
            i.InSTypeId  = ss.InSTypeId;
            i.SupplierId = ss.SupplierId;
            i.DetailNum  = ss.DetailNum;
            i.Num        = ss.Num;
            i.SumMoney   = ss.SumMoney;
            i.Status     = status;
            i.AuditUser  = ss.AuditUser;
            i.AuditTime  = ss.AuditTime;
            i.IsDelete   = ss.IsDelete;
            i.Remark     = ss.Remark;
            var inStorages = new InStorageManager();
            var s          = inStorages.Update(i);

            if (status.Equals("审核通过"))
            {
                var d = inStorageDetail.GetByWhere(item => item.InStorageId == ss.InSNum);
                foreach (var item in d)
                {
                    var pd = new ProductManager();
                    Expression <Func <Product, bool> > where = iss => iss.ProductNum == item.ProductNum;
                    var pdu1 = pd.GetByWhere(where).SingleOrDefault();
                    pdu1.StockNum = Convert.ToInt32(pdu1.StockNum + item.Quantity);
                    var pdu = productManager.Update(pdu1);
                }
            }
            var result = new
            {
                ActionResult = s
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        //修改入库单
        public ActionResult UpdtInfo(List <InStorageDetail> detail, int inSTypeId, int supplierId, string Remark, string InSNum)
        {
            //先删除明细
            bool val_1            = true;
            var  inStorageDetails = new InStorageDetailManager();
            var  mx = inStorageDetails.GetByWhere(i => i.InStorageId == InSNum);

            foreach (var item in mx)
            {
                val_1 = inStorageDetails.Delete(item);
            }

            //获取明细表最大编号
            string detailNumBig = inStorageDetail.GetByWhere(item => true).OrderByDescending(item => item.DetailNum).Take(1).Select(item => item.DetailNum).FirstOrDefault();
            string detailNum    = "";

            if (detailNumBig == null)
            {
                detailNumBig = "000001";
            }
            else
            {
                detailNum = "00000" + (int.Parse(detailNumBig) + 1);
                int num1 = int.Parse(detailNumBig);
                if (num1 >= 9)
                {
                    detailNumBig = "0000" + (int.Parse(detailNumBig) + 1);
                }
                else if (num1 >= 99)
                {
                    detailNumBig = "000" + (int.Parse(detailNumBig) + 1);
                }
            }
            string msg = "";
            bool   val = true;

            foreach (var item in detail)
            {
                item.DetailNum   = detailNum;
                item.InStorageId = InSNum;
                item.CreateTime  = DateTime.Now;
                val = inStorageDetail.Add(item);
            }
            if (val)
            {
                var num         = inStorageDetail.GetByWhere(item => item.InStorageId == InSNum).Sum(item => item.Quantity);
                var sumMoney    = Convert.ToDouble(inStorageDetail.GetByWhere(item => item.InStorageId == InSNum).Sum(item => item.SumMoney));
                var inStorage_1 = new InStorageManager();
                var s           = inStorage_1.GetByWhere(i => i.InSNum == InSNum).SingleOrDefault();
                s.DetailNum  = detailNum;
                s.InSTypeId  = inSTypeId;
                s.SupplierId = supplierId;
                s.Remark     = Remark;
                s.Num        = Convert.ToInt32(num);
                s.SumMoney   = Convert.ToDouble(sumMoney);
                bool vall = inStorage.Update(s);
                if (vall)
                {
                    msg = "修改成功";
                }
                else
                {
                    msg = "修改失败";
                }
                msg = "修改成功";
            }
            else
            {
                msg = "修改失败";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }