本票审核逻辑修改

usertest
嵇文龙 6 months ago
parent d9db8f5e47
commit fd98622cc2

@ -104,7 +104,7 @@ namespace DS.WMS.Core.Fee.Dtos
[IgnoreDataMember]
public long? SourceId { get; set; }
public string Source { get; set; }
public string SourceName { get; set; }
/// <summary>
/// 来源明细
@ -112,7 +112,7 @@ namespace DS.WMS.Core.Fee.Dtos
[IgnoreDataMember]
public long? SourceDetailId { get; set; }
public string SourceDetail { get; set; }
public string DetailName { get; set; }
/// <summary>
/// 经营单位
@ -259,7 +259,7 @@ namespace DS.WMS.Core.Fee.Dtos
/// <summary>
/// 订舱公司
/// </summary>
public string BookingCompany { get; set; }
public string Forwarder { get; set; }
/// <summary>
/// 签单方式

@ -32,7 +32,7 @@ namespace DS.WMS.Core.Fee.Interface
/// <param name="yesOrNo">审批结果1=通过2=驳回</param>
/// <param name="remark">备注</param>
/// <returns></returns>
DataResult AuditBusiness(int yesOrNo, string remark);
DataResult Audit(int yesOrNo, string remark);
/// <summary>
/// 整单费用状态审核

@ -2,6 +2,7 @@
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Fee.Interface;
@ -26,6 +27,11 @@ namespace DS.WMS.Core.Fee.Method
/// </summary>
public static readonly FeeStatus[] AuditStatusArray = [FeeStatus.AuditSubmitted, FeeStatus.ApplyDeletion, FeeStatus.ApplyModification];
/// <summary>
/// 一键审核支持的类型
/// </summary>
public static readonly string[] AuditTypes = [FeeAuditType.ApplyAudit.ToString(), FeeAuditType.ApplyModification.ToString(), FeeAuditType.ApplyDeletion.ToString()];
/// <summary>
/// 工作流运行状态值
/// </summary>
@ -53,26 +59,25 @@ namespace DS.WMS.Core.Fee.Method
/// <returns></returns>
public DataResult<List<FeeAuditBusiness>> GetListByPage(PageRequest request)
{
var flowList = db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus && x.MakerList.Contains(user.UserId))
.Select(x => new { x.BusinessId, x.BusinessType }).ToList();
var flowList = db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus
&& SqlFunc.SplitIn(x.MakerList, user.UserId) && AuditTypes.Contains(x.AuditType))
.Select(x => new FlowInstance { BusinessId = x.BusinessId, BusinessType = x.BusinessType }).ToList();
//没有待审批的列表直接返回不再执行后续查询
if (flowList.Count == 0)
DataResult<List<FeeAuditBusiness>>.PageList(0, null, MultiLanguageConst.DataQuerySuccess);
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var queryList = GetDataQuery(tenantDb);
var bidList = flowList.Select(x => x.BusinessId);
queryList = queryList.Where(x => bidList.Contains(x.Id));
var queryList = CreateQuery(tenantDb, flowList);
//queryList = queryList.Where(x => SqlFunc.Subqueryable<FlowInstance>().Where(
// y => y.BusinessId == x.Id && y.BusinessType == x.BusinessType && SqlFunc.SplitIn(y.MakerList, user.UserId)).Any());
List<IConditionalModel> whereList = null;
if (!request.QueryCondition.IsNullOrEmpty())
whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
if (whereList != null)
{
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
queryList = queryList.Where(whereList);
}
var result = queryList.ToQueryPage(request.PageCondition);
if (result.Data.Count > 0)
{
//关联用户名称
@ -94,16 +99,20 @@ namespace DS.WMS.Core.Fee.Method
return result;
}
//获取各项业务数据的查询并集
internal static ISugarQueryable<FeeAuditBusiness> GetDataQuery(SqlSugarScopeProvider tenantDb)
//创建各项业务数据的查询并集
internal static ISugarQueryable<FeeAuditBusiness> CreateQuery(SqlSugarScopeProvider tenantDb, IEnumerable<FlowInstance> additions)
{
//海运出口
var query1 = tenantDb.Queryable<SeaExport, BusinessFeeStatus, FeeRecord>((s, b, f) => new JoinQueryInfos(
var ids1 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingExport).Select(x => x.BusinessId).ToArray();
var query1 = tenantDb.Queryable<SeaExport, BusinessFeeStatus, FeeRecord, CodeSource, CodeSourceDetail>((s, b, f, cs, csd) => new JoinQueryInfos(
JoinType.Left, s.Id == b.BusinessId && b.BusinessType == BusinessType.OceanShippingExport,
JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus)
JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && AuditStatusArray.Contains(f.FeeStatus),
JoinType.Left,s.SourceId == cs.Id,
JoinType.Left, s.SourceDetailId == csd.Id
))
.WhereIF(ids1 != null && ids1.Length > 0, (s, b, f) => ids1.Contains(f.Id))
.GroupBy(s => s.Id)
.Select((s, b, f) => new FeeAuditBusiness
.Select((s, b, f, cs, csd) => new FeeAuditBusiness
{
Id = s.Id,
AccountDate = SqlFunc.ToDate(s.AccountDate),
@ -113,8 +122,6 @@ namespace DS.WMS.Core.Fee.Method
BusinessStatus = s.BusinessStatusName,
BusinessDate = s.BusinessDate,//业务日期
BLType = s.BLType,
//BookingCompany = //订舱公司
//BusinessUnit = //经营单位
CargoId = s.CargoId,
Carrier = s.Carrier,
AgencyId = s.AgentId,
@ -133,6 +140,7 @@ namespace DS.WMS.Core.Fee.Method
DischargePort = s.DischargePort,
Doc = s.Doc,
ETD = s.ETD,
Forwarder = s.Forwarder,
GoodsName = s.GoodsName,
HBLNO = s.HBLNO,
InvoiceNo = s.InvoiceNo,
@ -150,17 +158,29 @@ namespace DS.WMS.Core.Fee.Method
ReceiptPlace = s.ReceiptPlace,
Remark = s.Remark,
SaleDeptId = s.SaleDeptId,
SaleId = s.SaleId,//揽货人
SaleName = s.Sale,
//SaleDeptName //所属部门
SaleId = s.SaleId,
SaleName = s.Sale,//揽货人
SourceId = s.SourceId,
SourceName = cs.SourceName,
SourceDetailId = s.SourceDetailId,
DetailName = csd.DetailName,
TradeTerm = s.TradeTerm,
TransitTerms = s.Service,//运输条款
Vessel = s.Vessel,//船名
Voyage = s.Voyno,//航次
Yard = s.Yard
//BusinessUnit = //经营单位
//ChangeOrder //更改单
//ChangeReason //更改单更改原因
//FreightRatio //运杂费比例
//查询:运输类型 (枚举值,暂未建立)
//查询:是否费用提交
//查询:利润减少
});
//海运进口
//var ids2 = additions?.Where(x => x.BusinessType == BusinessType.OceanShippingImport).Select(x => x.BusinessId).ToArray();
return tenantDb.UnionAll(new List<ISugarQueryable<FeeAuditBusiness>> { query1 });
}
@ -234,22 +254,16 @@ namespace DS.WMS.Core.Fee.Method
/// <param name="yesOrNo">审批结果1=通过2=驳回</param>
/// <param name="remark">备注</param>
/// <returns></returns>
public DataResult AuditBusiness(int yesOrNo, string remark)
public DataResult Audit(int yesOrNo, string remark)
{
var flowList = db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus && x.MakerList.Contains(user.UserId))
.Select(x => new { x.BusinessId, x.BusinessType }).ToList();
var recordIds = db.Queryable<FlowInstance>().Where(x => x.FlowStatus == RunningStatus &&
SqlFunc.SplitIn(x.MakerList, user.UserId) && AuditTypes.Contains(x.AuditType))
.Select(x => x.BusinessId).ToArray();
//没有待审批的列表直接返回不再执行后续查询
if (flowList.Count == 0)
if (recordIds.Length == 0)
return DataResult.Failed("当前暂无待审批的费用");
var request = new FeeBizAuditRequest
{
Items = flowList.Select(x => new BizAudit { Id = x.BusinessId, BusinessType = x.BusinessType }).ToList(),
Remark = remark,
Result = yesOrNo
};
return AuditBusiness(request);
return Audit(yesOrNo, remark, recordIds);
}
/// <summary>
@ -282,7 +296,8 @@ namespace DS.WMS.Core.Fee.Method
return DataResult.Failed("业务的审批状态不正确");
var fIdArr = bizList.Select(x => x.FlowId).ToArray();
var flows = db.Queryable<FlowInstance>().Where(x => fIdArr.Contains(x.Id)).ToList();
string auditType = FeeAuditType.Business.ToString();
var flows = db.Queryable<FlowInstance>().Where(x => fIdArr.Contains(x.Id) && x.AuditType == auditType).ToList();
if (flows.Count == 0)
return DataResult.Failed("未能获取审批工作流");

