Exemple #1
0
        /// <summary>
        /// 执行控制命令
        /// </summary>
        /// <param name="output"></param>
        public void RunCmd(Action <string, eOutputType> output)
        {
            CmcsAppRemoteControlCmd appRemoteControlCmd = commonDAO.GetNewestAppRemoteControlCmd(GlobalVars.MachineCode_HYGPJ_1);

            if (appRemoteControlCmd != null)
            {
                if (appRemoteControlCmd.CmdCode == "卸车刷卡")
                {
                    output("接收远程命令:" + appRemoteControlCmd.CmdCode + ",参数:" + appRemoteControlCmd.Param, eOutputType.Normal);
                    Dictionary <string, object> cmd = new Dictionary <string, object>();
                    cmd.Add("送样小车.卸车端." + "卸车刷卡", true);
                    if (opcServere.WriteOPCItemValue(cmd))
                    {
                        // 更新执行结果
                        commonDAO.SetAppRemoteControlCmdResultCode(appRemoteControlCmd, eEquInfCmdResultCode.成功);
                        commonDAO.SaveSysMessage(appRemoteControlCmd.AppIdentifier + "卸车刷卡", appRemoteControlCmd.AppIdentifier + "卸车刷卡执行成功");
                    }
                }
                else if (appRemoteControlCmd.CmdCode == "装车刷卡")
                {
                    output("接收远程命令:" + appRemoteControlCmd.CmdCode + ",参数:" + appRemoteControlCmd.Param, eOutputType.Normal);
                    Dictionary <string, object> cmd = new Dictionary <string, object>();
                    cmd.Add("送样小车.卸车端." + "装车刷卡", true);
                    if (opcServere.WriteOPCItemValue(cmd))
                    {
                        // 更新执行结果
                        commonDAO.SetAppRemoteControlCmdResultCode(appRemoteControlCmd, eEquInfCmdResultCode.成功);
                        commonDAO.SaveSysMessage(appRemoteControlCmd.AppIdentifier + "装车刷卡", appRemoteControlCmd.AppIdentifier + "装车刷卡执行成功");
                    }
                }
            }
        }
        /// <summary>
        /// 执行远程命令
        /// </summary>
        void ExecAppRemoteControlCmd()
        {
            // 获取最新的命令
            CmcsAppRemoteControlCmd appRemoteControlCmd = commonDAO.GetNewestAppRemoteControlCmd(CommonAppConfig.GetInstance().AppIdentifier);

            if (appRemoteControlCmd != null)
            {
                if (appRemoteControlCmd.CmdCode == "控制道闸")
                {
                    Log4Neter.Info("接收远程命令:" + appRemoteControlCmd.CmdCode + ",参数:" + appRemoteControlCmd.Param);

                    if (appRemoteControlCmd.Param.Equals("Gate1Up", StringComparison.CurrentCultureIgnoreCase))
                    {
                        this.iocControler.Gate1Up();
                    }
                    else if (appRemoteControlCmd.Param.Equals("Gate1Down", StringComparison.CurrentCultureIgnoreCase))
                    {
                        this.iocControler.Gate1Down();
                    }
                    else if (appRemoteControlCmd.Param.Equals("Gate2Up", StringComparison.CurrentCultureIgnoreCase))
                    {
                        this.iocControler.Gate2Up();
                    }
                    else if (appRemoteControlCmd.Param.Equals("Gate2Down", StringComparison.CurrentCultureIgnoreCase))
                    {
                        this.iocControler.Gate2Down();
                    }

                    // 更新执行结果
                    commonDAO.SetAppRemoteControlCmdResultCode(appRemoteControlCmd, eEquInfCmdResultCode.成功);
                }
            }
        }
        /// <summary>
        /// 采样机1执行控制命令
        /// </summary>
        /// <param name="output"></param>
        public void RunCmd1(Action <string, eOutputType> output)
        {
            CmcsAppRemoteControlCmd appRemoteControlCmd = commonDAO.GetNewestAppRemoteControlCmd(GlobalVars.MachineCode_QCJXCYJ_1);

            if (appRemoteControlCmd != null)
            {
                if (appRemoteControlCmd.CmdCode == "急停")
                {
                    output("接收远程命令:" + appRemoteControlCmd.CmdCode + ",参数:" + appRemoteControlCmd.Param, eOutputType.Normal);
                    Dictionary <string, object> cmd = new Dictionary <string, object>();
                    cmd.Add("汽车机械采样机.#1采样机." + "急停/复位", appRemoteControlCmd.Param == "1" ? true : false);
                    if (opcServere.WriteOPCItemValue(cmd))
                    {
                        // 更新执行结果
                        commonDAO.SetAppRemoteControlCmdResultCode(appRemoteControlCmd, eEquInfCmdResultCode.成功);
                        commonDAO.SaveSysMessage(appRemoteControlCmd.AppIdentifier + "急停/复位", appRemoteControlCmd.AppIdentifier + appRemoteControlCmd.Param == "1"? "急停执行成功" : "复位执行成功");
                    }
                }
                else if (appRemoteControlCmd.CmdCode == "制样急停")
                {
                    output("接收远程命令:" + appRemoteControlCmd.CmdCode + ",参数:" + appRemoteControlCmd.Param, eOutputType.Normal);
                    Dictionary <string, object> cmd = new Dictionary <string, object>();
                    cmd.Add("汽车机械采样机.#1采样机." + "启动/停止", appRemoteControlCmd.Param == "1" ? true : false);
                    if (opcServere.WriteOPCItemValue(cmd))
                    {
                        // 更新执行结果
                        commonDAO.SetAppRemoteControlCmdResultCode(appRemoteControlCmd, eEquInfCmdResultCode.成功);
                        commonDAO.SaveSysMessage(appRemoteControlCmd.AppIdentifier + "制样急停", appRemoteControlCmd.AppIdentifier + appRemoteControlCmd.Param == "1" ? "急停执行成功" : "复位执行成功");
                    }
                }
            }
        }
Exemple #4
0
 /// <summary>
 /// 更改程序远程控制命令的执行结果
 /// </summary>
 /// <param name="appRemoteControlCmd"></param>
 /// <param name="cmdResultCode"></param>
 public void SetAppRemoteControlCmdResultCode(CmcsAppRemoteControlCmd appRemoteControlCmd, eEquInfCmdResultCode cmdResultCode)
 {
     appRemoteControlCmd.DataFlag   = 1;
     appRemoteControlCmd.ResultCode = cmdResultCode.ToString();
     SelfDber.Update(appRemoteControlCmd);
 }