Beispiel #1
0
        //修改审核状态
        public ActionResult UpdtStatus(CheckStock i, string status)
        {
            var ss = checkStock.GetByWhere(item => item.Id == i.Id).SingleOrDefault();

            i.CheckNum    = ss.CheckNum;
            i.CheckTypeId = ss.CheckTypeId;
            i.DetailNum   = ss.DetailNum;
            i.Status      = status;
            i.AuditUser   = ss.AuditUser;
            i.AuditTime   = ss.AuditTime;
            i.IsDelete    = ss.IsDelete;
            i.Remark      = ss.Remark;
            var checkStocks = new CheckStockManager();
            var s           = checkStocks.Update(i);
            var result      = new
            {
                ActionResult = s
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        //修改盘点单
        public ActionResult UpdtInfo(List <CheckStockDetail> detail, int CheckTypeId, string Remark, string checkNum)
        {
            //先删除明细
            bool val_1             = true;
            var  checkStockDetails = new CheckStockDetailManager();
            var  mx = checkStockDetails.GetByWhere(i => i.CheckId == checkNum);

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

            //获取明细表最大编号
            string detailNumBig = checkStockDetail.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.CreateTime = DateTime.Now;
                item.CheckId    = checkNum;
                val             = checkStockDetail.Add(item);
            }
            if (val)
            {
                var checkStock_1 = new CheckStockManager();
                var s            = checkStock_1.GetByWhere(i => i.CheckNum == checkNum).SingleOrDefault();
                s.DetailNum   = detailNum;
                s.CheckTypeId = CheckTypeId;
                s.Remark      = Remark;
                bool vall = checkStock.Update(s);
                if (vall)
                {
                    msg = "修改成功";
                }
                else
                {
                    msg = "修改失败";
                }
                msg = "修改成功";
            }
            else
            {
                msg = "修改失败";
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }