|
|
@ -9,6 +9,7 @@ using DS.WMS.Core.Fee.Interface;
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
using DS.WMS.Core.Flow.Dtos;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Entity;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
using DS.WMS.Core.Flow.Interface;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
@ -87,6 +88,18 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
return new DataResult<List<FeeRecord>>(ResultCode.Success) { Data = data };
|
|
|
|
return new DataResult<List<FeeRecord>>(ResultCode.Success) { Data = data };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// 检查业务是否已费用锁定
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="bid">业务ID</param>
|
|
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
|
|
bool IsFeeLocked(long bid)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
var entity = tenantDb.Queryable<SeaExport>().Where(x => x.Id == bid).Select(x => new { x.IsFeeLocking }).First();
|
|
|
|
|
|
|
|
return entity == null ? false : entity.IsFeeLocking.GetValueOrDefault();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// 提交
|
|
|
|
/// 提交
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
@ -96,6 +109,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
public DataResult InsertOrUpdate(long bid, IEnumerable<FeeRecord> items)
|
|
|
|
public DataResult InsertOrUpdate(long bid, IEnumerable<FeeRecord> items)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IsFeeLocked(bid))
|
|
|
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
tenantDb.Ado.BeginTran();
|
|
|
|
tenantDb.Ado.BeginTran();
|
|
|
@ -264,6 +281,10 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bid = tenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id)).Select(x => x.BusinessId).First();
|
|
|
|
|
|
|
|
if (IsFeeLocked(bid))
|
|
|
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
|
|
|
|
|
|
|
if (tenantDb.Queryable<FeeRecord>().Any(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering || x.FeeStatus != FeeStatus.AuditPassed)))
|
|
|
|
if (tenantDb.Queryable<FeeRecord>().Any(x => ids.Contains(x.Id) && (x.FeeStatus != FeeStatus.Entering || x.FeeStatus != FeeStatus.AuditPassed)))
|
|
|
|
return DataResult.Failed("只能删除状态为‘录入’或‘审核通过’的费用", MultiLanguageConst.FeeRecordDelete);
|
|
|
|
return DataResult.Failed("只能删除状态为‘录入’或‘审核通过’的费用", MultiLanguageConst.FeeRecordDelete);
|
|
|
|
|
|
|
|
|
|
|
@ -285,11 +306,15 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
Id = x.Id,
|
|
|
|
Id = x.Id,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeName = x.FeeName,
|
|
|
|
FeeStatus = x.FeeStatus,
|
|
|
|
FeeStatus = x.FeeStatus,
|
|
|
|
FlowId = x.FlowId
|
|
|
|
FlowId = x.FlowId,
|
|
|
|
|
|
|
|
BusinessId = x.BusinessId
|
|
|
|
}).ToList();
|
|
|
|
}).ToList();
|
|
|
|
if (fees.IsNullOrEmpty())
|
|
|
|
if (fees.IsNullOrEmpty())
|
|
|
|
return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
return DataResult.Failed($"未能获取费用信息,提交失败", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IsFeeLocked(fees[0].BusinessId))
|
|
|
|
|
|
|
|
return DataResult.Failed("当前业务已费用锁定,禁止修改", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
|
|
|
|
|
|
|
if (fees.Any(x => x.FlowId.HasValue))
|
|
|
|
if (fees.Any(x => x.FlowId.HasValue))
|
|
|
|
return DataResult.Failed($"当前费用包含正在审批中的费用,无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
return DataResult.Failed($"当前费用包含正在审批中的费用,无法提交", MultiLanguageConst.Operation_Failed);
|
|
|
|
|
|
|
|
|
|
|
@ -506,7 +531,7 @@ namespace DS.WMS.Core.Fee.Method
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="auditType">审批类型</param>
|
|
|
|
/// <param name="auditType">审批类型</param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public FlowTemplateTenant FindTemplate(string auditType)
|
|
|
|
FlowTemplateTenant FindTemplate(string auditType)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return db.Queryable<FlowTemplateTenant>().Where(x =>
|
|
|
|
return db.Queryable<FlowTemplateTenant>().Where(x =>
|
|
|
|
x.Status == StatusEnum.Enable &&
|
|
|
|
x.Status == StatusEnum.Enable &&
|
|
|
|