一厂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.
 
 
 
 
 

133 lines
3.8 KiB

using MESClassLibrary.BLL.Injection;
using MESClassLibrary.EFModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MESWebSite.HttpHandlers
{
/// <summary>
/// InjectionRecordHandler 的摘要说明
/// </summary>
public class InjectionRecordHandler : 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 stationID = Request.Params["StationID"];
if (string.IsNullOrEmpty(page))
{
page = "0";
}
if (string.IsNullOrEmpty(pagesize))
{
pagesize = "15";
}
InjectionRecordBLL bll = new InjectionRecordBLL();
Response.Write(bll.SearchInfoAll(page, pagesize, StartTime, EndTime, stationID));
Response.End();
}
void SaveInfo()
{
string ID = Request.Params["ID"];
string StationID = Request.Params["StationID"];
string workClass = Request.Params["workClass"];
string JK_Weight = Request.Params["JK_Weight"];
string Waste_Weight = Request.Params["Waste_Weight"];
string RecordDate = Request.Params["RecordDate"];
string StockNo = Request.Params["StockNo"];
string PartNo = Request.Params["PartNo"];
InjectionRecordBLL bll = new InjectionRecordBLL();
tb_Injection_Record md = new tb_Injection_Record();
md.StationID = StationID;
md.workClass = workClass;
md.JK_Weight = Convert.ToInt32(JK_Weight);
int JK_Weight_ = 0;
Int32.TryParse(JK_Weight, out JK_Weight_);
md.JK_Weight = JK_Weight_;
int Waste_Weight_ = 0;
Int32.TryParse(Waste_Weight, out Waste_Weight_);
md.Waste_Weight = Waste_Weight_;
md.RecordDate = Convert.ToDateTime(RecordDate);
md.StockNo = StockNo;
md.PartNo = PartNo;
if (ID == "0")
{
md.ID = Guid.NewGuid().ToString();
//新增
Response.Write(bll.AddInfo(md) == true ? "true" : "false");
}
else
{
md.ID = ID;
//修改
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
}
Response.End();
}
void DelInfo()
{
string ID = Request.Params["ID"];
InjectionRecordBLL bll = new InjectionRecordBLL();
tb_Injection_Record md = new tb_Injection_Record();
md.ID = ID;
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
Response.End();
}
}
}