public bool HasOrtherBlockControlAskedFromRedis(string vh_id, string req_block_zone_id, out string crt_block_zone_status)
        {
            crt_block_zone_status = string.Empty;
            bool   hasOhther               = false;
            string set_key_word            = string.Format(REDIS_BLOCK_CONTROL_KEY_VHID, vh_id);
            var    blockInfo               = scApp.getRedisCacheManager().StringGet(set_key_word);
            string requested_block_zone_id = string.Empty;
            string status = string.Empty;

            if (blockInfo.HasValue)
            {
                string[] blockInfos = ((string)blockInfo).Split(',');
                requested_block_zone_id = blockInfos[0];
                status    = blockInfos[1];
                hasOhther = !SCUtility.isMatche(requested_block_zone_id, req_block_zone_id) &&
                            SCUtility.isMatche(status, SCAppConstants.BlockQueueState.Request);
                if (hasOhther)
                {
                    List <string> requested_block_detail_id = scApp.MapBLL.loadBlockZoneDetailSecIDsByEntrySecID(requested_block_zone_id);
                    List <string> request_block_detail_id   = scApp.MapBLL.loadBlockZoneDetailSecIDsByEntrySecID(req_block_zone_id);
                    hasOhther = requested_block_detail_id.Intersect(request_block_detail_id).Count() == 0;
                }

                if (!hasOhther)
                {
                    crt_block_zone_status = status;
                }
            }
            LogCollection.BlockControlLogger.Trace
                ($"Check has orther block zone req, VH_ID [{vh_id}],block id [{req_block_zone_id}], " +
                $"has orther [{hasOhther}],redis block id:{requested_block_zone_id},redis block status:{status}");
            return(hasOhther);
        }
            public bool IsPortInSpecifiedSegment(BLL.SectionBLL sectionBLL, string portID, string segmentID)
            {
                APORTSTATION aPORTSTATION = getPortStation(portID);
                ASECTION     aSECTION     = sectionBLL.cache.GetSectionsByAddress(aPORTSTATION.ADR_ID.Trim()).First();

                return(SCUtility.isMatche(aSECTION.SEG_NUM, segmentID));
            }
        public (bool isSuccess, string result) processCarOutScenario(MaintainLift mtx, AVEHICLE preCarOutVh)
        {
            string pre_car_out_vh_id          = preCarOutVh.VEHICLE_ID;
            string pre_car_out_vh_ohtc_cmd_id = preCarOutVh.OHTC_CMD;
            string pre_car_out_vh_cur_adr_id  = preCarOutVh.CUR_ADR_ID;
            bool   isSuccess;
            string result = "OK";

            mtx.CancelCarOutRequest = false;
            mtx.CarOurSuccess       = false;
            CarOutStart(mtx);
            //接著要開始等待MTS的兩個門都放下來之後,才可以將OHT開過來
            if (mtx.DokingMaintainDevice is MaintainSpace)
            {
                MaintainSpace dockingMaintainSpace = mtx.DokingMaintainDevice as MaintainSpace;
                if (!SpinWait.SpinUntil(() => dockingMaintainSpace.MTSBackDoorStatus == MTSDoorStatus.Open &&
                                        dockingMaintainSpace.MTSFrontDoorStatus == MTSDoorStatus.Open,
                                        MTS_DOOR_OPEN_TIME_OUT_ms))
                {
                    isSuccess = false;
                    result    = $"Process car out scenario,but mts:{dockingMaintainSpace.DeviceID} status not ready " +
                                $"{nameof(dockingMaintainSpace.MTSBackDoorStatus)}:{dockingMaintainSpace.MTSBackDoorStatus}," +
                                $"{nameof(dockingMaintainSpace.MTSFrontDoorStatus)}:{dockingMaintainSpace.MTSFrontDoorStatus}";
                    LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(MTLService), Device: SCAppConstants.DeviceName.DEVICE_NAME_MTx,
                                  Data: result,
                                  XID: dockingMaintainSpace.DeviceID);
                    CarOutFinish(mtx);
                    return(isSuccess, result);
                }
            }

            //isSuccess = VehicleService.doReservationVhToMaintainsBufferAddress(pre_car_out_vh_id, MTL_CAR_OUT_BUFFER_ADDRESS);
            isSuccess = VehicleService.doReservationVhToMaintainsBufferAddress(pre_car_out_vh_id, mtx.MTL_SYSTEM_OUT_ADDRESS);
            if (isSuccess && SCUtility.isEmpty(pre_car_out_vh_ohtc_cmd_id))
            {
                //在收到OHT的ID:132-命令結束後或者在變為AutoLocal後此時OHT沒有命令的話則會呼叫此Function來創建一個Transfer command,讓Vh移至移動至System out上
                if (SCUtility.isMatche(pre_car_out_vh_cur_adr_id, mtx.MTL_SYSTEM_OUT_ADDRESS))
                {
                    VehicleService.doAskVhToMaintainsAddress(pre_car_out_vh_id, mtx.MTL_ADDRESS);
                }
                else
                {
                    VehicleService.doAskVhToSystemOutAddress(pre_car_out_vh_id, mtx.MTL_SYSTEM_OUT_ADDRESS);
                }
            }
            if (isSuccess)
            {
                //carOutVhID = pre_car_out_vh_id;
                mtx.PreCarOutVhID = pre_car_out_vh_id;
                Task.Run(() => RegularUpdateRealTimeCarInfo(mtx, preCarOutVh));
            }
            else
            {
                //mtx.SetCarOutInterlock(false);
                CarOutFinish(mtx);
                isSuccess = false;
                result    = $"Reservation vh to mtl fail.";
            }
            return(isSuccess, result);
        }
            public Boolean checkUserPassword(string user_id, string password)
            {
                DBConnection_EF conn   = null;
                Boolean         result = false;

                try
                {
                    conn = DBConnection_EF.GetContext();
                    conn.BeginTransaction();
                    UASUSR loginUser = userDao.getUser(conn, false, user_id);
                    if (loginUser == null)
                    {
                        result = false;
                    }
                    else if (SCUtility.isMatche(loginUser.PASSWD, password))
                    {
                        result = true;
                    }
                    conn.Commit();
                }
                catch (Exception ex)
                {
                    logger.Warn("Load User Function Failed from UASUFNC [user_id:{0}]",
                                user_id, ex);
                    result = false;
                }
                finally
                {
                    if (conn != null)
                    {
                        try { conn.Close(); } catch { }
                    }
                }
                return(result);
            }
