| | |
| | | |
| | | using Autofac.Core; |
| | | using AutoMapper; |
| | | using HslCommunication; |
| | | using Magicodes.ExporterAndImporter.Core; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.AspNetCore.Mvc.RazorPages; |
| | |
| | | private readonly ITask_HtyService _task_HtyService; |
| | | private readonly IMapper _mapper; |
| | | private readonly IEquipmentStatusService _equipmentStatus; |
| | | private readonly IAgvStationService _gvStationService; |
| | | |
| | | |
| | | private Dictionary<string, OrderByType> _taskOrderBy = new() |
| | |
| | | |
| | | public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList(); |
| | | |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService, IRouterRepository routerRepository, IEquipmentStatusService equipmentStatus) : base(BaseDal) |
| | | public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ITask_HtyService task_HtyService, IRouterRepository routerRepository, IEquipmentStatusService equipmentStatus, IAgvStationService agvStationService) : base(BaseDal) |
| | | { |
| | | _routerService = routerService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _mapper = mapper; |
| | | _routerRepository = routerRepository; |
| | | _equipmentStatus = equipmentStatus; |
| | | _gvStationService = agvStationService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | else if (item.type == 2) //åºåº |
| | | { |
| | | string roadway = ""; |
| | | string CurrentAddress = ""; |
| | | switch (item.startAddress) |
| | | { |
| | | case "1": |
| | | roadway = "RGV110"; |
| | | CurrentAddress = "1101"; |
| | | break; |
| | | case "2": |
| | | roadway = "RGV112"; |
| | | CurrentAddress = "1121"; |
| | | break; |
| | | case "3": |
| | | roadway = "RGV114"; |
| | | CurrentAddress = "1141"; |
| | | break; |
| | | case "4": |
| | | roadway = "RGV115"; |
| | | CurrentAddress = "1151"; |
| | | break; |
| | | } |
| | | |
| | | AGVStation gVStation = _gvStationService.Corridorequipment(roadway); |
| | | |
| | | Dt_Task dt_Task = new Dt_Task(); |
| | | dt_Task.TaskNum = item.taskNo; |
| | |
| | | dt_Task.RGVCurrentexecution = "0"; //ç®åææ |
| | | dt_Task.TaskState = (int)TaskOutStatusEnum.OutNew; //ç®åææ |
| | | dt_Task.SourceAddress = item.startAddress; |
| | | dt_Task.TargetAddress = ""; |
| | | dt_Task.CurrentAddress = CurrentAddress; |
| | | dt_Task.NextAddress = "0"; //ç®åææ |
| | | dt_Task.TargetAddress ="0"; |
| | | dt_Task.CurrentAddress = gVStation.Motherinlaw.ToString(); |
| | | dt_Task.NextAddress = gVStation.ZicheMotherinlaw.ToString(); //ç®åææ |
| | | dt_Task.Grade = item.priority; |
| | | dt_Task.WMSId = 0; //ç®åææ |
| | | BaseDal.AddData(dt_Task); |
| | |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode, TaskOrderBy); |
| | | } |
| | | |
| | | public Dt_Task ChildVehicleMission(AGVStation aGVStation) |
| | | { |
| | | Dt_Task dt_Tasks =BaseDal.QueryFirst(x => x.Roadway == aGVStation.ChildPosiDeviceCode && x.CurrentAddress== aGVStation.MotherCarDeviceCode.ToString() && x.RGVTaskType== (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy); |
| | | if(dt_Tasks !=null) return dt_Tasks; |
| | | Dt_Task dt_Tasks2 = BaseDal.QueryFirst(x => x.Roadway == aGVStation.ChildPosiDeviceCode && x.CurrentAddress == aGVStation.MotherCardeputy.ToString() && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy); |
| | | if (dt_Tasks2 != null) return dt_Tasks2; |
| | | Dt_Task dt_Tasks3 = BaseDal.QueryFirst(x => x.Roadway == aGVStation.ChildPosiDeviceCode && x.CurrentAddress == aGVStation.HCJStorageaddress.ToString() && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy); |
| | | if (dt_Tasks3 != null) return dt_Tasks3; |
| | | return null; |
| | | } |
| | | public Dt_Task GetFinhuoTask(string DeviceCode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskOutStatusEnum.RGV_OutZicheFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.Placing, TaskOrderBy); |
| | | } |
| | | |
| | | public Dt_Task GetOutkouFinhuoTask(string DeviceCode,string curraderr,int type) |
| | | { |
| | | if (type == 1) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskOutStatusEnum.RGV_OutZicheReleaseFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp && x.CurrentAddress == curraderr, TaskOrderBy); |
| | | } |
| | | else |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskOutStatusEnum.RGV_OutPickupFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.Placing && x.NextAddress !="", TaskOrderBy); |
| | | } |
| | | } |
| | | |
| | | public Dt_Task GetInkouFinhuoTask(string DeviceCode,int type) |
| | | { |
| | | if (type == 1) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InNew && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy); |
| | | } |
| | | else |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InPickupFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.Placing, TaskOrderBy); |
| | | } |
| | | } |
| | | |
| | | public Dt_Task GetInzicheTask(string DeviceCode, int type) |
| | | { |
| | | if (type == 1) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InReleaseFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.PickingUp, TaskOrderBy); |
| | | } |
| | | else |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InZicheFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.Placing, TaskOrderBy); |
| | | } |
| | | } |
| | | public Dt_Task GetInzicheTaskMobile(string DeviceCode, int type) |
| | | { |
| | | if (type == 1) //1为å车移å¨ä»»å¡ 2为æ¯è½¦ç§»å¨ä»»å¡ |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InZicheReleaseFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly, TaskOrderBy); |
| | | } |
| | | else |
| | | { |
| | | return BaseDal.QueryFirst(x => x.Roadway == DeviceCode && x.TaskState == (int)TaskInStatusEnum.RGV_InZichemoveFinish && x.RGVTaskType == (int)RGVTaskTypeEnum.TravelingOnly, TaskOrderBy); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent UpdateRGVTasktype(int taskNum, int RGVTasktype) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |