|
|
using DSWeb.Areas.CommMng.Models;
|
|
|
using DSWeb.Areas.OA.Models.WorkFlow;
|
|
|
using DSWeb.Common.DB;
|
|
|
using DSWeb.EntityDA;
|
|
|
using DSWeb.MvcShipping.DAL.MsInfoClient;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
using DSWeb.MvcShipping.Helper;
|
|
|
using DSWeb.MvcShipping.Models.MsCtExplan;
|
|
|
using DSWeb.MvcShipping.Models.MsInfoClient;
|
|
|
using DSWeb.SoftMng.BLL;
|
|
|
using DSWeb.SoftMng.Models.MsInfoClass;
|
|
|
using DSWeb.SoftMng.Models.MsInfoClientItem;
|
|
|
using DSWeb.TruckMng.Helper.Repository;
|
|
|
using HcUtility.Comm;
|
|
|
using HcUtility.Core;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using NPOI.HSSF.UserModel;
|
|
|
using NPOI.SS.UserModel;
|
|
|
using NPOI.XSSF.UserModel;
|
|
|
using Spire.Pdf;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Data.SqlClient;//使用sqlcomm
|
|
|
using System.IO;//用于向数据库中存取图片
|
|
|
using System.Linq;
|
|
|
using System.Net;
|
|
|
using System.Text;
|
|
|
using System.Text.RegularExpressions;
|
|
|
using System.Web;
|
|
|
using System.Web.Mvc;
|
|
|
using System.Security.Cryptography;
|
|
|
using System.Threading;
|
|
|
|
|
|
using DSWeb.Areas.Dispatch.Helper;
|
|
|
using DSWeb.MvcShipping.Models.MsOpBillYj;
|
|
|
using NPOI.SS.Formula.Functions;
|
|
|
using javax.xml.crypto;
|
|
|
using NPOI.OpenXmlFormats.Dml;
|
|
|
using sun.security.jgss;
|
|
|
using Quartz.Util;
|
|
|
using Baidu.Aip;
|
|
|
using AlibabaCloud.SDK.Dingtalkokr_1_0.Models;
|
|
|
using sun.nio.cs.ext;
|
|
|
using System.Xml;
|
|
|
|
|
|
using Org.BouncyCastle.Crypto.Parameters;
|
|
|
using Org.BouncyCastle.Asn1.X509;
|
|
|
using Org.BouncyCastle.X509;
|
|
|
using static DSWeb.Areas.CommMng.DAL.PublicAPIDAL.金识雀Helper;
|
|
|
using static DSWeb.Areas.CommMng.DAL.PublicAPIDAL.泛微OAHelper;
|
|
|
using Org.BouncyCastle.Math;
|
|
|
using Org.BouncyCastle.Pkcs;
|
|
|
using Org.BouncyCastle.Crypto.Generators;
|
|
|
using Org.BouncyCastle.Crypto;
|
|
|
using Org.BouncyCastle.Asn1.Pkcs;
|
|
|
using Org.BouncyCastle.Asn1;
|
|
|
using Org.BouncyCastle.Bcpg;
|
|
|
using Org.BouncyCastle.Security;
|
|
|
using Org.BouncyCastle.Crypto.Encodings;
|
|
|
using Org.BouncyCastle.Crypto.Engines;
|
|
|
using System.ServiceModel.Configuration;
|
|
|
using java.util;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_Payapplication;
|
|
|
|
|
|
namespace DSWeb.Areas.CommMng.DAL
|
|
|
{
|
|
|
public class PublicAPIDAL
|
|
|
{
|
|
|
|
|
|
#region 壹沓科技 ocr识别功能
|
|
|
|
|
|
|
|
|
public static class 金识雀Helper
|
|
|
{
|
|
|
private static bool locked { get; set; } = false;
|
|
|
private static string token { get; set; } = "";
|
|
|
private static DateTime? tokentime { get; set; } = null;
|
|
|
|
|
|
//获取新token
|
|
|
public static void GetNewToken()
|
|
|
{
|
|
|
if (locked) return;
|
|
|
locked = true;
|
|
|
|
|
|
//获取token
|
|
|
try
|
|
|
{
|
|
|
GetBackUrl_gettoken hp = new GetBackUrl_gettoken();
|
|
|
var rp = hp.DoGet();
|
|
|
|
|
|
var data = rp.data;
|
|
|
|
|
|
token = data.accessToken;
|
|
|
|
|
|
tokentime = DateTime.Now.AddSeconds((double)data.expiresIn);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
finally { locked = false; }
|
|
|
}
|
|
|
|
|
|
//获取token
|
|
|
public static void GetToken()
|
|
|
{
|
|
|
//if (string.IsNullOrWhiteSpace(token) || DateTime.Now.AddMinutes(3) > tokentime)
|
|
|
//{
|
|
|
// GetNewToken();
|
|
|
//}
|
|
|
//return token;
|
|
|
|
|
|
|
|
|
GetBackUrl_gettokenByPort hp = new GetBackUrl_gettokenByPort();
|
|
|
var rp = hp.DoGet();
|
|
|
|
|
|
token = rp.data;
|
|
|
|
|
|
//tokentime = DateTime.Now.AddSeconds((double)data.expiresIn);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取前端接入参数
|
|
|
|
|
|
|
|
|
const string 测试cognitionurl = "https://ocr-beta.1datatech.net";
|
|
|
const string 正式cognitionurl = "https://ocr.1datatech.net";
|
|
|
|
|
|
const string 测试UrlHead = "https://jinshique-web-beta.1datatech.net/erpRecog/recordid";
|
|
|
const string 正式UrlHead = " https://jinshique.1datatech.net/erpRecog/recordid";//{}
|
|
|
|
|
|
static string cognitionurl = 测试cognitionurl;
|
|
|
static string UrlHead = 测试UrlHead;
|
|
|
public static string GetUrl_front(string CUSTOMERNAME, string recordId = "")
|
|
|
{
|
|
|
|
|
|
var baseurl = UrlHead;
|
|
|
//var baseurl = 正式UrlHead;
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(recordId))
|
|
|
{
|
|
|
baseurl = baseurl.Replace("/recordid", "");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
baseurl = baseurl.Replace("recordid", recordId);
|
|
|
}
|
|
|
/*
|
|
|
erpCustomSign string 是 即上传文件的客户在对接的 ERP 系统内的标
|
|
|
识,用来区分上传的文件属于 ERP 的哪家客户
|
|
|
sceneId string 是 即识别文档类型,固定值,确认 ERP 文档识别
|
|
|
需求后提供
|
|
|
shpping_order
|
|
|
redirectUrl string 否 校对完成后的重定向链接, 无此链接,则点击
|
|
|
校对完成无跳转 (需通过 JS 中
|
|
|
encodeURIComponent 语法编码)
|
|
|
beacon json 否 ERP 自定义参数, 批量上传需包含 ERP 系统内
|
|
|
的该文件记录 ID(需通过 JS 中
|
|
|
encodeURIComponent 语法编码)
|
|
|
token string 是 通过后端接口获取的 token
|
|
|
*/
|
|
|
GetToken();
|
|
|
|
|
|
var url = baseurl + $"?erpCustomSign={CUSTOMERNAME}&sceneId={"shipping_order"}&redirectUrl&beacon&token={token}";
|
|
|
|
|
|
|
|
|
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
public static ResultResponse GetOcrResult(string recordId)
|
|
|
{
|
|
|
|
|
|
//GetToken();
|
|
|
|
|
|
var result = new ResultResponse();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var hp = new GetResult();
|
|
|
|
|
|
var dic = new Dictionary<string, string>();
|
|
|
|
|
|
if (string.IsNullOrEmpty(token))
|
|
|
{
|
|
|
GetToken();
|
|
|
}
|
|
|
|
|
|
dic.Add("recordId", recordId);
|
|
|
dic.Add("access_token", token);
|
|
|
|
|
|
result = hp.DoGet(dic);
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public abstract class API_URL
|
|
|
{
|
|
|
public string Url { get; set; } = "";
|
|
|
|
|
|
public 金识雀Response response { get; set; }
|
|
|
public static string GetBaseUrl()
|
|
|
{
|
|
|
|
|
|
var baseurl = cognitionurl;
|
|
|
|
|
|
|
|
|
return baseurl;
|
|
|
}
|
|
|
public abstract string GetUrl();
|
|
|
|
|
|
public 金识雀Response DoGet(Dictionary<string, string> dic = null)
|
|
|
{
|
|
|
GetUrl();
|
|
|
var rtn = WebRequestHelper.DoGet(Url);
|
|
|
|
|
|
//临时替换 由于.在识别时报错 临时改为##
|
|
|
|
|
|
//rtn = rtn.Replace(".", "##");
|
|
|
|
|
|
response = JsonConvert.Deserialize<金识雀Response>(rtn);
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class GetBackUrl_gettoken : API_URL
|
|
|
{
|
|
|
|
|
|
public override string GetUrl()
|
|
|
{
|
|
|
|
|
|
//获取appid和secret
|
|
|
var appid = MsSysParamSetDAL.GetSysParamValue("JinShiQueAppid");
|
|
|
var secret = MsSysParamSetDAL.GetSysParamValue("JinShiQueSecret");
|
|
|
|
|
|
Url = GetBaseUrl() + $"/oauth/1.0/token?grant_type=client_credential&appid={appid}&secret={secret}";
|
|
|
return Url;
|
|
|
}
|
|
|
|
|
|
public TokenResponse DoGet()
|
|
|
{
|
|
|
GetUrl();
|
|
|
var rtn = WebRequestHelper.DoGet(Url);
|
|
|
|
|
|
//临时替换 由于.在识别时报错 临时改为##
|
|
|
|
|
|
//rtn = rtn.Replace(".", "##");
|
|
|
|
|
|
var _res = JsonConvert.Deserialize<TokenResponse>(rtn);
|
|
|
|
|
|
return _res;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class GetBackUrl_gettokenByPort : API_URL
|
|
|
{
|
|
|
//20221208 改为使用吴广的接口
|
|
|
/*
|
|
|
url: http://118.190.106.151:5678/v1/ydkj/token
|
|
|
请求方式: post
|
|
|
参数上传方式, json
|
|
|
{
|
|
|
"appid": "RXJXMteB",
|
|
|
"secret": "60cdbead4f05233d5e4fe8638a5178129665fda5"
|
|
|
}
|
|
|
|
|
|
响应示例
|
|
|
{'code': 200, 'data': '[token文本]', 'msg': 'ok', 'request': 'POST /v1/ydkj/token'}
|
|
|
|
|
|
{'code': 1000, 'data': [], 'msg': 'Invalid access key', 'request': 'POST /v1/ydkj/token'}
|
|
|
|
|
|
*/
|
|
|
public override string GetUrl()
|
|
|
{
|
|
|
|
|
|
Url = "http://118.190.106.151:5678/v1/ydkj/token";
|
|
|
return Url;
|
|
|
}
|
|
|
|
|
|
public TokenResponseByPort DoGet()
|
|
|
{
|
|
|
GetUrl();
|
|
|
|
|
|
//获取appid和secret
|
|
|
var appid = MsSysParamSetDAL.GetSysParamValue("JinShiQueAppid");
|
|
|
var secret = MsSysParamSetDAL.GetSysParamValue("JinShiQueSecret");
|
|
|
|
|
|
var appparam = new
|
|
|
{
|
|
|
appid = appid,
|
|
|
secret = secret
|
|
|
};
|
|
|
|
|
|
var rtn = WebRequestHelper.DoPost_Json(Url, appparam);
|
|
|
|
|
|
//临时替换 由于.在识别时报错 临时改为##
|
|
|
|
|
|
//rtn = rtn.Replace(".", "##");
|
|
|
|
|
|
var _res = JsonConvert.Deserialize<TokenResponseByPort>(rtn);
|
|
|
|
|
|
return _res;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class GetResult : API_URL
|
|
|
{
|
|
|
|
|
|
public override string GetUrl()
|
|
|
{
|
|
|
|
|
|
//获取appid和secret
|
|
|
|
|
|
Url = GetBaseUrl() + "/api/recog/v1/proofread/result";
|
|
|
return Url;
|
|
|
}
|
|
|
|
|
|
public ResultResponse DoGet(Dictionary<string, string> dic = null)
|
|
|
{
|
|
|
var _res = new ResultResponse();
|
|
|
try
|
|
|
{
|
|
|
GetUrl();
|
|
|
|
|
|
var rtn = WebRequestHelper.DoGet_Param(Url, dic);
|
|
|
|
|
|
rtn = rtn.Replace("\"PO NO\"", "\"PONO\"");
|
|
|
|
|
|
_res = JsonConvert.Deserialize<ResultResponse>(rtn);
|
|
|
|
|
|
return _res;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
return _res;
|
|
|
}
|
|
|
finally { }
|
|
|
return _res;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class 金识雀Response
|
|
|
{
|
|
|
public int code { get; set; }
|
|
|
public string message { get; set; }
|
|
|
public string data { get; set; }
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
public class TokenData
|
|
|
{
|
|
|
public string accessToken { get; set; }
|
|
|
public long? expiresIn { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
public class TokenResponse : 金识雀Response
|
|
|
{
|
|
|
//public string accessToken { get; internal set; }
|
|
|
public new TokenData data { get; set; }
|
|
|
}
|
|
|
|
|
|
public class TokenResponseByPort : 金识雀Response
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class 箱型箱量
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 箱量 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 箱型 { get; set; }
|
|
|
}
|
|
|
|
|
|
public class CommitResult
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// 山东恩威国际货运代理有限公司
|
|
|
/// </summary>
|
|
|
public string 委托公司 { get; set; }
|
|
|
/// <summary>
|
|
|
/// 恩威小李
|
|
|
/// </summary>
|
|
|
public string 联系人 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
//public int? proofreadUsedTime { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 电话 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 运输条款 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 发货人 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 客户委托编码 { get; set; }
|
|
|
/// <summary>
|
|
|
/// TO: 青岛捷丰储运\nTO:泛海华航FM:恩威小李 0535-6233091\n船期:CMA 10月 12日\n约号:QQGD065967\n提单上显示目的港代理信息,电放提单\n申请目的港14天免费箱使\n甲苯二异氰酸酯 CLASS:6.1 UN NO:2078(无海污)\nHS CODE:29291010\n无副危 闪点:137℃ PGII EMS:F-A,S-A\n我司订舱货物,若港口显示,船期,转运条款,\n航程,挂港,运价等与我司要求不符或船公司\n有特殊要求,请及时通知我司
|
|
|
/// </summary>
|
|
|
public string 备注 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string templateId { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 换列控制符 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public int? recordId { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 邮箱 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 收货地 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 目的港 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 运费条款 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 货描 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string proofreadFrom { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 毛重 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string commitType { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 包装种类 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 收货人 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 通知人 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 船名 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 贸易条款 { get; set; }
|
|
|
/// <summary>
|
|
|
/// (请务必填写中文品名)\n4 X20' 80 MT NET TOLUENE DIISOCYANATE\nTOLUENE DIISOCYANATE,\nCASNO.26471-62-5
|
|
|
/// </summary>
|
|
|
public string 品名 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 航次 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 卸货港 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public List<箱型箱量> 箱型箱量 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 起运港 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 唛头 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 件数 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public DateTime? ETD { get; set; }
|
|
|
/// <summary>
|
|
|
/// 海运托书
|
|
|
/// </summary>
|
|
|
public string templateName { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 交货地 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public long? createTime { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 船公司 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string 体积 { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string HSCODE { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public int? proofreadUser { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string _id { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public int? cid { get; set; }
|
|
|
|
|
|
|
|
|
public string GetCntrtotal()
|
|
|
{
|
|
|
var result = "";
|
|
|
|
|
|
if (箱型箱量 != null && 箱型箱量.Count > 0)
|
|
|
{
|
|
|
foreach (var item in 箱型箱量)
|
|
|
{
|
|
|
if (result != "") result += " ";
|
|
|
|
|
|
result += item.箱型 + "*" + item.箱量;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class ResultData
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string templateId { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public int recordId { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string name { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string recogType { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string proofreadType { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public CommitResult commitResult { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string beacon { get; set; }
|
|
|
}
|
|
|
public class ResultResponse : 金识雀Response
|
|
|
{
|
|
|
//public string accessToken { get; internal set; }
|
|
|
public new ResultData data
|
|
|
{
|
|
|
get;
|
|
|
set;
|
|
|
}
|
|
|
|
|
|
public void SetData(ref DSWeb.MvcShipping.Models.MsOpSeae.MsOpSeae headdata)
|
|
|
{ //将识别数据与现有数据合并
|
|
|
//如识别数据有内容 则用其代替现有字段内容
|
|
|
|
|
|
if (data != null && data.commitResult != null)
|
|
|
{
|
|
|
|
|
|
var _result = data.commitResult;
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(_result.发货人))
|
|
|
{
|
|
|
//headdata.
|
|
|
}
|
|
|
|
|
|
//发货人 SHIPPER
|
|
|
PropNameList = new Dictionary<string, string>
|
|
|
{
|
|
|
|
|
|
|
|
|
{ "委托公司", "CUSTOMERNAME" },
|
|
|
{ "联系人", "ATTN" },
|
|
|
{ "电话", "ATTNTEL" },
|
|
|
|
|
|
{ "发货人", "SHIPPER" },
|
|
|
{ "客户委托编码", "CUSTNO" },
|
|
|
{ "备注", "REMARK" },
|
|
|
{ "邮箱", "ATTNEMAIL" },
|
|
|
{ "收货地", "PLACERECEIPT" },
|
|
|
{ "目的港", "DESTINATION" },
|
|
|
//{ "运费条款", "SHIPPER" },
|
|
|
{ "货描", "DESCRIPTION" },
|
|
|
{ "毛重", "KGS" },
|
|
|
{ "包装种类", "KINDPKGS" },
|
|
|
{ "收货人", "CONSIGNEE" },
|
|
|
{ "通知人", "NOTIFYPARTY" },
|
|
|
|
|
|
{ "运输条款", "SERVICE" },
|
|
|
|
|
|
{ "船公司", "CARRIER" },
|
|
|
{ "船名", "VESSEL" },
|
|
|
|
|
|
{ "航次", "VOYNO" },
|
|
|
{ "贸易条款", "TRADETERM" },
|
|
|
{ "品名", "GOODSNAME" },
|
|
|
|
|
|
{ "起运港", "PODLOAD" },
|
|
|
{ "卸货港", "PORTDISCHARGE" },
|
|
|
|
|
|
{ "交货地", "PLACEDELIVERY" },
|
|
|
|
|
|
{ "ETD", "ETD" },
|
|
|
{ "唛头", "MARKS" },
|
|
|
{ "件数", "NOPKGS" },
|
|
|
|
|
|
{ "体积", "CBM" },
|
|
|
{ "HSCODE", "HSCODE" }
|
|
|
};
|
|
|
|
|
|
foreach (var item in PropNameList)
|
|
|
{
|
|
|
//var value = _result.GetType().GetProperty("发货人").GetValue(_result, null);
|
|
|
|
|
|
//headdata.SetPropertyValue("")
|
|
|
var value = _result.GetType().GetProperty(item.Key).GetValue(_result, null);
|
|
|
|
|
|
if (value != null && !string.IsNullOrWhiteSpace(value.ToString()))
|
|
|
{
|
|
|
headdata.SetPropertyValue(item.Value, value.ToString());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//不规则的数据
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
headdata.CNTRTOTAL = _result.GetCntrtotal();
|
|
|
|
|
|
var _customername = headdata.CUSTOMERNAME;
|
|
|
|
|
|
//如果CUSTOMERNAME在info_client.SHORTNAME当中不存在 则尝试用info_client.FULLNAME对应后修改之
|
|
|
|
|
|
var _infoclient = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == _customername);
|
|
|
|
|
|
if (_infoclient == null || string.IsNullOrWhiteSpace(_infoclient.SHORTNAME))
|
|
|
{
|
|
|
var _tempinfoclient = cdc.info_client.FirstOrDefault(x => x.EnFullName == _customername || x.DESCRIPTION == _customername);
|
|
|
|
|
|
if (_tempinfoclient == null || string.IsNullOrWhiteSpace(_tempinfoclient.SHORTNAME))
|
|
|
{
|
|
|
headdata.CUSTOMERNAME = _tempinfoclient.SHORTNAME;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
private Dictionary<string, string> PropNameList { get; set; } = new Dictionary<string, string>();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 泛微
|
|
|
public struct RSAKEY
|
|
|
{
|
|
|
public string PublicKey
|
|
|
{
|
|
|
get;
|
|
|
set;
|
|
|
}
|
|
|
public string PrivateKey
|
|
|
{
|
|
|
get;
|
|
|
set;
|
|
|
}
|
|
|
}
|
|
|
public static RSAKEY GetKey()
|
|
|
{
|
|
|
//RSA密钥对的构造器
|
|
|
RsaKeyPairGenerator keyGenerator = new RsaKeyPairGenerator();
|
|
|
|
|
|
//RSA密钥构造器的参数
|
|
|
RsaKeyGenerationParameters param = new RsaKeyGenerationParameters(
|
|
|
Org.BouncyCastle.Math.BigInteger.ValueOf(3),
|
|
|
new Org.BouncyCastle.Security.SecureRandom(),
|
|
|
1024, //密钥长度
|
|
|
25);
|
|
|
//用参数初始化密钥构造器
|
|
|
keyGenerator.Init(param);
|
|
|
//产生密钥对
|
|
|
AsymmetricCipherKeyPair keyPair = keyGenerator.GenerateKeyPair();
|
|
|
//获取公钥和密钥
|
|
|
AsymmetricKeyParameter publicKey = keyPair.Public;
|
|
|
AsymmetricKeyParameter privateKey = keyPair.Private;
|
|
|
|
|
|
SubjectPublicKeyInfo subjectPublicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(publicKey);
|
|
|
PrivateKeyInfo privateKeyInfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(privateKey);
|
|
|
|
|
|
|
|
|
Asn1Object asn1ObjectPublic = subjectPublicKeyInfo.ToAsn1Object();
|
|
|
|
|
|
byte[] publicInfoByte = asn1ObjectPublic.GetEncoded("UTF-8");
|
|
|
Asn1Object asn1ObjectPrivate = privateKeyInfo.ToAsn1Object();
|
|
|
byte[] privateInfoByte = asn1ObjectPrivate.GetEncoded("UTF-8");
|
|
|
|
|
|
RSAKEY item = new RSAKEY()
|
|
|
{
|
|
|
PublicKey = Convert.ToBase64String(publicInfoByte),
|
|
|
PrivateKey = Convert.ToBase64String(privateInfoByte)
|
|
|
};
|
|
|
return item;
|
|
|
}
|
|
|
private static Encoding Encoding_UTF8 = Encoding.UTF8;
|
|
|
/// <summary>
|
|
|
/// 公钥加密
|
|
|
/// </summary>
|
|
|
/// <param name="data">加密内容</param>
|
|
|
/// <param name="publicKey">公钥(Base64编码后的)</param>
|
|
|
/// <returns>返回Base64内容</returns>
|
|
|
public static string EncryptByPublicKey(string data, string publicKey)
|
|
|
{
|
|
|
//非对称加密算法,加解密用
|
|
|
IAsymmetricBlockCipher engine = new Pkcs1Encoding(new RsaEngine());
|
|
|
|
|
|
//加密
|
|
|
try
|
|
|
{
|
|
|
engine.Init(true, GetPublicKeyParameter(publicKey));
|
|
|
byte[] byteData = Encoding_UTF8.GetBytes(data);
|
|
|
var ResultData = engine.ProcessBlock(byteData, 0, byteData.Length);
|
|
|
return Convert.ToBase64String(ResultData);
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
throw ex;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private static AsymmetricKeyParameter GetPublicKeyParameter(string keyBase64)
|
|
|
{
|
|
|
keyBase64 = keyBase64.Replace("\r", "").Replace("\n", "").Replace(" ", "");
|
|
|
byte[] publicInfoByte = Convert.FromBase64String(keyBase64);
|
|
|
Asn1Object pubKeyObj = Asn1Object.FromByteArray(publicInfoByte);//这里也可以从流中读取,从本地导入
|
|
|
AsymmetricKeyParameter pubKey = PublicKeyFactory.CreateKey(publicInfoByte);
|
|
|
return pubKey;
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// RSA公钥格式转换,.net->java
|
|
|
/// </summary>
|
|
|
/// <param name="publicKey">.net生成的公钥</param>
|
|
|
/// <returns></returns>
|
|
|
public static string RSAPublicKeyDotNet2Java(string publicKey)
|
|
|
{
|
|
|
XmlDocument doc = new XmlDocument();
|
|
|
doc.LoadXml(publicKey);
|
|
|
BigInteger m = new BigInteger(1, Convert.FromBase64String(doc.DocumentElement.GetElementsByTagName("Modulus")[0].InnerText));
|
|
|
BigInteger p = new BigInteger(1, Convert.FromBase64String(doc.DocumentElement.GetElementsByTagName("Exponent")[0].InnerText));
|
|
|
|
|
|
RsaKeyParameters pub = new RsaKeyParameters(false, m, p);
|
|
|
|
|
|
SubjectPublicKeyInfo publicKeyInfo = SubjectPublicKeyInfoFactory.CreateSubjectPublicKeyInfo(pub);
|
|
|
byte[] serializedPublicBytes = publicKeyInfo.ToAsn1Object().GetDerEncoded();
|
|
|
return Convert.ToBase64String(serializedPublicBytes);
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// RSA私钥格式转换,java->.net
|
|
|
/// </summary>
|
|
|
/// <param name="privateKey">java生成的RSA私钥</param>
|
|
|
/// <returns></returns>
|
|
|
public static string RSAPrivateKeyJava2DotNet(string privateKey)
|
|
|
{
|
|
|
RsaPrivateCrtKeyParameters privateKeyParam = (RsaPrivateCrtKeyParameters)PrivateKeyFactory.CreateKey(Convert.FromBase64String(privateKey));
|
|
|
|
|
|
return string.Format("<RSAKeyValue><Modulus>{0}</Modulus><Exponent>{1}</Exponent><P>{2}</P><Q>{3}</Q><DP>{4}</DP><DQ>{5}</DQ><InverseQ>{6}</InverseQ><D>{7}</D></RSAKeyValue>",
|
|
|
Convert.ToBase64String(privateKeyParam.Modulus.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.PublicExponent.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.P.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.Q.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.DP.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.DQ.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.QInv.ToByteArrayUnsigned()),
|
|
|
Convert.ToBase64String(privateKeyParam.Exponent.ToByteArrayUnsigned()));
|
|
|
}
|
|
|
|
|
|
public static class 泛微OAHelper
|
|
|
{
|
|
|
|
|
|
private static string APPID { get; set; } = "";
|
|
|
private static string CPK { get; set; } = "";
|
|
|
private static string SPK { get; set; } = "";
|
|
|
private static string SECRET { get; set; } = "";
|
|
|
private static bool locked { get; set; } = false;
|
|
|
private static string token { get; set; } = "";
|
|
|
private static DateTime? tokenEndTime { get; set; } = null;
|
|
|
|
|
|
const string URLHead = "http://117.78.44.211";
|
|
|
|
|
|
//获取secret
|
|
|
public static void GetRSAKEY()
|
|
|
{
|
|
|
var rsakey = GetKey();
|
|
|
CPK = rsakey.PublicKey;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void GetSecret() {
|
|
|
|
|
|
APPID= MsSysParamSetDAL.GetSysParamValue("FanWei_appid");
|
|
|
SPK = MsSysParamSetDAL.GetSysParamValue("FanWei_SPK");
|
|
|
SECRET = MsSysParamSetDAL.GetSysParamValue("FanWei_SECRET");
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(SPK) && !string.IsNullOrWhiteSpace(SECRET))
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
GetRSAKEY();
|
|
|
|
|
|
var appparam = new
|
|
|
{
|
|
|
appid = APPID,
|
|
|
cpk = CPK
|
|
|
};
|
|
|
|
|
|
var paramdic = new Dictionary<string, string>
|
|
|
{
|
|
|
{ "appid", APPID },
|
|
|
{ "cpk", CPK }
|
|
|
};
|
|
|
|
|
|
var securl = URLHead + "/api/ec/dev/auth/regist";
|
|
|
|
|
|
var data = WebRequestHelper.DoPost_Header(securl, paramdic);
|
|
|
|
|
|
if (data != null)
|
|
|
{
|
|
|
//JSONObject result = JSON.parseObject(data);
|
|
|
//if ("true".equals(result.getString("status")))
|
|
|
//{
|
|
|
// this.SPK = result.getString("spk");
|
|
|
// this.SECRET = result.getString("secrit");
|
|
|
//}
|
|
|
var cpkresult = JsonConvert.Deserialize<SecretResponse>(data);
|
|
|
|
|
|
//从返回值中解析出SPK
|
|
|
SPK = cpkresult.spk;
|
|
|
//SPK = RSAPrivateKeyJava2DotNet(cpkresult.spk);
|
|
|
SECRET = cpkresult.secret;
|
|
|
//将CPK记录至
|
|
|
MsSysParamSetDAL.SaveSysParamValue("FanWei_SPK", "泛微SPK", SPK);
|
|
|
MsSysParamSetDAL.SaveSysParamValue("FanWei_SECRET", "泛微SECRET", SECRET);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void GetToken()
|
|
|
{
|
|
|
if (locked) return;
|
|
|
locked = true;
|
|
|
try
|
|
|
{
|
|
|
GetSecret();
|
|
|
|
|
|
//token过期时间30分钟
|
|
|
//所以获取时记录获取后的25分钟为过期时间 如过期则重新获取
|
|
|
|
|
|
if (!(tokenEndTime == null || tokenEndTime <= DateTime.Now || string.IsNullOrWhiteSpace(token))) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
var secret = EncryptByPublicKey(SECRET,SPK);
|
|
|
|
|
|
|
|
|
var paramdic = new Dictionary<string, string>
|
|
|
{
|
|
|
{ "appid", APPID },
|
|
|
{ "secret", secret }
|
|
|
};
|
|
|
|
|
|
|
|
|
var securl = URLHead + "/api/ec/dev/auth/applytoken";
|
|
|
|
|
|
var data = WebRequestHelper.DoPost_Header(securl, paramdic);
|
|
|
|
|
|
if (data != null)
|
|
|
{
|
|
|
var r = JsonConvert.Deserialize<TokenResponse>(data);
|
|
|
|
|
|
token = r.token;
|
|
|
tokenEndTime = DateTime.Now.AddMinutes(25);
|
|
|
//MsSysParamSetDAL.SaveSysParamValue("FanWei_TOKEN", "泛微TOKEN", token);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
|
|
|
}
|
|
|
finally { locked = false; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static ResultResponse PostApplication( ChPayapplication headdata, string userid, string username, string companyid)
|
|
|
{
|
|
|
|
|
|
GetToken();
|
|
|
|
|
|
var result = new ResultResponse();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
var hp = new GetResult();
|
|
|
|
|
|
|
|
|
result = hp.DoGet(headdata, userid, username, companyid);
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public abstract class API_URL
|
|
|
{
|
|
|
public string Url { get; set; } = "";
|
|
|
|
|
|
public 泛微Response response { get; set; }
|
|
|
public static string GetBaseUrl()
|
|
|
{
|
|
|
|
|
|
var baseurl = URLHead;
|
|
|
|
|
|
|
|
|
return baseurl;
|
|
|
}
|
|
|
public abstract string GetUrl();
|
|
|
|
|
|
public 泛微Response DoGet(Dictionary<string,string> dic=null)
|
|
|
{
|
|
|
GetUrl();
|
|
|
var rtn = WebRequestHelper.DoGet(Url);
|
|
|
|
|
|
//临时替换 由于.在识别时报错 临时改为##
|
|
|
|
|
|
//rtn = rtn.Replace(".", "##");
|
|
|
|
|
|
response = JsonConvert.Deserialize<泛微Response>(rtn);
|
|
|
|
|
|
return response;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public class SecretResponse : 泛微Response
|
|
|
{
|
|
|
|
|
|
public string secret { get; set; }
|
|
|
public string spk { get; set; }
|
|
|
}
|
|
|
public class TokenResponse: 泛微Response
|
|
|
{
|
|
|
public string token { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class Field {
|
|
|
public string fieldName { get; set; }
|
|
|
public string fieldValue { get; set; }
|
|
|
public Field()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
public Field(string _fieldname, string _fieldvalue) {
|
|
|
fieldName=_fieldname;
|
|
|
fieldValue=_fieldvalue;
|
|
|
}
|
|
|
public Field(string _fieldname, decimal? _fieldvalue)
|
|
|
{
|
|
|
fieldName = _fieldname;
|
|
|
fieldValue = _fieldvalue==null?"0": _fieldvalue.ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class FileField : Field {
|
|
|
public List<Field> fieldValue { get; set; }
|
|
|
}
|
|
|
|
|
|
public static ArrayList GetMainData(ChPayapplication headdata, string userid, string username, string compoanyid) {
|
|
|
var result = new ArrayList();
|
|
|
|
|
|
result.add(new Field("sqr", headdata.APPLICANTNAME));
|
|
|
result.add(new Field("sqbm", headdata.APPLICANTDEPT));
|
|
|
var applytimestr = headdata.APPLYTIME == null ? "" : ((DateTime)(headdata.APPLYTIME)).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
result.add(new Field("lcbh", headdata.BILLNO));
|
|
|
result.add(new Field("bz", headdata.REMARK));
|
|
|
result.add(new Field("fkdx", headdata.CUSTOMERNAME));
|
|
|
|
|
|
|
|
|
var yxzh = "";
|
|
|
var khx = "";
|
|
|
var cdc = new CommonDataContext();
|
|
|
if (!string.IsNullOrWhiteSpace(headdata.CUSTACCOUNTGID)) {
|
|
|
var custbank = cdc.info_client_bank.FirstOrDefault(x => x.GID == headdata.CUSTACCOUNTGID);
|
|
|
|
|
|
yxzh = custbank.ACCOUNT;
|
|
|
khx = custbank.BANKNAME;
|
|
|
|
|
|
}
|
|
|
|
|
|
result.add(new Field("yxzh", yxzh));
|
|
|
result.add(new Field("khx", khx));
|
|
|
result.add(new Field("wtdw", headdata.BS_CUSTOMERNAME));
|
|
|
|
|
|
result.add(new Field("jehj", headdata.AMOUNTRMB));
|
|
|
result.add(new Field("jehjdx", BasicDataRefDAL.ConvertToChineseMoney( (double)headdata.AMOUNTRMB)));
|
|
|
result.add(new Field("jehjmj", headdata.AMOUNTUSD));
|
|
|
result.add(new Field("jehjmjdx", BasicDataRefDAL.ConvertToChineseMoney((double)headdata.AMOUNTUSD)));
|
|
|
|
|
|
var bodymblnolist = cdc.ch_fee_do.Where(x=>x.BILLNO ==headdata.BILLNO).Select(s=>s.MBLNO).Distinct().ToList();
|
|
|
var bodymblnostr = "";
|
|
|
if (bodymblnolist != null && bodymblnolist.Count > 0) {
|
|
|
bodymblnostr = string.Join(" , ", bodymblnolist);
|
|
|
}
|
|
|
result.add(new Field("tdh", bodymblnostr));
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static List<detailData> GetDetailData(ChPayapplication headdata) {
|
|
|
|
|
|
var resultlist = new List<detailData>();
|
|
|
|
|
|
var result = new detailData();
|
|
|
result.workflowRequestTableRecords = new List<detailBody>();
|
|
|
var cdc = new CommonDataContext();
|
|
|
var bodylist = cdc.ch_fee_do.Where(x => x.BILLNO == headdata.BILLNO).ToList();
|
|
|
var bsnolist = bodylist.Select(s => s.BSNO).ToList();
|
|
|
var vopbsList = cdc.v_op_bs.Where(x => bsnolist.Contains(x.BSNO)).ToList();
|
|
|
|
|
|
foreach (var item in bodylist) {
|
|
|
var newline = new detailBody();
|
|
|
|
|
|
var bs = vopbsList.First(x => x.BSNO == item.BSNO);
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("fymc",item.FEENAME));
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyje", item.ORIGAMOUNT*item.EXCHANGERATE));
|
|
|
newline.workflowRequestTableFields.Add(new Field("wtdw", bs.CUSTOMERNAME));
|
|
|
newline.workflowRequestTableFields.Add(new Field("yslx", bs.OPLBNAME));
|
|
|
newline.workflowRequestTableFields.Add(new Field("tdh", bs.MBLNO));
|
|
|
newline.workflowRequestTableFields.Add(new Field("xxxl", bs.CNTRTOTAL));
|
|
|
var fyjemj = "0";
|
|
|
if (item.CURRENCY == "USD") fyjemj = item.ORIGAMOUNT==null?"0": item.ORIGAMOUNT.ToString();
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyjemj", fyjemj));
|
|
|
|
|
|
result.workflowRequestTableRecords.Add(newline);
|
|
|
}
|
|
|
|
|
|
resultlist.Add(result);
|
|
|
|
|
|
return resultlist;
|
|
|
}
|
|
|
|
|
|
public class detailBody {
|
|
|
public int recordOrder { get; set; } = 0;
|
|
|
public List<Field> workflowRequestTableFields { get; set; }
|
|
|
|
|
|
public detailBody() {
|
|
|
workflowRequestTableFields = new List<Field>();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class detailData {
|
|
|
public string tableDBName { get; set; } = "formtable_main_1356_dt1";
|
|
|
|
|
|
public List<detailBody> workflowRequestTableRecords { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class GetResult : API_URL
|
|
|
{
|
|
|
|
|
|
public override string GetUrl()
|
|
|
{
|
|
|
|
|
|
//获取appid和secret
|
|
|
|
|
|
Url = GetBaseUrl() + "/api/workflow/paService/doCreateRequest";
|
|
|
return Url;
|
|
|
}
|
|
|
|
|
|
public ResultResponse DoGet(ChPayapplication headdata , string userid, string username, string companyid)
|
|
|
{
|
|
|
var _res = new ResultResponse();
|
|
|
try
|
|
|
{
|
|
|
GetUrl();
|
|
|
|
|
|
//String secretUserid = rsa.encrypt(null, userid, null, "utf-8", spk, false);
|
|
|
//heads.put("userid", secretUserid);
|
|
|
//userid将会填在user.wechetaccount里面
|
|
|
var _userid = EncryptByPublicKey("cs1", SPK);
|
|
|
|
|
|
var dic = new Dictionary<string, string> {
|
|
|
{ "token", token },
|
|
|
{ "appid", APPID},
|
|
|
{ "userid", _userid }
|
|
|
};
|
|
|
|
|
|
var maindata = GetMainData(headdata, userid, username, companyid);
|
|
|
|
|
|
var detaildata = GetDetailData(headdata);
|
|
|
|
|
|
//var sendobj = new
|
|
|
//{
|
|
|
// detailData = detaildata,
|
|
|
// mainData = maindata,
|
|
|
// otherParams = new { isnextflow = "1" },
|
|
|
// remark = "",
|
|
|
// requestLevel = "",
|
|
|
// requestName = "业务类供应商付款申请-票结",
|
|
|
// workflowId = "117"
|
|
|
//};
|
|
|
|
|
|
var valuedic = new Dictionary<string, string> {
|
|
|
{ "mainData", JsonConvert.Serialize(maindata) },
|
|
|
{ "detailData", JsonConvert.Serialize(detaildata)},
|
|
|
{ "otherParams", JsonConvert.Serialize(new { isnextflow = "1" }) },
|
|
|
{ "requestName", "业务类供应商付款申请-票结" },
|
|
|
{ "workflowId", "117" }
|
|
|
};
|
|
|
|
|
|
//var jsonstr=JsonConvert.Serialize(sendobj).Replace("\r\n","");
|
|
|
|
|
|
var rtn = WebRequestHelper.DoPost_Header(Url, dic, valuedic);
|
|
|
|
|
|
_res = JsonConvert.Deserialize<ResultResponse>(rtn);
|
|
|
|
|
|
return _res;
|
|
|
}
|
|
|
catch (Exception e) {
|
|
|
return _res;
|
|
|
}
|
|
|
finally { }
|
|
|
//return _res;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class 泛微Response
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string code { get; set; }
|
|
|
public bool status { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string data { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string errMsg { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ResultData
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string code { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string data { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string errMsg { get; set; }
|
|
|
|
|
|
}
|
|
|
public class ResultResponse : 泛微Response
|
|
|
{
|
|
|
//public string accessToken { get; internal set; }
|
|
|
public new ResultData data {
|
|
|
get;
|
|
|
set;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
} |