From 7ca9651f81d7b84f054194d3d46fdbd1d9c8b922 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 09 七月 2025 22:55:27 +0800
Subject: [PATCH] 增加质检出入库逻辑
---
项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs | 84 +++++++++++++++++++++++++++++------------
1 files changed, 59 insertions(+), 25 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
index 3514ad3..18cbfe1 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ShuttleCarJob/ShuttleCarJob.cs"
@@ -2,10 +2,13 @@
using HslCommunication;
using Newtonsoft.Json;
using OfficeOpenXml.Drawing.Chart;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using Quartz;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEAWCS_Common.ShuttleCarEnum;
@@ -14,6 +17,7 @@
using WIDESEAWCS_Core.Caches;
using WIDESEAWCS_Core.Helper;
using WIDESEAWCS_DTO.System;
+using WIDESEAWCS_DTO.TaskInfo;
using WIDESEAWCS_DTO.WMSInfo;
using WIDESEAWCS_IShuttleCar;
using WIDESEAWCS_ITaskInfoRepository;
@@ -68,56 +72,86 @@
{
#region 绌挎杞︿换鍔″畬鎴�
var complete = shuttleCar.GetValue<ShuttleCarDBName, bool>(ShuttleCarDBName.TaskComplete);
- if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby && command.Status == command.TaskTypeComplete)
+ if (complete && command.TaskTypeComplete > (short)ShuttleCarTaskComplete.Standby)
{
+ #region 鏃ュ織璁板綍
+ FieldInfo? fieldInfo = typeof(ShuttleCarTaskComplete).GetField(((ShuttleCarTaskComplete)command.TaskTypeComplete).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ var type = description?.Description ?? ((ShuttleCarTaskComplete)command.TaskTypeComplete).ToString();
+ WriteDebug($"{shuttleCar.DeviceName}浠诲姟瀹屾垚", $"浠诲姟鍙枫�恵command.number}銆�,瀹屾垚绫诲瀷銆恵type}銆�");
+ #endregion
_taskService.ShuttleCarTaskCompleted(command.number, command.TaskTypeComplete);
shuttleCar.SetValue(ShuttleCarDBName.ConfirmComplete, true, shuttleCar.DeviceCode);
}
#endregion
- #region 鑾峰彇鍫嗗灈鏈虹Щ杞�/绉诲簱瀹屾垚浠诲姟
- GetSC_CarFinish();
- #endregion
+ GetSC_CarFinish();//鍫嗗灈鏈哄畬鎴愮Щ杞�/绉昏溅鍏呯數/绉诲簱/鍏ュ簱浠诲姟
#region 鍒涘缓绉昏溅鍏呯數浠诲姟
if (command.Err_Status == (short)ShuttleCarErr.LowBattery || command.ElectricQuantity <= (short)ShuttleCarErr.LowBattery)
{
- var ShuttleCar = QueryCode(shuttleCar.DeviceCode);//鍦ㄥ厖鐢典綅鐩存帴璁╃┛姊溅鍘诲厖鐢�
- //鐢熸垚鍫嗗灈鏈虹Щ杞︿换鍔�&绌挎杞﹀厖鐢典换鍔�,鍒ゆ柇鏄惁鏈夌┛姊溅鍦ㄥ厖鐢�
- Dt_Task _Task = _taskRepository.QueryFirst(x => x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt());
- if (_Task != null)
+ var ShuttleCar = QueryCode(shuttleCar.DeviceCode);
+ #region 鍒ゆ柇绌挎杞﹀綋鍓嶄綅缃槸鍚︽湁浠诲姟
+ if (_taskRepository.QueryFirst(x => x.SourceAddress == ShuttleCar.ShuttleCarPosition || x.TargetAddress == ShuttleCar.ShuttleCarPosition) == null)
{
- if (_Task.ShuttleCarCode != shuttleCar.DeviceCode)
+ Dt_Task _Task = _taskRepository.QueryFirst(x => x.TaskType == TaskOtherTypeEnum.RelocationCarCharging.ObjToInt());
+ if (_Task != null)
{
- ShuttleCar shuttleCar1 = Storage.Devices.Where(x => x.DeviceCode.Equals(_Task.ShuttleCarCode)).FirstOrDefault() as ShuttleCar;
- ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//璇诲彇绌挎杞︿俊鎭�
- if (command1 != null && command1.JoinStatus == 1)
+ if (_Task.ShuttleCarCode != shuttleCar.DeviceCode)
{
- if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50)
+ ShuttleCar shuttleCar1 = Storage.Devices.Where(x => x.DeviceCode.Equals(_Task.ShuttleCarCode)).FirstOrDefault() as ShuttleCar;
+ ShuttleCarTaskCommandR command1 = ReadCustomer<ShuttleCarTaskCommandR>(shuttleCar1, shuttleCar1.DeviceCode);//璇诲彇绌挎杞︿俊鎭�
+ if (command1 != null && command1.JoinStatus == 1)
{
- shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging);
+ if (command1.Status == (short)ShuttleCarStatus.Charging && command1.ElectricQuantity >= 50)
+ {
+ shuttleCar1.SetValue(ShuttleCarDBName.TaskType, (short)ShuttleCarStatus.QuitCharging);
+ }
}
}
}
- }
- else
- {
- //鍒ゆ柇鍏呯數浣嶆槸鍚︽湁杞�
- var ShuttleCar1 = _shuttleCarService.QueryShuttleCar("003-002-001");
- if (ShuttleCar1 != null && ShuttleCar1.ShuttleCarCode != shuttleCar.DeviceCode)
- {
- _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode);
- }
else
{
- _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, "003-002-001", ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
+ string CarChargingStation = AppSettings.Configuration[nameof(CarChargingStation)];//鍒ゆ柇鍏呯數浣嶆槸鍚︽湁杞�
+ var ShuttleCar1 = _shuttleCarService.QueryShuttleCar(CarChargingStation);
+ if (ShuttleCar1 != null && ShuttleCar1.ShuttleCarCode != shuttleCar.DeviceCode)
+ {
+ #region 鍒ゆ柇鏄惁瀛樺湪鏂板缓绉昏溅浠诲姟
+ if (_taskRepository.QueryFirst(x => x.ShuttleCarCode == ShuttleCar1.ShuttleCarCode) == null)
+ {
+ var dt_Task = GetTask((int)TaskCarStatusEnum.CarNew, (int)TaskOtherTypeEnum.RelocationCar);
+ if (dt_Task != null && string.IsNullOrEmpty(dt_Task.SourceAddress))
+ {
+ dt_Task.SourceAddress = ShuttleCar1.ShuttleCarPosition;
+ dt_Task.CurrentAddress = dt_Task.SourceAddress;
+ dt_Task.ShuttleCarCode = ShuttleCar1.ShuttleCarCode;
+ _taskService.UpdateData(dt_Task);
+ _taskExecuteDetailService.AddTaskExecuteDetail(dt_Task.TaskNum, "鏇存柊绉昏溅浠诲姟璧峰鍦板潃");
+ }
+ else
+ _taskService.AddRelocationCarTask(ShuttleCar1.ShuttleCarPosition, "", ShuttleCar1.ShuttleCarCode);
+ }
+ #endregion
+ }
+ else
+ {
+ _taskService.AddRelocationCarTask(ShuttleCar.ShuttleCarPosition, CarChargingStation, ShuttleCar.ShuttleCarCode, ShuttleCarTaskType.Charging.ToString());
+ }
}
}
+ #endregion
}
#endregion
#region 鑾峰彇绉昏溅/鍑哄叆搴撲换鍔�
- Get_CarTask(shuttleCar, command);
+ if (command != null &&
+ (command.Status == (short)ShuttleCarStatus.Standby || command.Status == (short)ShuttleCarStatus.Charging) &&
+ command.TaskTypeComplete == (short)ShuttleCarTaskComplete.Standby &&
+ (command.Err_Status == (short)ShuttleCarErr.Normal || command.Err_Status == (short)ShuttleCarErr.LowBattery))
+ {
+ //Get_CarTask(shuttleCar, command);
+ GetShuttleCarTask(shuttleCar, command);
+ }
#endregion
}
}
--
Gitblit v1.9.3