From 0864509e1eb593c3dedb66196ec19fe51437922b Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期一, 26 五月 2025 10:25:42 +0800
Subject: [PATCH] 新增货位管理,PDA扫码生成任务烘烤出料,烘烤回炉,空托回流

---
 代码管理/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs |  207 ++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 194 insertions(+), 13 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
index ea6bac0..b0f3247 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskCZService.cs"
@@ -26,18 +26,26 @@
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
-
+using WIDESEAWCS_ISystemServices;
+using WIDESEAWCS_ISystemRepository;
+using WIDESEA_Common;
+using WIDESEA_Core.Enums;
+using SqlSugar.Extensions;
 namespace WIDESEAWCS_TaskInfoService
 {
     public class TaskCZService : ServiceBase<DtCZTask, ITaskCZRepository>, ITaskCZService
     {
         private readonly ITaskRepository _taskRepository;
+        private readonly ITaskService _taskService;
         private readonly ITaskCZDetailsRepository _detailsRepository;
+        private readonly IDt_StationinfoRepository _stationinfoRepository;
 
-        public TaskCZService(ITaskCZRepository BaseDal, ITaskRepository taskRepository, ITaskCZDetailsRepository detailsRepository) : base(BaseDal)
+        public TaskCZService(ITaskCZRepository BaseDal, IDt_StationinfoRepository stationinfoRepository, ITaskService taskService, ITaskRepository taskRepository, ITaskCZDetailsRepository detailsRepository) : base(BaseDal)
         {
             _taskRepository = taskRepository;
             _detailsRepository = detailsRepository;
+            _taskService = taskService;
+            _stationinfoRepository = stationinfoRepository;
         }
 
         public Task<WebResponseContent> AddTaskCZAsync(CZTaskDto dto)
@@ -165,7 +173,7 @@
         }
 
         /// <summary>
-        /// 杈撻�佺嚎鍥炴祦
+        /// 绌烘墭鍥炴祦
         /// </summary>
         /// <param name="saveModel"></param>
         /// <returns></returns>
@@ -174,23 +182,196 @@
             WebResponseContent webResponseContent = new WebResponseContent();
             try
             {
+                //閫氳繃绔欑偣琛ㄥ垽鏂紦瀛樻灦鏄偅涓尯鍩熷幓閭f潯杈撻�佺嚎鍥炴祦鍙c�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
                 string Saddress = saveModel.MainData["sourceAddress"].ToString();
                 string Taddress = saveModel.MainData["targetAddress"].ToString();
-                string Exception = saveModel.MainData["Exception"].ToString();
-                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == Saddress && x.TaskState == (int)TaskInStatusEnum.InPending && x.TargetAddress == "WaitBind");
-                if (task == null)
+                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == Saddress);
+                if (task != null)
                 {
-                    webResponseContent.Error("浠诲姟涓嶅瓨鍦紒");
+                    webResponseContent.Error("姝ょ紦瀛樻灦宸插瓨鍦ㄤ换鍔★紒");
                     return Task.FromResult(webResponseContent);
                 }
-                task.TargetAddress = Taddress;
-                task.ExceptionMessage = Exception;
-                task.TaskState = (int)TaskInStatusEnum.InNew;
-                var isTrue = _taskRepository.UpdateData(task);
-                if (isTrue)
+                Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress);
+
+                Dt_Task dt_Task = new Dt_Task();
+                dt_Task.TaskNum = _taskService.GetTaskNum();
+                dt_Task.CreateDate = DateTime.Now;
+                dt_Task.Creater = "system";
+                dt_Task.CurrentAddress = Saddress;
+                dt_Task.SourceAddress = Saddress;
+                dt_Task.TaskState = (int)TaskInStatusEnum.InNew;
+                dt_Task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
+                dt_Task.Grade = 1;
+                dt_Task.PalletCode = "";
+                if (Stationinfo.Area == "姝f瀬")
                 {
-                    webResponseContent.OK("浠诲姟涓嬪彂鎴愬姛锛�");
+                    dt_Task.TargetAddress = "姝f瀬鍥炴祦杈撻�佺嚎鍏ュ彛";
                 }
