|
|
@ -448,7 +448,64 @@ namespace DS.WMS.Core.Check.Method
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 对账列表批量删除
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="req">主表Ids</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
public async Task<DataResult> BatchDelCheckBill(IdModel req)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
|
|
|
return DataResult.Failed("业务Ids不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains(x.Id) && x.IsLocking == true).Any())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return DataResult.Failed("存在客户对账信息已锁定");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await tenantDb.Ado.BeginTranAsync();
|
|
|
|
|
|
|
|
foreach (var item in req.Ids)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var info = await tenantDb.Queryable<CheckBill>().FirstAsync(x => x.Id == item);
|
|
|
|
|
|
|
|
//if (info.IsNull())
|
|
|
|
|
|
|
|
// return DataResult.Failed("客户对账信息不存在");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var businessList = tenantDb.Queryable<CheckBillBusiness>().Where(x => x.CheckId == item).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (businessList.Count > 0)
|
|
|
|
|
|
|
|
tenantDb.Deleteable(businessList).ExecuteCommand();
|
|
|
|
|
|
|
|
var feeList = tenantDb.Queryable<CheckBillFeeRecords>().Where(x => x.CheckId == item).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (feeList.Count > 0)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
#region 更新费用记录对账标识
|
|
|
|
|
|
|
|
var feeIds = feeList.Select(x => x.FeeRecordId).Distinct().ToList();
|
|
|
|
|
|
|
|
var feeRecords = tenantDb.Queryable<FeeRecord>().Where(x => feeIds.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
foreach (var record in feeRecords)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//对账标识
|
|
|
|
|
|
|
|
record.IsDebit = false;
|
|
|
|
|
|
|
|
record.DebitNo = "";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//更新费用记录
|
|
|
|
|
|
|
|
tenantDb.Updateable(feeRecords).ExecuteCommand();
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
tenantDb.Deleteable(feeList).ExecuteCommand();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
await tenantDb.Ado.CommitTranAsync();
|
|
|
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (Exception)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await tenantDb.Ado.RollbackTranAsync();
|
|
|
|
|
|
|
|
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 对账明细添加
|
|
|
|
/// 对账明细添加
|
|
|
|