using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// InjectionPlanHandler 的摘要说明 /// public class InjectionPlanHandler : 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 "QueryListALL": QueryListALL(); break; case "SaveInfo": SaveInfo(); break; case "SaveInfo2": SaveInfo2(); break; case "DelInfo": DelInfo(); break; case "GetEndTime": GetEndTime(); break; case "GetStartTime": GetStartTime(); break; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string stationID = Request.Params["StationID"]; string stockNo = Request.Params["StockNo"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } InjectionPlanBLL bll = new InjectionPlanBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, stationID, stockNo)); Response.End(); } void QueryListALL() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string stationID = Request.Params["StationID"]; string stockNo = Request.Params["StockNo"]; string StartTime = Request.Params["StartTime"]; string EndTime = Request.Params["EndTime"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } InjectionPlanBLL bll = new InjectionPlanBLL(); Response.Write(bll.SearchInfoAll2(page, pagesize, stationID, stockNo, StartTime, EndTime)); Response.End(); } void SaveInfo() { string InjectionPlanID = Request.Params["InjectionPlanID"]; string StationID = Request.Params["StationID"]; string BeginTime = Request.Params["BeginTime"]; string StockNo = Request.Params["StockNo"]; string PlanCount = Request.Params["PlanCount"]; string EndTime = Request.Params["EndTime"]; //string PlanDate = Request.Params["PlanDate"]; string RealCycle = Request.Params["RealCycle"]; string PartNo = Request.Params["PartNo"]; string workClass = Request.Params["workClass"]; string JK_Weight = Request.Params["JK_Weight"]; string Waste_Weight = Request.Params["Waste_Weight"]; InjectionPlanBLL bll = new InjectionPlanBLL(); tb_InjectionPlan md = new tb_InjectionPlan(); md.StationID = StationID; md.BeginTime = BeginTime; md.StockNo = StockNo; md.PartNo = PartNo; int PlanCount_ = 0; Int32.TryParse(PlanCount, out PlanCount_); md.PlanCount = PlanCount_; decimal RealCycle_ = 0; Decimal.TryParse(RealCycle, out RealCycle_); md.RealCycle = RealCycle_; md.EndTime = EndTime; //md.PlanDate = Convert.ToDateTime(PlanDate); 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_; if (InjectionPlanID == "0") { md.InjectionPlanID = Guid.NewGuid().ToString(); md.CompleteCount = 0; //新增 Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { md.InjectionPlanID = InjectionPlanID; //修改 Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void SaveInfo2() { string InjectionPlanID = Request.Params["InjectionPlanID"]; string workClass = Request.Params["workClass"]; string JK_Weight = Request.Params["JK_Weight"]; string Waste_Weight = Request.Params["Waste_Weight"]; InjectionPlanBLL bll = new InjectionPlanBLL(); tb_InjectionPlan md = new tb_InjectionPlan(); md.workClass = workClass; 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.InjectionPlanID = InjectionPlanID; //修改 Response.Write(bll.UpdateInfo2(md) == true ? "true" : "false"); Response.End(); } void DelInfo() { string InjectionPlanID = Request.Params["InjectionPlanID"]; InjectionPlanBLL bll = new InjectionPlanBLL(); tb_InjectionPlan md = new tb_InjectionPlan(); md.InjectionPlanID = InjectionPlanID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void GetEndTime() { string StationID = Request.Params["StationID"]; string BeginTime = Request.Params["BeginTime"]; string StockNo = Request.Params["StockNo"]; string PlanCount = Request.Params["PlanCount"]; InjectionPlanBLL bll = new InjectionPlanBLL(); tb_InjectionPlan md = new tb_InjectionPlan(); md.StationID = StationID; md.BeginTime = BeginTime; md.StockNo = StockNo; int PlanCount_ = 0; Int32.TryParse(PlanCount, out PlanCount_); md.PlanCount = PlanCount_; Response.Write(bll.GetEndTime(md)); Response.End(); } void GetStartTime() { string StationID = Request.Params["StationID"]; InjectionPlanBLL bll = new InjectionPlanBLL(); Response.Write(bll.GetStartTime(StationID)); Response.End(); } } }