| | |
| | | #endregion 站台方式 |
| | | |
| | | #region 路由方式 |
| | | |
| | | List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | DateTime dateTime = DateTime.Now; |
| | | Console.WriteLine($"循环开始时间{dateTime}"); |
| | | |
| | | foreach (string childDeviceCode in childDeviceCodes) |
| | | { |
| | | //Thread.Sleep(1000); |
| | | //if (childCodeList.Contains(childDeviceCode)) |
| | | //{ |
| | | // Console.WriteLine($"当前{childDeviceCode}执行中,已跳过"); |
| | | // continue; |
| | | //} |
| | | //childCodeList.Add(childDeviceCode); |
| | | //Console.WriteLine(childDeviceCode); |
| | | |
| | | ConveyorLineTaskCommand_After command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(childDeviceCode); |
| | | |
| | | if (command == null) continue; |
| | |
| | | } |
| | | } |
| | | |
| | | //childCodeList.Remove(childDeviceCode); |
| | | |
| | | #region 调用事件总线通知前端 |
| | | |
| | |
| | | #endregion 调用事件总线通知前端 |
| | | |
| | | } |
| | | DateTime ENDdateTime = DateTime.Now; |
| | | Console.WriteLine($"循环结束时间{ENDdateTime}"); |
| | | |
| | | #endregion 路由方式 |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Console.Out.WriteLine(nameof(CommonConveyorLine_CWJob) + ":" + DateTime.Now + ":" + ex.ToString()); |
| | | Console.Out.WriteLine(nameof(CommonConveyorLine_CWJob) + ":" + DateTime.Now + ":" + ex.ToString(),ex.StackTrace); |
| | | } |
| | | finally |
| | | { |
| | | //WriteDebug("CommonConveyorLineJob", "test"); |
| | | //Console.Out.WriteLine(DateTime.Now); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | | conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode); |
| | | content = _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationArea == "Call" && x.stationType == 12); |
| | | CommonConveyorLine_BZ? commonConveyorBZ=Storage.Devices.FirstOrDefault(x=>x.DeviceCode==station.stationPLC) as CommonConveyorLine_BZ; |
| | | if (commonConveyorBZ != null) |
| | | { |
| | | ConveyorLineTaskCommand_After readSignal = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationLocation); |
| | | if (readSignal.Reserved5 == 1) |
| | | { |
| | | var tasks = _taskRepository.QueryData(x => x.TargetAddress == childDeviceCode); |
| | | if (tasks.Count == 0) |
| | | { |
| | | commonConveyorBZ.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), station.stationLocation); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | |
| | | } |
| | | } |
| | | |
| | | //conveyorLine.SendCommand(taskCommand, childDeviceCode); |
| | | |
| | | bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); |
| | | if (sendFlag) |
| | | { |
| | |
| | | |
| | | taskNext.ExceptionMessage = log; |
| | | content = _taskService.UpdateTaskStatusToNext(taskNext); |
| | | } |
| | | var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == childDeviceCode && x.stationArea == "Call" && x.stationType == 12); |
| | | CommonConveyorLine_BZ? commonConveyorBZ = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC) as CommonConveyorLine_BZ; |
| | | if (commonConveyorBZ != null) |
| | | { |
| | | ConveyorLineTaskCommand_After readSignal = conveyorLine.ReadCustomer<ConveyorLineTaskCommand_After>(station.stationLocation); |
| | | if (readSignal.Reserved5 == 1) |
| | | { |
| | | var tasks = _taskRepository.QueryData(x => x.TargetAddress == childDeviceCode); |
| | | if (tasks.Count == 0) |
| | | { |
| | | commonConveyorBZ.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), station.stationLocation); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | var wmsIpAddress = wmsBase + requestTrayOutTask; |
| | | |
| | | //var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString()); |
| | | //var deviceCode = device.Select(x => x.DeviceCode).ToList(); |
| | | |
| | | List<string> strings = platform.Location.Split(',').ToList(); |
| | | |
| | | WriteInfo("调度执行时间记录", "【调取WMS出库接口开始时间:】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); |
| | | |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.Serialize()); |
| | | //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString()); |
| | | |
| | | WriteInfo("调度执行时间记录", "【调取WMS出库接口结束时间:】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff")); |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |