From efc0923ff1e1dc995f6981c2559227df24da7623 Mon Sep 17 00:00:00 2001
From: zhangchengsong <zhangchengsong@hnkhzn.com>
Date: 星期四, 23 四月 2026 16:54:43 +0800
Subject: [PATCH] 1
---
项目代码/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 48 +++++++++++++++++++++++++++---------------------
1 files changed, 27 insertions(+), 21 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
index cff8018..987e148 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs"
@@ -27,6 +27,7 @@
using WIDESEAWCS_ISystemServices;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_Model.Models.System;
using WIDESEAWCS_QuartzJob;
@@ -49,17 +50,21 @@
private readonly ITaskRepository _taskRepository;
private readonly IRouterService _routerService;
private readonly IDt_PlatformStationService _DtPlatformStationService;
+ private readonly IDt_roadwayinfoService _Dt_roadwayinfoService;
- public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService)
+ public CommonStackerCraneJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IDt_roadwayinfoService dt_roadwayinfoService, ITaskRepository taskRepository, IRouterService routerService, IDt_PlatformStationService dt_PlatformStationService)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
_taskRepository = taskRepository;
_routerService = routerService;
_DtPlatformStationService = dt_PlatformStationService;
+ _Dt_roadwayinfoService = dt_roadwayinfoService;
}
private static readonly Dictionary<string, bool> _deviceLastStatus = new Dictionary<string, bool>();
public string urlWMSdeverror = WIDESEAWCS_Core.Helper.AppSettings.Configuration["urlWMSdeverror"];
+ private static readonly StackerFault[] _stackerFaultEnumCache = Enum.GetValues(typeof(StackerFault)).Cast<StackerFault>().ToArray();
+
public Task Execute(IJobExecutionContext context)
@@ -124,7 +129,7 @@
WebResponseContent webResponse = _taskService.StackCraneTaskCompleted(commonStackerCrane.CurrentTaskNum, PalletCode);
if (webResponse.Status)
{
- Task.Run(() => WriteLog.Write_Log("鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", "鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", $"銆恵commonStackerCrane.DeviceCode}銆戝簱鍫嗗灈鏈轰笂鎶ヤ换鍔″彿:銆恵commonStackerCrane.CurrentTaskNum}銆戝畬鎴愪俊鍙凤紒"));
+ WriteLog.Write_Log("鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", "鍫嗗灈鏈轰换鍔′笂鎶ュ畬鎴愪俊鎭�", $"銆恵commonStackerCrane.DeviceCode}銆戝簱鍫嗗灈鏈轰笂鎶ヤ换鍔″彿:銆恵commonStackerCrane.CurrentTaskNum}銆戝畬鎴愪俊鍙凤紒");
bool ddjfk = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
}
@@ -257,12 +262,9 @@
{
try
{
- CommonConveyorLine? conveyorLine = null;
- lock (Storage.Devices)
- {
+ CommonConveyorLine? conveyorLine = null;
string deviceCode = Roadway == "C" ? "1004" : "1003";
conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceCode) as CommonConveyorLine;
- }
if (conveyorLine == null) return false;
DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == NextAddress && x.DeviceProParamName == "StationNum");
@@ -291,11 +293,8 @@
{
CommonConveyorLine? conveyorLine = null;
- lock (Storage.Devices)
- {
string deviceCode = Roadway == "C" ? "1004" : "1003";
conveyorLine = Storage.Devices.FirstOrDefault(x => x.DeviceCode == deviceCode) as CommonConveyorLine;
- }
if (conveyorLine == null) return false;
DeviceProDTO? deviceProDTO = conveyorLine.DeviceProDTOs.FirstOrDefault(x => x.DeviceChildCode == SourceAddress && x.DeviceProParamName == "StationNum");
@@ -305,7 +304,7 @@
int StationNum = conveyorLine.Communicator.Read<ushort>(deviceProDTO.DeviceProAddress);
int HandShake = conveyorLine.Communicator.Read<ushort>(HandShakeprodto.DeviceProAddress);
WriteLog.Write_Log("鍏ュ簱搴撳彛鐘舵�佷俊鎭�", "鍏ュ簱搴撳彛鐘舵�佷俊鎭�", $"搴撳彛鏄�恵SourceAddress}銆戯紝鐢宠鐘舵�佸湴鍧�锛氥�恵HandShakeprodto.DeviceProAddress}銆�,璇诲彇鐨勬暟鎹細銆恵HandShake}銆慭n搴撳彛鏄惁鏈夎揣鐘舵�佸湴鍧�锛氥�恵deviceProDTO.DeviceProAddress}銆戯紝璇诲彇鐨勬暟鎹�恵StationNum}銆�");
- return (StationNum == 1 && HandShake == 0) ? true : false;
+ return StationNum == 1;
}
catch (Exception ex)
{
@@ -474,7 +473,14 @@
{
var dtTask = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
if (dtTask == null) return;
-
+ //鍫嗗灈鏈烘斁璐т腑鏄换鍔$姸鎬佸洖璋冩嬁pickup
+ if (dtTask.TaskType == 200 && stackerCraneWorkStatusDes == "鏀捐揣涓�")
+ {
+ string Result = WMSTaskStatusEnum.pickup.GetDescription();
+ Dt_roadwayinfo roadwayinfo = _Dt_roadwayinfoService.GetRoadwayinfo(dtTask.Roadway);
+ CommandResult command = _taskService.taskreturn(int.Parse(dtTask.WMStaskid), Result, roadwayinfo.WarehouseInvType, "");
+ return;
+ }
string[] targets = { "G02", "G03", "G04", "C02", "C01" };
if (dtTask.TaskType != 100 || !targets.Contains(dtTask.TargetAddress)) return;
@@ -499,18 +505,21 @@
conveyorLine.Communicator.Write<short>(handShake.DeviceProAddress, writeValue);
}
- catch
- { }
+ catch(Exception e)
+ {
+ WriteLog.Write_Log("鍑哄簱灞忚斀鍏夋爡/鍫嗗灈鍏ュ簱瑕佹斁璐у紓甯�", "閿欒", e.ToString());
+ }
}
-
/// <summary>
- /// 璇诲彇鏁呴殰锛堜紭鍖朑C锛�
+ /// 鏁呴殰淇℃伅
/// </summary>
+ /// <param name="crane"></param>
+ /// <returns></returns>
public string ReadStackerFaults(CommonStackerCrane crane)
{
try
{
- foreach (StackerFault fault in Enum.GetValues(typeof(StackerFault)))
+ foreach (StackerFault fault in _stackerFaultEnumCache)
{
try
{
@@ -518,13 +527,10 @@
if (isFault)
return fault.GetDesc();
}
- catch { }
+ catch { continue; }
}
}
- catch (Exception ex)
- {
- WriteLog.Write_Log("DB107鏁呴殰璇诲彇寮傚父", "閿欒", ex.ToString());
- }
+ catch { }
return string.Empty;
}
}
--
Gitblit v1.9.3