protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception) { exception = null; returnValue = null; string paramSampler = arguments[0].GetStringValue(); switch (name) { //获取异常信息 case "GetHitchs": //异常信息 string machineCode = string.Empty; if (paramSampler == "#1") { machineCode = GlobalVars.MachineCode_QZDZYJ_1; } else if (paramSampler == "#2") { machineCode = GlobalVars.MachineCode_QZDZYJ_2; } equInfHitchs = CommonDAO.GetInstance().GetEquInfHitchsByTime(machineCode, DateTime.Now); returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(equInfHitchs.Select(a => new { MachineCode = a.MachineCode, HitchTime = a.HitchTime.ToString("yyyy-MM-dd HH:mm"), HitchDescribe = a.HitchDescribe }))); break; case "OpenAutoMaker": CefProcessMessage OpenAutoMaker = CefProcessMessage.Create("OpenAutoMaker"); int f = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenAutoMaker.Arguments.SetValue(f, model); f++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenAutoMaker); break; default: returnValue = null; break; } return(true); }
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception) { exception = null; returnValue = null; string paramSampler = string.Empty; string paramSampler1 = string.Empty; string paramSampler2 = string.Empty; if (arguments.Length > 0) { paramSampler = arguments[0].GetStringValue(); paramSampler1 = arguments.Length > 1 ? arguments[1].GetStringValue() : ""; paramSampler2 = arguments.Length > 2 ? arguments[2].GetStringValue() : ""; } switch (name) { // 打开皮带采样机监控界面 case "OpenTrainBeltSampler": CefProcessMessage OpenTrainBeltSampler = CefProcessMessage.Create("OpenTrainBeltSampler"); int b = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenTrainBeltSampler.Arguments.SetValue(b, model); b++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenTrainBeltSampler); break; // 打开皮带采样机监控界面 case "OpenOutTrainBeltSampler": CefProcessMessage OpenOutBeltSampler = CefProcessMessage.Create("OpenOutTrainBeltSampler"); int c = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenOutBeltSampler.Arguments.SetValue(c, model); c++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenOutBeltSampler); break; // 打开火车机械采样机监控界面 case "OpenTrainMachinerySampler": // CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTrainMachinerySampler")); break; // 打开全自动制样机监控 case "OpenAutoMaker": CefProcessMessage OpenAutoMaker = CefProcessMessage.Create("OpenAutoMaker"); int f = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenAutoMaker.Arguments.SetValue(f, model); f++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenAutoMaker); break; // 打开火车入厂翻车机监控 case "OpenTrainTipper": CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTrainTipper")); break; // 打开火车入厂记录查询 case "OpenWeightBridgeLoadToday": CefProcessMessage OpenWeightBridgeLoadToday = CefProcessMessage.Create("OpenWeightBridgeLoadToday"); int d = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenWeightBridgeLoadToday.Arguments.SetValue(d, model); d++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenWeightBridgeLoadToday); break; // 打开汽车入厂重车衡监控 case "OpenTruckWeighter": CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTruckWeighter")); break; // 打开汽车成品仓监控 case "OpenTruckOrder": CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenTruckOrder")); break; // 打开汽车机械采样机监控 case "OpenTruckMachinerySampler": CefProcessMessage SamplerMessage = CefProcessMessage.Create("OpenTruckMachinerySampler"); int a = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); SamplerMessage.Arguments.SetValue(a, model); a++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, SamplerMessage); break; // 打开智能存样柜与气动传输监控 case "OpenAutoCupboard": CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenAutoCupboardPneumaticTransfer")); break; // 打开化验室监控 case "OpenLaboratory": CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, CefProcessMessage.Create("OpenAssayManage")); break; case "OpenCarMonitor": CefProcessMessage OpenCarMonitor = CefProcessMessage.Create("OpenCarMonitor"); int e = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); OpenCarMonitor.Arguments.SetValue(e, model); e++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, OpenCarMonitor); break; case "OpenPoundInfo": CefProcessMessage message = CefProcessMessage.Create("OpenPoundInfo"); int i = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); message.Arguments.SetValue(i, model); i++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, message); break; case "GetHitchs": List <HitchsEntityTemp> Hitchslist = GetHitchsData(paramSampler); exception = null; returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(Hitchslist)); break; // 成品仓信息 case "getStorageInfo": List <StorageEntityTemp> list = getStorageInfoData(paramSampler); exception = null; returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(list)); break; // 成品仓信息 case "getStorageAreaInfo": string sql = string.Format(@"select a.fuelstorageid,a.startpoint,a.endpoint from stgtbfuelstoragearea a where a.AREANAME = '{0}'", paramSampler); DataTable dt = CommonDAO.GetInstance().SelfDber.ExecuteDataTable(sql); if (dt != null && dt.Rows.Count > 0) { STGSelectStorageData StorageArea = GetStorageData(dt.Rows[0]["fuelstorageid"].ToString(), dt.Rows[0]["startpoint"].ToString(), dt.Rows[0]["endpoint"].ToString()); exception = null; string sql1 = string.Format(@"select a.pointx,a.pointy,a.unitname,a.TEMPERATURE,a.polecode from stgtbstoragetemperature a where a.unitname = '{0}'", paramSampler); DataTable dt1 = CommonDAO.GetInstance().SelfDber.ExecuteDataTable(sql1); if (dt1 != null && dt1.Rows.Count > 0) { foreach (DataRow dr in dt1.Rows) { StorageArea.TEMPERATURE += dr["polecode"].ToString() + "," + dr["TEMPERATURE"].ToString() + "|"; } } List <STGSelectStorageData> StorageDataList = new List <STGSelectStorageData>(); StorageDataList.Add(StorageArea); returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(StorageDataList)); } break; case "getStorageStackInfo": STGSelectStorageData StorageArea1 = GetStorageData(paramSampler, paramSampler1, paramSampler2); exception = null; List <STGSelectStorageData> StorageDataList1 = new List <STGSelectStorageData>(); StorageDataList1.Add(StorageArea1); returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(StorageDataList1)); break; case "GetStorageBox": List <StorageBoxTemp> Boxlist = GetStorageBoxData(); exception = null; returnValue = CefV8Value.CreateString(Newtonsoft.Json.JsonConvert.SerializeObject(Boxlist)); break; case "OpenInOutInfo": CefProcessMessage messageDoorInfo = CefProcessMessage.Create("OpenInOutInfo"); int j = 0; foreach (CefV8Value item in arguments) { CefValue model = CefValue.Create(); model.SetString(item.GetStringValue()); messageDoorInfo.Arguments.SetValue(j, model); j++; } CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, messageDoorInfo); break; default: returnValue = null; break; } return(true); }