From e5642daf4b6820d0706967e486b16e8d33a46d6d Mon Sep 17 00:00:00 2001
From: 刘磊 <1161824510@qq.com>
Date: 星期四, 26 十二月 2024 14:37:52 +0800
Subject: [PATCH] 1
---
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs | 15
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs | 27 +
.gitignore | 6
Code Management/WMS/WIDESEA_WMSClient/src/components/basic/ViewGrid/ViewGrid.vue | 2
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs | 3
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs | 493 +++++++++++++++++++--
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 9
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs | 27
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 35 +
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs | 14
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs | 10
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs | 2
/dev/null | 0
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs | 415 +++++++++---------
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/ProcessApplyController.cs | 12
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ConsoleHelper.cs | 16
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs | 12
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/ProcessApply/IProcessApplyService.cs | 8
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs | 10
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs | 175 +++++++
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/AutofacModuleRegister.cs | 4
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs | 10
Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js | 8
23 files changed, 1,014 insertions(+), 299 deletions(-)
diff --git a/.gitignore b/.gitignore
index 2823dd4..7b03c8c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1587,3 +1587,9 @@
/Code Management/.vs/Code Management/CopilotIndices/17.12.31.40377/CodeChunks.db-wal
/Code Management/.vs/Code Management/CopilotIndices/17.12.31.40377/SemanticSymbols.db-wal
/Code Management/.vs/slnx.sqlite
+/Code Management/.vs/Code Management/v17/.wsuo
+/Code Management/.vs/Code Management/v17/workspaceFileList.bin
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
+/Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/copilot-chat/bef6627e/sessions/82695646-a5cf-44a5-803d-fe8b5ff11fef
+/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
diff --git a/Code Management/.vs/Code Management/v17/.wsuo b/Code Management/.vs/Code Management/v17/.wsuo
deleted file mode 100644
index 77c39f3..0000000
--- a/Code Management/.vs/Code Management/v17/.wsuo
+++ /dev/null
Binary files differ
diff --git a/Code Management/.vs/Code Management/v17/workspaceFileList.bin b/Code Management/.vs/Code Management/v17/workspaceFileList.bin
deleted file mode 100644
index 66fb339..0000000
--- a/Code Management/.vs/Code Management/v17/workspaceFileList.bin
+++ /dev/null
Binary files differ
diff --git a/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3 b/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
deleted file mode 100644
index c22568e..0000000
--- a/Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/copilot-chat/bef6627e/sessions/0fd52b0d-b36f-4668-871f-5e1c1d23e2e3
+++ /dev/null
Binary files differ
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/AutofacModuleRegister.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/AutofacModuleRegister.cs
index e4e2058..19104a5 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/AutofacModuleRegister.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Extensions/AutofacModuleRegister.cs
@@ -23,8 +23,8 @@
var basePath = AppContext.BaseDirectory;
var cacheType = new List<Type>();
- builder.RegisterType<LogAOP>();
- cacheType.Add(typeof(LogAOP));
+ //builder.RegisterType<LogAOP>();
+ //cacheType.Add(typeof(LogAOP));
builder.RegisterGeneric(typeof(RepositoryBase<>)).As(typeof(IRepository<>)).InstancePerDependency();//娉ㄥ唽浠撳偍
builder.RegisterGeneric(typeof(ServiceBase<,>)).As(typeof(IService<>)).InstancePerDependency();//娉ㄥ唽鏈嶅姟
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ConsoleHelper.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ConsoleHelper.cs
index 452102f..9c43a3d 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ConsoleHelper.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ConsoleHelper.cs
@@ -27,6 +27,22 @@
}
/// <summary>
+ /// 鍦ㄦ帶鍒跺彴杈撳嚭
+ /// </summary>
+ /// <param name="str">鏂囨湰</param>
+ /// <param name="color">鍓嶉鑹�</param>
+ public static void WriteColorLine(object str, ConsoleColor color)
+ {
+ lock (_objLock)
+ {
+ ConsoleColor currentForeColor = Console.ForegroundColor;
+ Console.ForegroundColor = color;
+ Console.WriteLine(str);
+ Console.ForegroundColor = currentForeColor;
+ }
+ }
+
+ /// <summary>
/// 鎵撳嵃閿欒淇℃伅
/// </summary>
/// <param name="str">寰呮墦鍗扮殑瀛楃涓�</param>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
index 582e1f6..e40fb0c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
@@ -274,7 +274,7 @@
}
/// <summary>
- ///
+ /// 妫�娴嬬珯鍙版槸鍚︽湁璐�
/// </summary>
/// <param name="deviceChildCode"></param>
/// <returns></returns>
@@ -306,6 +306,31 @@
return false;
}
+ /// <summary>
+ /// 妫�娴嬬珯鍙版槸鍚︽湁璐�
+ /// </summary>
+ /// <param name="deviceChildCode"></param>
+ /// <returns></returns>
+ /// <exception cref="Exception"></exception>
+ public bool IsOccupiedx(string deviceChildCode)
+ {
+ if (Communicator.IsConnected)
+ {
+ var device = _deviceProDTOs.Where(x => x.DeviceChildCode == deviceChildCode && x.DeviceProParamName == "InteractiveSignal").FirstOrDefault();
+
+ object readStatus = Communicator.ReadAsObj(device.DeviceProAddress, device.DeviceDataType);
+
+ //todo 鍗忚鏄庣粏淇℃伅鏈幏鍙栧埌鏃舵姏鍑哄紓甯�
+ if (readStatus.ToString() != "2")
+ {
+ return true;
+ }
+ return false;
+ }
+ //todo 閫氳鏈繛鎺ユ椂鎶涘嚭寮傚父
+ return false;
+ }
+
public void Dispose()
{
_heartStatr = false;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs
index 745f284..022cb6b 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/StackerCrane/Common/CommonStackerCrane.cs
@@ -396,22 +396,22 @@
switch (typeCode)
{
case TypeCode.Boolean:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToBoolean(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToBoolean(deviceProtocolDetail.ProtocalDetailValue));
break;
case TypeCode.Byte:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToByte(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToByte(deviceProtocolDetail.ProtocalDetailValue));
break;
case TypeCode.Int16:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt16(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToInt16(deviceProtocolDetail.ProtocalDetailValue));
break;
case TypeCode.Int32:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToInt32(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToInt32(deviceProtocolDetail.ProtocalDetailValue));
break;
case TypeCode.UInt16:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt16(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToUInt16(deviceProtocolDetail.ProtocalDetailValue));
break;
case TypeCode.UInt32:
- operateResult = Communicator.Wait(devicePro.DeviceProAddress, 500, 10 * 6000, Convert.ToUInt32(deviceProtocolDetail.ProtocalDetailValue));
+ operateResult = Communicator.Wait(devicePro.DeviceProAddress, 1000, 20 * 6000, Convert.ToUInt32(deviceProtocolDetail.ProtocalDetailValue));
break;
default:
break;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index f18b745..cf9d722 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -25,6 +25,7 @@
using WIDESEAWCS_QuartzJob.Models;
using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_TaskInfoRepository;
namespace WIDESEAWCS_TaskInfoService
{
@@ -503,6 +504,14 @@
BaseDal.DeleteData(task);
_taskHtyRepository.AddData(task_Hty);
}
+
+
+ if (task.TaskState == (int)TaskOutStatusEnum.SC_OutFinish)
+ {
+ content = StackCraneTaskCompleted(task.TaskNum);
+ return content;
+ }
+
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index 7e0cec8..433a120 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -22,6 +22,7 @@
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DeviceBase;
using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -32,7 +33,7 @@
[DisallowConcurrentExecution]
public partial class CommonConveyorLineJob : JobBase, IJob
{
- public readonly ITaskService _taskService;
+ private readonly ITaskService _taskService;
private readonly ITaskRepository _taskRepository;
private readonly ITaskExecuteDetailService _taskExecuteDetailService;
private readonly IRouterService _routerService;
@@ -43,12 +44,13 @@
private readonly IDt_StationManagerRepository _stationManagerRepository;
private readonly ICacheService _cacheService;
private readonly INoticeService _noticeService;
+ private readonly IDeviceInfoRepository _deviceInfoRepository;
private static List<string>? userTokenIds;
private static List<int>? userIds;
- public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService)
+ public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService, IDt_StationManagerService stationManagerService, IDt_StationManagerRepository stationManagerRepository, ICacheService cacheService, INoticeService noticeService, IDeviceInfoRepository deviceInfoRepository)
{
_taskService = taskService;
_taskExecuteDetailService = taskExecuteDetailService;
@@ -61,13 +63,12 @@
_stationManagerRepository = stationManagerRepository;
_cacheService = cacheService;
_noticeService = noticeService;
+ _deviceInfoRepository = deviceInfoRepository;
}
public async Task Execute(IJobExecutionContext context)
{
string jobName = context.JobDetail.Key.Name;
- //if (MemoryLockManager.TryAcquireLock(jobName))
- //{
try
{
// 浠嶫obDataMap涓幏鍙栦紶閫掔殑鍙傛暟
@@ -76,9 +77,11 @@
{
// 鏌ヨ鎵�鏈夊瓙璁惧鐨勪綅缃�
List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
+
// 骞惰澶勭悊姣忎釜瀛愯澶�
var tasks = childDeviceCodes.Select(childDeviceCode => ProcessDeviceAsync(conveyorLine, childDeviceCode)).ToList();
await Task.WhenAll(tasks);
+
// 鑾峰彇鎵�鏈夌珯鐐圭鐞嗗櫒
List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
@@ -98,7 +101,7 @@
// 杈撳嚭璀﹀憡淇℃伅
ConsoleHelper.WriteWarningLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵station.stationChildCode}銆戠┖鎵樼洏璇锋眰鎵爜鍏ュ簱");
// 澶勭悊鍏ュ簱璇锋眰
- NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation);
+ NGRequestTaskInbound(conveyorLine, command, station, 0);
}
else
{
@@ -143,31 +146,22 @@
// 杈撳嚭寮傚父淇℃伅
Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
}
- // finally
- // {
- // MemoryLockManager.ReleaseLock(jobName);
- // }
- // }
- // else
- // {
- // ConsoleHelper.WriteErrorLine($"[CommonConveyorLineJob]銆恵jobName}銆戜换鍔″凡琚攣瀹氾紝鏃犳硶澶勭悊");
- // }
return;
}
private Task ProcessDeviceAsync(CommonConveyorLine conveyorLine, string childDeviceCode)
{
- // 璇诲彇浠诲姟鍛戒护鍜岃澶囧懡浠�
- ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
- ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
- if (command != null && commandWrite != null)
+ try
{
- #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
-
- // 鑾峰彇缂撳瓨涓殑鐢ㄦ埛淇℃伅
- if (userTokenIds == null && userIds == null)
+ // 璇诲彇浠诲姟鍛戒护鍜岃澶囧懡浠�
+ ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
+ ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
+ if (command != null && commandWrite != null)
{
+ #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
+ // 鑾峰彇缂撳瓨涓殑鐢ㄦ埛淇℃伅
var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
if (tokenInfos != null && tokenInfos.Any())
{
@@ -183,75 +177,71 @@
// 鍙戦�侀�氱煡
_noticeService.LineData(userIds.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj });
}
- }
- else
- {
- // 鏋勯�犻�氱煡鏁版嵁
- object obj = new
+
+ #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
+ // 灏嗕氦浜掍俊鍙疯浆鎹负甯冨皵鏁扮粍
+ var writeInteractiveSignal = commandWrite.WriteInteractiveSignal;
+ var structs = BitConverter.GetBytes(writeInteractiveSignal).Reverse().ToArray().ToBoolArray();
+ // 鑾峰彇璁惧鍗忚璇︽儏
+ List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
+
+ if (deviceProtocolDetails != null)
{
- command,
- commandWrite
- };
- // 鍙戦�侀�氱煡
- _noticeService.LineData(userIds.FirstOrDefault(), userTokenIds, new { conveyorLine.DeviceName, childDeviceCode, data = obj });
- }
-
- #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
-
- // 灏嗕氦浜掍俊鍙疯浆鎹负甯冨皵鏁扮粍
- var writeInteractiveSignal = commandWrite.WriteInteractiveSignal;
- var structs = BitConverter.GetBytes(writeInteractiveSignal).Reverse().ToArray().ToBoolArray();
- // 鑾峰彇璁惧鍗忚璇︽儏
- List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
-
- if (deviceProtocolDetails != null)
- {
- foreach (var item in deviceProtocolDetails)
- {
- int itemValue = item.ProtocalDetailValue.ObjToInt();
- if (structs[itemValue] == true)
+ foreach (var item in deviceProtocolDetails)
{
- // 鑾峰彇澶勭悊鏂规硶
- MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
- if (method != null)
+ int itemValue = item.ProtocalDetailValue.ObjToInt();
+ if (structs[itemValue] == true)
{
- command.InteractiveSignal = writeInteractiveSignal;
- // 璋冪敤澶勭悊鏂规硶
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, itemValue });
+ // 鑾峰彇澶勭悊鏂规硶
+ MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
+ if (method != null)
+ {
+ command.InteractiveSignal = writeInteractiveSignal;
+ // 璋冪敤澶勭悊鏂规硶
+ method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, itemValue });
+ }
+ }
+ else
+ {
+ // 鍙戦�佸畬鎴愪俊鍙�
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, itemValue, false);
}
}
- else
- {
- // 鍙戦�佸畬鎴愪俊鍙�
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, itemValue, false);
- }
}
- }
- // 鏌ヨ骞冲彴淇℃伅
- Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
- if (platform != null && !string.IsNullOrEmpty(platform.Location))
- {
- var strings = platform.Location.Split(',').ToList();
- foreach (var ite in strings)
+ // 鏌ヨ骞冲彴淇℃伅
+ Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+ if (platform != null && !string.IsNullOrEmpty(platform.Location))
{
- // 璇诲彇浠诲姟鍛戒护
- ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
- if (command1.InteractiveSignal != 2)
+ var strings = platform.Location.Split(',').ToList();
+ foreach (var ite in strings)
{
- command.InteractiveSignal = writeInteractiveSignal;
- int count = strings.Count;
- // 鑾峰彇澶勭悊鏂规硶
- MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
- if (method != null)
+ // 璇诲彇浠诲姟鍛戒护
+ ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+ if (command1.InteractiveSignal != 2)
{
- command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
- // 璋冪敤澶勭悊鏂规硶
- method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
- };
+ command.InteractiveSignal = writeInteractiveSignal;
+ int count = strings.Count;
+ // 鑾峰彇澶勭悊鏂规硶
+ MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+ if (method != null)
+ {
+ command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+ // 璋冪敤澶勭悊鏂规硶
+ method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+ };
+ }
}
}
+ //if (conveyorLine.DeviceCode == "1001")
+ //{
+ // ConsoleHelper.WriteSuccessLine("ProcessDeviceAsync鏂规硶缁撴潫鏃堕棿锛�" + DateTime.Now.ToString("G") + $"鐐逛綅锛歿childDeviceCode}");
+ //}
}
+ }
+ catch (Exception ex)
+ {
}
return Task.CompletedTask;
@@ -370,37 +360,45 @@
/// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
{
- ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚");
- var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
- if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
+ try
{
- if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
+
+ ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚");
+ var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+ if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
{
- //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
-
- ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣�,骞跺啓鍏�1000銆�");
-
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
- if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
+ if (command.Barcode == task.PalletCode && childDeviceCode == task.NextAddress)
{
- int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
+ //conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, "1000", childDeviceCode);
- var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
- task.CurrentAddress = station.stationLocation;
- task.NextAddress = station.stationNGLocation;
- task.TargetAddress = task.NextAddress;
- task.TaskState = nextStatus;
- task.ModifyDate = DateTime.Now;
- task.Modifier = "System";
- _taskRepository.UpdateData(task);
- }
- else
- {
- WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
- Console.Out.WriteLine(content.ToJsonString());
+ ConsoleHelper.WriteWarningLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍏ュ簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆愮瓑寰呭垎閰嶈揣浣�,骞跺啓鍏�1000銆�");
+
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+ if (task.TaskType == (int)TaskInboundTypeEnum.InNG)
+ {
+ int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
+
+ var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.SourceAddress);
+ task.CurrentAddress = station.stationLocation;
+ task.NextAddress = station.stationNGLocation;
+ task.TargetAddress = task.NextAddress;
+ task.TaskState = nextStatus;
+ task.ModifyDate = DateTime.Now;
+ task.Modifier = "System";
+ _taskRepository.UpdateData(task);
+ }
+ else
+ {
+ WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
+ Console.Out.WriteLine(content.ToJsonString());
+ }
}
}
+ }
+ catch (Exception ex)
+ {
+
}
}
@@ -417,41 +415,49 @@
/// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
{
- // 鏌ヨ杈撻�佺嚎浠诲姟锛屾牴鎹緭閫佺嚎璁惧鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅
- var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-
- // 杈撳嚭鎴愬姛淇℃伅锛屽寘鎷緭閫佺嚎鍚嶇О銆佷换鍔″彿銆佹墭鐩樻潯鐮佸拰瀛愯澶囦唬鐮侊紝浠ュ強浠诲姟淇℃伅
- ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎璇锋眰鍑哄簱,task{task.ToJsonString()}");
-
- // 濡傛灉浠诲姟涓嶄负绌猴紝鍒欐墽琛屼互涓嬫搷浣�
- if (task != null)
+ try
{
- // 鑾峰彇浠诲姟鐨勪笅涓�鐩爣鍦板潃
- var next = task.NextAddress;
- // 灏嗕换鍔″懡浠ゆ槧灏勫埌褰撳墠浠诲姟
- var taskCommand = MapTaskCommand(task, command);
+ // 鏌ヨ杈撻�佺嚎浠诲姟锛屾牴鎹緭閫佺嚎璁惧鍜屽瓙璁惧浠g爜鑾峰彇浠诲姟淇℃伅
+ var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
- // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
- task.NextAddress = next;
+ // 杈撳嚭鎴愬姛淇℃伅锛屽寘鎷緭閫佺嚎鍚嶇О銆佷换鍔″彿銆佹墭鐩樻潯鐮佸拰瀛愯澶囦唬鐮侊紝浠ュ強浠诲姟淇℃伅
+ ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎璇锋眰鍑哄簱,task{task.ToJsonString()}");
- // 杈撳嚭鎴愬姛淇℃伅锛屽寘鎷緭閫佺嚎鍚嶇О銆佷换鍔″彿銆佹墭鐩樻潯鐮併�佸瓙璁惧浠g爜鍜屼笅涓�鐩爣鍦板潃
- ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎璇锋眰鍑哄簱,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
-
- // 鍚戣緭閫佺嚎鍙戦�佸懡浠�
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
- // 瀹屾垚杈撻�佺嚎鍙戦�佷换鍔★紝骞舵洿鏂颁换鍔$姸鎬�
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-
- // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
- _taskService.UpdateTaskStatusToNext(task);
-
- // 濡傛灉浠诲姟鐨勭洰鏍囧湴鍧�鏄�"1020-1"锛屽垯鍐嶆鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
- if (task.TargetAddress == "1020-1")
+ // 濡傛灉浠诲姟涓嶄负绌猴紝鍒欐墽琛屼互涓嬫搷浣�
+ if (task != null)
{
+ // 鑾峰彇浠诲姟鐨勪笅涓�鐩爣鍦板潃
+ var next = task.NextAddress;
+
+ // 灏嗕换鍔″懡浠ゆ槧灏勫埌褰撳墠浠诲姟
+ var taskCommand = MapTaskCommand(task, command);
+
+ // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
+ task.NextAddress = next;
+
+ // 杈撳嚭鎴愬姛淇℃伅锛屽寘鎷緭閫佺嚎鍚嶇О銆佷换鍔″彿銆佹墭鐩樻潯鐮併�佸瓙璁惧浠g爜鍜屼笅涓�鐩爣鍦板潃
+ ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine._deviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎璇锋眰鍑哄簱,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
+
+ // 鍚戣緭閫佺嚎鍙戦�佸懡浠�
+ conveyorLine.SendCommand(taskCommand, childDeviceCode);
+
+ // 瀹屾垚杈撻�佺嚎鍙戦�佷换鍔★紝骞舵洿鏂颁换鍔$姸鎬�
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+
+ // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
_taskService.UpdateTaskStatusToNext(task);
+
+ // 濡傛灉浠诲姟鐨勭洰鏍囧湴鍧�鏄�"1020-1"锛屽垯鍐嶆鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
+ if (task.TargetAddress == "1020-1")
+ {
+ _taskService.UpdateTaskStatusToNext(task);
+ }
}
+ }
+ catch (Exception ex)
+ {
+
}
}
@@ -511,64 +517,72 @@
/// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
{
- // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴�
- ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚");
-
- // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟
- var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
-
- // 濡傛灉浠诲姟瀛樺湪
- if (task != null)
+ try
{
- // 濡傛灉浠诲姟涓殑鎵樼洏鏉$爜涓庡懡浠や腑鐨勬墭鐩樻潯鐮佷竴鑷�
- if (command.Barcode == task.PalletCode)
+
+ // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴�
+ ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚");
+
+ // 鏌ヨ姝e湪鎵ц鐨勮緭閫佺嚎浠诲姟
+ var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+
+ // 濡傛灉浠诲姟瀛樺湪
+ if (task != null)
{
- // 鍒涘缓涓�涓┖鐨刉ebResponseContent瀵硅薄
- WebResponseContent content = new WebResponseContent();
-
- // 淇濆瓨浠诲姟鐨勪笅涓�鐩爣鍦板潃
- var next = task.NextAddress;
- // 灏嗕换鍔℃槧灏勪负鍛戒护
- var taskCommand = MapTaskCommand(task, command);
- // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
- task.NextAddress = next;
-
- // 濡傛灉浠诲姟鐨勬墭鐩樻潯鐮佷笌鍛戒护涓殑鎵樼洏鏉$爜涓嶄竴鑷存垨鑰呬换鍔″娉ㄤ负"NG"
- if (task.PalletCode != command.Barcode || task.Remark == "NG")
+ // 濡傛灉浠诲姟涓殑鎵樼洏鏉$爜涓庡懡浠や腑鐨勬墭鐩樻潯鐮佷竴鑷�
+ if (command.Barcode == task.PalletCode)
{
- // 鏌ヨ鐩爣鍦板潃鐨勫閲�
- var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
- // 璁剧疆鍛戒护鐨勭洰鏍囧湴鍧�涓篘G鍦板潃
- taskCommand.TargetAddress = NGAddress;
+ // 鍒涘缓涓�涓┖鐨刉ebResponseContent瀵硅薄
+ WebResponseContent content = new WebResponseContent();
+
+ // 淇濆瓨浠诲姟鐨勪笅涓�鐩爣鍦板潃
+ var next = task.NextAddress;
+ // 灏嗕换鍔℃槧灏勪负鍛戒护
+ var taskCommand = MapTaskCommand(task, command);
+ // 鎭㈠浠诲姟鐨勪笅涓�鐩爣鍦板潃
+ task.NextAddress = next;
+
+ // 濡傛灉浠诲姟鐨勬墭鐩樻潯鐮佷笌鍛戒护涓殑鎵樼洏鏉$爜涓嶄竴鑷存垨鑰呬换鍔″娉ㄤ负"NG"
+ if (task.PalletCode != command.Barcode || task.Remark == "NG")
+ {
+ // 鏌ヨ鐩爣鍦板潃鐨勫閲�
+ var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
+ // 璁剧疆鍛戒护鐨勭洰鏍囧湴鍧�涓篘G鍦板潃
+ taskCommand.TargetAddress = NGAddress;
+ }
+ else
+ {
+ // 璁剧疆鍛戒护鐨勭洰鏍囧湴鍧�涓�1000
+ taskCommand.TargetAddress = 1000;
+ }
+
+ // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹�
+ ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
+ // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+ conveyorLine.SendCommand(taskCommand, childDeviceCode);
+ // 瀹屾垚杈撻�佺嚎鍙戦��
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
+ content = _taskService.UpdateTaskStatusToNext(task);
}
else
{
- // 璁剧疆鍛戒护鐨勭洰鏍囧湴鍧�涓�1000
- taskCommand.TargetAddress = 1000;
+ // 鏌ヨ鐩爣鍦板潃鐨勫閲�
+ var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
+ // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹�
+ ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵NGAddress}銆�");
+ // 璁剧疆杈撻�佺嚎鐨勭洰鏍囧湴鍧�涓篘G鍦板潃
+ conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, NGAddress, childDeviceCode);
+ // 瀹屾垚杈撻�佺嚎鍙戦��
+ ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
+ _taskService.UpdateTaskStatusToNext(task);
}
+ }
+ }
+ catch (Exception ex)
+ {
- // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹�
- ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵taskCommand.TargetAddress}銆�");
- // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
- // 瀹屾垚杈撻�佺嚎鍙戦��
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
- // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
- content = _taskService.UpdateTaskStatusToNext(task);
- }
- else
- {
- // 鏌ヨ鐩爣鍦板潃鐨勫閲�
- var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == task.TargetAddress).Capacity;
- // 鎵撳嵃鎴愬姛淇℃伅锛岃〃绀烘墭鐩樺凡鍒拌揪鎸囧畾杈撻�佺嚎骞跺畬鎴愬嚭搴擄紝涓嬩竴鐩爣鍦板潃宸茬‘瀹�
- ConsoleHelper.WriteSuccessLine($"銆恵conveyorLine.DeviceName}銆戜换鍔″彿锛氥�恵command.TaskNum}銆�,鎵樼洏鏉$爜锛氥�恵command.Barcode}銆戝凡鍒拌揪銆恵childDeviceCode}銆戣緭閫佺嚎鍑哄簱瀹屾垚,涓嬩竴鐩爣鍦板潃銆恵NGAddress}銆�");
- // 璁剧疆杈撻�佺嚎鐨勭洰鏍囧湴鍧�涓篘G鍦板潃
- conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, NGAddress, childDeviceCode);
- // 瀹屾垚杈撻�佺嚎鍙戦��
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
- // 鏇存柊浠诲姟鐘舵�佸埌涓嬩竴涓姸鎬�
- _taskService.UpdateTaskStatusToNext(task);
- }
}
}
@@ -623,7 +637,7 @@
else
taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
// 璋冪敤妫�鏌ュ苟鍒涘缓浠诲姟鐨勬柟娉�
- await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
+ await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
}
catch (Exception)
{
@@ -634,7 +648,7 @@
/// <summary>
/// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
/// </summary>
- private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
+ private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
{
// 鏌ヨ鏁版嵁搴撲腑宸叉湁鐨勪换鍔�
var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
@@ -659,8 +673,11 @@
}
var wmsIpAddress = wmsBase + requestTrayOutTask;
+ var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
+ var deviceCode = device.Select(x => x.DeviceCode).ToList();
+
// 鍙戦�丠TTP POST璇锋眰鑾峰彇浠诲姟鏁版嵁
- var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString());
+ var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = platform.Stacker, AreaCdoes = deviceCode, platform.ProductionLine }.ToJsonString());
// 瑙f瀽杩斿洖鐨凧SON鏁版嵁
WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
@@ -695,7 +712,7 @@
#region 璁惧NG鍙e叆搴�
- public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, string TargetAddress)
+ public void NGRequestTaskInbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, Dt_StationManager stationManager, int ProtocalDetailValue)
{
var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue;
@@ -704,7 +721,6 @@
{
throw new InvalidOperationException("MOM IP 鏈厤缃�");
}
- Dt_StationManager stationManager = _stationManagerRepository.QueryFirst(x => x.stationPLC == conveyorLine.DeviceCode && x.stationChildCode == childDeviceCode);
TrayCellsStatusDto trayCells = new TrayCellsStatusDto()
{
Software = "WMS",
@@ -719,14 +735,13 @@
var MOMIpAddress = wmsBase + ipAddress;
var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result;
- WriteInfo("鍏ョ珯鏍¢獙", $"銆恵childDeviceCode}銆戝叆绔欐牎楠岃姹傚弬鏁般�恵trayCells.ToJsonString()}銆�");
+ WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃姹傚弬鏁般�恵trayCells.ToJsonString()}銆�");
WriteInfo("鍏ョ珯鏍¢獙", "");
- WriteInfo("鍏ョ珯鏍¢獙", $"銆恵childDeviceCode}銆戝叆绔欐牎楠岃繑鍥炲弬鏁般�恵result}銆�");
+ WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃繑鍥炲弬鏁般�恵result}銆�");
ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result);
if (result1.Success)
{
-
var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1).ToList();
if (serialNosError.Count > 0)
{
@@ -735,33 +750,21 @@
if (result1.SerialNos.Count <= 0)
{
- // 绌烘墭鐩樺叆搴撻�昏緫
- Dt_Task dt_Task = new Dt_Task()
- {
- TargetAddress = TargetAddress,
- PalletCode = command.Barcode,
- NextAddress = TargetAddress,
- TaskNum = 0
- };
- var next = dt_Task.NextAddress;
- var taskCommand = MapTaskCommand(dt_Task, command);
- dt_Task.NextAddress = next;
+ conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, stationManager.stationLocation, stationManager.stationChildCode);
- conveyorLine.SendCommand(taskCommand, childDeviceCode);
-
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
}
else
{
- conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, childDeviceCode);
+ conveyorLine.SetValue(ConveyorLineDBName.ConveyorLineTargetAddress, 1000, stationManager.stationChildCode);
- ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
+ ConveyorLineSendFinish(conveyorLine, stationManager.stationChildCode, ProtocalDetailValue, true);
}
}
else
{
-
+ ConsoleHelper.WriteErrorLine(result1.MOMMessage);
}
}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index de1a341..c5ba64c 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -41,6 +41,7 @@
using WIDESEAWCS_Model.Models;
using WIDESEAWCS_QuartzJob;
using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Repository;
using WIDESEAWCS_QuartzJob.Service;
using WIDESEAWCS_SignalR;
using WIDESEAWCS_Tasks.ConveyorLineJob;
@@ -449,7 +450,7 @@
taskOutboundTypeEnum = TaskOutboundTypeEnum.OutTray;
else
taskOutboundTypeEnum = TaskOutboundTypeEnum.Outbound;
- await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform.Stacker, platform);
+ await CheckAndCreateTask(taskOutboundTypeEnum, childDeviceCode, index, platform);
}
catch (Exception)
{
@@ -459,7 +460,7 @@
/// <summary>
/// 妫�鏌ヤ换鍔″苟鍒涘缓鏂颁换鍔�
/// </summary>
- private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, string roadWay, Platform platform)
+ private async Task CheckAndCreateTask(TaskOutboundTypeEnum taskType, string childDeviceCode, int index, Platform platform)
{
var tasks = _taskRepository.QueryData(x => x.TaskType == (int)taskType && x.TargetAddress == childDeviceCode);
if (tasks.Count < index)
@@ -478,10 +479,11 @@
}
var wmsIpAddress = wmsBase + requestTrayOutTask;
-
+ var device = _deviceInfoRepository.QueryData(x => x.DeviceStatus == "1" && x.DeviceRemark == platform.Id.ToString());
+ var deviceCode = device.Select(x => x.DeviceCode).ToList();
List<string> strings = platform.Location.Split(',').ToList();
- var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = roadWay, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
+ var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.ToJsonString());
//var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 6df4aae..abafd03 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,6 +1,8 @@
锘縰sing Mapster;
+using Newtonsoft.Json;
using Quartz;
using System.Diagnostics.CodeAnalysis;
+using System.Text;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.Caches;
@@ -78,11 +80,31 @@
StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
if (stackerCraneTaskCommand != null)
{
- bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
- if (sendFlag)
+ var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
+ var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode);
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満浠诲姟鍙凤細銆恵taskNum}銆�,鍫嗗灈鏈烘墭鐩樺彿锛氥�恵taskBarCode}銆�,浠诲姟浠诲姟鍙凤細銆恵task.TaskNum}銆戜换鍔℃墭鐩樺彿锛氥�恵task.PalletCode}銆�", ConsoleColor.DarkBlue);
+ if (taskNum == 0 && taskBarCode != task.PalletCode)
{
- commonStackerCrane.LastTaskType = task.TaskType;
- _taskService.UpdateTaskStatusToNext(task.TaskNum);
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓恒�恵0}銆�,鎵樼洏鍙蜂笉涓�鑷村彲浠ヤ笅鍙戜换鍔�", ConsoleColor.DarkBlue);
+ bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
+ if (sendFlag)
+ {
+ StringBuilder builder = new StringBuilder();
+ builder.AppendLine();
+ builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戝爢鍨涙満鐘舵�侊細銆恵commonStackerCrane.StackerCraneStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
+ builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戞墜鑷姩鐘舵�侊細銆恵commonStackerCrane.StackerCraneAutoStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
+ builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜綔涓氱姸鎬侊細銆恵commonStackerCrane.StackerCraneWorkStatusDes}銆�,鏃堕棿锛氥�恵DateTime.Now}銆�");
+ builder.AppendLine($"銆恵commonStackerCrane.DeviceName}銆戜笅鍙戜换鍔℃垚鍔�,銆恵JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}銆�");
+ builder.AppendLine($"鏃堕棿锛氥�恵DateTime.Now}銆�");
+ builder.AppendLine();
+ ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
+ commonStackerCrane.LastTaskType = task.TaskType;
+ _taskService.UpdateTaskStatusToNext(task.TaskNum);
+ }
+ }
+ else
+ {
+ ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″彿涓嶄负銆恵0}銆�,鎴栬�呮墭鐩樺彿涓�鑷翠笉鍙互涓嬪彂浠诲姟", ConsoleColor.DarkBlue);
}
}
}
@@ -133,8 +155,7 @@
CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
if (commonStackerCrane != null)
{
- //var x = commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType);
- //if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
+ if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
{
//Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
ConsoleHelper.WriteColorLine($"銆恵commonStackerCrane.DeviceName}銆戜换鍔″畬鎴�,浠诲姟鍙凤細銆恵e.TaskNum}銆�", ConsoleColor.Blue);
@@ -294,7 +315,7 @@
if (device != null)
{
CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
- //if (conveyorLine.IsOccupied(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
+ if (conveyorLine.IsOccupiedx(router.ChildPosi))//鍑哄簱绔欏彴鏈鍗犵敤
{
return task;
}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs
index f8811bf..399951a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneDBName.cs
@@ -70,5 +70,15 @@
/// 鎵樼洏鍙�
/// </summary>
Barcode,
+
+ /// <summary>
+ /// 鍚姩鍛戒护
+ /// </summary>
+ StartCommand,
+
+ /// <summary>
+ /// 娑堥槻鍛戒护
+ /// </summary>
+ FireCommand,
}
}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/components/basic/ViewGrid/ViewGrid.vue b/Code Management/WMS/WIDESEA_WMSClient/src/components/basic/ViewGrid/ViewGrid.vue
index c548c62..c66cf97 100644
--- a/Code Management/WMS/WIDESEA_WMSClient/src/components/basic/ViewGrid/ViewGrid.vue
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/components/basic/ViewGrid/ViewGrid.vue
@@ -329,7 +329,7 @@
//闇�瑕佷粠杩滅▼缁戝畾鏁版嵁婧愮殑瀛楀吀缂栧彿,濡傛灉瀛楀吀鏁版嵁婧愮殑鏌ヨ缁撴灉杈冨锛岃鍦╫nInit涓皢瀛楀吀缂栧彿娣诲姞杩涙潵
//鍙鑷畾sql鏈夋晥
remoteKeys: [],
- columnIndex: false, //2020.11.01鏄惁鏄剧ず琛屽彿
+ columnIndex: true, //2020.11.01鏄惁鏄剧ず琛屽彿
ck: true, //2020.11.01鏄惁鏄剧ずcheckbox
continueAdd: false, //2021.04.11鏂板缓鏃舵槸鍚﹀彲浠ヨ繛缁柊寤烘搷浣�
continueAddName: '淇濆瓨鍚庣户缁坊鍔�', //2021.04.11鎸夐挳鍚嶇О
diff --git a/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js b/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
index 8b4f264..03e27d3 100644
--- a/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
+++ b/Code Management/WMS/WIDESEA_WMSClient/src/router/tables.js
@@ -4,7 +4,7 @@
name: 'Dt_AreaInfo',
component: () => import('@/views/widesea_wms/basicinfo/Dt_AreaInfo.vue'),
meta: {
- keepAlive: false
+ keepAlive: true
}
},
{
@@ -44,7 +44,7 @@
name: 'Dt_LocationInfo',
component: () => import('@/views/widesea_wms/basicinfo/Dt_LocationInfo.vue'),
meta: {
- keepAlive: false
+ keepAlive: true
}
},
{
@@ -140,14 +140,14 @@
name: 'Dt_Task',
component: () => import('@/views/widesea_wms/taskinfo/Dt_Task.vue'),
meta: {
- keepAlive: false
+ keepAlive: true
}
},{
path: '/Dt_Task_Hty',
name: 'Dt_Task_Hty',
component: () => import('@/views/widesea_wms/taskinfo/Dt_Task_Hty.vue'),
meta: {
- keepAlive: false
+ keepAlive: true
}
},
// {
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
index 990408f..692d693 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/HttpClient/HttpsClient.cs
@@ -78,12 +78,23 @@
private static void LogRequestParameters(Dictionary<string, object> parameters,string url = "")
{
- LogFactory.GetLog("API鎺ュ彛").Info(true, "url:" + url + "璇锋眰鍙傛暟: " + JsonConvert.SerializeObject(parameters));
+ StringBuilder builder = new StringBuilder();
+ builder.Append(Environment.NewLine);
+ builder.Append("---------------------------------------------");
+ builder.Append(Environment.NewLine);
+ builder.Append("url:" + url + "璇锋眰鍙傛暟: " + JsonConvert.SerializeObject(parameters));
+ LogFactory.GetLog("API鎺ュ彛").Info(true, builder);
}
private static void LogResponseParameters(string responseBody, string url = "")
{
- LogFactory.GetLog("API鎺ュ彛").Info(true, "url:" + url + "鍝嶅簲鍙傛暟: " + responseBody);
+ StringBuilder builder = new StringBuilder();
+ builder.Append(Environment.NewLine);
+ builder.Append("url:" + url + "鍝嶅簲鍙傛暟: " + responseBody);
+ builder.Append(Environment.NewLine);
+ builder.Append("---------------------------------------------");
+ builder.Append(Environment.NewLine);
+ LogFactory.GetLog("API鎺ュ彛").Info(true, builder);
}
private static IEnumerable<KeyValuePair<string, string>> ConvertToKeyValuePairs(Dictionary<string, object> parameters)
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs
index a7f1db1..4a5e263 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/IRepository.cs
@@ -124,6 +124,20 @@
Task<bool> UpdateDataAsync(List<TEntity> listEntity);
/// <summary>
+ /// 瀵艰埅鏇存柊鏁版嵁(鍙敮鎸�2绾�)
+ /// </summary>
+ /// <param name="Entity"></param>
+ /// <returns></returns>
+ Task<bool> UpdateDataNavAsync(TEntity Entity);
+
+ /// <summary>
+ /// 瀵艰埅鏇存柊鏁版嵁(鍙敮鎸�2绾�)
+ /// </summary>
+ /// <param name="Entity"></param>
+ /// <returns></returns>
+ bool UpdateDataNav(TEntity Entity);
+
+ /// <summary>
/// 鎸囧畾鍒楁洿鏂版暟鎹�
/// </summary>
/// <param name="entity"></param>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs
index 607821b..ee96461 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs
@@ -880,6 +880,16 @@
return _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).OrderBy(orderByModels).ToList();
}
+ public Task<bool> UpdateDataNavAsync(TEntity Entity)
+ {
+ return _db.UpdateNav(Entity).IncludesAllFirstLayer().ExecuteCommandAsync();
+ }
+
+ public bool UpdateDataNav(TEntity Entity)
+ {
+ return _db.UpdateNav(Entity).IncludesAllFirstLayer().ExecuteCommand();
+ }
+
//List<TResult> QueryMuch<T, T2, T3, TResult>(
// Expression<Func<T, T2, T3, object[]>> joinExpression,
// Expression<Func<T, T2, T3, TResult>> selectExpression,
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
index aad02cc..8c0f2a0 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
@@ -1,9 +1,4 @@
-锘縰sing System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
+锘縰sing System.ComponentModel;
namespace WIDESEA_Core.Enums
{
@@ -94,10 +89,25 @@
NotAllow = 2
}
+ public enum LocationType
+ {
+ /// <summary>
+ /// 鍗曟繁璐т綅
+ /// </summary>
+ [Description("鍗曟繁璐т綅")]
+ Single = 1,
+
+ /// <summary>
+ /// 鍙屾繁璐т綅
+ /// </summary>
+ [Description("鍙屾繁璐т綅")]
+ Double = 2
+ }
+
#region 浠诲姟绫诲瀷
/// <summary>
- /// 浠诲姟绫诲瀷
+ /// 浠诲姟绫诲瀷
/// </summary>
public enum TaskInboundTypeEnum
@@ -175,7 +185,7 @@
/// NG鍑哄簱
/// </summary>
[Description("NG鍑哄簱")]
- OutNG =105,
+ OutNG = 105,
/// <summary>
/// 鐩存帴鍑哄簱
@@ -202,6 +212,7 @@
public enum TaskOtherTypeEnum
{
}
+
public enum TaskTypeEnum
{
/// <summary>
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs
index 48abb76..7ab5c6c 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs
@@ -4,6 +4,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEA_Core.Seed;
namespace WIDESEA_Core.Helper
{
@@ -15,7 +16,7 @@
//鐢ㄥ崟渚嬫ā寮�
public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
{
- ConnectionString = "Data Source=.;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",//杩炴帴绗﹀瓧涓�
+ ConnectionString = DBContext.GetMainConnectionDb().Connection,
DbType = DbType.SqlServer,//鏁版嵁搴撶被鍨�
IsAutoCloseConnection = true //涓嶈鎴恡rue瑕佹墜鍔╟lose
},
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
index 21bbef2..fe41350 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/SeedDataHostedService.cs
@@ -49,7 +49,7 @@
{
// 浣跨敤 myScopedService 鎵ц浠诲姟
- //await DBSeed.SeedAsync(_dbContext, _webRootPath);
+ await DBSeed.SeedAsync(_dbContext, _webRootPath);
//澶氱鎴� 鍚屾
//await DBSeed.TenantSeedAsync(_dbContext);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/ProcessApply/IProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/ProcessApply/IProcessApplyService.cs
index 5fdccb3..b9cdd63 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/ProcessApply/IProcessApplyService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/MOM/ProcessApply/IProcessApplyService.cs
@@ -11,4 +11,12 @@
public interface IProcessApplyService : IDependency
{
Task<WebResponseContent> GetProcessApplyAsync(ProcessApplyDto input);
+
+ /// <summary>
+ /// 琛ュ綍鍏ュ簱鏁版嵁
+ /// </summary>
+ /// <param name="palletCode">鎵樼洏鍙�</param>
+ /// <param name="areaID">鍖哄煙涓婚敭</param>
+ /// <returns></returns>
+ Task<WebResponseContent> StockInDataBackfillInterfaceAsync(string palletCode, int areaID);
}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
index 3de2826..142e609 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -4,10 +4,15 @@
using WIDESEA_Common;
using WIDESEA_Core;
using WIDESEA_Core.Const;
+using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.MOM;
+using WIDESEA_IBusinessesRepository;
using WIDESEA_IServices;
+using WIDESEA_IStorageBasicRepository;
+using WIDESEA_IStorageTaskRepository;
using WIDESEA_IStoragIntegrationServices;
+using WIDESEA_Model.Models;
namespace WIDESEA_StoragIntegrationServices;
@@ -15,10 +20,18 @@
{
private readonly LogFactory LogFactory = new LogFactory();
private readonly ISys_ConfigService _configService;
+ private readonly IDt_AreaInfoRepository _areaInfoRepository;
+ private readonly ICellStateService _cellStateService;
+ private readonly IStockInfoRepository _stockInfoRepository;
+ private readonly IAgingInOrOutInputService _gingInOrOutInputService;
- public ProcessApplyService(ISys_ConfigService configRepository)
+ public ProcessApplyService(ISys_ConfigService configRepository, IDt_AreaInfoRepository areaInfoRepository, ICellStateService cellStateService, IDt_TaskRepository taskRepository, IStockInfoRepository stockInfoRepository, IAgingInOrOutInputService gingInOrOutInputService)
{
_configService = configRepository;
+ _areaInfoRepository = areaInfoRepository;
+ _cellStateService = cellStateService;
+ _stockInfoRepository = stockInfoRepository;
+ _gingInOrOutInputService = gingInOrOutInputService;
}
/// <summary>
@@ -62,4 +75,164 @@
}
return content;
}
+
+ /// <summary>
+ /// 琛ュ綍鍑哄簱鏁版嵁
+ /// </summary>
+ /// <param name="palletCode"></param>
+ /// <returns></returns>
+ public async Task<WebResponseContent> StockOutDataBackfillInterfaceAsync(string palletCode, int areaID)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var area = _areaInfoRepository.QueryFirst(x => x.AreaID == areaID);
+ var trayCells = new TrayCellsStatusDto()
+ {
+ Software = area.Spare3,
+ TrayBarcode = palletCode,
+ EquipmentCode = area.Spare2,
+ SceneType = area.Spare4
+ };
+ content = await _cellStateService.GetTrayCellStatusAsync(trayCells);
+ if (!content.Status) return content;
+
+ var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ if (result.SerialNos.Count > 0)
+ {
+ var stockHty = await SqlSugarHelper.Db.Queryable<DtStockInfo>().IncludesAllFirstLayer().FirstAsync();
+ if (stockHty != null)
+ {
+ var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stockHty.ParameterInfos).FirstOrDefault(y => y.Description.Contains("鏃堕棿"));
+ if (parameterInfo == null) throw new Exception("");
+
+ var outHours = (DateTime.Now - (stockHty.LinedProcessFeedbackTime == null ? stockHty.ModifyDate.Value : stockHty.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
+ var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
+
+ var defectCode = string.Empty;
+ if (!isNG) defectCode = "TQCK";
+ var outputDto = new AgingOutputDto
+ {
+ OpFlag = 1,
+ Software = area.Spare3,
+ EquipmentCode = area.Spare2,
+ TrayBarcode = palletCode,
+ SerialNos = result.SerialNos.Select(x => new SerialNoOutDto
+ {
+ SlotNo = x.PositionNo,
+ SerialNo = x.SerialNo,
+ SerialNoResult = true, //isNG,
+ ParameterInfo = new List<ParameterInfoOutput> {
+ new ParameterInfoOutput() {
+ Value = outHours.ToString(),
+ ParameterCode =parameterInfo.ParameterCode,
+ ParameterDesc = parameterInfo.Description,
+ ParameterResult = "OK", //isNG.ToString(),
+ TargetValue = parameterInfo.TargetValue,
+ LowerLomit = parameterInfo.LowerSpecificationsLimit,
+ UpperLimit = parameterInfo.UpperSpecificationsLimit,
+ DefectCode = defectCode,
+ UOMCode = parameterInfo.UOMCode,
+ }
+ }
+ }).ToList()
+ };
+ content = await _gingInOrOutInputService.GetOCVOutputAsync(outputDto);
+ }
+ }
+ else
+ {
+ content.Error("鐢佃姱鏁版嵁涓虹┖");
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ return content;
+ }
+
+ /// <summary>
+ /// 琛ュ綍鍏ュ簱鏁版嵁
+ /// </summary>
+ /// <param name="palletCode"></param>
+ /// <param name="areaID"></param>
+ /// <returns></returns>
+ public async Task<WebResponseContent> StockInDataBackfillInterfaceAsync(string palletCode, int areaID)
+ {
+ WebResponseContent content = new WebResponseContent();
+ try
+ {
+ var area = _areaInfoRepository.QueryFirst(x => x.AreaID == areaID);
+ var trayCells = new TrayCellsStatusDto()
+ {
+ Software = area.Spare3,
+ TrayBarcode = palletCode,
+ EquipmentCode = area.Spare2,
+ SceneType = area.Spare4
+ };
+ content = await _cellStateService.GetTrayCellStatusAsync(trayCells);
+ if (!content.Status) return content;
+
+ var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ if (result.SerialNos.Count > 0 && result.Success)
+ {
+ var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode);
+ if (stockInfo != null)
+ {
+ stockInfo.IsFull = true;
+ stockInfo.StockInfoDetails = result.SerialNos.Select(serialNoObj => new DtStockInfoDetail
+ {
+ SerialNumber = serialNoObj.SerialNo,
+ OrderNo = serialNoObj.PositionNo.ToString(),
+ Status = serialNoObj.SerialNoStatus,
+ MaterielCode = result.BindCode,
+ Remark = result.TrayBarcodePropertys.ToJsonString(),
+ }).ToList();
+ stockInfo.Remark = stockInfo.StockInfoDetails.Count().ToString();
+
+ // 澶勭悊璇锋眰鍙傛暟
+ AgingInputDto agingInputDto = new AgingInputDto()
+ {
+ SerialNos = stockInfo.StockInfoDetails
+ .Select(item => new SerialNoInDto { SerialNo = item.SerialNumber, PositionNo = item.OrderNo })
+ .ToList(),
+ TrayBarcode = palletCode,
+ OpFlag = 1,
+ EquipmentCode = area.Spare2,
+ Software = area.Spare3
+ };
+
+ content = _gingInOrOutInputService.GetOCVInputAsync(agingInputDto).Result;
+ var respone = JsonConvert.DeserializeObject<ResponeAgingInputDto>(content.Data.ToString());
+
+ stockInfo.LinedProcessFeedbackTime = respone.LinedProcessFeedbackTime;
+ stockInfo.SpecialParameterDuration = respone.SpecialParameterDuration;
+ //2024骞�11鏈�16鏃ワ細鏂板瀛楁璁$畻搴斿嚭搴撴椂闂�
+ stockInfo.OutboundTime = Convert.ToDateTime(respone.LinedProcessFeedbackTime == null ? DateTime.Now : respone.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(respone.SpecialParameterDuration));
+ stockInfo.ProductionLine = respone.ProductionLine;
+ stockInfo.ParameterInfos = respone.ParameterInfos.ToJsonString();
+ stockInfo.StockStatus = 1;
+
+ var isResult = await _stockInfoRepository.UpdateDataNavAsync(stockInfo);
+ if (isResult)
+ content.OK("鏇存柊鏁版嵁鎴愬姛");
+ else
+ content.Error("鏇存柊鏁版嵁澶辫触");
+ }
+ else
+ {
+ content.Error("鏈壘鍒板簱瀛�");
+ }
+ }
+ else
+ {
+ return content;
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
+ }
}
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index fd13845..b6ebcfb 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -1,5 +1,8 @@
-锘縰sing Mapster;
+锘縰sing AngleSharp.Dom;
+using Mapster;
using Masuit.Tools;
+using SixLabors.Fonts.Tables.AdvancedTypographic;
+using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using WIDESEA_Core.Const;
@@ -7,6 +10,7 @@
using WIDESEA_DTO.WMS;
using WIDESEA_IServices;
using WIDESEA_IStoragIntegrationServices;
+using WIDESEA_StoragIntegrationServices;
using WIDESEAWCS_BasicInfoRepository;
namespace WIDESEA_StorageTaskServices;
@@ -76,18 +80,100 @@
{
if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
{
+ #region 鑰佺増鏈�
//var process = await SqlSugarHelper.Db.Queryable<Dt_EquipmentProcess>()
// .FirstAsync(x => x.EquipmentName == task.Roadway);
//var info = JsonConvert.DeserializeObject<ResponseEqptRunDto>(process.ProcessValue);
- if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") //闈炲垎瀹瑰簱鍖轰笌褰撳墠宸ュ簭鏄疧CVB鍧囦笂鎶OM鍑哄叆绔�
+ //if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB") //闈炲垎瀹瑰簱鍖轰笌褰撳墠宸ュ簭鏄疧CVB鍧囦笂鎶OM鍑哄叆绔�
+ //{
+ // var agingOutputDto = MapToAgingOutputDto(stock);
+ // content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+ // //ValidateResponse(content);
+ // var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+ // if (!result.Success || !agingOutputDto.SerialNos[0].SerialNoResult)
+ // {
+ // if (result.MessageCode == "E10001")
+ // {
+ // var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == stock.AreaCode);
+ // if (area == null)
+ // {
+ // throw new Exception("鏈壘鍒板搴旂殑搴撳尯淇℃伅");
+ // }
+ // var trayCells = new TrayCellsStatusDto()
+ // {
+ // Software = area.Spare3,
+ // TrayBarcode = task.PalletCode,
+ // EquipmentCode = area.Spare2,
+ // SceneType = area.Spare4
+ // };
+ // content = await _cellStateService.GetTrayCellStatusAsync(trayCells);
+ // if (!content.Status) return content;
+
+ // var ResultTray = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ // if (ResultTray.SerialNos.Count > 0)
+ // {
+ // var parameterInfo = JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos).FirstOrDefault(y => y.Description.Contains("鏃堕棿"));
+ // if (parameterInfo == null) throw new Exception("");
+
+ // var outHours = (DateTime.Now - (stock.LinedProcessFeedbackTime == null ? stock.CreateDate : stock.LinedProcessFeedbackTime.ToDateTime())).TotalHours;
+
+ // var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble() && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
+
+ // var defectCode = string.Empty;
+ // if (!isNG) defectCode = "TQCK";
+ // var outputDto = new AgingOutputDto
+ // {
+ // OpFlag = 1,
+ // Software = area.Spare3,
+ // EquipmentCode = area.Spare2,
+ // TrayBarcode = stock.PalletCode,
+ // SerialNos = ResultTray.SerialNos.Select(x => new SerialNoOutDto
+ // {
+ // SlotNo = x.PositionNo,
+ // SerialNo = x.SerialNo,
+ // SerialNoResult = true, //isNG,
+ // ParameterInfo = new List<ParameterInfoOutput> {
+ // new ParameterInfoOutput() {
+ // Value = outHours.ToString(),
+ // ParameterCode =parameterInfo.ParameterCode,
+ // ParameterDesc = parameterInfo.Description,
+ // ParameterResult = "OK", //isNG.ToString(),
+ // TargetValue = parameterInfo.TargetValue,
+ // LowerLomit = parameterInfo.LowerSpecificationsLimit,
+ // UpperLimit = parameterInfo.UpperSpecificationsLimit,
+ // DefectCode = defectCode,
+ // UOMCode = parameterInfo.UOMCode,
+ // }
+ // }
+ // }).ToList()
+ // };
+
+ // content = await _agingInOrOutInputService.GetOCVOutputAsync(outputDto);
+ // result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+ // if (!result.Success)
+ // task.Remark = "NG";
+ // }
+ // }
+ // else
+ // task.Remark = "NG";
+ // }
+ //}
+ #endregion 鑰佺増鏈�
+
+ if (task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
{
- var agingOutputDto = MapToAgingOutputDto(stock);
- content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
- //ValidateResponse(content);
- var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
- if (!result.Success || !agingOutputDto.SerialNos[0].SerialNoResult)
+ if (!task.Roadway.Contains("FR") && stock.ProcessCode != "OCVB")
{
- task.Remark = "NG";
+ var agingOutputDto = MapToAgingOutputDto(stock);
+ content = await _agingInOrOutInputService.GetOCVOutputAsync(agingOutputDto);
+
+ var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+ task.Remark = result.Success ? null : "NG";
+
+ if (!result.Success && result.MessageCode == "E10001")
+ {
+ await HandleOutBoundError(stock, task);
+ }
}
}
}
@@ -95,7 +181,10 @@
// 鏇存柊搴撳瓨鐘舵�佸拰浠诲姟鐘舵��
(var loc, var tas) = UpdateStockAndTaskStatus(stock, task);
var taskHty = task.Adapt<Dt_Task_Hty>();
- //taskHty.FinishTime = DateTime.Now;
+ taskHty.FinishTime = DateTime.Now;
+
+ DtStockInfo_Hty stockInfo_Hty = stock.Adapt<DtStockInfo_Hty>();
+ stockInfo_Hty.ModifyDate = DateTime.Now;
// 浜嬪姟澶勭悊
await _unitOfWorkManage.UseTranAsync(async () =>
@@ -104,9 +193,9 @@
{
await DeleteStockInfoAsync(stock.Id);
await DeleteStockInfoDetailsAsync(stock.StockInfoDetails);
+ await AddStockInfoHtyAsync(stockInfo_Hty);
}
await UpdateLocationAsync(loc);
- //if (task.Roadway.Contains("FR") || task.Roadway.Contains("GW") || task.TaskType == (int)TaskOutboundTypeEnum.OutTray) //濡傛灉鏄垎瀹规垨楂樻俯鍑哄簱 灏嗕换鍔″垹闄�
await DeleteTaskAsync(task.TaskId);
await AddTaskHtyAsync(taskHty);
});
@@ -175,10 +264,6 @@
};
}
- private void ValidateResponse(WebResponseContent content)
- {
- }
-
private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(DtStockInfo stock, Dt_Task task)
{
var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
@@ -199,6 +284,15 @@
if (!isStockUpdated)
{
throw new Exception("搴撳瓨淇℃伅鏇存柊澶辫触");
+ }
+ }
+
+ private async Task AddStockInfoHtyAsync(DtStockInfo_Hty dtStock)
+ {
+ var isStockAdd = await SqlSugarHelper.Db.InsertNav(dtStock).IncludesAllFirstLayer().ExecuteCommandAsync();
+ if (!isStockAdd)
+ {
+ throw new Exception("搴撳瓨鍘嗗彶淇℃伅娣诲姞澶辫触");
}
}
@@ -917,7 +1011,7 @@
}
catch (Exception err)
{
- throw;
+ return content.Error(err.Message);
}
}
@@ -1029,7 +1123,7 @@
{
// 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
- ? areaCodes == null ? await QueryStockInfoForRealTrayAsync(areaCode, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
+ ? areaCode != "CWSC1" ? await QueryStockInfoForRealTrayAsync(areaCode, areaCodes, productionLine) : await QueryStockInfoForRealTrayCWAsync(areaCodes, productionLine)
: await QueryStockInfoForEmptyTrayAsync(areaCode);
if (stockInfo == null)
@@ -1077,7 +1171,7 @@
/// <summary>
/// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
/// </summary>
- private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, string productionLine)
+ private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> devices, string productionLine)
{
var area = await _areaInfoRepository.QueryFirstAsync(x => x.AreaCode == areaCode);
@@ -1086,7 +1180,8 @@
.Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
.Where(x => x.AreaCode == areaCode && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
.WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
- .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+ .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
+ .WhereIF(!devices.IsNullOrEmpty(), x => devices.Contains(x.LocationInfo.RoadwayNo))
.OrderBy(x => x.OutboundTime) // 鎺掑簭
.FirstAsync(); // 鑾峰彇绗竴涓厓绱�
@@ -1097,7 +1192,7 @@
}
/// <summary>
- /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
+ /// 鏌ヨ甯告俯瀹炵洏搴撳瓨淇℃伅
/// </summary>
private async Task<DtStockInfo> QueryStockInfoForRealTrayCWAsync(List<string> areaCodes, string productionLine)
{
@@ -1108,7 +1203,7 @@
.Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
.Where(x => areaCodes.Contains(x.AreaCode) && x.OutboundTime < DateTime.Now && x.IsFull == true) // 杩囨护鏉′欢
.WhereIF(!productionLine.IsNullOrEmpty(), x => x.ProductionLine == productionLine)
- .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+ .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
.OrderBy(x => x.OutboundTime) // 鎺掑簭
.FirstAsync(); // 鑾峰彇绗竴涓厓绱�
@@ -1130,7 +1225,7 @@
.Includes(x => x.StockInfoDetails) // 棰勫姞杞絊tockInfoDetails
.Where(x => x.AreaCode == areaCode && x.IsFull == false)
.Where(x => x.StockInfoDetails.Any(y => y.MaterielCode == "绌烘墭鐩�"))
- .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID) // 杩囨护鏉′欢
+ .Where(x => x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && x.LocationInfo.AreaId == area.AreaID && x.LocationInfo.EnalbeStatus == (int)EnableEnum.Enable) // 杩囨护鏉′欢
.OrderBy(x => x.CreateDate) // 鎺掑簭
.FirstAsync(); // 杞崲涓哄垪琛�
@@ -1146,7 +1241,7 @@
{
return new Dt_Task
{
- Grade = 1,
+ Grade = tag == 104 ? 2 : 1,
Roadway = stockInfo.LocationInfo.RoadwayNo,
TargetAddress = position,
Dispatchertime = DateTime.Now,
@@ -1173,7 +1268,7 @@
return new WMSTaskDTO
{
TaskNum = task.TaskNum.Value,
- Grade = 1,
+ Grade = task.Grade.Value,
PalletCode = task.PalletCode,
RoadWay = task.Roadway,
SourceAddress = task.SourceAddress,
@@ -1330,6 +1425,129 @@
public async Task<WebResponseContent> CreateAndSendInboundTask(string palletCode, string position)
{
+ #region
+ //WebResponseContent content = new WebResponseContent();
+ //try
+ //{
+ // // 鏌ヨ搴撳瓨淇℃伅
+ // var stockInfo = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode);
+ // if (stockInfo == null)
+ // {
+ // var taskOld = BaseDal.QueryFirst(x => x.PalletCode == palletCode);
+ // if (!taskOld.IsNullOrEmpty())
+ // {// 鍒涘缓WMS浠诲姟
+ // WMSTaskDTO taskDTO = new WMSTaskDTO()
+ // {
+ // TaskNum = taskOld.TaskNum.Value,
+ // Grade = 1,
+ // PalletCode = taskOld.PalletCode,
+ // RoadWay = taskOld.Roadway,
+ // SourceAddress = taskOld.CurrentAddress,
+ // TargetAddress = taskOld.TargetAddress,
+ // TaskState = taskOld.TaskState.Value,
+ // Id = 0,
+ // TaskType = taskOld.TaskType,
+ // };
+ // return content.OK(data: taskDTO);
+ // }
+ // var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2);
+ // var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == position);
+ // TrayCellsStatusDto trayCells = CreateTrayCellsStatusDto(area, palletCode);
+ // content = await GetTrayCellStatusAsync(trayCells);
+ // if (!content.Status) return content;
+
+ // ConsoleHelper.WriteErrorLine(content.ToJsonString());
+ // var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ // if (!result.Success) return content.Error(result.MOMMessage);
+
+ // if (result.SerialNos.Count > 0)
+ // {
+ // var boxing = CreateBoxingInfo(result, palletCode);
+ // if (boxing == null) return content.Error("缁勭洏澶辫触");
+
+ // // 鑾峰彇宸ヨ壓璺嚎
+ // ProcessApplyDto process = await GetProcessApplyAsync(result);
+ // // 璧嬪�间笂浣嶈蒋浠跺悕绉板拰璁惧缂栫爜
+ // process.Software = area.Spare3;
+ // process.EquipmentCode = area.Spare2;
+ // content = await _processApplyService.GetProcessApplyAsync(process);
+ // if (!content.Status) return content.Error("宸ヨ壓鐢宠澶辫触");
+
+ // var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString());
+ // if (!resultProcessApply.Success) return content.Error("宸ヨ壓鐢宠澶辫触");
+
+ // var number = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode.Contains(boxing.ProcessCode)).FirstOrDefault().Number.ToInt32();
+ // foreach (var item in resultProcessApply.ProcessInfo)
+ // {
+ // if (item.Number.ToInt32() == number + 1)
+ // {
+ // boxing.NextProcessCode = item.ProcessCode;
+ // }
+ // }
+ // var location = await GetLocationDistributeAsync(station.Roadway);
+
+ // ConsoleHelper.WriteErrorLine(location.ToJsonString());
+
+ // // 鍒涘缓鏂颁换鍔″疄渚�
+ // var task = new Dt_Task
+ // {
+ // CurrentAddress = station.stationLocation,
+ // Grade = 1,
+ // Roadway = station.Roadway,
+ // TargetAddress = location.LocationCode,
+ // Dispatchertime = DateTime.Now,
+ // MaterialNo = "",
+ // NextAddress = location.LocationCode,
+ // OrderNo = null,
+ // PalletCode = palletCode,
+ // SourceAddress = position,
+ // TaskState = (int)TaskInStatusEnum.Line_InFinish,
+ // TaskType = (int)TaskInboundTypeEnum.Inbound,
+ // TaskNum = await BaseDal.GetTaskNo(),
+ // Creater = "Systeam"
+ // };
+
+ // // 鍒涘缓WMS浠诲姟
+ // WMSTaskDTO taskDTO = new WMSTaskDTO()
+ // {
+ // TaskNum = task.TaskNum.Value,
+ // Grade = 1,
+ // PalletCode = task.PalletCode,
+ // RoadWay = task.Roadway,
+ // SourceAddress = task.SourceAddress,
+ // TargetAddress = task.TargetAddress,
+ // TaskState = task.TaskState.Value,
+ // Id = 0,
+ // TaskType = task.TaskType,
+ // };
+
+ // await _unitOfWorkManage.UseTranAsync(async () =>
+ // {
+ // // 娣诲姞浠诲姟鍒版暟鎹簱
+ // await BaseDal.AddDataAsync(task);
+ // // 鏇存柊搴撳瓨浣嶇疆鐘舵�佷负涓嶅彲鐢�
+ // location.LocationStatus = (int)LocationEnum.InStockDisable;
+ // await _locationRepository.UpdateDataAsync(location);
+ // await _boxingInfoRepository.AddDataNavAsync(boxing);
+ // });
+
+ // content.OK(data: taskDTO);
+ // }
+ // else
+ // content.Error(result.MOMMessage);
+ // }
+ // else
+ // {
+ // // TODO璐ㄦ鍥炲簱
+ // var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2);
+ // }
+ //}
+ //catch (Exception ex)
+ //{
+ // content.Error(ex.Message);
+ //}
+ //return content;
+ #endregion
WebResponseContent content = new WebResponseContent();
try
{
@@ -1338,20 +1556,10 @@
if (stockInfo == null)
{
var taskOld = BaseDal.QueryFirst(x => x.PalletCode == palletCode);
- if (!taskOld.IsNullOrEmpty())
- {// 鍒涘缓WMS浠诲姟
- WMSTaskDTO taskDTO = new WMSTaskDTO()
- {
- TaskNum = taskOld.TaskNum.Value,
- Grade = 1,
- PalletCode = taskOld.PalletCode,
- RoadWay = taskOld.Roadway,
- SourceAddress = taskOld.CurrentAddress,
- TargetAddress = taskOld.TargetAddress,
- TaskState = taskOld.TaskState.Value,
- Id = 0,
- TaskType = taskOld.TaskType,
- };
+ if (taskOld != null)
+ {
+ // 鍒涘缓WMS浠诲姟
+ WMSTaskDTO taskDTO = CreateWMSTaskDTO(taskOld);
return content.OK(data: taskDTO);
}
var area = _areaInfoRepository.QueryFirst(x => x.AreaID == 2);
@@ -1362,11 +1570,37 @@
ConsoleHelper.WriteErrorLine(content.ToJsonString());
var result = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ if (result == null || !result.Success) return content.Error(result?.MOMMessage ?? "Deserialization error");
+
if (result.SerialNos.Count > 0)
{
+ var boxing = CreateBoxingInfo(result, palletCode);
+ if (boxing == null) return content.Error("缁勭洏澶辫触");
+
+ // 鑾峰彇宸ヨ壓璺嚎
+ ProcessApplyDto process = await GetProcessApplyAsync(result);
+ // 璧嬪�间笂浣嶈蒋浠跺悕绉板拰璁惧缂栫爜
+ process.Software = area.Spare3;
+ process.EquipmentCode = area.Spare2;
+
+ content = await _processApplyService.GetProcessApplyAsync(process);
+ if (!content.Status) return content.Error("宸ヨ壓鐢宠澶辫触");
+
+ var resultProcessApply = JsonConvert.DeserializeObject<ResultProcessApply>(content.Data.ToString()) as ResultProcessApply;
+ if (resultProcessApply == null || !resultProcessApply.Success) return content.Error("宸ヨ壓鐢宠澶辫触");
+
+ var number = resultProcessApply.ProcessInfo.Where(x => x.ProcessCode.Contains(boxing.ProcessCode)).FirstOrDefault()?.Number.ToInt32() ?? 0;
+ foreach (var item in resultProcessApply.ProcessInfo)
+ {
+ if (item.Number.ToInt32() == number + 1)
+ {
+ boxing.NextProcessCode = item.ProcessCode;
+ }
+ }
var location = await GetLocationDistributeAsync(station.Roadway);
ConsoleHelper.WriteErrorLine(location.ToJsonString());
+
// 鍒涘缓鏂颁换鍔″疄渚�
var task = new Dt_Task
{
@@ -1387,26 +1621,16 @@
};
// 鍒涘缓WMS浠诲姟
- WMSTaskDTO taskDTO = new WMSTaskDTO()
- {
- TaskNum = task.TaskNum.Value,
- Grade = 1,
- PalletCode = task.PalletCode,
- RoadWay = task.Roadway,
- SourceAddress = task.SourceAddress,
- TargetAddress = task.TargetAddress,
- TaskState = task.TaskState.Value,
- Id = 0,
- TaskType = task.TaskType,
- };
+ WMSTaskDTO taskDTO = CreateWMSTaskDTO(task);
await _unitOfWorkManage.UseTranAsync(async () =>
{
// 娣诲姞浠诲姟鍒版暟鎹簱
await BaseDal.AddDataAsync(task);
// 鏇存柊搴撳瓨浣嶇疆鐘舵�佷负涓嶅彲鐢�
- location.LocationStatus = (int)LocationEnum.InStockDisable;
+ location.LocationStatus = (int)LocationEnum.Lock;
await _locationRepository.UpdateDataAsync(location);
+ await _boxingInfoRepository.AddDataNavAsync(boxing);
});
content.OK(data: taskDTO);
@@ -1422,9 +1646,50 @@
}
catch (Exception ex)
{
+ // 鏇磋缁嗙殑鏃ュ織璁板綍锛屽彲浣跨敤鏃ュ織妗嗘灦鏇挎崲 Console.WriteLine
+ Console.WriteLine($"Error in CreateAndSendInboundTask: {ex.Message}");
content.Error(ex.Message);
}
return content;
+ }
+
+
+ private WMSTaskDTO CreateWMSTaskDTO(object source)
+ {
+ if (source is Dt_Task taskOld)
+ {
+ return new WMSTaskDTO()
+ {
+ TaskNum = taskOld.TaskNum.Value,
+ Grade = 1,
+ PalletCode = taskOld.PalletCode,
+ RoadWay = taskOld.Roadway,
+ SourceAddress = taskOld.CurrentAddress,
+ TargetAddress = taskOld.TargetAddress,
+ TaskState = taskOld.TaskState.Value,
+ Id = 0,
+ TaskType = taskOld.TaskType,
+ };
+ }
+ else if (source is Dt_Task task)
+ {
+ return new WMSTaskDTO()
+ {
+ TaskNum = task.TaskNum.Value,
+ Grade = 1,
+ PalletCode = task.PalletCode,
+ RoadWay = task.Roadway,
+ SourceAddress = task.SourceAddress,
+ TargetAddress = task.TargetAddress,
+ TaskState = task.TaskState.Value,
+ Id = 0,
+ TaskType = task.TaskType,
+ };
+ }
+ else
+ {
+ throw new ArgumentException("Invalid source object type for WMSTaskDTO creation.");
+ }
}
#endregion 闈欑疆寮傚父鍙e叆搴�
@@ -1471,6 +1736,35 @@
public async Task<bool> Delete(List<int> ids)
{
return await BaseDal.Delete(ids);
+ }
+
+ public override WebResponseContent DeleteData(object[] key)
+ {
+ WebResponseContent content = new WebResponseContent();
+ // 鍒涘缓鍘嗗彶浠诲姟瀹炰緥妯″瀷
+ try
+ {
+ Dt_Task task = BaseDal.QueryFirst(x => x.TaskId == Convert.ToInt32(key[0]));
+ if (task == null)
+ {
+ return content.Error("鏈壘鍒颁换鍔′俊鎭�!");
+ }
+ var taskHtyNG = CreateHistoricalTask(task, true);
+
+ // 鎵ц鏁版嵁搴撲簨鍔�
+
+ // 娣诲姞鍘嗗彶浠诲姟
+ var isTaskHtyAdd = _task_HtyRepository.AddData(taskHtyNG) > 0;
+
+ // 鍒犻櫎浠诲姟鏁版嵁
+ var isTaskDelete = BaseDal.Delete(task.TaskId);
+
+ return content.OK("鍒犻櫎鎴愬姛!");
+ }
+ catch (Exception ex)
+ {
+ return content.Error("鍒犻櫎浠诲姟寮傚父锛�" + ex.Message);
+ }
}
/// <summary>
@@ -1582,7 +1876,7 @@
/// </summary>
/// <param name="task"></param>
/// <returns></returns>
- private Dt_Task_Hty CreateHistoricalTask(Dt_Task task)
+ private Dt_Task_Hty CreateHistoricalTask(Dt_Task task, bool isHand = false)
{
// 鏇存柊浠诲姟鐘舵��
task.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
@@ -1592,7 +1886,7 @@
var taskHty = _mapper.Map<Dt_Task_Hty>(task);
taskHty.FinishTime = DateTime.Now;
taskHty.TaskId = 0;
- taskHty.OperateType = (int)OperateTypeEnum.鑷姩瀹屾垚;
+ taskHty.OperateType = isHand ? (int)OperateTypeEnum.浜哄伐鍒犻櫎 : (int)OperateTypeEnum.鑷姩瀹屾垚;
taskHty.SourceId = task.TaskId;
taskHty.TaskState = TaskOutStatusEnum.OutFinish.ObjToInt();
return taskHty;
@@ -1710,7 +2004,6 @@
var content = new WebResponseContent();
// 鑾峰彇鐩爣鍦板潃鍜屾洿鏂颁换鍔$姸鎬�
-
input.Position = Regex.Replace(input.Position, @"-(\d+)", "");
if (Convert.ToInt32(input.Position) > 1999)
@@ -1882,6 +2175,8 @@
return content;
}
+
+ private static readonly SemaphoreSlim _semaphore = new SemaphoreSlim(1, 1);
/// <summary>
/// 鏌ユ壘璐т綅
/// </summary>
@@ -1892,16 +2187,17 @@
{
#region 鑾峰彇璐т綅
+ await _semaphore.WaitAsync();
try
{
List<DtLocationInfo> locations;
if (IsFull)
{
- locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay);
+ locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay && x.EnalbeStatus == (int)EnableEnum.Enable);
}
else
{
- locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay /*&& x.LocationType ==*/);
+ locations = await _locationRepository.QueryDataAsync(x => x.LocationStatus == (int)LocationEnum.Free && x.RoadwayNo == roadWay && x.EnalbeStatus == (int)EnableEnum.Enable);
}
if (locations == null)
@@ -1915,6 +2211,10 @@
{
Console.WriteLine(err.Message.ToString());
return null;
+ }
+ finally
+ {
+ _semaphore.Release();
}
#endregion 鑾峰彇璐т綅
@@ -1966,6 +2266,89 @@
return minRoadwayNo;
}
+ // 鏂扮殑鍑哄簱閿欒澶勭悊閫昏緫
+ private async Task HandleOutBoundError(DtStockInfo stock, Dt_Task task)
+ {
+ WebResponseContent content = new WebResponseContent();
+ var area = _areaInfoRepository.QueryFirst(x => x.AreaCode == stock.AreaCode);
+ if (area == null)
+ {
+ throw new Exception("鏈壘鍒板搴旂殑搴撳尯淇℃伅");
+ }
+
+ var trayCells = new TrayCellsStatusDto
+ {
+ Software = area.Spare3,
+ TrayBarcode = task.PalletCode,
+ EquipmentCode = area.Spare2,
+ SceneType = area.Spare4
+ };
+
+ content = await _cellStateService.GetTrayCellStatusAsync(trayCells);
+ if (!content.Status) return;
+
+ var ResultTray = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(content.Data.ToString());
+ if (ResultTray.SerialNos.Count > 0)
+ {
+ var parameterInfo = GetParameterInfo(stock);
+
+ var outHours = CalculateOutHours(stock);
+ var isNG = outHours > parameterInfo.LowerSpecificationsLimit.ToDouble()
+ && outHours < parameterInfo.UpperSpecificationsLimit.ToDouble();
+
+ var defectCode = !isNG ? "TQCK" : string.Empty;
+
+ var outputDto = CreateAgingOutputDto(area, stock, ResultTray, parameterInfo, outHours, defectCode);
+ content = await _agingInOrOutInputService.GetOCVOutputAsync(outputDto);
+
+ var result = JsonConvert.DeserializeObject<BasicResult>(content.Data.ToString());
+ if (!result.Success)
+ task.Remark = "NG";
+ }
+ }
+
+ // 璁$畻鍑哄簱灏忔椂鐨勬柟娉�
+ private double CalculateOutHours(DtStockInfo stock) =>
+ (DateTime.Now - Convert.ToDateTime(stock.LinedProcessFeedbackTime ?? stock.CreateDate.ToString())).TotalHours;
+
+ // 鐢熸垚 AgingOutputDto 鐨勫皝瑁呮柟娉�
+ private AgingOutputDto CreateAgingOutputDto(Dt_AreaInfo area, DtStockInfo stock, ResultTrayCellsStatus resultTray,
+ ParameterInfo parameterInfo, double outHours, string defectCode)
+ {
+ return new AgingOutputDto
+ {
+ OpFlag = 1,
+ Software = area.Spare3,
+ EquipmentCode = area.Spare2,
+ TrayBarcode = stock.PalletCode,
+ SerialNos = resultTray.SerialNos.Select(x => new SerialNoOutDto
+ {
+ SlotNo = x.PositionNo,
+ SerialNo = x.SerialNo,
+ SerialNoResult = true,
+ ParameterInfo = new List<ParameterInfoOutput>
+ {
+ new ParameterInfoOutput
+ {
+ Value = outHours.ToString(),
+ ParameterCode = parameterInfo.ParameterCode,
+ ParameterDesc = parameterInfo.Description,
+ ParameterResult = "OK",
+ TargetValue = parameterInfo.TargetValue,
+ LowerLomit = parameterInfo.LowerSpecificationsLimit,
+ UpperLimit = parameterInfo.UpperSpecificationsLimit,
+ DefectCode = defectCode,
+ }
+ }
+ }).ToList()
+ };
+ }
+
+ // 鑾峰彇鍙傛暟淇℃伅鐨勮緟鍔╂柟娉�
+ private ParameterInfo GetParameterInfo(DtStockInfo stock) =>
+ JsonConvert.DeserializeObject<List<ParameterInfo>>(stock.ParameterInfos)
+ .FirstOrDefault(y => y.Description.Contains("鏃堕棿"));
+
#endregion 浠诲姟璇锋眰鏂规硶
#endregion private 鍐呴儴鏂规硶
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/ProcessApplyController.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/ProcessApplyController.cs
index 543b12f..4f42cf1 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/ProcessApplyController.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Integration/ProcessApplyController.cs
@@ -25,4 +25,16 @@
{
return await _processApplyService.GetProcessApplyAsync(input);
}
+
+ /// <summary>
+ /// 琛ュ綍鍏ュ簱鏁版嵁
+ /// </summary>
+ /// <param name="palletCode">鎵樼洏鍙�</param>
+ /// <param name="areaID">鍖哄煙涓婚敭</param>
+ /// <returns></returns>
+ [HttpPost("StockInDataBack")]
+ public async Task<WebResponseContent> StockInDataBackfillInterfaceAsync(string palletCode, int areaID)
+ {
+ return await _processApplyService.StockInDataBackfillInterfaceAsync(palletCode, areaID);
+ }
}
\ No newline at end of file
--
Gitblit v1.9.3