jianghaiqing 4 months ago
commit 85c47d348f

@ -11,175 +11,229 @@ namespace DS.Module.Core
/// 重要提醒
/// </summary>
[Description("重要提醒")]
CAUTION_NOTICE,
CAUTION_NOTICE = 0,
/// <summary>
/// BC
/// </summary>
[Description("BC")]
BC,
BC = 1,
/// <summary>
/// DRAFT
/// </summary>
[Description("DRAFT")]
DRAFT,
DRAFT = 2,
/// <summary>
/// Cancellation 订舱取消
/// </summary>
[Description("Cancellation")]
CANCELLATION,
CANCELLATION = 3,
/// <summary>
/// SEAWAY BILL下载
/// </summary>
[Description("SEAWAY BILL")]
SEAWAYBILL_DOWN,
SEAWAYBILL_DOWN = 4,
/// <summary>
/// 提单正本下载
/// </summary>
[Description("提单正本下载")]
ORIGINAL_DOWN,
ORIGINAL_DOWN = 5,
/// <summary>
/// 未装载
/// </summary>
[Description("未装载")]
NOT_LOADED,
NOT_LOADED = 6,
/// <summary>
/// 未装船
/// </summary>
[Description("未装船")]
NOT_SHIPMENG,
NOT_SHIPMENG = 7,
/// <summary>
/// 航次账单邮件
/// </summary>
[Description("航次账单")]
INVOICE_BILL_MAIL,
INVOICE_BILL_MAIL = 8,
/// <summary>
/// VGM对比
/// </summary>
[Description("VGM对比")]
VGM_COMPARE,
VGM_COMPARE = 9,
/// <summary>
/// 电放通知
/// </summary>
[Description("电放通知")]
TELEX_NOTICE,
TELEX_NOTICE = 10,
/// <summary>
/// SI回执
/// </summary>
[Description("SI回执")]
SI_FEEDBACK,
SI_FEEDBACK = 11,
/// <summary>
/// 单票账单
/// </summary>
[Description("单票账单")]
PER_BILL,
PER_BILL = 12,
/// <summary>
/// 换船通知
/// </summary>
[Description("换船通知")]
CHANGE_SHIP,
CHANGE_SHIP = 13,
/// <summary>
/// 取消换船通知
/// </summary>
[Description("取消换船通知")]
ABORT_CHANGE_SHIP,
ABORT_CHANGE_SHIP = 14,
/// <summary>
/// 下货纸
/// </summary>
[Description("下货纸")]
SHIPPING_ORDER,
SHIPPING_ORDER = 15,
/// <summary>
/// 正本缺失
/// </summary>
[Description("正本缺失")]
ORIGINAL_LOST,
ORIGINAL_LOST = 16,
/// <summary>
/// VGM异常
/// </summary>
[Description("VGM异常")]
VGM_EXCEPT,
VGM_EXCEPT = 17,
/// <summary>
/// 比对下货纸
/// </summary>
[Description("比对下货纸")]
SHIPPING_ORDER_COMPARE,
SHIPPING_ORDER_COMPARE = 18,
/// <summary>
/// 派车
/// </summary>
[Description("派车")]
TRUCK_DISPATCH,
TRUCK_DISPATCH = 19,
/// <summary>
/// Booking Amendment
/// </summary>
[Description("Amendment")]
BC_MODIFY,
BC_MODIFY = 20,
/// <summary>
/// 截止时间变更通知
/// </summary>
[Description("截止时间变更")]
CUT_MODIFY,
CUT_MODIFY = 21,
/// <summary>
/// Rolling Nomination(预甩货通知)
/// </summary>
[Description("RollingNomination")]
ROLLING_NOMINATION,
ROLLING_NOMINATION = 22,
/// <summary>
/// Transfer Nomination(预甩货通知)
/// </summary>
[Description("TransferNomination")]
TRANSFER_NOMINATION,
TRANSFER_NOMINATION = 23,
/// <summary>
/// VGM回执
/// </summary>
[Description("VGM回执")]
VGM_FEEDBACK,
VGM_FEEDBACK = 24,
/// <summary>
/// VGM未提交
/// </summary>
[Description("VGM未提交")]
VGM_MISSING,
VGM_MISSING = 25,
/// <summary>
/// 目的港未提货
/// </summary>
[Description("目的港未提货")]
POD_DISCHARGE_FULL,
POD_DISCHARGE_FULL = 26,
/// <summary>
/// 目的港未返空箱
/// </summary>
[Description("目的港未返空箱")]
POD_GATEOUT_FULL,
POD_GATEOUT_FULL = 27,
/// <summary>
/// 航线截止时间调整
/// </summary>
[Description("航线截止时间调整")]
ROUTE_CUT_CHANGE,
ROUTE_CUT_CHANGE = 28,
/// <summary>
/// 装货港未提箱
/// </summary>
[Description("装货港未提箱")]
POL_CTN_NOT_PICKUP,
POL_CTN_NOT_PICKUP = 29,
/// <summary>
/// 运输计划已变更
/// </summary>
[Description("运输计划已变更")]
TRNAS_PLAN_HAS_CHANGE,
TRNAS_PLAN_HAS_CHANGE = 30,
/// <summary>
/// 待审单
/// </summary>
[Description("待审单")]
WAIT_ORDER_AUDIT = 31,
/// <summary>
/// 待收BC
/// </summary>
[Description("待收BC")]
WAIT_BC = 32,
/// <summary>
/// 待订舱
/// </summary>
[Description("待订舱")]
WAIT_BOOKING = 33,
/// <summary>
/// 待放舱
/// </summary>
[Description("待放舱")]
WAIT_SPACE_RELEASE = 34,
/// <summary>
/// 待提单确认
/// </summary>
[Description("待提单确认")]
WAIT_BILL_CONFIRM = 35,
/// <summary>
/// 待提交SI
/// </summary>
[Description("待提交SI")]
WAIT_SI = 36,
/// <summary>
/// 待处理Draft
/// </summary>
[Description("待处理Draft")]
WAIT_DRAFT = 37,
/// <summary>
/// 待签出提单
/// </summary>
[Description("待签出提单")]
WAIT_CHECKOUT_BILL = 38,
/// <summary>
/// 待派车
/// </summary>
[Description("待派车")]
WAIT_TRUCK_DISPATCH = 39,
/// <summary>
/// 待提交VGM
/// </summary>
[Description("待提交VGM")]
WAIT_VGM = 40
}
}

