物料搜索
This commit is contained in:
@@ -107,7 +107,7 @@ namespace WMS.Web.Repositories
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTaskDetails>> GetDetailsList(List<int> ids)
|
||||
{
|
||||
var entitys = await _context.InStockTaskDetails
|
||||
var entitys = await _context.InStockTaskDetails
|
||||
.Where(f => ids.Contains(f.Id))
|
||||
.ToListAsync();
|
||||
return entitys;
|
||||
@@ -154,7 +154,7 @@ namespace WMS.Web.Repositories
|
||||
if (suppliers_result.IsSuccess)
|
||||
suppliers = suppliers_result.Data.ToList();
|
||||
|
||||
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)
|
||||
{
|
||||
@@ -162,11 +162,11 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
Id = entity.Id,
|
||||
BillNo = entity.BillNo,
|
||||
SaleBillNo= (string.Join(",", entity.Details.Select(x => x.SaleBillNo).ToList()).TrimEnd(',')),
|
||||
SourceBillNo = entity.SourceBillNo,
|
||||
SaleBillNo = (string.Join(",", entity.Details.Select(x => x.SaleBillNo).ToList()).TrimEnd(',')),
|
||||
SourceBillNo = entity.SourceBillNo,
|
||||
Status = entity.Status.GetRemark(),
|
||||
Type = entity.Type.GetRemark(),
|
||||
Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, entity.SupplierId??0),
|
||||
Supplier = _erpBasicDataExtendService.GetSupplierName(suppliers, entity.SupplierId ?? 0),
|
||||
Org = _erpBasicDataExtendService.GetOrgName(orgs, entity.OrgCode),
|
||||
CreateTime = entity.CreateTime.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
};
|
||||
@@ -178,14 +178,14 @@ namespace WMS.Web.Repositories
|
||||
.SelectMany(x => x.ts.DefaultIfEmpty(), (p, box) => new { p.detail, box })
|
||||
.Where(x => x.box.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
|
||||
{
|
||||
BoxId=x.box.BoxId,
|
||||
BoxId = x.box.BoxId,
|
||||
BoxBillNo = x.box.BoxBillNo,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
||||
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) : "",
|
||||
Qty = x.detail.ReceiveQty,
|
||||
ReceiveQty=x.detail.ReceiveQty
|
||||
ReceiveQty = x.detail.ReceiveQty
|
||||
}).ToListAsync();
|
||||
|
||||
if (boxList != null && boxList.Count != 0)
|
||||
@@ -195,19 +195,20 @@ namespace WMS.Web.Repositories
|
||||
|
||||
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();
|
||||
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 =>
|
||||
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();
|
||||
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");
|
||||
x.ShelfTime = order == null ? "" : order.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -221,7 +222,7 @@ namespace WMS.Web.Repositories
|
||||
x.SerialNumbers = (string.Join(",", serialNumbList.Where(x => x.MaterialNumber == x.MaterialNumber).Select(x => x.SerialNumber).ToList())).TrimEnd(',');
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -229,53 +230,54 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
else
|
||||
{
|
||||
var boxList= await _context.InStockDetails
|
||||
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.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 })
|
||||
.Where(x => x.detail.TaskId == entity.Id).Select(x => new InStockTaskBoxInfoDto()
|
||||
{
|
||||
BoxId=x.box.Id,
|
||||
BoxId = x.box.Id,
|
||||
BoxBillNo = x.box.BoxBillNo,
|
||||
Method=x.order.Method.GetRemark(),
|
||||
MethodForInt=(int)x.order.Method,
|
||||
Method = x.order.Method.GetRemark(),
|
||||
MethodForInt = (int)x.order.Method,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, x.detail.MaterialNumber),
|
||||
|
||||
Qty=0,
|
||||
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),
|
||||
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(','))
|
||||
SerialNumbers = (string.Join(",", x.detail.SerialNumbers).TrimEnd(','))
|
||||
|
||||
}).ToListAsync();
|
||||
|
||||
if (boxList != null && boxList.Count != 0)
|
||||
if (boxList != null && boxList.Count != 0)
|
||||
{
|
||||
var boxIds= boxList.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
var boxIds = boxList.GroupBy(x => x.BoxId).Select(x => x.Key).ToList();
|
||||
|
||||
var boxdetails= await _context.BoxDetails
|
||||
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
|
||||
.Where(x => boxIds.Contains(x.box.Id)).Select(x => new
|
||||
{
|
||||
BoxId=x.box.Id,
|
||||
MaterialNumber=x.detail.MaterialNumber,
|
||||
Qty=x.detail.Qty
|
||||
BoxId = x.box.Id,
|
||||
MaterialNumber = x.detail.MaterialNumber,
|
||||
Qty = x.detail.Qty
|
||||
}).ToListAsync();
|
||||
|
||||
if (boxdetails != null && boxdetails.Count != 0)
|
||||
if (boxdetails != null && boxdetails.Count != 0)
|
||||
{
|
||||
boxList.ForEach(x =>
|
||||
boxList.ForEach(x =>
|
||||
{
|
||||
var method = (InventoryInOutMethod)x.MethodForInt;
|
||||
if (method == InventoryInOutMethod.Box) {
|
||||
if (method == InventoryInOutMethod.Box)
|
||||
{
|
||||
var currentBoxDet = boxdetails.Where(t => t.BoxId == x.BoxId && t.MaterialNumber == x.MaterialNumber).FirstOrDefault();
|
||||
if (currentBoxDet != null)
|
||||
{
|
||||
@@ -357,7 +359,7 @@ namespace WMS.Web.Repositories
|
||||
DetailsId = s.detail.Id,
|
||||
SupplierId = s.detail.SupplierId,
|
||||
OrgId = s.detail.OrgId,
|
||||
OrgCode=s.detail.OrgCode,
|
||||
OrgCode = s.detail.OrgCode,
|
||||
SourceBillNo = s.order.SourceBillNo,
|
||||
StockCode = s.detail.StockCode,
|
||||
StockName = _singleDataService.GetSingleData(SingleAction.StocksJoinOrgCode, _loginRepositories.CompanyId, s.detail.StockCode + s.detail.OrgCode),
|
||||
@@ -691,6 +693,7 @@ namespace WMS.Web.Repositories
|
||||
if (suppliers_result.IsSuccess)
|
||||
suppliers = suppliers_result.Data.ToList();
|
||||
|
||||
List<string> materialNumbs = new List<string>();
|
||||
List<int> ids_Receiver = new List<int>();
|
||||
List<int> ids_Operator = new List<int>();
|
||||
if (companyId == 0)
|
||||
@@ -715,10 +718,10 @@ namespace WMS.Web.Repositories
|
||||
{
|
||||
if (materials.Count != 0)
|
||||
{
|
||||
materials = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber)
|
||||
materialNumbs = materials.Where(w => w.MaterialNumber.Contains(dto.MaterialNumber)
|
||||
|| w.MaterialName.Contains(dto.MaterialNumber)
|
||||
|| w.Specifications.Contains(dto.MaterialNumber)
|
||||
).ToList();
|
||||
).Select(x => x.MaterialNumber).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -733,11 +736,7 @@ namespace WMS.Web.Repositories
|
||||
//物料ID在模糊后的物料
|
||||
if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
||||
{
|
||||
if (materials != null && materials.Count != 0)
|
||||
{
|
||||
var mids = materials.Select(x => x.MaterialNumber).ToList();
|
||||
query = query.Where(w => mids.Contains(w.detail.MaterialNumber));
|
||||
}
|
||||
query = query.Where(w => materialNumbs.Contains(w.detail.MaterialNumber));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(dto.Receiver))
|
||||
@@ -805,9 +804,9 @@ namespace WMS.Web.Repositories
|
||||
/// 获取明细
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<InStockTaskDetails>> GetNotSendErpDetails()
|
||||
public async Task<List<InStockTaskDetails>> GetNotSendErpDetails()
|
||||
{
|
||||
return await _context.InStockTaskDetails.Where(x =>x.AccruedQty!=0 && x.IsHasSend != null && x.IsHasSend == false && !string.IsNullOrEmpty(x.SaleBillNo) && !string.IsNullOrEmpty(x.CustomerCode)).ToListAsync();
|
||||
return await _context.InStockTaskDetails.Where(x => x.AccruedQty != 0 && x.IsHasSend != null && x.IsHasSend == false && !string.IsNullOrEmpty(x.SaleBillNo) && !string.IsNullOrEmpty(x.CustomerCode)).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user