|
|
|
@ -123,13 +123,15 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
{
|
|
|
|
|
long userId = long.Parse(User.UserId);
|
|
|
|
|
DateTime dtNow = DateTime.Now;
|
|
|
|
|
|
|
|
|
|
TenantDb.QueryFilter.Clear<IOrgId>();
|
|
|
|
|
TenantDb.QueryFilter.Clear<ISharedOrgId>();
|
|
|
|
|
var clientNames = list.Select(x => x.CompanyName).Distinct();
|
|
|
|
|
var clients = await TenantDb.Queryable<InfoClient>().Where(x => clientNames.Contains(x.ShortName))
|
|
|
|
|
var clients = await TenantDb.Queryable<InfoClient>().Where(x => clientNames.Contains(x.ShortName) || clientNames.Contains(x.Description))
|
|
|
|
|
.Select(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
|
x.ShortName,
|
|
|
|
|
x.Description,
|
|
|
|
|
x.OrgId
|
|
|
|
|
}).ToListAsync();
|
|
|
|
|
|
|
|
|
@ -137,40 +139,43 @@ public class ClientBankService : ServiceBase, IClientBankService
|
|
|
|
|
List<InfoClientBank> banks = new List<InfoClientBank>(list.Count);
|
|
|
|
|
foreach (var model in list)
|
|
|
|
|
{
|
|
|
|
|
var client = clients.Find(x => x.ShortName == model.CompanyName);
|
|
|
|
|
if (client == null)
|
|
|
|
|
var clientList = clients.FindAll(x => x.ShortName == model.CompanyName || x.Description == model.CompanyName);
|
|
|
|
|
if (clientList.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
sb.Append("," + model.CompanyName);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
InfoClientBank bank = new()
|
|
|
|
|
{
|
|
|
|
|
ClientId = client.Id,
|
|
|
|
|
OrgId = client.OrgId,
|
|
|
|
|
BankName = model.BankName,
|
|
|
|
|
Account = model.BankAccount,
|
|
|
|
|
BankAddress = model.BankAddress,
|
|
|
|
|
BankAccountNo = model.BankAccount,
|
|
|
|
|
IsInvoiceDefault = model.IsDefault,
|
|
|
|
|
CreateBy = userId,
|
|
|
|
|
CreateUserName = User.UserName,
|
|
|
|
|
CreateTime = dtNow,
|
|
|
|
|
InvoiceHeaders = []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (model.Currency == "人民币")
|
|
|
|
|
bank.Currency = FeeCurrency.RMB_CODE;
|
|
|
|
|
else if (model.Currency == "美元")
|
|
|
|
|
bank.Currency = FeeCurrency.USD_CODE;
|
|
|
|
|
|
|
|
|
|
bank.InvoiceHeaders.Add(new InvoiceHeader
|
|
|
|
|
foreach (var item in clientList)
|
|
|
|
|
{
|
|
|
|
|
Header = model.InvoiceHeader,
|
|
|
|
|
AddressTel = model.InvoiceAddress + " " + model.InvoiceTel
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
banks.Add(bank);
|
|
|
|
|
InfoClientBank bank = new()
|
|
|
|
|
{
|
|
|
|
|
ClientId = item.Id,
|
|
|
|
|
OrgId = item.OrgId,
|
|
|
|
|
BankName = model.BankName,
|
|
|
|
|
Account = model.BankAccount,
|
|
|
|
|
BankAddress = model.BankAddress,
|
|
|
|
|
BankAccountNo = model.BankAccount,
|
|
|
|
|
IsInvoiceDefault = model.IsDefault,
|
|
|
|
|
CreateBy = userId,
|
|
|
|
|
CreateUserName = User.UserName,
|
|
|
|
|
CreateTime = dtNow,
|
|
|
|
|
InvoiceHeaders = []
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (model.Currency == "人民币")
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sb.Length > 0)
|
|
|
|
|