自动费用模板保存bug修复

dev
嵇文龙 1 month ago
parent 9f32b44f71
commit 219c23717e

@ -49,6 +49,12 @@ namespace DS.WMS.Core.Fee.Dtos
[ExcelColumnName("付费方式")]
public string? PaymentType { get; set; }
/// <summary>
/// 业务来源代码
/// </summary>
[ExcelColumnName("业务来源代码")]
public string? SourceCode { get; set; }
/// <summary>
/// 20GP
/// </summary>

@ -36,12 +36,6 @@ namespace DS.WMS.Core.Fee.Entity
[SugarColumn(ColumnDescription = "结算对象", Length = 100, IsNullable = true)]
public string? CustomerName { get; set; }
/// <summary>
/// 结算对象类型
/// </summary>
[SugarColumn(ColumnDescription = "结算对象类型", IsNullable = true)]
public string? CustomerType { get; set; }
/// <summary>
/// 名称
/// </summary>

@ -126,6 +126,7 @@ namespace DS.WMS.Core.Fee.Method
TemplateId = template.Id
};
await TenantDb.Insertable(record).ExecuteCommandAsync();
break;
}
}
}
@ -177,7 +178,7 @@ namespace DS.WMS.Core.Fee.Method
return null;
if (!string.IsNullOrEmpty(template.Condition)) //设置了自定义匹配条件
{
{
var conditionModel = JsonConvert.DeserializeObject<ConditionContent>(template.Condition);
if (!actionService.Value.IsMatch(order, conditionModel))
return null;
@ -296,7 +297,6 @@ namespace DS.WMS.Core.Fee.Method
{
ArgumentNullException.ThrowIfNull(models, nameof(models));
long userId = long.Parse(User.UserId);
DateTime dtNow = DateTime.Now;
var custNames = models.Select(x => x.CustomerName).Distinct();
var custList = await TenantDb.Queryable<InfoClient>().Where(x => custNames.Contains(x.Name) && x.Status == 0).Select(x => new
@ -341,8 +341,15 @@ namespace DS.WMS.Core.Fee.Method
// x.EdiCode
//}).ToListAsync();
var sourceCodes = models.Select(x => x.SourceCode).Distinct();
var sources = await TenantDb.Queryable<CodeSource>().Where(x => sourceCodes.Contains(x.SourceCode)).Select(x => new
{
x.Id,
x.SourceCode
}).ToListAsync();
List<FeeCustTemplate> list = [];
var groups = models.GroupBy(x => new { x.CarrierName, x.POL, x.POD, x.LaneName, x.PaymentType, x.CustomerName }).ToList();
var groups = models.GroupBy(x => new { x.CarrierName, x.POL, x.POD, x.LaneName, x.PaymentType, x.CustomerName, x.SourceCode }).ToList();
foreach (var g in groups)
{
var first = g.First();
@ -363,8 +370,8 @@ namespace DS.WMS.Core.Fee.Method
MBLFrtCode = g.Key.PaymentType,
POLCode = g.Key.POL,
PODCode = g.Key.POD,
SourceId = sources.Find(x => x.SourceCode == g.Key.SourceCode)?.Id,
CreateBy = userId,
CreateTime = dtNow,
Note = "系统导入",
Details = []
};
@ -376,15 +383,17 @@ namespace DS.WMS.Core.Fee.Method
{
CustomerId = template.CustomerId.GetValueOrDefault(),
CustomerName = template.CustomerName,
CustomerType = "controller",
CustomerType = template.FeeType == FeeType.Receivable ? "controller" : null,
Currency = item.Currency,
FeeId = (fees.Find(x => x.Name == item.FeeName)?.Id).GetValueOrDefault(),
FeeCode = fees.Find(x => x.Name == item.FeeName)?.Code,
FeeName = item.FeeName,
IsCtn = item.UnitPrice == null,
Tax = 0,
TaxRate = 0,
AccTaxRate = 0,
IsInvoice = true,
CreateBy = userId,
CreateTime = dtNow,
CreateBy = userId
};
if (item.UnitPrice.HasValue)
@ -474,7 +483,6 @@ namespace DS.WMS.Core.Fee.Method
if (string.IsNullOrEmpty(item.CustomerName))
item.CustomerName = model.CustomerName;
item.CustomerType = model.CustomerType;
item.CreateBy = userId;
item.CreateTime = dt;
}

@ -406,6 +406,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
var fee = await TenantDb.Queryable<FeeRecord>().Where(x => x.Id == request.BusinessId)
.Select(x => new
{
x.Id,
x.BusinessId,
x.BusinessType
}).FirstAsync();
@ -415,6 +416,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
copiedInfo.Head.BSNO = fee.BusinessId; //替换为费用关联的订单ID
copiedInfo.Main.RecvUserInfoList.Clear();
copiedInfo.Main.RecvUserInfoList.Add(item);
copiedInfo.Main.ExtData = new { fee.BusinessType, FeeId = fee.Id };
result = await ManagerService.InitTaskJob(copiedInfo);
if (!result.Succeeded)

@ -51,9 +51,11 @@ namespace DS.WMS.FeeApi.Controllers
/// <summary>
/// 导入费用模板
/// </summary>
/// <param name="file"></param>
/// <param name="sourceCode"></param>
/// <returns></returns>
[HttpPost, Route("Import")]
public async Task<IActionResult> ImportAsync(IFormFile file)
public async Task<IActionResult> ImportAsync(IFormFile file, string? sourceCode)
{
if (file == null)
return BadRequest("请求未包含文件流");
@ -76,6 +78,7 @@ namespace DS.WMS.FeeApi.Controllers
PaymentType = item["G"]?.ToString(),
Currency = item["L"]?.ToString(),
CustomerName = item["M"]?.ToString(),
SourceCode = sourceCode
};
if (int.TryParse(item["H"]?.ToString(), out int hVal))

Loading…
Cancel
Save