コード例 #1
0
 /// <summary>
 /// 添加充电桩指令
 /// </summary>
 /// <param name="chargeid"></param>
 /// <param name="ctov"></param>
 public void Charge_AddControl(int chargeid, CommandToValue ctov)
 {
     try
     {
         AGVSessionBase session = ChargeStationSessions.FirstOrDefault(p => (p as AGVSessionBase).DeviceID == chargeid) as AGVSessionBase;
         if (session != null)
         {
             session.QueueCommand.Enqueue(ctov);
         }
         else
         {
             DelegateState.InvokeDispatchStateEvent("添加指令失败,未能找到" + chargeid.ToString() + "号充电桩 ");
         }
     }
     catch (Exception ex)
     {
         DelegateState.InvokeDispatchStateEvent("添加充电桩指令异常");
     }
 }
コード例 #2
0
 /// <summary>
 /// 添加AGV发送指令
 /// </summary>
 public void AGV_AddControl(int AGVID, CommandToValue ctov)
 {
     try
     {
         AGVSessionBase session = AGVSessions.FirstOrDefault(p => (p as AGVSessionBase).DeviceID == AGVID) as AGVSessionBase;
         if (session != null)
         {
             //LogHelper.WriteCreatTaskLog("添加AGV:"+ AGVID.ToString()+"指令-->"+ ctov.Command.ToString());
             session.QueueCommand.Enqueue(ctov);
         }
         else
         {
             DelegateState.InvokeDispatchStateEvent("添加指令失败,未能找到" + AGVID.ToString() + "号AGV通信管道!");
             LogHelper.WriteLog("添加指令失败,未能找到" + AGVID.ToString() + "号AGV通信管道!");
         }
     }
     catch (Exception ex)
     {
         DelegateState.InvokeDispatchStateEvent("添加指令异常");
         LogHelper.WriteErrorLog(ex);
     }
 }