客户银行导入优化

dev
嵇文龙 1 month ago
parent 80e3535a55
commit 2abf71c12c

@ -17,10 +17,10 @@ public class ClientTagReq
/// </summary>
public long? ClientId { get; set; }
///// <summary>
///// Desc:是否特批放单客户
///// </summary>
//public bool? IsSpecialApproval { get; set; } = false;
/// <summary>
/// Desc:是否特批放单客户
/// </summary>
public bool? IsSpecialApproval { get; set; } = false;
/// <summary>
/// Desc:是否船公司
@ -121,8 +121,7 @@ public class ClientTagReq
/// <summary>
/// Desc:其他类型
/// </summary>
public string Others { get; set; }
public string? Others { get; set; }
/// <summary>
/// Desc:是否船代
@ -141,6 +140,42 @@ public class ClientTagReq
/// Desc:是否约主
/// </summary>
public bool? IsContract { get; set; } = false;
/// <summary>
/// 是否国内同行
/// </summary>
public bool IsForeignCounterparts { get; set; }
/// <summary>
/// 是否国内直客
/// </summary>
public bool IsDirectCustomerCn { get; set; }
/// <summary>
/// 是否国外直客
/// </summary>
public bool IsDirectCustomer { get; set; }
/// <summary>
/// 是否指定货发货人
/// </summary>
public bool IsShipperZDH { get; set; }
/// <summary>
/// 是否个人
/// </summary>
public bool IsPersonal { get; set; }
/// <summary>
/// 是否装箱加固
/// </summary>
public bool IsPacking { get; set; }
/// <summary>
/// 是否放箱公司
/// </summary>
public bool IsContainerCompany { get; set; }
/// <summary>
/// 备注
/// </summary>

@ -18,7 +18,7 @@ public class InfoClientBank : BaseModelV2<long>
/// <summary>
/// Desc:代码
/// </summary>
[SugarColumn(ColumnDescription = "代码", Length = 20)]
[SugarColumn(ColumnDescription = "代码", Length = 50)]
public string CodeName { get; set; }
/// <summary>
@ -36,13 +36,13 @@ public class InfoClientBank : BaseModelV2<long>
/// <summary>
/// Desc:银行账户
/// </summary>
[SugarColumn(ColumnDescription = "银行账户", Length = 40, IsNullable = true)]
[SugarColumn(ColumnDescription = "银行账户", Length = 100, IsNullable = true)]
public string Account { get; set; }
/// <summary>
/// Desc:银行地址
/// </summary>
[SugarColumn(ColumnDescription = "银行地址", Length = 50, IsNullable = true)]
[SugarColumn(ColumnDescription = "银行地址", Length = 500, IsNullable = true)]
public string BankAddress { get; set; }
/// <summary>
@ -72,7 +72,7 @@ public class InfoClientBank : BaseModelV2<long>
/// <summary>
/// Desc:银行账号
/// </summary>
[SugarColumn(ColumnDescription = "银行账号", Length = 20, IsNullable = true)]
[SugarColumn(ColumnDescription = "银行账号", Length = 100, IsNullable = true)]
public string BankAccountNo { get; set; }
/// <summary>

@ -6,6 +6,7 @@ using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Dtos;
using DS.WMS.Core.Info.Entity;
using DS.WMS.Core.Info.Interface;
using DS.WMS.Core.TaskPlat.Dtos;
using Mapster;
namespace DS.WMS.Core.Info.Method;
@ -114,6 +115,7 @@ public class ClientBankService : ServiceBase, IClientBankService
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
const int PAGE_SIZE = 200;
/// <summary>
/// 导入客户银行
/// </summary>
@ -152,6 +154,7 @@ public class ClientBankService : ServiceBase, IClientBankService
{
ClientId = item.Id,
OrgId = item.OrgId,
CodeName = PinYinUtil.GetFristLetter(model.BankName),
BankName = model.BankName,
Account = model.BankAccount,
BankAddress = model.BankAddress,
@ -163,6 +166,9 @@ public class ClientBankService : ServiceBase, IClientBankService
InvoiceHeaders = []
};
if (bank.CodeName.Length > 50)
bank.CodeName = bank.CodeName.Substring(0, 50);
if (model.Currency == "人民币")
bank.Currency = FeeCurrency.RMB_CODE;
else if (model.Currency == "美元")
@ -178,16 +184,23 @@ public class ClientBankService : ServiceBase, IClientBankService
}
}
if (sb.Length > 0)
{
sb.Remove(0, 1);
return DataResult.Failed("下列【公司名称】匹配不到客户/供应商:" + sb.ToString());
}
//if (sb.Length > 0)
//{
// sb.Remove(0, 1);
// return DataResult.Failed("下列【公司名称】匹配不到客户/供应商:" + sb.ToString());
//}
await TenantDb.Ado.BeginTranAsync();
try
{
await TenantDb.Fastest<InfoClientBank>().BulkMergeAsync(banks);
//await TenantDb.Fastest<InfoClientBank>().BulkMergeAsync(banks);
int page = Convert.ToInt32(Math.Ceiling(banks.Count / Convert.ToDouble(PAGE_SIZE)));
for (int i = 0; i < page; i++)
{
var batchList = banks.Skip(i * PAGE_SIZE).Take(PAGE_SIZE).ToList();
await TenantDb.Insertable(batchList).ExecuteCommandAsync();
}
foreach (var bank in banks)
{

Loading…
Cancel
Save