| | |
| | | using WIDESEAWCS_ISystemServices; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_Model.Models.System; |
| | | using WIDESEAWCS_QuartzJob; |
| | |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IRouterService _routerService; |
| | | private readonly IDt_PlatformStationService _DtPlatformStationService; |
| | | private readonly IDt_roadwayinfoService _Dt_roadwayinfoService; |
| | | |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService) |
| | | public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IDt_roadwayinfoService dt_roadwayinfoService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _routerService = routerService; |
| | | _DtPlatformStationService = dt_PlatformStationService; |
| | | _Dt_roadwayinfoService = dt_roadwayinfoService; |
| | | } |
| | | private static readonly Dictionary<string, bool> _deviceLastStatus = new Dictionary<string, bool>(); |
| | | public string urlWMSdeverror = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSdeverror"]; |
| | | private static readonly StackerFault[] _stackerFaultEnumCache = Enum.GetValues(typeof(StackerFault)).Cast<StackerFault>().ToArray(); |
| | | // ç¨æ¥è®°å½åªäºä»»å¡å·²ç»ä¸æ¥è¿æ¾è´§ä¸ |
| | | private static readonly HashSet<int> _reportedPickupTaskIds = new HashSet<int>(); |
| | | |
| | | |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | WebResponseContent webResponse = _taskService.StackCraneTaskCompleted(commonStackerCrane.CurrentTaskNum, PalletCode); |
| | | if (webResponse.Status) |
| | | { |
| | | Task.Run(() => WriteLog.Write_Log("å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", "å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", $"ã{commonStackerCrane.DeviceCode}ãåºå åæºä¸æ¥ä»»å¡å·:ã{commonStackerCrane.CurrentTaskNum}ãå®æä¿¡å·ï¼")); |
| | | WriteLog.Write_Log("å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", "å åæºä»»å¡ä¸æ¥å®æä¿¡æ¯", $"ã{commonStackerCrane.DeviceCode}ãåºå åæºä¸æ¥ä»»å¡å·:ã{commonStackerCrane.CurrentTaskNum}ãå®æä¿¡å·ï¼"); |
| | | |
| | | bool ddjfk = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | CommonConveyorLine? conveyorLine = null; |
| | | lock (Storage.Devices) |
| | | { |
| | | CommonConveyorLine? conveyorLine = null; |
| | | 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 == NextAddress && x.DeviceProParamName == "StationNum"); |
| | |
| | | { |
| | | |
| | | 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"); |
| | |
| | | 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; |
| | | return StationNum == 1; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | var dtTask = _taskRepository.QueryFirst(x => x.TaskNum == taskNum); |
| | | if (dtTask == null) return; |
| | | //å åæºæ¾è´§ä¸æ¯ä»»å¡ç¶æåè°æ¿pickup |
| | | // ===================== åºåºæ¾è´§ä¸ï¼åªä¸æ¥1次 ===================== |
| | | if (dtTask.TaskType == (int)TaskTypeEnum.Inbound && stackerCraneWorkStatusDes == "æ¾è´§ä¸") |
| | | { |
| | | // 夿æ¯å¦å·²ç»ä¸æ¥è¿ |
| | | if (_reportedPickupTaskIds.Contains(taskNum)) |
| | | { |
| | | return; // 已䏿¥ï¼ç´æ¥è·³è¿ |
| | | } |
| | | // ç¬¬ä¸æ¬¡ä¸æ¥ |
| | | string Result = WMSTaskStatusEnum.pickup.GetDescription(); |
| | | Dt_roadwayinfo roadwayinfo = _Dt_roadwayinfoService.GetRoadwayinfo(dtTask.Roadway); |
| | | CommandResult command = _taskService.taskreturn(int.Parse(dtTask.WMStaskid), Result, roadwayinfo.WarehouseInvType, ""); |
| | | |
| | | // æ è®°ä¸ºå·²ä¸æ¥ |
| | | _reportedPickupTaskIds.Add(taskNum); |
| | | } |
| | | // ä»»å¡å®ææ¶æ¸
çè®°å½ |
| | | if (stackerCraneWorkStatusDes == "ä»»å¡å®æ") |
| | | { |
| | | _reportedPickupTaskIds.Remove(taskNum); |
| | | } |
| | | string[] targets = { "G02", "G03", "G04", "C02", "C01" }; |
| | | if (dtTask.TaskType != 100 || !targets.Contains(dtTask.TargetAddress)) return; |
| | | |
| | |
| | | |
| | | conveyorLine.Communicator.Write<short>(handShake.DeviceProAddress, writeValue); |
| | | } |
| | | catch |
| | | { } |
| | | catch(Exception e) |
| | | { |
| | | WriteLog.Write_Log("åºåºå±è½å
æ
/å åå
¥åºè¦æ¾è´§å¼å¸¸", "é误", e.ToString()); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 读åæ
éï¼ä¼åGCï¼ |
| | | /// æ
éä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="crane"></param> |
| | | /// <returns></returns> |
| | | public string ReadStackerFaults(CommonStackerCrane crane) |
| | | { |
| | | try |
| | | { |
| | | foreach (StackerFault fault in Enum.GetValues(typeof(StackerFault))) |
| | | foreach (StackerFault fault in _stackerFaultEnumCache) |
| | | { |
| | | try |
| | | { |
| | |
| | | if (isFault) |
| | | return fault.GetDesc(); |
| | | } |
| | | catch { } |
| | | catch { continue; } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteLog.Write_Log("DB107æ
é读åå¼å¸¸", "é误", ex.ToString()); |
| | | } |
| | | catch { } |
| | | return string.Empty; |
| | | } |
| | | } |