1. 接收东胜推送的订舱需求的接口添加KGS、REMARK, 2.添加接口“接收BC信息更新订舱” 3.SendBookingORder添加同步类型:“BC”

master
zhangxiaofeng 8 months ago
parent 3fb5c28f5c
commit 43ade29cd5

@ -442,6 +442,15 @@ namespace Myshipping.Application
/// </summary>
public int? CTNNUM { get; set; }
/// <summary>
/// 毛重
/// </summary>
public decimal? KGS { get; set; }
/// <summary>
/// 备注
/// </summary>
public string REMARK { get; set; }
}
/// <summary>

@ -9680,12 +9680,12 @@ namespace Myshipping.Application
/// 推送东胜
/// </summary>
/// <param name="ids"></param>
/// <param name="syncTypeEnum"></param>
/// <returns></returns>
[NonAction]
public async Task<dynamic> SendBookingOrder(long[] ids)
public async Task<dynamic> SendBookingOrder(long[] ids, BookingOrderSyncTypeEnum? syncTypeEnum = null)
{
// 以后需要把RUN_TYPE_CUST 、 RUN_TYPE_NORMAL放开
if (App.Configuration["RunType"] is CommonConst.RUN_TYPE_CUST or CommonConst.RUN_TYPE_DJY or CommonConst.RUN_TYPE_NORMAL)
if (App.Configuration["RunType"] is CommonConst.RUN_TYPE_DJY)
{
return null;
}
@ -9716,6 +9716,11 @@ namespace Myshipping.Application
var dto = item.Adapt<SyncBookingOrderDto>();
if (syncTypeEnum != null)
{
dto.SyncType = syncTypeEnum.ToString();
}
List<ServiceProjectStatusDto> statusList = new List<ServiceProjectStatusDto>();
if (App.Configuration["ServiceStatusOpenAuto"] == "1")
@ -11897,6 +11902,67 @@ namespace Myshipping.Application
#endregion
/// <summary>
/// 接收BC信息更新订舱
/// </summary>
[AllowAnonymous]
[HttpPost("/BookingOrder/ReceiveBcInfo")]
[ApiUser(ApiCode = "ReceiveBcInfo")]
public async Task<ReceiveBcInfoResultDto> ReceiveBcInfo(ReceiveBcInfoDto input)
{
if (string.IsNullOrWhiteSpace(input.CUSTNO))
{
return new ReceiveBcInfoResultDto(false, "CUSTNO不能为空");
}
var list = await _rep.AsQueryable().Filter(null, true).Where(x => x.CUSTNO == input.CUSTNO)
.ToListAsync();
if (list.Count == 0)
{
string msg = $"通过CUSTNO查询订舱更新BC相关字段时未查询到数据CUSTNO【{input.CUSTNO}】,结束";
_logger.LogInformation(msg);
return new ReceiveBcInfoResultDto(false, msg);
}
_logger.LogInformation($"通过CUSTNO查询订舱更新BC相关字段时查询到{list.Count}条数据CUSTNO【{input.CUSTNO}】,开始更新");
var oldOrderList = list.Adapt<List<BookingOrder>>();
list.ForEach(x =>
{
x.MBLNO = input.MBLNO;
x.CUSTNO = input.CUSTNO;
x.CLOSEVGMDATE = input.CLOSEVGMDATE;
x.CLOSEDOCDATE = input.CLOSEDOCDATE;
x.VESSEL = input.VESSEL;
x.VOYNO = input.VOYNO;
x.ETD = input.ETD;
x.UpdatedTime = DateTime.Now;
});
var changeNum = await _rep.Context.Updateable(list).UpdateColumns(x => new
{
x.MBLNO,
x.CUSTNO,
x.CLOSEDOCDATE,
x.CLOSEVGMDATE,
x.VESSEL,
x.VOYNO,
x.ETD,
x.UpdatedTime,
}).ExecuteCommandAsync();
foreach (var item in list)
{
var oldOrder = oldOrderList.FirstOrDefault(x => x.Id == item.Id);
await SaveLog(item, oldOrder, "接收BC后更新订舱");
}
var orderIdArr = list.Select(x => x.Id).ToArray();
await SendBookingOrder(orderIdArr, BookingOrderSyncTypeEnum.BC);
return new ReceiveBcInfoResultDto(true, $"接收成功,共更新{changeNum}条订舱记录");
}
}
}

