DeviceMonitorCommon.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. (function ($, learun) {
  2. "use strict";
  3. learun.SetDeviceMonitor = {
  4. SetDeviceData: function (data) {
  5. if (!isJsonObj(data)) return;
  6. if (data.AreasDevices) { }
  7. if (data.WCSStations && data.WCSStations.length > 0) { SetStation(data.WCSStations) }
  8. if (data.SRMStations && data.SRMStations.length > 0) { }
  9. if (data.WCSAGVs) { }
  10. if (data.WCSSRMs) { SetSRM(data.WCSSRMs) }
  11. },
  12. //Station: function (data) {
  13. //},
  14. //SRM: function (data) {
  15. //},
  16. };
  17. var isJsonObj = function (obj) {
  18. var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
  19. return isjson;
  20. }
  21. function SetStation(data) {
  22. var stationlist = $("[wcsstation = 'wcsstation']");
  23. //stationlist.each(function () {
  24. // $(this).attr("wcsstation");
  25. //});
  26. for (var i = 0; i < stationlist.length; i++) {
  27. for (var j = 0; j < data.length; j++) {
  28. if (stationlist[i].id == data[j].Code) {
  29. if (data[j].FaultInfo && data[j].FaultInfo.length > 0) {
  30. $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhdred.png');
  31. }
  32. else if (data[j].IsAuto) {
  33. $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhdyellow.png');
  34. }
  35. else {
  36. $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhd.png');
  37. }
  38. if ($(stationlist[i]).attr('isweight')) {
  39. $("#station" + data[j].Code).attr("src", data[j].PH_STATUS ? '/Content/images/DeviceMonitor/ongoods.png'
  40. : '/Content/images/DeviceMonitor/on.png');
  41. }
  42. else {
  43. $("#station" + data[j].Code).attr("src", data[j].PH_STATUS ? '/Content/images/DeviceMonitor/stationgoods.png'
  44. : '/Content/images/DeviceMonitor/station.png');
  45. }
  46. break;
  47. }
  48. }
  49. }
  50. //data[i].BarCode
  51. //data[i].Code
  52. //data[i].FaultInfo
  53. //data[i].Frame
  54. //data[i].GoodsCode
  55. //data[i].GoodsEnd
  56. //data[i].GoodsStart
  57. //data[i].Info
  58. //data[i].IsAuto
  59. //data[i].PH_STATUS
  60. //data[i].Request
  61. //data[i].Status
  62. //data[i].TaskNum
  63. }
  64. function SetSRM(data) {
  65. var srmlist = $("[wcssrm = 'wcssrm']");
  66. for (var i = 0; i < srmlist.length; i++) {
  67. for (var j = 0; j < data.length; j++) {
  68. if ($(srmlist[i]).attr('name') == data[j].Code) {
  69. if (data[j].SCAlarm && data[j].SCAlarm.length > 0 && data[j].SCAlarm !='无') {
  70. $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddjred.png');
  71. }
  72. else if (data[j].IsAuto!=1) {
  73. $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddjyellow.png');
  74. }
  75. else {
  76. $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddj.png');
  77. }
  78. break;
  79. }
  80. //data[j].Code
  81. //data[j].FaultInfo
  82. //data[j].Frame
  83. //data[j].Info
  84. //data[j].IsAuto
  85. //data[j].No
  86. //data[j].TaskNum
  87. //data[j].TaskType
  88. }
  89. }
  90. }
  91. })(window.jQuery, top.learun);