From 9de6c7c6d835ba5161d64114d154bfc7676244a1 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期一, 06 四月 2026 12:44:43 +0800
Subject: [PATCH] 同步

---
 项目代码/WMS/WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs |   62 +++++--------------------------
 1 files changed, 10 insertions(+), 52 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs"
index d44d961..f1ff5e0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs"
@@ -9,6 +9,7 @@
 using WIDESEA_Core;
 using WIDESEA_Core.HttpContextUser;
 using WIDESEA_DTO;
+using WIDESEA_DTO.Location;
 using WIDESEA_Model.Models;
 
 namespace WIDESEA_StorageBasicService;
@@ -26,6 +27,7 @@
     private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
     private readonly IMapper _mapper;
     private readonly IDt_PalletStockInfoRepository _palletStockInfoRepository;
+    private readonly IVV_StockInfoRepository _stockrepository;
 
     public LocationInfoService(ILocationInfoRepository BaseDal,
                                     IUnitOfWorkManage unitOfWorkManage,
@@ -37,7 +39,8 @@
                                     IStockInfoDetailRepository stockInfoDetailRepository,
                                     IMapper mapper,
                                     IDt_TaskService taskService,
-                                    IDt_PalletStockInfoRepository palletStockInfoRepository) : base(BaseDal)
+                                    IDt_PalletStockInfoRepository palletStockInfoRepository,
+                                    IVV_StockInfoRepository stockrepository) : base(BaseDal)
     {
         _unitOfWorkManage = unitOfWorkManage;
         _taskRepository = taskRepository;
@@ -49,6 +52,7 @@
         _mapper = mapper;
         _taskService = taskService;
         _palletStockInfoRepository = palletStockInfoRepository;
+        _stockrepository = stockrepository;
     }
 
 
@@ -71,56 +75,6 @@
         _locationStatusChangeRecordRepository.AddStatusChangeRecord(changeRecordDto);
 
         return base.UpdateData(saveModel);
-    }
-
-    public override WebResponseContent AddData(SaveModel saveModel)
-    {
-        WebResponseContent content = new();
-        try
-        {
-            int line = saveModel.MainData["row"].ObjToInt();
-            int column = saveModel.MainData["column"].ObjToInt();
-            int layer = saveModel.MainData["layer"].ObjToInt();
-            int locationType = saveModel.MainData["locationType"].ObjToInt();
-            //int status = saveModel.MainData["locationStatus"].ObjToInt();
-            //string roadwayNo = saveModel.MainData["roadwayNo"].ToString();
-
-            string locationCode = line.ToString().PadLeft(3, '0') + '-' + column.ToString().PadLeft(3, '0') + '-' + layer.ToString().PadLeft(3, '0');
-            var location = BaseDal.QueryFirst(x => x.LocationCode == locationCode);
-            if (location != null) throw new Exception($"{locationCode}搴撲綅宸插瓨鍦�,璇锋牳鏌�");
-
-            DtLocationInfo locationInfo = new DtLocationInfo
-            {
-                Row = line,
-                Column = column,
-                Layer = layer,
-                LocationCode = line.ToString().PadLeft(3, '0') + '-' + column.ToString().PadLeft(3, '0') + '-' + layer.ToString().PadLeft(3, '0'),
-                LocationName = ConvertToFormattedString(line, column, layer),
-                LocationType = locationType,
-                Remark = "",
-                Depth = 0,
-                RoadwayNo = locationType == 1 ? "CTU" : "AGV",
-                LocationStatus = LocationEnum.Free.ObjToInt(),
-                AreaId = 0,
-                Creater = App.User.UserName,
-                EnalbeStatus = 2,  //榛樿绂佺敤
-                CreateDate = DateTime.Now,
-            };
-
-            if (BaseDal.AddData(locationInfo) > 0)
-            {
-                return content.OK("娣诲姞鎴愬姛!");
-            }
-            else
-            {
-                return content.Error("娣诲姞澶辫触");
-            }
-        }
-        catch (Exception ex)
-        {
-            return content.Error($"娣诲姞澶辫触:{ex.Message}");
-        }
-
     }
 
     #region 鍒濆鍖栧簱浣�
@@ -263,6 +217,8 @@
     {
         var data = BaseDal.QueryData(x => x.AreaId == Convert.ToInt32(area.areaCode));
 
+        List<VV_StockInfo> stockInfos = _stockrepository.QueryData(x => true);
+
         List<LocationLayer> layers = new List<LocationLayer>();
         foreach (var layer in data.GroupBy(t => t.Layer))
         {
@@ -273,6 +229,8 @@
                 var cols = new List<LocationCol>();
                 foreach (var data_col in data_row)
                 {
+                    var stock = stockInfos.FirstOrDefault(x => x.LocationCode == data_col.LocationCode);
+                    
                     cols.Add(new LocationCol()
                     {
                         //鍒�
@@ -280,6 +238,7 @@
                         locationCode = data_col.LocationCode,
                         location_state = data_col.LocationStatus.ToString(),
                         location_lock = data_col.EnalbeStatus.ToString(),
+                        stockInfo = stock
                     });
                 }
                 cols = cols.OrderBy(t => t.index).ToList();
@@ -303,7 +262,6 @@
         return layers;
     }
     #endregion
-
 
     #region 鍐呴儴鏂规硶
 

--
Gitblit v1.9.3