修复bug
This commit is contained in:
@@ -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,16 +207,46 @@ 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();
|
||||
//左连接中 右表中的数据如果有多条,所以需要特殊处理
|
||||
var instockTaskBoxList = await _context.InstockTaskBox.Where(w => w.TaskId == entity.Id && boxIds.Contains(w.BoxId)).ToListAsync();
|
||||
foreach (var bid in boxIds)
|
||||
if (entity.Type == InstockType.Purchase)
|
||||
{
|
||||
var resList = boxList.Where(w => w.BoxId == bid).OrderBy(x => x.ShelfTime).ToList();
|
||||
for (int i = 0; i < resList.Count(); i++)
|
||||
//左连接中 右表中的数据如果有多条,所以需要特殊处理
|
||||
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 bList = instockTaskBoxList.Where(w => w.BoxId == bid).OrderBy(x => x.CreateTime).ToList();
|
||||
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") : "";
|
||||
var resList = boxList.Where(w => w.BoxId == bid).OrderBy(x => x.ShelfTime).ToList();
|
||||
for (int i = 0; i < resList.Count(); i++)
|
||||
{
|
||||
var bList = instockTaskBoxList.Where(w => w.BoxId == bid).OrderBy(x => x.CreateTime).ToList();
|
||||
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(',')) : "",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user