AddCheckBarcode_WCF.ashx 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <%@ WebHandler Language="C#" Class="AddCheckBarcode_WCF" %>
  2. using System.Web;
  3. using System.Web.SessionState;
  4. using System.Web.Configuration;
  5. using Newtonsoft.Json;
  6. using Newtonsoft.Json.Linq;
  7. using System.Collections;
  8. using Curtain.DataAccess;
  9. using Curtain.Log;
  10. using DK.XuWei.WebMes;
  11. /// <summary>
  12. /// 从WCF接口获取 成检保存
  13. /// xuwei 2019-11-11
  14. /// </summary>
  15. public class AddCheckBarcode_WCF : IHttpHandler, IReadOnlySessionState
  16. {
  17. public void ProcessRequest(HttpContext context)
  18. {
  19. //处理提交数据
  20. if(context.Request["productionDataEntitys"] is object)
  21. {
  22. //提交到接口
  23. WCF wcf = new WCF();
  24. wcf.Para = wcf.LoadParaBySession();
  25. wcf.Para.Add(new JProperty("procedureID", context.Request["procedureID"]));
  26. wcf.Para.Add(new JProperty("productionDataEntitys",JArray.Parse(context.Request["productionDataEntitys"])));
  27. string jsonStr = wcf.Post("/DKService/PDAModuleService/AddCheckBarcode");
  28. if(jsonStr != "")
  29. {
  30. //成检重复提交判断 2020-06-28 xuwei
  31. if(jsonStr == "重复提交")
  32. {
  33. jsonStr = ("{'success':false,'message':'重复提交!','rows':'" + jsonStr + "'}").Replace("'","\"");
  34. }
  35. else if(jsonStr.IndexOf("PLC写入失败") >=0 )
  36. {
  37. jsonStr = ("{'success':false,'message':'PLC写入失败!','rows':'" + jsonStr + "'}").Replace("'","\"");
  38. }
  39. else
  40. {
  41. jsonStr = ("{'success':true,'message':'操作成功!','rows':'" + jsonStr + "'}").Replace("'","\"");
  42. }
  43. }
  44. else
  45. {
  46. jsonStr = ("{'success':false,'message':'操作失败!','rows':'" + jsonStr + "'}").Replace("'","\"");
  47. }
  48. context.Response.Write(jsonStr);
  49. }
  50. else
  51. {
  52. string jsonStr = ("{'success':false,'message':'操作失败!','rows':''}").Replace("'","\"");
  53. context.Response.Write(jsonStr);
  54. }
  55. }
  56. public bool IsReusable
  57. {
  58. get
  59. {
  60. return false;
  61. }
  62. }
  63. }