@ -60,7 +60,7 @@ namespace DS.WMS.FeeApi.Controllers
if (status != 1 && status != 2)
return DataResult.Failed("参数无效", MultiLanguageConst.IllegalRequest);
return _auditService.AuditBusiness(status, remark);
return _auditService.Audit(status, remark);
}
/// <summary>

@ -1020,3 +1020,38 @@
2024-06-04 17:02:33.6570 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-04 17:02:33.6570 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-04 17:02:33.6570 Info Configuration initialized.
2024-06-05 11:35:20.3506 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-05 11:35:20.3770 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-05 11:35:20.3770 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-05 11:35:20.3897 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-05 11:35:20.3897 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 11:35:20.3897 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 11:35:20.3897 Info Configuration initialized.
2024-06-05 11:45:01.6040 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-05 11:45:01.6245 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-05 11:45:01.6439 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-05 11:45:01.6608 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-05 11:45:01.6608 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 11:45:01.6748 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 11:45:01.6748 Info Configuration initialized.
2024-06-05 11:52:49.4697 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-05 11:52:49.5104 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-05 11:52:49.5169 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-05 11:52:49.5385 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-05 11:52:49.5652 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 11:52:49.5652 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 11:52:49.5975 Info Configuration initialized.
2024-06-05 11:54:40.1696 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-05 11:54:40.2250 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-05 11:54:40.2250 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-05 11:54:40.2625 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-05 11:54:40.2625 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 11:54:40.2625 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 11:54:40.2806 Info Configuration initialized.
2024-06-05 13:49:01.3062 Info Registered target NLog.Targets.FileTarget(Name=allfile)
2024-06-05 13:49:01.3282 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web)
2024-06-05 13:49:01.3282 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console)
2024-06-05 13:49:01.3461 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False
2024-06-05 13:49:01.3461 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config
2024-06-05 13:49:01.3530 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile
2024-06-05 13:49:01.3530 Info Configuration initialized.

Loading…
Cancel
Save