|
|
|
|
using AngleSharp.Dom;
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Data;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Check.Dtos;
|
|
|
|
|
using DS.WMS.Core.Check.Entity;
|
|
|
|
|
using DS.WMS.Core.Check.Interface;
|
|
|
|
|
using DS.WMS.Core.Check.View;
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
using DS.WMS.Core.Fee.Dtos;
|
|
|
|
|
using DS.WMS.Core.Fee.Entity;
|
|
|
|
|
using DS.WMS.Core.Info.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using DS.WMS.Core.Sys.Method;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Check.Method
|
|
|
|
|
{
|
|
|
|
|
public class CheckBillService : ICheckBillService
|
|
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
|
private readonly ISqlSugarClient db;
|
|
|
|
|
private readonly IUser user;
|
|
|
|
|
private readonly ISaasDbService saasService;
|
|
|
|
|
private readonly ICommonService commonService;
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="serviceProvider"></param>
|
|
|
|
|
public CheckBillService(IServiceProvider serviceProvider)
|
|
|
|
|
{
|
|
|
|
|
_serviceProvider = serviceProvider;
|
|
|
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
commonService = _serviceProvider.GetRequiredService<ICommonService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 业务明细查询列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<VW_CheckBill_Detail>> GetBusinessQueryList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<VW_CheckBill_Detail>()
|
|
|
|
|
.Where(whereList).ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 业务明细对应费用查询列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<CheckBillFeeRecordRes>> GetFeeRecordQueryList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<FeeRecord>()
|
|
|
|
|
.Where(whereList).Select<CheckBillFeeRecordRes>()
|
|
|
|
|
.ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 客户对账列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<CheckBillRes>> GetCheckBillList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<CheckBill>()
|
|
|
|
|
//.LeftJoin<VW_CheckBill_Bussiness>((a,b)=>a.Id == b.CheckId)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<CheckBillRes>()
|
|
|
|
|
.Mapper(it =>
|
|
|
|
|
{
|
|
|
|
|
var checkBillDetails = tenantDb.Queryable<VW_CheckBill_Bussiness>().Where(x => x.CheckId == it.Id).ToList();
|
|
|
|
|
it.RMBDR = checkBillDetails.Sum(x => x.RMBDR);
|
|
|
|
|
it.RMBCR = checkBillDetails.Sum(x => x.RMBCR);
|
|
|
|
|
it.USDDR = checkBillDetails.Sum(x => x.USDDR);
|
|
|
|
|
it.USDCR = checkBillDetails.Sum(x => x.USDCR);
|
|
|
|
|
it.BALRMBDR = checkBillDetails.Sum(x => x.BALRMBDR);
|
|
|
|
|
it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR);
|
|
|
|
|
it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR);
|
|
|
|
|
it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR);
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
.ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 详情
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<CheckBillInfoRes> GetCheckBillInfo(string id)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var data = tenantDb.Queryable<CheckBill>()
|
|
|
|
|
.Where(a => a.Id == long.Parse(id))
|
|
|
|
|
.Select<CheckBillInfoRes>()
|
|
|
|
|
.First();
|
|
|
|
|
return DataResult<CheckBillInfoRes>.Success(data, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 客户对账明细列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<VW_CheckBill_Bussiness>> GetCheckBillBusinessList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<VW_CheckBill_Bussiness>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 客户对账明细对应费用列表
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<VW_CheckBill_Fee_Records>> GetCheckBillFeeRecordsList(PageRequest request)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
|
|
|
|
|
var data = tenantDb.Queryable<VW_CheckBill_Fee_Records>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.ToQueryPage(request.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 编辑
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult EditCheckBill(CheckBillReq req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
if (req.Id == 0)
|
|
|
|
|
{
|
|
|
|
|
var data = req.Adapt<CheckBill>();
|
|
|
|
|
var sequence = commonService.GetSequenceNext<CheckBill>();
|
|
|
|
|
if (!sequence.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist);
|
|
|
|
|
}
|
|
|
|
|
data.BillNo = sequence.Data;
|
|
|
|
|
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
|
|
|
|
|
if (req.BusinessIds.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var businessList = new List<CheckBillBusiness>();
|
|
|
|
|
var feeList = new List<CheckBillFeeRecords>();
|
|
|
|
|
foreach (var item in req.BusinessIds)
|
|
|
|
|
{
|
|
|
|
|
businessList.Add(new CheckBillBusiness()
|
|
|
|
|
{
|
|
|
|
|
CheckId = entity.Id,
|
|
|
|
|
BusinessId = item
|
|
|
|
|
});
|
|
|
|
|
var feeRecords = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == item).ToList();
|
|
|
|
|
foreach (var record in feeRecords)
|
|
|
|
|
{
|
|
|
|
|
feeList.Add(new CheckBillFeeRecords()
|
|
|
|
|
{
|
|
|
|
|
CheckId = entity.Id,
|
|
|
|
|
BusinessId = item,
|
|
|
|
|
FeeRecordId = record.Id,
|
|
|
|
|
CheckBillAmount = record.Amount,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
tenantDb.Insertable(businessList).ExecuteCommand();
|
|
|
|
|
tenantDb.Insertable(feeList).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var info = tenantDb.Queryable<CheckBill>().Where(x => x.Id == req.Id).First();
|
|
|
|
|
if ((bool)info.IsLocking)
|
|
|
|
|
return DataResult.Failed("客户对账信息已锁定");
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
var businessList = new List<CheckBillBusiness>();
|
|
|
|
|
var feeList = new List<CheckBillFeeRecords>();
|
|
|
|
|
if (req.BusinessIds.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var businessIds = tenantDb.Queryable<CheckBillBusiness>().Where(x => x.CheckId == req.Id).Select(x => x.BusinessId).ToList();
|
|
|
|
|
var addBusinessIds = req.BusinessIds.AsQueryable().Except(businessIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addBusinessIds.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in addBusinessIds)
|
|
|
|
|
{
|
|
|
|
|
businessList.Add(new CheckBillBusiness()
|
|
|
|
|
{
|
|
|
|
|
CheckId = info.Id,
|
|
|
|
|
BusinessId = item
|
|
|
|
|
});
|
|
|
|
|
var feeRecords = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == item).ToList();
|
|
|
|
|
foreach (var record in feeRecords)
|
|
|
|
|
{
|
|
|
|
|
feeList.Add(new CheckBillFeeRecords()
|
|
|
|
|
{
|
|
|
|
|
CheckId = info.Id,
|
|
|
|
|
BusinessId = item,
|
|
|
|
|
FeeRecordId = record.Id,
|
|
|
|
|
CheckBillAmount = record.Amount,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tenantDb.Insertable(businessList).ExecuteCommand();
|
|
|
|
|
tenantDb.Insertable(feeList).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对账明细批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req">主表Id及明细业务Ids</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult BatchDelCheckBillDetail(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var checkId = long.Parse(req.Id);
|
|
|
|
|
if (req.Id.IsNull())
|
|
|
|
|
return DataResult.Failed("主表Id不能为空");
|
|
|
|
|
|
|
|
|
|
var info = tenantDb.Queryable<CheckBill>().First(x => x.Id == checkId);
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
return DataResult.Failed("客户对账信息不存在");
|
|
|
|
|
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("明细业务Ids不能为空");
|
|
|
|
|
|
|
|
|
|
if ((bool)info.IsLocking)
|
|
|
|
|
return DataResult.Failed("客户对账信息已锁定");
|
|
|
|
|
|
|
|
|
|
var businessList = tenantDb.Queryable<CheckBillBusiness>().Where(x => x.CheckId == checkId && req.Ids.Contains(x.BusinessId)).ToList();
|
|
|
|
|
|
|
|
|
|
if (businessList.Count > 0)
|
|
|
|
|
tenantDb.Deleteable(businessList).ExecuteCommand();
|
|
|
|
|
var feeList = tenantDb.Queryable<CheckBillFeeRecords>().Where(x => x.CheckId == checkId && req.Ids.Contains(x.BusinessId)).ToList();
|
|
|
|
|
|
|
|
|
|
if (feeList.Count > 0)
|
|
|
|
|
tenantDb.Deleteable(feeList).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对账明细费用批量删除
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req">主表Id及费用Ids</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult BatchDelCheckBillFeeRecords(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var checkId = long.Parse(req.Id);
|
|
|
|
|
if (req.Id.IsNull())
|
|
|
|
|
return DataResult.Failed("主表Id不能为空");
|
|
|
|
|
|
|
|
|
|
var info = tenantDb.Queryable<CheckBill>().First(x => x.Id == checkId);
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
return DataResult.Failed("客户对账信息不存在");
|
|
|
|
|
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("明细业务Ids不能为空");
|
|
|
|
|
|
|
|
|
|
if ((bool)info.IsLocking)
|
|
|
|
|
return DataResult.Failed("客户对账信息已锁定");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var feeList = tenantDb.Queryable<CheckBillFeeRecords>().Where(x => x.CheckId == checkId && req.Ids.Contains(x.FeeRecordId)).ToList();
|
|
|
|
|
|
|
|
|
|
if (feeList.Count > 0)
|
|
|
|
|
tenantDb.Deleteable(feeList).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对账明细添加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req">主表Id及明细业务Ids</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult AddCheckBillDetail(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var checkId = long.Parse(req.Id);
|
|
|
|
|
if (req.Id.IsNull())
|
|
|
|
|
return DataResult.Failed("主表Id不能为空");
|
|
|
|
|
|
|
|
|
|
var info = tenantDb.Queryable<CheckBill>().First(x => x.Id == checkId);
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
return DataResult.Failed("客户对账信息不存在");
|
|
|
|
|
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("明细业务Ids不能为空");
|
|
|
|
|
if ((bool)info.IsLocking)
|
|
|
|
|
return DataResult.Failed("客户对账信息已锁定");
|
|
|
|
|
|
|
|
|
|
var businessList = new List<CheckBillBusiness>();
|
|
|
|
|
var feeList = new List<CheckBillFeeRecords>();
|
|
|
|
|
var businessIds = tenantDb.Queryable<CheckBillBusiness>().Where(x => x.CheckId == checkId).Select(x => x.BusinessId).ToList();
|
|
|
|
|
var addBusinessIds = req.Ids.AsQueryable().Except(businessIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addBusinessIds.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in addBusinessIds)
|
|
|
|
|
{
|
|
|
|
|
businessList.Add(new CheckBillBusiness()
|
|
|
|
|
{
|
|
|
|
|
CheckId = info.Id,
|
|
|
|
|
BusinessId = item
|
|
|
|
|
});
|
|
|
|
|
var feeRecords = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == item).ToList();
|
|
|
|
|
foreach (var record in feeRecords)
|
|
|
|
|
{
|
|
|
|
|
feeList.Add(new CheckBillFeeRecords()
|
|
|
|
|
{
|
|
|
|
|
CheckId = info.Id,
|
|
|
|
|
BusinessId = item,
|
|
|
|
|
FeeRecordId = record.Id,
|
|
|
|
|
CheckBillAmount = record.Amount,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tenantDb.Insertable(businessList).ExecuteCommand();
|
|
|
|
|
tenantDb.Insertable(feeList).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
return DataResult.Successed("添加成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对账明细费用添加
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req">主表Id及明细业务费用Ids</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult AddCheckBillFeeRecords(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var checkId = long.Parse(req.Id);
|
|
|
|
|
if (req.Id.IsNull())
|
|
|
|
|
return DataResult.Failed("主表Id不能为空");
|
|
|
|
|
|
|
|
|
|
var info = tenantDb.Queryable<CheckBill>().First(x => x.Id == checkId);
|
|
|
|
|
if (info.IsNull())
|
|
|
|
|
return DataResult.Failed("客户对账信息不存在");
|
|
|
|
|
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("明细业务费用Ids不能为空");
|
|
|
|
|
if ((bool)info.IsLocking)
|
|
|
|
|
return DataResult.Failed("客户对账信息已锁定");
|
|
|
|
|
|
|
|
|
|
var feeList = new List<CheckBillFeeRecords>();
|
|
|
|
|
var feeIds = tenantDb.Queryable<CheckBillFeeRecords>().Where(x => x.CheckId == checkId ).Select(x => x.FeeRecordId).ToList();
|
|
|
|
|
var addFeeIds = req.Ids.AsQueryable().Except(feeIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (addFeeIds.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach (var item in addFeeIds)
|
|
|
|
|
{
|
|
|
|
|
var feeRecords = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == item).ToList();
|
|
|
|
|
foreach (var record in feeRecords)
|
|
|
|
|
{
|
|
|
|
|
feeList.Add(new CheckBillFeeRecords()
|
|
|
|
|
{
|
|
|
|
|
CheckId = info.Id,
|
|
|
|
|
BusinessId = record.BusinessId,
|
|
|
|
|
FeeRecordId = record.Id,
|
|
|
|
|
CheckBillAmount = record.Amount,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
tenantDb.Insertable(feeList).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
return DataResult.Successed("添加成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 锁定
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult CheckBillLocking(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
if (req.Ids.Length==0)
|
|
|
|
|
return DataResult.Failed("业务Ids不能为空");
|
|
|
|
|
|
|
|
|
|
if (tenantDb.Queryable<CheckBill>().Where(x=>x.IsLocking == true).Any())
|
|
|
|
|
return DataResult.Failed("存在已锁定的客户对账信息");
|
|
|
|
|
|
|
|
|
|
var list = tenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
|
|
tenantDb.Updateable(list).SetColumns(it=>it.IsLocking == true).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 解除锁定
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="req"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult CheckBillUnLocking(IdModel req)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
if (req.Ids.Length == 0)
|
|
|
|
|
return DataResult.Failed("业务Ids不能为空");
|
|
|
|
|
|
|
|
|
|
if (tenantDb.Queryable<CheckBill>().Where(x => x.IsLocking == false).Any())
|
|
|
|
|
return DataResult.Failed("存在已解除锁定的客户对账信息");
|
|
|
|
|
|
|
|
|
|
var list = tenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains(x.Id)).ToList();
|
|
|
|
|
|
|
|
|
|
tenantDb.Updateable(list).SetColumns(it => it.IsLocking == false).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|