123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- (function ($, learun) {
- "use strict";
- learun.SetDeviceMonitor = {
- SetDeviceData: function (data) {
- if (!isJsonObj(data)) return;
- if (data.AreasDevices) { }
- if (data.WCSStations && data.WCSStations.length > 0) { SetStation(data.WCSStations) }
- if (data.SRMStations && data.SRMStations.length > 0) { }
- if (data.WCSAGVs) { }
- if (data.WCSSRMs) { SetSRM(data.WCSSRMs) }
- },
- //Station: function (data) {
- //},
- //SRM: function (data) {
- //},
- };
- var isJsonObj = function (obj) {
- var isjson = typeof (obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length;
- return isjson;
- }
- function SetStation(data) {
- var stationlist = $("[wcsstation = 'wcsstation']");
- //stationlist.each(function () {
- // $(this).attr("wcsstation");
- //});
- for (var i = 0; i < stationlist.length; i++) {
- for (var j = 0; j < data.length; j++) {
- if (stationlist[i].id == data[j].Code) {
- if (data[j].FaultInfo && data[j].FaultInfo.length > 0) {
- $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhdred.png');
- }
- else if (data[j].IsAuto) {
- $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhdyellow.png');
- }
- else {
- $("#bj" + data[j].Code).attr("src", '/Content/images/DeviceMonitor/jhd.png');
- }
- if ($(stationlist[i]).attr('isweight')) {
- $("#station" + data[j].Code).attr("src", data[j].PH_STATUS ? '/Content/images/DeviceMonitor/ongoods.png'
- : '/Content/images/DeviceMonitor/on.png');
- }
- else {
- $("#station" + data[j].Code).attr("src", data[j].PH_STATUS ? '/Content/images/DeviceMonitor/stationgoods.png'
- : '/Content/images/DeviceMonitor/station.png');
- }
- break;
- }
- }
- }
- //data[i].BarCode
- //data[i].Code
- //data[i].FaultInfo
- //data[i].Frame
- //data[i].GoodsCode
- //data[i].GoodsEnd
- //data[i].GoodsStart
- //data[i].Info
- //data[i].IsAuto
- //data[i].PH_STATUS
- //data[i].Request
- //data[i].Status
- //data[i].TaskNum
- }
- function SetSRM(data) {
- var srmlist = $("[wcssrm = 'wcssrm']");
- for (var i = 0; i < srmlist.length; i++) {
- for (var j = 0; j < data.length; j++) {
- if ($(srmlist[i]).attr('name') == data[j].Code) {
- if (data[j].SCAlarm && data[j].SCAlarm.length > 0 && data[j].SCAlarm !='无') {
- $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddjred.png');
- }
- else if (data[j].IsAuto!=1) {
- $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddjyellow.png');
- }
- else {
- $(srmlist[i]).attr("src", '/Content/images/DeviceMonitor/ddj.png');
- }
- break;
- }
- //data[j].Code
- //data[j].FaultInfo
- //data[j].Frame
- //data[j].Info
- //data[j].IsAuto
- //data[j].No
- //data[j].TaskNum
- //data[j].TaskType
- }
- }
- }
- })(window.jQuery, top.learun);
|