修复bug

This commit is contained in:
18942506660
2024-11-15 15:36:10 +08:00
parent cbc55ac889
commit 24e4eb4bce

View File

@@ -198,8 +198,8 @@ namespace WMS.Web.Repositories
ReceiveQty = x.detail.Qty,
ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
//Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.taskBox.ReceiverId ?? 0),
//ReceiveTime = x.taskBox.CreateTime.HasValue ? x.taskBox.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
Receiver = "",
ReceiveTime = "",
SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
}).ToListAsync();
@@ -207,8 +207,10 @@ namespace WMS.Web.Repositories
//boxList = boxList.GroupBy(g => g.DetailId).Select(s => s.OrderByDescending(o => o.ReceiveTime).First()).ToList();
var boxIds = boxList.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
if (entity.Type == InstockType.Purchase)
{
//左连接中 右表中的数据如果有多条,所以需要特殊处理
var instockTaskBoxList = await _context.InstockTaskBox.Where(w => w.TaskId == entity.Id && boxIds.Contains(w.BoxId)).ToListAsync();
var instockTaskBoxList = await _context.InstockTaskBox.Include(x => x.Details).Where(w => w.TaskId == entity.Id && boxIds.Contains(w.BoxId)).ToListAsync();
foreach (var bid in boxIds)
{
var resList = boxList.Where(w => w.BoxId == bid).OrderBy(x => x.ShelfTime).ToList();
@@ -218,6 +220,34 @@ namespace WMS.Web.Repositories
resList[i].Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, bList[i].ReceiverId ?? 0);
resList[i].ReceiveTime = bList[i].CreateTime.HasValue ? bList[i].CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
}
//如果收货的条数大于入库的条数 代表有收货未入库的 需要添加
if (resList.Count() < instockTaskBoxList.Where(w => w.BoxId == bid).Count())
{
var boxd = instockTaskBoxList.Where(w => w.BoxId == bid).OrderByDescending(x => x.CreateTime).First();
foreach (var boxdetail in boxd.Details)
{
boxList.Add(new InStockTaskBoxInfoDto()
{
DetailId = "instocktask_" + boxdetail.Id,
BoxId = boxd.BoxId,
BoxBillNo = boxd.BoxBillNo,
SaleBillNo = resList[0].SaleBillNo,
Method = InventoryInOutMethod.Box.GetRemark(),
MethodForInt = (int)InventoryInOutMethod.Box,
Qty = boxdetail.ReceiveQty,
ReceiveQty = boxdetail.ReceiveQty,
RealityQty = 0,
MaterialNumber = boxdetail.MaterialNumber,
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, boxdetail.MaterialNumber),
ShelfTime = "",
Shelfer = "",
ReceiveTime = boxd.CreateTime.HasValue ? boxd.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
Receiver = boxd.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, boxd.ReceiverId.Value) : "",
SerialNumbers = boxdetail.SerialNumbers != null && boxdetail.SerialNumbers.Count() > 0 ? (string.Join(",", boxdetail.SerialNumbers).TrimEnd(',')) : "",
});
}
}
}
}