wet 2 years ago
commit c973bc32ea

@ -772,11 +772,11 @@ namespace Myshipping.Application.EDI.TSL
icount = icount + 2;
if (InttrEdi.filerole == "9")
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+9'");
r.WriteLine("BGM+335+" + bill.ORDERNO + "+9'");
else if (InttrEdi.filerole == "1")
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+1'");
r.WriteLine("BGM+335+" + bill.ORDERNO + "+1'");
else
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+5'");
r.WriteLine("BGM+335+" + bill.ORDERNO + "+5'");
r.WriteLine("DTM+137:" + nowDate.ToString("yyyyMMddHHmm") + ":203'");
@ -1346,21 +1346,32 @@ namespace Myshipping.Application.EDI.TSL
r.WriteLine("EQD+CN++" + ctn.CTNALLCODE + "+1'");
else
r.WriteLine("EQD+CN++" + ctn.CTNALLCODE + "+2'");
r.WriteLine("EQN+" + ctn.CTNNUM.ToString() + "'");
icount = icount + 2;
icount = icount + 1;
if (bill.CARGOID == "R")
{
if (!string.IsNullOrWhiteSpace(bill.REEFERF))
{
r.WriteLine("MEA+AAE+AAS+CBM:" + bill.REEFERF + "'");
icount = icount + 1;
}
if (!string.IsNullOrWhiteSpace(bill.HUMIDITY))
{
r.WriteLine("MEA+AAE+AAO+HMD:" + bill.HUMIDITY + "'");
r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'");
icount = icount + 2;
icount = icount + 1;
}
}
r.WriteLine("EQN+" + ctn.CTNNUM.ToString() + "'");
icount = icount + 1;
if (bill.CARGOID == "R")
{
r.WriteLine("TMP+2+" + bill.TEMPSET + ":CEL'");
icount = icount + 1;
}
}
}
@ -2126,8 +2137,20 @@ namespace Myshipping.Application.EDI.TSL
}
#endregion
}
/// <summary>
/// 订舱提单份数为空时,默认返回"0"
/// </summary>
public static class NoBillSOExts
{
public static string EmptyDefaultNum(this string s)
{
if (string.IsNullOrWhiteSpace(s))
return "0";
return s;
}
}
}

@ -4245,7 +4245,20 @@ namespace Myshipping.Application
}
primaryModel.CARRIEREDICODE = ediSOSICfg.MapCode;
primaryModel.ORDERNO = order.BOOKINGNO;
//这里除了TSL订舱编号默认都对应到业务编号订舱保存时自动生成
if (ediRouteEnum == EDIRouteEnum.TSL)
{
if(string.IsNullOrWhiteSpace(order.CUSTNO))
throw Oops.Bah($"船公司是{order.CARRIERID} 订舱编号不能为空");
primaryModel.ORDERNO = order.CUSTNO;
}
else
{
primaryModel.ORDERNO = order.BOOKINGNO;
}
var curBasePkgs = basePkgsList.FirstOrDefault(p => p.Name.Equals(order.KINDPKGS, StringComparison.OrdinalIgnoreCase));

