cjy 3 weeks ago
commit ecc9c7e512

@ -58,7 +58,7 @@
<PackageReference Include="Snowflake.Data" Version="2.2.0" />
<PackageReference Include="Spire.XLS" Version="14.9.1" />
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.167" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.170" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="6.8.1" />

@ -205,20 +205,20 @@ namespace DS.WMS.Core.Application.Method
//OrderAmount = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId).Sum(f => f.OrderAmount),
//InvoiceAmount = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId).Sum(f => f.InvoiceAmount),
//SettlementAmount = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId).Sum(f => f.SettlementAmount),
//未申请开票金额=金额-开票金额-申请开票金额+申请开票金额已开票
UnBilledRMB = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed
&& f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
&& f.Currency == FeeCurrency.RMB_CODE).Sum(f => f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount),
UnBilledUSD = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed
&& f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
&& f.Currency == FeeCurrency.USD_CODE).Sum(f => f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount),
UnBilledOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed
&& f.Currency != FeeCurrency.RMB_CODE && f.Currency != FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
&& f.Currency != FeeCurrency.RMB_CODE && f.Currency != FeeCurrency.USD_CODE).Sum(f => f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount),
//未结算金额=金额-结算金额-申请金额+申请金额已结算
UnSettlementPaid = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed && f.FeeType == FeeType.Payable)
.Select(f => SqlFunc.AggregateSum(f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount)),
.Sum(f => f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount),
UnSettlementCharged = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed && f.FeeType == FeeType.Receivable)
.Select(f => SqlFunc.AggregateSum(f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount)),
.Sum(f => f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount),
});
}

@ -206,23 +206,23 @@ namespace DS.WMS.Core.Application.Method
StlName = s.StlName, //结算方式
//--------统计项--------
UnpaidRMB = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Sum(f => f.Amount),
UnpaidUSD = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Sum(f => f.Amount),
UnpaidOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Payable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Sum(f => f.Amount),
UnreceivedRMB = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.RMB_CODE).Sum(f => f.Amount),
UnreceivedUSD = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.USD_CODE).Sum(f => f.Amount),
UnreceivedOther = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
f.FeeType == FeeType.Receivable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Sum(f => f.Amount),
UnpaidRMBInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Sum(f => f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount),
UnpaidUSDInv = SqlFunc.Subqueryable<FeeRecord>().Where(f => f.BusinessId == s.BusinessId && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount))
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Sum(f => f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)
});
}

@ -1129,7 +1129,7 @@ namespace DS.WMS.Core.Fee.Method
return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed));
}
//// <summary>
/// <summary>
/// 获取费用打印信息
/// </summary>
/// <param name="providerName">数据提供程序</param>

