<%@ WebHandler Language="C#" Class="GetCheckBarCode_WCF" %> using System; using System.Web; using System.Web.SessionState; using System.Web.Configuration; using Newtonsoft.Json.Linq; using Curtain.DataAccess; using Curtain.Log; using DK.XuWei.WebMes; using System.Configuration; /// /// 从WCF接口获取 产品信息 /// xuwei 2019-10-26 /// public class GetCheckBarCode_WCF : IHttpHandler, IReadOnlySessionState { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; if(context.Request["procedureid"].ToString()!="") { WCF wcf = new WCF(); wcf.Para = wcf.LoadParaBySession(); wcf.Para.Add(new JProperty("barcode", context.Request["barcode"])); wcf.Para.Add(new JProperty("procedureID", context.Request["procedureid"])); string jsonStr = wcf.Post("/DKService/PDAModuleService/CheckBarcode"); if(jsonStr!="") { jsonStr = ("{'success':true,'message':'操作成功!','rows':" + jsonStr + "}").Replace("'","\""); //如果指定了自动重烧工序处理 bool ProductCheckAutoRefire = Convert.ToBoolean(ConfigurationManager.AppSettings["ProductCheckAutoRefire"]); string ProductCheckRefireProcedureId = ConfigurationManager.AppSettings["ProductCheckRefireProcedureId"].ToString(); //如果成检出错,并且配置自动重烧 //if ((jsonStr.IndexOf("不能到达该工序") > 0 ) && ProductCheckAutoRefire) //{ // //使用重烧节点进行成检 // wcf.Para["procedureID"] = ProductCheckRefireProcedureId; // string jsonStr2 = wcf.Post("/DKService/PDAModuleService/CheckBarcode"); // JArray jsonArray = JArray.Parse(jsonStr2); // if (jsonArray[0]["out_errMsg"].ToString() == "") // jsonStr = ("{'success':true,'message':'操作成功!','rows':" + jsonStr2 + "}").Replace("'", "\""); //} } else { jsonStr = ("{'success':false,'message':'操作失败!','rows':''}").Replace("'","\""); } context.Response.Write(jsonStr); } else { string jsonStr = ""; jsonStr = ("{'success':false,'message':'请指定成检工序的procedureID!','rows':''}").Replace("'","\""); context.Response.Write(jsonStr); } } public bool IsReusable { get { return false; } } }