+                else
+                {
+                    dt_Task.TargetAddress = "璐熸瀬鍥炴祦杈撻�佺嚎鍏ュ彛";
+                }
+                dt_Task.NextAddress = dt_Task.TargetAddress;
+                dt_Task.Barcode = "";
+                dt_Task.Roadway = "AGV";
+                dt_Task.WMSId = 0;
+                dt_Task.Remark = "绌烘墭鍥炴祦";
+
+                Dt_Task dt_Tasks = new Dt_Task();
+                dt_Tasks.TaskNum = _taskService.GetTaskNum();
+                dt_Tasks.CreateDate = DateTime.Now;
+                dt_Tasks.Creater = "system";
+                if (Stationinfo.Area == "姝f瀬")
+                {
+                    dt_Task.CurrentAddress = "姝f瀬鍥炴祦杈撻�佺嚎鍑哄彛";
+                }
+                else
+                {
+                    dt_Task.CurrentAddress = "璐熸瀬鍥炴祦杈撻�佺嚎鍑哄彛";
+                }
+                dt_Tasks.SourceAddress = dt_Task.CurrentAddress;
+                dt_Tasks.TaskState = (int)TaskInStatusEnum.InPending;
+                dt_Tasks.TaskType = (int)TaskOutboundTypeEnum.Outbound;
+                dt_Tasks.Grade = 1;
+                dt_Tasks.PalletCode = "";
+                dt_Tasks.TargetAddress = Taddress;
+                dt_Tasks.NextAddress = Taddress;
+                dt_Tasks.Barcode = "";
+                dt_Tasks.Roadway = "AGV";
+                dt_Tasks.WMSId = 0;
+                dt_Tasks.Remark = "绌烘墭鍥炴祦";
+
+                var isTrue = _taskRepository.AddData(dt_Task);
+                var isTrue1 = _taskRepository.AddData(dt_Tasks);
+                webResponseContent.OK("浠诲姟涓嬪彂鎴愬姛锛�");
+            }
+            catch (Exception ex)
+            {
+                webResponseContent.Error(ex.Message);
+            }
+            return Task.FromResult(webResponseContent);
+        }
+        /// <summary>
+        /// 鐑樼儰鍑烘枡
+        /// </summary>
+        /// <param name="sourceAddress"></param>
+        /// <returns></returns>
+        public Task<WebResponseContent> OutBoundTask(string sourceAddress)
+        {
+            WebResponseContent webResponseContent = new WebResponseContent();
+            try
+            {
+                Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == sourceAddress);
+                if (task != null)
+                {
+                    webResponseContent.Error("璧风偣宸插瓨鍦ㄤ换鍔★紒");
+                    return Task.FromResult(webResponseContent);
+                }
+                Dt_Stationinfo stationinfo = _stationinfoRepository.QueryFirst(x => x.Location_state == LocationStatusEnum.Free.ObjToInt());
+                if (stationinfo == null)
+                {
+                    webResponseContent.Error("鏈壘鍒扮┖缂撳瓨鏋舵斁缃紒");
+                    return Task.FromResult(webResponseContent);
+                }
+                Dt_Task tasks = _taskRepository.QueryFirst(x => x.SourceAddress == stationinfo.StationCode || x.TargetAddress == stationinfo.StationCode);
+                if (tasks != null)
+                {
+                    webResponseContent.Error("鏈壘鍒板彲鐢ㄧ紦瀛樻灦");
+                    return Task.FromResult(webResponseContent);
+                }
+                Dt_Task dt_Task = new Dt_Task()
+                {
+                    TaskNum = _taskService.GetTaskNum(),
+                    CreateDate = DateTime.Now,
+                    Creater = "system",
+                    CurrentAddress = sourceAddress,
+                    SourceAddress = sourceAddress,
+                    TaskState = (int)TaskInStatusEnum.InNew,
+                    TaskType = (int)TaskOutboundTypeEnum.Outbound,
+                    Grade = 1,
+                    PalletCode = "",
+                    TargetAddress = stationinfo.StationCode,
+                    NextAddress = stationinfo.StationCode,
+                    Barcode = "",
+                    Roadway = "AGV",
+                    WMSId = 0,
+                    Remark = "绌烘墭鍥炴祦"
+                };
+                var isTrue = _taskRepository.AddData(dt_Task);
+                webResponseContent.OK("浠诲姟涓嬪彂鎴愬姛锛�");
+            }
+            catch (Exception ex)
+            {
+                webResponseContent.Error(ex.Message);
+            }
+            return Task.FromResult(webResponseContent);
+        }
+        /// <summary>
+        /// 鐑樼儰鍥炵倝
+        /// </summary>
+        /// <param name="saveModel"></param>
+        /// <returns></returns>
+        public Task<WebResponseContent> OutBoundTasks(SaveModel saveModel)
+        {
+            WebResponseContent webResponseContent = new WebResponseContent();
+            try
+            {
+                //閫氳繃绔欑偣琛ㄥ垽鏂紦瀛樻灦鏄偅涓尯鍩熷幓閭f潯杈撻�佺嚎鍥炴祦鍙c�傘�傘�傘�傘�傘�傘�傘�傘�傘�傘��
+                string Saddress = saveModel.MainData["sourceAddress"].ToString();
+                string Taddress = saveModel.MainData["targetAddress"].ToString();
+
+                Dt_Stationinfo Stationinfo = _stationinfoRepository.QueryFirst(x => x.StationCode == Saddress);
+
+                Dt_Task dt_Task = new Dt_Task();
+                dt_Task.TaskNum = _taskService.GetTaskNum();
+                dt_Task.CreateDate = DateTime.Now;
+                dt_Task.Creater = "system";
+                dt_Task.CurrentAddress = Saddress;
+                dt_Task.SourceAddress = Saddress;
+                dt_Task.TaskState = (int)TaskInStatusEnum.InNew;
+                dt_Task.TaskType = (int)TaskOutboundTypeEnum.Outbound;
+                dt_Task.Grade = 1;
+                dt_Task.PalletCode = "";
+                if (Stationinfo.Area == "姝f瀬")
+                {
+                    dt_Task.TargetAddress = "姝f瀬鍥炴祦杈撻�佺嚎鍏ュ彛";
+                }
+                else
+                {
+                    dt_Task.TargetAddress = "璐熸瀬鍥炴祦杈撻�佺嚎鍏ュ彛";
+                }
+                dt_Task.NextAddress = dt_Task.TargetAddress;
+                dt_Task.Barcode = "";
+                dt_Task.Roadway = "AGV";
+                dt_Task.WMSId = 0;
+                dt_Task.Remark = "鐑樼儰鍥炵倝";
+
+                Dt_Task dt_Tasks = new Dt_Task();
+                dt_Tasks.TaskNum = _taskService.GetTaskNum();
+                dt_Tasks.CreateDate = DateTime.Now;
+                dt_Tasks.Creater = "system";
+                if (Stationinfo.Area == "姝f瀬")
+                {
+                    dt_Task.CurrentAddress = "姝f瀬鍥炴祦杈撻�佺嚎鍑哄彛";
+                }
+                else
+                {
+                    dt_Task.CurrentAddress = "璐熸瀬鍥炴祦杈撻�佺嚎鍑哄彛";
+                }
+                dt_Tasks.SourceAddress = dt_Task.CurrentAddress;
+                dt_Tasks.TaskState = (int)TaskInStatusEnum.InPending;
+                dt_Tasks.TaskType = (int)TaskOutboundTypeEnum.Outbound;
+                dt_Tasks.Grade = 1;
+                dt_Tasks.PalletCode = "";
+                dt_Tasks.TargetAddress = Taddress;
+                dt_Tasks.NextAddress = Taddress;
+                dt_Tasks.Barcode = "";
+                dt_Tasks.Roadway = "AGV";
+                dt_Tasks.WMSId = 0;
+                dt_Tasks.Remark = "鐑樼儰鍥炵倝";
+                var isTrue = _taskRepository.AddData(dt_Task);
+                var isTrue1 = _taskRepository.AddData(dt_Tasks);
+                webResponseContent.OK("浠诲姟涓嬪彂鎴愬姛锛�");
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3