From 34bafb439a438c0f4e85ef7006dac590140d155c Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 01 十一月 2024 14:50:15 +0800
Subject: [PATCH] 联调程序变动

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs |   70 ++++++++++++++++++++++++++---------
 1 files changed, 52 insertions(+), 18 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 53676e6..1cdc30a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -1,4 +1,5 @@
 锘�#region << 鐗� 鏈� 娉� 閲� >>
+
 /*----------------------------------------------------------------
  * 鍛藉悕绌洪棿锛歐IDESEAWCS_TaskInfoService
  * 鍒涘缓鑰咃細鑳$搴�
@@ -11,32 +12,27 @@
  * 淇敼鏃堕棿锛�
  * 鐗堟湰锛歏1.0.1
  * 淇敼璇存槑锛�
- * 
+ *
  *----------------------------------------------------------------*/
+
 #endregion << 鐗� 鏈� 娉� 閲� >>
 
 using AutoMapper;
-using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
+using HslCommunication;
+using Newtonsoft.Json;
 using SqlSugar;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
 using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Reflection;
-using System.Text;
-using System.Threading.Tasks;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseServices;
-using WIDESEAWCS_Core.Enums;
+using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_DTO.WMS;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob.Models;
 using WIDESEAWCS_QuartzJob.Service;
-using WIDESEAWCS_Common.TaskEnum;
 
 namespace WIDESEAWCS_TaskInfoService
 {
@@ -53,7 +49,8 @@
                 {nameof(Dt_Task.CreateDate),OrderByType.Asc},
             };
 
-        public Dictionary<string, OrderByType> TaskOrderBy { get { return _taskOrderBy; } set { _taskOrderBy = value; } }
+        public Dictionary<string, OrderByType> TaskOrderBy
+        { get { return _taskOrderBy; } set { _taskOrderBy = value; } }
 
         public List<int> TaskInboundTypes => typeof(TaskInboundTypeEnum).GetEnumIndexList();
 
@@ -134,14 +131,41 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                #region 鐪熷疄鏁版嵁
+
+                // 鍒涘缓璇锋眰瀵硅薄
+                //RequestTaskDto request = new RequestTaskDto()
+                //{
+                //    Position = sourceAddress,
+                //    PalletCode = palletCode,
+                //};
+
+                //// 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
+                //var result = HttpHelper.PostAsync("http:127.0.0.1:8098/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
+
+                //// 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
+                //content = JsonConvert.DeserializeObject<WebResponseContent>(result);
+
+                //// 妫�鏌ョ姸鎬佸苟杩斿洖
+                //if (!content.Status)
+                //    return content;
+
+                //// 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
+                //WMSTaskDTO task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+
+                //// 澶勭悊浠诲姟骞惰繑鍥炵粨鏋�
+                //content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
+
+                #endregion
+
                 WMSTaskDTO taskDTO = new WMSTaskDTO()
                 {
                     TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
                     Grade = 1,
                     PalletCode = palletCode,
-                    RoadWay = "SC01",
+                    RoadWay = "CHSC01",
                     SourceAddress = sourceAddress,
-                    TargetAddress = "SC01",
+                    TargetAddress = "CHSC01",
                     TaskState = (int)TaskInStatusEnum.InNew,
                     Id = 0,
                     TaskType = (int)TaskInboundTypeEnum.Inbound
@@ -187,6 +211,17 @@
         public Dt_Task QueryCompletedConveyorLineTask(int taskNum, string currentAddress)
         {
             return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.Line_InFinish || x.TaskState == (int)TaskOutStatusEnum.Line_OutFinish), TaskOrderBy);
+        }
+
+        /// <summary>
+        /// 鏍规嵁浠诲姟鍙枫�佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏂板缓鐨勪换鍔�
+        /// </summary>
+        /// <param name="taskNum">浠诲姟鍙�</param>
+        /// <param name="currentAddress">褰撳墠鍦板潃</param>
+        /// <returns></returns>
+        public Dt_Task QueryCraneConveyorLineTask(int taskNum, string currentAddress)
+        {
+            return BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress && (x.TaskState == (int)TaskInStatusEnum.InNew || x.TaskState == (int)TaskOutStatusEnum.OutNew), TaskOrderBy);
         }
 
         /// <summary>
@@ -364,7 +399,7 @@
                     {
                         Random random = new Random();
                         task.CurrentAddress = task.NextAddress;
-                        task.NextAddress = $"{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}-{random.Next(1, 100).ToString().PadLeft(3, '0')}";
+                        task.NextAddress = $"{random.Next(1, 1).ToString().PadLeft(3, '0')}-{random.Next(1, 1).ToString().PadLeft(3, '0')}-{random.Next(1, 1).ToString().PadLeft(3, '0')}";
                         task.TargetAddress = task.NextAddress;
                     }
                 }
@@ -461,7 +496,7 @@
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup && task.TaskState == (int)TaskInStatusEnum.SC_InExecuting)
                 {
-                    //todo 
+                    //todo
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                     task.TaskState = nextStatus;
                     task.ModifyDate = DateTime.Now;
@@ -490,7 +525,6 @@
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OtherGroup)
                 {
-
                 }
                 else
                 {
@@ -596,4 +630,4 @@
             return content;
         }
     }
-}
+}
\ No newline at end of file

--
Gitblit v1.9.3