| | |
| | | 锘縰sing HslCommunication; |
| | | using Mapster; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_Common; |
| | |
| | | using WIDESEAWCS_Model.BasicInfo; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | |
| | | case 2: |
| | | case 3: |
| | | RequestInOrOutbound(command, conveyorLine, stationManager, task); |
| | | RequestNextAddress(command, conveyorLine, stationManager, task); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | public void HandleFinishTaskAsync(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, Dt_Task task=null) |
| | | { |
| | | var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationPLC == conveyorLine.DeviceCode); |
| | | |
| | | switch (stationManager.stationType) |
| | | { |
| | | case 4: |
| | | case 5: |
| | | ConveyorLineInOrOutFinish(conveyorLine, command, stationManager, task); |
| | | break; |
| | | case 7: |
| | | ConveyorLineOutFinish(conveyorLine, command, stationManager, task); |
| | | task = _taskService.QueryConveyorLineFinishTask(stationManager.stationChildCode, command.TaskNum); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | |
| | | var RGVName = string.Empty; |
| | | if (stationManager.stationFloor == "1F") |
| | | { |
| | | var RGVOne = _taskRepository.QueryData(x => x.RGVName == "RGV01").ToList(); |
| | | var RGVTwo = _taskRepository.QueryData(x => x.RGVName == "RGV02").ToList(); |
| | | if (RGVOne.Count > RGVTwo.Count) |
| | | var deviceCode = _deviceInfoRepository.Db.Queryable<Dt_DeviceInfo>().Where(x => x.DeviceStatus == "1" && x.DeviceRemark == "1F").Where(x => x.DeviceCode.Contains("RGV")).ToList().Select(x => x.DeviceCode).ToList(); |
| | | if (deviceCode != null && deviceCode.Count() > 0) |
| | | { |
| | | RGVName = "RGV01"; |
| | | if (deviceCode.Contains("RGV01") && deviceCode.Contains("RGV02")) |
| | | { |
| | | var RGVOne = _taskRepository.QueryData(x => x.RGVName == "RGV01").ToList(); |
| | | var RGVTwo = _taskRepository.QueryData(x => x.RGVName == "RGV02").ToList(); |
| | | if (RGVOne.Count > RGVTwo.Count) |
| | | { |
| | | RGVName = "RGV01"; |
| | | } |
| | | else |
| | | { |
| | | RGVName = "RGV02"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | RGVName = deviceCode[0]; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | RGVName = "RGV02"; |
| | | RGVName = "RGV01"; |
| | | } |
| | | } |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | else |
| | | { |
| | | TaskNum = _taskRepository.GetTaskNo().Result, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | SourceAddress = childDeviceCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, // 璁剧疆榛樿浼樺厛绾т负1 |
| | | Creater = "System", |
| | | Floor = stationManager.stationFloor, |
| | | RGVName = stationManager.RGVName != null ? stationManager.RGVName : RGVName, |
| | | }; |
| | | RGVName = "RGV03"; |
| | | } |
| | | |
| | | |
| | | Dt_Task task = new Dt_Task() |
| | | { |
| | | TaskNum = _taskRepository.GetTaskNo().Result, |
| | | TaskType = (int)TaskInboundTypeEnum.Inbound, |
| | | TaskState = (int)TaskInStatusEnum.InNew, |
| | | SourceAddress = childDeviceCode, |
| | | Dispatchertime = DateTime.Now, |
| | | Grade = 1, // 璁剧疆榛樿浼樺厛绾т负1 |
| | | Creater = "System", |
| | | Floor = stationManager.stationFloor, |
| | | RGVName = stationManager.RGVName != null ? stationManager.RGVName : RGVName, |
| | | }; |
| | | _taskRepository.AddData(task); |
| | | } |
| | | } |