@ -0,0 +1,15 @@
using System;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class ReceiveBcInfoDto
{
public string MBLNO { get; set; }
public string CUSTNO { get; set; }
public DateTime? CLOSEVGMDATE { get; set; }
public DateTime? CLOSEDOCDATE { get; set; }
public string VESSEL { get; set; }
public string VOYNO { get; set; }
public DateTime? ETD { get; set; }
}
}

@ -0,0 +1,15 @@
namespace Myshipping.Application.Service.BookingOrder.Dto
{
public class ReceiveBcInfoResultDto
{
public bool Success { get; set; }
public ReceiveBcInfoResultDto(bool success, string message)
{
Success = success;
Message = message;
}
public string Message { get; set; }
}
}

@ -47,8 +47,9 @@ namespace Myshipping.Application
/// 推送东胜
/// </summary>
/// <param name="ids"></param>
/// <param name="syncTypeEnum"><see cref="BookingOrderSyncTypeEnum"/></param>
/// <returns></returns>
Task<dynamic> SendBookingOrder(long[] ids);
Task<dynamic> SendBookingOrder(long[] ids, BookingOrderSyncTypeEnum? syncTypeEnum = null);
/// <summary>
/// 保存(新增或修改)放舱

@ -10,6 +10,11 @@ namespace Myshipping.Application.Service.DataSync.Dto
{
public class SyncBookingOrderDto
{
/// <summary>
/// 字段同步类型 空:更新全部字段 BC只更新BC相关字段
/// </summary>
public string SyncType { get; set; }
///// <summary>
///// 主键
///// </summary>

@ -0,0 +1,16 @@
namespace Myshipping.Core;
/// <summary>
/// 订舱记录同步类型
/// </summary>
public enum BookingOrderSyncTypeEnum
{
/// <summary>
/// 同步全部字段(未指定时,默认为同步全部)
/// </summary>
ALL = 0,
/// <summary>
/// 只同步BC相关字段
/// </summary>
BC = 1,
}

@ -4455,6 +4455,21 @@
普通账号
</summary>
</member>
<member name="T:Myshipping.Core.BookingOrderSyncTypeEnum">
<summary>
订舱记录同步类型
</summary>
</member>
<member name="F:Myshipping.Core.BookingOrderSyncTypeEnum.ALL">
<summary>
同步全部字段(未指定时,默认为同步全部)
</summary>
</member>
<member name="F:Myshipping.Core.BookingOrderSyncTypeEnum.BC">
<summary>
只同步BC相关字段
</summary>
</member>
<member name="T:Myshipping.Core.CacheType">
<summary>
缓存类型
@ -16906,7 +16921,13 @@
</summary>
<returns></returns>
</member>
<!-- Badly formed XML comment ignored for member "M:Myshipping.Core.Service.SysUserService.ImportUser(Microsoft.AspNetCore.Http.IFormFile)" -->
<member name="M:Myshipping.Core.Service.SysUserService.ImportUser(Microsoft.AspNetCore.Http.IFormFile)">
<summary>
用户导入
</summary>
<param name="file"></param>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.SysUserService.GetUserById(System.Int64)">
<summary>
根据用户Id获取用户

@ -4,10 +4,10 @@
"DefaultDbType": "MySql",
//
"DefaultDbString": "Data Source=60.209.125.238;Database=booking_hechuan_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;",
//"DefaultDbString": "Data Source=60.209.125.238;Database=booking_hechuan_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;",
// -
//"DefaultDbString": "Data Source=60.209.125.238;Database=booking_customer_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;",
"DefaultDbString": "Data Source=60.209.125.238;Database=booking_customer_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;",
// -
//"DefaultDbString": "Data Source=60.209.125.238;Database=booking_djy_test;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;sslmode=none;CharSet=utf8mb4;Convert Zero Datetime=True;Allow Zero Datetime=True;",

@ -45,5 +45,5 @@
CUST -
DJY -
*/
"RunType": "HeChuan"
"RunType": "CUST"
}
Loading…
Cancel
Save