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/TaskMethods.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 96 insertions(+), 24 deletions(-)
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 ca5fdbb..104b6cc 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"
@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net.NetworkInformation;
using System.Reflection.Metadata;
using System.Text;
using System.Text.Json;
@@ -78,6 +79,10 @@
case "outbin":
TaskFromCompleted(task, deviceTypeEnum);
break;
+ case "start":
+ task.TaskState = (int)TaskStatusEnum.Takeing;
+ TaskFeedback(task, 1);
+ break;
default:
task.TaskState = ReturnTaskStatus(hIKROBOT.extra.values.method, deviceTypeEnum);
BaseDal.UpdateData(task);
@@ -91,36 +96,56 @@
//var task = BaseDal.QueryFirst(x => x.RGVTaskId == Rgv.content.taskID);
var task = BaseDal.QueryFirst(x => x.PalletCode == Rgv.content.podID);
if (task == null) throw new Exception($"鏈壘鍒颁换鍔�,浠诲姟缂栧彿銆恵Rgv.content.taskID}銆�");
- if (Rgv.messageType == 72)//灏忚溅椤惰捣璐х墿
+ if (task.TaskType == TaskTypeEnum.CPMoveInventory.ObjToInt())
{
- if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Execut)
- {
- task.TaskState = (int)TaskStatusEnum.WaiCheckShape;
- BaseDal.UpdateData(task);//缁欒川妫�闂ㄥ啓鍏ュ惎鍔ㄤ俊鍙�
- var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice ?? throw new Exception("鏈壘鍒�1妤艰川妫�闂ㄨ澶囦俊鎭�");
- device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, true, task.SourceAddress);
- }
- else
- {
- TaskFromCompleted(task, deviceTypeEnum);
- }
+
}
- else if (Rgv.messageType == 10)
+ else
{
- if (Rgv.content.status == 4)
+ if (Rgv.messageType == 72)//灏忚溅椤惰捣璐х墿
{
- if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.TakeFinish)
+ if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Execut)
{
- task.TaskState = (int)TaskStatusEnum.CheckShapeing;
- BaseDal.UpdateData(task);
+ task.TaskState = (int)TaskStatusEnum.WaiCheckShape;
+ //BaseDal.UpdateData(task);//缁欒川妫�闂ㄥ啓鍏ュ惎鍔ㄤ俊鍙�
+ var device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "F1") as OtherDevice;
+ if (device == null) task.ExceptionMessage = "鏈壘鍒�1妤艰川妫�闂ㄨ澶囦俊鎭�";
+ else
+ {
+ if (device.IsConnected)
+ device.SetValue(QualityInspectionCommandEnum.StartqualityInspection, true, task.SourceAddress);
+ else
+ task.ExceptionMessage = "1妤艰川妫�闂ㄨ澶囪繛鎺ュけ璐�";
+ }
+ TaskFeedback(task, 4);
}
- else if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Puting)
+ else
{
- TaskCompleted(task, deviceTypeEnum);
+ TaskFromCompleted(task, deviceTypeEnum);
}
- else if (task.TaskType == (int)TaskTypeEnum.CPOutbound || task.TaskType == (int)TaskTypeEnum.CPMoveInventory)//鍑哄簱銆佺Щ搴撳畬鎴�
+ }
+ else if (Rgv.messageType == 10)
+ {
+ if (Rgv.content.status == 2) TaskFeedback(task, 1);
+ if (Rgv.content.status == 4)
{
- TaskCompleted(task, deviceTypeEnum);
+ if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.TakeFinish)
+ {
+ if (!string.IsNullOrEmpty(task.ExceptionMessage)) task.TaskState = TaskStatusEnum.CheckShapeingNG.ObjToInt();
+ else task.TaskState = (int)TaskStatusEnum.CheckShapeing;
+ BaseDal.UpdateData(task);
+ }
+ else if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Puting)
+ {
+ if (!string.IsNullOrEmpty(task.ExceptionMessage))
+ ErrorTaskFeedback(task, true/*!task.ExceptionMessage.Contains("澶栨澶辫触")*/);
+ else
+ TaskCompleted(task, deviceTypeEnum);
+ }
+ else if (task.TaskType == (int)TaskTypeEnum.CPOutbound || task.TaskType == (int)TaskTypeEnum.CPMoveInventory)//鍑哄簱銆佺Щ搴撳畬鎴�
+ {
+ TaskCompleted(task, deviceTypeEnum);
+ }
}
}
}
@@ -356,8 +381,12 @@
boundCompleteFeedback.custStatus = "";
string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
agvContent = response.DeserializeObject<WMSReturn>();
- content.Data = agvContent;
- if (agvContent.code != 0) dt_Task.ExceptionMessage = agvContent.msg;
+ content.OK(data: agvContent);
+ if (agvContent.code != 200)
+ {
+ dt_Task.ExceptionMessage = agvContent.message;
+ content.Error(agvContent.message);
+ }
}
}
catch (Exception ex)
@@ -367,7 +396,7 @@
finally
{
_trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
- if (agvContent != null && agvContent.code == 0 && Status == 2)
+ if (agvContent != null && agvContent.code == 200 && Status == 2)
BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩瀹屾垚);
else
BaseDal.UpdateData(dt_Task);
@@ -375,5 +404,48 @@
return WebResponseContent.Instance.OK();
}
#endregion
+ #region 澶辫触浠诲姟涓婃姤WMS骞跺垹闄や换鍔�
+ public WebResponseContent ErrorTaskFeedback(Dt_Task dt_Task, bool Del)
+ {
+ WebResponseContent content = new WebResponseContent();
+ WMSInOutBoundCompleteFeedback boundCompleteFeedback = new WMSInOutBoundCompleteFeedback();
+ WMSReturn agvContent = null;
+ try
+ {
+ Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSInOutBoundCompleteFeedback));
+ if (apiInfo == null) dt_Task.ExceptionMessage = "鏈壘鍒板嚭鍏ュ簱瀹屾垚鍙嶉WMS鎺ュ彛閰嶇疆淇℃伅锛佽妫�鏌ユ帴鍙i厤缃�";
+ else
+ {
+ boundCompleteFeedback.taskCode = dt_Task.WMSTaskNum;
+ boundCompleteFeedback.containerCode = dt_Task.PalletCode;
+ boundCompleteFeedback.fromStationCode = dt_Task.SourceAddress;
+ boundCompleteFeedback.toLocationCode = dt_Task.TargetAddress;
+ boundCompleteFeedback.status = 3;
+ boundCompleteFeedback.custStatus = "";
+ boundCompleteFeedback.memo = dt_Task.ExceptionMessage;
+ string response = HttpHelper.Post(apiInfo.ApiAddress, boundCompleteFeedback.Serialize());
+ agvContent = response.DeserializeObject<WMSReturn>();
+ content.OK(data: agvContent);
+ if (agvContent.code != 200)
+ {
+ dt_Task.ExceptionMessage = agvContent.message;
+ content.Error(agvContent.message);
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ dt_Task.ExceptionMessage = ex.Message;
+ content.Error(ex.Message);
+ }
+ finally
+ {
+ _trackloginfoService.AddTrackLog(boundCompleteFeedback, content, "鍑哄叆搴撲换鍔$姸鎬佸弽棣圵MS", "", "");
+ if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.鑷姩鍒犻櫎);
+ else BaseDal.UpdateData(dt_Task);
+ }
+ return content;
+ }
+ #endregion
}
}
--
Gitblit v1.9.3