|
|
|
@ -453,18 +453,28 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> DeleteAsync(params long[] ids)
|
|
|
|
|
{
|
|
|
|
|
var model = await TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).FirstAsync();
|
|
|
|
|
if (await IsFeeLockedAsync(model.BusinessId, model.BusinessType))
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
|
|
|
|
|
|
|
|
|
|
if (await TenantDb.Queryable<FeeRecord>().AnyAsync(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission)))
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordDelete));
|
|
|
|
|
await TenantDb.Ado.BeginTranAsync();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var model = await TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id)).Select(x => new { x.BusinessId, x.BusinessType }).FirstAsync();
|
|
|
|
|
if (await IsFeeLockedAsync(model.BusinessId, model.BusinessType))
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeLocked));
|
|
|
|
|
|
|
|
|
|
int result = await TenantDb.Deleteable<FeeRecord>(x => ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
if (await TenantDb.Queryable<FeeRecord>().AnyAsync(x => ids.Contains(x.Id) && x.FeeStatus != FeeStatus.Entering && x.FeeStatus != FeeStatus.RejectSubmission))
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.FeeRecordDelete));
|
|
|
|
|
|
|
|
|
|
await WriteBackStatusAsync(model.BusinessId, model.BusinessType);
|
|
|
|
|
await TenantDb.Deleteable<FeeRecord>(x => ids.Contains(x.Id)).ExecuteCommandAsync();
|
|
|
|
|
await WriteBackStatusAsync(model.BusinessId, model.BusinessType);
|
|
|
|
|
|
|
|
|
|
return result > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
await TenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
await ex.LogAsync(Db);
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 审核相关
|
|
|
|
@ -534,6 +544,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.SubmitBy,
|
|
|
|
|
x.SubmitDate
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
await WriteBackStatusAsync(bid, bType);
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
@ -869,6 +881,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
await TenantDb.Updateable(fees).UpdateColumns(x => new { x.FeeStatus, x.SubmitBy, x.SubmitDate }).ExecuteCommandAsync();
|
|
|
|
|
await WriteBackStatusAsync(fees[0].BusinessId, fees[0].BusinessType);
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Success;
|
|
|
|
|
}
|
|
|
|
@ -1002,6 +1015,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
(x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.Withdraw || x.FeeStatus == FeeStatus.RejectSubmission))
|
|
|
|
|
.SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await WriteBackStatusAsync(bid, type);
|
|
|
|
|
|
|
|
|
|
if (useTransaction)
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return DataResult.Success;
|
|
|
|
@ -1092,6 +1107,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == bid && x.BusinessType == type && x.FeeStatus == FeeStatus.AuditSubmitted)
|
|
|
|
|
.SetColumns(x => x.FeeStatus == FeeStatus.Entering).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await WriteBackStatusAsync(bid, type);
|
|
|
|
|
|
|
|
|
|
await TenantDb.Ado.CommitTranAsync();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|