jianghaiqing 8 months ago
commit c40abd3636

@ -33,6 +33,11 @@ namespace Myshipping.Application
config.ForType<BookingLog, BookingLogSyncCustomerDto>()
.Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty);
config.ForType<BookingSoTemplate, BookingSoTemplateListOutput>()
.Map(dest => dest.CreatedTime, src => src.CreatedTime.HasValue ? src.CreatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null)
.Map(dest => dest.UpdatedTime, src => src.UpdatedTime.HasValue ? src.UpdatedTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : null);
}
}
}

@ -288,6 +288,36 @@ namespace Myshipping.Application.Entity
/// 附加数据
/// </summary>
public string ExtendData { get; set; }
/// <summary>
/// 起运港唯一代码
/// </summary>
public string PORTLOADCODE { get; set; }
/// <summary>
/// 目的港唯一代码
/// </summary>
public string PORTDISCHARGECODE { get; set; }
/// <summary>
/// 目的地唯一代码
/// </summary>
public string DESTINATIONCODE { get; set; }
/// <summary>
/// 付费方式代码
/// </summary>
public string FRTCODE { get; set; }
/// <summary>
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
/// <summary>
/// 船公司航线代码
/// </summary>
public string LANECODE { get; set; }
}
/// <summary>

@ -1025,5 +1025,30 @@ namespace Myshipping.Application.Entity
/// </summary>
[Description("删除时间")]
public DateTime? DeleteTime { get; set; }
/// <summary>
/// 起运港唯一代码
/// </summary>
public string PORTLOADCODE { get; set; }
/// <summary>
/// 目的港唯一代码
/// </summary>
public string PORTDISCHARGECODE { get; set; }
/// <summary>
/// 目的地唯一代码
/// </summary>
public string DESTINATIONCODE { get; set; }
/// <summary>
/// 付费方式代码
/// </summary>
public string FRTCODE { get; set; }
/// <summary>
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
}
}

@ -59,6 +59,13 @@ namespace Myshipping.Application.Entity
[Description("模板名称")]
public string TemplateName{ get; set; }
/// <summary>
/// 分类
/// </summary>
[SugarColumn(ColumnName = "Category")]
[Description("分类")]
public string Category { get; set; }
/// <summary>
/// 船司ID
/// </summary>

