From ff34f2d5f1e9a4a3fcd7ed5049bd88d75c70203b Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 10 十二月 2025 12:39:59 +0800
Subject: [PATCH] 1
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs | 70 ++++++++++++++++++++++------------
1 files changed, 45 insertions(+), 25 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
index ecb95db..854c468 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
@@ -116,20 +116,13 @@
#endregion 绔欏彴鏂瑰紡
#region 璺敱鏂瑰紡
-
List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
- DateTime dateTime = DateTime.Now;
- Console.WriteLine($"寰幆寮�濮嬫椂闂磠dateTime}");
+
+ childDeviceCodes.Add("4000");
+
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;
@@ -156,7 +149,6 @@
MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
if (method != null)
{
- //var strings = platform.Location.Split(',').ToList();
int count = 1;
method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
}
@@ -164,14 +156,12 @@
}
}
- //childCodeList.Remove(childDeviceCode);
#region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
if (tokenInfos == null || !tokenInfos.Any())
{
- //throw new Exception(conveyorLine.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
continue;
}
var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
@@ -187,20 +177,16 @@
#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;
}
@@ -222,6 +208,13 @@
//_noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
WriteInfo(conveyorLine.DeviceName, log);
+
+ if (childDeviceCode == "4000")
+ {
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1601), childDeviceCode);
+ Thread.Sleep(100);
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 9999, childDeviceCode);
+ }
if (task == null)
{
@@ -460,12 +453,25 @@
}
}
- //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
@@ -497,8 +503,6 @@
}
}
- //conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
if (sendFlag)
{
@@ -506,6 +510,20 @@
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);
+ }
+ }
}
}
}
@@ -556,12 +574,14 @@
}
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("璋冨害鎵ц鏃堕棿璁板綍", "銆愯皟鍙朩MS鍑哄簱鎺ュ彛寮�濮嬫椂闂达細銆�" + 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("璋冨害鎵ц鏃堕棿璁板綍", "銆愯皟鍙朩MS鍑哄簱鎺ュ彛缁撴潫鏃堕棿锛氥��" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
--
Gitblit v1.9.3