//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 virtual HltResult RemoveAllReservedSectionsBySectionID(string sectionID) { string sec_id = SCUtility.Trim(sectionID); HltResult result = mapAPI.RemoveAllReservedSectionsBySectionID(sec_id); onReserveStatusChange(); return(result); }
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); }
public HltResult RemoveAllReservedSectionsBySectionID(string sectionID) { //int sec_id = 0; //int.TryParse(sectionID, out sec_id); string sec_id = SCUtility.Trim(sectionID); HltResult result = mapAPI.RemoveAllReservedSectionsBySectionID(sec_id); onReserveStatusChange(); return(result); }
public virtual HltResult TryAddVehicleOrUpdate(string vhID, string adrID, float angle = 0) { var adr_obj = mapAPI.GetAddressObjectByID(adrID); var hlt_vh = new HltVehicle(vhID, adr_obj.X, adr_obj.Y, angle, sensorDirection: HltDirection.NESW); HltResult result = mapAPI.TryAddOrUpdateVehicle(hlt_vh); onReserveStatusChange(); return(result); }
public virtual HltResult TryAddVehicleOrUpdateResetSensorForkDir(string vhID) { var hltvh = mapAPI.HltVehicles.Where(vh => SCUtility.isMatche(vh.ID, vhID)).SingleOrDefault(); var clone_hltvh = hltvh.DeepClone(); clone_hltvh.SensorDirection = HltDirection.None; clone_hltvh.ForkDirection = HltDirection.None; HltResult result = mapAPI.TryAddOrUpdateVehicle(clone_hltvh); return(result); }
public HltResult TryAddVehicleOrUpdate(string vhID, string adrID) { var adr_obj = mapAPI.GetAddressObjectByID(adrID); var hlt_vh = new HltVehicle(vhID, adr_obj.X, adr_obj.Y, 0, sensorDirection: Mirle.Hlts.Utils.HltDirection.NESW); //HltResult result = mapAPI.TryAddVehicleOrUpdate(vhID, adr_obj.X, adr_obj.Y, 0, vehicleSensorDirection: Mirle.Hlts.Utils.HltDirection.NESW); HltResult result = mapAPI.TryAddOrUpdateVehicle(hlt_vh); onReserveStatusChange(); return(result); }
public virtual HltResult TryAddReservedSection(string vhID, string sectionID, HltDirection sensorDir = HltDirection.NESW, 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 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); }
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); }
private async void btn_set_vh_Click(object sender, EventArgs e) { string adr_id = cmb_adr_id.Text; string vh_id = cmb_vh_ids.Text; var map_address_axis = bcApp.SCApplication.ReserveBLL.GetHltMapAddress(adr_id); HltDirection vh_fork_dir; Enum.TryParse <HltDirection>(cmb_vh_fork_dir.SelectedValue.ToString(), out vh_fork_dir); HltDirection vh_sensor_dir; Enum.TryParse <HltDirection>(cmb_vh_sensor_dir.SelectedValue.ToString(), out vh_sensor_dir); HltResult result = null; await Task.Run(() => result = bcApp.SCApplication.ReserveBLL.TryAddVehicleOrUpdate(vh_id, "", map_address_axis.x, map_address_axis.y, 0, 0, vh_sensor_dir, vh_fork_dir)); MessageBox.Show(result.ToString()); RefreshReserveInfo(); }
private async void btn_set_vh_by_axis_Click(object sender, EventArgs e) { string vh_id = cmb_vh_ids.Text; string x_axis = txt_x.Text; string y_axis = txt_y.Text; float angle = (float)num_vh_angle.Value; double.TryParse(x_axis, out double x); double.TryParse(y_axis, out double y); HltDirection vh_fork_dir; Enum.TryParse <HltDirection>(cmb_vh_fork_dir.SelectedValue.ToString(), out vh_fork_dir); HltDirection vh_sensor_dir; Enum.TryParse <HltDirection>(cmb_vh_sensor_dir.SelectedValue.ToString(), out vh_sensor_dir); HltResult result = null; await Task.Run(() => result = bcApp.SCApplication.ReserveBLL.TryAddVehicleOrUpdate(vh_id, "", x, y, angle, 0, vh_sensor_dir, vh_fork_dir)); MessageBox.Show(result.ToString()); }
private async void btn_reserve_section_Click(object sender, EventArgs e) { string vh_id = cmb_vh_ids.Text; string sec_id = cmb_reserve_section.Text.Trim(); HltDirection fork_dir; Enum.TryParse <HltDirection>(cmb_fork_dir.SelectedValue.ToString(), out fork_dir); HltDirection sensor_dir; Enum.TryParse <HltDirection>(cmb_sensor_dir.SelectedValue.ToString(), out sensor_dir); HltResult result = null; await Task.Run(() => result = bcApp.SCApplication.ReserveBLL.TryAddReservedSection(vh_id, sec_id, sensor_dir, fork_dir)); //await Task.Run(() => //{ // result = bcApp.SCApplication.ReserveBLL.TryAddReservedSection(vh_id, "0025", sensor_dir, fork_dir); // result = bcApp.SCApplication.ReserveBLL.TryAddReservedSection(vh_id, "0024", sensor_dir, fork_dir); //}); MessageBox.Show(result.ToString()); RefreshReserveInfo(); }
//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 { } }
public static com.mirle.ibg3k0.sc.BLL.ReserveCheckResult ToReserveCheckResult(this HltResult result) { return(new com.mirle.ibg3k0.sc.BLL.ReserveCheckResult(result.OK, result.VehicleID, result.SectionID, result.Description)); }