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

@@ -214,6 +214,7 @@ namespace WMS.Web.Repositories
/// <returns></returns>
public async Task<(List<OutStockTaskQueryInfoResponse> list, int total)> GetListAsync(OutStockTaskQueryRequest dto)
{
#region erp基础资料
List<int> mIds = new List<int>();
var materials_result = await _erpService.BillQueryForMaterial();
if (!materials_result.IsSuccess)
@@ -224,14 +225,34 @@ 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<OutStockTaskQueryInfoResponse>(), 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<OutStockTaskQueryInfoResponse>(), 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.OutStockTaskDetails
.GroupJoin(_context.OutStockTask, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
.OrderByDescending(o => o.order.Id)
.Where(adv => 1 == 1);
//if (!string.IsNullOrEmpty(dto.ReceiptCustomer))
if (mIds.Count()!=0)
if (cIds.Count() != 0)
query = query.Where(w => cIds.Contains(w.order.ReceiptCustomerId));
if (mIds.Count() != 0)
query = query.Where(w => mIds.Contains(w.detail.MaterialId));
if (dto.Ids.Count() > 0)
query = query.Where(w => dto.Ids.Contains(w.detail.Id));
@@ -255,18 +276,20 @@ namespace WMS.Web.Repositories
{
#region dto组装
Id = s.order.Id,
DetailId=s.detail.Id,
BillNo =s.order.BillNo,
DetailId = s.detail.Id,
BillNo = s.order.BillNo,
Status = s.order.Status.GetRemark(),
Type = s.order.Type.GetRemark(),
CreateTime = s.order.OperateTime.DateToStringSeconds(),
OutStockBeginTime= s.detail.OutStockBeginTime.DateToStringSeconds(),
OutStockBeginTime = s.detail.OutStockBeginTime.DateToStringSeconds(),
OutStockEndTime = s.detail.OutStockEndTime.DateToStringSeconds(),
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),