From 2a73ec6d537d9b55f60fe0088678c99930eb84d8 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期二, 10 三月 2026 18:52:49 +0800
Subject: [PATCH] 优化成品库入库逻辑
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs | 2
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs | 42 +++++++++++---------
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs | 4 +-
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs | 7 +++
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs | 9 ++++
5 files changed, 41 insertions(+), 23 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
index 62c53d9..9156ebf 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_BasicInfoService/RGVLocationInfoService.cs"
@@ -20,10 +20,10 @@
}
private Dictionary<string, OrderByType> _emptyAssignOrderBy = new Dictionary<string, OrderByType>()
{
+ { nameof(Dt_RGVLocationInfo.Row), OrderByType.Asc },
{ nameof(Dt_RGVLocationInfo.Depth), OrderByType.Desc },
{ nameof(Dt_RGVLocationInfo.Layer), OrderByType.Asc },
//{ nameof(Dt_RGVLocationInfo.Column), OrderByType.Asc },
- { nameof(Dt_RGVLocationInfo.Row), OrderByType.Asc },
};
private Dictionary<string, OrderByType> _DepthAscOrderBy = new Dictionary<string, OrderByType>()
{
@@ -43,32 +43,36 @@
public Dt_RGVLocationInfo? GetInFreeLocationInfo(string AreaCode)
{
Dt_RGVLocationInfo? rGVLocationInfo = null;
- List<Dt_RGVLocationInfo> rGVLocationInfos = BaseDal.QueryData(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy);
+ Dt_RGVLocationInfo? FreerGVLocationInfo = null;
+ List<Dt_RGVLocationInfo> rGVLocationInfos = BaseDal.QueryData(x => x.WarehouseId.ToString() == AreaCode && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _emptyAssignOrderBy);//鏌ユ壘鎵�鏈夌┖璐т綅
if (rGVLocationInfos == null || rGVLocationInfos.Count < 1) return rGVLocationInfo;
#region 鍒ゆ柇宸烽亾鏄惁鏈夎揣
List<string> LocationCodes = new List<string>();
- foreach (var item in rGVLocationInfos)
+ foreach (var items in rGVLocationInfos.GroupBy(x => x.RoadwayNo))//鏍规嵁宸烽亾鍙峰垎缁�
{
- Dt_RGVLocationInfo dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
- if (dt_RGVLocationInfo == null) return dt_RGVLocationInfo;
- dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == item.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth > item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _DepthAscOrderBy);
- }
- if (rGVLocationInfo != null)
- {
- List<string> NoRoadwayNos = new List<string>();
- while (true)
+ foreach (var item in items)
{
- Dt_RGVLocationInfo dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == rGVLocationInfo.RoadwayNo && x.Depth < rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
- if (dt_RGVLocationInfo == null) return rGVLocationInfo;
-
- rGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == dt_RGVLocationInfo.RoadwayNo && x.EnableStatus == EnableStatusEnum.Normal.ObjToInt() && x.Depth > dt_RGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.Free.ObjToInt(), _DepthAscOrderBy);
- dt_RGVLocationInfo = BaseDal.QueryFirst(x => x.RoadwayNo == rGVLocationInfo.RoadwayNo && x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt(), _emptyAssignOrderBy);
- if (dt_RGVLocationInfo == null) return rGVLocationInfo;
-
+ List<Dt_RGVLocationInfo> dt_RGVLocationInfos = BaseDal.QueryData(x => x.RoadwayNo == items.Key);//鏌ユ壘褰撳墠宸烽亾鍙疯揣浣�
+ rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.Depth < item.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault();//鍒ゆ柇娴呮繁搴﹁揣浣嶆槸鍚︽湁璐�
+ if (rGVLocationInfo != null)//娴呮繁搴﹁揣浣嶆湁璐э紝鎵炬繁娣卞害璐т綅鏄惁鏈夎揣
+ {
+ if (item.LocationType == 1) break;//宸烽亾绫诲瀷涓哄崟鍚戯紝鐩存帴璺宠繃
+ foreach (var locationInfo in rGVLocationInfos.Where(x => x.RoadwayNo == items.Key).OrderBy(x => x.Depth))
+ {
+ if (!dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.InStock.ObjToInt() && x.Depth > locationInfo.Depth).Any()) return locationInfo;
+ }
+ //rGVLocationInfo = dt_RGVLocationInfos.Where(x => x.LocationStatus == LocationStatusEnum.Free.ObjToInt()).OrderBy(x => x.Depth).FirstOrDefault();//鎵炬祬娣卞害绌鸿揣浣�
+ //if (rGVLocationInfo != null)
+ //{
+ // if (dt_RGVLocationInfos.Where(x => x.Depth > rGVLocationInfo.Depth && x.LocationStatus == LocationStatusEnum.InStock.ObjToInt()).FirstOrDefault() == null)//鍒ゆ柇娣辨繁搴﹁揣浣嶆槸鍚︽湁璐�
+ // return rGVLocationInfo;
+ //}
+ }
+ else return item;
}
}
#endregion
- return rGVLocationInfo;
+ return FreerGVLocationInfo;
}
}
}
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
index 0761bf8..a94fe87 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/KLSTaskMethods.cs"
@@ -27,6 +27,13 @@
try
{
int containerType = taskDTO.containerCode.Contains("LLM") ? LocationTypeEnum.LargePallet.ObjToInt() : LocationTypeEnum.SmallPallet.ObjToInt();
+ #region 鐐瑰埌鐐�
+ if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
+ {
+ var LocationInfo = _kLSLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐硅揣浣嶃�恵taskDTO.toLocationCode}銆�");
+ if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
+ }
+ #endregion
//鑾峰彇璐т綅淇℃伅
Dt_KLSLocationInfo? kLSLocationInfo = _kLSLocationInfoService.GetFreeLocationInfo(taskDTO.toAreaCode, containerType) ?? throw new Exception($"鏈壘鍒扮粓鐐瑰簱鍖恒�恵taskDTO.toAreaCode}銆戝彲鐢ㄧ┖璐т綅锛�");
Dt_Task dt_Task = new()
@@ -58,7 +65,7 @@
Db.Ado.RollbackTran();
throw new Exception(ex.Message);
}
-
+
return content.OK(data: new
{
taskCode = taskDTO.taskCode,
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
index 911a361..1da389c 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/RGVTaskMethods.cs"
@@ -31,6 +31,13 @@
WebResponseContent content = new WebResponseContent();
try
{
+ #region 鐐瑰埌鐐�
+ //if (!string.IsNullOrEmpty(taskDTO.toLocationCode))
+ //{
+ // var LocationInfo = _rGVLocationInfoService.Repository.QueryFirst(x => x.LocationCode == taskDTO.toLocationCode) ?? throw new Exception($"鏈壘鍒扮粓鐐硅揣浣嶃�恵taskDTO.toLocationCode}銆�");
+ // if (LocationInfo.LocationStatus != LocationStatusEnum.Free.ObjToInt()) throw new Exception($"缁堢偣璐т綅銆恵taskDTO.toLocationCode}銆戣揣浣嶇姸鎬佷笉涓虹┖璐т綅");
+ //}
+ #endregion
Dt_StationManger stationManger = _stationMangerService.GetInStationInfo(taskDTO.fromLocationCode) ?? throw new Exception($"鏈壘鍒拌捣鐐逛綅缃�恵taskDTO.fromLocationCode}銆戠珯鍙颁俊鎭紒");
Dt_Task dt_Task = new()
{
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
index d8b1305..99bb24d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs"
@@ -71,10 +71,10 @@
if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟缂栧彿銆恵hIKROBOT.robotTaskCode}銆�");
switch (hIKROBOT.extra.values.method)
{
- case "start":
+ case "end":
TaskCompleted(task, deviceTypeEnum);
break;
- case "end":
+ case "outbin":
TaskFromCompleted(task, deviceTypeEnum);
break;
default:
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
index adeaac1..510a784 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/Task/KLSTaskExtend.cs"
@@ -30,7 +30,7 @@
GALAXISTask gALAXISTask = new GALAXISTask()
{
taskId = task.WMSTaskNum,
- taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 2 : 1,
+ taskType = task.TaskType == (int)TaskTypeEnum.MLInbound ? 0 : 1,
barCode = task.PalletCode,
endNode = task.TargetAddress,
startNode = task.SourceAddress,
--
Gitblit v1.9.3