|
|
|
@ -254,16 +254,16 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
/// 根据模板ID创建
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bid">业务ID</param>
|
|
|
|
|
/// <param name="type">业务类型</param>
|
|
|
|
|
/// <param name="businessType">业务类型</param>
|
|
|
|
|
/// <param name="tidArray">模板ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult CreateByTemplate(long bid, BusinessType type, params long[] tidArray)
|
|
|
|
|
public DataResult CreateByTemplate(long bid, BusinessType businessType, params long[] tidArray)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
bool hasExists = tenantDb.Queryable<FeeRecord>().LeftJoin<FeeTemplateDetail>((x, y) =>
|
|
|
|
|
x.FeeId == y.FeeId && x.FeeType == y.FeeType).Any((x, y) =>
|
|
|
|
|
x.BusinessId == bid && tidArray.Contains(y.TemplateId) && !y.Deleted);
|
|
|
|
|
x.BusinessId == bid && x.BusinessType == businessType && tidArray.Contains(y.TemplateId) && !y.Deleted);
|
|
|
|
|
if (hasExists)
|
|
|
|
|
return DataResult.Failed("费用记录已存在", MultiLanguageConst.FeeRecordExist);
|
|
|
|
|
|
|
|
|
@ -306,23 +306,11 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
|
|
|
|
|
int result = tenantDb.Insertable(records).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
WriteBackStatus(tenantDb, bid, type);
|
|
|
|
|
WriteBackStatus(tenantDb, bid, businessType);
|
|
|
|
|
|
|
|
|
|
return result > 0 ? DataResult.Successed("保存成功", records, MultiLanguageConst.DataCreateSuccess) : DataResult.Successed("操作失败!", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 根据费用明细转换为模板明细
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idArray">费用明细ID</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult<List<FeeTemplateDetailRes>> ReadAsTemplate(params long[] idArray)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var list = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select<FeeTemplateDetailRes>().ToList();
|
|
|
|
|
return new DataResult<List<FeeTemplateDetailRes>>(ResultCode.Success) { Data = list };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 删除
|
|
|
|
|
/// </summary>
|
|
|
|
@ -355,7 +343,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
public DataResult SubmitForApproval(FeeAuditType auditType, params long[] idArray)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(x => new FeeRecord
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(
|
|
|
|
|
x => new FeeRecord
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
@ -511,9 +500,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DataResult SubmitForModification(IEnumerable<FeeModification> items)
|
|
|
|
|
{
|
|
|
|
|
var bizType = items.FirstOrDefault()?.BusinessType;
|
|
|
|
|
var idList = items.Select(x => x.FeeRecordId).Distinct().ToList();
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idList.Contains(x.Id)).Select(x => new FeeRecord
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idList.Contains(x.Id) && x.BusinessType == bizType).Select(x => new FeeRecord
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
@ -589,14 +579,19 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
BusinessFeeStatus businessFee = null;
|
|
|
|
|
if (auditType == FeeAuditType.Business)
|
|
|
|
|
{
|
|
|
|
|
businessFee = tenantDb.Queryable<BusinessFeeStatus>().Where(x => x.Id == callback.BusinessId).Select(
|
|
|
|
|
x => new BusinessFeeStatus { Id = x.Id, BusinessId = x.BusinessId, BillAuditStatus = x.BillAuditStatus }).First();
|
|
|
|
|
businessFee = tenantDb.Queryable<BusinessFeeStatus>().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType)
|
|
|
|
|
.Select(x => new BusinessFeeStatus
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
BusinessId = x.BusinessId,
|
|
|
|
|
BillAuditStatus = x.BillAuditStatus
|
|
|
|
|
}).First();
|
|
|
|
|
if (businessFee == null)
|
|
|
|
|
return DataResult.Failed("未能找到业务信息,更新状态失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fee = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == callback.BusinessId).Select(
|
|
|
|
|
fee = tenantDb.Queryable<FeeRecord>().Where(x => x.Id == callback.BusinessId && x.BusinessType == callback.BusinessType).Select(
|
|
|
|
|
x => new FeeRecord { Id = x.Id, FeeStatus = x.FeeStatus }).First();
|
|
|
|
|
if (fee == null)
|
|
|
|
|
return DataResult.Failed("未能找到费用记录,更新状态失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
@ -636,9 +631,6 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
//申请修改审核成功需要回填费用信息
|
|
|
|
|
if (callback.FlowStatus == FlowStatusEnum.Approve)
|
|
|
|
|
{
|
|
|
|
|
fee.FeeStatus = FeeStatus.AuditPassed;
|
|
|
|
|
fee.Reason = string.Empty;
|
|
|
|
|
|
|
|
|
|
var fm = tenantDb.Queryable<FeeModification>().Where(x => x.FeeRecordId == fee.Id).OrderByDescending(x => x.CreateTime).First();
|
|
|
|
|
if (fm == null)
|
|
|
|
|
return DataResult.Failed("未找到费用修改信息,更新失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
@ -648,6 +640,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
entity.Reason = callback.RejectReason;
|
|
|
|
|
fee = entity;
|
|
|
|
|
|
|
|
|
|
//全表更新
|
|
|
|
|
tenantDb.Updateable(fee).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
//逻辑删除暂存数据
|
|
|
|
|
fm.Deleted = true;
|
|
|
|
|
fm.DeleteTime = DateTime.Now;
|
|
|
|
|
fm.DeleteBy = long.Parse(user.UserId);
|
|
|
|
@ -660,8 +656,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
else if (callback.FlowStatus == FlowStatusEnum.Reject)
|
|
|
|
|
{
|
|
|
|
|
fee.FeeStatus = FeeStatus.RejectApplication;
|
|
|
|
|
|
|
|
|
|
tenantDb.Updateable(fee).UpdateColumns(x => new
|
|
|
|
|
{
|
|
|
|
|
x.Id,
|
|
|
|
@ -669,6 +665,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
x.Reason,
|
|
|
|
|
x.FlowId
|
|
|
|
|
}).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case FeeAuditType.ApplyDeletion:
|
|
|
|
|
if (callback.FlowStatus == FlowStatusEnum.Approve)
|
|
|
|
@ -752,7 +750,8 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
|
public DataResult Withdraw(params long[] idArray)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(x => new FeeRecord
|
|
|
|
|
var fees = tenantDb.Queryable<FeeRecord>().Where(x => idArray.Contains(x.Id)).Select(
|
|
|
|
|
x => new FeeRecord
|
|
|
|
|
{
|
|
|
|
|
Id = x.Id,
|
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
|