From 6b74e1dcf5642c8f56975471e27780d695953989 Mon Sep 17 00:00:00 2001
From: 陈勇 <竞男@ASUNA>
Date: 星期日, 26 四月 2026 15:48:01 +0800
Subject: [PATCH] 同步代码

---
 项目代码/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs |  101 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 100 insertions(+), 1 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
index 27ef51c..cbed3c3 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServer/WIDESEA_StorageBasicServices/Stock/VV_StockInfoService.cs"
@@ -5,14 +5,113 @@
 using System.Collections.Generic;
 using System.Drawing.Printing;
 using System.Linq.Expressions;
+using WIDESEA_Common;
 using WIDESEA_Core;
+using WIDESEA_Core.Enums;
+using WIDESEA_DTO;
+using WIDESEA_IRecordService;
 
 namespace WIDESEA_StorageBasicService;
 
 public class VV_StockInfoService : ServiceBase<VV_StockInfo, IVV_StockInfoRepository>, IVV_StockInfoService
 {
-    public VV_StockInfoService(IVV_StockInfoRepository BaseDal) : base(BaseDal)
+    private readonly IDt_PalletStockInfoRepository _PalletStockInfoRepository;
+    private readonly IStockQuantityChangeRecordService _stockQuantityChangeRecord;
+    private readonly IDt_CarBodyInfoRepository _carBodyInfoRepository;
+    private readonly ILocationInfoRepository _locationInfoRepository;
+    private readonly ILocationStatusChangeRecordRepository _locationStatusChangeRecordRepository;
+    private readonly IUnitOfWorkManage _unitOfWorkManage;
+
+    public VV_StockInfoService(IVV_StockInfoRepository BaseDal, IDt_PalletStockInfoRepository PalletStockInfoRepository, IStockQuantityChangeRecordService stockQuantityChangeRecord, IDt_CarBodyInfoRepository carBodyInfoRepository, ILocationInfoRepository locationInfoRepository, ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
     {
+        _PalletStockInfoRepository = PalletStockInfoRepository;
+        _stockQuantityChangeRecord = stockQuantityChangeRecord;
+        _carBodyInfoRepository = carBodyInfoRepository;
+        _locationInfoRepository = locationInfoRepository;
+        _locationStatusChangeRecordRepository = locationStatusChangeRecordRepository;
+        _unitOfWorkManage = unitOfWorkManage;
     }
 
+    public WebResponseContent stockLock(object[] keys)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            foreach (var item in keys)
+            {
+                var stock = _PalletStockInfoRepository.QueryFirst(x => x.Id == Convert.ToInt32(item));
+                if (stock.LockOrder != 1)
+                {
+                    stock.StockStatus = 1;
+                    _PalletStockInfoRepository.UpdateData(stock);
+                }
+            }
+            return content.OK("閿佸畾鎴愬姛!");
+        }
+        catch (Exception e)
+        {
+            return content.Error(e.Message);
+        }
+    }
+
+    public WebResponseContent stockUnLock(object[] keys)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            foreach (var item in keys)
+            {
+                var stock = _PalletStockInfoRepository.QueryFirst(x => x.Id == Convert.ToInt32(item));
+                stock.StockStatus = 0;
+                _PalletStockInfoRepository.UpdateData(stock);
+            }
+            return content.OK("瑙i攣鎴愬姛!");
+        }
+        catch (Exception e)
+        {
+            return content.Error(e.Message);
+        }
+    }
+
+
+    public override WebResponseContent DeleteData(object[] keys)
+    {
+        WebResponseContent content = new WebResponseContent();
+        try
+        {
+            var stockInfo = BaseDal.QueryFirst(x => x.Id == keys[0].ObjToInt());
+            var stock = _PalletStockInfoRepository.QueryFirst(x => x.Id == keys[0].ObjToInt());
+            var location = _locationInfoRepository.QueryFirst(x => x.LocationCode == stock.LocationCode);
+            var carInfo = _carBodyInfoRepository.QueryData(x => x.Id == stock.carBodyID);
+
+            int beforState = location.LocationStatus;
+            stock.StockStatus = 5;
+            location.LocationStatus = LocationEnum.Free.ObjToInt();
+
+            LocationChangeRecordDto changeRecordDto = new LocationChangeRecordDto()
+            {
+                AfterStatus = 0,
+                BeforeStatus = beforState,
+                TaskNum = 0,
+                LocationId = location.Id,
+                LocationCode = location.LocationCode,
+                ChangeType = (int)StatusChangeTypeEnum.ManualOperation
+            };
+
+            _unitOfWorkManage.BeginTran();
+            _PalletStockInfoRepository.DeleteData(stock);
+            _locationInfoRepository.UpdateData(location);
+            _carBodyInfoRepository.DeleteData(carInfo);
+
+            _locationStatusChangeRecordRepository.AddStatusChangeRecord(changeRecordDto);
+            _unitOfWorkManage.CommitTran();
+
+            return content.OK("鍒犻櫎鎴愬姛");
+        }
+        catch (Exception ex)
+        {
+            _unitOfWorkManage.RollbackTran();
+            return content.Error(ex.Message);
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3