youh
This commit is contained in:
@@ -203,9 +203,6 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
var instockOrder_ids = boxInstockList_details.GroupBy(x => x.Fid).Select(x => x.Key).ToList();
|
||||
var instockOrder = await _context.Instock.Where(x => instockOrder_ids.Contains(x.Id)).ToListAsync();
|
||||
//var boxInstockList = boxInstockList_details.GroupBy(x => new { BoxId = x.BoxId, MaterialNumber = x.MaterialNumber }).
|
||||
// Select(x => new { BoxId = x.Key.BoxId, MaterialNumber = x.Key.MaterialNumber, RealityQty = x.Sum(t => t.Qty) }).ToList();
|
||||
|
||||
boxList.ForEach(x =>
|
||||
{
|
||||
var currentInstock = boxInstockList_details.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
||||
@@ -218,19 +215,66 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
////序列号
|
||||
//var materNumbs = boxList.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
|
||||
//var serialNumbList = _context.SerialNumbers.Where(x => materNumbs.Contains(x.MaterialNumber)).ToList();
|
||||
|
||||
//boxList.ForEach(x =>
|
||||
//{
|
||||
// x.SerialNumbers = (string.Join(",", serialNumbList.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).Select(t => t.SerialNumber).ToList())).TrimEnd(',');
|
||||
//});
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
boxList = await _context.InStockDetails
|
||||
.GroupJoin(_context.Instock, det => det.Fid, ts => ts.Id, (detail, ts) => new { detail, ts })
|
||||
.SelectMany(x => x.ts.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 })
|
||||
.GroupJoin(_context.InStockTaskDetails, p => p.detail.TaskDetailId, ts => ts.Id, (p, ts) => new { p.detail, p.order, p.box, ts })
|
||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, taskDet) => new { p.detail, p.order, p.box, taskDet })
|
||||
.Where(x => x.detail.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
|
||||
{
|
||||
BoxId = x.box.Id,
|
||||
BoxBillNo = x.box.BoxBillNo,
|
||||
Method = x.order.Method.GetRemark(),
|
||||
MethodForInt = (int)x.order.Method,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
||||
SaleBillNo = x.taskDet.SaleBillNo,
|
||||
Qty = 0,
|
||||
RealityQty = x.detail.Qty,
|
||||
ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
|
||||
ReceiveQty = x.detail.Qty,
|
||||
Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
|
||||
ReceiveTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
|
||||
|
||||
}).ToListAsync();
|
||||
if (boxList != null && boxList.Count != 0)
|
||||
{
|
||||
var boxIds = boxList.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
|
||||
var boxdetails = await _context.BoxDetails
|
||||
.GroupJoin(_context.Box, det => det.Fid, ts => ts.Id, (detail, ts) => new { detail, ts })
|
||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, box })
|
||||
.Where(x => boxIds.Contains(x.box.Id)).Select(x => new
|
||||
{
|
||||
BoxId = x.box.Id,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Qty = x.detail.Qty
|
||||
}).ToListAsync();
|
||||
|
||||
if (boxdetails != null && boxdetails.Count != 0)
|
||||
{
|
||||
boxList.ForEach(x =>
|
||||
{
|
||||
var method = (InventoryInOutMethod)x.MethodForInt;
|
||||
if (method == InventoryInOutMethod.Box)
|
||||
{
|
||||
var currentBoxDet = boxdetails.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
||||
if (currentBoxDet != null)
|
||||
{
|
||||
x.Qty = currentBoxDet.Qty;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
response.Boxs = boxList;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user