批量设置费用状态

dev
嵇文龙 4 weeks ago
parent 8b56b07abf
commit 7bbc8297a3

@ -613,7 +613,7 @@ public static class MultiLanguageConst
public const string NoNeedWithdraw = "NoNeed_Withdraw"; public const string NoNeedWithdraw = "NoNeed_Withdraw";
[Description("未能获取业务信息")] [Description("未能获取业务信息")]
public const string BusinessNotFound = "Business_NotFound"; public const string BusinessNotFound = "Business_NotFound";
[Description("当前业务的费用状态为:{0},无法提交")] [Description("当前业务的费用状态为:{0},无法执行此操作")]
public const string BusinessStatusError = "Business_Status_Error"; public const string BusinessStatusError = "Business_Status_Error";
[Description("当前业务的审批状态不正确")] [Description("当前业务的审批状态不正确")]
public const string BusinessAuditStatusError = "Business_AuditStatus_Error"; public const string BusinessAuditStatusError = "Business_AuditStatus_Error";

@ -64,23 +64,19 @@ namespace DS.Module.SqlSugar
if (createByValue == null || Equals(createByValue, 0L)) if (createByValue == null || Equals(createByValue, 0L))
{ {
if (!user.UserId.IsNullOrEmpty()) if (!user.UserId.IsNullOrEmpty())
{
entityInfo.SetValue(user.UserId); entityInfo.SetValue(user.UserId);
}
else else
{
entityInfo.SetValue(1288018625843826688); entityInfo.SetValue(1288018625843826688);
} }
} }
}
if (entityInfo.PropertyName == "CreateUserName") if (entityInfo.PropertyName == "CreateUserName")
{ {
if (!user.UserId.IsNullOrEmpty()) var createUserName = PropertyExtensions.GetPropertyValue(entityInfo.EntityValue, entityInfo.PropertyName, Flags.InstancePublic) as string;
if (string.IsNullOrEmpty(createUserName))
{ {
if (!user.UserId.IsNullOrEmpty())
entityInfo.SetValue(user.UserName); entityInfo.SetValue(user.UserName);
}
else else
{
entityInfo.SetValue("超级管理员"); entityInfo.SetValue("超级管理员");
} }
} }

@ -78,6 +78,14 @@ namespace DS.WMS.Core.Fee.Interface
/// <returns></returns> /// <returns></returns>
Task<DataResult> SetFeeLockingAsync(IEnumerable<BusinessFeeStatus> items); Task<DataResult> SetFeeLockingAsync(IEnumerable<BusinessFeeStatus> items);
/// <summary>
/// 设置费用状态
/// </summary>
/// <param name="status">费用状态</param>
/// <param name="ids">费用ID</param>
/// <returns></returns>
Task<DataResult> SetFeeStatusAsync(FeeStatus status, params long[] ids);
/// <summary> /// <summary>
/// 根据审批结果更新审批状态 /// 根据审批结果更新审批状态
/// </summary> /// </summary>

