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

162 lines
4.6 KiB

using MESClassLibrary.BLL;
using MESClassLibrary.BLL.BasicInfo;
using MESClassLibrary.EFModel;
using MESWebSite.CommonClass;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MESWebSite.HttpHandlers
{
/// <summary>
/// Bom_MKHandler 的摘要说明
/// </summary>
public class Bom_MKHandler : 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 partNo1 = Request.Params["PartNo1"];
string partNo2 = Request.Params["PartNo2"];
string lineName = Request.Params["LineName"];
if (string.IsNullOrEmpty(page))
{
page = "0";
}
if (string.IsNullOrEmpty(pagesize))
{
pagesize = "15";
}
Bom_MKBLL bll = new Bom_MKBLL();
Response.Write(bll.SearchInfoAll(page, pagesize, partNo1, partNo2, lineName));
Response.End();
}
void SaveInfo()
{
string BomID = Request.Params["BomID"];
string PartNo1 = Request.Params["PartNo1"];
string PartNo2 = Request.Params["PartNo2"];
string IsChecked = Request.Params["IsChecked"];
string IsPartAssemble = Request.Params["IsPartAssemble"];
string StationNo = Request.Params["StationNo"];
string LineName = Request.Params["LineName"];
string stationNo = "";
BasicBLL<tb_Station> stationDB = new BasicBLL<tb_Station>();
var stationList = stationDB.Search<tb_Station>(p => p.StationNo == StationNo);
if (stationList != null && stationList.Count > 0)
{
stationNo = stationList[0].StationNo;
}
if (string.IsNullOrEmpty(stationNo))
{
Response.Write(ResponseResult.Fail("工位号不存在!"));
Response.End();
return;
}
Bom_MKBLL bll = new Bom_MKBLL();
tb_Bom_MK md = new tb_Bom_MK();
md.PartNo1 = PartNo1;
md.PartNo2 = PartNo2;
md.LineName = LineName;
md.StationNo = StationNo;
if(IsPartAssemble == "1")
{
md.IsPartAssemble = 1;
}
else
{
md.IsPartAssemble = 0;
}
if (IsChecked == "1")
{
md.IsChecked = true;
}
var info = Request.Cookies.Get("LoginUserInfo");
if (info != null)
{
md.UserID = info["UserID"].ToUpper();
}
if (BomID == "0")
{
//新增
//md.BomID = Guid.NewGuid().ToString();
Response.Write(bll.AddInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("添加失败"));
}
else
{
//修改
md.BomID = int.Parse(BomID);
Response.Write(bll.UpdateInfo(md) == true ? ResponseResult.Success() : ResponseResult.Fail("更新失败"));
}
Response.End();
}
void DelInfo()
{
string BomID = Request.Params["BomID"];
Bom_MKBLL bll = new Bom_MKBLL();
tb_Bom_MK md = new tb_Bom_MK();
md.BomID = int.Parse(BomID);
var info = Request.Cookies.Get("LoginUserInfo");
if (info != null)
{
md.UserID = info["UserID"].ToUpper();
}
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
Response.End();
}
}
}