仓库获取的优化

This commit is contained in:
tongfei
2023-11-22 09:34:02 +08:00
parent fb67d6e8e2
commit b1c557c876
7 changed files with 17 additions and 10 deletions

View File

@@ -4956,6 +4956,11 @@
仓位集合 仓位集合
</summary> </summary>
</member> </member>
<member name="F:WMS.Web.Domain.Values.Single.SingleAction.StocksJoinOrgCode">
<summary>
仓库:编码与组织编码结合
</summary>
</member>
<member name="T:WMS.Web.Domain.Values.Single.SingleControllerType"> <member name="T:WMS.Web.Domain.Values.Single.SingleControllerType">
<summary> <summary>
单点-控制器枚举 单点-控制器枚举

View File

@@ -65,6 +65,8 @@ namespace WMS.Web.Repositories
var query = _context.BackRecordDetails var query = _context.BackRecordDetails
.GroupJoin(_context.BackRecord, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders }) .GroupJoin(_context.BackRecord, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order }) .SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.GroupJoin(_context.Box, p => p.detail.BoxId, ts => ts.Id, (p, ts) => new { p.detail, p.order, ts })
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, p.order,box })
.Where(adv => 1 == 1); .Where(adv => 1 == 1);
if (dto.SubStockId.HasValue) if (dto.SubStockId.HasValue)
@@ -81,7 +83,7 @@ namespace WMS.Web.Repositories
Id = s.order.Id, Id = s.order.Id,
DetailsId = s.detail.Id, DetailsId = s.detail.Id,
BillNo=s.order.BillNo, BillNo=s.order.BillNo,
BoxBillNo ="", BoxBillNo = s.box.BoxBillNo,
Type = s.order.Type.GetRemark(), Type = s.order.Type.GetRemark(),
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId), Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
CreateTime =s.order.CreateTime, CreateTime =s.order.CreateTime,
@@ -89,7 +91,7 @@ namespace WMS.Web.Repositories
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId), MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Qty = s.detail.Qty, Qty = s.detail.Qty,
SubStock = "", SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.detail.SubStockId),
SerialNumbers = JsonConvert.SerializeObject(s.detail.SerialNumbers), SerialNumbers = JsonConvert.SerializeObject(s.detail.SerialNumbers),
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); }).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();

View File

@@ -89,7 +89,7 @@ namespace WMS.Web.Repositories
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId), MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId), MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.order.StockCode), Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.order.StockCode+s.order.OrgCode),
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.order.SubStockId), SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.order.SubStockId),
Qty = s.detail.Qty, Qty = s.detail.Qty,
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); }).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
@@ -115,7 +115,7 @@ namespace WMS.Web.Repositories
.Where(x => 1 == 1 && x.box.BoxBillNo==boxBillNo).Select(x=>x.boxinvent).FirstOrDefaultAsync(); .Where(x => 1 == 1 && x.box.BoxBillNo==boxBillNo).Select(x=>x.boxinvent).FirstOrDefaultAsync();
var response = _mapper.Map<BoxInventoryResponse>(entity); var response = _mapper.Map<BoxInventoryResponse>(entity);
response.Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, response.StockCode); response.Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, response.StockCode+response.OrgCode);
response.SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, response.SubStockId); response.SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, response.SubStockId);
response.Details = _mapper.Map<List<BoxInventoryDetailsResponse>>(entity.Details); response.Details = _mapper.Map<List<BoxInventoryDetailsResponse>>(entity.Details);

View File

@@ -125,7 +125,7 @@ namespace WMS.Web.Repositories
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId), MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId), MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode), Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode+s.detail.OrgCode),
Qty =s.detail.Qty, Qty =s.detail.Qty,
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId), Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
CreateTime =s.order.CreateTime, CreateTime =s.order.CreateTime,

View File

@@ -137,9 +137,9 @@ namespace WMS.Web.Repositories
AccruedQty = s.detail.AccruedQty, AccruedQty = s.detail.AccruedQty,
ReceiveQty = s.detail.ReceiveQty, ReceiveQty = s.detail.ReceiveQty,
RealityQty = s.detail.RealityQty, RealityQty = s.detail.RealityQty,
Receiver = "", Receiver = s.order.ReceiverId.HasValue? _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.ReceiverId.Value):"",
ReceiveTime = s.order.ReceiveTime.HasValue ? s.order.ReceiveTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", ReceiveTime = s.order.ReceiveTime.HasValue ? s.order.ReceiveTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
Shelfer = "", Shelfer = s.order.ShelferId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.ShelferId.Value) : "",
ShelfTime = s.order.ShelfTime.HasValue ? s.order.ShelfTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "", ShelfTime = s.order.ShelfTime.HasValue ? s.order.ShelfTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), CreateTime = s.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
}).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync(); }).OrderByDescending(x => x.Id).Skip((dto.PageNo - 1) * dto.PageSize).Take(dto.PageSize).ToListAsync();
@@ -282,7 +282,7 @@ namespace WMS.Web.Repositories
SourceBillNo=s.order.SourceBillNo, SourceBillNo=s.order.SourceBillNo,
MaterialId=s.detail.MaterialId, MaterialId=s.detail.MaterialId,
StockCode=s.detail.StockCode, StockCode=s.detail.StockCode,
StockName = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockCode), StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode+s.detail.OrgCode),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId), MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId), MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),

View File

@@ -89,7 +89,7 @@ namespace WMS.Web.Repositories
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId), MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId), MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId), Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialId),
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode), Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.StockCode + s.OrgCode),
Qty = s.Qty, Qty = s.Qty,
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId), SubStock = _singleDataService.GetSingleData(SingleAction.SubStocks, _loginRepositories.CompanyId, s.SubStockId),
Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.MaterialId), Unit = _erpBasicDataExtendService.GetMaterialUnitName(materials, s.MaterialId),

View File

@@ -96,7 +96,7 @@ namespace WMS.Web.Repositories
Type =s.Type.GetRemark(), Type =s.Type.GetRemark(),
OrderType=s.OrderType.GetRemark(), OrderType=s.OrderType.GetRemark(),
OrderBillNo=s.OrderBillNo, OrderBillNo=s.OrderBillNo,
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.StockCode), Stock = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.StockCode+s.OrgCode),
Qty = s.Qty, Qty = s.Qty,
SurplusQty=s.SurplusQty, SurplusQty=s.SurplusQty,
CreateTime = s.CreateTime CreateTime = s.CreateTime