@ -776,6 +776,43 @@ namespace DS.WMS.Core.Fee.Method
return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed); return rows > 0 ? DataResult.Success : DataResult.Failed(MultiLanguageConst.Operation_Failed);
} }
/// <summary>
/// 设置费用状态
/// </summary>
/// <param name="status">费用状态</param>
/// <param name="ids">费用ID</param>
/// <returns></returns>
public async Task<DataResult> SetFeeStatusAsync(FeeStatus status, params long[] ids)
{
long userId = long.Parse(User.UserId);
DateTime dtNow = DateTime.Now;
var fees = ids.Select(x => new FeeRecord
{
Id = x,
FeeStatus = status
}).ToList();
if (status == FeeStatus.AuditPassed || status == FeeStatus.RejectSubmission)
{
foreach (var item in fees)
{
item.AuditBy = userId;
item.AuditOperator = User.UserName;
item.AuditDate = dtNow;
}
}
int rows = await TenantDb.Updateable(fees).UpdateColumns(x => new
{
x.FeeStatus,
x.AuditBy,
x.AuditOperator,
x.AuditDate
}).ExecuteCommandAsync();
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
/// <summary> /// <summary>
/// 根据审批结果更新审批状态 /// 根据审批结果更新审批状态
/// </summary> /// </summary>

@ -139,7 +139,7 @@ namespace DS.WMS.Core.Fee.Method
TemplateId = template.Id TemplateId = template.Id
}; };
await TenantDb.Insertable(record).ExecuteCommandAsync(); await TenantDb.Insertable(record).ExecuteCommandAsync();
break; //break;
} }
} }
} }
@ -226,12 +226,12 @@ namespace DS.WMS.Core.Fee.Method
} }
else else
{ {
var ctn = order.CtnInfo?.Find(x => x.Ctn == g.Key.Unit); var ctnList = order.CtnInfo?.FindAll(x => x.Ctn == g.Key.Unit);
if (ctn == null) if (ctnList == null || ctnList.Count == 0)
continue; continue;
detail = g.FirstOrDefault(x => x.Unit == ctn.Ctn); detail = g.FirstOrDefault(x => x.Unit == g.Key.Unit);
qty = ctn.CtnNum; qty = ctnList.Sum(x => x.CtnNum);
} }
var fee = new FeeRecord var fee = new FeeRecord
@ -247,7 +247,6 @@ namespace DS.WMS.Core.Fee.Method
CustomerName = detail.CustomerName, CustomerName = detail.CustomerName,
CustomerType = detail.CustomerType, CustomerType = detail.CustomerType,
InputMethod = InputMethod.Automatic, InputMethod = InputMethod.Automatic,
Quantity = qty, Quantity = qty,
FeeCode = detail.FeeCode, FeeCode = detail.FeeCode,
FeeName = detail.FeeName, FeeName = detail.FeeName,
@ -259,7 +258,9 @@ namespace DS.WMS.Core.Fee.Method
Tax = detail.Tax.GetValueOrDefault(), Tax = detail.Tax.GetValueOrDefault(),
TaxUnitPrice = detail.TaxUnitPrice.GetValueOrDefault(), TaxUnitPrice = detail.TaxUnitPrice.GetValueOrDefault(),
IsInvoice = detail.IsInvoice, IsInvoice = detail.IsInvoice,
IsAdvancedPay = detail.IsAdvancedPay IsAdvancedPay = detail.IsAdvancedPay,
CreateBy = order.OperatorId,
CreateUserName = order.OperatorName
}; };
if (fee.ExchangeRate.GetValueOrDefault() == 0 && fee.Currency != localCurrecy) if (fee.ExchangeRate.GetValueOrDefault() == 0 && fee.Currency != localCurrecy)

