From 3571d8b2231e06e46774af86be502014d6974e1d Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 07 四月 2026 16:16:53 +0800
Subject: [PATCH] 优化ERP接收单据逻辑,一期领料变更逻辑修改
---
项目代码/WMS/WMSServices/WIDESEA_BasicService/Base/LocationInfoService.cs | 75 ++++++++++++++++++++++++++++++++++++-
1 files changed, 73 insertions(+), 2 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 7ff15b5..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>
--
Gitblit v1.9.3