Example #1
0
        //public HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.Forward, HltDirection forkDir = HltDirection.None, bool isAsk = false)
        //{
        //    //int sec_id = 0;
        //    //int.TryParse(sectionID, out sec_id);
        //    string sec_id = SCUtility.Trim(sectionID);

        //    HltResult result = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, isAsk);
        //    onReserveStatusChange();

        //    return result;
        //}
        public HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.Forward, HltDirection forkDir = HltDirection.None, bool isAsk = false)
        {
            HltResult result = null;
            string    sec_id = SCUtility.Trim(sectionID);
            //如果詢問的Section是Reserve Enhance的section時,
            //則要判斷該區塊且之後的Section是否要得到
            var reserve_enhance_info_check_result = IsReserveEnhanceSection(sectionID);

            if (reserve_enhance_info_check_result.isEnhanceInfo)
            {
                List <string> enhance_control_sections = reserve_enhance_info_check_result.info.EnhanceControlSections;
                int           section_index            = enhance_control_sections.IndexOf(sectionID);
                for (int i = section_index; i < enhance_control_sections.Count; i++)
                {
                    result = mapAPI.TryAddReservedSection(vhID, enhance_control_sections[i], sensorDir, forkDir, true);
                    if (!result.OK)
                    {
                        result.Description += $",section:{sectionID} is reserve enhance group:{reserve_enhance_info_check_result.info.GroupID}," +
                                              $"current has vh:{result.VehicleID}";
                        return(result);
                    }
                }
            }
            result = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, isAsk);
            onReserveStatusChange();

            return(result);
        }
        public HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.NESW, HltDirection forkDir = HltDirection.NESW, bool isAsk = false)
        {
            //int sec_id = 0;
            //int.TryParse(sectionID, out sec_id);
            string sec_id = SCUtility.Trim(sectionID);

            HltResult result = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, isAsk);

            onReserveStatusChange();

            return(result);
        }
Example #3
0
        public virtual HltResult TryAddVehicleOrUpdate(string vhID, string currentSectionID, double vehicleX, double vehicleY, float vehicleAngle, double speedMmPerSecond,
                                                       HltDirection sensorDir, HltDirection forkDir)
        {
            LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Debug, Class: nameof(ReserveBLL), Device: "AGV",
                          Data: $"add vh in reserve system: vh:{vhID},x:{vehicleX},y:{vehicleY},angle:{vehicleAngle},speedMmPerSecond:{speedMmPerSecond},sensorDir:{sensorDir},forkDir:{forkDir}",
                          VehicleID: vhID);
            var       hlt_vh = new HltVehicle(vhID, vehicleX, vehicleY, vehicleAngle, speedMmPerSecond, sensorDirection: sensorDir, forkDirection: forkDir, currentSectionID: currentSectionID);
            HltResult result = mapAPI.TryAddOrUpdateVehicle(hlt_vh, isKeepRestSection: false);

            onReserveStatusChange();

            return(result);
        }
Example #4
0
        public virtual HltResult TryAddReservedSection(string vhID, string sectionID,
                                                       HltDirection sensorDir       = HltDirection.ForwardReverse, HltDirection forkDir = HltDirection.None,
                                                       DriveDirction driveDirection = DriveDirction.DriveDirNone, bool isAsk            = false)
        {
            string    sec_id            = SCUtility.Trim(sectionID);
            int       vehicle_direction = getVehicleDirection(driveDirection);
            HltResult result            = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, vehicle_direction, isAsk);

            LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Info, Class: nameof(ReserveBLL), Device: "AGV",
                          Data: $"vh:{vhID} Try add reserve section:{sectionID} dir:{sensorDir},result:{result}",
                          VehicleID: vhID);
            onReserveStatusChange();

            return(result);
        }
 public override HltResult TryAddVehicleOrUpdate(string vhID, string currentSectionID, double vehicleX, double vehicleY, float vehicleAngle, double speedMmPerSecond, HltDirection sensorDir, HltDirection forkDir)
 {
     return(new HltResult(true, "By Pass Reserve"));
 }
 public override HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.NESW, HltDirection forkDir = HltDirection.None, bool isAsk = false)
 {
     return(new HltResult(true, "By Pass Reserve"));
 }
        public HltResult TryAddVehicleOrUpdate(string vhID, double vehicleX, double vehicleY, float vehicleAngle, HltDirection sensorDir = HltDirection.None, HltDirection forkDir = HltDirection.None)
        {
            //HltResult result = mapAPI.TryAddVehicleOrUpdate(vhID, vehicleX, vehicleY, vehicleAngle, sensorDir, forkDir);
            var       hlt_vh = new HltVehicle(vhID, vehicleX, vehicleY, vehicleAngle, sensorDirection: sensorDir, forkDirection: forkDir);
            HltResult result = mapAPI.TryAddOrUpdateVehicle(hlt_vh);

            onReserveStatusChange();

            return(result);
        }