@ -94,112 +94,6 @@ namespace DS.WMS.Core.Fee.Method
return TenantDb.UnionAll(new List<ISugarQueryable<BusinessFeeDto>> { query1 });
}
/// <summary>
/// 更新费用及其业务的费用状态
/// </summary>
/// <param name="ids">费用记录ID</param>
/// <remarks>此方法内部将始终异步执行,请确保在调用前已提交数据库事务等必要的操作。</remarks>
protected internal void UpdateFeeStatus(IEnumerable<long> ids)
{
var task1 = Task.Factory.StartNew(UpdateFeeStatusCore, ids, CancellationToken.None);
task1.ContinueWith(t => UpdateBizStatusCore(t.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
}
private List<FeeRecord> UpdateFeeStatusCore(object? state)
{
if (state == null)
return [];
var ids = (IEnumerable<long>)state;
var fees = TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id))
.Select(x => new FeeRecord
{
Id = x.Id,
BusinessId = x.BusinessId,
BusinessType = x.BusinessType,
FeeStatus = x.FeeStatus,
Amount = x.Amount,
SettlementAmount = x.SettlementAmount,
OrderAmount = x.OrderAmount,
OrderSettlementAmount = x.OrderSettlementAmount
}).ToList();
if (fees.Count == 0)
return [];
List<FeeRecord> list = new(fees.Count);
foreach (var item in fees)
{
var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount;
if (restAmount == 0)
{
item.FeeStatus = FeeStatus.SettlementCompleted;
list.Add(item);
}
else if (restAmount != item.Amount)
{
item.FeeStatus = FeeStatus.PartialSettlement;
list.Add(item);
}
else if (item.SettlementAmount == 0)
{
item.FeeStatus = FeeStatus.AuditPassed;
list.Add(item);
}
}
TenantDb.Updateable(list).UpdateColumns(x => new { x.FeeStatus }).ExecuteCommand();
return list;
}
private void UpdateBizStatusCore(List<FeeRecord> list)
{
var bizIds = list.Select(x => x.BusinessId);
var types = list.Select(x => x.BusinessType).Distinct();
var fees2 = TenantDb.Queryable<FeeRecord>().Where(x => bizIds.Contains(x.BusinessId) && types.Contains(x.BusinessType))
.Select(x => new { x.BusinessId, x.BusinessType, x.FeeType, x.FeeStatus }).ToList();
if (fees2.Count == 0)
return;
var gpList = fees2.GroupBy(x => new { x.BusinessId, x.BusinessType });
foreach (var gp in gpList)
{
BusinessFeeStatus biz = new() { BusinessId = gp.Key.BusinessId, BusinessType = gp.Key.BusinessType };
var upt = TenantDb.Updateable(biz).WhereColumns(x => new { x.BusinessId, x.BusinessType });
//应收
var arList = gp.Where(x => x.FeeType == FeeType.Receivable).ToList();
if (arList.Count > 0)
{
if (arList.All(x => x.FeeStatus == FeeStatus.SettlementCompleted))
{
biz.ARFeeStatus = BillFeeStatus.SettlementCompleted;
upt = upt.UpdateColumns(x => x.ARFeeStatus);
}
else if (arList.Any(x => x.FeeStatus == FeeStatus.PartialSettlement))
{
biz.ARFeeStatus = BillFeeStatus.PartialSettlement;
upt = upt.UpdateColumns(x => x.ARFeeStatus);
}
}
//应付
var apList = gp.Where(x => x.FeeType == FeeType.Payable).ToList();
if (apList.Count > 0)
{
if (apList.All(x => x.FeeStatus == FeeStatus.SettlementCompleted))
{
biz.APFeeStatus = BillFeeStatus.SettlementCompleted;
upt = upt.UpdateColumns(x => x.APFeeStatus);
}
else if (apList.Any(x => x.FeeStatus == FeeStatus.PartialSettlement))
{
biz.APFeeStatus = BillFeeStatus.PartialSettlement;
upt = upt.UpdateColumns(x => x.APFeeStatus);
}
}
upt.ExecuteCommand();
}
}
/// <summary>
/// 获取汇率
/// </summary>

