| | |
| | | using Mapster; |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | using Quartz; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Text; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Communicator; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_DTO.WMS; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ISystemServices; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | var isWorkType = commonStackerCrane.Communicator.WriteNoRead("DB100.18.0", Convert.ToInt16(1)); |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | Thread.Sleep(1000); |
| | |
| | | ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue); |
| | | var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum); |
| | | |
| | | if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | if (task == null) |
| | | { |
| | | commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | return; |
| | | } |
| | | string WorkStatus = $"ã{commonStackerCrane.StackerCraneWorkStatusValue}ã"; |
| | | bool IsWrite = false; |
| | | var content = _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | |
| | | var structs = BitConverter.GetBytes(InteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0]) |
| | | { |
| | | IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", 0); |
| | | Thread.Sleep(1000); |
| | | IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", 9999); |
| | | //IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", Convert.ToInt32(0)); |
| | | //Thread.Sleep(1000); |
| | | IsWrite = conveyorLine.Communicator.WriteNoRead("DB100.0", Convert.ToInt32(9999)); |
| | | conveyorLine.Communicator.WriteNoRead("DB100.4", Convert.ToInt16(task.TaskNum)); |
| | | if (!IsWrite) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); |
| | | if (station != null) |
| | | { |
| | | _taskService.SendAgvTask(station.stationRemark, task.TaskNum); |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | | |
| | | var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | //var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.FinishConfirm, 1); |
| | | var isWorkType = commonStackerCrane.Communicator.WriteNoRead("DB100.0", Convert.ToInt16(1)); |
| | | |
| | | |
| | | str = $"{commonStackerCrane.DeviceName}ãWMS|WCSä»»å¡å®æï¼ã{content.Status}{content.Message}ã,å åæºå®æä¿¡å·åå
¥ï¼ã{isWorkType}ã,ä»»å¡å·ï¼ã{e.TaskNum}ãæ¶é´ã{DateTime.Now}ãè¾é线åå
¥{IsWrite}"; |
| | |
| | | } |
| | | else |
| | | { |
| | | string[] sourceCodes = task.SourceAddress.Split("-"); |
| | | if (sourceCodes[0].Contains("3")) |
| | | { |
| | | var taskDto = new RequestTaskDto() |
| | | { |
| | | Position = task.SourceAddress, |
| | | PalletCode = task.PalletCode, |
| | | TaskNum = task.TaskNum |
| | | }; |
| | | |
| | | // è·åWMSipå°å |
| | | var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue; |
| | | var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.StackerIsNeedRelocation).FirstOrDefault()?.ConfigValue; |
| | | if (wmsBasez == null || requestLocation == null) |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | var wmsIpAddrss = wmsBasez + requestLocation; |
| | | |
| | | var result = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result; |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | task.ExceptionMessage = content.Message; |
| | | _taskRepository.UpdateData(task); |
| | | return null; |
| | | } |
| | | |
| | | // ååºåå任塿°æ® |
| | | var taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | |
| | | if (taskDTO.TaskNum != task.TaskNum) |
| | | { |
| | | _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | return _taskRepository.QueryFirst(x => x.TaskNum == taskDTO.TaskNum); |
| | | } |
| | | } |
| | | |
| | | CommonConveyorLine? conveyorLine = Storage.Devices.FirstOrDefault(x=>x.DeviceCode =="1001") as CommonConveyorLine; |
| | | if (conveyorLine != null) |
| | | { |
| | |
| | | else |
| | | { |
| | | task.ExceptionMessage = "è¯·æ£æ¥è¾é线æ¯å¦æ¯èªå¨æ¨¡å¼æå·²ç»ç§»å¨å°åºåºå£"; |
| | | _taskRepository.UpdateData(task); |
| | | return null; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | task.ExceptionMessage = "è¾éçº¿è®¾å¤æå¼è¿æ¥"; |
| | | _taskRepository.UpdateData(task); |
| | | return null; |
| | | } |
| | | } |
| | |
| | | |
| | | stackerCraneTaskCommand.TaskNum = Convert.ToInt16(task.TaskNum); |
| | | stackerCraneTaskCommand.WorkType = Convert.ToInt16(1); |
| | | stackerCraneTaskCommand.StartCommand = Convert.ToInt16(1); |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.CurrentAddress); |
| | | string[] sourceCodes = station.stationLocation.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | |
| | | string[] targetCodes = station.stationLocation.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |
| | |
| | | string[] sourceCodes = task.CurrentAddress.Split("-"); |
| | | if (sourceCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]); |
| | | stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]); |
| | | stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]); |
| | | } |
| | |
| | | string[] targetCodes = task.NextAddress.Split("-"); |
| | | if (targetCodes.Length == 3) |
| | | { |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]) % 2 != 0 ? (short)1 : (short)2; |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]); |
| | | } |