yanjinhui
11 小时以前 cba2c0ff983f40757aa9840a3bd520c28a9896d9
´úÂë¹ÜÀí/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskMethods.cs
@@ -317,31 +317,40 @@
                    var task = BaseDal.QueryFirst(x => x.PalletCode == Rgv.content.podID);
                    if (task == null) throw new Exception($"未找到任务,任务编号【{Rgv.content.taskID}】");
                    //移库
                    if (task.TaskType == TaskTypeEnum.CPMoveInventory.ObjToInt() && Rgv.messageType == 10 && Rgv.content.status == 4)
                    if (task.TaskType == TaskTypeEnum.CPMoveInventory.ObjToInt())
                    {
                        deviceName += "移库";
                        WMSMoveLocationFeedback wMSMoveLocationFeedback = new WMSMoveLocationFeedback()
                        if (Rgv.messageType == 72)
                        {
                            containerCode = task.PalletCode,
                            fromStationCode = task.SourceAddress,
                            toLocationCode = task.TargetAddress
                        };
                        Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSMoveLocationFeedback));
                        WMSReturn agvContent = null;
                        if (apiInfo == null) task.ExceptionMessage = "未找到移库完成反馈WMS接口配置信息!请检查接口配置";
                        else
                            task.TaskState = TaskStatusEnum.TakeFinish.ObjToInt();
                            BaseDal.UpdateData(task);
                            UpdateLocationStatus(task.SourceAddress, task.PalletCode, deviceTypeEnum, LocationStatusEnum.Free);
                        }
                        if (Rgv.messageType == 10 && Rgv.content.status == 4)
                        {
                            task.TaskState = TaskStatusEnum.Finish.ObjToInt();
                            string response = HttpHelper.Post(apiInfo.ApiAddress, wMSMoveLocationFeedback.Serialize());
                            agvContent = response.DeserializeObject<WMSReturn>();
                            content.OK(data: agvContent);
                            if (agvContent.code != 200)
                            deviceName += "移库";
                            WMSMoveLocationFeedback wMSMoveLocationFeedback = new WMSMoveLocationFeedback()
                            {
                                task.ExceptionMessage = agvContent.message;
                                content.Error(agvContent.message);
                                containerCode = task.PalletCode,
                                fromStationCode = task.SourceAddress,
                                toLocationCode = task.TargetAddress
                            };
                            Dt_ApiInfo? apiInfo = _apiInfoService.Repository.QueryFirst(x => x.ApiCode == nameof(WMSMoveLocationFeedback));
                            WMSReturn agvContent = null;
                            if (apiInfo == null) task.ExceptionMessage = "未找到移库完成反馈WMS接口配置信息!请检查接口配置";
                            else
                            {
                                task.TaskState = TaskStatusEnum.Finish.ObjToInt();
                                string response = HttpHelper.Post(apiInfo.ApiAddress, wMSMoveLocationFeedback.Serialize());
                                agvContent = response.DeserializeObject<WMSReturn>();
                                content.OK(data: agvContent);
                                if (agvContent.code != 200)
                                {
                                    task.ExceptionMessage = agvContent.message;
                                    content.Error(agvContent.message);
                                }
                                UpdateLocationStatus(task.TargetAddress, task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
                                BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.自动完成);
                            }
                            UpdateLocationStatus(task.TargetAddress, task.PalletCode, deviceTypeEnum, LocationStatusEnum.InStock);
                            BaseDal.DeleteAndMoveIntoHty(task, OperateTypeEnum.自动完成);
                        }
                    }
                    else
@@ -397,16 +406,24 @@
                            {
                                task.ExceptionMessage = Rgv.content.errorReason;
                                var Error = _taskErrorMessageService.Repository.QueryFirst(x => x.ErrorCode == Rgv.content.errorCode && x.DeviceType == (int)deviceTypeEnum);
                                if (Error != null)
                                if (task.TaskType == (int)TaskTypeEnum.CPOutbound && task.TaskState == (int)TaskStatusEnum.Execut && Rgv.content.errorCode == 1330003)//成品出库任务下发后反馈有阻碍托,修改任务状态为新建重新查询阻碍托关系
                                {
                                    task.ExceptionMessage = Error.ExceptionMessage;
                                    MatchCollection matches = Regex.Matches(Rgv.content.errorReason, @"\(([^)]+)\)");
                                    if (matches.Count > 0)
                                        task.ExceptionMessage = ReplacePlaceholders(Rgv.content.errorReason, Error.ExceptionMessage);
                                    ErrorTaskFeedback(task, true, Error.ErrorCode.ToString());
                                    task.TaskState = (int)TaskStatusEnum.New;
                                    BaseDal.UpdateData(task);
                                }
                                else
                                    ErrorTaskFeedback(task, true);
                                {
                                    if (Error != null)
                                    {
                                        task.ExceptionMessage = Error.ExceptionMessage;
                                        MatchCollection matches = Regex.Matches(Rgv.content.errorReason, @"\(([^)]+)\)");
                                        if (matches.Count > 0)
                                            task.ExceptionMessage = ReplacePlaceholders(Rgv.content.errorReason, Error.ExceptionMessage);
                                        ErrorTaskFeedback(task, true, Error.ErrorCode.ToString());
                                    }
                                    else
                                        ErrorTaskFeedback(task, true);
                                }
                            }
                        }
                    }