@ -0,0 +1,134 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Dtos
{
public class BookingSlotRollingDto
{
/// <summary>
/// 主键ID
/// </summary>
public long Id { get; set; }
/// <summary>
/// 舱位主键
/// </summary>
public long SlotId { get; set; }
/// <summary>
/// 延期原因类型Rolling-甩货Change-换舱)
/// </summary>
public string DelayReasonType { get; set; }
/// <summary>
/// 延期原因名称Rolling-甩货Change-换舱)
/// </summary>
public string DelayReasonTypeName { get; set; }
/// <summary>
/// 延期次数
/// </summary>
public int DelayNum { get; set; }
/// <summary>
/// 船名
/// </summary>
public string Vessel { get; set; }
/// <summary>
/// 航次号
/// </summary>
public string Voyno { get; set; }
/// <summary>
/// 船公司ID
/// </summary>
public Nullable<long> CarrierId { get; set; }
/// <summary>
/// 船公司代码
/// </summary>
public string CarrierCode { get; set; }
/// <summary>
/// 船公司
/// </summary>
public string Carrier { get; set; }
/// <summary>
/// 预计开船日期
/// </summary>
public Nullable<DateTime> ETD { get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
public Nullable<DateTime> ETA { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
public string PortLoadCode { get; set; }
/// <summary>
/// 装货港主键
/// </summary>
public Nullable<long> PortLoadId { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string PortLoad { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string PortDischargeCode { get; set; }
/// <summary>
/// 卸货港主键
/// </summary>
public Nullable<long> PortDischargeId { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string PortDischarge { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreateTime { get; set; }
/// <summary>
/// 创建人
/// </summary>
public long CreateBy { get; set; }
/// <summary>
/// 创建人名称
/// </summary>
public string CreateUserName { get; set; }
/// <summary>
/// 修改人
/// </summary>
public long UpdateBy { get; set; }
/// <summary>
/// 修改人名称
/// </summary>
public string UpdateUserName { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public DateTime UpdateTime { get; set; }
}
}

@ -0,0 +1,118 @@
using DS.Module.Core.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Op.Entity
{
/// <summary>
/// 舱位甩货或换舱信息
/// </summary>
[SqlSugar.SugarTable("op_sea_booking_slot_rolling", "舱位甩货或换舱信息")]
public class BookingSlotRolling : BaseModel<long>
{
/// <summary>
/// 舱位主键
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "舱位主键", IsNullable = false)]
public long SlotId { get; set; }
/// <summary>
/// 延期原因类型Rolling-甩货Change-换舱)
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "延期原因类型Rolling-甩货Change-换舱)", Length = 20, IsNullable = false)]
public string DelayReasonType { get; set; }
/// <summary>
/// 延期原因名称Rolling-甩货Change-换舱)
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "延期原因名称Rolling-甩货Change-换舱)", Length = 30, IsNullable = false)]
public string DelayReasonTypeName { get; set; }
/// <summary>
/// 延期次数
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "延期次数", IsNullable = false)]
public int DelayNum { get; set; }
/// <summary>
/// 船名
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船名", Length = 30, IsNullable = true)]
public string Vessel { get; set; }
/// <summary>
/// 航次号
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "航次号", Length = 20, IsNullable = true)]
public string Voyno { get; set; }
/// <summary>
/// 船公司ID
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船公司ID", IsNullable = true)]
public Nullable<long> CarrierId { get; set; }
/// <summary>
/// 船公司代码
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船公司代码", Length = 20, IsNullable = true)]
public string CarrierCode { get; set; }
/// <summary>
/// 船公司
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "船公司", Length = 20, IsNullable = true)]
public string Carrier { get; set; }
/// <summary>
/// 预计开船日期
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "预计开船日期", IsNullable = true)]
public Nullable<DateTime> ETD { get; set; }
/// <summary>
/// 预计到港日期
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "预计到港日期", IsNullable = true)]
public Nullable<DateTime> ETA { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "装货港代码", Length = 10, IsNullable = true)]
public string PortLoadCode { get; set; }
/// <summary>
/// 装货港主键
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "装货港主键", IsNullable = true)]
public Nullable<long> PortLoadId { get; set; }
/// <summary>
/// 装货港
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "装货港", Length = 120, IsNullable = true)]
public string PortLoad { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "卸货港代码", Length = 10, IsNullable = true)]
public string PortDischargeCode { get; set; }
/// <summary>
/// 卸货港主键
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "卸货港主键", IsNullable = true)]
public Nullable<long> PortDischargeId { get; set; }
/// <summary>
/// 卸货港
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "卸货港", Length = 120, IsNullable = true)]
public string PortDischarge { get; set; }
}
}

@ -277,5 +277,19 @@ namespace DS.WMS.Core.Op.Interface
/// <param name="req">同步订单更新舱位请求</param>
/// <returns>返回回执</returns>
Task<DataResult> SyncBookingOrderToSlot(BookingOrderToSlotDto req);
/// <summary>
/// 保存舱位预甩或换舱
/// </summary>
/// <param name="req">请求详情</param>
/// <returns>返回回执</returns>
Task<DataResult> SaveRolling(BookingSlotRollingDto req);
/// <summary>
/// 获取舱位预甩或换舱列表
/// </summary>
/// <param name="slotId">舱位ID</param>
/// <returns>返回列表</returns>
Task<DataResult<List<BookingSlotRollingDto>>> GetRollingList(long slotId);
}
}