@ -59,6 +59,12 @@ namespace DS.Module.Core
/// 系统
/// </summary>
[Description("系统")]
SYSTEM
SYSTEM,
/// <summary>
/// 工作流
/// </summary>
[Description("系统")]
WORK_FLOW,
}
}

@ -1,3 +1,4 @@
using DS.Module.Core.Helpers;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
@ -16,7 +17,10 @@ public class CustomContractResolver : CamelCasePropertyNamesContractResolver
{
return new JsonConverterLong();
}
if (objectType == typeof(DateTime?) || objectType == typeof(DateTime))
{
return new DatetimeJsonConverter();
}
return base.ResolveContractConverter(objectType);
}
}

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
namespace DS.Module.Core.Helpers
{
/// <summary>
/// 时间转换
/// </summary>
public class DatetimeJsonConverter : JsonConverter
{
/// <summary>
/// 是否可以转换
/// </summary>
/// <param name="objectType"></param>
/// <returns></returns>
public override bool CanConvert(Type objectType)
{
return true;
}
/// <summary>
/// 读json
/// </summary>
/// <param name="reader"></param>
/// <param name="objectType"></param>
/// <param name="existingValue"></param>
/// <param name="serializer"></param>
/// <returns></returns>
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if ((reader.ValueType == null || reader.ValueType == typeof(DateTime?)) && reader.Value == null)
{
return null;
}
else
{
DateTime.TryParse(reader.Value != null ? reader.Value.ToString() : "", out DateTime value);
return value;
}
}
/// <summary>
/// 写json
/// </summary>
/// <param name="writer"></param>
/// <param name="value"></param>
/// <param name="serializer"></param>
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
if (value == null)
writer.WriteValue(value);
else if (value != null)
{
var years = DateTime.Parse(value.ToString()).Year;
if (years == 1900|| years == 2000 || years == 1901 || years == 1970)
{
writer.WriteValue("");
}
else
writer.WriteValue(value);
}
}
}
}

