刘磊
2024-12-17 f7f1f176f931f5ad54056df7b8e8a9f028eea100
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -96,8 +96,20 @@
                if (!content.Status)
                {
                    // wms失败返回去NG口任务
                    //if (stationManager.stationChildCode != stationManager.stationNGChildCode)
                    //{
                    //    WMSTaskDTO taskDTO = new WMSTaskDTO()
                    //    {
                    //        Grade = 8,
                    //        PalletCode = palletCode,
                    //        SourceAddress = stationManager.stationLocation,
                    //        TargetAddress = stationManager.stationNGLocation,
                    //        RoadWay = stationManager.Roadway,
                    //        TaskNum = 1000,
                    //        TaskState = (int)TaskOutStatusEnum.OutNew,
                    //        TaskType = (int)TaskOutboundTypeEnum.InToOut
                    //    };
                    //}
                    return content;
                }
@@ -111,6 +123,45 @@
            }
        }
        public async Task<WebResponseContent> RequestOutTaskToBZAsync(Dt_StationManager stationManager)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
                var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestOutTaskToBZ)?.ConfigValue;
                if (wmsBase == null || requestTask == null)
                {
                    throw new InvalidOperationException("WMS IP 未配置");
                }
                var wmsIpAddrss = wmsBase + requestTask;
                var result = await HttpHelper.PostAsync(wmsIpAddrss, new { }.ToJsonString());
                content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                if (!content.Status)
                {
                    //无满足条件可出库至包装的库存
                    return content;
                }
                var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
                ConsoleHelper.WriteSuccessLine(content.Data.ToString());
                content = ReceiveByWMSTask(task);
                //if (content.Status)
                //{
                //    //相应的在途数据+1
                //   // _taskNeedBarcodeRepository.UpdateData();
                //}
                return content;
            }
            catch (Exception ex)
            {
                return content.Error(ex.Message);
            }
        }
        /// <summary>
        /// 接收WMS任务信息
        /// </summary>