From cdabe47ad8128c5006202e55c29746a617e988d6 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期日, 22 十二月 2024 15:29:57 +0800
Subject: [PATCH] 添加静置NG入库功能,更新相关接口和配置,优化代码结构
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 94 +++++++++++++++++++++++++++++++++++++++--------
1 files changed, 78 insertions(+), 16 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 6689c40..3335a9f 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -90,32 +90,49 @@
task.Creater = "WMS";
if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
{
- List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress);
- if (routers.Count > 0)
+ if (task.TargetAddress == "002-021-001" && task.Roadway.Contains("JZ") && task.TaskType == (int)TaskOutboundTypeEnum.OutTray)
{
task.TaskState = (int)TaskOutStatusEnum.OutNew;
task.CurrentAddress = item.SourceAddress;
- task.NextAddress = routers.FirstOrDefault().ChildPosi;
+ task.NextAddress = item.TargetAddress;
}
else
{
- routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+ List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress);
if (routers.Count > 0)
{
- task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
+ task.TaskState = (int)TaskOutStatusEnum.OutNew;
task.CurrentAddress = item.SourceAddress;
task.NextAddress = routers.FirstOrDefault().ChildPosi;
+ }
+ else
+ {
+ routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+ if (routers.Count > 0)
+ {
+ task.TaskState = (int)TaskOutStatusEnum.SC_OutFinish;
+ task.CurrentAddress = item.SourceAddress;
+ task.NextAddress = routers.FirstOrDefault().ChildPosi;
+ }
}
}
}
else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
{
- List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
- if (routers.Count > 0)
+ if (task.SourceAddress != "1359-4")
{
- task.TaskState = (int)TaskInStatusEnum.InNew;
- task.CurrentAddress = item.SourceAddress;
- task.NextAddress = routers.FirstOrDefault().ChildPosi;
+ List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
+ if (routers.Count > 0)
+ {
+ task.TaskState = (int)TaskInStatusEnum.InNew;
+ task.CurrentAddress = item.SourceAddress;
+ task.NextAddress = routers.FirstOrDefault().ChildPosi;
+ }
+ }
+ else
+ {
+ task.CurrentAddress = "002-021-001";
+ task.NextAddress = item.TargetAddress;
}
}
tasks.Add(task);
@@ -144,20 +161,31 @@
WebResponseContent content = new WebResponseContent();
try
{
+
var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode);
if (hasTask != null)
{
return content.OK("褰撳墠鎵樼洏瀛樺湪浠诲姟");
}
- var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
- var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
- var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
- if (wmsBase == null || requestTask == null)
+ var wmsIpAddrss = string.Empty;
+ var stationManager = _stationManagerRepository.QueryFirst(x => x.stationChildCode == sourceAddress);
+ if (stationManager.stationType == 5)
{
- throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestInBoundTaskNG);
}
- var wmsIpAddrss = wmsBase + requestTask;
+ else
+ {
+ wmsIpAddrss = GetIpAddress(SysConfigKeyConst.WMSIP_BASE, SysConfigKeyConst.RequestTask);
+ }
+ //var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+ //var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+ //var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
+ //if (wmsBase == null || requestTask == null)
+ //{
+ // throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ //}
+ //var wmsIpAddrss = wmsBase + requestTask;
var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode }.ToJsonString());
content = JsonConvert.DeserializeObject<WebResponseContent>(result);
@@ -249,6 +277,12 @@
return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
}
+ public Dt_Task QueryBarcodeTask(string barcode, string currentAddress)
+ {
+ return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.CurrentAddress == currentAddress, TaskOrderBy);
+ }
+
+
/// <summary>
/// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏂板缓鐨勪换鍔�
/// </summary>
@@ -317,6 +351,21 @@
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
else
return BaseDal.QueryFirst(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.CurrentAddress == currentAddress, TaskOrderBy);
+ }
+
+ /// <summary>
+ /// 鏍规嵁璁惧缂栧彿銆佹帓闄ょ殑浠诲姟銆佸綋鍓嶅湴鍧�鎸夌収浼樺厛绾т互鍙婂垱寤烘椂闂存帓搴忔煡璇换鍔℃睜鍑哄簱绫诲瀷鐨勬柊澧炵殑鎵�鏈変换鍔�
+ /// </summary>
+ /// <param name="deviceNo">璁惧缂栧彿</param>
+ /// <param name="excludedTaskId">鎺掗櫎鐨勪换鍔�</param>
+ /// <param name="currentAddress">褰撳墠鍦板潃</param>
+ /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄锛屽彲鑳戒负null</returns>
+ public List<Dt_Task> QueryAllOutboundTasks(string deviceNo, string currentAddress = "")
+ {
+ if (string.IsNullOrEmpty(currentAddress))
+ return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew, TaskOrderBy);
+ else
+ return BaseDal.QueryData(x => x.Roadway == deviceNo && TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == (int)TaskOutStatusEnum.OutNew && x.CurrentAddress == currentAddress, TaskOrderBy);
}
/// <summary>
@@ -792,5 +841,18 @@
{
return BaseDal.QueryFirst(x => x.PalletCode == barcode && x.NextAddress == nextAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting), TaskOrderBy);
}
+
+
+ private string GetIpAddress(string baseIp,string name)
+ {
+ var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+ var wcsBasez = configz.Where(x => x.ConfigKey == baseIp).FirstOrDefault()?.ConfigValue;
+ var address = configz.Where(x => x.ConfigKey == name).FirstOrDefault()?.ConfigValue;
+ if (wcsBasez == null || address == null)
+ {
+ throw new InvalidOperationException("WMS IP 鏈厤缃�");
+ }
+ return wcsBasez + address;
+ }
}
}
\ No newline at end of file
--
Gitblit v1.9.3