|
|
|
@ -34,18 +34,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
|
var result = TenantDb.Queryable<InfoClientBank>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<ClientBankRes>().ToQueryPage(request.PageCondition);
|
|
|
|
|
|
|
|
|
|
if (result.Data?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var ids = result.Data.Select(x => x.Id);
|
|
|
|
|
var list = TenantDb.Queryable<InvoiceHeader>().Where(x => ids.Contains(x.RelativeId)).ToList();
|
|
|
|
|
foreach (var item in result.Data)
|
|
|
|
|
{
|
|
|
|
|
item.InvoiceHeaders = list.FindAll(x => x.RelativeId == item.Id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.Select<ClientBankRes>().ToQueryPage(request.PageCondition);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -62,7 +51,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
return DataResult.Failed("银行信息已存在!", MultiLanguageConst.ClientBankExist);
|
|
|
|
|
|
|
|
|
|
var data = req.Adapt<InfoClientBank>();
|
|
|
|
|
var entity = await TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntityAsync();
|
|
|
|
|
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -75,11 +64,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
await TenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
//创建或更新发票抬头
|
|
|
|
|
if (req.InvoiceHeaders?.Count > 0)
|
|
|
|
|
await TenantDb.Storageable(req.InvoiceHeaders).DefaultAddElseUpdate().ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -94,11 +79,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
var data = await TenantDb.Queryable<InfoClientBank>()
|
|
|
|
|
.Where(a => a.Id == id)
|
|
|
|
|
.Select<ClientBankRes>()
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
|
|
|
|
|
if (data != null)
|
|
|
|
|
data.InvoiceHeaders = await TenantDb.Queryable<InvoiceHeader>().Where(x => x.RelativeId == data.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
.FirstAsync();
|
|
|
|
|
return DataResult<ClientBankRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -163,7 +144,6 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
CreateBy = userId,
|
|
|
|
|
CreateUserName = User.UserName,
|
|
|
|
|
CreateTime = dtNow,
|
|
|
|
|
InvoiceHeaders = []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (bank.CodeName.Length > 50)
|
|
|
|
@ -173,12 +153,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
bank.Currency = FeeCurrency.RMB_CODE;
|
|
|
|
|
else if (model.Currency == "美元")
|
|
|
|
|
bank.Currency = FeeCurrency.USD_CODE;
|
|
|
|
|
|
|
|
|
|
bank.InvoiceHeaders.Add(new InvoiceHeader
|
|
|
|
|
{
|
|
|
|
|
Header = model.InvoiceHeader,
|
|
|
|
|
AddressTel = model.InvoiceAddress + " " + model.InvoiceTel
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
banks.Add(bank);
|
|
|
|
|
}
|
|
|
|
@ -200,17 +175,7 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
{
|
|
|
|
|
var batchList = banks.Skip(i * PAGE_SIZE).Take(PAGE_SIZE).ToList();
|
|
|
|
|
await TenantDb.Insertable(batchList).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (var bank in banks)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in bank.InvoiceHeaders)
|
|
|
|
|
item.RelativeId = bank.Id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var invoiceHeaders = banks.SelectMany(x => x.InvoiceHeaders).ToList();
|
|
|
|
|
await TenantDb.Fastest<InvoiceHeader>().BulkMergeAsync(invoiceHeaders);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|