@ -11,8 +11,10 @@ using Microsoft.Extensions.Options;
using Myshipping.Application.ConfigOption;
using Myshipping.Application.Entity;
using Myshipping.Core;
using Myshipping.Core.Entity;
using Myshipping.Core.Service;
using Org.BouncyCastle.Crypto;
using SqlSugar;
using StackExchange.Profiling.Internal;
using System;
using System.Collections.Generic;
@ -25,6 +27,7 @@ using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Yitter.IdGenerator;
@ -37,10 +40,12 @@ namespace Myshipping.Application
public class BookingValueAddedService : IBookingValueAddedService, IDynamicApiController, ITransient
{
private readonly ISysCacheService _cache;
private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
//private readonly IDjyWebsiteAccountConfigService _webAccountConfig;
private readonly ILogger<BookingTruckService> _logger;
private readonly SqlSugarRepository<BookingOrder> _bookingOrderRepository;
private readonly SqlSugarRepository<BookingFile> _bookingfile;
private readonly SqlSugarRepository<DjyWebsiteAccountConfig> _djyWebsiteAccountConfigRepository;
private readonly SqlSugarRepository<SysUser> _sysUserRepository;
const string CONST_MAPPING_BC_MODULE_ROUTE = "BC_DOWN_RT";
const string CONST_MAPPING_DRAFT_MODULE_ROUTE = "DRAFT_DOWN_RT";
@ -54,7 +59,7 @@ namespace Myshipping.Application
public BookingValueAddedService(ISysCacheService cache, ILogger<BookingTruckService> logger,
SqlSugarRepository<BookingOrder> bookingOrderRepository, SqlSugarRepository<BookingFile> bookingfile,
IDjyWebsiteAccountConfigService webAccountConfig)
SqlSugarRepository<DjyWebsiteAccountConfig> djyWebsiteAccountConfigRepository, SqlSugarRepository<SysUser> sysUserRepository)
{
_cache = cache;
_logger = logger;
@ -62,7 +67,8 @@ namespace Myshipping.Application
_bookingOrderRepository = bookingOrderRepository;
_bookingfile = bookingfile;
_webAccountConfig = webAccountConfig;
_djyWebsiteAccountConfigRepository = djyWebsiteAccountConfigRepository;
_sysUserRepository = sysUserRepository;
}
@ -128,14 +134,21 @@ namespace Myshipping.Application
var fail = downResultList.Count(x => !x.succ);
if (succ > 0)
{
result.batchTotal = succ.ToString();
}
else
{
result.batchTotal = "- ";
}
if(fail > 0)
{
if (succ > 0)
result.batchTotal = result.batchTotal+"/"+ fail.ToString();
result.batchTotal = "/" + fail.ToString();
result.batchTotal += "/" + fail.ToString();
}
else
{
result.batchTotal += " -";
}
}
catch (Exception ex)
@ -218,7 +231,7 @@ namespace Myshipping.Application
string webKey = string.Format(CONST_FORMAT_WEB, bcOrDraftRouteCfg.MapCode);
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人个人没有配置取公司对应配置
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(webKey, UserManager.UserId).GetAwaiter()
var userWebAccountConfig = GetAccountConfig(webKey, UserManager.UserId,UserManager.TENANT_ID).GetAwaiter()
.GetResult();
_logger.LogInformation("批次={no} 获取获取网站的账户完成result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
@ -302,7 +315,7 @@ namespace Myshipping.Application
}
//这里先写入附件表
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(currFilePath).Name,
await SaveEDIFile(bookingOrder.Id, bookFilePath, new System.IO.FileInfo(currFilePath).Name,
fileTypeCode, fileTypeName);
result.succ = true;
@ -416,14 +429,21 @@ namespace Myshipping.Application
var fail = downResultList.Count(x => !x.succ);
if (succ > 0)
{
result.batchTotal = succ.ToString();
}
else
{
result.batchTotal = "- ";
}
if (fail > 0)
{
if (succ > 0)
result.batchTotal = result.batchTotal + "/" + fail.ToString();
result.batchTotal = "/" + fail.ToString();
result.batchTotal += "/" + fail.ToString();
}
else
{
result.batchTotal += " -";
}
}
catch (Exception ex)
@ -525,7 +545,7 @@ namespace Myshipping.Application
string webKey = string.Format(CONST_FORMAT_WEB, bcOrDraftRouteCfg.MapCode);
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人个人没有配置取公司对应配置
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(webKey, UserManager.UserId).GetAwaiter()
var userWebAccountConfig = GetAccountConfig(webKey, UserManager.UserId, UserManager.TENANT_ID).GetAwaiter()
.GetResult();
_logger.LogInformation("批次={no} 获取获取网站的账户完成result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
@ -698,7 +718,10 @@ namespace Myshipping.Application
{
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
var res = await url.SetHttpMethod(HttpMethod.Post)
var res = await url.OnClientCreating(client => {
// client 为 HttpClient 对象
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
}).SetHttpMethod(HttpMethod.Post)
.SetBody(JSON.Serialize(info), "application/json")
.SetContentEncoding(Encoding.UTF8)
.PostAsync();
@ -747,7 +770,10 @@ namespace Myshipping.Application
{
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
var res = await url.SetHttpMethod(HttpMethod.Post)
var res = await url.OnClientCreating(client => {
// client 为 HttpClient 对象
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
}).SetHttpMethod(HttpMethod.Post)
.SetBody(JSON.Serialize(info), "application/json")
.SetContentEncoding(Encoding.UTF8)
.PostAsync();
@ -936,14 +962,21 @@ namespace Myshipping.Application
var fail = downResultList.Count(x => !x.succ);
if (succ > 0)
{
result.batchTotal = succ.ToString();
}
else
{
result.batchTotal = "- ";
}
if (fail > 0)
{
if (succ > 0)
result.batchTotal = result.batchTotal + "/" + fail.ToString();
result.batchTotal = "/" + fail.ToString();
result.batchTotal += "/" + fail.ToString();
}
else
{
result.batchTotal += " -";
}
}
catch (Exception ex)
@ -1035,7 +1068,7 @@ namespace Myshipping.Application
string webKey = string.Format(CONST_FORMAT_WEB, bcOrDraftRouteCfg.MapCode);
//获取个人对应的账户,这里GetAccountConfig逻辑优先取个人个人没有配置取公司对应配置
var userWebAccountConfig = _webAccountConfig.GetAccountConfig(webKey, UserManager.UserId).GetAwaiter()
var userWebAccountConfig = GetAccountConfig(webKey, UserManager.UserId, UserManager.TENANT_ID).GetAwaiter()
.GetResult();
_logger.LogInformation("批次={no} 获取获取网站的账户完成result={Num}", batchNo, JSON.Serialize(userWebAccountConfig));
@ -1128,6 +1161,29 @@ namespace Myshipping.Application
return result;
}
#endregion
/// <summary>
/// 获取个人或公司网站账户配置
/// </summary>
/// <param name="typeCode">账户类型代码</param>
/// <param name="userId">用户ID</param>
/// <param name="tendId">租户ID</param>
/// <returns>返回账户配置</returns>
private async Task<DjyWebsiteAccountConfig> GetAccountConfig(string typeCode,long userId,long tendId)
{
DjyWebsiteAccountConfig accountConfig = new DjyWebsiteAccountConfig();
accountConfig = await _djyWebsiteAccountConfigRepository.EntityContext.CopyNew().Queryable<DjyWebsiteAccountConfig>()
.FirstAsync(x => x.TypeCode == typeCode && x.CreatedUserId == userId);
if (accountConfig == null)
{
accountConfig = await _djyWebsiteAccountConfigRepository.EntityContext.CopyNew().Queryable<DjyWebsiteAccountConfig>()
.FirstAsync(x => x.TypeCode == typeCode && x.TenantId == tendId && x.IsTenant == true);
}
return accountConfig;
}
}
public class DateTimeJsonConverter : System.Text.Json.Serialization.JsonConverter<DateTime>

