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.
290 lines
8.8 KiB
290 lines
8.8 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using MESClassLibrary.BLL.BasicInfo;
|
|
using MESClassLibrary.BLL.PunchAndWeld;
|
|
using MESClassLibrary.EFModel;
|
|
|
|
namespace MESWebSite.HttpHandlers
|
|
{
|
|
/// <summary>
|
|
/// PunchBomHandler 的摘要说明
|
|
/// </summary>
|
|
public class PunchBomHandler : 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 SaveInfo()
|
|
{
|
|
string BomID = Request.Params["BomID"];
|
|
string PartNo1 = Request.Params["PartNo1"];
|
|
string PartNo2 = Request.Params["PartNo2"];
|
|
string StationNo = Request.Params["StationNo"];
|
|
string PartNo3 = Request.Params["PartNo3"];
|
|
string PartNo4 = Request.Params["PartNo4"];
|
|
string PartNo5 = Request.Params["PartNo5"];
|
|
string PartNo6 = Request.Params["PartNo6"];
|
|
string PartNo7 = Request.Params["PartNo7"];
|
|
string PartNo8 = Request.Params["PartNo8"];
|
|
|
|
string partNo9 = Request.Params["partNo9"];
|
|
string partNo10 = Request.Params["partNo10"];
|
|
string partNo11 = Request.Params["partNo11"];
|
|
string partNo12 = Request.Params["partNo12"];
|
|
string partNo13 = Request.Params["partNo13"];
|
|
string partNo14 = Request.Params["partNo14"];
|
|
|
|
string IsCheck = Request.Params["IsCheck"];
|
|
string AddressNo = Request.Params["AddressNo"];
|
|
string PortName = Request.Params["PortName"];
|
|
|
|
PunchAndStationBLL bll = new PunchAndStationBLL();
|
|
StationBLL sbll=new StationBLL();
|
|
ProductBLL pbll=new ProductBLL();
|
|
tb_PunchAndStation md = new tb_PunchAndStation();
|
|
|
|
//md.StationID = StationNo;
|
|
|
|
DataTable dt1 = pbll.SearchInfoByPartNo(PartNo1);
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
{
|
|
md.ProductID1 = dt1.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID1 = "";
|
|
}
|
|
|
|
DataTable dt2 = pbll.SearchInfoByPartNo(PartNo2);
|
|
if (dt2 != null && dt2.Rows.Count > 0)
|
|
{
|
|
md.ProductID2 = dt2.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID2 = "";
|
|
}
|
|
|
|
DataTable dt3 = pbll.SearchInfoByPartNo(PartNo3);
|
|
if (dt3 != null && dt3.Rows.Count > 0)
|
|
{
|
|
md.ProductID3 = dt3.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID3 = "";
|
|
}
|
|
|
|
DataTable dt4 = pbll.SearchInfoByPartNo(PartNo4);
|
|
if (dt4 != null && dt4.Rows.Count > 0)
|
|
{
|
|
md.ProductID4 = dt4.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID4 = "";
|
|
}
|
|
|
|
DataTable dt5 = pbll.SearchInfoByPartNo(PartNo5);
|
|
if (dt5 != null && dt5.Rows.Count > 0)
|
|
{
|
|
md.ProductID5 = dt5.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID5 = "";
|
|
}
|
|
|
|
DataTable dt6 = pbll.SearchInfoByPartNo(PartNo6);
|
|
if (dt6 != null && dt6.Rows.Count > 0)
|
|
{
|
|
md.ProductID6 = dt6.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID6 = "";
|
|
}
|
|
DataTable dt7 = pbll.SearchInfoByPartNo(PartNo7);
|
|
if (dt7 != null && dt7.Rows.Count > 0)
|
|
{
|
|
md.ProductID7 = dt7.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID7 = "";
|
|
}
|
|
DataTable dt8 = pbll.SearchInfoByPartNo(PartNo8);
|
|
if (dt8 != null && dt8.Rows.Count > 0)
|
|
{
|
|
md.ProductID8 = dt8.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID8 = "";
|
|
}
|
|
|
|
DataTable dt9 = pbll.SearchInfoByPartNo(partNo9);
|
|
if (dt9 != null && dt9.Rows.Count > 0)
|
|
{
|
|
md.ProductID9 = dt9.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID9 = "";
|
|
}
|
|
DataTable dt10 = pbll.SearchInfoByPartNo(partNo10);
|
|
if (dt10 != null && dt10.Rows.Count > 0)
|
|
{
|
|
md.ProductID10 = dt10.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID10 = "";
|
|
}
|
|
DataTable dt11 = pbll.SearchInfoByPartNo(partNo11);
|
|
if (dt11 != null && dt11.Rows.Count > 0)
|
|
{
|
|
md.ProductID11 = dt11.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID11 = "";
|
|
}
|
|
DataTable dt12 = pbll.SearchInfoByPartNo(partNo12);
|
|
if (dt12 != null && dt12.Rows.Count > 0)
|
|
{
|
|
md.ProductID12 = dt12.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID12 = "";
|
|
}
|
|
DataTable dt13 = pbll.SearchInfoByPartNo(partNo13);
|
|
if (dt13 != null && dt13.Rows.Count > 0)
|
|
{
|
|
md.ProductID13 = dt13.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID13 = "";
|
|
}
|
|
DataTable dt14 = pbll.SearchInfoByPartNo(partNo14);
|
|
if (dt14 != null && dt14.Rows.Count > 0)
|
|
{
|
|
md.ProductID14 = dt14.Rows[0]["ProductID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
md.ProductID14 = "";
|
|
}
|
|
|
|
if (BomID == "0")
|
|
{
|
|
//新增
|
|
md.ID = Guid.NewGuid().ToString();
|
|
md.CreateTine=DateTime.Now;
|
|
md.IsCheck = int.Parse(IsCheck);
|
|
md.StationID = StationNo;
|
|
md.AddressNo = int.Parse(AddressNo);
|
|
md.PortName = PortName;
|
|
if (IsCheck == "1")
|
|
{
|
|
md.CheckDone = 0;
|
|
}
|
|
Response.Write(bll.AddInfo(md) ? "true" : "false");
|
|
}
|
|
else
|
|
{
|
|
//修改
|
|
md.ID = BomID;
|
|
md.IsCheck = int.Parse(IsCheck);
|
|
md.AddressNo = int.Parse(AddressNo);
|
|
md.PortName = PortName;
|
|
md.StationID = StationNo;
|
|
//DataTable dt = sbll.SearchInfoByNo(StationNo);
|
|
//if (dt != null && dt.Rows.Count > 0)
|
|
//{
|
|
// md.StationID = dt.Rows[0]["StationID"].ToString();
|
|
//}
|
|
//else
|
|
//{
|
|
// md.StationID = "";
|
|
//}
|
|
if (IsCheck == "1")
|
|
{
|
|
md.CheckDone = 0;
|
|
}
|
|
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
|
|
}
|
|
Response.End();
|
|
}
|
|
|
|
void QueryList()
|
|
{
|
|
string page = Request.Params["page"];
|
|
string pagesize = Request.Params["rows"];
|
|
string partNo1 = Request.Params["PartNo1"];
|
|
|
|
if (string.IsNullOrEmpty(page))
|
|
{
|
|
page = "0";
|
|
}
|
|
if (string.IsNullOrEmpty(pagesize))
|
|
{
|
|
pagesize = "15";
|
|
}
|
|
PunchAndStationBLL bll = new PunchAndStationBLL();
|
|
Response.Write(bll.SearchInfoAll(page, pagesize, partNo1));
|
|
Response.End();
|
|
}
|
|
|
|
void DelInfo()
|
|
{
|
|
string BomID = Request.Params["BomID"];
|
|
|
|
PunchAndStationBLL bll = new PunchAndStationBLL();
|
|
tb_PunchAndStation md = new tb_PunchAndStation();
|
|
md.ID = BomID;
|
|
Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
|
|
Response.End();
|
|
|
|
}
|
|
}
|
|
}
|