wet 1 year ago
commit ac9dd0f443

@ -660,7 +660,7 @@ namespace Myshipping.Application
/// <returns></returns>
[HttpPost("/BookingOrder/Save")]
public async Task<BookingOrderOutput> Save(BookingOrderDto input)
public async Task<BookingOrderOutput> Save(SaveBookingOrderInput input)
{
if (input == null)
{
@ -1062,6 +1062,28 @@ namespace Myshipping.Application
ordOut.BookingEDIExt = ediExtEntity.Adapt<BookingEDIExtDto>();
}
await SendBookingOrder(new long[] { main.ParentId == 0 ? Id : (long)main.ParentId });
//临时文件转正式
if (input.TempFiles != null && input.TempFiles.Count > 0)
{
var optTmp = App.GetOptions<TempFileOptions>();
foreach (var tmpFile in input.TempFiles)
{
var fpath = Path.Combine(App.WebHostEnvironment.WebRootPath, optTmp.Path, tmpFile.TempPathName);
if (File.Exists(fpath))
{
var fn = Path.GetFileName(tmpFile.TempPathName);
MemoryStream memStream = new MemoryStream(File.ReadAllBytes(fpath));
await AddFile(new FormFile(memStream, 0, memStream.Length, fn, fn), new BookingFileDto()
{
BookingId = Id,
TypeCode = tmpFile.TypeCode,
TypeName = tmpFile.TypeName
});
}
}
}
//推送订舱数据到客户订舱系统
CustomerBookingSyncHelper.SendCustomerBookingSync(Id);
return ordOut;
@ -1563,10 +1585,10 @@ namespace Myshipping.Application
/// 增加订舱附件
/// </summary>
/// <param name="file"></param>
/// <param name="dto"></param>
/// <param name="dto">注意如果是新建单据BookingId传0</param>
/// <returns></returns>
[HttpPost("/BookingOrder/AddFile")]
public async Task AddFile(IFormFile file, [FromForm] BookingFileDto dto)
public async Task<string> AddFile(IFormFile file, [FromForm] BookingFileDto dto)
{
//未上传文件
if (file == null || file.Length == 0)
@ -1583,42 +1605,63 @@ namespace Myshipping.Application
}
var dirAbs = string.Empty;
if (string.IsNullOrEmpty(opt.basePath))
var fileRelaPath = string.Empty;
var fileAbsPath = string.Empty;
//2023年8月9日增加无bookingId时可上传附件功能放在临时目录
if (dto.BookingId == 0)
{
dirAbs = Path.Combine(App.WebHostEnvironment.WebRootPath, opt.relativePath);
var optTmp = App.GetOptions<TempFileOptions>();
dirAbs = Path.Combine(App.WebHostEnvironment.WebRootPath, optTmp.Path);
var tmpPath = YitIdHelper.NextId().ToString();
fileRelaPath = Path.Combine(tmpPath, originalFilename).ToLower();
dirAbs = Path.Combine(dirAbs, tmpPath);
if (!Directory.Exists(dirAbs))
Directory.CreateDirectory(dirAbs);
fileAbsPath = Path.Combine(dirAbs, originalFilename).ToLower();
}
else
{
dirAbs = Path.Combine(opt.basePath, opt.relativePath);
}
if (string.IsNullOrEmpty(opt.basePath))
{
dirAbs = Path.Combine(App.WebHostEnvironment.WebRootPath, opt.relativePath);
}
else
{
dirAbs = Path.Combine(opt.basePath, opt.relativePath);
}
if (!Directory.Exists(dirAbs))
Directory.CreateDirectory(dirAbs);
if (!Directory.Exists(dirAbs))
Directory.CreateDirectory(dirAbs);
// 先存库获取Id
var id = YitIdHelper.NextId();
var fileSaveName = $"{id}{fileSuffix}".ToLower();
var fileRelaPath = Path.Combine(opt.relativePath, fileSaveName).ToLower();
var fileAbsPath = Path.Combine(dirAbs, fileSaveName).ToLower();
var newFile = new BookingFile
{
Id = id,
FileName = originalFilename,
FilePath = fileRelaPath,
TypeCode = dto.TypeCode,
TypeName = dto.TypeName,
BookingId = dto.BookingId,
// 先存库获取Id
var id = YitIdHelper.NextId();
var fileSaveName = $"{id}{fileSuffix}".ToLower();
fileRelaPath = Path.Combine(opt.relativePath, fileSaveName).ToLower();
fileAbsPath = Path.Combine(dirAbs, fileSaveName).ToLower();
var newFile = new BookingFile
{
Id = id,
FileName = originalFilename,
FilePath = fileRelaPath,
TypeCode = dto.TypeCode,
TypeName = dto.TypeName,
BookingId = dto.BookingId,
};
await _bookingfile.InsertAsync(newFile);
}
};
await _bookingfile.InsertAsync(newFile);
using (var stream = File.Create(fileAbsPath))
{
await file.CopyToAsync(stream);
}
return fileRelaPath;
}
/// <summary>
/// 获取附件
/// </summary>
@ -3217,7 +3260,6 @@ namespace Myshipping.Application
/// 下载文件
/// </summary>
/// <returns></returns>
[HttpGet("/BookingOrder/Download")]
public async Task<IActionResult> Download(long id)
{
@ -7289,11 +7331,13 @@ namespace Myshipping.Application
/// 上传ocr文件
/// </summary>
/// <param name="file"></param>
/// <param name="bookingId">订舱id</param>
/// <param name="bookingId">订舱id新建的单据传0</param>
/// <returns></returns>
[HttpPost("/BookingOrder/OcrUpFile")]
public async Task<string> OcrUpFile(IFormFile file, long bookingId)
public async Task<OcrUploadOutputDto> OcrUpFile(IFormFile file, long bookingId)
{
var output = new OcrUploadOutputDto();
//未上传文件
if (file == null || file.Length == 0)
{
@ -7301,7 +7345,7 @@ namespace Myshipping.Application
}
//保存到订舱
await AddFile(file, new BookingFileDto()
output.UploadFileName = await AddFile(file, new BookingFileDto()
{
BookingId = bookingId,
TypeCode = "other",
@ -7350,8 +7394,8 @@ namespace Myshipping.Application
var jobj = strRtn.ToJObject();
if (jobj.GetIntValue("code") == 0)
{
var fn = jobj.GetStringValue("data");
return fn;
output.OcrFileName = jobj.GetStringValue("data");
return output;
}
else
{
@ -7595,6 +7639,24 @@ namespace Myshipping.Application
if (ctns.Count(x => !string.IsNullOrEmpty(x.CNTRNO) || !string.IsNullOrEmpty(x.SEALNO)) > 0) //有数据填写了箱封号,不再处理
{
_logger.LogInformation($"{bookId}({order.MBLNO})的数据已填写过箱封号,不再处理自动引入");
//写入提示
await SaveAutoYardData(bookId, false,
$"已有箱封号,无法处理数据引入",
ctns.ToJson(), "");
return;
}
var ctnAllMulti = ctns.GroupBy(x => x.CTNALL).Select(x => new { CTNALL = x.Key, COUNT = x.Count() }).Count(x => x.COUNT > 1);
if (ctnAllMulti > 0) //有箱型填写超过1行展开过箱量不再处理
{
//写入提示
await SaveAutoYardData(bookId, false,
$"箱量已展开,无法处理数据引入",
ctns.ToJson(), "");
return;
}
@ -7722,9 +7784,9 @@ HLCUTA12307DPXJ3 以这票为例 6个柜
if (match)
{
var cfgDevSwitch = (await _cache.GetAllSysConfig()).FirstOrDefault(x => x.Name == "AutoYardDataDevSwitch");
var cfgDevSwitch = (await _cache.GetAllSysConfig()).FirstOrDefault(x => x.Name == "AutoYardDataDevOpId");
if (cfgDevSwitch != null && cfgDevSwitch.Value == "0")
if (cfgDevSwitch != null && (cfgDevSwitch.Value == "all" || (!string.IsNullOrEmpty(order.OPID) && cfgDevSwitch.Value.Contains(order.OPID.ToString()))))
{
await _repCtn.DeleteAsync(x => x.BILLID == bookId);

@ -26,14 +26,14 @@ namespace Myshipping.Application
/// 第三方系统编号
/// </summary>
public virtual string BSNO { get; set; }
/// <summary>
/// 业务状态
/// </summary>
public virtual string BSSTATUS { get; set; }
/// <summary>
/// 业务开始日期
/// </summary>
@ -49,7 +49,7 @@ namespace Myshipping.Application
/// 主提单号
/// </summary>
public virtual string MBLNO { get; set; }
/// <summary>
/// 分提单号
/// </summary>
@ -59,65 +59,65 @@ namespace Myshipping.Application
/// 业务编号
/// </summary>
public virtual string BOOKINGNO { get; set; }
/// <summary>
/// 合约号
/// </summary>
public virtual string CONTRACTNO { get; set; }
/// <summary>
/// 客户合同号
/// </summary>
public virtual string SERVICECONTRACTNO { get; set; }
/// <summary>
/// 发货人
/// </summary>
public virtual string SHIPPER { get; set; }
/// <summary>
/// 收货人
/// </summary>
public virtual string CONSIGNEE { get; set; }
/// <summary>
/// 通知人
/// </summary>
public virtual string NOTIFYPARTY { get; set; }
/// <summary>
/// 第二通知人
/// </summary>
public virtual string NOTIFYPARTY2 { get; set; }
/// <summary>
/// 场站代码
/// </summary>
public virtual string YARDID { get; set; }
/// <summary>
/// 船舶呼号
/// </summary>
public virtual string VESSELID { get; set; }
/// <summary>
/// 船名
/// </summary>
public virtual string VESSEL { get; set; }
/// <summary>
/// 海关航次
/// </summary>
public virtual string VOYNO { get; set; }
/// <summary>
/// 内部航次
/// </summary>
public virtual string VOYNOINNER { get; set; }
/// <summary>
/// 开船日期开始
/// </summary>
@ -172,70 +172,70 @@ namespace Myshipping.Application
/// </summary>
public virtual DateTime? EETA { get; set; }
/// <summary>
/// 收货地
/// </summary>
public virtual string PLACERECEIPT { get; set; }
/// <summary>
/// 起运港代码
/// </summary>
public virtual string PORTLOADID { get; set; }
/// <summary>
/// 起运港
/// </summary>
public virtual string PORTLOAD { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public virtual string PORTDISCHARGEID { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public virtual string PORTDISCHARGE { get; set; }
/// <summary>
/// 交货地代码
/// </summary>
public virtual string PLACEDELIVERYID { get; set; }
/// <summary>
/// 交货地
/// </summary>
public virtual string PLACEDELIVERY { get; set; }
/// <summary>
/// 目的地代码
/// </summary>
public virtual string DESTINATIONID { get; set; }
/// <summary>
/// 目的地
/// </summary>
public virtual string DESTINATION { get; set; }
/// <summary>
/// 提单份数
/// </summary>
public virtual string NOBILL { get; set; }
/// <summary>
/// 副本提单份数
/// </summary>
public virtual string COPYNOBILLL { get; set; }
/// <summary>
/// 签单方式
/// </summary>
public virtual string ISSUETYPE { get; set; }
/// <summary>
/// 签单日期
/// </summary>
@ -248,142 +248,142 @@ namespace Myshipping.Application
/// 签单地点代码
/// </summary>
public virtual string ISSUEPLACEID { get; set; }
/// <summary>
/// 签单地点
/// </summary>
public virtual string ISSUEPLACE { get; set; }
/// <summary>
/// 付费方式
/// </summary>
public virtual string BLFRT { get; set; }
/// <summary>
/// 预付地点
/// </summary>
public virtual string PREPARDAT { get; set; }
/// <summary>
/// 到付地点
/// </summary>
public virtual string PAYABLEAT { get; set; }
/// <summary>
/// 运输条款
/// </summary>
public virtual string SERVICE { get; set; }
/// <summary>
/// 唛头
/// </summary>
public virtual string MARKS { get; set; }
/// <summary>
/// HS代码
/// </summary>
public virtual string HSCODE { get; set; }
/// <summary>
/// 货描
/// </summary>
public virtual string DESCRIPTION { get; set; }
/// <summary>
/// 件数
/// </summary>
public virtual int PKGS { get; set; }
/// <summary>
/// 包装
/// </summary>
public virtual string KINDPKGS { get; set; }
/// <summary>
/// 毛重
/// </summary>
public virtual decimal KGS { get; set; }
/// <summary>
/// 尺码
/// </summary>
public virtual decimal CBM { get; set; }
/// <summary>
/// 件数大写
/// </summary>
public virtual string TOTALNO { get; set; }
/// <summary>
/// 集装箱
/// </summary>
public virtual string CNTRTOTAL { get; set; }
/// <summary>
/// 船公司代号
/// </summary>
public virtual string CARRIERID { get; set; }
/// <summary>
/// 船公司
/// </summary>
public virtual string CARRIER { get; set; }
/// <summary>
/// 货物标识
/// </summary>
public virtual string CARGOID { get; set; }
/// <summary>
/// 危险品类别
/// </summary>
public virtual string DCLASS { get; set; }
/// <summary>
/// 危险品编号
/// </summary>
public virtual string DUNNO { get; set; }
/// <summary>
/// 危险品页号
/// </summary>
public virtual string DPAGE { get; set; }
/// <summary>
/// 危险品标签
/// </summary>
public virtual string DLABEL { get; set; }
/// <summary>
/// 危险品联系人
/// </summary>
public virtual string LINKMAN { get; set; }
/// <summary>
/// 温度单位
/// </summary>
public virtual string TEMPID { get; set; }
/// <summary>
/// 设置温度
/// </summary>
public virtual string TEMPSET { get; set; }
/// <summary>
/// 通风度
/// </summary>
public virtual string REEFERF { get; set; }
/// <summary>
/// 湿度
/// </summary>
public virtual string HUMIDITY { get; set; }
/// <summary>
/// 最低温度
/// </summary>
public virtual string TEMPMIN { get; set; }
/// <summary>
/// 最高温度
/// </summary>
@ -398,312 +398,312 @@ namespace Myshipping.Application
/// SO备注
/// </summary>
public virtual string SOREMARK { get; set; }
/// <summary>
/// SI备注
/// </summary>
public virtual string SIREMARK { get; set; }
/// <summary>
/// 场站备注
/// </summary>
public virtual string YARDREMARK { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public virtual string COMPID { get; set; }
/// <summary>
/// 公司名称
/// </summary>
public virtual string COMPNAME { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
public virtual string SHIPPERNAME { get; set; }
/// <summary>
/// 发货人地址1
/// </summary>
public virtual string SHIPPERADDR1 { get; set; }
/// <summary>
/// 发货人地址2
/// </summary>
public virtual string SHIPPERADDR2 { get; set; }
/// <summary>
/// 发货人地址3
/// </summary>
public virtual string SHIPPERADDR3 { get; set; }
/// <summary>
/// 发货人城市
/// </summary>
public virtual string SHIPPERCITY { get; set; }
/// <summary>
/// 发货人省份代码
/// </summary>
public virtual string SHIPPERPROVINCE { get; set; }
/// <summary>
/// 发货人邮编
/// </summary>
public virtual string SHIPPERPOSTCODE { get; set; }
/// <summary>
/// 发货人国家代码
/// </summary>
public virtual string SHIPPERCOUNTRY { get; set; }
/// <summary>
/// 发货人联系人
/// </summary>
public virtual string SHIPPERATTN { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public virtual string SHIPPERTEL { get; set; }
/// <summary>
/// 发货人名称
/// </summary>
public virtual string CONSIGNEENAME { get; set; }
/// <summary>
/// 发货人地址1
/// </summary>
public virtual string CONSIGNEEADDR1 { get; set; }
/// <summary>
/// 发货人地址2
/// </summary>
public virtual string CONSIGNEEADDR2 { get; set; }
/// <summary>
/// 发货人地址3
/// </summary>
public virtual string CONSIGNEEADDR3 { get; set; }
/// <summary>
/// 发货人城市
/// </summary>
public virtual string CONSIGNEECITY { get; set; }
/// <summary>
/// 发货人省份代码
/// </summary>
public virtual string CONSIGNEEPROVINCE { get; set; }
/// <summary>
/// 发货人邮编
/// </summary>
public virtual string CONSIGNEEPOSTCODE { get; set; }
/// <summary>
/// 发货人国家代码
/// </summary>
public virtual string CONSIGNEERCOUNTRY { get; set; }
/// <summary>
/// 发货人联系人
/// </summary>
public virtual string CONSIGNEEATTN { get; set; }
/// <summary>
/// 发货人电话
/// </summary>
public virtual string CONSIGNEETEL { get; set; }
/// <summary>
/// 通知人名称
/// </summary>
public virtual string NOTIFYPARTYNAME { get; set; }
/// <summary>
/// 通知人地址1
/// </summary>
public virtual string NOTIFYPARTYADDR1 { get; set; }
/// <summary>
/// 通知人地址2
/// </summary>
public virtual string NOTIFYPARTYADDR2 { get; set; }
/// <summary>
/// 通知人地址3
/// </summary>
public virtual string NOTIFYPARTYADDR3 { get; set; }
/// <summary>
/// 通知人城市
/// </summary>
public virtual string NOTIFYPARTYCITY { get; set; }
/// <summary>
/// 通知人省份代码
/// </summary>
public virtual string NOTIFYPARTYPROVINCE { get; set; }
/// <summary>
/// 通知人邮编
/// </summary>
public virtual string NOTIFYPARTYPOSTCODE { get; set; }
/// <summary>
/// 通知人国家代码
/// </summary>
public virtual string NOTIFYPARTYCOUNTRY { get; set; }
/// <summary>
/// 通知人联系人
/// </summary>
public virtual string NOTIFYPARTYATTN { get; set; }
/// <summary>
/// 通知人电话
/// </summary>
public virtual string NOTIFYPARTYTEL { get; set; }
/// <summary>
/// PO号
/// </summary>
public virtual string PONO { get; set; }
/// <summary>
/// 操作id
/// </summary>
public virtual string OPID { get; set; }
/// <summary>
/// 单证id
/// </summary>
public virtual string DOCID { get; set; }
/// <summary>
/// 操作
/// </summary>
public virtual string OP { get; set; }
/// <summary>
/// 单证
/// </summary>
public virtual string DOC { get; set; }
/// <summary>
/// 销售ID
/// </summary>
public virtual string SALEID { get; set; }
/// <summary>
/// 销售
/// </summary>
public virtual string SALE { get; set; }
/// <summary>
/// 客服ID
/// </summary>
public virtual string CUSTSERVICEID { get; set; }
/// <summary>
/// 客服
/// </summary>
public virtual string CUSTSERVICE { get; set; }
/// <summary>
/// 客户
/// </summary>
public virtual string CUSTOMERNAME { get; set; }
/// <summary>
/// 订舱代理
/// </summary>
public virtual string FORWARDER { get; set; }
/// <summary>
/// 船代
/// </summary>
public virtual string SHIPAGENCY { get; set; }
/// <summary>
/// 报关行
/// </summary>
public virtual string CUSTOMSER { get; set; }
/// <summary>
/// 车队
/// </summary>
public virtual string TRUCKER { get; set; }
/// <summary>
/// 国外代理
/// </summary>
public virtual string AGENTID { get; set; }
/// <summary>
/// 客户ID
/// </summary>
public virtual long? CUSTOMERID { get; set; }
/// <summary>
/// 订舱代理ID
/// </summary>
public virtual string FORWARDERID { get; set; }
/// <summary>
/// 船代ID
/// </summary>
public virtual string SHIPAGENCYID { get; set; }
/// <summary>
/// 报关行ID
/// </summary>
public virtual string CUSTOMSERID { get; set; }
/// <summary>
/// 车队ID
/// </summary>
public virtual string TRUCKERID { get; set; }
/// <summary>
/// 国外代理名称
/// </summary>
public virtual string AGENTNAME { get; set; }
/// <summary>
/// 委托方
/// </summary>
public virtual string WEITUO { get; set; }
/// <summary>
/// 收货人DOOR地址
/// </summary>
public virtual string CONSIGNEEDOORADDR { get; set; }
/// <summary>
/// 发货人DOOR地址
/// </summary>
public virtual string SHIPPERDOORADDR { get; set; }
/// <summary>
/// SCAC代码
/// </summary>
public virtual string SCACCODE { get; set; }
/// <summary>
/// ITN编号
/// </summary>
public virtual string ITNCODE { get; set; }
/// <summary>
/// 预付地点ID
/// </summary>
public virtual string PREPARDATID { get; set; }
/// <summary>
/// 到付地点ID
/// </summary>
@ -713,17 +713,17 @@ namespace Myshipping.Application
/// 订舱编号
/// </summary>
public virtual string CUSTNO { get; set; }
/// <summary>
/// 中转港代码
/// </summary>
public virtual string TRANSPORTID { get; set; }
/// <summary>
/// 中转港
/// </summary>
public virtual string TRANSPORT { get; set; }
/// <summary>
/// 第三付款地
/// </summary>
@ -738,12 +738,12 @@ namespace Myshipping.Application
/// 场站联系人电话
/// </summary>
public virtual string YARDCONTRACTTEL { get; set; }
/// <summary>
/// 场站联系人邮箱
/// </summary>
public virtual string YARDCONTRACTEMAIL { get; set; }
/// <summary>
/// 费用自结
/// </summary>
@ -758,7 +758,7 @@ namespace Myshipping.Application
/// 航线名称(船公司)
/// </summary>
public virtual string LANENAME { get; set; }
/// <summary>
/// 付款方
/// </summary>
@ -835,19 +835,32 @@ namespace Myshipping.Application
public long? OrgOp { get; set; }
}
public class AddBookingOrderInput : BookingOrderDto
public class SaveBookingOrderInput : BookingOrderDto
{
/// <summary>
/// 新建单据时,上传的未关联到订舱数据的临时附件
/// </summary>
public List<BookingFileTempDto> TempFiles { get; set; }
}
public class UpdateBookingOrderInput : BookingOrderDto
/// <summary>
/// 订舱临时文件dto
/// </summary>
public class BookingFileTempDto
{
/// <summary>
/// 上传文件时返回的文件名称(带临时路径)
/// </summary>
public string TempPathName { get; set; }
}
/// <summary>
/// 文件类型代码
/// </summary>
public string TypeCode { get; set; }
/// <summary>
/// 文件类型名
/// </summary>
public string TypeName { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// Ocr上传后返回
/// </summary>
public class OcrUploadOutputDto
{
/// <summary>
/// OCR返回文件名后面调用OCR获取内容时使用
/// </summary>
public string OcrFileName { get; set; }
/// <summary>
/// 上传附件的文件名
/// </summary>
public string UploadFileName { get; set; }
}
}

@ -23,7 +23,7 @@ namespace Myshipping.Application
Task AddRemark(BookingRemarkDto dto);
Task AddFile(IFormFile file, [FromForm] BookingFileDto dto);
Task<string> AddFile(IFormFile file, [FromForm] BookingFileDto dto);
Task<List<BookingFile>> GetFile(long Id);

Loading…
Cancel
Save