| | |
| | | using HslCommunication; |
| | | using Microsoft.AspNetCore.Components.Routing; |
| | | using Microsoft.AspNetCore.Hosting; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Diagnostics.CodeAnalysis; |
| | | using System.Diagnostics.Eventing.Reader; |
| | | using System.DirectoryServices.Protocols; |
| | | using System.IO.Ports; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Reflection.Metadata; |
| | | using System.Security.Cryptography.Xml; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Transactions; |
| | | using WIDESEA_Comm.Http; |
| | | using WIDESEA_Common.Log; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_DTO.TaskInfo; |
| | | using WIDESEAWCS_ISystemServices; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_QuartzJob.StackerCrane.Enum; |
| | | using WIDESEAWCS_TaskInfoService; |
| | | using WIDESEAWCS_Tasks.StackerCraneJob; |
| | | using static WIDESEAWCS_Model.Models.System.JobError; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _DtPlatformStationService= dt_PlatformStationService; |
| | | _DtPlatformStationService = dt_PlatformStationService; |
| | | } |
| | | private static readonly Dictionary<string, bool> _deviceLastStatus = new Dictionary<string, bool>(); |
| | | public string urlWMSdeverror = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSdeverror"]; |
| | | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | | { |
| | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | | WriteLog.Write_Log("å åæºå½åç¶æä¿¡æ¯", $"{commonStackerCrane.DeviceCode}åºå åæºå½åç¶æ", |
| | | $"å åæºè®¾å¤ç¶æå°å:ãDB105.2.0ã,读åçæ°æ®ï¼ã{commonStackerCrane.StackerCraneAutoStatusDes}ã\n" + |
| | | $"å åæºå·¥ä½æ¨¡å¼å°å:ãDB105.3.0ã,读åçæ°æ®ï¼ã{commonStackerCrane.StackerCraneStatusDes}ã\n" + |
| | | $"å åæºä½ä¸ç¶æå°å:ãDB105.22.0ã,读åçæ°æ®ï¼ã{commonStackerCrane.StackerCraneWorkStatusDes}ã\n" + |
| | | $"å åæºå½å任塿§è¡ä¸å°å:ãDB105.18.0ã,读åçæ°æ®ï¼ã{commonStackerCrane.CurrentTaskNum}ã\n"); |
| | | // è·åå½åç¶æ |
| | | bool isFaultNow = commonStackerCrane.StackerCraneStatusDes.Equals("æ
é"); |
| | | string deviceCode = commonStackerCrane.DeviceCode; |
| | | |
| | | if (!_deviceLastStatus.ContainsKey(deviceCode)) |
| | | { |
| | | _deviceLastStatus[deviceCode] = isFaultNow; |
| | | if (isFaultNow) |
| | | { |
| | | SendDevError(commonStackerCrane, "66", "start", ReadStackerFaults(commonStackerCrane)); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | bool lastStatus = _deviceLastStatus[deviceCode]; |
| | | if (!lastStatus && isFaultNow) |
| | | { |
| | | SendDevError(commonStackerCrane, "66", "start", ReadStackerFaults(commonStackerCrane)); |
| | | _deviceLastStatus[deviceCode] = true; |
| | | } |
| | | else if (lastStatus && !isFaultNow) |
| | | { |
| | | SendDevError(commonStackerCrane, "99", "stop", "å åæºæ¢å¤æ£å¸¸"); |
| | | _deviceLastStatus[deviceCode] = false; |
| | | } |
| | | } |
| | | |
| | | UpdateHandShake(commonStackerCrane.CurrentTaskNum, commonStackerCrane.StackerCraneWorkStatusDes); |
| | | //ä»»å¡å®æStackerCraneWorkStatus |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.WorkCompleted) |
| | | { |
| | |
| | | Dt_Task? currtask = _taskService.CurrtaskInfo(commonStackerCrane.CurrentTaskNum); |
| | | if(currtask != null) |
| | | { |
| | | string PalletCode = ""; |
| | | //夿任å¡ç±»å |
| | | if(currtask.TaskType== (int)TaskTypeEnum.Inventorybound) |
| | | if (currtask.TaskType== (int)TaskTypeEnum.Inventorybound) |
| | | { |
| | | //è¯»åæ¡ç ï¼è¿è¡é
对 |
| | | |
| | | |
| | | DeviceProDTO? deviceProDTO = commonStackerCrane.DeviceProDTOs.FirstOrDefault(x => x.DeviceProParamName == "SCBarcode"); |
| | | byte[] bytes = commonStackerCrane.Communicator.Read(deviceProDTO.DeviceProAddress, 64); |
| | | string result = Encoding.ASCII.GetString(bytes).Replace(" ", ""); |
| | | |
| | | bool pandianBort = false; |
| | | if(currtask.PalletCode== result) pandianBort= true; |
| | | |
| | | //读åçæçæ¡ç |
| | | PalletCode = Encoding.ASCII.GetString(bytes).Replace(" ", ""); |
| | | } |
| | | |
| | | WebResponseContent webResponse = _taskService.StackCraneTaskCompleted(commonStackerCrane.CurrentTaskNum); |
| | | Console.WriteLine(webResponse.ToJsonString()); |
| | | WebResponseContent webResponse = _taskService.StackCraneTaskCompleted(commonStackerCrane.CurrentTaskNum, PalletCode); |
| | | if (webResponse.Status) |
| | | { |
| | | Task.Run(() => WriteLog.Write_Log("å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", "å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", $"ã{commonStackerCrane.DeviceCode}ãåºå åæºä¸æ¥ä»»å¡å·:ã{commonStackerCrane.CurrentTaskNum}ãå®æä¿¡å·ï¼")); |
| | | |
| | | |
| | | bool ddjfk = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | bool ddjfk = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | if (commonStackerCrane.StackerCraneAutoStatusValue == StackerCraneAutoStatus.Automatic && commonStackerCrane.StackerCraneStatusValue == StackerCraneStatus.Normal) |
| | | { |
| | | |
| | | if (commonStackerCrane.StackerCraneWorkStatusValue == StackerCraneWorkStatus.Standby) |
| | | { |
| | | |
| | | |
| | | Dt_Task? task = GetTask(commonStackerCrane); |
| | | if (task != null) |
| | |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine(nameof(CommonStackerCraneJob) + ":" + ex.ToString()); |
| | | WriteLog.Write_Log("å åæºæ¥éä¿¡æ¯", "å åæºæ¥éä¿¡æ¯", $"å åæºæ¥éä¿¡æ¯ï¼ã{ex.ToString()}ã"); |
| | | |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®æäºä»¶è®¢é
çæ¹æ³ |
| | | /// æ
é䏿¥ï¼æ¹ä¸ºawaitè°ç¨ï¼ä¿®å¤å¼æ¥BUGï¼ |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void CommonStackerCrane_StackerCraneTaskCompletedEventHandler(object? sender, WIDESEAWCS_QuartzJob.StackerCrane.StackerCraneTaskCompletedEventArgs e) |
| | | public void SendDevError(CommonStackerCrane crane, string errorcode, string dealType, string errorInfo = "") |
| | | { |
| | | CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane; |
| | | if (commonStackerCrane != null) |
| | | CommandResult commandResult = new CommandResult(); |
| | | try |
| | | { |
| | | if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5 && e.TaskNum !=0) |
| | | DeviceErrorRequest deviceErrorRequest = new DeviceErrorRequest |
| | | { |
| | | //Console.Out.WriteLine("TaskCompleted" + e.TaskNum); |
| | | _taskService.StackCraneTaskCompleted(e.TaskNum); |
| | | commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | | devErrorJsons = new List<DeviceErrorInfo> |
| | | { |
| | | new DeviceErrorInfo |
| | | { |
| | | devuuid = crane.DeviceCode, |
| | | id = "", |
| | | errorcode = errorcode, |
| | | errorinfo = errorInfo, |
| | | erroraddress = "DB107", |
| | | warehouse = crane.DeviceCode == "B" ? "ZR17":(crane.DeviceCode == "G"?"ZR18":"ZR16"), |
| | | remark = dealType == "start" ? "设å¤å¼å¸¸" : "è®¾å¤æ¢å¤", |
| | | devname = $"{crane.DeviceCode}åºå åæº", |
| | | } |
| | | }, |
| | | dealType = dealType, |
| | | psd = "akjfapjfpadaoif", |
| | | }; |
| | | |
| | | commandResult = HttpHelper.Post<CommandResult>(urlWMSdeverror, deviceErrorRequest, "è®¾å¤æ
éåè°"); |
| | | WriteLog.Write_Log("忥ç»ä¸æ¸¸è®¾å¤æ
éä¿¡æ¯", "è®¾å¤æ
éä¿¡æ¯", $"设å¤idï¼ã{crane.DeviceCode}ãï¼æå", $"设å¤åè°ç¶æï¼ã{dealType}ãï¼å¼å¸¸ä¿¡æ¯ï¼ã{errorInfo}ã\n" + |
| | | $"è°ç¨ä¸æ¸¸è¿åç»æä¿¡æ¯ï¼ã{commandResult?.ToJsonString() ?? "è¿åç»æä¸ºnull"}ã"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("æ
é䏿¥å¤±è´¥", "é误", ex.ToString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// è·åä»»å¡ |
| | |
| | | return taskItem; |
| | | } |
| | | } |
| | | else if (taskItem.TaskType == (int)TaskTypeEnum.Inbound || taskItem.TaskType == (int)TaskTypeEnum.Inventorybound) |
| | | else if ((InTaskStationIsOccupied(taskItem.SourceAddress, taskItem.Roadway) && taskItem.TaskType == (int)TaskTypeEnum.Inbound) || taskItem.TaskType == (int)TaskTypeEnum.Inventorybound) |
| | | { |
| | | |
| | | return taskItem; |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | if (Roadway == "C") |
| | | CommonConveyorLine? conveyorLine = null; |
| | | lock (Storage.Devices) |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1004"); |
| | | if (device == null) return false; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | if (StationNum == 0 && HandShake == 0 && Roadway == "C") |
| | | { |
| | | return true; |
| | | } |
| | | string deviceCode = Roadway == "C" ? "1004" : "1003"; |
| | | conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceCode) as CommonConveyorLine; |
| | | } |
| | | else |
| | | { |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1003"); |
| | | if (device == null) return false; |
| | | CommonConveyorLine conveyorLine = (CommonConveyorLine)device; |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | if (conveyorLine == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | if ((StationNum == 1 && HandShake == 0 && Roadway == "B") || (StationNum == 0 && HandShake == 0 && Roadway != "B")) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | |
| | | WriteLog.Write_Log("åºåºåºå£ç¶æä¿¡æ¯", "åºåºåºå£ç¶æä¿¡æ¯", $"åºå£æ¯ã{NextAddress}ãï¼ç³è¯·ç¶æå°åï¼ã{HandShakeprodto.DeviceProAddress}ã,读åçæ°æ®ï¼ã{HandShake}ã\nåºå£æ¯å¦æè´§ç¶æå°åï¼ã{deviceProDTO.DeviceProAddress}ãï¼è¯»åçæ°æ®ã{StationNum}ã"); |
| | | if (Roadway == "C" || Roadway == "G") return StationNum == 0 && HandShake == 0; |
| | | return (StationNum == 1 && HandShake == 0 && Roadway == "B"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine("读åç«å°ä¿¡æ¯é误ï¼"+ex.Message); |
| | | Console.WriteLine("读åç«å°ä¿¡æ¯é误ï¼" + ex.Message); |
| | | return false; |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | /// <summary> |
| | | /// å
¥åºä»»å¡åºå£æè´§æ è´§ç¶æ |
| | | /// </summary> |
| | | public bool InTaskStationIsOccupied(string SourceAddress, string Roadway) |
| | | { |
| | | try |
| | | { |
| | | |
| | | CommonConveyorLine? conveyorLine = null; |
| | | lock (Storage.Devices) |
| | | { |
| | | string deviceCode = Roadway == "C" ? "1004" : "1003"; |
| | | conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceCode) as CommonConveyorLine; |
| | | } |
| | | if (conveyorLine == null) return false; |
| | | |
| | | DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SourceAddress && x.DeviceProParamName == "StationNum"); |
| | | DeviceProDTO? HandShakeprodto = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SourceAddress && x.DeviceProParamName == "HandShake"); |
| | | if (deviceProDTO == null || HandShakeprodto == null) return false; |
| | | |
| | | int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress); |
| | | int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress); |
| | | WriteLog.Write_Log("å
¥åºåºå£ç¶æä¿¡æ¯", "å
¥åºåºå£ç¶æä¿¡æ¯", $"åºå£æ¯ã{SourceAddress}ãï¼ç³è¯·ç¶æå°åï¼ã{HandShakeprodto.DeviceProAddress}ã,读åçæ°æ®ï¼ã{HandShake}ã\nåºå£æ¯å¦æè´§ç¶æå°åï¼ã{deviceProDTO.DeviceProAddress}ãï¼è¯»åçæ°æ®ã{StationNum}ã"); |
| | | return (StationNum == 1 && HandShake == 0) ? true : false; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.WriteLine("读åç«å°ä¿¡æ¯é误ï¼" + ex.Message); |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// ä»»å¡å®ä½è½¬æ¢æå½ä»¤Model |
| | |
| | | { |
| | | StackerCraneTaskCommand stackerCraneTaskCommand = new StackerCraneTaskCommand(); |
| | | |
| | | |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 0; |
| | | if (task.Roadway == "B" || task.Roadway == "C") |
| | | { |
| | | //夿 task.PalletCode æ¯ä¸æ¯ä¸ä¸ªææç GUID |
| | | stackerCraneTaskCommand.Barcode = stackerCraneTaskCommand.Barcode = Guid.TryParse(task.PalletCode, out var guid) ? guid.ToString("N")[0..6] : task.PalletCode; |
| | | } |
| | | else if (task.Roadway == "G" ) |
| | | { |
| | | if (Guid.TryParse(task.PalletCode, out var palletGuid)) |
| | | { |
| | | stackerCraneTaskCommand.Barcode = palletGuid.ToString("N")[0..6]; |
| | | |
| | | // æ åGUIDå°±æ¯36ä½ï¼æä»¥ç´æ¥å¤æé¿åº¦å³å¯ |
| | | stackerCraneTaskCommand.TrayType = (short)(task.PalletCode.Length == 36 ? 1 : 2); |
| | | } |
| | | else |
| | | { |
| | | stackerCraneTaskCommand.Barcode = task.PalletCode; |
| | | stackerCraneTaskCommand.TrayType = 2; |
| | | } |
| | | } |
| | | |
| | | if (task.TaskType == (int)TaskTypeEnum.Inbound)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | //è·åç«å°ç¼å· |
| | | Dt_PlatformStation dt_Platform=_DtPlatformStationService.getStatiomInfo(task.SourceAddress); |
| | | |
| | | Dt_PlatformStation dt_Platform = _DtPlatformStationService.getStatiomInfo(task.SourceAddress); |
| | | string[] targetCodest = dt_Platform.Station_storey.Split("-"); |
| | | if (targetCodest.Length == 3) |
| | | { |
| | |
| | | string EndRow = EndCodest[0].Substring(1); |
| | | string SCEndRow = LaneModification(task.Roadway, int.Parse(EndRow)); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(SCEndRow ); |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(SCEndRow); |
| | | stackerCraneTaskCommand.EndColumn = Convert.ToInt16(EndCodest[1]); |
| | | stackerCraneTaskCommand.EndLayer = Convert.ToInt16(EndCodest[2]); |
| | | } |
| | |
| | | if (EndCodest.Length == 3) |
| | | { |
| | | string EndRow = EndCodest[0].Substring(1); |
| | | string SCEnRow=LaneModification(task.Roadway,int.Parse(EndRow)); |
| | | string SCEnRow = LaneModification(task.Roadway, int.Parse(EndRow)); |
| | | |
| | | stackerCraneTaskCommand.EndRow = Convert.ToInt16(SCEnRow); |
| | | stackerCraneTaskCommand.EndColumn = (short)(Convert.ToInt16(EndCodest[1]) + 1); |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | |
| | | //æ°æ®é
ç½®é误 |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"ç§»åºä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"çç¹ä»»å¡èµ·ç¹é误ï¼èµ·ç¹ï¼ã{task.CurrentAddress}ã"); |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | return stackerCraneTaskCommand; |
| | | } |
| | |
| | | return SCRow.ToString(); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// çæµGåºãCåºåºåºæ¾è´§æ¶å±è½å
æ
|
| | | /// </summary> |
| | | /// <param name="taskNum"></param> |
| | | /// <param name="stackerCraneWorkStatusDes"></param> |
| | | public void UpdateHandShake(int taskNum, string stackerCraneWorkStatusDes) |
| | | { |
| | | try |
| | | { |
| | | var dtTask = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (dtTask == null) return; |
| | | |
| | | string[] targets = { "G02", "G03", "G04", "C02", "C01" }; |
| | | if (dtTask.TaskType != 100 || !targets.Contains(dtTask.TargetAddress)) return; |
| | | |
| | | short writeValue = stackerCraneWorkStatusDes switch |
| | | { |
| | | "æ¾è´§ä¸" => 1, |
| | | "ä»»å¡å®æ" => 0, |
| | | _ => -1 |
| | | }; |
| | | if (writeValue == -1) return; |
| | | |
| | | CommonConveyorLine? conveyorLine = null; |
| | | lock (Storage.Devices) |
| | | { |
| | | string deviceCode = dtTask.CurrentAddress.StartsWith("C") ? "1004" : "1003"; |
| | | conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceCode) as CommonConveyorLine; |
| | | } |
| | | if (conveyorLine == null) return; |
| | | |
| | | var handShake = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == dtTask.TargetAddress && x.DeviceProParamName == "HandShake"); |
| | | if (handShake == null) return; |
| | | |
| | | conveyorLine.Communicator.Write<short>(handShake.DeviceProAddress, writeValue); |
| | | } |
| | | catch |
| | | { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读åæ
éï¼ä¼åGCï¼ |
| | | /// </summary> |
| | | public string ReadStackerFaults(CommonStackerCrane crane) |
| | | { |
| | | try |
| | | { |
| | | foreach (StackerFault fault in Enum.GetValues(typeof(StackerFault))) |
| | | { |
| | | try |
| | | { |
| | | bool isFault = crane.Communicator.Read<bool>(fault.ToPlcAddress()); |
| | | if (isFault) |
| | | return fault.GetDesc(); |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("DB107æ
é读åå¼å¸¸", "é误", ex.ToString()); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | } |
| | | } |