任务详情优化1
This commit is contained in:
@@ -183,11 +183,12 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
BoxId = x.box.Id,
|
||||
BoxBillNo = x.box.BoxBillNo,
|
||||
SaleBillNo = x.taskDet.SaleBillNo,
|
||||
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 = x.detail.Qty,
|
||||
RealityQty = x.detail.Qty,
|
||||
ReceiveQty = x.detail.Qty,
|
||||
@@ -200,13 +201,43 @@ namespace WMS.Web.Repositories
|
||||
}).ToListAsync();
|
||||
|
||||
var boxIds = boxList.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var boxs= await _context.Box.Where(x => boxIds.Contains(x.Id)).ToListAsync();
|
||||
boxList.ForEach(x=>
|
||||
|
||||
if (entity.Type == InstockType.Purchase)
|
||||
{
|
||||
var current_box= boxs.Where(b => b.Id == x.BoxId).FirstOrDefault();
|
||||
if (current_box != null)
|
||||
var receiveBox = await _context.InStockTaskBoxDetails
|
||||
.GroupJoin(_context.InstockTaskBox, boxde => boxde.Fid, ts => ts.Id, (detail, ts) => new { detail, ts })
|
||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, box })
|
||||
.GroupJoin(_context.InStockTaskDetails, p => p.box.TaskDetailId, ts => ts.Id, (p, ts) => new { p.detail, p.box, ts })
|
||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, taskDet) => new { p.detail, p.box, taskDet })
|
||||
.Where(x => x.box.TaskId == entity.Id && !boxIds.Contains(x.box.BoxId)).Select(x => new InStockTaskBoxInfoDto()
|
||||
{
|
||||
BoxId = x.box.BoxId,
|
||||
BoxBillNo = x.box.BoxBillNo,
|
||||
SaleBillNo = x.taskDet.SaleBillNo,
|
||||
Method = InventoryInOutMethod.Box.GetRemark(),
|
||||
MethodForInt =(int)InventoryInOutMethod.Box,
|
||||
Qty = x.detail.ReceiveQty,
|
||||
ReceiveQty = x.detail.ReceiveQty,
|
||||
RealityQty = 0,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
||||
ShelfTime = "",
|
||||
Shelfer = "",
|
||||
ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
||||
Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "",
|
||||
SerialNumbers = x.detail.SerialNumbers != null && x.detail.SerialNumbers.Count() > 0 ? (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) : "",
|
||||
}).ToListAsync();
|
||||
|
||||
boxList.AddRange(receiveBox);
|
||||
}
|
||||
|
||||
var boxs = await _context.Box.Where(x => boxIds.Contains(x.Id)).ToListAsync();
|
||||
boxList.ForEach(x =>
|
||||
{
|
||||
var current_box = boxs.Where(b => b.Id == x.BoxId).FirstOrDefault();
|
||||
if (current_box != null)
|
||||
{
|
||||
var current_boxDet= current_box.Details.Where(d => d.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
||||
var current_boxDet = current_box.Details.Where(d => d.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
||||
if (x.MethodForInt == (int)InventoryInOutMethod.Product && current_boxDet.Qty != 0)
|
||||
x.Qty = current_boxDet.Qty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user