找到已收货的箱子

This commit is contained in:
tongfei
2024-03-26 15:34:36 +08:00
parent df821329ef
commit 16fe648ad8
9 changed files with 177 additions and 22 deletions

View File

@@ -56,7 +56,7 @@ namespace WMS.Web.Repositories
_singleDataService = singleDataService;
_loginRepositories = loginRepositories;
_erpBasicDataExtendService = erpBasicDataExtendService;
}
}
/// <summary>
/// 详情
@@ -163,11 +163,11 @@ namespace WMS.Web.Repositories
var query = _context.InStockTaskDetails
.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 })
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%")
&& w.order.Type == InstockType.Purchase
&& (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status== InstockStatus.WaitInStock)
&& w.detail.AccruedQty>0
&& w.detail.IsRepeal!=true);
.Where(w => EF.Functions.Like(w.order.SourceBillNo, "%" + dto.SourceBillNo + "%")
&& w.order.Type == InstockType.Purchase
&& (w.order.Status == InstockStatus.Part || w.order.Status == InstockStatus.Wait || w.order.Status == InstockStatus.WaitInStock)
&& w.detail.AccruedQty > 0
&& w.detail.IsRepeal != true);
//仓库
if (!string.IsNullOrEmpty(dto.StockCode))
@@ -183,15 +183,15 @@ namespace WMS.Web.Repositories
StockCode = s.detail.StockCode,
StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode + s.detail.OrgCode),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialNumber),
MaterialNumber = s.detail.MaterialNumber,
MaterialNumber = s.detail.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialNumber),
Qty = s.detail.AccruedQty,
DeliveredQty = s.detail.DeliveredQty,
ReceiveQty = s.detail.ReceiveQty,
//采购:可入库数量=应入库数量-收货数量-已交数量+该明细的入库数量之和;
AvailableQty = s.detail.AccruedQty - s.detail.ReceiveQty - (s.detail.DeliveredQty> s.detail.RealityQty? s.detail.DeliveredQty : s.detail.RealityQty),
AvailableQty = s.detail.AccruedQty - s.detail.ReceiveQty - (s.detail.DeliveredQty > s.detail.RealityQty ? s.detail.DeliveredQty : s.detail.RealityQty),
Remark = s.detail.Remark,
ErpDetailId=s.detail.ErpDetailId
ErpDetailId = s.detail.ErpDetailId
}).ToListAsync();
@@ -230,7 +230,7 @@ namespace WMS.Web.Repositories
//这里只查状态为:部分入库和等待收货
var task_query = _context.InStockTask
.Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && w.Type!= InstockType.Purchase && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait || w.Status==InstockStatus.WaitInStock));
.Where(w => EF.Functions.Like(w.SourceBillNo, "%" + dto.SourceBillNo + "%") && w.Type != InstockType.Purchase && (w.Status == InstockStatus.Part || w.Status == InstockStatus.Wait || w.Status == InstockStatus.WaitInStock));
//找到头列表
var taskList = await task_query
@@ -243,7 +243,7 @@ namespace WMS.Web.Repositories
{
var ids = taskList.Select(x => x.Id).ToList();
//找明细
var query = _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid) && x.AccruedQty>0 && x.IsRepeal!=true);
var query = _context.InStockTaskDetails.Where(x => ids.Contains(x.Fid) && x.AccruedQty > 0 && x.IsRepeal != true);
//仓库
if (!string.IsNullOrEmpty(dto.StockCode))
@@ -255,20 +255,20 @@ namespace WMS.Web.Repositories
DetailsId = s.Id,
SupplierId = s.SupplierId,
OrgId = s.OrgId,
OrgCode=s.OrgCode,
OrgCode = s.OrgCode,
StockCode = s.StockCode,
StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.StockCode+s.OrgCode),
StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.StockCode + s.OrgCode),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.MaterialNumber),
MaterialNumber = s.MaterialNumber,
MaterialNumber = s.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.MaterialNumber),
Qty = s.AccruedQty,
DeliveredQty = s.DeliveredQty,
//非采购:可入库数量=应入库数量-收货数量;
AvailableQty = s.AccruedQty - s.ReceiveQty,
Remark = s.Remark,
ErpDetailId=s.ErpDetailId
}).Where(x=>x.AvailableQty>0).ToListAsync();
ErpDetailId = s.ErpDetailId
}).Where(x => x.AvailableQty > 0).ToListAsync();
//找箱
var task_box = await _context.InstockTaskBox.Where(x => ids.Contains(x.TaskId))
.Select(s => new SourceBillNoNoPurchaseBoxQueryResponse()
@@ -290,15 +290,29 @@ namespace WMS.Web.Repositories
var response = new List<SourceBillNoNoPurchaseQueryResponse>();
foreach (var item in taskList)
{
if (item.Details.Count != 0)
if (item.Details.Count != 0)
{
response.Add(item);
}
}
return response;
}
/// <summary>
/// 获取-已收货的箱子
/// </summary>
/// <param name="taskId"></param>
/// <returns></returns>
public async Task<List<ReceiveBoxResponse>> GetReceiveBox(int taskId)
{
return await _context.InstockTaskBox.Where(x => x.TaskId == taskId).Select(x => new ReceiveBoxResponse()
{
TaskId = x.TaskId,
BoxId = x.BoxId,
BoxBillNo = x.BoxBillNo
}).ToListAsync();
}
/// <summary>
/// 批量添加
@@ -472,7 +486,7 @@ namespace WMS.Web.Repositories
List<int> ids_Operator = new List<int>();
if (companyId == 0)
companyId = _loginRepositories.CompanyId;
if (!string.IsNullOrEmpty(dto.Receiver))
{
var staffList = await _basicsRepositories.GetStaffListAsync(companyId);
@@ -480,7 +494,7 @@ namespace WMS.Web.Repositories
ids_Receiver = staffList.Where(w => w.Name.Contains(dto.Receiver)).Select(s => s.Id).ToList();
}
if (!string.IsNullOrEmpty(dto.Operator))
if (!string.IsNullOrEmpty(dto.Operator))
{
var staffList = await _basicsRepositories.GetStaffListAsync(companyId);
if (staffList != null)