@ -1,6 +0,0 @@
namespace DS.Module.Core.Helpers
{
public static class StringLongHelper
{
}
}

@ -1,10 +1,12 @@
using DS.Module.Core;
using DS.Module.Core.Filters;
using DS.Module.Core.Helpers;
using FluentValidation.AspNetCore;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
namespace DS.Module.Core.ServiceExtensions;

@ -57,9 +57,9 @@ public class CheckBillController : ApiController
/// <returns></returns>
[HttpPost]
[Route("GetCheckBillList")]
public DataResult<List<CheckBillSumRes>> GetCheckBillList([FromBody] PageRequest request)
public async Task<DataResult<CheckBillListRes>> GetCheckBillList([FromBody] PageRequest request)
{
var res = _invokeService.GetCheckBillList(request);
var res = await _invokeService.GetCheckBillList(request);
return res;
}
/// <summary>
@ -93,9 +93,9 @@ public class CheckBillController : ApiController
/// <returns></returns>
[HttpPost]
[Route("GetCheckBillBusinessList")]
public DataResult<List<VW_CheckBill_Business>> GetCheckBillBusinessList([FromBody] PageRequest request)
public async Task<DataResult<CheckBillBusinessRes>> GetCheckBillBusinessList([FromBody] PageRequest request)
{
var res = _invokeService.GetCheckBillBusinessList(request);
var res = await _invokeService.GetCheckBillBusinessList(request);
return res;
}

@ -0,0 +1,30 @@
using DS.WMS.Core.Check.View;
using DS.WMS.Core.Op.Dtos;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Check.Dtos
{
/// <summary>
/// 客户对账业务明细
/// </summary>
public class CheckBillBusinessRes
{
/// <summary>
/// 列表数据
/// </summary>
public List<VW_CheckBill_Business> List { get; set; }
/// <summary>
/// 合计数
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// 合计信息
/// </summary>
public CheckBillTotalRes DataTotal { get; set; }
}
}

@ -1,4 +1,5 @@
using SqlSugar;
using DS.WMS.Core.Op.Dtos;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@ -50,37 +51,88 @@ namespace DS.WMS.Core.Check.Dtos
/// <summary>
/// RMB应收
/// </summary>
public decimal? RMBDR { get; set; } = 0;
public decimal RMBDR { get; set; } = 0;
/// <summary>
/// RMB应付
/// </summary>
public decimal? RMBCR { get; set; } = 0;
public decimal RMBCR { get; set; } = 0;
/// <summary>
/// USD应收
/// </summary>
public decimal? USDDR { get; set; } = 0;
public decimal USDDR { get; set; } = 0;
/// <summary>
/// USD应付
/// </summary>
public decimal? USDCR { get; set; } = 0;
public decimal USDCR { get; set; } = 0;
/// <summary>
/// RMB未收
/// </summary>
public decimal? BALRMBDR { get; set; } = 0;
public decimal BALRMBDR { get; set; } = 0;
/// <summary>
/// RMB未付
/// </summary>
public decimal? BALRMBCR { get; set; } = 0;
public decimal BALRMBCR { get; set; } = 0;
/// <summary>
/// USD未收
/// </summary>
public decimal? BALUSDDR { get; set; } = 0;
public decimal BALUSDDR { get; set; } = 0;
/// <summary>
/// USD未付
/// </summary>
public decimal? BALUSDCR { get; set; } = 0;
public decimal BALUSDCR { get; set; } = 0;
/// <summary>
/// 其他应收
/// </summary>
public decimal OtherDR { get; set; }
/// <summary>
/// 其他应付
/// </summary>
public decimal OtherCR { get; set; }
/// <summary>
/// 其他未收
/// </summary>
public decimal BALOtherDR { get; set; }
/// <summary>
/// 其他未付
/// </summary>
public decimal BALOtherCR { get; set; }
/// <summary>
/// TTL应收
/// </summary>
public decimal TTLDR { get; set; }
/// <summary>
/// TTL应付
/// </summary>
public decimal TTLCR { get; set; }
/// <summary>
/// TTL未收
/// </summary>
public decimal BALTTLDR { get; set; }
/// <summary>
/// TTL未付
/// </summary>
public decimal BALTTLCR { get; set; }
/// <summary>
/// 开票RMB应收
/// </summary>
public decimal OrderInvoiceRMBDR { get; set; }
/// <summary>
/// 开票USD应收
/// </summary>
public decimal OrderInvoiceUSDDR { get; set; }
/// <summary>
/// 订单金额RMB应付
/// </summary>
public decimal OrderAmountRMBCR { get; set; }
/// <summary>
/// 订单金额USD应付
/// </summary>
public decimal OrderAmountUSDCR { get; set; }
/// <summary>
/// 对账时间
/// </summary>
@ -96,10 +148,31 @@ namespace DS.WMS.Core.Check.Dtos
/// 对账人
/// </summary>
public string CreateByName { get; set; }
public string CreateUserName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Note { get; set; } = "";
}
/// <summary>
/// 客户对账列表返回
/// </summary>
public class CheckBillListRes
{
/// <summary>
/// 列表数据
/// </summary>
public List<CheckBillSumRes> List { get; set; }
/// <summary>
/// 合计数
/// </summary>
public int TotalCount { get; set; }
/// <summary>
/// 合计信息
/// </summary>
public CheckBillTotalRes DataTotal { get; set; }
}
}

