erp客户同步

This commit is contained in:
18942506660
2023-11-09 10:06:36 +08:00
parent b51f09542c
commit 0bd21a0329
9 changed files with 184 additions and 13 deletions

View File

@@ -88,7 +88,7 @@ namespace WMS.Web.Repositories
var staffList = await _basicsRepositories.GetStaffListAsync(_loginRepositories.CompanyId);
ids = staffList.Where(w => EF.Functions.Like(w.Name, "%" + dto.Creator + "%")).Select(s => s.Id).ToList();
}
#region erp基础资料
List<int> mIds = new List<int>();
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
@@ -100,6 +100,24 @@ namespace WMS.Web.Repositories
mIds = materials.Where(w => EF.Functions.Like(w.MaterialNumber, "%" + dto.MaterialNumber + "%")).Select(s => s.MaterialId).ToList();
}
//取组织
var org_result = await _erpService.BillQueryForOrg();
if (!org_result.IsSuccess)
return (new List<OutStockQueryInfoResponse>(), 0);
var orgs = org_result.Data.ToList();
List<int> cIds = new List<int>();
var customer_result = await _erpService.BillQueryForCustomer();
if (!customer_result.IsSuccess)
return (new List<OutStockQueryInfoResponse>(), 0);
var customers = customer_result.Data.ToList();
//物料集合;模糊查询后的物料集合
if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
{
cIds = customers.Where(w => EF.Functions.Like(w.Name, "%" + dto.ReceiptCustomer + "%")).Select(s => s.MaterialId).ToList();
}
#endregion
var query = _context.OutStockDetails
.GroupJoin(_context.OutStock, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
@@ -139,8 +157,10 @@ namespace WMS.Web.Repositories
Stock = _singleDataService.GetSingleData(SingleAction.Stocks, _loginRepositories.CompanyId, s.detail.StockId),
SourceBillNo = s.order.SourceBillNo,
SaleBillNo = s.detail.SaleBillNo,
DeliveryOrg = "",
ReceiptCustomer = "",
DeliveryOrg = _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
ReceiptCustomer = s.order.Type == OutStockType.Sal
? _erpBasicDataExtendService.GetCustomerName(customers, s.order.ReceiptCustomerId)
: _erpBasicDataExtendService.GetOrgName(orgs, s.order.DeliveryOrgId),
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),