From 0831fc62745a46b056e450395b0366ec168a6e55 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 26 三月 2026 13:44:45 +0800
Subject: [PATCH] 1

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   50 ++++++++++++++++++++++++--------------------------
 Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs   |    3 ++-
 Code/WMS/.claude/settings.local.json                              |    3 ++-
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/Code/WMS/.claude/settings.local.json b/Code/WMS/.claude/settings.local.json
index ded820a..783fdf1 100644
--- a/Code/WMS/.claude/settings.local.json
+++ b/Code/WMS/.claude/settings.local.json
@@ -1,7 +1,8 @@
 {
   "permissions": {
     "allow": [
-      "Bash(git:*)"
+      "Bash(git:*)",
+      "Bash(dotnet build:*)"
     ]
   }
 }
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
index 5a531aa..1bf9205 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -132,8 +132,9 @@
                 var entity = new Dt_StockInfo
                 {
                     PalletCode = stock.TargetPalletNo,
+                    //WarehouseId = stock.WarehouseId > 0 ? stock.WarehouseId : 1,
                     WarehouseId = 1,
-                    StockStatus = 1,
+                    StockStatus = StockStatusEmun.缁勭洏鏆傚瓨.GetHashCode(),
                     Creater = "system",
                     Details = details
                 };
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
index 20dc592..ee6b07a 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -67,7 +67,7 @@
         {
             try
             {
-                WebResponseContent content = await GetTasksByPalletCodeAsync(taskDto.PalletCode);
+                WebResponseContent content = await GetTaskByPalletCodeAsync(taskDto.PalletCode);
                 if (content.Status)
                 {
                     return content;
@@ -331,7 +331,7 @@
         {
             try
             {
-                WebResponseContent content = await GetTasksByPalletCodeAsync(taskDto.PalletCode);
+                WebResponseContent content = await GetTaskByPalletCodeAsync(taskDto.PalletCode);
                 if (content.Status)
                 {
                     return content;
@@ -381,8 +381,10 @@
                 };
                 var taskDtos = task.Adapt<WMSTaskDTO>();
 
-                BaseDal.AddData(task);
-                return WebResponseContent.Instance.OK("鏌ヨ鎴愬姛", taskDtos);
+                var addResult = await BaseDal.AddDataAsync(task);
+                if (!addResult)
+                    return WebResponseContent.Instance.Error("浠诲姟鍒涘缓澶辫触");
+                return WebResponseContent.Instance.OK("浠诲姟鍒涘缓鎴愬姛", taskDtos);
             }
             catch (Exception ex)
             {
@@ -421,15 +423,15 @@
         /// </summary>
         /// <param name="palletCode"></param>
         /// <returns></returns>
-        private async Task<WebResponseContent> GetTasksByPalletCodeAsync(string palletCode)
+        private async Task<WebResponseContent> GetTaskByPalletCodeAsync(string palletCode)
         {
             try
             {
-                var tasks = await BaseDal.QueryFirstAsync(s => s.PalletCode == palletCode);
-                if (tasks == null)
+                var task = await BaseDal.QueryFirstAsync(s => s.PalletCode == palletCode);
+                if (task == null)
                     return WebResponseContent.Instance.Error("鏈壘鍒板搴旂殑浠诲姟");
-                var taskDtos = _mapper.Map<List<WMSTaskDTO>>(tasks);
-                return WebResponseContent.Instance.OK("鏌ヨ鎴愬姛", taskDtos);
+                var taskDto = _mapper.Map<WMSTaskDTO>(task);
+                return WebResponseContent.Instance.OK("鏌ヨ鎴愬姛", taskDto);
             }
             catch (Exception ex)
             {
@@ -779,30 +781,26 @@
             try
             {
                 var stockInfo = await _stockInfoService.GetStockInfoAsync(input.PalletCode, input.LocationCode);
+
+                int locationStatus;
                 if (stockInfo == null)
                 {
                     var location = await _locationInfoService.GetLocationInfoAsync(input.LocationCode);
-
-                    OutputDto outPutDto = new OutputDto()
-                    {
-                        LocationCode = input.LocationCode,
-                        PalletCode = input.PalletCode,
-                        IsNormalProcedure = 1,
-                        LocationStatus = location.LocationStatus
-                    };
-                    content.OK(data: outPutDto);
+                    locationStatus = location?.LocationStatus ?? 0;
                 }
                 else
                 {
-                    OutputDto outPutDto = new OutputDto()
-                    {
-                        LocationCode = input.LocationCode,
-                        PalletCode = input.PalletCode,
-                        IsNormalProcedure = 1,
-                        LocationStatus = stockInfo.LocationDetails.LocationStatus
-                    };
-                    content.OK(data: outPutDto);
+                    locationStatus = stockInfo.LocationDetails?.LocationStatus ?? 0;
                 }
+
+                OutputDto outPutDto = new OutputDto()
+                {
+                    LocationCode = input.LocationCode,
+                    PalletCode = input.PalletCode,
+                    IsNormalProcedure = 1,
+                    LocationStatus = locationStatus
+                };
+                return content.OK(data: outPutDto);
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3