yanjinhui
2026-03-12 9178986ebfa6e3e009b78768b776bc7335d765a2
´úÂë¹ÜÀí/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;
@@ -123,6 +124,10 @@
                            else if (task.TaskType == (int)TaskTypeEnum.CPInbound && task.TaskState == (int)TaskStatusEnum.Puting)
                            {
                                TaskCompleted(task, deviceTypeEnum);
                            }
                            else if (task.TaskType == (int)TaskTypeEnum.CPInbound && !string.IsNullOrEmpty(task.ExceptionMessage))
                            {
                                ErrorTaskFeedback(task, !task.ExceptionMessage.Contains("外检失败"));
                            }
                            else if (task.TaskType == (int)TaskTypeEnum.CPOutbound || task.TaskType == (int)TaskTypeEnum.CPMoveInventory)//出库、移库完成
                            {
@@ -385,5 +390,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接口配置信息!请检查接口配置";
                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, "出入库任务状态反馈WMS", "", "");
                if (agvContent != null && agvContent.code == 200 && Del) BaseDal.DeleteAndMoveIntoHty(dt_Task, OperateTypeEnum.自动删除);
                else BaseDal.UpdateData(dt_Task);
            }
            return content;
        }
        #endregion
    }
}