@ -4943,6 +4943,61 @@ namespace DS.WMS.Core.Op.Method
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
#endregion
#region 保存舱位预甩或换舱
/// <summary>
/// 保存舱位预甩或换舱
/// </summary>
/// <param name="req">请求详情</param>
/// <returns>返回回执</returns>
public async Task<DataResult> SaveRolling(BookingSlotRollingDto req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
var model = req.Adapt<BookingSlotRollingDto>();
await tenantDb.Insertable<BookingSlotRollingDto>(model).ExecuteCommandAsync();
}
else
{
var model = req.Adapt<BookingSlotRollingDto>();
await tenantDb.Updateable<BookingSlotRollingDto>(model).ExecuteCommandAsync();
}
return DataResult.Successed("成功");
}
#endregion
#region 获取舱位预甩或换舱列表
/// <summary>
/// 获取舱位预甩或换舱列表
/// </summary>
/// <param name="slotId">舱位ID</param>
/// <returns>返回列表</returns>
public async Task<DataResult<List<BookingSlotRollingDto>>> GetRollingList(long slotId)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = tenantDb.Queryable<BookingSlotRolling>().Where(a => a.SlotId == slotId).ToList();
if (list.Count > 0)
{
var rltList = list.Select(b =>
{
var dto = b.Adapt<BookingSlotRollingDto>();
return dto;
}).OrderByDescending(a => a.CreateTime).ToList();
return DataResult<List<BookingSlotRollingDto>>.Success(rltList);
}
return DataResult<List<BookingSlotRollingDto>>.FailedData(null);
}
#endregion
}
public static class LetterIndexUtil

@ -254,7 +254,7 @@ namespace DS.WMS.Core.Settlement.Method
}
/// <summary>
/// 获取付费自由结算明细
/// 获取自由结算明细
/// </summary>
/// <param name="request"></param>
/// <returns></returns>

