GetProductionData_WCF.ashx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <%@ WebHandler Language="C#" Class="GetProductionData_WCF" %>
  2. using System.Web;
  3. using System.Web.SessionState;
  4. using System.Web.Configuration;
  5. using Newtonsoft.Json.Linq;
  6. using Curtain.DataAccess;
  7. using Curtain.Log;
  8. using DK.XuWei.WebMes;
  9. /// <summary>
  10. /// 从WCF接口获取 产品信息
  11. /// xuwei 2019-10-26
  12. /// </summary>
  13. public class GetProductionData_WCF : IHttpHandler, IReadOnlySessionState
  14. {
  15. public void ProcessRequest(HttpContext context)
  16. {
  17. context.Response.ContentType = "text/plain";
  18. if(context.Request["BarCode"].ToString()!="")
  19. {
  20. WCF wcf = new WCF();
  21. wcf.Para = wcf.LoadParaBySession();
  22. wcf.Para.Add(new JProperty("BarCode", context.Request["BarCode"]));
  23. wcf.Para.Add(new JProperty("ProcedureID", context.Request["ProcedureID"]));
  24. //wcf.Para.Add(new JProperty("userCode", context.Request["userCode"]));
  25. string jsonStr = wcf.Post("/DKService/PDAModuleService/GetProductionData");
  26. //2020-04-20 冷补后 jsonStr = "" 找不到 productiondataid
  27. if (jsonStr == "") jsonStr = "\"\"";
  28. jsonStr = ("{'success':true,'message':'操作成功!','rows':" + jsonStr + "}").Replace("'","\"");
  29. context.Response.Write(jsonStr);
  30. }
  31. else
  32. {
  33. string jsonStr = "";
  34. jsonStr = ("{'success':false,'message':'请指定BarCode、ProcedureID、userCode!','rows':''}").Replace("'","\"");
  35. context.Response.Write(jsonStr);
  36. }
  37. }
  38. public bool IsReusable
  39. {
  40. get
  41. {
  42. return false;
  43. }
  44. }
  45. }