@ -0,0 +1,101 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Check.Dtos
{
/// <summary>
/// 客户对账列表合计
/// </summary>
public class CheckBillTotalRes
{
/// <summary>
/// RMB应收
/// </summary>
public decimal RMBDR { get; set; }
/// <summary>
/// RMB应付
/// </summary>
public decimal RMBCR { get; set; }
/// <summary>
/// USD应收
/// </summary>
public decimal USDDR { get; set; }
/// <summary>
/// USD应付
/// </summary>
public decimal USDCR { get; set; }
/// <summary>
/// RMB未收
/// </summary>
public decimal BALRMBDR { get; set; }
/// <summary>
/// RMB未付
/// </summary>
public decimal BALRMBCR { get; set; }
/// <summary>
/// USD未收
/// </summary>
public decimal BALUSDDR { get; set; }
/// <summary>
/// USD未付
/// </summary>
public decimal BALUSDCR { get; set; }
/// <summary>
/// 其他应收
/// </summary>
public decimal OtherDR { get; set; }
/// <summary>
/// 其他应付
/// </summary>
public decimal OtherCR { get; set; }
/// <summary>
/// 其他未收
/// </summary>
public decimal BALOtherDR { get; set; }
/// <summary>
/// 其他未付
/// </summary>
public decimal BALOtherCR { get; set; }
/// <summary>
/// TTL应收
/// </summary>
public decimal TTLDR { get; set; }
/// <summary>
/// TTL应付
/// </summary>
public decimal TTLCR { get; set; }
/// <summary>
/// TTL未收
/// </summary>
public decimal BALTTLDR { get; set; }
/// <summary>
/// TTL未付
/// </summary>
public decimal BALTTLCR { get; set; }
/// <summary>
/// 开票RMB应收
/// </summary>
public decimal OrderInvoiceRMBDR { get; set; }
/// <summary>
/// 开票USD应收
/// </summary>
public decimal OrderInvoiceUSDDR { get; set; }
/// <summary>
/// 订单金额RMB应付
/// </summary>
public decimal OrderAmountRMBCR { get; set; }
/// <summary>
/// 订单金额USD应付
/// </summary>
public decimal OrderAmountUSDCR { get; set; }
}
}

@ -17,7 +17,7 @@ namespace DS.WMS.Core.Check.Interface
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<CheckBillSumRes>> GetCheckBillList(PageRequest request);
public Task<DataResult<CheckBillListRes>> GetCheckBillList(PageRequest request);
/// <summary>
@ -31,7 +31,7 @@ namespace DS.WMS.Core.Check.Interface
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<VW_CheckBill_Business>> GetCheckBillBusinessList(PageRequest request);
public Task<DataResult<CheckBillBusinessRes>> GetCheckBillBusinessList(PageRequest request);
/// <summary>
/// 客户对账明细对应费用列表
/// </summary>

