PorcelainWeight2.ashx 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <%@ WebHandler Language="C#" Class="mesPackingIndex" %>
  2. using System;
  3. using System.Web;
  4. using System.Data;
  5. using Curtain.DataAccess;
  6. using DK.XuWei.WebMes;
  7. /// <summary>
  8. /// 当日经过3#卸窑的光瓷重量
  9. /// xuwei 2020-08-20
  10. /// </summary>
  11. public class mesPackingIndex : IHttpHandler
  12. {
  13. public string procedureid = "";
  14. public string StartTime = "";
  15. public string EndTime = "";
  16. public void ProcessRequest(HttpContext context)
  17. {
  18. context.Response.ContentType = "text/plain";
  19. procedureid = context.Request["PROCEDUREID"] is object ? context.Request["PROCEDUREID"] : "";
  20. StartTime = context.Request["StartTime"] is object ? context.Request["StartTime"] : "";
  21. EndTime = context.Request["EndTime"] is object ? context.Request["EndTime"] : "";
  22. DataTable dt = new DataTable();
  23. using (IDataAccess conn = DataAccess.Create())
  24. {
  25. if (procedureid != "" && StartTime == "" && EndTime == "")
  26. {
  27. dt = conn.ExecuteDatatable(@"
  28. SELECT
  29. SUM( T.LUSTERWAREWEIGHT * T.count ) LUSTERWAREWEIGHT
  30. FROM
  31. (
  32. SELECT
  33. TPPD.GOODSCODE,
  34. TMG.LUSTERWAREWEIGHT,
  35. COUNT( * ) count
  36. FROM
  37. TP_PM_PRODUCTIONDATA TPPD
  38. LEFT JOIN TP_MST_GOODS TMG ON TPPD.GOODSID = TMG.GOODSID
  39. WHERE
  40. TPPD.PROCEDUREID = @PROCEDUREID@
  41. AND TPPD.CREATETIME >= trunc( SYSDATE )
  42. GROUP BY
  43. TPPD.GOODSCODE,
  44. TMG.LUSTERWAREWEIGHT
  45. ) T
  46. ",
  47. new CDAParameter("PROCEDUREID", procedureid)
  48. );
  49. var LUSTERWAREWEIGHT = dt.Rows[0]["LUSTERWAREWEIGHT"].ToString();
  50. context.Response.Write(new JsonResult(LUSTERWAREWEIGHT).ToJson());
  51. }
  52. else if (procedureid != "" && StartTime != "" && EndTime != "")
  53. {
  54. dt = conn.ExecuteDatatable(@"
  55. SELECT
  56. SUM( T.LUSTERWAREWEIGHT * T.count ) LUSTERWAREWEIGHT
  57. FROM
  58. (
  59. SELECT
  60. TPPD.GOODSCODE,
  61. TMG.LUSTERWAREWEIGHT,
  62. COUNT( * ) count
  63. FROM
  64. TP_PM_PRODUCTIONDATA TPPD
  65. LEFT JOIN TP_MST_GOODS TMG ON TPPD.GOODSID = TMG.GOODSID
  66. WHERE
  67. TPPD.PROCEDUREID = @PROCEDUREID@
  68. AND TPPD.CREATETIME >= TO_date(@StartTime@,'yy-mm-dd hh24:mi:ss')
  69. AND TPPD.CREATETIME <= TO_date(@EndTime@,'yy-mm-dd hh24:mi:ss')
  70. GROUP BY
  71. TPPD.GOODSCODE,
  72. TMG.LUSTERWAREWEIGHT
  73. ) T
  74. ",
  75. new CDAParameter("PROCEDUREID", procedureid),
  76. new CDAParameter("StartTime", StartTime+"00:00:00"),
  77. new CDAParameter("EndTime", EndTime+"23:59:59")
  78. );
  79. var LUSTERWAREWEIGHT = dt.Rows[0]["LUSTERWAREWEIGHT"].ToString();
  80. context.Response.Write(new JsonResult(LUSTERWAREWEIGHT).ToJson());
  81. }
  82. else {
  83. string meagss = "传入的参数不正确";
  84. context.Response.Write(new JsonResult(meagss).ToJson());
  85. }
  86. }
  87. }
  88. public bool IsReusable
  89. {
  90. get
  91. {
  92. return false;
  93. }
  94. }
  95. }