@ -960,38 +960,33 @@ namespace DS.WMS.Core.Fee.Method
if (!result.Succeeded) if (!result.Succeeded)
return result; return result;
FeeType feeType = default;
//变更状态为提交审核 //变更状态为提交审核
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT) if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{ {
entity.BillAuditStatus = BillAuditStatus.RecvSubmitted; entity.BillAuditStatus = BillAuditStatus.RecvSubmitted;
entity.ARFeeStatus = BillFeeStatus.AuditSubmitted; entity.ARFeeStatus = BillFeeStatus.AuditSubmitted;
feeType = FeeType.Receivable; entity.APFeeStatus = BillFeeStatus.AuditSubmitted;
await TenantDb.Updateable(entity).UpdateColumns(x => new await TenantDb.Updateable(entity).UpdateColumns(x => new
{ {
x.BillAuditStatus, x.BillAuditStatus,
x.ARFeeStatus x.ARFeeStatus,
x.APFeeStatus
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
//修改关联费用状态为提交审核
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == bid && x.BusinessType == type &&
(x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.Withdraw || x.FeeStatus == FeeStatus.RejectSubmission))
.SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
} }
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT) else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{ {
entity.BillAuditStatus = BillAuditStatus.PaySubmitted; entity.BillAuditStatus = BillAuditStatus.PaySubmitted;
entity.APFeeStatus = BillFeeStatus.AuditSubmitted;
feeType = FeeType.Payable;
await TenantDb.Updateable(entity).UpdateColumns(x => new await TenantDb.Updateable(entity).UpdateColumns(x => new
{ {
x.BillAuditStatus, x.BillAuditStatus
x.APFeeStatus
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
} }
//修改关联费用状态为提交审核
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == bid && x.BusinessType == type && x.FeeType == feeType &&
(x.FeeStatus == FeeStatus.Entering || x.FeeStatus == FeeStatus.Withdraw || x.FeeStatus == FeeStatus.RejectSubmission))
.SetColumns(x => x.FeeStatus == FeeStatus.AuditSubmitted).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();
return DataResult.Success; return DataResult.Success;
} }
@ -1035,7 +1030,6 @@ namespace DS.WMS.Core.Fee.Method
} }
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT) else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{ {
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted)
return DataResult.Failed(string.Format( return DataResult.Failed(string.Format(
MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BusinessStatusError)), entity.BillAuditStatus.GetDescription())); MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BusinessStatusError)), entity.BillAuditStatus.GetDescription()));
} }
@ -1068,35 +1062,15 @@ namespace DS.WMS.Core.Fee.Method
return result; return result;
} }
FeeType feeType = default;
//变更状态为待提交
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
entity.BillAuditStatus = BillAuditStatus.Pending; entity.BillAuditStatus = BillAuditStatus.Pending;
entity.ARFeeStatus = BillFeeStatus.Entering; entity.ARFeeStatus = BillFeeStatus.Entering;
feeType = FeeType.Receivable;
await TenantDb.Updateable(entity).UpdateColumns(x => new await TenantDb.Updateable(entity).UpdateColumns(x => new
{ {
x.BillAuditStatus, x.BillAuditStatus,
x.ARFeeStatus x.ARFeeStatus
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
}
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
entity.BillAuditStatus = BillAuditStatus.RecvPassed;
entity.APFeeStatus = BillFeeStatus.Entering;
feeType = FeeType.Payable;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.APFeeStatus
}).ExecuteCommandAsync();
}
//修改关联费用状态为录入状态 //修改关联费用状态为录入状态
await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == bid && x.BusinessType == type && x.FeeType == feeType && x.FeeStatus == FeeStatus.AuditSubmitted) await TenantDb.Updateable<FeeRecord>().Where(x => x.BusinessId == bid && x.BusinessType == type && x.FeeStatus == FeeStatus.AuditSubmitted)
.SetColumns(x => x.FeeStatus == FeeStatus.Entering).ExecuteCommandAsync(); .SetColumns(x => x.FeeStatus == FeeStatus.Entering).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync(); await TenantDb.Ado.CommitTranAsync();

