From 375ace27ad6afbc3c83d92add0fb5a0347a6edbf Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 08 十二月 2025 21:24:24 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu
---
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs | 102 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 98 insertions(+), 4 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
index cd50907..2e53c0f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
@@ -1,5 +1,11 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+锘縰sing SqlSugar;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_Core.HttpContextUser;
+using WIDESEA_DTO.Stock;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -7,10 +13,12 @@
{
public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IRepository<Dt_StockInfoDetail>>, IStockInfoDetailService
{
- public StockInfoDetailService(IRepository<Dt_StockInfoDetail> BaseDal) : base(BaseDal)
+ public StockInfoDetailService(IRepository<Dt_StockInfoDetail> BaseDal, IRepository<Dt_StockInfo> stockinfoRepository) : base(BaseDal)
{
+ _stockinfoRepository = stockinfoRepository;
}
+ public IRepository<Dt_StockInfo> _stockinfoRepository;
public IRepository<Dt_StockInfoDetail> Repository => BaseDal;
public bool ExistBarcodes(string barcode)
@@ -20,7 +28,93 @@
public bool ExistBarcodes(List<string> barcodes)
{
- return BaseDal.QueryFirst(x =>!string.IsNullOrEmpty( x.Barcode) && barcodes.Contains(x.Barcode)) != null;
+ return BaseDal.QueryFirst(x => !string.IsNullOrEmpty(x.Barcode) && barcodes.Contains(x.Barcode)) != null;
}
+
+ public PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options)
+ {
+ // 1. 鑾峰彇鍩虹鍒嗛〉鏁版嵁
+ PageGridData<Dt_StockInfoDetail> pageData = base.GetPageData(options);
+ List<Dt_StockInfoDetail> filteredDetails = pageData.Rows.ToList(); // 鍏堟嫹璐濆師濮嬫暟鎹�
+
+ if (!string.IsNullOrEmpty(options.Wheres))
+ {
+ try
+ {
+ List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+ if (searchParametersList?.Any() == true)
+ {
+ foreach (var param in searchParametersList)
+ {
+ // 鍖归厤鎵樼洏缂栧彿鏌ヨ鏉′欢锛堝皬鍐欏瓧娈靛悕锛�
+ if (param.Name.Equals(nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(), StringComparison.OrdinalIgnoreCase)
+ && !string.IsNullOrEmpty(param.Value?.ToString()))
+ {
+ // 浼樺寲锛氭壒閲忔煡璇紙濡傛灉鏈夊涓墭鐩樼爜锛岃繖閲屼篃鍙互鎵╁睍锛�
+ string palletCode = param.Value.ToString().Trim();
+ var targetStock = _stockinfoRepository.QueryFirst(x => x.PalletCode == palletCode);
+
+ // 绌哄�兼牎楠岋細鏈壘鍒板搴旀墭鐩樼殑搴撳瓨锛岀洿鎺ヨ繃婊や负绌�
+ if (targetStock != null)
+ {
+ filteredDetails = filteredDetails.Where(x => x.StockId == targetStock.Id).ToList();
+ }
+ else
+ {
+ filteredDetails = new List<Dt_StockInfoDetail>();
+ }
+ break; // 鍗曚釜鎵樼洏鐮佹煡璇紝鍖归厤鍚庨��鍑哄惊鐜�
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ }
+ }
+
+ List<int> stockIds = filteredDetails.Select(detail => detail.StockId).Distinct().ToList();
+ var stockDict = _stockinfoRepository.QueryData(x => stockIds.Contains(x.Id))
+ .ToDictionary(x => x.Id, x => x.PalletCode ?? "鏃犳墭鐩樼紪鍙�");
+
+ List<StockInfoDetailWithPalletDto> dtoList = filteredDetails
+ .Select(detail => new StockInfoDetailWithPalletDto
+ {
+ Id = detail.Id,
+ StockId = detail.StockId,
+ MaterielCode = detail.MaterielCode,
+ MaterielName = detail.MaterielName,
+ OrderNo = detail.OrderNo,
+ BatchNo = detail.BatchNo,
+ ProductionDate = detail.ProductionDate,
+ EffectiveDate = detail.EffectiveDate,
+ SerialNumber = detail.SerialNumber,
+ StockQuantity = detail.StockQuantity,
+ OutboundQuantity = detail.OutboundQuantity,
+ Status = detail.Status,
+ Unit = detail.Unit,
+ InboundOrderRowNo = detail.InboundOrderRowNo,
+ SupplyCode = detail.SupplyCode,
+ WarehouseCode = detail.WarehouseCode,
+ Barcode = detail.Barcode,
+ BusinessType = detail.BusinessType,
+ Remark = detail.Remark,
+ Creater = detail.Creater,
+ CreateDate = detail.CreateDate,
+ Modifier = detail.Modifier,
+ ModifyDate = detail.ModifyDate,
+ PalletCode = stockDict.TryGetValue(detail.StockId, out var palletCode) ? palletCode : "鏃犳墭鐩樼紪鍙�"
+ })
+ .ToList();
+
+ return new PageGridData<StockInfoDetailWithPalletDto>
+ {
+ Rows = dtoList,
+ Total = pageData.Total,
+ Summary = pageData.Summary
+ };
+ }
+
}
-}
+ }
+
--
Gitblit v1.9.3