diff --git a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
index 0375043f..1ed1ecd4 100644
--- a/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/BookingOrderService.cs
@@ -660,7 +660,7 @@ namespace Myshipping.Application
///
[HttpPost("/BookingOrder/Save")]
- public async Task Save(BookingOrderDto input)
+ public async Task Save(SaveBookingOrderInput input)
{
if (input == null)
{
@@ -1062,6 +1062,28 @@ namespace Myshipping.Application
ordOut.BookingEDIExt = ediExtEntity.Adapt();
}
await SendBookingOrder(new long[] { main.ParentId == 0 ? Id : (long)main.ParentId });
+
+ //临时文件转正式
+ if (input.TempFiles != null && input.TempFiles.Count > 0)
+ {
+ var optTmp = App.GetOptions();
+ 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
/// 增加订舱附件
///
///
- ///
+ /// 注意,如果是新建单据,BookingId传0
///
[HttpPost("/BookingOrder/AddFile")]
- public async Task AddFile(IFormFile file, [FromForm] BookingFileDto dto)
+ public async Task 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();
+ 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;
}
+
///
/// 获取附件
///
@@ -3217,7 +3260,6 @@ namespace Myshipping.Application
/// 下载文件
///
///
-
[HttpGet("/BookingOrder/Download")]
public async Task Download(long id)
{
@@ -7289,11 +7331,13 @@ namespace Myshipping.Application
/// 上传ocr文件
///
///
- /// 订舱id
+ /// 订舱id(新建的单据传0)
///
[HttpPost("/BookingOrder/OcrUpFile")]
- public async Task OcrUpFile(IFormFile file, long bookingId)
+ public async Task 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);
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs
index 9792b96a..3839e988 100644
--- a/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs
+++ b/Myshipping.Application/Service/BookingOrder/Dto/BookingOrderInput.cs
@@ -26,14 +26,14 @@ namespace Myshipping.Application
/// 第三方系统编号
///
public virtual string BSNO { get; set; }
-
+
///
/// 业务状态
///
public virtual string BSSTATUS { get; set; }
-
-
-
+
+
+
///
/// 业务开始日期
///
@@ -49,7 +49,7 @@ namespace Myshipping.Application
/// 主提单号
///
public virtual string MBLNO { get; set; }
-
+
///
/// 分提单号
///
@@ -59,65 +59,65 @@ namespace Myshipping.Application
/// 业务编号
///
public virtual string BOOKINGNO { get; set; }
-
+
///
/// 合约号
///
public virtual string CONTRACTNO { get; set; }
-
+
///
/// 客户合同号
///
public virtual string SERVICECONTRACTNO { get; set; }
-
+
///
/// 发货人
///
public virtual string SHIPPER { get; set; }
-
+
///
/// 收货人
///
public virtual string CONSIGNEE { get; set; }
-
+
///
/// 通知人
///
public virtual string NOTIFYPARTY { get; set; }
-
+
///
/// 第二通知人
///
public virtual string NOTIFYPARTY2 { get; set; }
-
+
///
/// 场站代码
///
public virtual string YARDID { get; set; }
-
-
-
+
+
+
///
/// 船舶呼号
///
public virtual string VESSELID { get; set; }
-
+
///
/// 船名
///
public virtual string VESSEL { get; set; }
-
+
///
/// 海关航次
///
public virtual string VOYNO { get; set; }
-
+
///
/// 内部航次
///
public virtual string VOYNOINNER { get; set; }
-
+
///
/// 开船日期开始
///
@@ -172,70 +172,70 @@ namespace Myshipping.Application
///
public virtual DateTime? EETA { get; set; }
-
-
+
+
///
/// 收货地
///
public virtual string PLACERECEIPT { get; set; }
-
+
///
/// 起运港代码
///
public virtual string PORTLOADID { get; set; }
-
+
///
/// 起运港
///
public virtual string PORTLOAD { get; set; }
-
+
///
/// 卸货港代码
///
public virtual string PORTDISCHARGEID { get; set; }
-
+
///
/// 卸货港
///
public virtual string PORTDISCHARGE { get; set; }
-
+
///
/// 交货地代码
///
public virtual string PLACEDELIVERYID { get; set; }
-
+
///
/// 交货地
///
public virtual string PLACEDELIVERY { get; set; }
-
+
///
/// 目的地代码
///
public virtual string DESTINATIONID { get; set; }
-
+
///
/// 目的地
///
public virtual string DESTINATION { get; set; }
-
+
///
/// 提单份数
///
public virtual string NOBILL { get; set; }
-
+
///
/// 副本提单份数
///
public virtual string COPYNOBILLL { get; set; }
-
+
///
/// 签单方式
///
public virtual string ISSUETYPE { get; set; }
-
+
///
/// 签单日期
///
@@ -248,142 +248,142 @@ namespace Myshipping.Application
/// 签单地点代码
///
public virtual string ISSUEPLACEID { get; set; }
-
+
///
/// 签单地点
///
public virtual string ISSUEPLACE { get; set; }
-
+
///
/// 付费方式
///
public virtual string BLFRT { get; set; }
-
+
///
/// 预付地点
///
public virtual string PREPARDAT { get; set; }
-
+
///
/// 到付地点
///
public virtual string PAYABLEAT { get; set; }
-
+
///
/// 运输条款
///
public virtual string SERVICE { get; set; }
-
+
///
/// 唛头
///
public virtual string MARKS { get; set; }
-
+
///
/// HS代码
///
public virtual string HSCODE { get; set; }
-
+
///
/// 货描
///
public virtual string DESCRIPTION { get; set; }
-
+
///
/// 件数
///
public virtual int PKGS { get; set; }
-
+
///
/// 包装
///
public virtual string KINDPKGS { get; set; }
-
+
///
/// 毛重
///
public virtual decimal KGS { get; set; }
-
+
///
/// 尺码
///
public virtual decimal CBM { get; set; }
-
+
///
/// 件数大写
///
public virtual string TOTALNO { get; set; }
-
+
///
/// 集装箱
///
public virtual string CNTRTOTAL { get; set; }
-
+
///
/// 船公司代号
///
public virtual string CARRIERID { get; set; }
-
+
///
/// 船公司
///
public virtual string CARRIER { get; set; }
-
+
///
/// 货物标识
///
public virtual string CARGOID { get; set; }
-
+
///
/// 危险品类别
///
public virtual string DCLASS { get; set; }
-
+
///
/// 危险品编号
///
public virtual string DUNNO { get; set; }
-
+
///
/// 危险品页号
///
public virtual string DPAGE { get; set; }
-
+
///
/// 危险品标签
///
public virtual string DLABEL { get; set; }
-
+
///
/// 危险品联系人
///
public virtual string LINKMAN { get; set; }
-
+
///
/// 温度单位
///
public virtual string TEMPID { get; set; }
-
+
///
/// 设置温度
///
public virtual string TEMPSET { get; set; }
-
+
///
/// 通风度
///
public virtual string REEFERF { get; set; }
-
+
///
/// 湿度
///
public virtual string HUMIDITY { get; set; }
-
+
///
/// 最低温度
///
public virtual string TEMPMIN { get; set; }
-
+
///
/// 最高温度
///
@@ -398,312 +398,312 @@ namespace Myshipping.Application
/// SO备注
///
public virtual string SOREMARK { get; set; }
-
+
///
/// SI备注
///
public virtual string SIREMARK { get; set; }
-
+
///
/// 场站备注
///
public virtual string YARDREMARK { get; set; }
-
+
///
/// 公司ID
///
public virtual string COMPID { get; set; }
-
+
///
/// 公司名称
///
public virtual string COMPNAME { get; set; }
-
+
///
/// 发货人名称
///
public virtual string SHIPPERNAME { get; set; }
-
+
///
/// 发货人地址1
///
public virtual string SHIPPERADDR1 { get; set; }
-
+
///
/// 发货人地址2
///
public virtual string SHIPPERADDR2 { get; set; }
-
+
///
/// 发货人地址3
///
public virtual string SHIPPERADDR3 { get; set; }
-
+
///
/// 发货人城市
///
public virtual string SHIPPERCITY { get; set; }
-
+
///
/// 发货人省份代码
///
public virtual string SHIPPERPROVINCE { get; set; }
-
+
///
/// 发货人邮编
///
public virtual string SHIPPERPOSTCODE { get; set; }
-
+
///
/// 发货人国家代码
///
public virtual string SHIPPERCOUNTRY { get; set; }
-
+
///
/// 发货人联系人
///
public virtual string SHIPPERATTN { get; set; }
-
+
///
/// 发货人电话
///
public virtual string SHIPPERTEL { get; set; }
-
+
///
/// 发货人名称
///
public virtual string CONSIGNEENAME { get; set; }
-
+
///
/// 发货人地址1
///
public virtual string CONSIGNEEADDR1 { get; set; }
-
+
///
/// 发货人地址2
///
public virtual string CONSIGNEEADDR2 { get; set; }
-
+
///
/// 发货人地址3
///
public virtual string CONSIGNEEADDR3 { get; set; }
-
+
///
/// 发货人城市
///
public virtual string CONSIGNEECITY { get; set; }
-
+
///
/// 发货人省份代码
///
public virtual string CONSIGNEEPROVINCE { get; set; }
-
+
///
/// 发货人邮编
///
public virtual string CONSIGNEEPOSTCODE { get; set; }
-
+
///
/// 发货人国家代码
///
public virtual string CONSIGNEERCOUNTRY { get; set; }
-
+
///
/// 发货人联系人
///
public virtual string CONSIGNEEATTN { get; set; }
-
+
///
/// 发货人电话
///
public virtual string CONSIGNEETEL { get; set; }
-
+
///
/// 通知人名称
///
public virtual string NOTIFYPARTYNAME { get; set; }
-
+
///
/// 通知人地址1
///
public virtual string NOTIFYPARTYADDR1 { get; set; }
-
+
///
/// 通知人地址2
///
public virtual string NOTIFYPARTYADDR2 { get; set; }
-
+
///
/// 通知人地址3
///
public virtual string NOTIFYPARTYADDR3 { get; set; }
-
+
///
/// 通知人城市
///
public virtual string NOTIFYPARTYCITY { get; set; }
-
+
///
/// 通知人省份代码
///
public virtual string NOTIFYPARTYPROVINCE { get; set; }
-
+
///
/// 通知人邮编
///
public virtual string NOTIFYPARTYPOSTCODE { get; set; }
-
+
///
/// 通知人国家代码
///
public virtual string NOTIFYPARTYCOUNTRY { get; set; }
-
+
///
/// 通知人联系人
///
public virtual string NOTIFYPARTYATTN { get; set; }
-
+
///
/// 通知人电话
///
public virtual string NOTIFYPARTYTEL { get; set; }
-
+
///
/// PO号
///
public virtual string PONO { get; set; }
-
+
///
/// 操作id
///
public virtual string OPID { get; set; }
-
+
///
/// 单证id
///
public virtual string DOCID { get; set; }
-
+
///
/// 操作
///
public virtual string OP { get; set; }
-
+
///
/// 单证
///
public virtual string DOC { get; set; }
-
+
///
/// 销售ID
///
public virtual string SALEID { get; set; }
-
+
///
/// 销售
///
public virtual string SALE { get; set; }
-
+
///
/// 客服ID
///
public virtual string CUSTSERVICEID { get; set; }
-
+
///
/// 客服
///
public virtual string CUSTSERVICE { get; set; }
-
+
///
/// 客户
///
public virtual string CUSTOMERNAME { get; set; }
-
+
///
/// 订舱代理
///
public virtual string FORWARDER { get; set; }
-
+
///
/// 船代
///
public virtual string SHIPAGENCY { get; set; }
-
+
///
/// 报关行
///
public virtual string CUSTOMSER { get; set; }
-
+
///
/// 车队
///
public virtual string TRUCKER { get; set; }
-
+
///
/// 国外代理
///
public virtual string AGENTID { get; set; }
-
+
///
/// 客户ID
///
public virtual long? CUSTOMERID { get; set; }
-
+
///
/// 订舱代理ID
///
public virtual string FORWARDERID { get; set; }
-
+
///
/// 船代ID
///
public virtual string SHIPAGENCYID { get; set; }
-
+
///
/// 报关行ID
///
public virtual string CUSTOMSERID { get; set; }
-
+
///
/// 车队ID
///
public virtual string TRUCKERID { get; set; }
-
+
///
/// 国外代理名称
///
public virtual string AGENTNAME { get; set; }
-
+
///
/// 委托方
///
public virtual string WEITUO { get; set; }
-
+
///
/// 收货人DOOR地址
///
public virtual string CONSIGNEEDOORADDR { get; set; }
-
+
///
/// 发货人DOOR地址
///
public virtual string SHIPPERDOORADDR { get; set; }
-
+
///
/// SCAC代码
///
public virtual string SCACCODE { get; set; }
-
+
///
/// ITN编号
///
public virtual string ITNCODE { get; set; }
-
+
///
/// 预付地点ID
///
public virtual string PREPARDATID { get; set; }
-
+
///
/// 到付地点ID
///
@@ -713,17 +713,17 @@ namespace Myshipping.Application
/// 订舱编号
///
public virtual string CUSTNO { get; set; }
-
+
///
/// 中转港代码
///
public virtual string TRANSPORTID { get; set; }
-
+
///
/// 中转港
///
public virtual string TRANSPORT { get; set; }
-
+
///
/// 第三付款地
///
@@ -738,12 +738,12 @@ namespace Myshipping.Application
/// 场站联系人电话
///
public virtual string YARDCONTRACTTEL { get; set; }
-
+
///
/// 场站联系人邮箱
///
public virtual string YARDCONTRACTEMAIL { get; set; }
-
+
///
/// 费用自结
///
@@ -758,7 +758,7 @@ namespace Myshipping.Application
/// 航线名称(船公司)
///
public virtual string LANENAME { get; set; }
-
+
///
/// 付款方
///
@@ -835,19 +835,32 @@ namespace Myshipping.Application
public long? OrgOp { get; set; }
}
- public class AddBookingOrderInput : BookingOrderDto
+ public class SaveBookingOrderInput : BookingOrderDto
{
-
+ ///
+ /// 新建单据时,上传的未关联到订舱数据的临时附件
+ ///
+ public List TempFiles { get; set; }
}
-
-
- public class UpdateBookingOrderInput : BookingOrderDto
+ ///
+ /// 订舱临时文件dto
+ ///
+ public class BookingFileTempDto
{
-
-
+ ///
+ /// 上传文件时返回的文件名称(带临时路径)
+ ///
+ public string TempPathName { get; set; }
- }
+ ///
+ /// 文件类型代码
+ ///
+ public string TypeCode { get; set; }
-
+ ///
+ /// 文件类型名
+ ///
+ public string TypeName { get; set; }
+ }
}
diff --git a/Myshipping.Application/Service/BookingOrder/Dto/OcrUploadOutputDto.cs b/Myshipping.Application/Service/BookingOrder/Dto/OcrUploadOutputDto.cs
new file mode 100644
index 00000000..5b400837
--- /dev/null
+++ b/Myshipping.Application/Service/BookingOrder/Dto/OcrUploadOutputDto.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Myshipping.Application
+{
+ ///
+ /// Ocr上传后返回
+ ///
+ public class OcrUploadOutputDto
+ {
+ ///
+ /// OCR返回文件名(后面调用OCR获取内容时使用)
+ ///
+ public string OcrFileName { get; set; }
+
+ ///
+ /// 上传附件的文件名
+ ///
+ public string UploadFileName { get; set; }
+ }
+}
diff --git a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
index 7ac579aa..6deb95b8 100644
--- a/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
+++ b/Myshipping.Application/Service/BookingOrder/IBookingOrderService.cs
@@ -23,7 +23,7 @@ namespace Myshipping.Application
Task AddRemark(BookingRemarkDto dto);
- Task AddFile(IFormFile file, [FromForm] BookingFileDto dto);
+ Task AddFile(IFormFile file, [FromForm] BookingFileDto dto);
Task> GetFile(long Id);