Exemplo n.º 1
0
        protected void str134_ReceiveProcess(object sender, TcpIpEventArgs e)
        {
            ID_134_TRANS_EVENT_REP recive_str = (ID_134_TRANS_EVENT_REP)e.objPacket;

            //TODO 需比較是否有位置重複的問題 => OK
            //if (!SCUtility.isMatche(eqpt.CUR_SEC_ID, recive_str.CurrentAdrID) || !SCUtility.isMatche(eqpt.CUR_SEC_ID, recive_str.CurrentSecID))
            //{
            SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, recive_str);
            if (recive_str.SecDistance > IGNORE_SECTION_DISTANCE)
            {
                scApp.VehicleBLL.setAndPublishPositionReportInfo2Redis(eqpt.VEHICLE_ID, recive_str);
            }
            else
            {
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(EQTcpIpMapAction), Device: "OHxC",
                              Data: $"ignore vh:{eqpt.VEHICLE_ID} of position report,because current section distance:{recive_str.SecDistance} less then {IGNORE_SECTION_DISTANCE}",
                              VehicleID: eqpt.VEHICLE_ID);
            }
            //scApp.VehicleBLL.setPositionReportInfo2Redis(eqpt.VEHICLE_ID, recive_str);
            //scApp.VehicleBLL.PublishPositionReportInfo2Redis(eqpt.VEHICLE_ID, recive_str);
            //}
            //dynamic service = scApp.BlockControlServer;
            //dynamic service = scApp.VehicleService;
            //ID_134_TRANS_EVENT_REP recive_str = (ID_134_TRANS_EVENT_REP)e.objPacket;
            //service.PositionReport(bcfApp, eqpt, recive_str, e.iSeqNum);
        }
Exemplo n.º 2
0
        protected void str134_ReceiveProcess(object sender, TcpIpEventArgs e)
        {
            ID_134_TRANS_EVENT_REP recive_str = (ID_134_TRANS_EVENT_REP)e.objPacket;

            SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, recive_str);
            scApp.VehicleBLL.setAndPublishPositionReportInfo2Redis(eqpt.VEHICLE_ID, recive_str);
        }
 protected void str134_Receive(object sender, TcpIpEventArgs e)
 {
     if (scApp.getEQObjCacheManager().getLine().ServerPreStop)
     {
         return;
     }
     try
     {
         ID_134_TRANS_EVENT_REP recive_str = (ID_134_TRANS_EVENT_REP)e.objPacket;
         SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, recive_str);
         int  current_seq_num       = e.iSeqNum;
         int  pre_position_seq_num  = eqpt.PrePositionSeqNum;
         bool need_process_position = true;
         lock (eqpt.PositionRefresh_Sync)
         {
             need_process_position  = checkPositionSeqNum(current_seq_num, pre_position_seq_num);
             eqpt.PrePositionSeqNum = current_seq_num;
         }
         if (!need_process_position)
         {
             LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(EQTcpIpMapAction), Device: Service.VehicleService.DEVICE_NAME_AGV,
                           Data: $"The vehicles updata position report of seq num is old,by pass this one.old seq num;{pre_position_seq_num},current seq num:{current_seq_num}",
                           VehicleID: eqpt.VEHICLE_ID,
                           CarrierID: eqpt.CST_ID);
             return;
         }
         scApp.VehicleBLL.setAndPublishPositionReportInfo2Redis(eqpt.VEHICLE_ID, recive_str);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "(str134_Receive) Exception");
     }
 }
Exemplo n.º 4
0
        public override bool send_Str37(string cmd_id, CMDCancelType actType)
        {
            //加入StackTrace,來找出他會下達Cancel的入口 by Kevin
            try
            {
                StackTrace st        = new StackTrace(true);
                string     trace_msg = SCUtility.ShowCallerInfo(st, $"Call EQTcpIpMapAction.send_Str37(),cmd id:{cmd_id},act type:{actType}");
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(EQTcpIpMapAction), Device: "OHxC",
                              Data: trace_msg,
                              VehicleID: eqpt.VEHICLE_ID,
                              Details: st.ToString(),
                              CarrierID: eqpt.CST_ID);
            }
            catch { }
            bool isScuess = false;

            try
            {
                string rtnMsg = string.Empty;
                ID_37_TRANS_CANCEL_REQUEST   stSend;
                ID_137_TRANS_CANCEL_RESPONSE stRecv;
                stSend = new ID_37_TRANS_CANCEL_REQUEST()
                {
                    CmdID   = cmd_id,
                    ActType = actType
                };

                WrapperMessage wrapper = new WrapperMessage
                {
                    ID             = VHMSGIF.ID_TRANS_CANCEL_REQUEST,
                    TransCancelReq = stSend
                };

                SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, stSend);
                com.mirle.iibg3k0.ttc.Common.TrxTcpIp.ReturnCode result = snedRecv(wrapper, out stRecv, out rtnMsg);
                SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, stRecv, result.ToString());
                if (result == TrxTcpIp.ReturnCode.Normal)
                {
                    if (stRecv.ReplyCode == 0)
                    {
                        isScuess = true;
                    }
                    else
                    {
                        isScuess = false;
                    }
                }
                else
                {
                    isScuess = false;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            return(isScuess);
        }
Exemplo n.º 5
0
 protected void str134_Receive(object sender, TcpIpEventArgs e)
 {
     if (scApp.getEQObjCacheManager().getLine().ServerPreStop)
     {
         return;
     }
     try
     {
         ID_134_TRANS_EVENT_REP recive_str = (ID_134_TRANS_EVENT_REP)e.objPacket;
         SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, recive_str);
         dynamic receive_process = scApp.VehicleService.Receive;
         receive_process.PositionReport(bcfApp, eqpt, recive_str, e.iSeqNum);
     }
     catch (Exception ex)
     {
         logger.Error(ex, "(str134_Receive) Exception");
     }
 }
        public override (bool isSendOK, int replyCode) send_Str37(string cmd_id, CMDCancelType actType)
        {
            bool is_scuess  = false;
            int  reply_code = 0;

            try
            {
                //由於A00的要求,希望可以在收到命令後 走完一個Section後再進行Cancel,因此先加入此Function
                //WaitPassOneSection();

                string rtnMsg = string.Empty;
                ID_37_TRANS_CANCEL_REQUEST   stSend;
                ID_137_TRANS_CANCEL_RESPONSE stRecv;
                stSend = new ID_37_TRANS_CANCEL_REQUEST()
                {
                    CmdID   = cmd_id,
                    ActType = actType
                };

                WrapperMessage wrapper = new WrapperMessage
                {
                    ID             = WrapperMessage.TransCancelReqFieldNumber,
                    TransCancelReq = stSend
                };

                SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, stSend);
                com.mirle.iibg3k0.ttc.Common.TrxTcpIp.ReturnCode result = snedRecv(wrapper, out stRecv, out rtnMsg);
                SCUtility.RecodeReportInfo(eqpt.VEHICLE_ID, 0, stRecv, result.ToString());
                is_scuess  = result == TrxTcpIp.ReturnCode.Normal;
                reply_code = stRecv.ReplyCode;
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            return(is_scuess, reply_code);
        }