Exemple #5
0
        private AVEHICLE findTheKeyBlockVhID(AVEHICLE avoidVh, AVEHICLE blockedVh)
        {
            if (blockedVh == null)
            {
                return(null);
            }

            if (SCUtility.isMatche(avoidVh.CanNotReserveInfo.ReservedVhID, blockedVh.VEHICLE_ID) &&
                SCUtility.isMatche(blockedVh.CanNotReserveInfo.ReservedVhID, avoidVh.VEHICLE_ID))
            {
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(DeadlockCheck), Device: "OHBC",
                              Data: $"dead lock happend ,find key blocked vh .avoid vh:{avoidVh.VEHICLE_ID} ,blocked vh:{blockedVh.VEHICLE_ID}",
                              VehicleID: avoidVh.VEHICLE_ID,
                              CarrierID: avoidVh.CST_ID);
                return(blockedVh);
            }
            else
            {
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(DeadlockCheck), Device: "OHBC",
                              Data: $"dead lock happend ,can't find key blocked vh .avoid vh:{avoidVh.VEHICLE_ID} ,blocked vh:{blockedVh.VEHICLE_ID}. start find orther block vh",
                              VehicleID: avoidVh.VEHICLE_ID,
                              CarrierID: avoidVh.CST_ID);

                AVEHICLE orther_reserved_vh = scApp.VehicleBLL.cache.getVhByID(blockedVh.CanNotReserveInfo.ReservedVhID);
                int      find_count         = 0;
                return(findTheOrtherKeyBlockVhID(avoidVh, orther_reserved_vh, ref find_count));
            }
        }
            public ABLOCKZONEMASTER getBlockZoneMaster(string entrySectionID)
            {
                var block_zone_master = commObjCache.getBlockMasterZone().
                                        Where(block_master => SCUtility.isMatche(block_master.ENTRY_SEC_ID, entrySectionID)).SingleOrDefault();

                return(block_zone_master);
            }
        public string getNearSegmentAddress(string adrID)
        {
            if (SCUtility.isMatche(FROM_ADR_ID, adrID) || SCUtility.isMatche(TO_ADR_ID, adrID))
            {
                return(adrID);
            }

            ASECTION section_of_to_adr = Sections.Where(sec => sec.TO_ADR_ID.Trim() == adrID.Trim()).Single();
            int      sec_index         = Sections.IndexOf(section_of_to_adr);
            double   with_from_adr_dis = 0;
            double   with_to_adr_dis   = 0;

            for (int i = 0; i < Sections.Count; i++)
            {
                if (i <= sec_index)
                {
                    with_from_adr_dis += Sections[i].SEC_DIS;
                }
                else
                {
                    with_to_adr_dis += Sections[i].SEC_DIS;
                }
            }
            if (with_from_adr_dis >= with_to_adr_dis)
            {
                return(RealToAddress);
            }
            else
            {
                return(RealFromAddress);
            }
        }
