优化详情
This commit is contained in:
@@ -1100,6 +1100,11 @@
|
|||||||
收货人
|
收货人
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.UnBind">
|
||||||
|
<summary>
|
||||||
|
是否解绑
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.Details">
|
<member name="P:WMS.Web.Domain.Entitys.InStockTaskBox.Details">
|
||||||
<summary>
|
<summary>
|
||||||
明细
|
明细
|
||||||
@@ -2874,13 +2879,6 @@
|
|||||||
箱与任务单绑定(收货)关系表-仓储接口
|
箱与任务单绑定(收货)关系表-仓储接口
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Int32)">
|
|
||||||
<summary>
|
|
||||||
集合:任务单ID
|
|
||||||
</summary>
|
|
||||||
<param name="taskId"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Collections.Generic.List{System.Int32})">
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.GetListBy(System.Collections.Generic.List{System.Int32})">
|
||||||
<summary>
|
<summary>
|
||||||
集合:根据boxIDS
|
集合:根据boxIDS
|
||||||
@@ -2926,6 +2924,14 @@
|
|||||||
<param name="isTransaction"></param>
|
<param name="isTransaction"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="M:WMS.Web.Domain.Infrastructure.IInStockTaskBoxRepositories.UpdateRange(System.Collections.Generic.List{WMS.Web.Domain.Entitys.InStockTaskBox},System.Boolean)">
|
||||||
|
<summary>
|
||||||
|
修改
|
||||||
|
</summary>
|
||||||
|
<param name="entitys"></param>
|
||||||
|
<param name="isTransaction"></param>
|
||||||
|
<returns></returns>
|
||||||
|
</member>
|
||||||
<member name="T:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories">
|
<member name="T:WMS.Web.Domain.Infrastructure.IInStockTaskRepositories">
|
||||||
<summary>
|
<summary>
|
||||||
入库任务-仓储接口
|
入库任务-仓储接口
|
||||||
|
|||||||
@@ -49,6 +49,11 @@ namespace WMS.Web.Domain.Entitys
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int? ReceiverId { get; set; }
|
public int? ReceiverId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否解绑
|
||||||
|
/// </summary>
|
||||||
|
public bool? UnBind { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 明细
|
/// 明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -11,12 +11,6 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IInStockTaskBoxRepositories
|
public interface IInStockTaskBoxRepositories
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 集合:任务单ID
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="taskId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
Task<List<InStockTaskBox>> GetListBy(int taskId);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集合:根据boxIDS
|
/// 集合:根据boxIDS
|
||||||
@@ -62,5 +56,13 @@ namespace WMS.Web.Domain.Infrastructure
|
|||||||
/// <param name="isTransaction"></param>
|
/// <param name="isTransaction"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<bool> DeleteRange(List<int> ids, bool isTransaction = true);
|
Task<bool> DeleteRange(List<int> ids, bool isTransaction = true);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entitys"></param>
|
||||||
|
/// <param name="isTransaction"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<bool> UpdateRange(List<InStockTaskBox> entitys, bool isTransaction = true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ namespace WMS.Web.Domain.Services
|
|||||||
var t_boxIds = boxIds.Distinct().ToList();
|
var t_boxIds = boxIds.Distinct().ToList();
|
||||||
var list= await _inStockTaskBoxRepositories.GetListBy(t_boxIds);
|
var list= await _inStockTaskBoxRepositories.GetListBy(t_boxIds);
|
||||||
|
|
||||||
delete_ids= list.Select(x => x.Id).ToList();
|
//delete_ids= list.Select(x => x.Id).ToList();
|
||||||
//var boxInvetList = await _boxInventoryRepositories.GetList(t_boxIds);
|
//var boxInvetList = await _boxInventoryRepositories.GetList(t_boxIds);
|
||||||
//foreach (var item in list)
|
//foreach (var item in list)
|
||||||
//{
|
//{
|
||||||
@@ -47,9 +47,16 @@ namespace WMS.Web.Domain.Services
|
|||||||
// delete_ids.Add(item.Id);
|
// delete_ids.Add(item.Id);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (delete_ids.Count != 0)
|
//if (delete_ids.Count != 0)
|
||||||
|
//{
|
||||||
|
// var isSuccess= await _inStockTaskBoxRepositories.DeleteRange(delete_ids, isTransaction);
|
||||||
|
// if (!isSuccess)
|
||||||
|
// return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (list.Count != 0)
|
||||||
{
|
{
|
||||||
var isSuccess= await _inStockTaskBoxRepositories.DeleteRange(delete_ids, isTransaction);
|
var isSuccess = await _inStockTaskBoxRepositories.UpdateRange(list, isTransaction);
|
||||||
if (!isSuccess)
|
if (!isSuccess)
|
||||||
return Result.ReFailure(ResultCodes.DateWriteError);
|
return Result.ReFailure(ResultCodes.DateWriteError);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
using WMS.Web.Domain.Infrastructure;
|
using WMS.Web.Domain.Infrastructure;
|
||||||
using WMS.Web.Domain.IService.Public;
|
using WMS.Web.Domain.IService.Public;
|
||||||
|
using WMS.Web.Domain.Mappers;
|
||||||
using WMS.Web.Repositories.Configuration;
|
using WMS.Web.Repositories.Configuration;
|
||||||
|
|
||||||
namespace WMS.Web.Repositories
|
namespace WMS.Web.Repositories
|
||||||
@@ -47,18 +48,6 @@ namespace WMS.Web.Repositories
|
|||||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 集合:根据任务ID
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="taskId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<List<InStockTaskBox>> GetListBy(int taskId)
|
|
||||||
{
|
|
||||||
var entitys = await _context.InstockTaskBox
|
|
||||||
.Include(s => s.Details).Where(x => x.TaskId == taskId).ToListAsync();
|
|
||||||
return entitys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 集合:根据boxIDS
|
/// 集合:根据boxIDS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -67,7 +56,7 @@ namespace WMS.Web.Repositories
|
|||||||
public async Task<List<InStockTaskBox>> GetListBy(List<int> boxIds)
|
public async Task<List<InStockTaskBox>> GetListBy(List<int> boxIds)
|
||||||
{
|
{
|
||||||
var entitys = await _context.InstockTaskBox
|
var entitys = await _context.InstockTaskBox
|
||||||
.Include(s => s.Details).Where(x => boxIds.Contains(x.BoxId)).ToListAsync();
|
.Include(s => s.Details).Where(x => boxIds.Contains(x.BoxId) && (x.UnBind==null || x.UnBind==false)).ToListAsync();
|
||||||
return entitys;
|
return entitys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +68,7 @@ namespace WMS.Web.Repositories
|
|||||||
public async Task<List<InStockTaskBox>> GetListBy(List<string> boxBillNos)
|
public async Task<List<InStockTaskBox>> GetListBy(List<string> boxBillNos)
|
||||||
{
|
{
|
||||||
var entitys = await _context.InstockTaskBox
|
var entitys = await _context.InstockTaskBox
|
||||||
.Include(s => s.Details).Where(x => boxBillNos.Contains(x.BoxBillNo)).ToListAsync();
|
.Include(s => s.Details).Where(x => boxBillNos.Contains(x.BoxBillNo) && (x.UnBind == null || x.UnBind == false)).ToListAsync();
|
||||||
return entitys;
|
return entitys;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +80,7 @@ namespace WMS.Web.Repositories
|
|||||||
public async Task<InStockTaskBox> GetBy(string boxBillNo)
|
public async Task<InStockTaskBox> GetBy(string boxBillNo)
|
||||||
{
|
{
|
||||||
var entity = await _context.InstockTaskBox
|
var entity = await _context.InstockTaskBox
|
||||||
.Include(s => s.Details).Where(x => x.BoxBillNo == boxBillNo).FirstOrDefaultAsync();
|
.Include(s => s.Details).Where(x => x.BoxBillNo == boxBillNo && (x.UnBind == null || x.UnBind == false)).FirstOrDefaultAsync();
|
||||||
return entity;
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +92,7 @@ namespace WMS.Web.Repositories
|
|||||||
public async Task<InStockTaskBox> GetBy(string boxBillNo, int? taskId)
|
public async Task<InStockTaskBox> GetBy(string boxBillNo, int? taskId)
|
||||||
{
|
{
|
||||||
var query = _context.InstockTaskBox
|
var query = _context.InstockTaskBox
|
||||||
.Include(s => s.Details).Where(x => x.BoxBillNo == boxBillNo);
|
.Include(s => s.Details).Where(x => x.BoxBillNo == boxBillNo && (x.UnBind == null || x.UnBind == false));
|
||||||
|
|
||||||
if (taskId.HasValue)
|
if (taskId.HasValue)
|
||||||
query = query.Where(x => x.TaskId == taskId.Value);
|
query = query.Where(x => x.TaskId == taskId.Value);
|
||||||
@@ -169,5 +158,35 @@ namespace WMS.Web.Repositories
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量修改
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="entitys"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<bool> UpdateRange(List<InStockTaskBox> entitys, bool isTransaction = true)
|
||||||
|
{
|
||||||
|
IDbContextTransaction _transaction = null;
|
||||||
|
if (isTransaction)
|
||||||
|
_transaction = _context.Database.BeginTransaction();
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
List<int> list = entitys.Select(s => s.Id).ToList();
|
||||||
|
var res = await _context.InstockTaskBox.Include(x => x.Details).Where(f => list.Contains(f.Id)).ToListAsync();
|
||||||
|
_mapper.Map(entitys, res);
|
||||||
|
var tt = await _context.SaveChangesAsync();
|
||||||
|
if (_transaction != null)
|
||||||
|
_transaction.Commit();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (_transaction != null)
|
||||||
|
_transaction.Rollback();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -157,195 +157,49 @@ namespace WMS.Web.Repositories
|
|||||||
|
|
||||||
var entity = await _context.InStockTask.Include(x => x.Details).Where(x => x.Id == id).FirstOrDefaultAsync();
|
var entity = await _context.InStockTask.Include(x => x.Details).Where(x => x.Id == id).FirstOrDefaultAsync();
|
||||||
|
|
||||||
if (entity != null)
|
if (entity == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
var response = new InStockTaskInfoDto()
|
||||||
{
|
{
|
||||||
var response = new InStockTaskInfoDto()
|
Id = entity.Id,
|
||||||
{
|
BillNo = entity.BillNo,
|
||||||
Id = entity.Id,
|
SaleBillNo = (string.Join(",", entity.Details.Select(x => x.SaleBillNo).ToList()).TrimEnd(',')),
|
||||||
BillNo = entity.BillNo,
|
SourceBillNo = entity.SourceBillNo,
|
||||||
SaleBillNo = (string.Join(",", entity.Details.Select(x => x.SaleBillNo).ToList()).TrimEnd(',')),
|
Status = entity.Status.GetRemark(),
|
||||||
SourceBillNo = entity.SourceBillNo,
|
Type = entity.Type.GetRemark(),
|
||||||
Status = entity.Status.GetRemark(),
|
Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, entity.SupplierId ?? 0),
|
||||||
Type = entity.Type.GetRemark(),
|
Org = _erpBasicDataExtendService.GetOrgName(orgs, entity.OrgCode),
|
||||||
Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, entity.SupplierId ?? 0),
|
CreateTime = entity.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||||
Org = _erpBasicDataExtendService.GetOrgName(orgs, entity.OrgCode),
|
};
|
||||||
CreateTime = entity.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
|
var boxList = await _context.InStockDetails
|
||||||
};
|
.GroupJoin(_context.Instock, det => det.Fid, ts => ts.Id, (detail, ts) => new { detail, ts })
|
||||||
if (entity.Type == InstockType.Purchase)
|
.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 })
|
||||||
var boxList = await _context.InStockTaskBoxDetails
|
.GroupJoin(_context.InStockTaskDetails, p => p.detail.TaskDetailId, ts => ts.Id, (p, ts) => new { p.detail, p.order, p.box, ts })
|
||||||
.GroupJoin(_context.InstockTaskBox, boxde => boxde.Fid, ts => ts.Id, (detail, ts) => new { detail, ts })
|
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, taskDet) => new { p.detail, p.order, p.box, taskDet })
|
||||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, box })
|
.Where(x => x.detail.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
|
||||||
.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 })
|
BoxId = x.box.Id,
|
||||||
.Where(x => x.box.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
|
BoxBillNo = x.box.BoxBillNo,
|
||||||
{
|
Method = x.order.Method.GetRemark(),
|
||||||
BoxId = x.box.BoxId,
|
MethodForInt = (int)x.order.Method,
|
||||||
BoxBillNo = x.box.BoxBillNo,
|
MaterialNumber = x.detail.MaterialNumber,
|
||||||
SaleBillNo = x.taskDet.SaleBillNo,
|
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
||||||
Method = InventoryInOutMethod.Box.GetRemark(),
|
SaleBillNo = x.taskDet.SaleBillNo,
|
||||||
MaterialNumber = x.detail.MaterialNumber,
|
Qty = x.detail.Qty,
|
||||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
RealityQty = x.detail.Qty,
|
||||||
ReceiveTime = x.box.CreateTime.HasValue ? x.box.CreateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
|
ReceiveQty = x.detail.Qty,
|
||||||
Receiver = x.box.ReceiverId.HasValue ? _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.box.ReceiverId.Value) : "",
|
ShelfTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
Qty = x.detail.ReceiveQty,
|
Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
|
||||||
ReceiveQty = x.detail.ReceiveQty,
|
Receiver = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, x.order.CreatorId),
|
||||||
SerialNumbers = x.detail.SerialNumbers != null && x.detail.SerialNumbers.Count() > 0 ? (string.Join(",", x.detail.SerialNumbers).TrimEnd(',')) : "",
|
ReceiveTime = x.order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||||
}).ToListAsync();
|
SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
|
||||||
|
|
||||||
if (boxList != null && boxList.Count != 0)
|
}).ToListAsync();
|
||||||
{
|
response.Boxs = boxList;
|
||||||
//采购入库明细
|
return response;
|
||||||
var boxInstockList_details = await _context.InStockDetails.Where(x => x.TaskId == entity.Id).ToListAsync();
|
|
||||||
|
|
||||||
if (boxInstockList_details != null && boxInstockList_details.Count != 0)
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
boxList.ForEach(x =>
|
|
||||||
{
|
|
||||||
var currentInstock = boxInstockList_details.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
|
||||||
if (currentInstock != null)
|
|
||||||
{
|
|
||||||
var order = instockOrder.Where(o => o.Id == currentInstock.Fid).FirstOrDefault();
|
|
||||||
x.RealityQty = currentInstock.Qty;
|
|
||||||
x.Shelfer = _singleDataService.GetSingleData(SingleAction.Staffs, companyId, (order == null ? 0 : order.CreatorId));
|
|
||||||
x.ShelfTime = order == null ? "" : order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user