コード例 #1
0
 public JsonResult Create(PlanDaoType obj)
 {
     try
     {
         IList<PurchasePlanType> plan =
             NSession.CreateQuery("from PurchasePlanType where Id=:p").SetInt32("p", Convert.ToInt32(obj.PlanNo)).
                 SetMaxResults(1)
                 .List<PurchasePlanType>();
         if (plan.Count > 0)
         {
             if (plan[0].Status != "已收到")
             {
                 obj.PlanId = plan[0].Id;
                 obj.PlanNo = plan[0].PlanNo;
                 WarehouseType w = NSession.Get<WarehouseType>(obj.WId);
                 obj.WName = w.WName;
                 obj.Price = Math.Round(plan[0].Price + plan[0].Freight / plan[0].Qty, 4);
                 obj.DaoOn = DateTime.Now;
                 obj.SendOn = DateTime.Now;
                 obj.IsAudit = 0;
                 NSession.SaveOrUpdate(obj);
                 NSession.Flush();
                 plan[0].Status = obj.Status;
                 plan[0].ReceiveOn = DateTime.Now;
                 plan[0].DaoQty += obj.RealQty;
                 NSession.SaveOrUpdate(plan[0]);
                 NSession.Flush();
                 LoggerUtil.GetPurchasePlanRecord(plan[0], "采购到货", "采购到货" + obj.Status + obj.RealQty, CurrentUser, NSession);
             }
         }
         else
         {
             return Json(new { ErrorMsg = "出错了", IsSuccess = false });
         }
     }
     catch (Exception ee)
     {
         return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
     }
     return Json(new { IsSuccess = true });
 }
コード例 #2
0
        public ActionResult Edit(PlanDaoType obj)
        {

            try
            {
                NSession.Update(obj);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return Json(new { IsSuccess = false, ErrorMsg = "出错了" });
            }
            return Json(new { IsSuccess = true });

        }