From 813d932834bd802364c045f890cc4d864aa76836 Mon Sep 17 00:00:00 2001
From: zhanghonglin <zhanghonglin@hnkhzn.com>
Date: 星期日, 13 七月 2025 12:46:51 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs |   66 ++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 25 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 5a885e6..1b446a7 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/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($"鏈壘鍒癢MSApi鍦板潃");
+                //}
+                //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($"鏈壘鍒癢MSApi鍦板潃");
-                }
-                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)
@@ -730,6 +745,7 @@
         /// <returns>杩斿洖浠诲姟瀹炰綋瀵硅薄锛屽彲鑳戒负null</returns>
         public Dt_Task QueryStackerCraneTask(string deviceNo, string currentAddress = "")
         {
+            //鍒ゆ柇鏄惁涓虹┖
             if (string.IsNullOrEmpty(currentAddress))
                 return BaseDal.QueryFirst(x => x.DeviceCode == deviceNo && x.TaskState == (int)TaskStatusEnum.SC_Execute, TaskOrderBy);
             else

--
Gitblit v1.9.3