Beispiel #1
0
        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            if (message.Name == "OpenTruckWeighter")
            {
                SelfVars.MainFrameForm.OpenTruckWeighter();
            }
            else if (message.Name == "OpenTruckMachinerySampler")
            {
                SelfVars.MainFrameForm.OpenTruckMachinerySampler();
            }
            else if (message.Name == "OpenAssayManage")
            {
                SelfVars.MainFrameForm.OpenAssayManage();
            }
            else if (message.Name == "CarSamplerChangeSelected")
            {
                SelfVars.CarSamplerForm.CurrentMachineCode = MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(message.Arguments.GetString(0));
            }
            else if (message.Name == "TruckWeighterChangeSelected")
            {
                SelfVars.TruckWeighterForm.CurrentMachineCode = MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(message.Arguments.GetString(0));
            }
            else if (message.Name == "ChangeSelected")
            {
                SelfVars.CurrentSelectedCell = message.Arguments.GetString(0);
            }
            else if (message.Name == "OpenHikVideo")
            {
                //视频预览
                SelfVars.MainFrameForm.OpenHikVideo(message.Arguments.GetString(0));
            }

            return(true);
        }
Beispiel #2
0
        protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
        {
            exception   = null;
            returnValue = null;
            CefProcessMessage cefMsg = null;

            switch (name)
            {
            // 道闸1升杆
            case "Gate1Up":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate1Up");
                break;

            // 道闸1降杆
            case "Gate1Down":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate1Down");
                break;

            // 道闸2升杆
            case "Gate2Up":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate2Up");
                break;

            // 道闸2降杆
            case "Gate2Down":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetTruckWeighterMachineCodeBySelected(arguments[0].GetStringValue()), "控制道闸", "Gate2Down");
                break;

            case "ChangeSelected":
                cefMsg = CefProcessMessage.Create("TruckWeighterChangeSelected");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            case "OpenHikVideo":
                cefMsg = CefProcessMessage.Create("OpenHikVideo");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                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 = arguments[0].GetStringValue();

            switch (name)
            {
            // 急停
            case "Stop":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "急停", "1");

                CefProcessMessage cefMsg1 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg1.Arguments.SetSize(0);
                cefMsg1.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "急停");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg1);
                break;

            // 车辆信息
            case "CarInfo":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 CarInfo");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 CarInfo");
                }
                break;

            // 故障复位
            case "ErrorReset":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 ErrorReset");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 ErrorReset");
                }
                break;

            // 采样历史记录
            case "SampleHistory":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 SampleHistory");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 SampleHistory");
                }
                break;

            //  打开制样机报警信息
            case "ErrorInfo":
                CefProcessMessage cefMsg = CefProcessMessage.Create("AutoMakerErrorInfo");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            //  历史故障
            case "FaultRecord":
                cefMsg = CefProcessMessage.Create("FaultRecord");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            // 故障复位
            case "FaultReset":
                commonDAO.SendAppRemoteControlCmd("#1全自动制样机", "故障复位", "1");

                CefProcessMessage cefMsg2 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg2.Arguments.SetSize(0);
                cefMsg2.Arguments.SetString(0, "设置#1全自动制样机故障复位");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg2);
                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 = arguments[0].GetStringValue();

            switch (name)
            {
            // 急停
            case "Stop":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "急停", "1");

                CefProcessMessage cefMsg1 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg1.Arguments.SetSize(0);
                cefMsg1.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "急停");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg1);
                break;

            // 复位
            case "Reset":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "急停", "0");

                CefProcessMessage cefMsg2 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg2.Arguments.SetSize(0);
                cefMsg2.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "急停复位");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg2);
                break;

            // 制样急停
            case "ZYStop":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "制样急停", "1");

                CefProcessMessage cefMsg3 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg3.Arguments.SetSize(0);
                cefMsg3.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "制样急停");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg3);
                break;

            // 制样复位
            case "ZYReset":
                commonDAO.SendAppRemoteControlCmd(MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()), "制样急停", "0");

                CefProcessMessage cefMsg4 = CefProcessMessage.Create("SaveOperationLog");
                cefMsg4.Arguments.SetSize(0);
                cefMsg4.Arguments.SetString(0, "设置" + MonitorCommon.GetInstance().GetCarSamplerMachineCodeBySelected(arguments[0].GetStringValue()) + "制样急停复位");
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg4);
                break;

            // 车辆信息
            case "CarInfo":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 CarInfo");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 CarInfo");
                }
                break;

            // 故障复位
            case "ErrorReset":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 ErrorReset");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 ErrorReset");
                }
                break;

            // 采样历史记录
            case "SampleHistory":
                if (paramSampler == "#1")
                {
                    MessageBox.Show("#1 SampleHistory");
                }
                else if (paramSampler == "#2")
                {
                    MessageBox.Show("#2 SampleHistory");
                }
                break;

            //获取异常信息
            case "GetHitchs":
                //异常信息
                string machineCode = string.Empty;
                if (paramSampler == "#1")
                {
                    machineCode = GlobalVars.MachineCode_QCJXCYJ_1;
                }
                else if (paramSampler == "#2")
                {
                    machineCode = GlobalVars.MachineCode_QCJXCYJ_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 "ChangeSelected":
                CefProcessMessage cefMsg = CefProcessMessage.Create("CarSamplerChangeSelected");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, paramSampler);
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            //  打开实时视频预览
            case "OpenHikVideo":
                cefMsg = CefProcessMessage.Create("OpenHikVideo");
                cefMsg.Arguments.SetSize(0);
                cefMsg.Arguments.SetString(0, arguments[0].GetStringValue());
                CefV8Context.GetCurrentContext().GetBrowser().SendProcessMessage(CefProcessId.Browser, cefMsg);
                break;

            default:
                returnValue = null;
                break;
            }

            return(true);
        }