批量设置费用状态

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

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

@ -64,23 +64,19 @@ namespace DS.Module.SqlSugar
if (createByValue == null || Equals(createByValue, 0L))
{
if (!user.UserId.IsNullOrEmpty())
{
entityInfo.SetValue(user.UserId);
}
else
{
entityInfo.SetValue(1288018625843826688);
}
}
}
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);
}
else
{
entityInfo.SetValue("超级管理员");
}
}

@ -78,6 +78,14 @@ namespace DS.WMS.Core.Fee.Interface
/// <returns></returns>
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>

@ -776,6 +776,43 @@ namespace DS.WMS.Core.Fee.Method
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>

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

@ -960,38 +960,33 @@ namespace DS.WMS.Core.Fee.Method
if (!result.Succeeded)
return result;
FeeType feeType = default;
//变更状态为提交审核
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
entity.BillAuditStatus = BillAuditStatus.RecvSubmitted;
entity.ARFeeStatus = BillFeeStatus.AuditSubmitted;
feeType = FeeType.Receivable;
entity.APFeeStatus = BillFeeStatus.AuditSubmitted;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.ARFeeStatus
x.ARFeeStatus,
x.APFeeStatus
}).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)
{
entity.BillAuditStatus = BillAuditStatus.PaySubmitted;
entity.APFeeStatus = BillFeeStatus.AuditSubmitted;
feeType = FeeType.Payable;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.APFeeStatus
x.BillAuditStatus
}).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();
return DataResult.Success;
}
@ -1035,7 +1030,6 @@ namespace DS.WMS.Core.Fee.Method
}
else if (taskType == TaskBaseTypeEnum.BILL_PAY_AUDIT)
{
if (entity.BillAuditStatus != BillAuditStatus.PaySubmitted)
return DataResult.Failed(string.Format(
MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.BusinessStatusError)), entity.BillAuditStatus.GetDescription()));
}
@ -1068,35 +1062,15 @@ namespace DS.WMS.Core.Fee.Method
return result;
}
FeeType feeType = default;
//变更状态为待提交
if (taskType == TaskBaseTypeEnum.BILL_RECV_AUDIT)
{
entity.BillAuditStatus = BillAuditStatus.Pending;
entity.ARFeeStatus = BillFeeStatus.Entering;
feeType = FeeType.Receivable;
await TenantDb.Updateable(entity).UpdateColumns(x => new
{
x.BillAuditStatus,
x.ARFeeStatus
}).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();
await TenantDb.Ado.CommitTranAsync();

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

@ -1,5 +1,6 @@
using System.Net;
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Fee.Dtos;
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>

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

Loading…
Cancel
Save