@ -585,6 +585,112 @@ namespace DS.WMS.Core.Settlement.Method
#endregion
/// <summary>
/// 更新费用及其业务的结算状态
/// </summary>
/// <param name="ids">费用记录ID</param>
/// <remarks>此方法内部将始终异步执行,请确保在调用前已提交数据库事务等必要的操作。</remarks>
protected internal void UpdateFeeStatus(IEnumerable<long> ids)
{
var task1 = Task.Factory.StartNew(UpdateFeeStatusCore, ids, CancellationToken.None);
task1.ContinueWith(t => UpdateBizStatusCore(t.Result), TaskContinuationOptions.OnlyOnRanToCompletion);
}
private List<FeeRecord> UpdateFeeStatusCore(object? state)
{
if (state == null)
return [];
var ids = (IEnumerable<long>)state;
var fees = TenantDb.Queryable<FeeRecord>().Where(x => ids.Contains(x.Id))
.Select(x => new FeeRecord
{
Id = x.Id,
BusinessId = x.BusinessId,
BusinessType = x.BusinessType,
FeeStatus = x.FeeStatus,
Amount = x.Amount,
SettlementAmount = x.SettlementAmount,
OrderAmount = x.OrderAmount,
OrderSettlementAmount = x.OrderSettlementAmount
}).ToList();
if (fees.Count == 0)
return [];
List<FeeRecord> list = new(fees.Count);
foreach (var item in fees)
{
var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount;
if (restAmount == 0)
{
item.FeeStatus = FeeStatus.SettlementCompleted;
list.Add(item);
}
else if (restAmount != item.Amount)
{
item.FeeStatus = FeeStatus.PartialSettlement;
list.Add(item);
}
else if (restAmount == item.Amount)
{
item.FeeStatus = FeeStatus.AuditPassed;
list.Add(item);
}
}
TenantDb.Updateable(list).UpdateColumns(x => new { x.FeeStatus }).ExecuteCommand();
return list;
}
private void UpdateBizStatusCore(List<FeeRecord> list)
{
var bizIds = list.Select(x => x.BusinessId);
var types = list.Select(x => x.BusinessType).Distinct();
var fees2 = TenantDb.Queryable<FeeRecord>().Where(x => bizIds.Contains(x.BusinessId) && types.Contains(x.BusinessType))
.Select(x => new { x.BusinessId, x.BusinessType, x.FeeType, x.FeeStatus }).ToList();
if (fees2.Count == 0)
return;
var gpList = fees2.GroupBy(x => new { x.BusinessId, x.BusinessType });
foreach (var gp in gpList)
{
BusinessFeeStatus biz = new() { BusinessId = gp.Key.BusinessId, BusinessType = gp.Key.BusinessType };
var upt = TenantDb.Updateable(biz).WhereColumns(x => new { x.BusinessId, x.BusinessType });
//应收
var arList = gp.Where(x => x.FeeType == FeeType.Receivable).ToList();
if (arList.Count > 0)
{
if (arList.All(x => x.FeeStatus == FeeStatus.SettlementCompleted))
{
biz.ARFeeStatus = BillFeeStatus.SettlementCompleted;
upt = upt.UpdateColumns(x => x.ARFeeStatus);
}
else if (arList.Any(x => x.FeeStatus == FeeStatus.PartialSettlement))
{
biz.ARFeeStatus = BillFeeStatus.PartialSettlement;
upt = upt.UpdateColumns(x => x.ARFeeStatus);
}
}
//应付
var apList = gp.Where(x => x.FeeType == FeeType.Payable).ToList();
if (apList.Count > 0)
{
if (apList.All(x => x.FeeStatus == FeeStatus.SettlementCompleted))
{
biz.APFeeStatus = BillFeeStatus.SettlementCompleted;
upt = upt.UpdateColumns(x => x.APFeeStatus);
}
else if (apList.Any(x => x.FeeStatus == FeeStatus.PartialSettlement))
{
biz.APFeeStatus = BillFeeStatus.PartialSettlement;
upt = upt.UpdateColumns(x => x.APFeeStatus);
}
}
upt.ExecuteCommand();
}
}
/// <summary>
/// 设置结算单的锁定状态
/// </summary>

@ -1,16 +1,15 @@
using System.Runtime.Serialization;
using DS.Module.Core;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.TaskInteraction.Entity;
using Masuit.Tools.Systems;
using SqlSugar;
namespace DS.WMS.Core.TaskInteraction.Dtos
{
/// <summary>
/// 提单确认信息
/// 任务组
/// </summary>
public class BLConfirmation
public class TaskGroup
{
/// <summary>
/// 主业务ID
@ -29,7 +28,7 @@ namespace DS.WMS.Core.TaskInteraction.Dtos
}
/// <summary>
/// 提单确认任务
/// 任务信息
/// </summary>
public class BLTask
{

@ -40,7 +40,7 @@ namespace DS.WMS.Core.TaskInteraction.Interface
/// <param name="bsId">业务ID</param>
/// <param name="bsType">业务类型</param>
/// <returns></returns>
Task<DataResult<BLConfirmation>> GetBLConfirmationAsync(long bsId, BusinessType bsType);
Task<DataResult<TaskGroup>> GetBLConfirmationAsync(long bsId, BusinessType bsType);
/// <summary>
/// 获取海运出口查询对象

@ -43,7 +43,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
request.Steps.Add(new TaskStepDto
{
Type = StepType.OPConfirm,
Name = StepType.OPConfirm.GetDescription()
Name = StepType.OPConfirm.ToString()
});
}
}
@ -213,9 +213,9 @@ namespace DS.WMS.Core.TaskInteraction.Method
/// <param name="bsId">业务ID</param>
/// <param name="bsType">业务类型</param>
/// <returns></returns>
public async Task<DataResult<BLConfirmation>> GetBLConfirmationAsync(long bsId, BusinessType bsType)
public async Task<DataResult<TaskGroup>> GetBLConfirmationAsync(long bsId, BusinessType bsType)
{
var confirmation = new BLConfirmation
var confirmation = new TaskGroup
{
BusinessId = bsId,
BusinessType = bsType,
@ -236,11 +236,14 @@ namespace DS.WMS.Core.TaskInteraction.Method
TaskType = t.TaskType,
TaskStatus = t.TaskStatus,
RecvUsers = t.RecvUsers,
IsMainBL = true
IsMainBL = true,
Steps = SqlFunc.Subqueryable<TaskStep>().Where(ts => ts.TaskId == t.Id).ToList(ts => new TaskStepDto
{
}, true)
}).FirstAsync();
if (mainTask == null)
return DataResult<BLConfirmation>.Success(confirmation);
return DataResult<TaskGroup>.Success(confirmation);
var list = await TenantDb.Queryable<BusinessTask>()
.LeftJoin<SeaExportBillManage>((t, b) => t.BusinessId == b.Id)
@ -278,7 +281,7 @@ namespace DS.WMS.Core.TaskInteraction.Method
}
}
return DataResult<BLConfirmation>.Success(confirmation);
return DataResult<TaskGroup>.Success(confirmation);
}
/// <summary>