@ -16,7 +16,7 @@ namespace Myshipping.Application
{
config.ForType<BookingOrder, MsOpSeaeEDIBaseModel>()
.Map(dest => dest.WEITUO, src => src.WEITUO)
.Map(dest => dest.ORDERNO, src => src.BSNO)
.Map(dest => dest.ORDERNO, src => src.CUSTNO)
.Map(dest => dest.MBLNO, src => src.MBLNO)
.Map(dest => dest.BLFRT, src => src.BLFRT)
.Map(dest => dest.VESSEL, src => src.VESSEL)

@ -25,5 +25,13 @@ namespace Myshipping.Application
/// <param name="bookingIds">订舱主键组</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> ExcuteShippingOrderCompareBatchAsync(string[] bookingIds);
/// <summary>
/// 批量执行下货纸比对
/// </summary>
/// <param name="bookingIds">订舱主键组</param>
/// <returns>返回回执</returns>
Task<TaskManageExcuteResultDto> AutoTaskShippingOrderCompareCallBackAsync(string[] bookingIds);
}
}

@ -275,6 +275,17 @@ namespace Myshipping.Application
return result;
}
/// <summary>
/// 批量执行下货纸比对
/// </summary>
/// <param name="bookingIds">订舱主键组</param>
/// <returns>返回回执</returns>
public async Task<TaskManageExcuteResultDto> AutoTaskShippingOrderCompareCallBackAsync(string[] bookingIds)
{
return new TaskManageExcuteResultDto();
}
/// <summary>
/// 生成请求规则报文
/// </summary>

Loading…
Cancel
Save