目录
[1、 RapidrepairController](#1、 RapidrepairController)
[1.1、 快速修车](#1.1、 快速修车)
[1.2、 快速领料](#1.2、 快速领料)
[1.2.1、 //无法获取session 重定向到登录界面 重新登录](#1.2.1、 //无法获取session 重定向到登录界面 重新登录)
[1.3、 生成预约单号](#1.3、 生成预约单号)
- RapidrepairController
using QXQPS.Models;
using QXQPS.Vo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace QXQPS.Areas.MechanicsManagment.Controllers
{
public class RapidrepairController : Controller
{
// GET: MechanicsManagment/Rapidrepair
Models.QXQPEntities myModels = new Models.QXQPEntities();
public ActionResult Rapidrepair()//快速修车
{
return View();
}
-
- 快速修车
[HttpPost]
public ActionResult Rapidrepair(int ReceptionID)//快速修车
{
Session["receptionID"] = ReceptionID;
return View();
}
public ActionResult ClearReceptions()//快速修车
{
Session["receptionID"] = null;
return Json("", JsonRequestBehavior.AllowGet);
}
-
- 快速领料
public ActionResult Collage()//快速领料
{
try
{
ViewBag.ReceptionID = Session["ReceptionID"];
return View();
}
catch (Exception)
{
-
-
- //无法获取session 重定向到登录界面 重新登录
-
return Redirect("/Home/Login");
}
}
[HttpPost]
public ActionResult Collage(int ReceptionID)//快速领料
{
Session["ReceptionID"] = ReceptionID;
return View();
}
public ActionResult ClearReception()//快速修车
{
Session["receptionID"] = null;
return Json("", JsonRequestBehavior.AllowGet);
}
-
- 生成预约单号
public ActionResult MaintenanceNum()//生成预约单号
{
string MaintenanceNum = "";
var date = "K" + DateTime.Now.ToString("yyyyMMdd");
try
{
var list = myModels.PW_Reception.Where(m => m.MaintenanceNum.Contains(date)).OrderBy(m => m.MaintenanceNum).ToList();
if (list.Count != 0)
{
int num = Convert.ToInt32(list.Last().MaintenanceNum.Trim().Substring(9)) + 1;
if (num < 10)
{
MaintenanceNum = date + "000" + num;
}
else if (num > 9 && num < 100)
{
MaintenanceNum = date + "00" + num;
}
else if (num > 99 && num < 1000)
{
MaintenanceNum = date + "0" + num;
}
}
else {
MaintenanceNum = date + "0001";
}
}
catch (Exception)
{
return Json(MaintenanceNum, JsonRequestBehavior.AllowGet);
}
return Json(MaintenanceNum, JsonRequestBehavior.AllowGet);
}