|
|
@ -61,8 +61,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
PODCode = x.PODCode,
|
|
|
|
PODCode = x.PODCode,
|
|
|
|
LaneId = x.LaneId,
|
|
|
|
LaneId = x.LaneId,
|
|
|
|
SourceId = x.SourceId,
|
|
|
|
SourceId = x.SourceId,
|
|
|
|
|
|
|
|
SourceDetailId = x.SourceDetailId,
|
|
|
|
CarrierId = x.CarrierId,
|
|
|
|
CarrierId = x.CarrierId,
|
|
|
|
ForwarderId = x.ForwarderId,
|
|
|
|
ForwarderId = x.ForwarderId,
|
|
|
|
|
|
|
|
DeptOrgId = x.DeptOrgId,
|
|
|
|
MBLFrtCode = x.MBLFrtCode,
|
|
|
|
MBLFrtCode = x.MBLFrtCode,
|
|
|
|
Condition = x.Condition
|
|
|
|
Condition = x.Condition
|
|
|
|
}).ToListAsync();
|
|
|
|
}).ToListAsync();
|
|
|
@ -186,9 +188,15 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
if (template.SourceId.HasValue && template.SourceId != order.SourceId)
|
|
|
|
if (template.SourceId.HasValue && template.SourceId != order.SourceId)
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (template.SourceDetailId.HasValue && template.SourceDetailId != order.SourceDetailId)
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
if (template.ForwarderId.HasValue && template.ForwarderId != order.ForwarderId)
|
|
|
|
if (template.ForwarderId.HasValue && template.ForwarderId != order.ForwarderId)
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (template.DeptOrgId.HasValue && template.DeptOrgId != order.DeptOrgId)
|
|
|
|
|
|
|
|
// return null;
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(template.Condition)) //设置了自定义匹配条件
|
|
|
|
if (!string.IsNullOrEmpty(template.Condition)) //设置了自定义匹配条件
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var conditionModel = JsonConvert.DeserializeObject<ConditionContent>(template.Condition);
|
|
|
|
var conditionModel = JsonConvert.DeserializeObject<ConditionContent>(template.Condition);
|
|
|
@ -558,6 +566,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (model.Id == 0)
|
|
|
|
if (model.Id == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
model.DeptOrgId ??= User.OrgId;
|
|
|
|
await TenantDb.InsertNav(model).Include(x => x.Details).ExecuteCommandAsync();
|
|
|
|
await TenantDb.InsertNav(model).Include(x => x.Details).ExecuteCommandAsync();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -579,6 +588,92 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 批量编辑模板
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="list"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult> BulkEditAsync(List<FeeCustTemplate> list)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
int rows = await TenantDb.Updateable(list).UpdateColumns(x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.StartTime,
|
|
|
|
|
|
|
|
x.EndTime,
|
|
|
|
|
|
|
|
x.IsDisabled,
|
|
|
|
|
|
|
|
x.FeeCategoryId,
|
|
|
|
|
|
|
|
x.FeeCategoryName,
|
|
|
|
|
|
|
|
x.Priority,
|
|
|
|
|
|
|
|
x.PODCode,
|
|
|
|
|
|
|
|
x.POLCode,
|
|
|
|
|
|
|
|
x.LaneId,
|
|
|
|
|
|
|
|
x.CarrierId,
|
|
|
|
|
|
|
|
x.MBLFrtCode,
|
|
|
|
|
|
|
|
x.SourceId,
|
|
|
|
|
|
|
|
x.SourceDetailId,
|
|
|
|
|
|
|
|
x.ForwarderId,
|
|
|
|
|
|
|
|
x.DeptOrgId
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 批量编辑模板明细
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="details"></param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult> BulkEditDetailsAsync(List<FeeCustTemplateDetail> details)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var model = await TenantDb.Queryable<FeeCustTemplate>()
|
|
|
|
|
|
|
|
.Where(x => x.Id == details[0].TemplateId).Select(x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.CustomerId,
|
|
|
|
|
|
|
|
x.CustomerName,
|
|
|
|
|
|
|
|
x.FeeType
|
|
|
|
|
|
|
|
}).FirstAsync();
|
|
|
|
|
|
|
|
if (model == null)
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in details)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.TaxRate ??= 0;
|
|
|
|
|
|
|
|
item.AccTaxRate ??= 0;
|
|
|
|
|
|
|
|
item.Tax = Math.Round(item.TaxUnitPrice.GetValueOrDefault() - item.TaxRate.GetValueOrDefault() / 100 * item.TaxUnitPrice.GetValueOrDefault(), 2, MidpointRounding.AwayFromZero);
|
|
|
|
|
|
|
|
item.UnitPrice = item.TaxUnitPrice - item.Tax.GetValueOrDefault();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item.ExchangeRate == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (item.Currency == FeeCurrency.RMB_CODE)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
item.ExchangeRate = 1m;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var er = await exchangeService.Value.GetExchangeRateAsync(new ExchangeRate
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
CurrencyFrom = item.Currency,
|
|
|
|
|
|
|
|
CurrencyTo = FeeCurrency.RMB_CODE,
|
|
|
|
|
|
|
|
FeeType = model.FeeType
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
item.ExchangeRate = er.Data?.Rate;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (item.CustomerId == 0 && model.CustomerId.HasValue)
|
|
|
|
|
|
|
|
item.CustomerId = model.CustomerId.Value;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(item.CustomerName))
|
|
|
|
|
|
|
|
item.CustomerName = model.CustomerName;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int rows = await TenantDb.Updateable(details).IgnoreColumns(x => new
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
x.TemplateId,
|
|
|
|
|
|
|
|
x.CreateTime,
|
|
|
|
|
|
|
|
x.CreateBy
|
|
|
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 根据ID批量删除
|
|
|
|
/// 根据ID批量删除
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|