|
|
|
@ -141,7 +141,7 @@ namespace Myshipping.Application
|
|
|
|
|
[HttpGet("/BookingOrder/Page")]
|
|
|
|
|
public async Task<dynamic> Page([FromQuery] BookingOrderInput input)
|
|
|
|
|
{
|
|
|
|
|
List<long> userlist = await _right.GetDataScopeList(351064299098181);
|
|
|
|
|
List<long> userlist = await _right.GetDataScopeList(351064299098181);
|
|
|
|
|
//List<long> userlist = await DataFilterExtensions.GetDataScopeIdList();
|
|
|
|
|
var entities = await _rep.AsQueryable().Where(x => x.ParentId == 0)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.BSNO), u => u.BSNO.Contains(input.BSNO))
|
|
|
|
@ -365,9 +365,15 @@ namespace Myshipping.Application
|
|
|
|
|
var groupList = input.ctnInputs.Where(x => x.CTNNUM > 0).GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Sum(gg => gg.CTNNUM)}");
|
|
|
|
|
input.CNTRTOTAL = string.Join(" / ", groupList);
|
|
|
|
|
}
|
|
|
|
|
var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("当前数据已存在,不能重复录入");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var entity = input.Adapt<BookingOrder>();
|
|
|
|
|
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
|
|
|
|
|
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
|
|
|
|
|
await _rep.InsertAsync(entity);
|
|
|
|
|
if (input.ctnInputs != null)
|
|
|
|
|
{
|
|
|
|
@ -473,6 +479,15 @@ namespace Myshipping.Application
|
|
|
|
|
input.CNTRTOTAL = string.Join(" / ", groupList);
|
|
|
|
|
}
|
|
|
|
|
var main = await _rep.AsQueryable().Where(x => x.Id == input.Id).FirstAsync();
|
|
|
|
|
|
|
|
|
|
var et = await _rep.Where(x => x.MBLNO == input.MBLNO && x.TenantId == UserManager.TENANT_ID && x.Id != input.Id).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("当前数据已存在,不能重复录入");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var entity = input.Adapt<BookingOrder>();
|
|
|
|
|
//entity.TOTALNO = NumberToUpper.ToUpper(entity.PKGS == null ? 0 : entity.PKGS);
|
|
|
|
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
|
|
@ -877,9 +892,9 @@ namespace Myshipping.Application
|
|
|
|
|
/// 调用运踪接口
|
|
|
|
|
/// </summary>
|
|
|
|
|
[HttpPost("/BookingOrder/SendTrace")]
|
|
|
|
|
[SqlSugarUnitOfWork]
|
|
|
|
|
public async Task SendTrace(List<BillTraceList> dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (dto == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未传入正确参数!");
|
|
|
|
@ -887,14 +902,32 @@ namespace Myshipping.Application
|
|
|
|
|
var key = _webAccountConfig.GetAccountConfig("seae_billtraceurl", UserManager.UserId).Result;
|
|
|
|
|
if (key == null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("调用运踪接口相关账号未维护!");
|
|
|
|
|
}
|
|
|
|
|
var url = _cache.GetAllDictData().Result;
|
|
|
|
|
BillTraceDto billdto = new BillTraceDto();
|
|
|
|
|
List<BillTraceList> billTraceList = new List<BillTraceList>();
|
|
|
|
|
var dicdatalist = _cache.GetAllDictData().Result;
|
|
|
|
|
foreach (var item in dto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (item.CARRIERID != "")
|
|
|
|
|
{
|
|
|
|
|
var et = _repBookingStatus.Where(x => x.StaCode == "sta_mudigang" && x.BookingId == Convert.ToInt64(item.BusinessId)).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("提单号"+item.MBLNO+"已订阅!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (item.YardCode != "")
|
|
|
|
|
{
|
|
|
|
|
var et = _repBookingStatus.Where(x => x.StaCode == "sta_qiyungang" && x.BookingId == Convert.ToInt64(item.BusinessId)).FirstAsync();
|
|
|
|
|
if (et != null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("提单号" + item.MBLNO + "已订阅!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation("调用运踪接口提单号:" + item.MBLNO + " 调用运踪接口");
|
|
|
|
|
billTraceList.Add(new BillTraceList
|
|
|
|
|
{
|
|
|
|
@ -906,6 +939,46 @@ namespace Myshipping.Application
|
|
|
|
|
CARRIERID = item.CARRIERID == "" ? null : item.CARRIERID,
|
|
|
|
|
isBook = item.isBook
|
|
|
|
|
});
|
|
|
|
|
var bookingStatusLog = new BookingStatusLog();
|
|
|
|
|
bookingStatusLog.BookingId = Convert.ToInt64(item.BusinessId);
|
|
|
|
|
bookingStatusLog.Category = "ship";
|
|
|
|
|
bookingStatusLog.CreatedTime = DateTime.Now;
|
|
|
|
|
if (item.YardCode == "" && item.CARRIERID != "")
|
|
|
|
|
{
|
|
|
|
|
bookingStatusLog.Status = "订阅目的港";
|
|
|
|
|
}
|
|
|
|
|
if (item.YardCode != "" && item.CARRIERID == "")
|
|
|
|
|
{
|
|
|
|
|
bookingStatusLog.Status = "订阅起运港";
|
|
|
|
|
}
|
|
|
|
|
if (item.YardCode != "" && item.CARRIERID != "")
|
|
|
|
|
{
|
|
|
|
|
bookingStatusLog.Status = "订阅起运港,目的港";
|
|
|
|
|
}
|
|
|
|
|
bookingStatusLog.OpTime = DateTime.Now;
|
|
|
|
|
bookingStatusLog.MBLNO = item.MBLNO;
|
|
|
|
|
await _repStatuslog.InsertAsync(bookingStatusLog);
|
|
|
|
|
|
|
|
|
|
if (item.CARRIERID != "")
|
|
|
|
|
{
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
bookingStatus.BookingId = Convert.ToInt64(item.BusinessId);
|
|
|
|
|
bookingStatus.StaCode = "sta_mudigang";
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_mudigang").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
bookingStatus.StaTime = DateTime.Now;
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
}
|
|
|
|
|
if (item.YardCode != "")
|
|
|
|
|
{
|
|
|
|
|
BookingStatus bookingStatus = new BookingStatus();
|
|
|
|
|
bookingStatus.BookingId = Convert.ToInt64(item.BusinessId);
|
|
|
|
|
bookingStatus.StaCode = "sta_qiyungang";
|
|
|
|
|
bookingStatus.StaName = dicdatalist.Where(x => x.Code == "sta_qiyungang").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
bookingStatus.StaTime = DateTime.Now;
|
|
|
|
|
bookingStatus.StaCate = "book_sta_cate_billtrace";
|
|
|
|
|
await _repBookingStatus.InsertAsync(bookingStatus);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
billdto.Children = billTraceList;
|
|
|
|
|
billdto.Key = key.Account;
|
|
|
|
@ -916,11 +989,11 @@ namespace Myshipping.Application
|
|
|
|
|
_logger.LogInformation("调用运踪接口发送josn:" + json);
|
|
|
|
|
var html = await url.FirstOrDefault(x => x.TypeCode == "url_set" && x.Code == "request_seae_billtraceurl").Value.SetHttpMethod(HttpMethod.Post).SetQueries(new { msg = json }).SetRetryPolicy(3, 5000).SendAsAsync<RespCommon>();
|
|
|
|
|
_logger.LogInformation("调用运踪接口返回" + html.ToJsonString());
|
|
|
|
|
if (html.Success!=true) {
|
|
|
|
|
_logger.LogError("调用运踪接口发送josn:" + json);
|
|
|
|
|
if (html.Success != true)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogError("调用运踪接口返回:" + html.ToJsonString());
|
|
|
|
|
throw Oops.Bah(html.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|