From ee1a08f59b6c532be931dae4d0d485cf77ae01af Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 13 三月 2026 10:39:27 +0800
Subject: [PATCH] 优化成品库入库外形检测逻辑
---
代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 200 +++++++++++++++++++++++++++++++++++++++----------
1 files changed, 159 insertions(+), 41 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index e29aaa4..63097eb 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -18,6 +18,7 @@
using AutoMapper;
using SixLabors.ImageSharp.ColorSpaces;
using SqlSugar;
+using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using WIDESEAWCS_BasicInfoService;
using WIDESEAWCS_Common;
@@ -89,53 +90,107 @@
WebResponseContent content = new WebResponseContent();
try
{
+ List<object> objects = new List<object>();
foreach (var item in taskDTOs)
{
foreach (var task in item.tasks)
{
+ #region 鍒ゆ柇
content = TaskHelpMethods.isOkTaskInfo(task, true, true);
- if (!content.Status) throw new Exception(content.Message);
- if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode) != null)
- throw new Exception($"浠诲姟鍙枫�恵task.taskCode}銆戝凡瀛樺湪浠诲姟");
- if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode) != null)
- throw new Exception($"鎵樼洏鍙枫�恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
- if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode) != null)
- throw new Exception($"璧风偣浣嶇疆銆恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
+ if (!content.Status)
+ {
+ objects.Add(new
+ {
+ taskCode = task.taskCode,
+ Message = $"浠诲姟鍙枫�恵task.taskCode}銆憑content.Message}"
+ });
+ continue;
+ //throw new Exception(content.Message);
+ }
+ if (BaseDal.QueryFirst(x => x.WMSTaskNum == task.taskCode && x.TaskType == item.taskType) != null)
+ {
+ objects.Add(new
+ {
+ taskCode = task.taskCode,
+ Message = $"浠诲姟鍙枫�恵task.taskCode}銆戝凡瀛樺湪浠诲姟"
+ });
+ continue;
+ //throw new Exception($"浠诲姟鍙枫�恵task.taskCode}銆戝凡瀛樺湪浠诲姟");
+ }
+ if (BaseDal.QueryFirst(x => x.PalletCode == task.containerCode && x.TaskType == item.taskType) != null)
+ {
+ objects.Add(new
+ {
+ taskCode = task.taskCode,
+ Message = $"鎵樼洏鍙枫�恵task.containerCode}銆戝凡瀛樺湪浠诲姟"
+ });
+ continue;
+ //throw new Exception($"鎵樼洏鍙枫�恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
+ }
+ if (BaseDal.QueryFirst(x => x.SourceAddress == task.fromLocationCode && x.TaskType == item.taskType) != null)
+ {
+ objects.Add(new
+ {
+ taskCode = task.taskCode,
+ Message = $"璧风偣浣嶇疆銆恵task.containerCode}銆戝凡瀛樺湪浠诲姟"
+ });
+ continue;
+ //throw new Exception($"璧风偣浣嶇疆銆恵task.containerCode}銆戝凡瀛樺湪浠诲姟");
+ }
+ #endregion
switch (item.taskType)
{
case (int)TaskTypeEnum.MLInbound:
- CreateKLSNewInTask(task, item.taskType);
+ content = CreateKLSNewInTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.MLOutbound:
- CreateKLSNewOutTask(task, item.taskType);
+ content = CreateKLSNewOutTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.CPInbound:
- CreateRGVNewInTask(task, item.taskType);
+ content = CreateRGVNewInTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.CPOutbound:
- CreateRGVNewOutTask(task, item.taskType);
+ content = CreateRGVNewOutTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.CJInbound:
- CreateHKNewInTask(task, item.taskType);
+ content = CreateHKNewInTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.CJOutbound:
- CreateHKNewOutTask(task, item.taskType);
+ content = CreateHKNewOutTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.Carry:
- CarryTask(task, item.taskType);
+ content = CarryTask(task, item.taskType);
+ objects.Add(content.Data);
break;
case (int)TaskTypeEnum.CJCarry:
- CJCarryTaske(task, item.taskType);
+ content = CJCarryTaske(task, item.taskType);
+ objects.Add(content.Data);
break;
default:
+ objects.Add(new
+ {
+ taskCode = task.taskCode,
+ Message = $"鏈畾涔夌殑浠诲姟绫诲瀷"
+ });
break;
}
}
}
+ content.Data = objects;
}
catch (Exception ex)
{
content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(taskDTOs, content, $"WMS涓嬪彂浠诲姟,", "", "");
}
return content;
}
@@ -178,6 +233,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒板嚡涔愬+AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, KLS.Serialize());
GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
+ content.OK(data: agvContent);
if (agvContent.success == true && agvContent.code == 0)
{
//鐩存帴绉诲叆鍘嗗彶
@@ -204,6 +260,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, cancelSXCTake.Serialize());
FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+ content.OK(data: fOURBOTReturn);
if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "鎴愬姛")
{
//鐩存帴绉诲叆鍘嗗彶
@@ -216,6 +273,7 @@
}
}
#endregion
+
#region 娴峰悍
if (isHK)
{
@@ -228,6 +286,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, cancelHIKROBOTTask.Serialize());
HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+ content.OK(data: hIKROBOTReturn);
if (hIKROBOTReturn.code == "SUCCESS" && hIKROBOTReturn.message == "鎴愬姛")
{
//鐩存帴绉诲叆鍘嗗彶
@@ -318,6 +377,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒板嚡涔愬+AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, updateGALAXISTaskGrade.Serialize());
GALAXISReturn agvContent = response.DeserializeObject<GALAXISReturn>();
+ content.OK(data: agvContent);
if (agvContent.success == true && agvContent.code == 0)
{
@@ -343,6 +403,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒版洿鏂板洓鍚戣溅浠诲姟浼樺厛绾ф帴鍙i厤缃俊鎭紒璇锋鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, request.Serialize());
FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+ content.OK(data: fOURBOTReturn);
if (fOURBOTReturn.returnCode == 0 && fOURBOTReturn.returnUserMsg == "鎴愬姛")
{
BaseDal.UpdateData(dt_Task);
@@ -367,6 +428,7 @@
if (apiInfo == null) throw new Exception("鏈壘鍒板洓鍚戣溅AGV浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
string response = HttpHelper.Post(apiInfo.ApiAddress, Hkrequest.Serialize());
HIKROBOTReturn hIKROBOTReturn = response.DeserializeObject<HIKROBOTReturn>();
+ content.OK(data: hIKROBOTReturn);
if (hIKROBOTReturn.code == "SUCCESS0" && hIKROBOTReturn.message == "鎴愬姛")
{
BaseDal.UpdateData(dt_Task);
@@ -1017,14 +1079,69 @@
/// <param name="AreaCode"></param>
/// <returns></returns>
/// <exception cref="NotImplementedException">鍖哄煙鍙�</exception>
- public WebResponseContent LocationInquiry(string AreaCode)
+ public WebResponseContent LocationInquiry(WMSGetLocationInfo getLocationInfo)
{
- if (AreaCode == null)
+ WebResponseContent content = new WebResponseContent();
+ List<object> list = new List<object>();
+ try
{
- //鏌ヨ杈撻�佺嚎绌烘墭缂撳瓨淇℃伅鏃惰繑鍥炵┖浣嶆暟閲�
- }
- return WebResponseContent.Instance.OK();
+ if (getLocationInfo == null) throw new Exception("璇锋眰鍙傛暟涓嶈兘涓虹┖锛�");
+ //if (getLocationInfo.AreaCode == null) throw new Exception("搴撳尯缂栧彿涓嶈兘涓虹┖锛�");
+ if (getLocationInfo.WarehouseId == 0) throw new Exception("浠撳簱ID涓嶈兘涓虹┖锛�");
+ if (getLocationInfo.WarehouseId == 1)
+ {
+ List<Dt_RGVLocationInfo> rGVLocationInfos = new List<Dt_RGVLocationInfo>();
+ if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
+ rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
+ else
+ rGVLocationInfos = _rGVLocationInfoService.Repository.QueryData();
+ foreach (var item in rGVLocationInfos)
+ {
+ list.Add(new
+ {
+ LoctionCode = item.LocationCode,
+ LocationStatus = item.LocationStatus,
+ EnableStatus = item.EnableStatus
+ });
+ }
+ content.OK(data: list);
+ }
+ else if (getLocationInfo.WarehouseId == 2)
+ {
+ List<Dt_KLSLocationInfo> rGVLocationInfos = new List<Dt_KLSLocationInfo>();
+ if (!string.IsNullOrEmpty(getLocationInfo.AreaCode))
+ rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData(x => x.WarehouseId == getLocationInfo.AreaCode.ObjToInt());
+ else
+ rGVLocationInfos = _kLSLocationInfoService.Repository.QueryData();
+ foreach (var item in rGVLocationInfos)
+ {
+ list.Add(new
+ {
+ LoctionCode = item.LocationCode,
+ LocationStatus = item.LocationStatus,
+ EnableStatus = item.EnableStatus
+ });
+ }
+ content.OK(data: list);
+ }
+ else if (getLocationInfo.WarehouseId == 3)
+ {
+ }
+ else if (getLocationInfo.WarehouseId == 4)
+ {
+
+ }
+ else if (getLocationInfo.WarehouseId == 5)
+ {
+
+ }
+ }
+ catch (Exception ex)
+ {
+ content.Error(ex.Message);
+ }
+ return content;
}
@@ -1120,33 +1237,34 @@
};
string response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOToccupyStation.Serialize());
FOURBOTReturn fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
- if (fOURBOTReturn.returnCode != 0 && fOURBOTReturn.returnUserMsg != $"绔欑偣宸茶鍗犵敤,(podID={iQC.ContainerCode})")
+ content.OK(data: fOURBOTReturn);
+ if (fOURBOTReturn.returnCode != 0 /*&& fOURBOTReturn.returnUserMsg != $"绔欑偣宸茶鍗犵敤,(podID={iQC.ContainerCode})"*/)
throw new Exception(fOURBOTReturn.returnUserMsg);
#endregion
#region 鍒涘缓鍥涘悜杞︿换鍔�
- var task = BaseDal.QueryFirst(x => x.PalletCode == iQC.ContainerCode && x.SourceAddress == iQC.StationCode && x.TaskState == (int)TaskStatusEnum.New);
+ //var task = BaseDal.QueryFirst(x => x.PalletCode == iQC.ContainerCode && x.SourceAddress == iQC.StationCode && x.TaskState == (int)TaskStatusEnum.New);
#endregion
#region 鍛煎彨鍥涘悜杞�
- apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
- FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new()
- {
- priority = task.Grade,
- podID = task.PalletCode,
- //desNodeID = task.SourceAddress,
- desExt = new
- {
- unload = 0//鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
- },
- desStationCodes = task.SourceAddress,
- desType = 5
- };
- response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
- fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
- content.Data = fOURBOTReturn;
- if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg);
- task.TaskState = (int)TaskStatusEnum.Execut;
- BaseDal.UpdateData(task);
+ //apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(FOURBOTnewMovePodTask)) ?? throw new Exception("鏈壘鍒板洓鍚戣溅浠诲姟涓嬪彂鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�");
+ //FOURBOTnewMovePodTask fOURBOTnewMovePodTask = new()
+ //{
+ // priority = task.Grade,
+ // podID = task.PalletCode,
+ // //desNodeID = task.SourceAddress,
+ // desExt = new
+ // {
+ // unload = 0//鏄惁鏀句笅瀹瑰櫒,0鍚�1鏄�
+ // },
+ // desStationCodes = task.SourceAddress,
+ // desType = 5
+ //};
+ //response = HttpHelper.Post(apiInfo.ApiAddress, fOURBOTnewMovePodTask.Serialize());
+ //fOURBOTReturn = response.DeserializeObject<FOURBOTReturn>();
+ //content.Data = fOURBOTReturn;
+ //if (fOURBOTReturn.returnCode != 0) throw new Exception(fOURBOTReturn.returnUserMsg);
+ //task.TaskState = (int)TaskStatusEnum.Execut;
+ //BaseDal.UpdateData(task);
#endregion
return WebResponseContent.Instance.OK();
}
--
Gitblit v1.9.3