From 737dec3c384f394fd6f9849b4480b697d1ba35d5 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 17 三月 2026 09:16:44 +0800
Subject: [PATCH] chore: 提交所有当前改动
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs | 87 +++++++++++++++++++++++++++++++++----------
1 files changed, 66 insertions(+), 21 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
index cb5bda3..d71d17d 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineNewJob/CommonConveyorLineNewJob.cs
@@ -17,11 +17,16 @@
#endregion << 鐗� 鏈� 娉� 閲� >>
-using AutoMapper;
+using MapsterMapper;
+using Microsoft.Extensions.Configuration;
using Quartz;
+using SqlSugar;
+using System.Text.Json;
+using WIDESEA_Core;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
@@ -36,15 +41,17 @@
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly IRouterService _routerService;
private readonly IMapper _mapper;
- ConveyorLineDispatchHandler _conveyorLineDispatch;
+ private ConveyorLineDispatchHandler _conveyorLineDispatch;
+ private readonly HttpClientHelper _httpClientHelper;
- public CommonConveyorLineNewJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper)
+ public CommonConveyorLineNewJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, HttpClientHelper httpClientHelper)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
_routerService = routerService;
_mapper = mapper;
_conveyorLineDispatch = new ConveyorLineDispatchHandler(_taskService, _taskExecuteDetailService, _routerService, _mapper);
+ _httpClientHelper = httpClientHelper;
}
public Task Execute(IJobExecutionContext context)
@@ -73,27 +80,68 @@
try
{
ConveyorLineTaskCommandNew command = conveyorLine.ReadCustomer<ConveyorLineTaskCommandNew>(childDeviceCode);
- if (command == null || command.PLC_STB == 0)
+
+
+ if (command == null)
{
return;
}
- if (command.Barcode.IsNullOrEmpty())
+ if(command.WCS_ACK == 1)
+ conveyorLine.SetValue(ConveyorLineDBNameNew.WCS_ACK, 0, childDeviceCode);
+
+ #region 妫�鏌ョ壒瀹氫綅缃槸鍚︽湁鎵樼洏
+
+ var checkPalletPositions = App.Configuration.GetSection("CheckPalletPositions")
+ .Get<List<CheckPalletPosition>>() ?? new List<CheckPalletPosition>();
+
+ if (checkPalletPositions.Any(x => x.Code == childDeviceCode))
+ {
+ if (command.CV_State.ObjToBool())
+ {
+ var existingTask = _taskService.Repository.QueryFirst(x => x.TargetAddress == childDeviceCode);
+ if (existingTask.IsNullOrEmpty())
+ {
+ var position = checkPalletPositions.FirstOrDefault(x => x.Code == childDeviceCode);
+ var responseResult = _httpClientHelper.Post<WebResponseContent>("GetOutBoundTrayTaskAsync", new CreateTaskDto()
+ {
+ WarehouseId = position.WarehouseId,
+ TargetAddress = childDeviceCode
+ }.Serialize());
+
+ if (responseResult.IsSuccess && responseResult.Data.Status)
+ {
+ var wmsTask = JsonSerializer.Deserialize<List<WMSTaskDTO>>(responseResult.Data.Data.Serialize());
+ if (wmsTask != null)
+ _taskService.ReceiveWMSTask(wmsTask);
+ }
+ }
+ }
+ }
+
+ #endregion
+
+ if (command.PLC_STB != 1) return;//PLC_STB=1鏃舵墠澶勭悊浠诲姟
+
+ if (command.Barcode.IsNullOrEmpty() || command.Barcode.Replace("\0", "") == "")
{
//鏃犳墭鐩樺彿鏃�
_conveyorLineDispatch.RequestOutbound(conveyorLine, command, childDeviceCode);
return;
}
- Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
- if (task.IsNullOrEmpty())
+ if (command.TaskNo > 0)
{
- _conveyorLineDispatch.RequestInbound(conveyorLine, command, childDeviceCode);
- return;
- }
+ Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNo, childDeviceCode);
+ if (!task.IsNullOrEmpty())
+ {
+ // 澶勭悊浠诲姟鐘舵��
+ ProcessTaskState(conveyorLine, command, task, childDeviceCode);
+ //_conveyorLineDispatch.RequestInbound(conveyorLine, command, childDeviceCode);
+ return;
+ }
- // 澶勭悊浠诲姟鐘舵��
- ProcessTaskState(conveyorLine, command, task, childDeviceCode);
+ }
}
catch (Exception innerEx)
{
@@ -108,7 +156,6 @@
}
return Task.CompletedTask;
}
-
/// <summary>
/// 澶勭悊浠诲姟鐘舵��
@@ -125,17 +172,17 @@
const int InFinish = (int)TaskInStatusEnum.InFinish;
const int OutFinish = (int)TaskOutStatusEnum.OutFinish;
- int state = task.TaskState;
+ int state = task.TaskStatus;
bool isTargetAddress = task.TargetAddress == childDeviceCode;
// 澶勭悊鐘舵�侀�昏緫
switch (state)
{
case InExecuting:
- if (isTargetAddress)
- _conveyorLineDispatch.ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
- else
- _conveyorLineDispatch.RequestInNextAddress(conveyorLine, command, childDeviceCode);
+ //if (isTargetAddress)
+ // _conveyorLineDispatch.ConveyorLineInFinish(conveyorLine, command, childDeviceCode);
+ //else
+ _conveyorLineDispatch.RequestInNextAddress(conveyorLine, command, childDeviceCode);
break;
case OutExecuting:
@@ -154,7 +201,5 @@
break;
}
}
-
-
}
-}
\ No newline at end of file
+}
--
Gitblit v1.9.3