@ -18,6 +18,7 @@ using DS.WMS.Core.Op.View;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using DS.WMS.Core.Sys.Method;
using LanguageExt.Common;
using Mapster;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -87,15 +88,12 @@ namespace DS.WMS.Core.Check.Method
.ToQueryPage(request.PageCondition);
return data;
}
/// <summary>
/// 客户对账列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<CheckBillSumRes>> GetCheckBillList(PageRequest request)
public async Task<DataResult<CheckBillListRes>> GetCheckBillList(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var users = db.Queryable<SysUser>().Select(x => new { x.Id, x.UserName }).ToList();
@ -116,10 +114,10 @@ namespace DS.WMS.Core.Check.Method
queryData = queryData.Where(x => checkIds.Contains(x.Id));
}
var data = queryData.Mapper(it =>
var result = queryData.Mapper(it =>
{
var checkBillDetails = tenantDb.Queryable<VW_CheckBill_Business>().Where(x => x.CheckId == it.Id).ToList();
it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName;
//it.CreateByName = users.Find(x => x.Id == it.CreateBy).UserName;
it.RMBDR = checkBillDetails.Sum(x => x.RMBDR);
it.RMBCR = checkBillDetails.Sum(x => x.RMBCR);
it.USDDR = checkBillDetails.Sum(x => x.USDDR);
@ -128,10 +126,52 @@ namespace DS.WMS.Core.Check.Method
it.BALRMBCR = checkBillDetails.Sum(x => x.BALRMBCR);
it.BALUSDDR = checkBillDetails.Sum(x => x.BALUSDDR);
it.BALUSDCR = checkBillDetails.Sum(x => x.BALUSDCR);
it.OtherDR = checkBillDetails.Sum(x => x.OtherDR);
it.OtherCR = checkBillDetails.Sum(x => x.OtherCR);
it.BALOtherDR = checkBillDetails.Sum(x => x.BALOtherDR);
it.TTLDR = checkBillDetails.Sum(x => x.TTLDR);
it.TTLCR = checkBillDetails.Sum(x => x.TTLCR);
it.BALTTLDR = checkBillDetails.Sum(x => x.BALTTLDR);
it.BALTTLCR = checkBillDetails.Sum(x => x.BALTTLCR);
it.OrderInvoiceRMBDR = checkBillDetails.Sum(x => x.OrderInvoiceRMBDR);
it.OrderInvoiceUSDDR = checkBillDetails.Sum(x => x.OrderInvoiceUSDDR);
it.OrderAmountRMBCR = checkBillDetails.Sum(x => x.OrderAmountRMBCR);
it.OrderAmountUSDCR = checkBillDetails.Sum(x => x.OrderAmountUSDCR);
}
)
.ToQueryPage(request.PageCondition);
return data;
);
var list = result.ToList();
var data = await result.ToQueryPageAsync(request.PageCondition);
var totalData = new CheckBillTotalRes()
{
RMBDR = list.Sum(x => x.RMBDR),
RMBCR = list.Sum(x => x.RMBCR),
USDDR = list.Sum(x => x.USDDR),
USDCR = list.Sum(x => x.USDCR),
BALRMBDR = list.Sum(x => x.BALRMBDR),
BALRMBCR = list.Sum(x => x.BALRMBCR),
BALUSDDR = list.Sum(x => x.BALUSDDR),
BALUSDCR = list.Sum(x => x.BALUSDCR),
OtherDR = list.Sum(x => x.OtherDR),
OtherCR = list.Sum(x => x.OtherCR),
BALOtherDR = list.Sum(x => x.BALOtherDR),
TTLDR = list.Sum(x => x.TTLDR),
TTLCR = list.Sum(x => x.TTLCR),
BALTTLDR = list.Sum(x => x.BALTTLDR),
BALTTLCR = list.Sum(x => x.BALTTLCR),
OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR),
OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR),
OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR),
OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR),
};
var res = new CheckBillListRes()
{
List = data.Data,
TotalCount = list.Count(),
DataTotal = totalData
};
return await Task.FromResult(DataResult<CheckBillListRes>.Success(res, MultiLanguageConst.DataQuerySuccess));
//.ToQueryPage(request.PageCondition);
//return data;
}
/// <summary>
/// 详情
@ -153,16 +193,45 @@ namespace DS.WMS.Core.Check.Method
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult<List<VW_CheckBill_Business>> GetCheckBillBusinessList(PageRequest request)
public async Task<DataResult<CheckBillBusinessRes>> GetCheckBillBusinessList(PageRequest request)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
var data = tenantDb.Queryable<VW_CheckBill_Business>()
.Where(whereList)
.ToQueryPage(request.PageCondition);
return data;
var result = tenantDb.Queryable<VW_CheckBill_Business>()
.Where(whereList);
var list = result.ToList();
var data = await result.ToQueryPageAsync(request.PageCondition);
var totalData = new CheckBillTotalRes()
{
RMBDR = list.Sum(x => x.RMBDR),
RMBCR = list.Sum(x => x.RMBCR),
USDDR = list.Sum(x => x.USDDR),
USDCR = list.Sum(x => x.USDCR),
BALRMBDR = list.Sum(x => x.BALRMBDR),
BALRMBCR = list.Sum(x => x.BALRMBCR),
BALUSDDR = list.Sum(x => x.BALUSDDR),
BALUSDCR = list.Sum(x => x.BALUSDCR),
OtherDR = list.Sum(x => x.OtherDR),
OtherCR = list.Sum(x => x.OtherCR),
BALOtherDR = list.Sum(x => x.BALOtherDR),
TTLDR = list.Sum(x => x.TTLDR),
TTLCR = list.Sum(x => x.TTLCR),
BALTTLDR = list.Sum(x => x.BALTTLDR),
BALTTLCR = list.Sum(x => x.BALTTLCR),
OrderInvoiceRMBDR = list.Sum(x => x.OrderInvoiceRMBDR),
OrderInvoiceUSDDR = list.Sum(x => x.OrderInvoiceUSDDR),
OrderAmountRMBCR = list.Sum(x => x.OrderAmountRMBCR),
OrderAmountUSDCR = list.Sum(x => x.OrderAmountUSDCR),
};
var res = new CheckBillBusinessRes()
{
List = data.Data,
TotalCount = list.Count(),
DataTotal = totalData
};
return await Task.FromResult(DataResult<CheckBillBusinessRes>.Success(res, MultiLanguageConst.DataQuerySuccess));
}
/// <summary>