@ -517,7 +517,6 @@ namespace Myshipping.Application
}
#endregion
#region 客户端操作与接口
/// <summary>
/// 提交订舱
@ -1763,6 +1762,12 @@ namespace Myshipping.Application
[HttpPost("/BookingCustomerOrder/ReceiveCustomerOrder"), AllowAnonymous, ApiUser]
public async Task ReceiveCustomerOrder([FromForm] BookingCustomerApiSaveInput input, IFormFile[] files)
{
var carrList = await _cache.GetAllCodeCarrier();
var portLoadList = await _cache.GetAllCodePortLoad();
var portDestList = await _cache.GetAllCodePort();
var serviceList = await _cache.GetAllCodeService();
var frtList = await _cache.GetAllCodeFrt();
var ctnList = await _cache.GetAllCodeCtn();
#region 校验
/*
@ -1792,34 +1797,77 @@ namespace Myshipping.Application
// throw Oops.Bah("订舱密码不能为空");
//}
if (string.IsNullOrEmpty(input.CARRIERID) || string.IsNullOrEmpty(input.CARRIER))
//2024-4-2为保证后面自动化订舱需要船司、港口、箱型等信息改为传公共库中的唯一代码
if (string.IsNullOrEmpty(input.CARRIERID))
{
throw Oops.Bah("船司代码不能为空");
}
var carr = carrList.FirstOrDefault(x => x.Code == input.CARRIERID);
if (carr == null)
{
throw Oops.Bah("船司代码和名称不能为空");
throw Oops.Bah($"未找到匹配的船司代码:{input.CARRIERID}");
}
if (!input.ETD.HasValue)
{
throw Oops.Bah("开船日期不能为空");
}
if (string.IsNullOrEmpty(input.PORTLOADID) || string.IsNullOrEmpty(input.PORTLOAD))
//2024-4-2为保证后面自动化订舱需要船司、港口、箱型等信息改为传公共库中的唯一代码名称和五字码根据唯一代码匹配写入无需传递
//if (string.IsNullOrEmpty(input.PORTLOADID) || string.IsNullOrEmpty(input.PORTLOAD))
//{
// throw Oops.Bah("起运港代码和名称不能为空");
//}
//if (string.IsNullOrEmpty(input.PORTDISCHARGEID) || string.IsNullOrEmpty(input.PORTDISCHARGE))
//{
// throw Oops.Bah("目的港代码和名称不能为空");
//}
if (string.IsNullOrEmpty(input.PORTLOADCODE))
{
throw Oops.Bah("起运港代码不能为空");
}
var portLoad = portLoadList.FirstOrDefault(x => x.Code == input.PORTLOADCODE);
if (portLoad == null)
{
throw Oops.Bah("起运港代码和名称不能为空");
throw Oops.Bah($"未找到匹配的起运港:{input.PORTLOADCODE}");
}
if (string.IsNullOrEmpty(input.PORTDISCHARGEID) || string.IsNullOrEmpty(input.PORTDISCHARGE))
if (string.IsNullOrEmpty(input.PORTDISCHARGECODE))
{
throw Oops.Bah("目的港代码和名称不能为空");
throw Oops.Bah("目的港代码不能为空");
}
if (string.IsNullOrEmpty(input.SERVICE))
var portDest = portDestList.FirstOrDefault(x => x.Code == input.PORTDISCHARGECODE);
if (portDest == null)
{
throw Oops.Bah("运输条款不能为空");
throw Oops.Bah($"未找到匹配的目的港:{input.PORTDISCHARGECODE}");
}
if (string.IsNullOrEmpty(input.BLFRT))
if (string.IsNullOrEmpty(input.SERVICECODE))
{
throw Oops.Bah("付费方式不能为空");
throw Oops.Bah("运输条款代码不能为空");
}
var service = serviceList.FirstOrDefault(x => x.Code == input.SERVICECODE);
if (service == null)
{
throw Oops.Bah($"未找到匹配的运输条款:{input.SERVICECODE}");
}
if (string.IsNullOrEmpty(input.FRTCODE))
{
throw Oops.Bah("付费方式代码不能为空");
}
var frt = frtList.FirstOrDefault(x => x.Code == input.FRTCODE);
if (frt == null)
{
throw Oops.Bah($"未找到匹配的付费方式:{input.FRTCODE}");
}
if (!input.KGS.HasValue)
@ -1848,6 +1896,7 @@ namespace Myshipping.Application
throw Oops.Bah("货物标识为冻柜的情况下,湿度不能为空");
}
}
else if (input.CARGOID == "D")
{
if (string.IsNullOrEmpty(input.DUNNO))
@ -1875,13 +1924,20 @@ namespace Myshipping.Application
if (input.CtnList == null || input.CtnList.Count == 0)
{
throw Oops.Bah("箱型箱量不能为空");
throw Oops.Bah("箱信息不能为空");
}
var notExistCode = input.CtnList.Where(x => ctnList.Count(y => y.Code == x.CTNCODE) == 0).Select(x => x.CTNCODE).ToList();
if (notExistCode.Any())
{
throw Oops.Bah($"未找到箱型:{string.Join(",", notExistCode)}");
}
if (input.ServiceItemList == null || input.ServiceItemList.Count == 0)
{
throw Oops.Bah("服务项目不能为空");
}
#endregion
var custOrder = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.TenantId == UserManager.TENANT_ID && x.BSNO == input.BSNO);
@ -1909,6 +1965,15 @@ namespace Myshipping.Application
ins = true;
}
//赋值根据唯一代码匹配后的代码、名称等信息
custOrder.CARRIER = carr.EnName;
custOrder.PORTLOAD = portLoad.EnName;
custOrder.PORTLOADID = portLoad.EdiCode;
custOrder.PORTDISCHARGE = portDest.EnName;
custOrder.PORTDISCHARGEID = portDest.EdiCode;
custOrder.SERVICE = service.Name;
custOrder.BLFRT = frt.EnName;
//订舱账号、密码
var jobj = new JObject();
if (!string.IsNullOrEmpty(custOrder.ExtendData))
@ -1916,13 +1981,17 @@ namespace Myshipping.Application
jobj = JObject.Parse(custOrder.ExtendData);
}
var jobjBookAcc=new JObject();
var jobjBookAcc = new JObject();
jobjBookAcc["Account"] = input.BOOKINGACCOUNT;
jobjBookAcc["Password"] = input.BOOKINGPASSWORD;
jobj["BookingAccount"] = jobjBookAcc;
custOrder.ExtendData = jobjBookAcc.ToJsonString();
var ctns = input.CtnList.Adapt<List<BookingCtn>>();
foreach(var ctn in ctns)
{
ctn.CTNALL = ctnList.First(x => x.Code == ctn.CTNCODE).Name;
}
var servList = input.ServiceItemList.Adapt<List<BookingServiceItem>>();
await SaveData(custOrder, ctns, servList, ins);

@ -300,6 +300,36 @@ namespace Myshipping.Application
/// 目的地
/// </summary>
public string DESTINATION { get; set; }
/// <summary>
/// 起运港唯一代码
/// </summary>
public string PORTLOADCODE { get; set; }
/// <summary>
/// 目的港唯一代码
/// </summary>
public string PORTDISCHARGECODE { get; set; }
/// <summary>
/// 目的地唯一代码
/// </summary>
public string DESTINATIONCODE { get; set; }
/// <summary>
/// 付费方式代码
/// </summary>
public string FRTCODE { get; set; }
/// <summary>
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
/// <summary>
/// 船公司航线代码
/// </summary>
public string LANECODE { get; set; }
}
//保存dto
@ -909,5 +939,10 @@ namespace Myshipping.Application
/// 订舱密码
/// </summary>
public string BOOKINGPASSWORD { get; set; }
/// <summary>
/// 航线代码
/// </summary>
public string LINECODE { get; set; }
}
}

@ -9841,6 +9841,15 @@ namespace Myshipping.Application
var childrens = await _rep.AsQueryable().Filter(null, true).Where(x => x.ParentId == item.Id && x.TenantId == UserManager.TENANT_ID && x.IsDeleted == false).ToListAsync();
dto.childrens = childrens.Adapt<List<Children>>();
var files = await _bookingfile.AsQueryable().Filter(null, true).Where(x => x.BookingId == item.Id).ToListAsync();
dto.Files = files.Select(x => new ReceiveBcInfoDto.DownloadFile()
{
FileName = x.FileName,
FileType = x.TypeCode,
FilePath = x.FilePath
}).ToList();
foreach (var childitem in dto.childrens)
{
var ctnInputs = await _repCtn.AsQueryable().Filter(null, true).Where(x => x.BILLID == childitem.Id && x.IsDeleted == false).ToListAsync();

@ -827,6 +827,32 @@ namespace Myshipping.Application
/// </summary>
public decimal CtrnHeight { get; set; }
/// <summary>
/// 起运港唯一代码
/// </summary>
public string PORTLOADCODE { get; set; }
/// <summary>
/// 目的港唯一代码
/// </summary>
public string PORTDISCHARGECODE { get; set; }
/// <summary>
/// 目的地唯一代码
/// </summary>
public string DESTINATIONCODE { get; set; }
/// <summary>
/// 付费方式代码
/// </summary>
public string FRTCODE { get; set; }
/// <summary>
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
/// <summary>
/// 扩展状态
/// </summary>

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace Myshipping.Application.Service.BookingOrder.Dto
{
@ -11,5 +12,14 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
public string VESSEL { get; set; }
public string VOYNO { get; set; }
public DateTime? ETD { get; set; }
public List<DownloadFile> Files { get; set; }
public class DownloadFile
{
public string FileName { get; set; }
public string FileType { get; set; }
public string FilePath { get; set; }
}
}
}

@ -255,6 +255,31 @@ namespace Myshipping.Application.Service.BookingOrder.Dto
/// 订舱编号
/// </summary>
public string CUSTNO { get; set; }
/// <summary>
/// 起运港唯一代码
/// </summary>
public string PORTLOADCODE { get; set; }
/// <summary>
/// 目的港唯一代码
/// </summary>
public string PORTDISCHARGECODE { get; set; }
/// <summary>
/// 目的地唯一代码
/// </summary>
public string DESTINATIONCODE { get; set; }
/// <summary>
/// 付费方式代码
/// </summary>
public string FRTCODE { get; set; }
/// <summary>
/// 运输条款代码
/// </summary>
public string SERVICECODE { get; set; }
}
/// <summary>

@ -422,6 +422,8 @@ namespace Myshipping.Application
checkResult.Add($"舱单主单中箱子的【总尺码】与订舱中箱子的【总尺码】不一致");
}
if (.Count > 0)
{
if (.Sum(x => x.PKGS) != bkOrderCtnList.Sum(x => x.PKGS))
{
checkResult.Add($"舱单分单中箱子的【总件数】与订舱中箱子的【总件数】不一致");
@ -434,6 +436,8 @@ namespace Myshipping.Application
{
checkResult.Add($"舱单分单中箱子的【总尺码】与订舱中箱子的【总尺码】不一致");
}
}
// 再按箱号比较
foreach (var item in .GroupBy(x => x.CNTRNO))

@ -47,6 +47,11 @@ namespace Myshipping.Application
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 分类
/// </summary>
public string Category { get; set; }
/// <summary>
/// 船司ID
/// </summary>

@ -1,4 +1,5 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Myshipping.Application
{
@ -7,6 +8,25 @@ namespace Myshipping.Application
/// </summary>
public class BookingSoTemplateListOutput : BookingSoTemplateDto
{
/// <summary>
/// 创建时间
/// </summary>
public virtual string CreatedTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
public virtual string UpdatedTime { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
public virtual string CreatedUserName { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
public virtual string UpdatedUserName { get; set; }
}

@ -5,6 +5,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Myshipping.Application.Service.BookingOrder.Dto.ReceiveBcInfoDto;
namespace Myshipping.Application.Service.DataSync.Dto
{
@ -827,6 +828,12 @@ namespace Myshipping.Application.Service.DataSync.Dto
///货物状态
///</summary>
public List<BookingGoodsStatusDto> GoodsStatus { get; set; }
/// <summary>
/// 附件列表
/// </summary>
public List<DownloadFile> Files { get; set; }
}

Loading…
Cancel
Save