Led.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using DK.XuWei.WebMes;
  6. using Curtain.DataAccess;
  7. using Curtain.Log;
  8. using System.Data;
  9. /// <summary>
  10. /// 发送LED看板数据到PLC xuwei add 2023-05-12
  11. /// </summary>
  12. public static class Led
  13. {
  14. public static void SendData()
  15. {
  16. //读取看板数据
  17. using (IDataAccess conn = DataAccess.Create())
  18. {
  19. DataTable dt = conn.ExecuteDatatable(@"
  20. SELECT
  21. *
  22. FROM
  23. TP_MST_USER
  24. WHERE
  25. VALUEFLAG = '1'
  26. AND USERID = @USERID@
  27. ",
  28. new CDAParameter("USERID", "")
  29. );
  30. }
  31. Logger.Debug("读取看板数据完成!");
  32. //发送数据到LED
  33. SiemensS7.Open("172.19.2.71", 102);
  34. SiemensS7.Write<short>("5.0", (Int16)99);//包装总量
  35. SiemensS7.Write<short>("5.2", (Int16)99);//一线包装产量
  36. SiemensS7.Write<short>("5.4", (Int16)99);//二线包装产量
  37. SiemensS7.Write<short>("5.6", (Int16)99);//一线7:30-9:00产量
  38. SiemensS7.Write<short>("5.8", (Int16)99);//一线9:00-10:00产量
  39. SiemensS7.Write<short>("5.10", (Int16)99);//一线10:00-11:00产量
  40. SiemensS7.Write<short>("5.12", (Int16)99);//一线12:00-14:00产量
  41. SiemensS7.Write<short>("5.14", (Int16)99);//一线14:00-15:00产量
  42. SiemensS7.Write<short>("5.16", (Int16)99);//一线15:00-16:00产量
  43. SiemensS7.Write<short>("5.18", (Int16)99);//一线16:00-17:00产量
  44. SiemensS7.Write<short>("5.20", (Int16)99);//一线17:00-18:00产量
  45. SiemensS7.Write<short>("5.22", (Int16)99);//二线7:30-9:00产量
  46. SiemensS7.Write<short>("5.24", (Int16)99);//二线9:00-10:00产量
  47. SiemensS7.Write<short>("5.26", (Int16)99);//二线10:00-11:00产量
  48. SiemensS7.Write<short>("5.28", (Int16)99);//二线12:00-14:00产量
  49. SiemensS7.Write<short>("5.30", (Int16)99);//二线14:00-15:00产量
  50. SiemensS7.Write<short>("5.32", (Int16)99);//二线15:00-16:00产量
  51. SiemensS7.Write<short>("5.34", (Int16)99);//二线16:00-17:00产量
  52. SiemensS7.Write<short>("5.36", (Int16)99);//二线17:00-18:00产量
  53. SiemensS7.Close();
  54. Logger.Debug("发送LED数据完成!");
  55. }
  56. }