public JsonResult Create(BeforePeiScanType obj)
 {
     try
     {
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return Json(new { errorMsg = "出错了" });
     }
     return Json(new { IsSuccess = "true" });
 }
 public JsonResult OutStockByBeforePei(string p1, string o)
 {
     List<OrderType> orders =
         NSession.CreateQuery("from OrderType where OrderNo='" + o + "'").List<OrderType>().ToList();
     if (orders.Count > 0)
     {
         OrderType order = orders[0];
         if (order.Status == OrderStatusEnum.待拣货.ToString() || (order.Status == OrderStatusEnum.已处理.ToString()))
         {
             order.Status = "待拣货";
             NSession.Update(order);
             NSession.Flush();
             var obj = new BeforePeiScanType
                           {
                               OId = order.Id,
                               OrderNo = order.OrderNo,
                               PeiBy = p1,
                               CreatBy = CurrentUser.Realname,
                               CreateOn = DateTime.Now
                           };
             NSession.Save(obj);
             NSession.Flush();
             LoggerUtil.GetOrderRecord(order, "订单配货前扫描!", "将订单配货前扫描," + p1 + "待拣货!", CurrentUser,
                                       NSession);
             string html = "订单: " + order.OrderNo + "开始拣货!配货人:" + p1;
             return Json(new { IsSuccess = true, Result = html });
         }
         return
             Json(new { IsSuccess = false, Result = "订单状态不符!现在的订单状态为:" + order.Status + " 将订单状态设置为“已处理”才能配货前扫描!" });
     }
     return Json(new { IsSuccess = false, Result = "找不到该订单" });
 }