From ccf5c6a4396e810b46676e545f7ad8970b3787f1 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期日, 15 十二月 2024 09:23:25 +0800
Subject: [PATCH] 更新项目依赖,修复代码注释,调整开发环境配置
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 109 ++++++++++++++++++++++++++----------------------------
1 files changed, 52 insertions(+), 57 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 1375410..c22fd8a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -96,7 +96,8 @@
var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
if (tokenInfos == null || !tokenInfos.Any())
{
- throw new Exception(commonStackerCrane.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
+ //throw new Exception(commonStackerCrane.DeviceName + "缂撳瓨涓湭鎵惧埌Token缂撳瓨");
+ return Task.CompletedTask;
}
var userTokenIds = tokenInfos?.Select(x => x.Token_ID).ToList();
var userIds = tokenInfos?.Select(x => x.UserId).ToList();
@@ -141,22 +142,38 @@
{
//Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�", ConsoleColor.Blue);
- if (commonStackerCrane.DeviceCode.Contains("GW"))
- {
- var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
+ var task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
+ if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
+
+ if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+ {
var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress);
IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC);
if (device != null)
{
CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
- conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress);
+ var isResult = conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress);
+ if (!isResult)
+ {
+ var result = conveyorLine.GetValue<ConveyorLineDBName_After, string>(ConveyorLineDBName_After.ConveyorLineBarcode, task.TargetAddress);
+ if (result != task.PalletCode)
+ {
+ conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, task.TargetAddress);
+ }
+ }
}
else
return;
}
+
_taskService.StackCraneTaskCompleted(e.TaskNum);
+ if (commonStackerCrane.DeviceCode.Contains("CH") && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
+ {
+ task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
+ Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
+ }
commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
}
}
@@ -170,7 +187,7 @@
private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
{
Dt_Task task;
- var taskRun = _taskRepository.QueryFirst(x => x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting);
+ var taskRun = _taskRepository.QueryFirst(x => x.Roadway == commonStackerCrane.DeviceCode && (x.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting || x.TaskState == (int)TaskInStatusEnum.SC_InExecuting));
if (taskRun != null) { return null; }
if (commonStackerCrane.LastTaskType == null)
{
@@ -232,34 +249,44 @@
{
if (router != null)
{
-
IDevice? device = null;
if (task.Roadway.Contains("CW"))
{
device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
- }
-
- else
- {
- device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015");
- }
-
- if (device != null)
- {
- CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
- if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ if (device != null)
{
- return task;
+ CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
}
- }
- else
- {
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.NextAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
}
}
else
{
- _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
+ IDevice? device = null;
+ if (task.Roadway.Contains("GW"))
+ {
+ device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015");
+ if (device != null)
+ {
+ CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
+ if (conveyorLine.IsOccupied(task.TargetAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+ {
+ return task;
+ }
+ }
+ else
+ {
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵task.TargetAddress}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
+ }
+ }
+ _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.TargetAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
}
}
else
@@ -271,7 +298,7 @@
if (device != null)
{
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
- if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
+ //if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
{
return task;
}
@@ -407,38 +434,6 @@
}
return stackerCraneTaskCommand;
}
-
-
- /// <summary>
- /// 璁惧蹇冭烦
- /// </summary>
- /// <param name="commonStackerCrane"></param>
- //public async void EqptAlive(CommonStackerCrane commonStackerCrane)
- //{
- // if (commonStackerCrane.StackerOnline)
- // {
- // BasicDto dto = new BasicDto
- // {
- // EmployeeNo = "T00001",
- // EquipmentCode = commonStackerCrane.DeviceCode,
- // RequestTime = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"),
- // SessionId = Guid.NewGuid().ToString(),
- // Software = commonStackerCrane.DeviceName,
- // };
- // var respone = await HttpHelper.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/EqptAlive", dto.ToJsonString());
- // if (respone != null)
- // {
- // var result = JsonConvert.DeserializeObject<ResponseEqptAliveDto>(respone);
- // if (result != null && result.Success)
- // {
- // if (result.KeyFlag == "99")
- // commonStackerCrane.StackerOnline = true;
- // else if (result.KeyFlag == "98")
- // commonStackerCrane.StackerOnline = false;
- // }
- // }
- // }
- //}
}
}
\ No newline at end of file
--
Gitblit v1.9.3