即使刷新

optimize
wet 2 years ago
parent a5b84f0764
commit 8f96371250

@ -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

@ -156,11 +156,9 @@ namespace Myshipping.Application
}
if (entity.PropString.Contains("shipagency"))
{
var ship = await _codeForwarder.AsQueryable().Where(x => x.Code == entity.CodeName).FirstAsync();
if (ship == null)
{
await _codeForwarder.InsertAsync(new CodeForwarder
{
GID = Guid.NewGuid().ToString(),
@ -169,7 +167,6 @@ namespace Myshipping.Application
Code = entity.CodeName,
Name = entity.ShortName
});
}
else
{
@ -181,9 +178,7 @@ namespace Myshipping.Application
await _codeForwarder.UpdateAsync(ship);
}
await _commonDBService.GetAllForwarder(false);
}
}

@ -43,6 +43,7 @@ public class SysCacheService : ISysCacheService, IDynamicApiController, ISinglet
var cacheKey = CommonConst.CACHE_KEY_DATASCOPE + $"{userId}";
return await _cache.GetAsync<List<long>>(cacheKey);
}
/// <summary>
/// 获取数据范围缓存用户Id集合
/// </summary>

@ -27,6 +27,7 @@ public class SysConfigService : ISysConfigService, IDynamicApiController, ITrans
_sysCacheService = sysCacheService;
}
/// <summary>
/// 分页获取系统参数配置
/// </summary>
@ -39,11 +40,12 @@ public class SysConfigService : ISysConfigService, IDynamicApiController, ITrans
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.Code), u => u.Code.Contains(input.Code.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.GroupCode), u => u.GroupCode == input.GroupCode.Trim())
.Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.GroupCode)
.ToPagedListAsync(input.PageNo, input.PageSize);
.Where(u => u.Status != CommonStatus.DELETED).OrderBy(u => u.GroupCode)
.ToPagedListAsync(input.PageNo, input.PageSize);
return configs.XnPagedResult();
}
/// <summary>
/// 获取系统参数配置列表
/// </summary>

Loading…
Cancel
Save