zhanghonglin
2025-07-11 4c6cf4c5bb9491dd98743f11fd3e657c2559523a
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -23,6 +23,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
@@ -198,7 +199,7 @@
                List<Dt_Task> tasks = new List<Dt_Task>();
                foreach (var item in taskDTOs)
                {
                    if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum || x.PalletCode == item.PalletCode) != null)
                    if (BaseDal.QueryFirst(x => x.TaskNum == item.TaskNum) != null)
                    {
                        flag = true;
                        continue;
@@ -217,14 +218,14 @@
                        if (taskTypeGroup == TaskTypeGroup.InboundGroup)
                        {
                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StationDeviceCode == item.SourceAddress);
                            if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt())
                            {
                                stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress);
                                //转换成品仓起点站台
                                item.SourceAddress = stationManger.StationCode;
                                task.CurrentAddress = stationManger.StationCode;
                                task.SourceAddress = stationManger.StationCode;
                            }
                            //if (stationManger==null && task.TaskType==TaskTypeEnum.InProduct.ObjToInt())
                            //{
                            //    stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode==task.SourceAddress);
                            //    //转换成品仓起点站台
                            //    item.SourceAddress = stationManger.StationCode;
                            //    task.CurrentAddress = stationManger.StationCode;
                            //    task.SourceAddress = stationManger.StationCode;
                            //}
                        }
                        else
                        {
@@ -244,10 +245,11 @@
                        if (routers.Count == 1)
                        {
                            if (taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode)
                            if (taskTypeGroup == TaskTypeGroup.InboundGroup)
                            {
                                task.CurrentAddress = router.StartPosi;
                                task.NextAddress = router.NextPosi;
                                task.DeviceCode = stationManger.StationDeviceCode;
                                task.DeviceCode = router.ChildPosiDeviceCode;
                            }
                            else if (item.TaskType == TaskTypeEnum.MesMatReturn.ObjToInt() && !router.IsEnd)
                            {
@@ -439,21 +441,34 @@
            WebResponseContent content = new WebResponseContent();
            try
            {
                string address = AppSettings.Get("WMSApiAddress");
                if (string.IsNullOrEmpty(address))
                //string address = AppSettings.Get("WMSApiAddress");
                //if (string.IsNullOrEmpty(address))
                //{
                //    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                //}
                //string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}");
                //WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                //if (responseContent != null && responseContent.Status && responseContent.Data != null)
                //{
                //    WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString());
                //    if (taskDTO != null)
                //    {
                WMSTaskDTO? taskDTO = new WMSTaskDTO()
                {
                    return WebResponseContent.Instance.Error($"未找到WMSApi地址");
                }
                string responseStr = HttpHelper.Get($"{address}/api/Task/DeviceRequestInboundTaskSimple?stationCode={sourceAddress}&palletCode={palletCode}");
                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
                if (responseContent != null && responseContent.Status && responseContent.Data != null)
                {
                    WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString());
                    if (taskDTO != null)
                    {
                        content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
                    }
                }
                    Id = 1,
                    TaskNum = DateTime.Now.ToString("mmss").ObjToInt(),
                    PalletCode="",
                    RoadWay="",
                    TaskType=TaskTypeEnum.InProduct.ObjToInt(),
                    TaskStatus=TaskStatusEnum.New.ObjToInt(),
                    SourceAddress= sourceAddress,
                    TargetAddress="",
                    WarehouseId=1,
                    Grade=0,
                };
                content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
                //    }
                //}
            }
            catch (Exception ex)