@ -46,6 +46,10 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 联系人ID
/// </summary>
public long CustomerContactId { get; set; }
/// <summary>
/// 联系人
/// </summary>
public string Name { get; set; }

@ -44,6 +44,10 @@ namespace DS.WMS.Core.Op.Dtos
/// </summary>
public string CustomerName { get; set; }
/// <summary>
/// 联系人ID
/// </summary>
public long CustomerContactId { get; set; }
/// <summary>
/// 联系人
/// </summary>
public string Name { get; set; }

@ -1,6 +1,6 @@
using DS.WMS.Core.Fee.Method;
namespace DS.WMS.Core.Op.Method.Task
namespace DS.WMS.Core.Op.Method.TaskInteraction
{
/// <summary>
/// 海运出口任务服务

@ -13,6 +13,11 @@ namespace DS.WMS.Core.TaskPlat.Dtos
///<example>08dabd4e-dcc3-471a-8031-cf066ed0a8f4</example>
public string GID { get; set; } = Guid.NewGuid().ToString();
/// <summary>
/// 业务主键
/// </summary>
public long? BSNO { get; set; }
/// <summary>
/// 报文类型 TASK-任务
/// </summary>

@ -65,6 +65,12 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "外业务类型 BOOK_ORDER-订舱 MAIL_RECV-邮件接收", IsNullable = true, Length = 40)]
public string? OUT_BUSI_TYPE { get; set; }
/// <summary>
/// 外业务主键
/// </summary>
[SugarColumn(ColumnDescription = "外业务主键", IsNullable = true)]
public long? OUT_BS_NO { get; set; }
/// <summary>
/// 基础业务类型
/// </summary>

