|
|
|
@ -6072,6 +6072,92 @@ namespace Myshipping.Application
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 即时刷新船期
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Id"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<dynamic> RefreshSailingDate(long Id)
|
|
|
|
|
{
|
|
|
|
|
var order = _rep.FirstOrDefault(x => x.Id == Id);
|
|
|
|
|
if (string.IsNullOrEmpty(order.MBLNO))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("提单号为空");
|
|
|
|
|
}
|
|
|
|
|
var url = _cache.GetAllDictData().Result.Where(x => x.Code == "billTraceYgtUrl").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
if (string.IsNullOrEmpty(url))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("未获取到请求URL,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var key = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserKey").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
if (string.IsNullOrEmpty(key))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("未获取到相关KEY,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var secret = _cache.GetAllSysConfig().Result.Where(x => x.Code == "billTraceNewUserSecret").Select(x => x.Value).FirstOrDefault();
|
|
|
|
|
if (string.IsNullOrEmpty(secret))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
throw Oops.Bah("未获取到相关SECRET,请联系管理员!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
JObject jobjSend = new JObject();
|
|
|
|
|
jobjSend.Add("user_key", new JValue(key));
|
|
|
|
|
jobjSend.Add("user_secret", new JValue(secret));
|
|
|
|
|
jobjSend.Add("customer_id", new JValue(order.TenantId));
|
|
|
|
|
jobjSend.Add("customer_name", new JValue(order.TenantName));
|
|
|
|
|
JArray jarrTemps = new JArray();
|
|
|
|
|
JObject jobjTemp = new JObject();
|
|
|
|
|
jobjTemp.Add("bno", new JValue(order.MBLNO));
|
|
|
|
|
jobjTemp.Add("web_code", new JValue("YGT_YZ"));
|
|
|
|
|
jarrTemps.Add(jobjTemp);
|
|
|
|
|
jobjSend.Add("data_list", jarrTemps);
|
|
|
|
|
var rtn = await url.SetHttpMethod(HttpMethod.Post).SetBody(jobjSend.ToJsonString()).PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
JObject jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
var code = jobjRtn.GetValue("code").ToString();
|
|
|
|
|
var msg = jobjRtn.GetValue("msg").ToString();
|
|
|
|
|
|
|
|
|
|
if (code != "200")
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah($"请求爬虫获取【云港通】出错:{msg}");
|
|
|
|
|
}
|
|
|
|
|
JArray jarrData = jobjRtn.GetValue("data") as JArray;
|
|
|
|
|
JObject item = jarrData[0] as JObject;
|
|
|
|
|
|
|
|
|
|
var yjdk_time = item.GetDateTimeValue("yjdk_time");//预计到港时间
|
|
|
|
|
var yjlk_time = item.GetDateTimeValue("yjlk_time");//预计离港时间
|
|
|
|
|
var sjdk_time = item.GetDateTimeValue("sjdk_time");//实际到港时间
|
|
|
|
|
var sjlg_time = item.GetDateTimeValue("sjlg_time");//实际离港时间
|
|
|
|
|
|
|
|
|
|
order.StartETA = yjdk_time;
|
|
|
|
|
order.YgtETD = yjlk_time;
|
|
|
|
|
order.StartATA = sjdk_time;
|
|
|
|
|
order.ATD = sjlg_time;
|
|
|
|
|
await _rep.AsUpdateable(order).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
var list=await _rep.AsQueryable().Filter(null, true).Where(x=>x.IsDeleted==false&&x.TenantId==UserManager.TENANT_ID&&x.CARRIERID==order.CARRIERID&&x.VESSEL==order.VESSEL)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(order.VOYNO), x => x.VOYNO == order.VOYNO)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(order.VOYNOINNER), x => x.VOYNOINNER == order.VOYNOINNER).ToListAsync();
|
|
|
|
|
foreach (var it in list)
|
|
|
|
|
{
|
|
|
|
|
it.StartETA = yjdk_time;
|
|
|
|
|
it.YgtETD = yjlk_time;
|
|
|
|
|
it.StartATA = sjdk_time;
|
|
|
|
|
it.ATD = sjlg_time;
|
|
|
|
|
await _rep.AsUpdateable(it).IgnoreColumns().ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
return order;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 临时测试使用
|
|
|
|
@ -6103,7 +6189,7 @@ namespace Myshipping.Application
|
|
|
|
|
" } " +
|
|
|
|
|
" ] " +
|
|
|
|
|
" } " +
|
|
|
|
|
"} " ;
|
|
|
|
|
"} ";
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|