@ -190,15 +190,15 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (!await HasAuthorizedAsync())
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ModuleUnauthorized));
////检查步骤类型是否重复
//if (request.Steps?.Count > 0)
//{
// if (request.Steps.Where(x => x.Type != StepType.NotSpecified).GroupBy(x => x.Type).Select(x => x.Key).Count() > 1)
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DuplicateStepType));
//检查步骤类型是否重复
if (request.Steps?.Count > 0)
{
if (request.Steps.Where(x => x.Type != StepType.NotSpecified).GroupBy(x => x.Type).Select(x => x.Key).Count() > 1)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DuplicateStepType));
// if (request.Steps.Any(x => x.Type == StepType.NotSpecified && string.IsNullOrEmpty(x.Name)))
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TypeOrName));
//}
if (request.Steps.Any(x => x.Type == StepType.NotSpecified && string.IsNullOrEmpty(x.Name)))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TypeOrName));
}
if (request.HasCabin.GetValueOrDefault() && request.BusinessType.HasValue)
{
@ -449,13 +449,13 @@ namespace DS.WMS.Core.TaskInteraction.Method
if (request.TaskStatus == TaskStatusEnum.Complete && await TenantDb.Queryable<BusinessTask>().AnyAsync(x => x.ParentId == task.Id && x.TaskStatus != request.TaskStatus))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.UnfinishedItems));
////检查是否有未完成的任务步骤
//var steps = await TenantDb.Queryable<TaskStep>().Where(x => x.TaskId == task.Id && !x.IsCompleted)
// .Select(x => new { x.Type, x.Name }).ToListAsync();
//if (steps.Count > 0)
// return DataResult.Failed(
// MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.UnfinishedItems)) + "" + string.Join("|", steps.Select(x => x.Type == StepType.NotSpecified ? x.Name : x.Type.GetDescription())),
// nameof(MultiLanguageConst.UnfinishedItems));
//检查是否有未完成的任务步骤
var steps = await TenantDb.Queryable<TaskStep>().Where(x => x.TaskId == task.Id && !x.IsCompleted)
.Select(x => new { x.Type, x.Name }).ToListAsync();
if (steps.Count > 0)
return DataResult.Failed(
MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.UnfinishedItems)) + "" + string.Join("|", steps.Select(x => x.Type == StepType.NotSpecified ? x.Name : x.Type.GetDescription())),
nameof(MultiLanguageConst.UnfinishedItems));
//触发任务状态变更通知
if (task.TaskStatus != request.TaskStatus)

