From ca0a0dffd906162c49c7cefed3846a1bc1b3e6cc Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 09 三月 2026 09:29:16 +0800
Subject: [PATCH] feat: 添加轮询服务类支持多出库口负载均衡
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 50 insertions(+), 5 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
index 339d933..6ade9de 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -1,4 +1,4 @@
-锘縰sing AutoMapper;
+锘縰sing WIDESEA_Common.StockEnum;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_IStockService;
@@ -8,14 +8,59 @@
{
public partial class StockInfoService : ServiceBase<Dt_StockInfo, IRepository<Dt_StockInfo>>, IStockInfoService
{
- private readonly IMapper _mapper;
-
public IRepository<Dt_StockInfo> Repository => BaseDal;
- public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper) : base(BaseDal)
+ public StockInfoService(IRepository<Dt_StockInfo> BaseDal) : base(BaseDal)
{
- _mapper = mapper;
}
+ /// <summary>
+ /// 鑾峰彇搴撳瓨淇℃伅鍒楄〃锛堝嚭搴撴棩鏈熷皬浜庡綋鍓嶆椂闂翠笖搴撳瓨鐘舵�佷负鍏ュ簱瀹屾垚鐨勮褰曪級
+ /// </summary>
+ public async Task<List<Dt_StockInfo>> GetStockInfoAsync()
+ {
+ return await BaseDal.QueryDataAsync(x =>
+ x.OutboundDate < DateTime.Now &&
+ x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.GetHashCode());
+ }
+
+ /// <summary>
+ /// 鑾峰彇搴撳瓨淇℃伅鍒楄〃锛堝嚭搴撴棩鏈熷皬浜庡綋鍓嶆椂闂翠笖搴撳瓨鐘舵�佷负鍏ュ簱瀹屾垚鐨勮褰曪紝涓斾粨搴揑D鍖归厤锛�
+ /// </summary>
+ public async Task<List<Dt_StockInfo>> GetStockInfoAsync(int warehouseId)
+ {
+ return await BaseDal.QueryDataAsync(x =>
+ x.OutboundDate < DateTime.Now &&
+ x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.GetHashCode() &&
+ x.WarehouseId == warehouseId);
+ }
+
+ /// <summary>
+ /// 鑾峰彇搴撳瓨淇℃伅锛堟牴鎹墭鐩樼爜鏌ヨ锛�
+ /// </summary>
+ public async Task<Dt_StockInfo> GetStockInfoAsync(string palletCode)
+ {
+ return await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode);
+ }
+
+ /// <summary>
+ /// 鏇存柊搴撳瓨鏁版嵁
+ /// </summary>
+ public async Task<bool> UpdateStockAsync(Dt_StockInfo stockInfo)
+ {
+ return await BaseDal.UpdateDataAsync(stockInfo);
+ }
+
+
+ /// <summary>
+ /// 妫�绱㈡寚瀹氭墭鐩樺湪缁欏畾浣嶇疆鐨勫簱瀛樿缁嗕俊鎭��
+ /// </summary>
+ /// <param name="palletCode">璇锋眰搴撳瓨淇℃伅鐨勬墭鐩樺敮涓�鏍囪瘑绗︺�備笉鑳戒负 null 鎴栫┖銆�</param>
+ /// <param name="locationCode">琛ㄧず鎵樼洏瀛樺偍浣嶇疆鐨勪唬鐮併�備笉鑳戒负 null 鎴栫┖銆�</param>
+ /// <returns>琛ㄧず寮傛鎿嶄綔鐨勪换鍔°�備换鍔$粨鏋滃寘鍚竴涓� <see cref="Dt_StockInfo"/> 瀵硅薄锛岃瀵硅薄鍖呭惈鎸囧畾鎵樼洏鍜屼綅缃殑搴撳瓨璇︾粏淇℃伅銆傚鏋滄湭鎵惧埌鍖归厤鐨勫簱瀛樹俊鎭紝鍒欒繑鍥� null銆�</returns>
+ public async Task<Dt_StockInfo> GetStockInfoAsync(string palletCode, string locationCode)
+ {
+ return await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode && x.LocationCode == locationCode);
+ }
}
}
--
Gitblit v1.9.3