@ -29,10 +29,16 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "执行模块主键")]
public long ModuleId { get; set; }
/// <summary>
/// 执行模块名称
/// </summary>
[SugarColumn(ColumnDescription = "执行模块名称", IsNullable = true, Length = 255)]
public string? ModuleName { get; set; }
/// <summary>
/// 原始数据内容
/// </summary>
[SugarColumn(ColumnDescription = "原始数据内容", IsNullable = true)]
[SugarColumn(ColumnDescription = "原始数据内容", IsNullable = true, Length = 255)]
public string? OriginDataContext { get; set; }
///// <summary>

@ -20,5 +20,15 @@ namespace DS.WMS.Core.TaskPlat.Interface
/// <param name="modifyFile"></param>
/// <returns>返回回执</returns>
Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null);
/// <summary>
/// 设置任务状态
/// </summary>
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="taskStatusEnum">业务状态</param>
/// <param name="statusTime">状态发生时间</param>
Task<DataResult> SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime);
}
}

@ -41,6 +41,40 @@ namespace DS.WMS.Core.TaskPlat.Method
this.environment = environment;
//_codeCtnService = codeCtnService;
}
/// <summary>
/// 设置任务状态
/// </summary>
/// <param name="bsno">业务主键</param>
/// <param name="taskBaseTypeEnum">业务类型</param>
/// <param name="taskStatusEnum">业务状态</param>
/// <param name="statusTime">状态发生时间</param>
public async Task<DataResult> SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime)
{
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
TaskBaseInfo taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BS_NO == bsno && t.TASK_BASE_TYPE == taskBaseTypeEnum.ToString());
if (taskInfo == null)
{
_logger.LogInformation($"根据bsno:【{bsno}】,TaskBaseTypeEnum【{taskBaseTypeEnum}】未查询到任务");
return DataResult.Failed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataQueryNoData)));
}
_logger.LogInformation("接收到任务状态修改报文 任务主键={id} 状态设置={status}", taskInfo.Id, taskStatusEnum.ToString());
taskInfo.STATUS = taskStatusEnum.ToString();
await tenantDb.Updateable(taskInfo).UpdateColumns(x => new
{
x.UpdateBy,
x.UpdateTime,
x.UpdateUserName,
x.STATUS
}).ExecuteCommandAsync();
return DataResult.Successed(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DataUpdateSuccess)));
}
public async Task<DataResult> InitTaskJob(TaskManageOrderMessageInfo info, IFormFile file = null, IFormFile modifyFile = null)
{
@ -55,22 +89,35 @@ namespace DS.WMS.Core.TaskPlat.Method
SqlSugarScopeProvider tenantDb = saasDbService.GetBizDbScopeById(user.TenantId);
var taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}");
TaskBaseInfo taskInfo = null;
_logger.LogInformation("批次={no} 接收到创建任务报文 结束查询任务 {msg}", batchNo, taskInfo == null ? "不存在" : "存在");
// 如果业务主键不为空,则通过业务主键进行重复判断
if (info.Head.BSNO is not null or 0)
{
taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BS_NO == info.Head.BSNO);
}
// 否则通过Head.GID进行判断
else
{
taskInfo = await tenantDb.Queryable<TaskBaseInfo>()
.OrderByDescending(a => a.CreateTime)
.FirstAsync(t => t.OUT_BUSI_NO == $"{info.Head.SenderId}_{info.Head.GID}");
/*
*/
if (taskInfo != null && taskInfo.STATUS != TaskStatusEnum.Cancel.ToString() && taskInfo.STATUS != TaskStatusEnum.Complete.ToString())
}
// 只要任务最后一次处理任务的状态是已取消、已完成,就可以重入新的任务
if (taskInfo != null
&& taskInfo.STATUS != TaskStatusEnum.Cancel.ToString()
&& taskInfo.STATUS != TaskStatusEnum.Complete.ToString())
{
_logger.LogInformation("批次={no} 状态已存在,不能重复创建任务 status={status}", batchNo, taskInfo.STATUS);
//throw new Exception($"状态已存在,不能重复创建任务");
throw new Exception($"状态已存在,不能重复创建任务");
}
_logger.LogInformation("批次={no} 接收到创建任务报文 结束查询任务 {msg}", batchNo, taskInfo == null ? "不存在" : "存在");
//如果文件路径不为空 判断文件是否真实存在
if (!string.IsNullOrWhiteSpace(info.Main.FilePath) && !File.Exists(info.Main.FilePath))
{
@ -108,7 +155,7 @@ namespace DS.WMS.Core.TaskPlat.Method
CUSTOMER_NAME = info.Main.CustomerName,
BATCH_STATIC = info.Main.BatchStatic,
DJYUserId = info.Head.DJYUserId,
OUT_BS_NO = info.Head.BSNO,
};
long taskReqUserId = 0;
@ -588,30 +635,6 @@ namespace DS.WMS.Core.TaskPlat.Method
#region 私有方法
static object? GetNestedDynamicPropertyValue(dynamic obj, string propertyPath)
{
var properties = propertyPath.Split('.');
dynamic currentObj = obj;
foreach (var property in properties)
{
if (currentObj is IDictionary<string, object> dictionary)
{
if (dictionary.TryGetValue(property, out var value))
{
currentObj = value;
}
else
{
return null;
}
}
else
{
return null;
}
}
return currentObj;
}
/// <summary>
/// 保存文件并返回文件完整路径

