From e46aa927d231af83724683c7286d9db503e24cf7 Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期二, 10 六月 2025 11:46:20 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs |   49 +++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 45 insertions(+), 4 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
index 3668c2f..4ac9304 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs"
@@ -1,9 +1,12 @@
-锘縰sing Microsoft.AspNetCore.Authorization;
+锘縰sing System.Threading.Tasks;
+using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseController;
-using WIDESEAWCS_DTO.TaskInfo;
+using WIDESEAWCS_DTO.BasicInfo;
+using WIDESEAWCS_IBasicInfoService;
+using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 
@@ -14,11 +17,49 @@
     public class TaskController : ApiBaseController<ITaskService, Dt_Task>
     {
         private readonly IHttpContextAccessor _httpContextAccessor;
-        public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor) : base(service)
+        private readonly IOrderDetailsService _orderDetailsService;
+        private readonly ITaskRepository _taskRepository;
+
+        public TaskController(ITaskService service, IHttpContextAccessor httpContextAccessor, IOrderDetailsService orderDetailsService, ITaskRepository taskRepository) : base(service)
         {
             _httpContextAccessor = httpContextAccessor;
+            _orderDetailsService = orderDetailsService;
+            _taskRepository = taskRepository;
         }
 
-        
+        [HttpPost, HttpGet, Route("CreateTask"), AllowAnonymous]
+        public WebResponseContent CreateTask(string takePosition, string putPosition, string deviceCode, int length, int width, int height)
+        {
+            return Service.CreateTask(takePosition, putPosition, deviceCode, length, width, height);
+        }
+
+        [HttpPost, HttpGet, Route("PlaceBlockTest"), AllowAnonymous]
+        public WebResponseContent PlaceBlockTest(int orderRowId)
+        {
+            return Service.PlaceBlockTest(orderRowId);
+        }
+
+        [HttpPost, HttpGet, Route("GenerateTask"), AllowAnonymous]
+        public Dt_Task GenerateTask(string barcode)
+        {
+            OrderInfo orderInfo = _orderDetailsService.GetOrderInfoByBarcode(barcode);
+
+            var (flag, task, message) = Service.GenerateTask(orderInfo);
+            if (flag && task != null)
+                return task;
+            else
+                return new Dt_Task();
+        }
+
+        [HttpPost, HttpGet, Route("TaskComplete"), AllowAnonymous]
+        public WebResponseContent TaskComplete(int taskNum)
+        {
+            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == taskNum);
+            if (task == null)
+            {
+                return WebResponseContent.Instance.Error($"鏈壘鍒板搴斾换鍔′俊鎭�");
+            }
+            return Service.TaskComplete(task);
+        }
     }
 }

--
Gitblit v1.9.3