Example #8
0
 public virtual HltResult TryAddReservedSection(string vhID, string sectionID,
                                                HltDirection sensorDir       = HltDirection.ForwardReverse, HltDirection forkDir = HltDirection.None,
                                                DriveDirction driveDirection = DriveDirction.DriveDirNone, bool isAsk            = false)
 {
     return(new HltResult(true, "By Pass Reserve"));
 }
        //public HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.Forward, HltDirection forkDir = HltDirection.None, bool isAsk = false)
        //{
        //    //int sec_id = 0;
        //    //int.TryParse(sectionID, out sec_id);
        //    string sec_id = SCUtility.Trim(sectionID);

        //    HltResult result = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, isAsk);
        //    onReserveStatusChange();

        //    return result;
        //}
        public HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.ForwardReverse, HltDirection forkDir = HltDirection.None, bool isAsk = false)
        {
            try
            {
                HltResult result = null;
                string    sec_id = SCUtility.Trim(sectionID);
                //如果詢問的Section是Reserve Enhance的section時,
                //則要判斷該區塊且之後的Section是否要得到
                var reserve_enhance_info_check_result = IsReserveEnhanceSection(sectionID);
                if (reserve_enhance_info_check_result.isEnhanceInfo)
                {
                    //如果車輛已經在section group內 則不需多檢查section group的section能否預約
                    AVEHICLE vh = scApp.VehicleBLL.cache.getVhByID(vhID);
                    if (vh != null)
                    {
                        var _result = IsReserveEnhanceSection(vh.CUR_SEC_ID);
                        if (!_result.isEnhanceInfo)
                        {
                            LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Info, Class: nameof(ReserveBLL), Device: "OHT",
                                          Data: $"TryAddReservedSection Vehicle is not in section group: vh:{vhID},reserve section id:{sectionID},vh cur section:{vh.CUR_SEC_ID}",
                                          VehicleID: vhID);
                            List <string> enhance_control_sections = reserve_enhance_info_check_result.info.EnhanceControlSections;
                            int           section_index            = enhance_control_sections.IndexOf(sectionID);
                            for (int i = section_index; i < enhance_control_sections.Count; i++)
                            {
                                result = mapAPI.TryAddReservedSection(vhID, enhance_control_sections[i], sensorDir, forkDir, true);
                                if (!result.OK)
                                {
                                    result.Description += $",section:{sectionID} is reserve enhance group:{reserve_enhance_info_check_result.info.GroupID}," +
                                                          $"current has vh:{result.VehicleID}";
                                    return(result);
                                }
                            }
                        }
                        else
                        {
                            LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Info, Class: nameof(ReserveBLL), Device: "OHT",
                                          Data: $"TryAddReservedSection Vehicle is in section group: vh:{vhID},reserve section id:{sectionID},vh cur section:{vh.CUR_SEC_ID}",
                                          VehicleID: vhID);
                        }
                    }
                    else
                    {
                        LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Info, Class: nameof(ReserveBLL), Device: "OHT",
                                      Data: $"TryAddReservedSection Vehicle is not found. vh:{vhID},reserve section id:{sectionID}",
                                      VehicleID: vhID);
                    }
                }
                result = mapAPI.TryAddReservedSection(vhID, sec_id, sensorDir, forkDir, isAsk);
                onReserveStatusChange();

                return(result);
            }
            catch (Exception ex)
            {
                LogHelper.Log(logger: logger, LogLevel: NLog.LogLevel.Info, Class: nameof(ReserveBLL), Device: "OHT",
                              Data: $"TryAddReservedSection have exception happen.exception:{ex.Message} vh:{vhID},reserve section id:{sectionID}",
                              VehicleID: vhID);
                return(null);
            }
            finally
            {
            }
        }