Exemple #8
0
            public void TrafficControlRelease(string vhID)
            {
                string key_pattern     = string.Format(SCAppConstants.REDIS_KEY_TRAFFIC_CONTROL_INFO_0, "*");
                var    all_reserve_key = redisCacheManager.SearchKey(key_pattern).ToArray();

                if (all_reserve_key.Count() > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (var reserve_key in all_reserve_key)
                    {
                        string   value = redisCacheManager.StringGet(reserve_key, false);
                        string[] reserve_vh_section_array = value.Split('#');
                        string   reserve_vh = reserve_vh_section_array[0];
                        if (SCUtility.isMatche(vhID, reserve_vh))
                        {
                            bool is_success = redisCacheManager.KeyDelete(reserve_key, false);
                            sb.Append($"key:{reserve_key},value:{value},is_success:{is_success}");
                            sb.AppendLine();
                            LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(TrafficControlBLL), Device: "AGVC",
                                          Details: $"Excute traffic control release:{sb.ToString()},by vh id:{vhID}",
                                          VehicleID: vhID);
                        }
                    }
                }
            }
Exemple #9
0
            public List <APORTSTATION> loadAllPortStation(string zoneID)
            {
                var port_stations = CacheManager.getALLPortStation();

                return(port_stations.Where(port => SCUtility.isMatche(port.ZONE_ID, zoneID)).
                       ToList());
            }
