From d01658c63cd541fe4ea5cec5c4bd7f23b9408cdb Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期六, 18 十月 2025 15:04:56 +0800
Subject: [PATCH] 前端,pda,后端接口更改,新增,优化

---
 WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
index 24c04ad..0ae970f 100644
--- a/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
+++ b/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/Base/LocationInfoService.cs
@@ -6,6 +6,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -16,6 +17,7 @@
 using WIDESEA_IBasicRepository;
 using WIDESEA_IBasicService;
 using WIDESEA_Model.Models;
+using WIDESEA_Model.Models.Inbound;
 
 namespace WIDESEA_BasicService
 {
@@ -289,6 +291,62 @@
             }
             return groupLocations;
         }
+        /// <summary>
+        /// 璐т綅閲婃斁
+        /// </summary>
+        /// <param name="locationCodes"></param>
+        /// <returns></returns>
+        public WebResponseContent LocationRelease(List<string> locationCodes)
+        {
+            try
+            {
+                if (locationCodes == null || locationCodes.Count == 0)
+                {
+                    return WebResponseContent.Instance.Error("璇锋彁渚涜揣浣嶇紪鐮�");
+                }
+
+                List<Dt_LocationInfo> locationInfos = BaseDal.GetLocationInfos(locationCodes);
+                var matchedCodes = locationInfos.Select(x => x.LocationCode).ToList();
+                var unmatchedCode = locationCodes.Except(matchedCodes).ToList();
+
+                if (unmatchedCode.Any())
+                {
+                    return WebResponseContent.Instance.Error($"浠ヤ笅璐т綅缂栧彿{string.Join(",", unmatchedCode)}鏈壘鍒拌揣浣嶄俊鎭�");
+                }
+
+                foreach (var x in locationInfos)
+                {
+                    if (x.EnableStatus == EnableStatusEnum.Disable.ObjToInt()|| x.EnableStatus == LocationStatusEnum.InStock.ObjToInt())
+                    {
+                        return WebResponseContent.Instance.OK($"璐т綅閲婃斁鎿嶄綔宸茬粓姝�,璇ヨ揣浣峽x.LocationCode}宸茬鐢ㄦ垨澶勪簬鏈夎揣鐘舵��");
+                    }
+
+                    if (x.LocationStatus == LocationStatusEnum.Lock.ObjToInt())
+                    {
+                        Dt_ReturnOrder returnOrder = BaseDal.Db.Queryable<Dt_ReturnOrder>()
+                            .Where(y => y.LocationCode == x.LocationCode && y.OrderStatus == InOrderStatusEnum.鏈紑濮�.ObjToInt())
+                            .First();
+
+                        if (returnOrder == null)
+                        {
+                            continue;
+                        }
+                        else
+                        {
+                            x.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+                        }
+                    }
+                }
+
+                Repository.UpdateData(locationInfos);
+                return WebResponseContent.Instance.OK("璐т綅閲婃斁鎴愬姛");
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
+
         public class LocationCache
         {
             public string LocationCode { get; set; }

--
Gitblit v1.9.3