修改了查询

This commit is contained in:
2025-07-03 16:04:23 +08:00
parent 8e9d14e55a
commit b93988c894

View File

@@ -343,29 +343,35 @@ namespace WMS.Web.Repositories
string sourceBillNo = s[0]; string sourceBillNo = s[0];
string type = s[1]; string type = s[1];
InstockType t = InstockType.Purchase; InstockType t = InstockType.Purchase;
if(type=="6") if (type == "6")
{ {
t = InstockType.ProduceSotck; t = InstockType.ProduceSotck;
} }
else else if (type == "1")
{ {
t = InstockType.Purchase; t = InstockType.Purchase;
} }
//这里只查状态为:部分入库和等待收货 //这里只查状态为:部分入库和等待收货
var query = _context.InStockTaskDetails var query = _context.InStockTaskDetails
.GroupJoin(_context.InStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders }) .GroupJoin(_context.InStockTask, 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 })
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + sourceBillNo + "%") .Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + sourceBillNo + "%")
&& w.order.Type == t // && w.order.Type == t
&& (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status == InstockStatus.WaitInStock) && (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status == InstockStatus.WaitInStock)
&& w.detail.AccruedQty > 0 && w.detail.AccruedQty > 0
&& w.detail.IsRepeal != true); && w.detail.IsRepeal != true);
if (type == "")
{
}
else
{
query = query.Where(x => x.order.Type == t);
}
//仓库 //仓库
if (!string.IsNullOrEmpty(dto.StockCode)) if (!string.IsNullOrEmpty(dto.StockCode))