@ -97,32 +97,49 @@ namespace DS.WMS.Core.TaskPlat
valStr = obj.ToString();
}
var oldValue = configMatchCount[configItem.Id];
if (conditionItem.MatchType == 1)
{
if (valStr?.Equals(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true)
{
configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1;
configMatchCount[configItem.Id] = oldValue + 1;
}
else
{
configMatchCount[configItem.Id] = oldValue - 1;
}
}
else if (conditionItem.MatchType == 2)
{
if (valStr?.Contains(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true)
{
configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1;
configMatchCount[configItem.Id] = oldValue + 1;
}
else
{
configMatchCount[configItem.Id] = oldValue - 1;
}
}
else if (conditionItem.MatchType == 3)
{
if (valStr?.StartsWith(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true)
{
configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1;
configMatchCount[configItem.Id] = oldValue + 1;
}
else
{
configMatchCount[configItem.Id] = oldValue - 1;
}
}
else if (conditionItem.MatchType == 4)
{
if (valStr?.EndsWith(conditionItem.MatchValue, StringComparison.CurrentCultureIgnoreCase) == true)
{
configMatchCount[configItem.Id] = configMatchCount[configItem.Id] + 1;
configMatchCount[configItem.Id] = oldValue + 1;
}
else
{
configMatchCount[configItem.Id] = oldValue - 1;
}
}
}
@ -207,17 +224,19 @@ namespace DS.WMS.Core.TaskPlat
{
throw new Exception($"未找到指定流程配置ExecuteModuleId{configItem.ExecuteModuleId}");
}
flowLogDetail.ModuleId = module.Id;
flowLogDetail.ModuleName = module.Name;
Assembly assembly;
if (module.AssemblyName!.StartsWith("DS.WMS.Core"))
{
//assembly = Assembly.GetEntryAssembly()!;
assembly = Assembly.GetExecutingAssembly();
}
else
{
assembly = Assembly.Load(module.AssemblyName!);
}
//var interfaceType2 = assembly.GetType(module.InterfaceName!);
var interfaceType = assembly.DefinedTypes.FirstOrDefault(x => x.Name == module.InterfaceName!);
if (interfaceType == null)
{

@ -54,6 +54,18 @@ public class TaskManageController : ApiController
return result;
}
/// <summary>
/// 设置任务状态
/// </summary>
[HttpPost("SetTaskStatus")]
[ApiUser(ApiCode = "BCTaskManage"), AllowAnonymous]
public async Task<DataResult> SetTaskStatus(long bsno, TaskBaseTypeEnum taskBaseTypeEnum, TaskStatusEnum taskStatusEnum, DateTime? statusTime)
{
var result = await taskManageService.SetTaskStatus(bsno, taskBaseTypeEnum, taskStatusEnum, statusTime);
return result;
}
// /TaskManage/CreateBCTaskJob
// /TaskManage/CreateDRAFTTaskJob
// /TaskManage/CreateAdvisoryTaskJob

Loading…
Cancel
Save