一厂MES,含注塑,喷涂,冲孔
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

121 lines
3.4 KiB

2 months ago
using MESClassLibrary.BLL.Keep;
using MESClassLibrary.EFModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MESWebSite.HttpHandlers
{
/// <summary>
/// KeepPlanHandler 的摘要说明
/// </summary>
public class KeepPlanHandler : IHttpHandler
{
HttpRequest Request = null;
HttpResponse Response = null;
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
Request = context.Request;
Response = context.Response;
string method = Request.Params["method"];
switch (method)
{
case "QueryList":
QueryList();
break;
case "SaveInfo":
SaveInfo();
break;
case "DelInfo":
DelInfo();
break;
default:
break;
}
}
public bool IsReusable
{
get
{
return false;
}
}
void QueryList()
{
string page = Request.Params["page"];
string pagesize = Request.Params["rows"];
string StartTime = Request.Params["StartTime"];
string EndTime = Request.Params["EndTime"];
string DeviceID = Request.Params["DeviceID"];
string KeepLevelID = Request.Params["KeepLevelID"];
if (string.IsNullOrEmpty(page))
{
page = "0";
}
if (string.IsNullOrEmpty(pagesize))
{
pagesize = "15";
}
KeepPlanBLL bll = new KeepPlanBLL();
Response.Write(bll.SearchInfoAll(page, pagesize, DeviceID, KeepLevelID, StartTime + " 00:00:00", EndTime + " 23:59:59"));
Response.End();
}
void SaveInfo()
{
string ID = Request.Params["ID"];
string KeepLevelID = Request.Params["KeepLevelID"];
string KeepTime = Request.Params["KeepTime"];
string DeviceID = Request.Params["DeviceID"];
string Des = Request.Params["Des"];
KeepPlanBLL bll = new KeepPlanBLL();
tb_KeepPlan md = new tb_KeepPlan();
md.KeepLevelID = KeepLevelID;
md.KeepDay = Convert.ToDateTime(KeepTime);
md.DeviceID = DeviceID;
md.Des = Des;
if (ID == "0")
{
//新增
md.ID = Guid.NewGuid().ToString();
md.CreateTime = DateTime.Now;
md.UpdateTime = DateTime.Now;
Response.Write(bll.AddInfo(md) == true ? "true" : "false");
}
else
{
//修改
md.ID = ID;
md.UpdateTime = DateTime.Now;
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
}
Response.End();
}
void DelInfo()
{
string ID = Request.Params["ID"];
KeepPlanBLL bll = new KeepPlanBLL();
tb_KeepPlan md = new tb_KeepPlan();
md.ID = ID;
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
Response.End();
}
}
}