|
|
|
@ -27,12 +27,23 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("未传入正确参数!"));
|
|
|
|
|
}
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var userKey = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var userPwd = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var userId = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userKey = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userPwd = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userId = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var reqUrl = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "request_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var resUrl = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "response_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
|
|
|
|
|
var account = seaComService.GetCodeThirdParty("BillTraceSubcribe", user.UserId, tenantDb);
|
|
|
|
|
|
|
|
|
|
if (account.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("未配置运踪订阅第三方账号信息!"));
|
|
|
|
|
}
|
|
|
|
|
if (account.AppSecret.IsNull()|| account.AppKey.IsNull()|| account.RegistContractName.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("请检查运踪订阅第三方账号关键参数!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BillTraceMain billdto = new BillTraceMain();
|
|
|
|
|
List<BillTraceReq> billTraceList = new List<BillTraceReq>();
|
|
|
|
|
foreach (var item in req)
|
|
|
|
@ -70,13 +81,27 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed($"场站代号配置未找到:{yardCode}"));
|
|
|
|
|
}
|
|
|
|
|
//var carrierMap = tenantDb.Queryable<MappingYard>().Where(x => x.Code == yardCode && x.Module == "BillTrace").First();
|
|
|
|
|
//if (yardMap.IsNull())
|
|
|
|
|
//{
|
|
|
|
|
// return await Task.FromResult(DataResult<string>.Failed($"船公司代号配置未找到:{yardCode}"));
|
|
|
|
|
//}
|
|
|
|
|
var carrierName =string.Empty;
|
|
|
|
|
if (string.IsNullOrEmpty(carrierCode))
|
|
|
|
|
{
|
|
|
|
|
carrierName = "";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
carrierName = seaComService.GetCarrierMapper(item.CarrierId, tenantDb).MapName;
|
|
|
|
|
}
|
|
|
|
|
billTraceList.Add(new BillTraceReq
|
|
|
|
|
{
|
|
|
|
|
BusinessId = item.BusinessId,
|
|
|
|
|
MBLNO = item.MBLNO,
|
|
|
|
|
YARD = item.Yard == "" ? null : item.Yard,
|
|
|
|
|
YARD = yardMap.MapName,
|
|
|
|
|
YardCode = yardMap.MapCode == "" ? null : yardMap.MapCode,
|
|
|
|
|
CARRIER = item.Carrier == "" ? null : item.Carrier,
|
|
|
|
|
CARRIER = carrierName,
|
|
|
|
|
CARRIERID = carrierCode == "" ? null : carrierCode,
|
|
|
|
|
isBook = item.isBook
|
|
|
|
|
});
|
|
|
|
@ -110,10 +135,10 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
billdto.Children = billTraceList;
|
|
|
|
|
billdto.Key = userKey;
|
|
|
|
|
billdto.PWD = userPwd;
|
|
|
|
|
billdto.Key = account.AppKey;
|
|
|
|
|
billdto.PWD = account.AppSecret;
|
|
|
|
|
billdto.url = resUrl;
|
|
|
|
|
billdto.Gid = userId;
|
|
|
|
|
billdto.Gid = account.RegistContractName;
|
|
|
|
|
billdto.PushBackKey = user.TenantId;//根据回传的租户Id回调
|
|
|
|
|
var json = billdto.ToJsonString();
|
|
|
|
|
|
|
|
|
@ -124,7 +149,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
reqUrl += "/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
reqUrl += "BillTrace/UpdateMblno";
|
|
|
|
|
reqUrl += "BillTrace/SubcribeOrUpdateBilltrace";
|
|
|
|
|
|
|
|
|
|
var result = RequestHelper.Post(postData.ToJsonString(), reqUrl);
|
|
|
|
|
|
|
|
|
@ -136,7 +161,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Success(res.Data));
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Success(res.Data.ToJsonString()));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -152,18 +177,28 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("未传入正确参数!"));
|
|
|
|
|
}
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
var userKey = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var userPwd = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var userId = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userKey = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userKey" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userPwd = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userPwd" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
//var userId = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "seae_billtraceurl_userId" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var reqUrl = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "request_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var resUrl = db.Queryable<SysConfig>().Filter(null, true).Where(x => x.Code == "response_seae_billtraceurl" && x.TenantId == 1288018625843826688).First().Value;
|
|
|
|
|
var account = seaComService.GetCodeThirdParty("BillTraceSubcribe", user.UserId, tenantDb);
|
|
|
|
|
|
|
|
|
|
if (account.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("未配置运踪订阅第三方账号信息!"));
|
|
|
|
|
}
|
|
|
|
|
if (account.AppSecret.IsNull() || account.AppKey.IsNull() || account.RegistContractName.IsNull())
|
|
|
|
|
{
|
|
|
|
|
return await Task.FromResult(DataResult<string>.Failed("请检查运踪订阅第三方账号关键参数!"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BillTraceUnsubscribeDto reqDto = new BillTraceUnsubscribeDto()
|
|
|
|
|
{
|
|
|
|
|
Children = new List<BillTraceUnsubscribeList>(),
|
|
|
|
|
Key = userKey,
|
|
|
|
|
PWD = userPwd,
|
|
|
|
|
Gid = userId,
|
|
|
|
|
Key = account.AppKey,
|
|
|
|
|
PWD = account.AppSecret,
|
|
|
|
|
Gid = account.RegistContractName,
|
|
|
|
|
PushBackKey= user.TenantId,
|
|
|
|
|
};
|
|
|
|
|
foreach (var item in req)
|
|
|
|
@ -191,7 +226,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
var postData = new { msg = json };
|
|
|
|
|
var result = RequestHelper.Post(postData.ToJsonString(), reqUrl);
|
|
|
|
|
|
|
|
|
|
var res = JsonConvert.DeserializeObject<BillTraceRes>(result);
|
|
|
|
|
var res = JsonConvert.DeserializeObject<BillTraceUnsubscribeRes>(result);
|
|
|
|
|
|
|
|
|
|
if (!res.Success)
|
|
|
|
|
{
|
|
|
|
|