@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<Project>
<PropertyGroup>
<_PublishTargetUrl>D:\Publish\DS8\FeeApi</_PublishTargetUrl>
<History>True|2024-11-02T12:54:29.9931812Z||;True|2024-11-02T20:39:20.4100370+08:00||;True|2024-11-02T18:33:41.0724285+08:00||;True|2024-11-02T18:21:55.8561639+08:00||;True|2024-11-02T17:36:24.3401782+08:00||;True|2024-11-02T16:38:03.0054105+08:00||;True|2024-11-02T16:26:26.1698304+08:00||;True|2024-11-02T16:15:20.2872358+08:00||;True|2024-11-02T15:19:14.9663838+08:00||;True|2024-11-02T14:39:47.8808708+08:00||;False|2024-11-02T14:22:04.2841792+08:00||;True|2024-11-02T11:50:48.2452805+08:00||;True|2024-10-29T18:52:12.7978878+08:00||;True|2024-10-29T10:27:49.1623527+08:00||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;True|2024-09-14T11:19:13.1037012+08:00||;</History>
<History>True|2024-11-02T13:17:44.8575190Z||;True|2024-11-02T20:54:29.9931812+08:00||;True|2024-11-02T20:39:20.4100370+08:00||;True|2024-11-02T18:33:41.0724285+08:00||;True|2024-11-02T18:21:55.8561639+08:00||;True|2024-11-02T17:36:24.3401782+08:00||;True|2024-11-02T16:38:03.0054105+08:00||;True|2024-11-02T16:26:26.1698304+08:00||;True|2024-11-02T16:15:20.2872358+08:00||;True|2024-11-02T15:19:14.9663838+08:00||;True|2024-11-02T14:39:47.8808708+08:00||;False|2024-11-02T14:22:04.2841792+08:00||;True|2024-11-02T11:50:48.2452805+08:00||;True|2024-10-29T18:52:12.7978878+08:00||;True|2024-10-29T10:27:49.1623527+08:00||;True|2024-10-25T15:09:27.7029075+08:00||;True|2024-10-25T10:29:26.9218878+08:00||;True|2024-10-22T17:58:39.9582805+08:00||;True|2024-10-21T17:57:21.7047579+08:00||;True|2024-10-21T14:30:54.4520206+08:00||;True|2024-10-21T10:19:05.7405749+08:00||;True|2024-10-18T16:11:05.4049685+08:00||;True|2024-10-18T14:59:49.1162741+08:00||;True|2024-10-16T16:29:15.3185348+08:00||;True|2024-10-16T14:12:58.1754214+08:00||;True|2024-10-16T14:08:06.5805581+08:00||;True|2024-10-16T11:55:29.8273176+08:00||;True|2024-10-15T17:39:40.4090324+08:00||;True|2024-10-15T17:06:43.0181578+08:00||;True|2024-10-15T15:07:38.9601925+08:00||;True|2024-10-12T13:33:32.4412583+08:00||;True|2024-10-11T17:00:54.0916209+08:00||;True|2024-10-11T10:54:50.3307087+08:00||;True|2024-10-11T10:45:07.8181500+08:00||;True|2024-10-11T10:40:44.2066046+08:00||;True|2024-10-11T10:21:25.7226983+08:00||;True|2024-10-11T10:09:05.5257478+08:00||;True|2024-10-10T14:58:29.1228618+08:00||;True|2024-10-10T14:05:59.4501659+08:00||;True|2024-10-10T11:08:58.9765455+08:00||;True|2024-10-08T17:59:07.5583287+08:00||;True|2024-09-27T19:01:59.6945760+08:00||;True|2024-09-27T18:45:48.2812860+08:00||;True|2024-09-27T18:10:25.5697467+08:00||;True|2024-09-27T17:39:06.3169139+08:00||;True|2024-09-27T17:30:14.1043193+08:00||;True|2024-09-27T16:02:09.0703159+08:00||;True|2024-09-27T15:53:05.1789245+08:00||;True|2024-09-27T15:32:52.1934490+08:00||;True|2024-09-27T13:51:24.9197626+08:00||;True|2024-09-27T13:48:17.2817346+08:00||;True|2024-09-27T11:51:46.8193040+08:00||;True|2024-09-27T10:58:33.1059648+08:00||;True|2024-09-27T10:37:35.0336563+08:00||;False|2024-09-27T10:31:52.6302264+08:00||;True|2024-09-26T19:50:15.5513195+08:00||;True|2024-09-26T19:47:14.0781788+08:00||;True|2024-09-26T19:01:26.5428388+08:00||;True|2024-09-26T18:35:28.7455319+08:00||;True|2024-09-26T18:24:30.8084807+08:00||;True|2024-09-26T18:20:47.3005460+08:00||;True|2024-09-26T18:04:39.8012913+08:00||;True|2024-09-26T17:48:13.8526872+08:00||;True|2024-09-26T16:08:20.1746970+08:00||;True|2024-09-26T16:01:01.1501975+08:00||;False|2024-09-26T16:00:34.1516745+08:00||;True|2024-09-26T14:33:03.4007570+08:00||;True|2024-09-25T19:14:27.8906774+08:00||;True|2024-09-25T18:57:40.1435131+08:00||;True|2024-09-25T17:38:44.0915841+08:00||;True|2024-09-25T15:33:58.4630618+08:00||;True|2024-09-25T15:10:31.3022063+08:00||;False|2024-09-25T14:14:40.9640545+08:00||;True|2024-09-25T10:09:32.2558600+08:00||;True|2024-09-25T09:59:17.1525160+08:00||;False|2024-09-25T09:57:58.7265103+08:00||;False|2024-09-25T09:53:36.7732713+08:00||;False|2024-09-24T18:40:10.0166224+08:00||;True|2024-09-24T08:59:56.1995425+08:00||;True|2024-09-23T18:07:54.7222163+08:00||;True|2024-09-23T17:23:57.7568406+08:00||;True|2024-09-23T16:28:49.3169826+08:00||;True|2024-09-23T15:57:31.8052490+08:00||;True|2024-09-23T11:47:21.1445419+08:00||;True|2024-09-23T09:24:36.0732229+08:00||;True|2024-09-21T11:59:19.0549926+08:00||;True|2024-09-21T11:24:32.4451752+08:00||;True|2024-09-21T10:39:11.5297411+08:00||;True|2024-09-20T18:24:31.7827684+08:00||;True|2024-09-19T17:55:53.1666689+08:00||;True|2024-09-19T17:42:47.9061485+08:00||;True|2024-09-19T16:08:21.7225571+08:00||;False|2024-09-19T14:15:42.9318446+08:00||;True|2024-09-19T11:20:03.5567568+08:00||;True|2024-09-18T11:35:18.1509724+08:00||;True|2024-09-18T09:08:59.1152574+08:00||;True|2024-09-14T15:48:22.9374486+08:00||;True|2024-09-14T15:42:19.0503983+08:00||;True|2024-09-14T11:51:53.3339222+08:00||;True|2024-09-14T11:41:38.3542237+08:00||;</History>
<LastFailureDetails />
</PropertyGroup>
</Project>