@ -49,9 +49,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
BusinessId = x.BusinessId, BusinessId = x.BusinessId,
BusinessType = x.BusinessType, BusinessType = x.BusinessType,
BillAuditStatus = x.BillAuditStatus, BillAuditStatus = x.BillAuditStatus,
BillFeeStatusTime = x.BillFeeStatusTime, BillFeeStatusTime = x.BillFeeStatusTime
ARFeeStatus = x.ARFeeStatus,
APFeeStatus = x.APFeeStatus
}).FirstAsync(); }).FirstAsync();
if (biz == null) if (biz == null)
return; return;
@ -63,34 +61,21 @@ namespace DS.WMS.Core.TaskInteraction.Method
{ {
if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT) if (auditType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{ {
FeeStatus status = FeeStatus.RejectSubmission;
if (callback.FlowStatus == FlowStatusEnum.Approve) if (callback.FlowStatus == FlowStatusEnum.Approve)
{ {
biz.BillAuditStatus = BillAuditStatus.RecvPassed; biz.BillAuditStatus = BillAuditStatus.RecvPassed;
biz.ARFeeStatus = BillFeeStatus.AuditPassed;
status = FeeStatus.AuditPassed;
} }
else if (callback.FlowStatus == FlowStatusEnum.Reject) else if (callback.FlowStatus == FlowStatusEnum.Reject)
{ {
biz.BillAuditStatus = BillAuditStatus.RecvRejected; biz.BillAuditStatus = BillAuditStatus.RecvRejected;
biz.ARFeeStatus = BillFeeStatus.RejectSubmission;
} }
biz.BillFeeStatusTime = dtNow; biz.BillFeeStatusTime = dtNow;
await TenantDb.Updateable(biz).UpdateColumns(x => new await TenantDb.Updateable(biz).UpdateColumns(x => new
{ {
x.BillAuditStatus, x.BillAuditStatus,
x.BillFeeStatusTime, x.BillFeeStatusTime
x.ARFeeStatus
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
await TenantDb.Updateable<FeeRecord>()
.SetColumns(x => x.FeeStatus == status)
.SetColumns(x => x.AuditBy == userId)
.SetColumns(x => x.AuditOperator == User.UserName)
.SetColumns(x => x.AuditDate == dtNow)
.Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeType == FeeType.Receivable && x.FeeStatus == FeeStatus.AuditSubmitted)
.ExecuteCommandAsync();
} }
else if (auditType == TaskBaseTypeEnum.BILL_PAY_AUDIT) else if (auditType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{ {
@ -98,13 +83,14 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (callback.FlowStatus == FlowStatusEnum.Approve) if (callback.FlowStatus == FlowStatusEnum.Approve)
{ {
biz.BillAuditStatus = BillAuditStatus.PayPassed; biz.BillAuditStatus = BillAuditStatus.PayPassed;
biz.APFeeStatus = BillFeeStatus.AuditPassed; biz.ARFeeStatus = biz.APFeeStatus = BillFeeStatus.AuditPassed;
status = FeeStatus.AuditPassed; status = FeeStatus.AuditPassed;
} }
else if (callback.FlowStatus == FlowStatusEnum.Reject) else if (callback.FlowStatus == FlowStatusEnum.Reject)
{ {
biz.BillAuditStatus = BillAuditStatus.PayRejected; biz.BillAuditStatus = BillAuditStatus.PayRejected;
biz.APFeeStatus = BillFeeStatus.RejectSubmission; biz.ARFeeStatus = biz.APFeeStatus = BillFeeStatus.RejectSubmission;
status = FeeStatus.RejectSubmission;
} }
biz.BillFeeStatusTime = dtNow; biz.BillFeeStatusTime = dtNow;
@ -112,6 +98,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
{ {
x.BillAuditStatus, x.BillAuditStatus,
x.BillFeeStatusTime, x.BillFeeStatusTime,
x.ARFeeStatus,
x.APFeeStatus x.APFeeStatus
}).ExecuteCommandAsync(); }).ExecuteCommandAsync();
@ -120,7 +107,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
.SetColumns(x => x.AuditBy == userId) .SetColumns(x => x.AuditBy == userId)
.SetColumns(x => x.AuditOperator == User.UserName) .SetColumns(x => x.AuditOperator == User.UserName)
.SetColumns(x => x.AuditDate == dtNow) .SetColumns(x => x.AuditDate == dtNow)
.Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeType == FeeType.Payable && x.FeeStatus == FeeStatus.AuditSubmitted) .Where(x => x.BusinessId == biz.BusinessId && x.BusinessType == biz.BusinessType && x.FeeStatus == FeeStatus.AuditSubmitted)
.ExecuteCommandAsync(); .ExecuteCommandAsync();
} }

@ -1,5 +1,6 @@
using System.Net; using System.Net;
using DS.Module.Core; using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Interface; using DS.WMS.Core.Fee.Interface;
@ -153,6 +154,17 @@ namespace DS.WMS.FeeApi.Controllers
})); }));
} }
/// <summary>
/// 设置费用状态
/// </summary>
/// <param name="idModel"></param>
/// <returns></returns>
[HttpPost, Route("SetFeeStatus")]
public async Task<DataResult> SetFeeStatusAsync(IdModel<FeeStatus> idModel)
{
return await _auditService.SetFeeStatusAsync(idModel.Value, idModel.Ids);
}
/// <summary> /// <summary>
/// 变更费用审核状态 /// 变更费用审核状态
/// </summary> /// </summary>

@ -75,6 +75,6 @@
"Queues": "fee" "Queues": "fee"
}, },
"JobConfig": { "JobConfig": {
"FeeCustTemplateJob": "1 59 23 * * ?" "FeeCustTemplateJob": "0 0 5 * * ?"
} }
} }

Loading…
Cancel
Save