From 5f53f4af369a1c7a8a09eb1f45c20a8581d107a9 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期四, 19 三月 2026 22:20:07 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/LongDeLiLiKu
---
项目代码/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs | 81 ++++++++++++++++++++++++++++++++++++++--
1 files changed, 76 insertions(+), 5 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs"
index b3f1bf3..7319aee 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs"
@@ -1,4 +1,4 @@
-锘縰sing HslCommunication.WebSocket;
+using HslCommunication.WebSocket;
using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
using SqlSugar;
@@ -32,13 +32,84 @@
private readonly IUnitOfWorkManage _unitOfWorkManage;
private readonly IBasicRepository _basicRepository;
private readonly IStockInfoRepository _stockInfoRepository;
+ private readonly IProStockInfoRepository _proStockInfoRepository;
public ILocationInfoRepository Repository => BaseDal;
- public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IStockInfoRepository stockInfoRepository) : base(BaseDal)
+ public LocationInfoService(ILocationInfoRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IBasicRepository basicRepository, IStockInfoRepository stockInfoRepository, IProStockInfoRepository proStockInfoRepository) : base(BaseDal)
{
_unitOfWorkManage = unitOfWorkManage;
_basicRepository = basicRepository;
_stockInfoRepository = stockInfoRepository;
+ _proStockInfoRepository = proStockInfoRepository;
+ }
+
+ /// <summary>
+ /// 鏌ヨ璐т綅瀵瑰簲鐨凴FID鍙婂簱瀛樹俊鎭�
+ /// </summary>
+ /// <param name="locationCodes"></param>
+ /// <returns></returns>
+ public WebResponseContent GetRfid(string[] locationCodes, int warehouseId = 0)
+ {
+ try
+ {
+ // 鍙傛暟楠岃瘉
+ if (locationCodes == null || locationCodes.Length == 0)
+ {
+ return WebResponseContent.Instance.Error("璐т綅缂栧彿涓嶈兘涓虹┖");
+ }
+
+ if (warehouseId == 1)
+ {
+ // 鏌ヨ鍘熸枡搴揇t_StockInfo琛紝鑾峰彇RFID鍙婂簱瀛樹俊鎭�
+ var rawMaterialRfidList = _stockInfoRepository.QueryData()
+ .Where(x => locationCodes.Contains(x.LocationCode))
+ .Select(x => new {
+ locationCode = x.LocationCode,
+ rfidCode = x.RfidCode,
+ paperRoll = x.MaterielName, // 绾稿嵎鍚嶇О
+ width = x.MaterielWide, // 闂ㄥ箙锛堝箙瀹斤級
+ barcode = x.PalletCode, // 绾稿嵎鏉$爜
+ status = x.StockStatus, // 鐘舵��
+ inDate = x.CreateDate // 鍏ュ簱鏃堕棿锛堝垱寤烘椂闂达級
+ })
+ .ToList();
+
+ // 杩斿洖缁撴灉
+ return WebResponseContent.Instance.OK(data: rawMaterialRfidList);
+ }
+
+ if (warehouseId == 2)
+ {
+ // 鏇挎崲鍘熸湁鐨� .Select(x => new { ... Detail = x.proStockInfoDetails?.FirstOrDefault() ... }) 浠g爜鍧�
+ var finishedProductRfidList = _proStockInfoRepository.Db.Queryable<Dt_ProStockInfo>()
+ .Includes(x => x.proStockInfoDetails)
+ .Where(x => locationCodes.Contains(x.LocationCode))
+ .ToList()
+ .Select(x => new
+ {
+ locationCode = x.LocationCode,
+ rfidCode = x.PalletCode,
+ paperRoll = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].ProductName : string.Empty,
+ productName = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].ProductName : string.Empty,
+ width = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].StockQty : 0,
+ quantity = (x.proStockInfoDetails != null && x.proStockInfoDetails.Count > 0) ? x.proStockInfoDetails[0].StockQty : 0,
+ barcode = x.PalletCode,
+ status = x.StockStatus,
+ inDate = x.CreateDate
+ })
+ .ToList();
+
+ // 杩斿洖缁撴灉
+ return WebResponseContent.Instance.OK(data: finishedProductRfidList);
+ }
+ // 濡傛灉娌℃湁鍖归厤鐨勪粨搴揑D锛岃繑鍥炵┖鍒楄〃
+ return WebResponseContent.Instance.OK(data: new List<object>());
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine($"GetRfid 寮傚父: {ex.Message}");
+ return WebResponseContent.Instance.Error(ex.Message);
+ }
}
/// <summary>
@@ -133,7 +204,7 @@
Dt_LocationInfo locationInfo = new Dt_LocationInfo()
{
WarehouseId = 0,
- Column = j + 1,
+ Columns = j + 1,
EnableStatus = EnableStatusEnum.Normal.ObjToInt(),
Layer = k + 1,
LocationStatus = LocationStatusEnum.Free.ObjToInt(),
@@ -142,8 +213,8 @@
Row = i + 1,
Depth = depth,
};
- locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Column.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}";
- locationInfo.LocationName = $"{locationInfo.RoadwayNo}宸烽亾{locationInfo.Row.ToString().PadLeft(3, '0')}琛寋locationInfo.Column.ToString().PadLeft(3, '0')}鍒梴locationInfo.Layer.ToString().PadLeft(3, '0')}灞倇locationInfo.Depth.ToString().PadLeft(2, '0')}娣�";
+ locationInfo.LocationCode = $"{locationInfo.RoadwayNo}-{locationInfo.Row.ToString().PadLeft(3, '0')}-{locationInfo.Columns.ToString().PadLeft(3, '0')}-{locationInfo.Layer.ToString().PadLeft(3, '0')}-{locationInfo.Depth.ToString().PadLeft(2, '0')}";
+ locationInfo.LocationName = $"{locationInfo.RoadwayNo}宸烽亾{locationInfo.Row.ToString().PadLeft(3, '0')}琛寋locationInfo.Columns.ToString().PadLeft(3, '0')}鍒梴locationInfo.Layer.ToString().PadLeft(3, '0')}灞倇locationInfo.Depth.ToString().PadLeft(2, '0')}娣�";
locationInfos.Add(locationInfo);
}
}
--
Gitblit v1.9.3