@ -53,7 +53,7 @@ namespace DS.WMS.OpApi.Controllers
/// <param name="businessType">业务类型(可选参数)</param>
/// <returns></returns>
[HttpGet, Route("GetBLConfirmation")]
public async Task<DataResult<BLConfirmation>> GetBLConfirmationAsync(long businessId, BusinessType businessType)
public async Task<DataResult<TaskGroup>> GetBLConfirmationAsync(long businessId, BusinessType businessType)
{
return await taskService.GetBLConfirmationAsync(businessId, businessType);
}

@ -220,7 +220,7 @@ public class SaasTest
//tenantDb.CodeFirst.InitTables(typeof(BookingSlotBase));
//tenantDb.CodeFirst.InitTables(typeof(BookingSlotCtn));
//tenantDb.CodeFirst.InitTables(typeof(BookingSlotStock));
tenantDb.CodeFirst.InitTables(typeof(BLIssueManageLog));
tenantDb.CodeFirst.InitTables(typeof(BookingSlotRolling));
//tenantDb.CodeFirst.InitTables(typeof(DraftCompareFeedBackRecord));
//tenantDb.CodeFirst.InitTables(typeof(BookingSlotAllocationCtn));
//tenantDb.CodeFirst.InitTables(typeof(BookingSlotDemand));

Loading…
Cancel
Save