|
|
|
@ -60,7 +60,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
|
x.Condition,
|
|
|
|
|
Details = SqlFunc.Subqueryable<FeeCustTemplateDetail>().Where(y => y.TemplateId == x.Id).ToList(y => new
|
|
|
|
|
Details = SqlFunc.Subqueryable<FeeCustTemplateDetail>().Where(y =>
|
|
|
|
|
y.TemplateId == x.Id && y.CustomerId == order.CustomerId).ToList(y => new
|
|
|
|
|
{
|
|
|
|
|
y.CustomerId,
|
|
|
|
|
y.CustomerName,
|
|
|
|
@ -176,8 +177,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult<FeeCustTemplate>> GetAsync(long id)
|
|
|
|
|
{
|
|
|
|
|
var data = await TenantDb.Queryable<FeeCustTemplate>().Where(x => x.Id == id)
|
|
|
|
|
.Includes(x => x.Details).FirstAsync();
|
|
|
|
|
var data = await TenantDb.Queryable<FeeCustTemplate>().Where(x => x.Id == id).FirstAsync();
|
|
|
|
|
if (data != null)
|
|
|
|
|
data.Details = await TenantDb.Queryable<FeeCustTemplateDetail>().Where(x => x.TemplateId == data.Id).ToListAsync();
|
|
|
|
|
|
|
|
|
|
return DataResult<FeeCustTemplate>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -207,19 +210,30 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool flag;
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (model.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
flag = await TenantDb.InsertNav(model).Include(x => x.Details).ExecuteCommandAsync();
|
|
|
|
|
await TenantDb.InsertNav(model).Include(x => x.Details).ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
flag = await TenantDb.Updateable(model).ExecuteCommandAsync() > 0;
|
|
|
|
|
flag = await TenantDb.Storageable(model.Details).DefaultAddElseUpdate().ExecuteCommandAsync() > 0;
|
|
|
|
|
await TenantDb.Updateable(model).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
if (model.Details.Count > 0)
|
|
|
|
|
await TenantDb.Storageable(model.Details).DefaultAddElseUpdate().ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return flag ? DataResult.Successed("添加成功!", model.Id, MultiLanguageConst.DataCreateSuccess)
|
|
|
|
|
: DataResult.FailedWithDesc(MultiLanguageConst.Operation_Failed);
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Successed("提交成功", model.Id, MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|