|
|
|
@ -270,41 +270,46 @@ namespace djy.Service.Isf
|
|
|
|
|
var fin = new FinanceService();
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<ISF_Master>().Where(x => (x.IsDel == false || x.IsDel == null) && x.CompID == user.CompId && x.GID == oid).ToOne();
|
|
|
|
|
var comlist = DbBus.Get(DbList.AMSCenter).Select<ISF_Company>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == oid).ToList();
|
|
|
|
|
if (msgType == "3"&& master.ReportState == "删单成功")
|
|
|
|
|
if (msgType == "4" && !(master.ReportState == "已删除" || master.MateState == "匹配失败"))
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
if (master.ReportState == "删单成功" && msgType == "3")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "已删除单据不可以再次删除";
|
|
|
|
|
return req;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var gethtml = "";
|
|
|
|
|
if (msgType != "3")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (msgType == "4" && !(master.ReportState == "已删除" || master.MateState == "匹配失败"))
|
|
|
|
|
if (msgType == "1" || msgType == "4")
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
///扣费接口
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
SENDUSERID = user.GID,
|
|
|
|
|
LURURENID = user.GID,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
BSTYPE = 16,
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
}
|
|
|
|
|
, 0);
|
|
|
|
|
if (!getfinrs.Status)
|
|
|
|
|
{
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = getfinrs.Message;
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
//if (msgType == "1" || msgType == "4")
|
|
|
|
|
//{
|
|
|
|
|
// ///扣费接口
|
|
|
|
|
// var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
// {
|
|
|
|
|
// SENDUSERID = user.GID,
|
|
|
|
|
// LURURENID = user.GID,
|
|
|
|
|
// CtnrCount = 1,
|
|
|
|
|
// CtnrInfo = string.Empty,
|
|
|
|
|
// BSTYPE = 16,
|
|
|
|
|
// SENDTYPE = 0,
|
|
|
|
|
// BSNO = oid.ToString(),
|
|
|
|
|
// MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
// }
|
|
|
|
|
// , 0);
|
|
|
|
|
// if (!getfinrs.Status)
|
|
|
|
|
// {
|
|
|
|
|
// req.Code = 201;
|
|
|
|
|
// req.Message = getfinrs.Message;
|
|
|
|
|
// return req;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
var portList = DbBus.Get(DbList.Common).Select<CodePort>().ToList();
|
|
|
|
|
var CodePortLoadList = DbBus.Get(DbList.Common).Select<CodePortLoad>().ToList();
|
|
|
|
|
Info info = new Info();
|
|
|
|
@ -317,49 +322,23 @@ namespace djy.Service.Isf
|
|
|
|
|
info.blTypeCode = master.BlTypeCode;
|
|
|
|
|
info.refId = master.GID;
|
|
|
|
|
|
|
|
|
|
//List<CompanyList> companyList = new List<CompanyList>();
|
|
|
|
|
JArray arr = new JArray();
|
|
|
|
|
List<CompanyList> companyList = new List<CompanyList>();
|
|
|
|
|
foreach (var item in comlist)
|
|
|
|
|
{
|
|
|
|
|
JObject obj = new JObject();
|
|
|
|
|
|
|
|
|
|
if (!item.Address.IsNullOrEmpty())
|
|
|
|
|
obj.Add("address", new JValue($"{item.Address}"));
|
|
|
|
|
if (!item.City.IsNullOrEmpty())
|
|
|
|
|
obj.Add("city", new JValue($"{item.City}"));
|
|
|
|
|
if (!item.CompanyId.IsNullOrEmpty())
|
|
|
|
|
obj.Add("companyId", new JValue($"{item.CompanyId}"));
|
|
|
|
|
if (!item.CompanyName.IsNullOrEmpty())
|
|
|
|
|
obj.Add("companyName", new JValue($"{item.CompanyName}"));
|
|
|
|
|
if (!item.CompanyType.IsNullOrEmpty())
|
|
|
|
|
obj.Add("companyType", new JValue($"{item.CompanyType}"));
|
|
|
|
|
if (!item.CountryCode.IsNullOrEmpty())
|
|
|
|
|
obj.Add("countryCode", new JValue($"{item.CountryCode}"));
|
|
|
|
|
if (!item.HstCode.IsNullOrEmpty())
|
|
|
|
|
obj.Add("hstCode", new JValue($"{item.HstCode}"));
|
|
|
|
|
if (!item.IdTypeCode.IsNullOrEmpty())
|
|
|
|
|
obj.Add("idTypeCode", new JValue($"{item.IdTypeCode}"));
|
|
|
|
|
if (!item.PostCode.IsNullOrEmpty())
|
|
|
|
|
obj.Add("postCode", new JValue($"{item.PostCode}"));
|
|
|
|
|
if (!item.Province.IsNullOrEmpty())
|
|
|
|
|
obj.Add("province", new JValue($"{item.Province}"));
|
|
|
|
|
if (!item.ProvinceCode.IsNullOrEmpty())
|
|
|
|
|
obj.Add("provinceCode", new JValue($"{item.ProvinceCode}"));
|
|
|
|
|
arr.Add(obj);
|
|
|
|
|
//companyList.Add(new CompanyList
|
|
|
|
|
//{
|
|
|
|
|
// companyType = item.CompanyType,
|
|
|
|
|
// companyName = item.CompanyName,
|
|
|
|
|
// idTypeCode = item.IdTypeCode,
|
|
|
|
|
// companyId = item.CompanyId,
|
|
|
|
|
// address = item.Address,
|
|
|
|
|
// city = item.City,
|
|
|
|
|
// province = item.Province,
|
|
|
|
|
// provinceCode = item.ProvinceCode,
|
|
|
|
|
// countryCode = item.CountryCode,
|
|
|
|
|
// postcode = item.PostCode,
|
|
|
|
|
// hstCode = item.HstCode,
|
|
|
|
|
//});
|
|
|
|
|
companyList.Add(new CompanyList
|
|
|
|
|
{
|
|
|
|
|
companyType = item.CompanyType,
|
|
|
|
|
companyName = item.CompanyName,
|
|
|
|
|
idTypeCode = item.IdTypeCode,
|
|
|
|
|
companyId = item.CompanyId,
|
|
|
|
|
address = item.Address,
|
|
|
|
|
city = item.City,
|
|
|
|
|
province = item.Province,
|
|
|
|
|
provinceCode = item.ProvinceCode,
|
|
|
|
|
countryCode = item.CountryCode,
|
|
|
|
|
postcode = item.PostCode,
|
|
|
|
|
hstCode = item.HstCode,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
@ -367,21 +346,13 @@ namespace djy.Service.Isf
|
|
|
|
|
var method = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "ISFMethod").ToOne();
|
|
|
|
|
var key = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSKEY").ToOne();
|
|
|
|
|
var url = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSURL").ToOne();
|
|
|
|
|
///////MD5加密
|
|
|
|
|
//string stringSign = string.Format("companyList={0}&format=json&info={1}&method={2}&msgType={3}×tamp={4}&user_id={5}&version=2.0&key={6}",
|
|
|
|
|
//JsonConvert.SerializeObject(arr), JsonConvert.SerializeObject(info), method.PARAMVALUE, Convert.ToInt32(msgType), timestamp, AMSAccount.PARAMVALUE, key.PARAMVALUE);
|
|
|
|
|
//string sign = stringSign.ToMd5().ToUpper();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/////MD5加密
|
|
|
|
|
string stringSign = string.Format("{0}{1}{2}", AMSAccount.PARAMVALUE, key.PARAMVALUE, timestamp);
|
|
|
|
|
string sign = stringSign.ToMd5();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///post参数
|
|
|
|
|
IsfInfo isfinfo = new IsfInfo();
|
|
|
|
|
isfinfo.companyList = arr;
|
|
|
|
|
isfinfo.companyList = companyList;
|
|
|
|
|
isfinfo.format = "json";
|
|
|
|
|
isfinfo.info = info;
|
|
|
|
|
isfinfo.method = method.PARAMVALUE;
|
|
|
|
@ -390,11 +361,43 @@ namespace djy.Service.Isf
|
|
|
|
|
isfinfo.sign = sign;
|
|
|
|
|
isfinfo.timestamp = timestamp;
|
|
|
|
|
isfinfo.version = "1.0";
|
|
|
|
|
isfinfo.format = "json";
|
|
|
|
|
string json = JsonConvert.SerializeObject(isfinfo);
|
|
|
|
|
_LogsAdd("SendDE", "post", $"ISF接口调用发送{oid}:{json}");
|
|
|
|
|
string gethtml = await HttpHelp.Post(isfinfo, url.PARAMVALUE, PsotType.Json);
|
|
|
|
|
|
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
dic.Add("user_id", AMSAccount.PARAMVALUE);
|
|
|
|
|
dic.Add("method", method.PARAMVALUE);
|
|
|
|
|
dic.Add("format", "json");
|
|
|
|
|
dic.Add("sign", sign);
|
|
|
|
|
dic.Add("timestamp", timestamp);
|
|
|
|
|
dic.Add("version", "1.0");
|
|
|
|
|
dic.Add("data", json);
|
|
|
|
|
gethtml = await HttpHelp.Post(dic, url.PARAMVALUE, PsotType.Urlencoded);
|
|
|
|
|
|
|
|
|
|
_LogsAdd("SendDE", "post", $"ISF接口调用返回{oid}:{gethtml}");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
var AMSAccount = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSAccount").ToOne();
|
|
|
|
|
var method = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "ISFMethod").ToOne();
|
|
|
|
|
var key = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSKEY").ToOne();
|
|
|
|
|
var url = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSURL").ToOne();
|
|
|
|
|
|
|
|
|
|
/////MD5加密
|
|
|
|
|
string stringSign = string.Format("{0}{1}{2}", AMSAccount.PARAMVALUE, key.PARAMVALUE, timestamp);
|
|
|
|
|
string sign = stringSign.ToMd5();
|
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
|
dic.Add("user_id", AMSAccount.PARAMVALUE);
|
|
|
|
|
dic.Add("method", method.PARAMVALUE);
|
|
|
|
|
dic.Add("format", "json");
|
|
|
|
|
dic.Add("sign", sign);
|
|
|
|
|
dic.Add("timestamp", timestamp);
|
|
|
|
|
dic.Add("version", "1.0");
|
|
|
|
|
dic.Add("refId", oid);
|
|
|
|
|
gethtml = await HttpHelp.Post(dic, url.PARAMVALUE, PsotType.Urlencoded);
|
|
|
|
|
_LogsAdd("SendDE", "post", $"ISF接口调用返回{oid}:{gethtml}");
|
|
|
|
|
}
|
|
|
|
|
if (gethtml != null)
|
|
|
|
|
{
|
|
|
|
|
JObject rlt = JObject.Parse(gethtml);
|
|
|
|
|