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