From 834294889ab62bafaf034b1b87c2ead961c33476 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 05 十二月 2025 09:37:46 +0800
Subject: [PATCH] 更新最新代码
---
项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPH.cs | 70 +++++++++++++++++++---------------
1 files changed, 39 insertions(+), 31 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
index a23ee93..39105b3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
@@ -3,16 +3,18 @@
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Org.BouncyCastle.Tls;
using Quartz;
-using SqlSugar.Extensions;
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Text;
+using System.Threading.Channels;
using System.Threading.Tasks;
using WIDESEAWCS_Common;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Communicator;
using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_IBasicInfoRepository;
using WIDESEAWCS_ITaskInfoRepository;
@@ -41,6 +43,10 @@
private readonly IRouterExtension _routerExtension;
private readonly List<Dt_WarehouseDevice> warehouseDevices;
private static object lockObj = 0;//
+ private static int Channel = 0;
+ private static int Long = 0;
+ private static int Wide = 0;
+ private static int High = 0;
public ConveyorLineJob_CPH(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension)
{
@@ -52,7 +58,13 @@
_routerRepository = routerRepository;
_routerService = routerService;
_routerExtension = routerExtension;
-
+ if (!AppSettings.Get("Channel").IsNullOrEmpty())
+ {
+ Channel = AppSettings.Get("Channel").ObjToInt();
+ Long= AppSettings.Get("Long").ObjToInt();
+ Wide = AppSettings.Get("Wide").ObjToInt();
+ High = AppSettings.Get("High").ObjToInt();
+ }
string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice));
if (!string.IsNullOrEmpty(warehouseDevicesStr))
{
@@ -71,19 +83,19 @@
if (lockObj.ToString()=="0")
{
lockObj = 1;
- Task task = Task.Run(() =>
+ Task task = Task.Run(async () =>
{
try
{
- while (true)
+ bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
+ if (flag && value != null)
{
- bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
- if (flag && value != null)
+ //鑾峰彇褰撳墠璁惧
+ OtherDevice device = (OtherDevice)value;
+ List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
+ Dt_StationManger? RequestIn = stationMangers.FirstOrDefault(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt());
+ while (true)
{
- //鑾峰彇褰撳墠璁惧
- OtherDevice device = (OtherDevice)value;
- List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
- Dt_StationManger? RequestIn = stationMangers.FirstOrDefault(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt());
if (RequestIn != null)
{
DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == RequestIn.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
@@ -94,29 +106,26 @@
//鐮佸灈鐜嚎璇锋眰浠诲姟
if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.R_BoxCode) && conveyorLineInfoRead.R_Request == 1)
{
- //WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.R_BoxCode, item.StationCode);
- ////鍚慦MS璇锋眰浠诲姟
- //if (true)
- //{
- //}
- string[] strings = conveyorLineInfoRead.R_BoxCode.Split("-");
- if (strings.Length==2)
+ #region todo:涓存椂閫昏緫
+ //鍐欏叆鎵ц鏁版嵁
+ device.SetValue(W_CLineCPHDB.W_TaskNo, 100 + 5, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_Channel, Channel, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_Long, Long, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_Wide, Wide, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_High, High, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, RequestIn.StationCode);
+ device.SetValue(W_CLineCPHDB.W_Request, 1, RequestIn.StationCode);
+ WebResponseContent content = _taskService.MESBoxCodeNotice(conveyorLineInfoRead.R_BoxCode);
+ if (content.Status)
{
- //鍐欏叆鎵ц鏁版嵁
- device.SetValue(W_CLineCPHDB.W_TaskNo, 100 + strings[1].ObjToInt(), RequestIn.StationCode);
- device.SetValue(W_CLineCPHDB.W_Channel, strings[1].ObjToInt(), RequestIn.StationCode);
-
- device.SetValue(W_CLineCPHDB.W_Long, 425, RequestIn.StationCode);
- device.SetValue(W_CLineCPHDB.W_Wide, 325, RequestIn.StationCode);
- device.SetValue(W_CLineCPHDB.W_High, 400, RequestIn.StationCode);
- device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, RequestIn.StationCode);
- device.SetValue(W_CLineCPHDB.W_Request, 1, RequestIn.StationCode);
+ WriteInfo(RequestIn.StationName, content.Message);
}
else
{
- WriteError(RequestIn.StationName, $"鏁版嵁鎴彇閿欒锛歿strings}");
+ WriteError(RequestIn.StationName, content.Message);
}
+ #endregion
}
}
else
@@ -124,7 +133,7 @@
WriteError(RequestIn.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{RequestIn.StationCode}鐨勫崗璁俊鎭�");
}
}
- foreach (var item in stationMangers.Where(x=>x.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt()))
+ foreach (var item in stationMangers.Where(x => x.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt()))
{
DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
if (deviceProRead != null)
@@ -144,21 +153,20 @@
}
}
}
- Thread.Sleep(100);
}
}
}
catch (Exception ex)
{
-
lockObj = 0;
WriteError(nameof(ConveyorLineJob_CPH), $"閿欒淇℃伅锛歿ex.Message}");
}
-
+
});
}
}
+
return Task.CompletedTask;
}
}
--
Gitblit v1.9.3