From b466b3135cd7f3b08f570efda0ffb691daff5270 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 05 十二月 2025 18:15:16 +0800
Subject: [PATCH] 一期输送线代码及AGV请求等
---
项目代码/WCSServices/WIDESEAWCS_Tasks/一期线体/ConveyorLineJob1.cs | 142 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 142 insertions(+), 0 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
new file mode 100644
index 0000000..e821c77
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCSServices/WIDESEAWCS_Tasks/\344\270\200\346\234\237\347\272\277\344\275\223/ConveyorLineJob1.cs"
@@ -0,0 +1,142 @@
+锘縰sing Autofac.Core;
+using Microsoft.AspNetCore.Components.Routing;
+using Newtonsoft.Json;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.IdentityModel.Tokens.Jwt;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Text.Unicode;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common;
+using WIDESEAWCS_Common.Helper;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Communicator;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_IBasicInfoRepository;
+using WIDESEAWCS_ITaskInfoRepository;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.ConveyorLine.Enum;
+using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Models;
+using WIDESEAWCS_QuartzJob.Repository;
+using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_Tasks.DBNames;
+using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
+
+namespace WIDESEAWCS_Tasks
+{
+ [DisallowConcurrentExecution]
+ public class ConveyorLineJob1 : JobBase, IJob
+ {
+ private readonly ICacheService _cacheService;
+ private readonly ITaskService _taskService;
+ private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+ private readonly ITaskRepository _taskRepository;
+ private readonly IStationMangerRepository _stationMangerRepository;
+ private readonly IRouterRepository _routerRepository;
+ private readonly IRouterService _routerService;
+ private readonly IRouterExtension _routerExtension;
+
+ public ConveyorLineJob1(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension)
+ {
+ _cacheService = cacheService;
+ _taskService = taskService;
+ _taskExecuteDetailService = taskExecuteDetailService;
+ _taskRepository = taskRepository;
+ _stationMangerRepository = stationMangerRepository;
+ _routerRepository = routerRepository;
+ _routerService = routerService;
+ _routerExtension = routerExtension;
+ }
+ /*
+ 1鍙蜂綅鍑哄簱鍙e厑璁告斁绠� 0
+ 1鍙蜂綅鏀剧瀹屾垚淇″彿 21
+ 6鍙蜂綅鎷i�変綅鏂欑鍒拌揪 1
+ 6鍙蜂綅鎷i�変綅鏂欑鏉$爜 2
+ 6鍙蜂綅鎷i�変綅鏂欑娴佸姩 22
+ 8鍙蜂綅鍏ュ簱鍙e厑璁稿彇绠� 11
+ 8鍙蜂綅鍏ュ簱鍙f枡绠辨潯鐮� 12
+ 8鍙蜂綅鏈哄櫒浜哄彇绠卞畬鎴� 23
+ */
+ public Task Execute(IJobExecutionContext context)
+ {
+ try
+ {
+ 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);
+
+ foreach (var station in stationMangers)
+ {
+ if (station.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt())
+ {
+
+ //鎷i�夌敵璇�
+ short pickArrived = device.Communicator.Read<short>("1");
+ if (pickArrived == 256)
+ {
+ byte[] bytesPick = device.Communicator.Read("2", 5);
+ string pickBarCode = Encoding.UTF8.GetString(bytesPick).Replace("\0", "").Replace("\\0", "");
+ //涓婃姤WMS鏂欑鍒拌揪
+ if (pickBarCode.IsNotEmptyOrNull())
+ {
+ WebResponseContent content = _taskService.WMSPickUp(station.PickStationCode, pickBarCode);
+ if (content.Status)
+ {
+ WriteInfo(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶ユ垚鍔焮pickBarCode}");
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂笂鎶MS閿欒{pickBarCode}锛屼俊鎭瘂content.Message}");
+ }
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"{station.PickStationCode}鎷i�夌敵璇蜂负{pickArrived}鏉$爜涓虹┖鍊�");
+ }
+ }
+ }
+ else
+ {
+ //鍏ュ簱鐢宠
+ short InTake = device.Communicator.Read<short>("11");
+ byte[] bytesIn = device.Communicator.Read("12", 5);
+ string InBarCode = Encoding.UTF8.GetString(bytesIn).Replace("\0", "").Replace("\\0", "");
+ if (InTake==256 && InBarCode.IsNotEmptyOrNull())
+ {
+ //鐢宠鍏ュ簱浠诲姟
+ Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == InBarCode && x.TaskType == TaskTypeEnum.Inbound.ObjToInt() && x.TaskState != TaskStatusEnum.CL_Executing.ObjToInt());
+ if (task != null) continue;
+
+ WebResponseContent content = _taskService.RequestInTask(station.StationCode, InBarCode);
+ if (content.Status)
+ {
+ WriteInfo(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱鎴愬姛");
+ }
+ else
+ {
+ WriteError(device.DeviceCode, $"绔欏彴{station.StationCode}鏂欑{InBarCode}鐢宠鍏ュ簱浠诲姟閿欒锛屼俊鎭瘂content.Message}");
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteError(nameof(ConveyorLineJob1), ex.Message);
+ }
+ return Task.CompletedTask;
+ }
+ }
+}
--
Gitblit v1.9.3