GetCheckBarCode_WCF.ashx 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <%@ WebHandler Language="C#" Class="GetCheckBarCode_WCF" %>
  2. using System;
  3. using System.Web;
  4. using System.Web.SessionState;
  5. using System.Web.Configuration;
  6. using Newtonsoft.Json.Linq;
  7. using Curtain.DataAccess;
  8. using Curtain.Log;
  9. using DK.XuWei.WebMes;
  10. using System.Configuration;
  11. /// <summary>
  12. /// 从WCF接口获取 产品信息
  13. /// xuwei 2019-10-26
  14. /// </summary>
  15. public class GetCheckBarCode_WCF : IHttpHandler, IReadOnlySessionState
  16. {
  17. public void ProcessRequest(HttpContext context)
  18. {
  19. context.Response.ContentType = "text/plain";
  20. if(context.Request["procedureid"].ToString()!="")
  21. {
  22. WCF wcf = new WCF();
  23. wcf.Para = wcf.LoadParaBySession();
  24. wcf.Para.Add(new JProperty("barcode", context.Request["barcode"]));
  25. wcf.Para.Add(new JProperty("procedureID", context.Request["procedureid"]));
  26. string jsonStr = wcf.Post("/DKService/PDAModuleService/CheckBarcode");
  27. if(jsonStr!="")
  28. {
  29. jsonStr = ("{'success':true,'message':'操作成功!','rows':" + jsonStr + "}").Replace("'","\"");
  30. //如果指定了自动重烧工序处理
  31. bool ProductCheckAutoRefire = Convert.ToBoolean(ConfigurationManager.AppSettings["ProductCheckAutoRefire"]);
  32. string ProductCheckRefireProcedureId = ConfigurationManager.AppSettings["ProductCheckRefireProcedureId"].ToString();
  33. //如果成检出错,并且配置自动重烧
  34. //if ((jsonStr.IndexOf("不能到达该工序") > 0 ) && ProductCheckAutoRefire)
  35. //{
  36. // //使用重烧节点进行成检
  37. // wcf.Para["procedureID"] = ProductCheckRefireProcedureId;
  38. // string jsonStr2 = wcf.Post("/DKService/PDAModuleService/CheckBarcode");
  39. // JArray jsonArray = JArray.Parse(jsonStr2);
  40. // if (jsonArray[0]["out_errMsg"].ToString() == "")
  41. // jsonStr = ("{'success':true,'message':'操作成功!','rows':" + jsonStr2 + "}").Replace("'", "\"");
  42. //}
  43. }
  44. else
  45. {
  46. jsonStr = ("{'success':false,'message':'操作失败!','rows':''}").Replace("'","\"");
  47. }
  48. context.Response.Write(jsonStr);
  49. }
  50. else
  51. {
  52. string jsonStr = "";
  53. jsonStr = ("{'success':false,'message':'请指定成检工序的procedureID!','rows':''}").Replace("'","\"");
  54. context.Response.Write(jsonStr);
  55. }
  56. }
  57. public bool IsReusable
  58. {
  59. get
  60. {
  61. return false;
  62. }
  63. }
  64. }