Exemple #10
0
        public void updatePortStatusByRedis()
        {
            var ports_plc_info = redis.getCurrentPortsInfo();
            var sb             = new StringBuilder();

            ports_plc_info.ForEach(info => sb.AppendLine(info.ToString()));
            LogHelper.Log(logger: logger, LogLevel: LogLevel.Debug, Class: nameof(PortStationBLL), Device: "AGVC",
                          Data: $"port infos:{sb}");

            var port_stations = OperateCatch.loadAGVPortStation();

            foreach (var port_station in port_stations)
            {
                var port_plc_info = ports_plc_info.Where(port => SCUtility.isMatche(port.PortID, port_station.PORT_ID)).
                                    FirstOrDefault();
                if (port_plc_info != null)
                {
                    //如果現在時間還沒超過該筆資料上次更新的時間10秒鐘,才可以進行更新
                    port_station.SetPortInfo(port_plc_info);

                    //if (DateTime.Now < port_plc_info.dTimeStamp.AddSeconds(PORT_INFO_TIME_OUT_SEC))
                    //{
                    //    port_station.SetPortInfo(port_plc_info);
                    //}
                    //else
                    //{
                    //    //port_station.ResetPortInfo();
                    //}
                }
                else
                {
                    port_station.ResetPortInfo();
                }
            }
        }
        public override void MTL_CarInRequest(object sender, ValueChangedEventArgs args)
        {
            var recevie_function =
                scApp.getFunBaseObj <MtlToOHxC_RequestCarInDataCheck>(MTS.EQPT_ID) as MtlToOHxC_RequestCarInDataCheck;
            var send_function =
                scApp.getFunBaseObj <OHxCToMtl_ReplyCarInDataCheck>(MTS.EQPT_ID) as OHxCToMtl_ReplyCarInDataCheck;

            try
            {
                recevie_function.Read(bcfApp, MTS.EqptObjectCate, MTS.EQPT_ID);
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(MTSValueDefMapActionNew), Device: DEVICE_NAME_MTL,
                              Data: recevie_function.ToString(),
                              VehicleID: MTS.EQPT_ID);
                ushort vh_num     = recevie_function.CarID;
                ushort hand_shake = recevie_function.Handshake;

                AVEHICLE pre_car_in_vh = scApp.VehicleBLL.cache.getVhByNum(vh_num);
                if (pre_car_in_vh != null)
                {
                    MaintainLift mtl = null;
                    if (SCUtility.isMatche(MTS.EQPT_ID, "MTS"))
                    {
                        mtl = scApp.EquipmentBLL.cache.GetMaintainLift();
                    }
                    var check_result = scApp.MTLService.checkVhAndMTxCarInStatus(MTS, mtl, pre_car_in_vh);
                    send_function.ReturnCode = check_result.isSuccess ? (UInt16)1 : (UInt16)3;
                    LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(MTSValueDefMapActionNew), Device: DEVICE_NAME_MTL,
                                  Data: $"check mts car in result, is success:{check_result.isSuccess},result:{check_result.result}",
                                  VehicleID: MTS.EQPT_ID);
                }
                else
                {
                    send_function.ReturnCode = 2;
                    LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(MTSValueDefMapActionNew), Device: DEVICE_NAME_MTL,
                                  Data: $"check mts car in result, vehicle num:{vh_num} not exist.",
                                  VehicleID: MTS.EQPT_ID);
                }
                send_function.Handshake = hand_shake;
                send_function.Write(bcfApp, MTS.EqptObjectCate, MTS.EQPT_ID);

                LogHelper.Log(logger: logger, LogLevel: LogLevel.Info, Class: nameof(MTSValueDefMapActionNew), Device: DEVICE_NAME_MTL,
                              Data: send_function.ToString(),
                              VehicleID: MTS.EQPT_ID);
                MTS.SynchronizeTime = DateTime.Now;

                if (send_function.Handshake == 1 && send_function.ReturnCode == 1)
                {
                    scApp.MTLService.processCarInScenario(MTS);
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
            finally
            {
                scApp.putFunBaseObj <MtlToOHxC_RequestCarInDataCheck>(recevie_function);
                scApp.putFunBaseObj <OHxCToMtl_ReplyCarInDataCheck>(send_function);
            }
        }
        getGuideInfo(string startAddress, string targetAddress, List <string> byPassSectionIDs = null)
        {
            if (SCUtility.isMatche(startAddress, targetAddress))
            {
                return(true, new List <string>(), new List <string>(), new List <string>(), 0);
            }

            bool is_success = false;

            int.TryParse(startAddress, out int i_start_address);
            int.TryParse(targetAddress, out int i_target_address);

            List <RouteInfo> stratFromRouteInfoList = null;

            if (byPassSectionIDs == null || byPassSectionIDs.Count == 0)
            {
                stratFromRouteInfoList = scApp.NewRouteGuide.getFromToRoutesAddrToAddr(i_start_address, i_target_address);
            }
            else
            {
                stratFromRouteInfoList = scApp.NewRouteGuide.getFromToRoutesAddrToAddr(i_start_address, i_target_address, byPassSectionIDs);
            }
            RouteInfo min_stratFromRouteInfo = null;

            if (stratFromRouteInfoList != null && stratFromRouteInfoList.Count > 0)
            {
                min_stratFromRouteInfo = stratFromRouteInfoList.First();
                is_success             = true;
            }

            return(is_success, null, min_stratFromRouteInfo.GetSectionIDs(), min_stratFromRouteInfo.GetAddressesIDs(), min_stratFromRouteInfo.total_cost);
        }
Exemple #13
0
            public AZONE GetZone(string zoneID)
            {
                var zones = eqObjCacheManager.getZoneListByLine();

                return(zones.Where(zone => SCUtility.isMatche(zone.ZONE_ID, zoneID)).
                       FirstOrDefault());
            }
