<%@ WebHandler Language="C#" Class="AddCheckBarcode_WCF" %> using System.Web; using System.Web.SessionState; using System.Web.Configuration; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System.Collections; using Curtain.DataAccess; using Curtain.Log; using DK.XuWei.WebMes; /// /// 从WCF接口获取 成检保存 /// xuwei 2019-11-11 /// public class AddCheckBarcode_WCF : IHttpHandler, IReadOnlySessionState { public void ProcessRequest(HttpContext context) { //处理提交数据 if(context.Request["productionDataEntitys"] is object) { //提交到接口 WCF wcf = new WCF(); wcf.Para = wcf.LoadParaBySession(); wcf.Para.Add(new JProperty("procedureID", context.Request["procedureID"])); wcf.Para.Add(new JProperty("productionDataEntitys",JArray.Parse(context.Request["productionDataEntitys"]))); string jsonStr = wcf.Post("/DKService/PDAModuleService/AddCheckBarcode"); if(jsonStr != "") { //成检重复提交判断 2020-06-28 xuwei if(jsonStr == "重复提交") { jsonStr = ("{'success':false,'message':'重复提交!','rows':'" + jsonStr + "'}").Replace("'","\""); } else if(jsonStr.IndexOf("PLC写入失败") >=0 ) { jsonStr = ("{'success':false,'message':'PLC写入失败!','rows':'" + jsonStr + "'}").Replace("'","\""); } else { jsonStr = ("{'success':true,'message':'操作成功!','rows':'" + jsonStr + "'}").Replace("'","\""); } } else { jsonStr = ("{'success':false,'message':'操作失败!','rows':'" + jsonStr + "'}").Replace("'","\""); } context.Response.Write(jsonStr); } else { string jsonStr = ("{'success':false,'message':'操作失败!','rows':''}").Replace("'","\""); context.Response.Write(jsonStr); } } public bool IsReusable { get { return false; } } }