|
|
|
@ -51,6 +51,7 @@ using System.Threading;
|
|
|
|
|
using Furion.JsonSerialization;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using Myshipping.Application.Helper;
|
|
|
|
|
using System.Net;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
@ -151,7 +152,7 @@ namespace Myshipping.Application
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSELID), u => u.VESSELID.Contains(input.VESSELID))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VESSEL), u => u.VESSEL.ToLower().Contains(u.VESSEL.ToLower()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNO), u => u.VOYNO.Contains(input.VOYNO))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER) )
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.VOYNOINNER), u => u.VOYNOINNER.Contains(input.VOYNOINNER))
|
|
|
|
|
.WhereIF(input.BETD != null, u => u.ETD >= input.BETD)
|
|
|
|
|
.WhereIF(input.EETD != null, u => u.ETD <= input.EETD)
|
|
|
|
|
.WhereIF(input.BATD != null, u => u.ATD >= input.BATD)
|
|
|
|
@ -166,9 +167,9 @@ namespace Myshipping.Application
|
|
|
|
|
.WhereIF(input.BETA != null, u => u.ETA >= input.BETA)
|
|
|
|
|
.WhereIF(input.EETA != null, u => u.ETA <= input.EETA)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACERECEIPT), u => u.PLACERECEIPT.Contains(input.PLACERECEIPT))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD) )
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID== input.PORTLOADID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGEID), u => u.PORTDISCHARGEID==input.PORTDISCHARGEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOAD), u => u.PORTLOAD.Contains(input.PORTLOAD))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTLOADID), u => u.PORTLOADID == input.PORTLOADID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGEID), u => u.PORTDISCHARGEID == input.PORTDISCHARGEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PORTDISCHARGE), u => u.PORTDISCHARGE.Contains(input.PORTDISCHARGE))
|
|
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PLACEDELIVERY), u => u.PLACEDELIVERY.Contains(input.PLACEDELIVERY))
|
|
|
|
@ -193,7 +194,7 @@ namespace Myshipping.Application
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.PAYABLEATID), u => u.PAYABLEATID == input.PAYABLEATID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SERVICE), u => u.SERVICE.Contains(input.SERVICE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.MARKS), u => u.MARKS.Contains(input.MARKS))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE) )
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.HSCODE), u => u.HSCODE.Contains(input.HSCODE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.DESCRIPTION), u => u.DESCRIPTION.Contains(input.DESCRIPTION))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.KINDPKGS), u => u.KINDPKGS == input.KINDPKGS)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CNTRTOTAL), u => u.CNTRTOTAL == input.CNTRTOTAL)
|
|
|
|
@ -216,7 +217,7 @@ namespace Myshipping.Application
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SIREMARK), u => u.SIREMARK.Contains(input.SIREMARK))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.YARDREMARK), u => u.YARDREMARK.Contains(input.YARDREMARK))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPID), u => u.COMPID == input.COMPID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.Contains(input.COMPNAME) )
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.COMPNAME), u => u.COMPNAME.Contains(input.COMPNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERNAME), u => u.SHIPPERNAME.Contains(input.SHIPPERNAME))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERCITY), u => u.SHIPPERCITY.Contains(input.SHIPPERCITY))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SHIPPERPROVINCE), u => u.SHIPPERPROVINCE == input.SHIPPERPROVINCE)
|
|
|
|
@ -248,7 +249,7 @@ namespace Myshipping.Application
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICEID), u => u.CUSTSERVICEID == input.CUSTSERVICEID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE.Contains(input.CUSTSERVICE))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME.Contains(input.CUSTOMERNAME))
|
|
|
|
|
.WhereIF(input.CUSTOMERID != null&& input.CUSTOMERID!=0, u => u.CUSTOMERID == input.CUSTOMERID)
|
|
|
|
|
.WhereIF(input.CUSTOMERID != null && input.CUSTOMERID != 0, u => u.CUSTOMERID == input.CUSTOMERID)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.FORWARDER), u => u.FORWARDER.Contains(input.FORWARDER))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTSERVICE), u => u.CUSTSERVICE == input.CUSTSERVICE)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.CUSTOMERNAME), u => u.CUSTOMERNAME == input.CUSTOMERNAME)
|
|
|
|
@ -326,7 +327,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
var entity = input.Adapt<BookingOrder>();
|
|
|
|
|
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
if (input.ctnInputs != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in input.ctnInputs)
|
|
|
|
@ -501,7 +502,7 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
string _oldvalue = oldvalue != null ? oldvalue.ToString() : "";
|
|
|
|
|
string _value = value != null ? value.ToString() : "";
|
|
|
|
|
if (_oldvalue != _value&&!string.IsNullOrWhiteSpace(descriptor.Description))
|
|
|
|
|
if (_oldvalue != _value && !string.IsNullOrWhiteSpace(descriptor.Description))
|
|
|
|
|
{
|
|
|
|
|
if (flag)
|
|
|
|
|
{
|
|
|
|
@ -522,7 +523,7 @@ namespace Myshipping.Application
|
|
|
|
|
PId = bid,
|
|
|
|
|
Field = descriptor.Description,
|
|
|
|
|
OldValue = _oldvalue,
|
|
|
|
|
NewValue = _value,
|
|
|
|
|
NewValue = _value,
|
|
|
|
|
});
|
|
|
|
|
if (descriptor.Name == "YARDID" || descriptor.Name == "YARD" || descriptor.Name == "MBLNO")
|
|
|
|
|
{
|
|
|
|
@ -592,7 +593,7 @@ namespace Myshipping.Application
|
|
|
|
|
//检索EDI扩展
|
|
|
|
|
var ediExtEntity = await _bookingEDIExt.FirstOrDefaultAsync(u => u.BookingId == Id);
|
|
|
|
|
|
|
|
|
|
if(ediExtEntity != null)
|
|
|
|
|
if (ediExtEntity != null)
|
|
|
|
|
{
|
|
|
|
|
ordOut.BookingEDIExt = ediExtEntity.Adapt<BookingEDIExtDto>();
|
|
|
|
|
}
|
|
|
|
@ -784,7 +785,8 @@ namespace Myshipping.Application
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("提单号:" + MBLNO + " 调用运踪接口");
|
|
|
|
|
var key = _repWebAcc.FirstOrDefault(x => x.TenantId == Convert.ToInt64(UserManager.TENANT_ID) && x.TypeCode == "seae_billtraceurl");
|
|
|
|
|
if (key==null) {
|
|
|
|
|
if (key == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("调用运踪接口相关账号未维护!");
|
|
|
|
|
}
|
|
|
|
@ -1932,7 +1934,7 @@ namespace Myshipping.Application
|
|
|
|
|
primaryModel.CTNGOODSLIST.Add(cargoModel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ediModel.BSLIST.Add(primaryModel);
|
|
|
|
|
|
|
|
|
@ -2196,6 +2198,122 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ocr
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上传ocr文件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="file"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/OcrUpFile")]
|
|
|
|
|
public async Task<string> OcrUpFile(IFormFile file)
|
|
|
|
|
{
|
|
|
|
|
//未上传文件
|
|
|
|
|
if (file == null || file.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未上传文件");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var originalFilename = file.FileName; // 文件原始名称
|
|
|
|
|
var fileSuffix = Path.GetExtension(file.FileName).ToLower(); // 文件后缀
|
|
|
|
|
|
|
|
|
|
var serverUrl = (await _cache.GetAllDictData()).FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "ocr_api_url").Value;
|
|
|
|
|
if (!serverUrl.EndsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
serverUrl += "/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var ms = new MemoryStream();
|
|
|
|
|
await file.CopyToAsync(ms);
|
|
|
|
|
_logger.LogInformation($"调用ocr处理文件{originalFilename}");
|
|
|
|
|
|
|
|
|
|
//Furion框架上传文件名称带有双引号,导致上传失败
|
|
|
|
|
//var strRtn = await $"{serverUrl}pdf/upload"
|
|
|
|
|
// .SetContentType("multipart/form-data")
|
|
|
|
|
// .SetContentEncoding(Encoding.UTF8)
|
|
|
|
|
// .SetBodyBytes(("file", ms.GetBuffer(), "test.pdf"))
|
|
|
|
|
// .PostAsStringAsync();
|
|
|
|
|
//var jobj = strRtn.ToJObject();
|
|
|
|
|
//if (jobj.GetIntValue("code") == 0)
|
|
|
|
|
//{
|
|
|
|
|
// var fn = jobj.GetStringValue("data");
|
|
|
|
|
// return fn;
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// throw Oops.Bah(jobj.GetStringValue("message"));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//使用HttpClient方式上传文件
|
|
|
|
|
ms.Position = 0;
|
|
|
|
|
var formData = new MultipartFormDataContent();
|
|
|
|
|
formData.Add(new StreamContent(ms, (int)ms.Length), "file", originalFilename);
|
|
|
|
|
var _httpclient = new HttpClient();
|
|
|
|
|
var response = await _httpclient.PostAsync($"{serverUrl}pdf/upload", formData);
|
|
|
|
|
if (response.IsSuccessStatusCode)
|
|
|
|
|
{
|
|
|
|
|
var strRtn = response.Content.ReadAsStringAsync().Result;
|
|
|
|
|
var jobj = strRtn.ToJObject();
|
|
|
|
|
if (jobj.GetIntValue("code") == 0)
|
|
|
|
|
{
|
|
|
|
|
var fn = jobj.GetStringValue("data");
|
|
|
|
|
return fn;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(jobj.GetStringValue("message"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("文件上传失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取图片
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fileName">文件名称</param>
|
|
|
|
|
/// <param name="scale">缩放比例,默认为1.5</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/OcrGetImg")]
|
|
|
|
|
public async Task<IActionResult> OcrGetImg(string fileName, float scale = 1.5f)
|
|
|
|
|
{
|
|
|
|
|
var serverUrl = (await _cache.GetAllDictData()).FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "ocr_api_url").Value;
|
|
|
|
|
if (!serverUrl.EndsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
serverUrl += "/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var bs = await $"{serverUrl}pdf/getCanvasImage?fileName={fileName}&scale={scale}"
|
|
|
|
|
.GetAsByteArrayAsync();
|
|
|
|
|
var result = new FileContentResult(bs, "application/octet-stream") { FileDownloadName = "ocr.jpg" };
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取文字
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fileName">文件名称</param>
|
|
|
|
|
/// <param name="scale">缩放比例</param>
|
|
|
|
|
/// <param name="x">x坐标</param>
|
|
|
|
|
/// <param name="y">y坐标</param>
|
|
|
|
|
/// <param name="w">宽度</param>
|
|
|
|
|
/// <param name="h">高度</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingOrder/OcrGetText")]
|
|
|
|
|
public async Task<string> OcrGetText(string fileName, float scale, int x, int y, int w, int h)
|
|
|
|
|
{
|
|
|
|
|
var serverUrl = (await _cache.GetAllDictData()).FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "ocr_api_url").Value;
|
|
|
|
|
if (!serverUrl.EndsWith("/"))
|
|
|
|
|
{
|
|
|
|
|
serverUrl += "/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var str = await $"{serverUrl}pdf/getRegionText?fileName={fileName}&scale={scale}&x={x}&y={y}&w={w}&h={h}"
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
return str;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 其他
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取用户报表的json
|
|
|
|
|