Exemple #14
0
        private void btn_AutoR_Button_Click(object sender, EventArgs e)
        {
            try
            {
                if (SCUtility.isMatche(cb_VhID.Text, ""))
                {
                    TipMessage_Type_Light.Show("", "Please select Vehicle ID.", BCAppConstants.INFO_MSG);
                    return;
                }
                else
                {
                    var confirmResult = TipMessage_Request_Light.Show("Are you sure to change Vehicle Mode ?");

                    if (confirmResult != DialogResult.Yes)
                    {
                        return;
                    }
                    else
                    {
                        TipMessage_Type_Light.Show("Successfully Set Auto Remote", "Successfully the vehicle was set auto remote.", BCAppConstants.INFO_MSG);
                        btn_AutoL.Enabled = true;
                        btn_AutoR.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
        }
        private List <ASECTION> getSectionByOrder(List <ASECTION> sections)
        {
            if (sections.Count == 1)
            {
                return(sections);
            }
            if (SCUtility.isMatche(SEG_ID, "900"))
            {
                return(new List <ASECTION>());
            }
            List <ASECTION> order_sections = new List <ASECTION>();
            string          next_from_adr  = RealFromAddress;

            for (int i = 0; i < sections.Count; i++)
            {
                //ASECTION section = sections.Where(s => s.FROM_ADR_ID.Trim() == next_from_adr.Trim()).SingleOrDefault();
                ASECTION section = sections.Where(s => s.REAL_FROM_ADR_ID.Trim() == next_from_adr.Trim()).SingleOrDefault();
                order_sections.Add(section);
                //next_from_adr = section.TO_ADR_ID;
                if (section == null)
                {
                }
                next_from_adr = section.REAL_TO_ADR_ID;
            }
            return(order_sections);
        }
        public bool checkAndUpdateVhEntryCycleRunAdr(string vh_id, string adr_id)
        {
            bool             isCyclingAdr    = false;
            ACYCLEZONEMASTER cycleZoneMaster = null;
            ALINE            line            = scApp.getEQObjCacheManager().getLine();
            AVEHICLE         vh = scApp.VehicleBLL.getVehicleByID(vh_id);

            if (!SCUtility.isEmpty(vh.CYCLERUN_ID) &&
                !vh.IS_CYCLING)
            {
                //DBConnection_EF con = DBConnection_EF.GetContext();
                //using (DBConnection_EF con = new DBConnection_EF())
                using (DBConnection_EF con = DBConnection_EF.GetUContext())
                {
                    cycleZoneMaster = cycleZoneMasterDao.getByEntryAdr(con, adr_id);
                    if (cycleZoneMaster == null)
                    {
                        return(false);
                    }
                    if (SCUtility.isMatche(vh.CYCLERUN_ID, cycleZoneMaster.CYCLE_ZONE_ID))
                    {
                        scApp.VehicleBLL.setVhIsInCycleRun(vh_id); //TODO 討論移到144判斷
                        isCyclingAdr = true;
                    }
                }
            }

            return(isCyclingAdr);
        }
Exemple #17
0
        public List <ALARM> resetAllAlarmReport(string eq_id)
        {
            List <ALARM> alarms = null;

            lock (lock_obj_alarm)
            {
                using (DBConnection_EF con = DBConnection_EF.GetUContext())
                {
                    alarms = alarmDao.loadSetAlarm(con, eq_id);

                    if (alarms != null)
                    {
                        foreach (ALARM alarm in alarms.ToList())
                        {
                            if (!SCUtility.isMatche(alarm.ALAM_CODE, VEHICLE_ALARM_HAPPEND))
                            {
                                alarm.ALAM_STAT       = ProtocolFormat.OHTMessage.ErrorStatus.ErrReset;
                                alarm.CLEAR_DATE_TIME = DateTime.Now;
                                alarmDao.updateAlarm(con, alarm);
                            }
                            else
                            {
                                alarms.Remove(alarm);
                            }
                        }
                        CheckSetAlarm();
                    }
                }
            }
            return(alarms);
        }
Exemple #18
0
        protected virtual void S5F3ReceiveEnableDisableAlarm(object sender, SECSEventArgs e)
        {
            try
            {
                bool isSuccess = true;
                S5F3 s5f3      = ((S5F3)e.secsHandler.Parse <S5F3>(e));
                SCUtility.secsActionRecordMsg(scApp, true, s5f3);
                if (!isProcess(s5f3))
                {
                    return;
                }
                Boolean isEnable   = SCUtility.isMatche(s5f3.ALED, SECSConst.ALED_Enable);
                string  alarm_code = s5f3.ALID;


                isSuccess = scApp.AlarmBLL.enableAlarmReport(alarm_code, isEnable);

                S5F4 s5f4 = null;
                s5f4               = new S5F4();
                s5f4.SystemByte    = s5f3.SystemByte;
                s5f4.SECSAgentName = scApp.EAPSecsAgentName;
                s5f4.ACKC5         = isSuccess ? SECSConst.ACKC5_Accepted : SECSConst.ACKC5_Not_Accepted;

                TrxSECS.ReturnCode rtnCode = ISECSControl.replySECS(bcfApp, s5f4);
                SCUtility.secsActionRecordMsg(scApp, false, s5f4);
                if (rtnCode != TrxSECS.ReturnCode.Normal)
                {
                    logger.Warn("Reply EQPT S2F18 Error:{0}", rtnCode);
                }
            }
            catch (Exception ex)
            {
                logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}", line.LINE_ID, "S2F17_Receive_Date_Time_Req", ex.ToString());
            }
        }
Exemple #19
0
        private void btn_Cmd_Button_Click(object sender, EventArgs e)
        {
            try
            {
                if (SCUtility.isMatche(cb_MvToStation.Text, ""))
                {
                    TipMessage_Type_Light.Show("", "Please select Station.", BCAppConstants.INFO_MSG);
                    return;
                }
                else
                {
                    var confirmResult = TipMessage_Request_Light.Show("Are you sure to change Station Mode ?");

                    if (confirmResult != DialogResult.Yes)
                    {
                        return;
                    }
                    else
                    {
                        TipMessage_Type_Light.Show("Successfully Command", "Successfully command to vehicle.", BCAppConstants.INFO_MSG);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex, "Exception");
            }
        }
 public List <AADDRESS> GetAddressesBySectionID(string secID)
 {
     return(CommObjCacheManager.getAddresses().
            Where(adr => SCUtility.isMatche(adr.SEC_ID, secID)).
            OrderBy(adr => adr.DISTANCE).
            ToList());
 }
            public List <CouplerAddress> LoadCouplerAddresses(string chargerID)
            {
                List <CouplerAddress> CouplerAddresses = CommObjCacheManager.getCouplerAddresses();

                CouplerAddresses = CouplerAddresses.Where(coupler => SCUtility.isMatche(coupler.ChargerID, chargerID)).ToList();
                return(CouplerAddresses);
            }
            public void AddressRelease(string vhID, string adrID)
            {
                string adr_id                = adrID.Trim();
                string adr_reserve_info      = string.Format(SCAppConstants.REDIS_KEY_ADDRESS_RESERVE_INFO_0, adr_id);
                string reserve_vh_section_id = redisCacheManager.StringGet(adr_reserve_info);

                string[] reserve_vh_section_array = reserve_vh_section_id.Split('#');
                string   reserve_vh = reserve_vh_section_array[0];

                bool is_success = false;

                if (SCUtility.isMatche(vhID, reserve_vh))
                {
                    is_success = redisCacheManager.KeyDelete(adr_reserve_info);
                }
                if (is_success)
                {
                    if (scApp.getCommObjCacheManager().isSectionAtFireDoorArea(reserve_vh_section_array[1]))
                    {
                        scApp.getCommObjCacheManager().sectionUnreserveAtFireDoorArea(reserve_vh_section_array[1]);
                    }
                }
                LogHelper.Log(logger: logger, LogLevel: LogLevel.Warn, Class: nameof(AddressesBLL), Device: "AGVC",
                              Details: $"Excute address id:{adr_id} release by vh id:{vhID},result:{is_success}");
            }
            public List <string> loadReserveSection(string vhID)
            {
                string           key_pattern                 = string.Format(SCAppConstants.REDIS_KEY_ADDRESS_RESERVE_INFO_0, "*");
                var              all_reserve_key             = redisCacheManager.SearchKey(key_pattern).ToArray();
                List <string>    all_reserve_value_vh_sec_id = null;
                HashSet <string> sections = new HashSet <string>();

                if (all_reserve_key.Count() > 0)
                {
                    all_reserve_value_vh_sec_id = redisCacheManager.StringGet(all_reserve_key).
                                                  Select(redis_value => redis_value.ToString()).
                                                  ToList();
                    foreach (string reserve_vh_section in all_reserve_value_vh_sec_id)
                    {
                        string[] reserve_vh_section_array = reserve_vh_section.Split('#');
                        string   reserve_vh = reserve_vh_section_array[0];
                        if (SCUtility.isMatche(vhID, reserve_vh))
                        {
                            string reserve_by_section = string.Empty;
                            if (reserve_vh_section_array.Count() > 1)
                            {
                                reserve_by_section = reserve_vh_section_array[1];
                            }
                            if (!SCUtility.isEmpty(reserve_by_section))
                            {
                                sections.Add(reserve_by_section);
                            }
                        }
                    }
                }
                return(sections.ToList());
            }
Exemple #24
0
        public int GetDistance(string startAddress, string targetAddress)
        {
            try
            {
                if (SCUtility.isMatche(startAddress, targetAddress))
                {
                    return(0);
                }

                var guide_info = getGuideInfo(startAddress, targetAddress);
                //if ((guide_info.guideAddressIds != null && guide_info.guideAddressIds.Count != 0) &&
                //    ((guide_info.guideSectionIds != null && guide_info.guideSectionIds.Count != 0)))
                if (guide_info.isSuccess)
                {
                    return(guide_info.totalCost);
                }
                else
                {
                    return(int.MaxValue);
                }
            }
            catch
            {
                return(int.MaxValue);
            }
        }
Exemple #25
0
        /// <summary>
        /// Handles the Load event of the BCMainForm control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void BCMainForm_Load(object sender, EventArgs e)
        {
            try
            {
                ProgressBarDialog progress = new ProgressBarDialog(bcApp);
                System.Threading.ThreadPool.QueueUserWorkItem(new WaitCallback(callBackDoInitialize), progress);
                if (progress != null && !progress.IsDisposed)
                {
                    progress.ShowDialog();
                }
#if DEBUG
                //openForm(typeof(OHT_Form).Name);
                if (SCUtility.isMatche(BCApp.SCApplication.BC_ID, "ASE_LOOP"))
                {
                    openForm(typeof(OHT_FormNew).Name, true, false);
                }
                else
                {
                    openForm(typeof(OHT_Form).Name);
                }
#endif
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, String.Format("Exception: {0}", ex));
                logger.Error(ex, "Exception");
            }
        }
Exemple #26
0
        public (bool isSuccess, int distance) IsRoadWalkable(string startAddress, string targetAddress)
        {
            try
            {
                if (SCUtility.isMatche(startAddress, targetAddress))
                {
                    return(true, 0);
                }

                var guide_info = getGuideInfo(startAddress, targetAddress);
                //if ((guide_info.guideAddressIds != null && guide_info.guideAddressIds.Count != 0) &&
                //    ((guide_info.guideSectionIds != null && guide_info.guideSectionIds.Count != 0)))
                if (guide_info.isSuccess)
                {
                    return(true, guide_info.totalCost);
                }
                else
                {
                    return(false, int.MaxValue);
                }
            }
            catch
            {
                return(false, int.MaxValue);
            }
        }
        public virtual bool IsR2000Address(string adrID)
        {
            var  hlt_r2000_section_objs = mapAPI.HltMapSections.Where(sec => SCUtility.isMatche(sec.Type, HtlSectionType.R2000.ToString())).ToList();
            bool is_r2000_address       = hlt_r2000_section_objs.Where(sec => SCUtility.isMatche(sec.StartAddressID, adrID) || SCUtility.isMatche(sec.EndAddressID, adrID))
                                          .Count() > 0;

            return(is_r2000_address);
        }
            public SCAppConstants.EqptType GetEqptType(string eqptID)
            {
                var eqpt = CacheManager.getAllEquipment().
                           Where(u => SCUtility.isMatche(u.EQPT_ID, eqptID)).
                           SingleOrDefault();

                return(eqpt.Type);
            }
            public AEQPT GetEqpt(string eqptID)
            {
                var eqpt = CacheManager.getAllEquipment().
                           Where(u => SCUtility.isMatche(u.EQPT_ID, eqptID)).
                           SingleOrDefault();

                return(eqpt);
            }
Exemple #30
0
            public TrafficControlInfo getTrafficControlInfo(string infoID)
            {
                var traffic_control_info = CommObjCacheManager.getTrafficControlInfos().
                                           Where(i => SCUtility.isMatche(i.ID, infoID))
                                           .SingleOrDefault();

                return(traffic_control_info);
            }