| | |
| | | /Code Management/.vs/slnx.sqlite |
| | | /Code Management/.vs/Code Management/v17/.wsuo |
| | | /Code Management/.vs/Code Management/v17/workspaceFileList.bin |
| | | /Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json |
| | | /Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3 |
| | |
| | | } |
| | | if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish) |
| | | { |
| | | Dt_Task? tasks = UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (tasks != null) |
| | | { |
| | | task.CurrentAddress = tasks.CurrentAddress; |
| | | task.NextAddress = tasks.NextAddress; |
| | | } |
| | | content = StackCraneTaskCompleted(task.TaskNum); |
| | | return content; |
| | | } |
| | | } |
| | | else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DeviceBase; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | |
| | | [DisallowConcurrentExecution] |
| | | public partial class CommonConveyorLineJob : JobBase, IJob |
| | | { |
| | | public readonly ITaskService _taskService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly IRouterService _routerService; |
| | |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ICacheService _cacheService; |
| | | private readonly INoticeService _noticeService; |
| | | private readonly IDeviceInfoRepository _deviceInfoRepository; |
| | | |
| | | private static List<string>? userTokenIds; |
| | | private static List<int>? userIds; |
| | | |
| | | |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService) |
| | | public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _cacheService = cacheService; |
| | | _noticeService = noticeService; |
| | | _deviceInfoRepository = deviceInfoRepository; |
| | | } |
| | | |
| | | public async Task Execute(IJobExecutionContext context) |
| | | { |
| | | string jobName = context.JobDetail.Key.Name; |
| | | //if (MemoryLockManager.TryAcquireLock(jobName)) |
| | | //{ |
| | | try |
| | | { |
| | | // ä»JobDataMapä¸è·åä¼ éçåæ° |
| | |
| | | { |
| | | // æ¥è¯¢ææå设å¤çä½ç½® |
| | | List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode); |
| | | |
| | | // å¹¶è¡å¤çæ¯ä¸ªåè®¾å¤ |
| | | var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList(); |
| | | await Task.WhenAll(tasks); |
| | | |
| | | |
| | | // è·åææç«ç¹ç®¡çå¨ |
| | | List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); |
| | |
| | | // è¾åºå¼å¸¸ä¿¡æ¯ |
| | | Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString()); |
| | | } |
| | | // finally |
| | | // { |
| | | // MemoryLockManager.ReleaseLock(jobName); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]ã{jobName}ãä»»å¡å·²è¢«éå®ï¼æ æ³å¤ç"); |
| | | // } |
| | | return; |
| | | } |
| | | |
| | |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | | { |
| | | |
| | | #region è°ç¨äºä»¶æ»çº¿éç¥å端 |
| | | |
| | | // è·åç¼åä¸çç¨æ·ä¿¡æ¯ |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | //if (conveyorLine.DeviceCode == "1001") |
| | | //{ |
| | | // ConsoleHelper.WriteSuccessLine("ProcessDeviceAsyncæ¹æ³ç»ææ¶é´ï¼" + DateTime.Now.ToString("G") + $"ç¹ä½ï¼{childDeviceCode}"); |
| | | //} |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | else |
| | | taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound; |
| | | // è°ç¨æ£æ¥å¹¶å建任å¡çæ¹æ³ |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform); |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform); |
| | | } |
| | | catch (Exception) |
| | | { |
| | |
| | | /// <summary> |
| | | /// æ£æ¥ä»»å¡å¹¶å建æ°ä»»å¡ |
| | | /// </summary> |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform) |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform) |
| | | { |
| | | // æ¥è¯¢æ°æ®åºä¸å·²æçä»»å¡ |
| | | var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode); |
| | |
| | | } |
| | | 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(); |
| | | |
| | | // åéHTTP POST请æ±è·å任塿°æ® |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString()); |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = platform.Stacker, AreaCdoes = deviceCode, platform.ProductionLine }.ToJsonString()); |
| | | // è§£æè¿åçJSONæ°æ® |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | |
| | |
| | | |
| | | if (result1.Success) |
| | | { |
| | | |
| | | var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList(); |
| | | if (serialNosError.Count > 0) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | |
| | | ConsoleHelper.WriteErrorLine(result1.MOMMessage); |
| | | } |
| | | } |
| | | |
| | |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using WIDESEAWCS_QuartzJob.DTO; |
| | | using WIDESEAWCS_QuartzJob.Repository; |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ICacheService _cacheService; |
| | | private readonly INoticeService _noticeService; |
| | | private readonly IDeviceInfoRepository _deviceInfoRepository; |
| | | |
| | | public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService) |
| | | public CommonConveyorLine_GWJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository) |
| | | { |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _cacheService = cacheService; |
| | | _noticeService = noticeService; |
| | | _deviceInfoRepository = deviceInfoRepository; |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray; |
| | | else |
| | | taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound; |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform); |
| | | await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform); |
| | | } |
| | | catch (Exception) |
| | | { |
| | |
| | | /// <summary> |
| | | /// æ£æ¥ä»»å¡å¹¶å建æ°ä»»å¡ |
| | | /// </summary> |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform) |
| | | private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform) |
| | | { |
| | | var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode); |
| | | if (tasks.Count < index) |
| | |
| | | } |
| | | 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(); |
| | | |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = roadWay, AreaCdoes = strings, platform.ProductionLine }.ToJsonString()); |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.ToJsonString()); |
| | | //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString()); |
| | | |
| | | WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | |
| | | bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand); |
| | | if (sendFlag) |
| | | { |
| | | commonStackerCrane.SetValue(StackerCraneDBName.StartCommand, 1); |
| | | commonStackerCrane.LastTaskType = task.TaskType; |
| | | _taskService.UpdateTaskStatusToNext(task.TaskNum); |
| | | } |
| | |
| | | stackerCraneTaskCommand.TaskNum = task.TaskNum; |
| | | stackerCraneTaskCommand.WorkType = 1; |
| | | stackerCraneTaskCommand.TrayType = 0; |
| | | //stackerCraneTaskCommand.StartCommand = 1; |
| | | stackerCraneTaskCommand.StartCommand = 1; |
| | | if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//夿æ¯å¦æ¯å
¥åºä»»å¡ |
| | | { |
| | | if (task.SourceAddress == "1359-4" && task.Roadway.Contains("JZ")) |
| | |
| | | using Mapster; |
| | | using Masuit.Tools; |
| | | using SixLabors.Fonts.Tables.AdvancedTypographic; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.Const; |
| | |
| | | { |
| | | // æ ¹æ®æçç±»åæ¥è¯¢åºåä¿¡æ¯ |
| | | DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound |
| | | ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | | ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine) |
| | | : await QueryStockInfoForEmptyTrayAsync(areaCode); |
| | | |
| | | if (stockInfo == null) |
| | |
| | | /// <summary> |
| | | /// æ¥è¯¢å®çåºåä¿¡æ¯ |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine) |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine) |
| | | { |
| | | var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode); |
| | | |
| | |
| | | .Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine) |
| | | .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // è¿æ»¤æ¡ä»¶ |
| | | .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo)) |
| | | .OrderBy(x => x.OutboundTime) // æåº |
| | | .FirstAsync(); // è·å第ä¸ä¸ªå
ç´ |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ¥è¯¢å®çåºåä¿¡æ¯ |
| | | /// æ¥è¯¢å¸¸æ¸©å®çåºåä¿¡æ¯ |
| | | /// </summary> |
| | | private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine) |
| | | { |
| | |
| | | { |
| | | return new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Grade = tag == 104 ? 2 : 1, |
| | | Roadway = stockInfo.LocationInfo.RoadwayNo, |
| | | TargetAddress = position, |
| | | Dispatchertime = DateTime.Now, |
| | |
| | | return new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = 1, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |