From e59d1777a111b6573b93afc58cca18c8c026ed9b Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期六, 04 一月 2025 09:57:43 +0800 Subject: [PATCH] 更新输送线目标地址和日志记录逻辑 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 64 +++++++++++--------------------- 1 files changed, 22 insertions(+), 42 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs index beee08f..674fe14 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs @@ -101,7 +101,7 @@ // 杈撳嚭璀﹀憡淇℃伅 ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵station.stationChildCode}銆戠┖鎵樼洏璇锋眰鎵爜鍏ュ簱"); // 澶勭悊鍏ュ簱璇锋眰 - NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation); + NGRequestTaskInbound(conveyorLine, command, station, 0); } else { @@ -162,26 +162,12 @@ #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇 // 鑾峰彇缂撳瓨涓殑鐢ㄦ埛淇℃伅 - if (userTokenIds == null && userIds == null) + var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); + if (tokenInfos != null && tokenInfos.Any()) { - var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); - if (tokenInfos != null && tokenInfos.Any()) - { - userTokenIds = tokenInfos.Select(x => x.Token_ID).ToList(); - userIds = tokenInfos.Select(x => x.UserId).ToList(); + userTokenIds = tokenInfos.Select(x => x.Token_ID).ToList(); + userIds = tokenInfos.Select(x => x.UserId).ToList(); - // 鏋勯�犻�氱煡鏁版嵁 - object obj = new - { - command, - commandWrite - }; - // 鍙戦�侀�氱煡 - _noticeService.LineData(userIds.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj }); - } - } - else - { // 鏋勯�犻�氱煡鏁版嵁 object obj = new { @@ -383,7 +369,7 @@ { if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress) { - //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode); + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, "1000", childDeviceCode); ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣�,骞跺啓鍏�1000銆�"); @@ -586,7 +572,7 @@ // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹� ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵NGAddress}銆�"); // 璁剧疆杈撻�佺嚎鐨勭洰鏍囧湴鍧�涓篘G鍦板潃 - conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, NGAddress, childDeviceCode); + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, NGAddress, childDeviceCode); // 瀹屾垚杈撻�佺嚎鍙戦�� ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬� @@ -726,7 +712,7 @@ #region 璁惧NG鍙e叆搴� - public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, string TargetAddress) + public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationManager, int ProtocalDetailValue) { var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue; @@ -735,7 +721,6 @@ { throw new InvalidOperationException("MOM IP 鏈厤缃�"); } - Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode); TrayCellsStatusDto trayCells = new TrayCellsStatusDto() { Software = "WMS", @@ -750,43 +735,38 @@ var MOMIpAddress = wmsBase + ipAddress; var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result; - WriteInfo("鍏ョ珯鏍¢獙", $"銆恵childDeviceCode}銆戝叆绔欐牎楠岃姹傚弬鏁般�恵trayCells.ToJsonString()}銆�"); + WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃姹傚弬鏁般�恵trayCells.ToJsonString()}銆�"); WriteInfo("鍏ョ珯鏍¢獙", ""); - WriteInfo("鍏ョ珯鏍¢獙", $"銆恵childDeviceCode}銆戝叆绔欐牎楠岃繑鍥炲弬鏁般�恵result}銆�"); + WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃繑鍥炲弬鏁般�恵result}銆�"); ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result); if (result1.Success) { - var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList(); + ConsoleHelper.WriteWarningLine("1"); + var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); if (serialNosError.Count > 0) { + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 100, stationManager.stationChildCode); + ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); return; } if (result1.SerialNos.Count <= 0) { - // 绌烘墭鐩樺叆搴撻�昏緫 - Dt_Task dt_Task = new Dt_Task() - { - TargetAddress = TargetAddress, - PalletCode = command.Barcode, - NextAddress = TargetAddress, - TaskNum = 0 - }; - var next = dt_Task.NextAddress; - var taskCommand = MapTaskCommand(dt_Task, command); - dt_Task.NextAddress = next; + ConsoleHelper.WriteWarningLine("2"); + ConsoleHelper.WriteWarningLine(stationManager.stationLocation); + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode); - conveyorLine.SendCommand(taskCommand, childDeviceCode); - - ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); } else { - conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, childDeviceCode); + ConsoleHelper.WriteWarningLine("1000"); + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTaskNum, 5, stationManager.stationChildCode); + conveyorLine.SetValue(ConveyorLineDBName.WriteConveyorLineTargetAddress, 1000, stationManager.stationChildCode); - ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); + ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true); } } else -- Gitblit v1.9.3