|
|
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;
|
|
|
using DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount;
|
|
|
using DSWeb.Areas.Account.Models.Chfee_payapplication;
|
|
|
using DSWeb.Areas.Account.DAL.Chfee_payapplication;
|
|
|
using DSWeb.Areas.Account.Controllers;
|
|
|
using DSWeb.Areas.Account.DAL.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;//测试cognitionurl;
|
|
|
static string UrlHead = 正式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"
|
|
|
}
|
|
|
{
|
|
|
"appid": "v7JNCMbkEnmDm5OwtwsUbmD93s",
|
|
|
"secret": "qHOPMT3dkHnQFLXHk1gbUWmKhcUFan"
|
|
|
}
|
|
|
appid=xSsjHYkzkAsoy53FtGCoPRFNAZ
|
|
|
secret=BlpdbnRssCNR5hlAEgN3f9jfc9c3vy
|
|
|
响应示例
|
|
|
{'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" }
|
|
|
};
|
|
|
|
|
|
var oldCustomerName = headdata.CUSTOMERNAME;
|
|
|
|
|
|
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 = "";
|
|
|
headdata.CUSTOMERNAME = oldCustomerName;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
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";
|
|
|
public static List<string> INWORKBILL { get; set; }
|
|
|
public static void BILLDONE(string BILLNO)
|
|
|
{
|
|
|
if (INWORKBILL.Exists(x => x == BILLNO))
|
|
|
{
|
|
|
INWORKBILL.RemoveAll(x => x == BILLNO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//获取secret
|
|
|
public static void GetRSAKEY()
|
|
|
{
|
|
|
var rsakey = GetKey();
|
|
|
CPK = rsakey.PublicKey;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void GetSecret()
|
|
|
{
|
|
|
|
|
|
APPID = MsSysParamSetDAL.GetSysParamValue("FanWei_appid");
|
|
|
//v7JNCMbkEnmDm5OwtwsUbmD93s
|
|
|
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; }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static DBResult CanSend(ChPayapplication headdata)
|
|
|
{
|
|
|
var result = new DBResult();
|
|
|
|
|
|
if (INWORKBILL == null)
|
|
|
{
|
|
|
INWORKBILL = new List<string>();
|
|
|
}
|
|
|
|
|
|
if (INWORKBILL.Exists(x => x == headdata.BILLNO))
|
|
|
{
|
|
|
result.SetErrorInfo("业务正在执行中");
|
|
|
return result;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
INWORKBILL.Add(headdata.BILLNO);
|
|
|
|
|
|
//var cdc = new CommonDataContext();
|
|
|
//var currHead = cdc.ch_fee_payapplication.First(x => x.BILLNO == headdata.BILLNO);
|
|
|
|
|
|
|
|
|
//var currHead = ChpayapplicationDAL.GetData_All($" cm.billno={headdata.BILLNO}");
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(headdata.PAYAPPID))
|
|
|
{
|
|
|
result.SetErrorInfo("业务已经提交至泛微OA");
|
|
|
泛微OAHelper.BILLDONE(headdata.BILLNO);
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.OK();
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static DBResult PostApplication(ChPayapplication headdata, string userid, string username, string companyid)
|
|
|
{
|
|
|
|
|
|
GetToken();
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
var hp = new GetResult();
|
|
|
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
result = hp.DoGet(headdata, userid, username, companyid);
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
BILLDONE(headdata.BILLNO);
|
|
|
}
|
|
|
|
|
|
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 fj
|
|
|
{
|
|
|
public string filePath { get; set; }
|
|
|
public string fileName { get; set; }
|
|
|
|
|
|
public fj() { }
|
|
|
|
|
|
public fj(ChfeeFile chfeefile)
|
|
|
{
|
|
|
|
|
|
//系统参数
|
|
|
var paramset = MsSysParamSetDAL.GetDataByName("DS7URL");
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(chfeefile.File_Path) && chfeefile.File_Path.IndexOf("\\Areas\\") >= 0)
|
|
|
{
|
|
|
var oldfilePath = chfeefile.File_Path.Substring(chfeefile.File_Path.IndexOf("\\Areas\\"), chfeefile.File_Path.Length - chfeefile.File_Path.IndexOf("\\Areas\\")).Replace("\\", "/");
|
|
|
filePath = (paramset.PARAMVALUE + "/" + oldfilePath).Replace("//Areas", "/Areas");
|
|
|
filePath = filePath.Replace("//Areas", "/Areas");
|
|
|
fileName = chfeefile.File_OriginalName + Path.GetExtension(chfeefile.File_Name);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static List<fj> GetFileList(string billno)
|
|
|
{
|
|
|
var filelist = ChfeeFileDal.GetFileList(billno);
|
|
|
|
|
|
var result = new List<fj>();
|
|
|
|
|
|
if (filelist != null && filelist.Count > 0)
|
|
|
{
|
|
|
foreach (var item in filelist)
|
|
|
{
|
|
|
result.Add(new fj(item));
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public class Field
|
|
|
{
|
|
|
public string fieldName { get; set; }
|
|
|
public string fieldValue { get; set; }
|
|
|
public Field()
|
|
|
{
|
|
|
|
|
|
}
|
|
|
public Field(string _fieldname, string _fieldvalue)
|
|
|
{
|
|
|
if (_fieldvalue == null) _fieldvalue = "";
|
|
|
fieldName = _fieldname;
|
|
|
|
|
|
fieldValue = BasicDataRefDAL.UrlEncode(_fieldvalue, Encoding.UTF8);
|
|
|
}
|
|
|
public Field(string _fieldname, decimal? _fieldvalue)
|
|
|
{
|
|
|
fieldName = _fieldname;
|
|
|
fieldValue = _fieldvalue == null ? "0" : BasicDataRefDAL.UrlEncode(_fieldvalue.ToString(), Encoding.UTF8);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class FileField
|
|
|
{
|
|
|
|
|
|
public string fieldName { get; set; }
|
|
|
public List<fj> fieldValue { get; set; }
|
|
|
|
|
|
public FileField(string _fieldname, List<fj> _fieldvalue)
|
|
|
{
|
|
|
fieldName = _fieldname;
|
|
|
fieldValue = _fieldvalue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public static ArrayList GetMainData_票结(ChPayapplication headdata, string userid, int deptid, view_xdf_md fkdx)
|
|
|
{
|
|
|
var result = new ArrayList();
|
|
|
|
|
|
result.add(new Field("sqr", userid));//申请人 改用ID
|
|
|
result.add(new Field("sqbm", deptid.ToString()));//申请部门 改用申请人部门ID
|
|
|
|
|
|
var applytimestr = headdata.APPLYTIME == null ? DateTime.Now.ToString("yyyy-MM-dd") : ((DateTime)(headdata.APPLYTIME)).ToString("yyyy-MM-dd");
|
|
|
result.add(new Field("sqrq", applytimestr));//申请日期
|
|
|
|
|
|
result.add(new Field("lcbh", headdata.BILLNO));//流程编号 用付费申请单号
|
|
|
result.add(new Field("bz", headdata.REMARK));//备注
|
|
|
|
|
|
result.add(new Field("fkdx", fkdx.id.ToString()));//headdata.CUSTOMERNAME 付款对象 需使用泛微的一个ID号
|
|
|
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
|
|
|
//var yxzh = "";
|
|
|
//var khx = "";
|
|
|
//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", fkdx.yxzh));//银行账号
|
|
|
result.add(new Field("khx", fkdx.khx));//开户行
|
|
|
result.add(new Field("wtdw", headdata.BS_CUSTOMERNAME));//委托单位 文本
|
|
|
|
|
|
result.add(new Field("jehj", Math.Round(headdata.AMOUNTRMB, 2)));//金额合计
|
|
|
result.add(new Field("jehjdx", Math.Round(headdata.AMOUNTRMB, 2)));//金额合计大写
|
|
|
//result.add(new Field("jehjdx", BasicDataRefDAL.ConvertToChineseMoney2( (double)headdata.AMOUNTRMB)));
|
|
|
result.add(new Field("jehjmj", Math.Round(headdata.AMOUNTUSD, 2)));//金额合计美金
|
|
|
result.add(new Field("jehjdxmj", Math.Round(headdata.AMOUNTUSD, 2)));//金额合计大写美金
|
|
|
//result.add(new Field("jehjmjdx", BasicDataRefDAL.ConvertToChineseMoney2((double)headdata.AMOUNTUSD)));
|
|
|
|
|
|
//附件fj字段的值: [{ "filePath":"上传的附件地址或者base64","fileName":"附件名称(包含附件类型)"}]
|
|
|
|
|
|
var fjlist = GetFileList(headdata.BILLNO);
|
|
|
//var fjliststr = JsonConvert.Serialize(fjlist);
|
|
|
|
|
|
result.add(new FileField("fj", fjlist));//金额合计大写美金
|
|
|
|
|
|
var bsnolist = cdc.ch_fee_do.Where(x => x.BILLNO == headdata.BILLNO).Select(s => s.BSNO).Distinct().ToList();
|
|
|
|
|
|
var vopbsList = cdc.v_op_bs.Where(x => bsnolist.Contains(x.BSNO)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var bodymblnostr = "";
|
|
|
if (bsnolist != null && bsnolist.Count > 0)
|
|
|
{
|
|
|
var vopbsMblnoList = vopbsList.Select(s => s.MBLNO).Distinct().ToList();
|
|
|
bodymblnostr = string.Join(" , ", vopbsMblnoList);
|
|
|
}
|
|
|
result.add(new Field("tdh", bodymblnostr));//提单号 依据付款申请的ch_fee_do的bsno关联v_op_bs的MBLNO
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static ArrayList GetMainData_月结(ChPayapplication headdata, string userid, int deptid, view_xdf_md fkdx)
|
|
|
{
|
|
|
var result = new ArrayList();
|
|
|
|
|
|
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();
|
|
|
|
|
|
var oplbdic = new Dictionary<string, string> {
|
|
|
{"海运进口" ,"0"},
|
|
|
{"海运出口" ,"1"},
|
|
|
{"空运进口" ,"2"},
|
|
|
{"空运出口" ,"3"},
|
|
|
{"海运进/出口" ,"4"},
|
|
|
{"空运进/出口" ,"5"},
|
|
|
{"铁路进口" ,"6"},
|
|
|
{"铁路出口" ,"7"},
|
|
|
{"铁路运输" ,"8"},
|
|
|
{"公路运输" ,"9"}
|
|
|
};
|
|
|
var oplbstr = "4";
|
|
|
var bs = vopbsList[0];
|
|
|
var _oplbname = bs.BSTYPE;
|
|
|
|
|
|
if (_oplbname != null && _oplbname.IndexOf("铁路") >= 0)
|
|
|
{
|
|
|
_oplbname = "铁路运输";
|
|
|
}
|
|
|
else
|
|
|
if (_oplbname != null && (_oplbname.IndexOf("公路") >= 0 || _oplbname.IndexOf("陆运") >= 0))
|
|
|
{
|
|
|
_oplbname = "公路运输";
|
|
|
}
|
|
|
|
|
|
if (oplbdic.ContainsKey(_oplbname)) oplbstr = oplbdic[_oplbname];
|
|
|
|
|
|
result.add(new Field("yslx", oplbstr));
|
|
|
|
|
|
|
|
|
result.add(new Field("sqr", userid));//申请人 改用ID
|
|
|
result.add(new Field("sqbm", deptid.ToString()));//申请部门 改用申请人部门ID
|
|
|
|
|
|
var applytimestr = headdata.APPLYTIME == null ? DateTime.Now.ToString("yyyy-MM-dd") : ((DateTime)(headdata.APPLYTIME)).ToString("yyyy-MM-dd");
|
|
|
result.add(new Field("sqrq", applytimestr));//申请日期
|
|
|
|
|
|
result.add(new Field("lcbh", headdata.BILLNO));//流程编号 用付费申请单号
|
|
|
result.add(new Field("zkyfjzy", headdata.REMARK));//账款月份及摘要
|
|
|
result.add(new Field("wtdw", headdata.BS_CUSTOMERNAME));//委托单位 文本
|
|
|
|
|
|
result.add(new Field("fkje", Math.Round(headdata.AMOUNTUSD, 2)));//付款金额(美金)
|
|
|
result.add(new Field("fkjedx", Math.Round(headdata.AMOUNTUSD, 2)));//付款金额大写(美金)
|
|
|
//result.add(new Field("jehjmjdx", BasicDataRefDAL.ConvertToChineseMoney2((double)headdata.AMOUNTUSD)));
|
|
|
|
|
|
//附件fj字段的值: [{ "filePath":"上传的附件地址或者base64","fileName":"附件名称(包含附件类型)"}]
|
|
|
var fjlist = GetFileList(headdata.BILLNO);
|
|
|
result.add(new FileField("fj", fjlist));//附件
|
|
|
|
|
|
result.add(new Field("bz", headdata.REMARK));//备注
|
|
|
|
|
|
result.add(new Field("fkdx", fkdx.id.ToString()));//headdata.CUSTOMERNAME 付款对象 需使用泛微的一个ID号
|
|
|
|
|
|
result.add(new Field("yxzh", fkdx.yxzh));//银行账号
|
|
|
result.add(new Field("khx", fkdx.khx));//开户行
|
|
|
|
|
|
|
|
|
result.add(new Field("fkjermb", Math.Round(headdata.AMOUNTRMB, 2)));//付款金额(人民币)
|
|
|
result.add(new Field("fkjedxrmb", Math.Round(headdata.AMOUNTRMB, 2)));//金额合计大写
|
|
|
//result.add(new Field("jehjdx", BasicDataRefDAL.ConvertToChineseMoney2( (double)headdata.AMOUNTRMB)));
|
|
|
|
|
|
|
|
|
//var vopbsMblnoList = cdc.v_op_bs.Where(x => bsnolist.Contains(x.BSNO)).Select(s => s.MBLNO).Distinct().ToList();
|
|
|
//var bodymblnostr = "";
|
|
|
//if (vopbsMblnoList != null && vopbsMblnoList.Count > 0)
|
|
|
//{
|
|
|
// bodymblnostr = string.Join(" , ", vopbsMblnoList);
|
|
|
//}
|
|
|
//result.add(new Field("tdh", bodymblnostr));//提单号 依据付款申请的ch_fee_do的bsno关联v_op_bs的MBLNO
|
|
|
|
|
|
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();
|
|
|
|
|
|
var oplbdic = new Dictionary<string, string> {
|
|
|
{"海运进口" ,"0"},
|
|
|
{"海运出口" ,"1"},
|
|
|
{"空运进口" ,"2"},
|
|
|
{"空运出口" ,"3"},
|
|
|
{"海运进/出口" ,"4"},
|
|
|
{"空运进/出口" ,"5"},
|
|
|
{"铁路进口" ,"6"},
|
|
|
{"铁路出口" ,"7"},
|
|
|
{"铁路运输" ,"8"},
|
|
|
{"公路运输" ,"9"}
|
|
|
};
|
|
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
if (headdata.CURR == "RMB" || item.CURRENCY == "RMB")
|
|
|
{
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyje", item.ORIGAMOUNT * item.EXCHANGERATE));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyje", 0));
|
|
|
//newline.workflowRequestTableFields.Add(new Field("fyje", item.ORIGAMOUNT*item.EXCHANGERATE));
|
|
|
}
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("wtdw", bs.CUSTOMERNAME));
|
|
|
|
|
|
var oplbstr = "4";
|
|
|
//0 海运进口 1海运出口 2空运进口 3空运出口
|
|
|
//4 海运进出口 5空运进出口 6铁路进口 7铁路出口 8铁路运输 9公路运输
|
|
|
|
|
|
var _oplbname = bs.BSTYPE;
|
|
|
|
|
|
if (_oplbname != null && _oplbname.IndexOf("铁路") >= 0)
|
|
|
{
|
|
|
_oplbname = "铁路运输";
|
|
|
}
|
|
|
else
|
|
|
if (_oplbname != null && (_oplbname.IndexOf("公路") >= 0 || _oplbname.IndexOf("陆运") >= 0))
|
|
|
{
|
|
|
_oplbname = "公路运输";
|
|
|
}
|
|
|
|
|
|
if (oplbdic.ContainsKey(_oplbname)) oplbstr = oplbdic[_oplbname];
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("yslx", oplbstr));
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("tdh", bs.MBLNO));
|
|
|
newline.workflowRequestTableFields.Add(new Field("xxxl", bs.CNTRTOTAL));
|
|
|
var fyjemj = "0";
|
|
|
if (headdata.CURR != "RMB" && item.CURRENCY == "USD") fyjemj = item.ORIGAMOUNT == null ? "0" : item.ORIGAMOUNT.ToString();
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyjemj", fyjemj));
|
|
|
|
|
|
//20230817 荣圣达泛微OA对接 票结 增加 起运港 卸货港 目的地
|
|
|
if (bsnolist != null && bsnolist.Count > 0)
|
|
|
{
|
|
|
//var vopbsHead = vopbsList[0];
|
|
|
//result.add(new Field("起运港", bs.PORTLOAD));
|
|
|
//result.add(new Field("卸货港", bs.PORTDISCHARGE));
|
|
|
//result.add(new Field("目的港", bs.DESTINATION));
|
|
|
newline.workflowRequestTableFields.Add(new Field("qyg", bs.PORTLOAD));
|
|
|
newline.workflowRequestTableFields.Add(new Field("xhg", bs.PORTDISCHARGE));
|
|
|
newline.workflowRequestTableFields.Add(new Field("mdd", bs.DESTINATION));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
newline.workflowRequestTableFields.Add(new Field("qyg", ""));
|
|
|
newline.workflowRequestTableFields.Add(new Field("xhg", ""));
|
|
|
newline.workflowRequestTableFields.Add(new Field("mdd", ""));
|
|
|
}
|
|
|
|
|
|
result.workflowRequestTableRecords.Add(newline);
|
|
|
}
|
|
|
|
|
|
resultlist.Add(result);
|
|
|
|
|
|
return resultlist;
|
|
|
}
|
|
|
public static List<detailData> GetDetailData_月结(ChPayapplication headdata)
|
|
|
{
|
|
|
|
|
|
var resultlist = new List<detailData>();
|
|
|
|
|
|
var result = new detailData();
|
|
|
result.tableDBName = "formtable_main_74_dt1";
|
|
|
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();
|
|
|
|
|
|
var oplbdic = new Dictionary<string, string> {
|
|
|
{"海运进口" ,"0"},
|
|
|
{"海运出口" ,"1"},
|
|
|
{"空运进口" ,"2"},
|
|
|
{"空运出口" ,"3"},
|
|
|
{"海运进/出口" ,"4"},
|
|
|
{"空运进/出口" ,"5"},
|
|
|
{"铁路进口" ,"6"},
|
|
|
{"铁路出口" ,"7"},
|
|
|
{"铁路运输" ,"8"},
|
|
|
{"公路运输" ,"9"}
|
|
|
};
|
|
|
|
|
|
var newline = new detailBody();
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("fymc", "合计费"));
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyjermb", headdata.AMOUNTRMB));//费用金额(人民币)
|
|
|
|
|
|
newline.workflowRequestTableFields.Add(new Field("fyje", headdata.AMOUNTUSD));//费用金额(美金)
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
|
|
//测试表:formtable_main_120 明细:formtable_main_120_dt1
|
|
|
//正式表:formtable_main_77 明细:formtable_main_77_dt1
|
|
|
//public string tableDBName { get; set; } = "formtable_main_120_dt1";
|
|
|
public string tableDBName { get; set; } = "formtable_main_77_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 DBResult DoGet(ChPayapplication headdata, string userid, string username, string companyid)
|
|
|
{
|
|
|
|
|
|
|
|
|
var cansend = CanSend(headdata);
|
|
|
|
|
|
if (!cansend.Success)
|
|
|
{
|
|
|
return cansend;
|
|
|
}
|
|
|
|
|
|
var result = new DBResult();
|
|
|
var _res = new SuccessResponse();
|
|
|
var _res2 = new FailResponse();
|
|
|
try
|
|
|
{
|
|
|
|
|
|
|
|
|
GetUrl();
|
|
|
|
|
|
|
|
|
var cdc = new CommonDataContext();
|
|
|
var _user = cdc.VW_user.FirstOrDefault(x => x.USERID == userid);
|
|
|
|
|
|
#region 正式获取userid的逻辑
|
|
|
|
|
|
var _userid = "0";
|
|
|
|
|
|
var fanweiconnstr = MsSysParamSetDAL.GetData("PARAMNAME='FanWei_DBCONN'").PARAMVALUE;
|
|
|
|
|
|
var FanWeidc = new OtherDB(fanweiconnstr);
|
|
|
|
|
|
var oaname = _user.SHOWNAME.Trim().Replace(" ", "");
|
|
|
|
|
|
var fwuser = FanWeidc.view_hrmresource.Where(x => x.lastname == oaname).ToList();
|
|
|
//var fwuser = FanWeidc.view_hrmresource.Where(x => x.lastname == "宫喜芬").ToList();
|
|
|
|
|
|
if (fwuser == null || fwuser.Count <= 0)
|
|
|
{
|
|
|
|
|
|
result.SetErrorInfo($"用户[{oaname}]在OA系统中不存在");
|
|
|
return result;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
_userid = fwuser[0].id.ToString();
|
|
|
}
|
|
|
|
|
|
var _userid_m = EncryptByPublicKey(_userid, SPK);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
//var _userid_m = EncryptByPublicKey("49", SPK);
|
|
|
|
|
|
var dic = new Dictionary<string, string> {
|
|
|
{ "token", token },
|
|
|
{ "appid", APPID},
|
|
|
{ "userid", _userid_m }
|
|
|
};
|
|
|
|
|
|
var 付费申请付款对象 = cdc.info_client.First(x => x.SHORTNAME == headdata.CUSTOMERNAME);
|
|
|
|
|
|
var fxdxlist = FanWeidc.view_xdf.Where(x => x.gyskhmc == 付费申请付款对象.DESCRIPTION).ToList();
|
|
|
if (fxdxlist == null || fxdxlist.Count <= 0)
|
|
|
{
|
|
|
result.SetErrorInfo($"客户[{付费申请付款对象.DESCRIPTION}]在OA系统中不存在");
|
|
|
return result;
|
|
|
}
|
|
|
var fxdx = fxdxlist[0];
|
|
|
|
|
|
//20230407 根据 ChPayapplication headdata 的customername判断
|
|
|
//如果该客户下具备月结的账期,则调用月结逻辑
|
|
|
|
|
|
//如不具备月结的账期,则调用票结逻辑
|
|
|
|
|
|
var 客户账期List = cdc.Info_Client_ACCDATE.Where(x => x.LINKGID == 付费申请付款对象.GID).ToList();
|
|
|
|
|
|
var 客户月结票结 = "票结";
|
|
|
|
|
|
if (客户账期List == null || 客户账期List.Count == 0)
|
|
|
{
|
|
|
客户月结票结 = "票结";
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
foreach (var 账期item in 客户账期List)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
if (账期item.ACCTYPE != "月结") continue;
|
|
|
var settledatestr = headdata.PAYABLETIME;
|
|
|
var settledate = DateTime.Now;
|
|
|
if (!string.IsNullOrWhiteSpace(settledatestr))
|
|
|
settledate = Convert.ToDateTime(headdata.PAYABLETIME);
|
|
|
var startdate = Convert.ToDateTime(账期item.BGNDATE);
|
|
|
var enddate = Convert.ToDateTime(账期item.ENDDATE);
|
|
|
if (startdate <= settledate && enddate >= settledate)
|
|
|
{
|
|
|
客户月结票结 = "月结";
|
|
|
}
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result.SetErrorInfo(ex.Message);
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
var maindata = new ArrayList();
|
|
|
|
|
|
var detaildata = new List<detailData>();
|
|
|
|
|
|
var workflowId = "00";
|
|
|
|
|
|
if (客户月结票结 == "票结")
|
|
|
{
|
|
|
maindata = GetMainData_票结(headdata, _userid, fwuser[0].departmentid, fxdx);
|
|
|
detaildata = GetDetailData_票结(headdata);
|
|
|
workflowId = "79";
|
|
|
}
|
|
|
|
|
|
if (客户月结票结 == "月结")
|
|
|
{
|
|
|
maindata = GetMainData_月结(headdata, _userid, fwuser[0].departmentid, fxdx);
|
|
|
//detaildata = GetDetailData_月结(headdata);
|
|
|
workflowId = "77";
|
|
|
}
|
|
|
|
|
|
//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", $"业务类供应商付款申请-{客户月结票结}-"+ _user.SHOWNAME+"-"+headdata.BILLNO},
|
|
|
{ "workflowId", workflowId }
|
|
|
};
|
|
|
if (客户月结票结 == "票结")
|
|
|
{
|
|
|
valuedic = new Dictionary<string, string> {
|
|
|
{ "mainData", JsonConvert.Serialize(maindata) },
|
|
|
{ "detailData", JsonConvert.Serialize(detaildata)},
|
|
|
{ "otherParams", JsonConvert.Serialize(new { isnextflow = "1" }) },
|
|
|
{ "requestName", $"业务类供应商付款申请-{客户月结票结}-"+ _user.SHOWNAME+"-"+headdata.BILLNO},
|
|
|
{ "workflowId", workflowId }
|
|
|
};
|
|
|
}
|
|
|
if (客户月结票结 == "月结")
|
|
|
{
|
|
|
valuedic = new Dictionary<string, string> {
|
|
|
{ "mainData", JsonConvert.Serialize(maindata) },
|
|
|
//{ "detailData", JsonConvert.Serialize(detaildata)},
|
|
|
{ "otherParams", JsonConvert.Serialize(new { isnextflow = "1" }) },
|
|
|
{ "requestName", $"业务类供应商付款申请-{客户月结票结}-"+ _user.SHOWNAME+"-"+headdata.BILLNO},
|
|
|
{ "workflowId", workflowId }
|
|
|
};
|
|
|
}
|
|
|
|
|
|
|
|
|
//var jsonstr=JsonConvert.Serialize(sendobj).Replace("\r\n","");
|
|
|
BasicDataRefDAL.SaveLog("url:" + Url + ";dic:" + JsonConvert.Serialize(dic) + ";valuedic:" + JsonConvert.Serialize(valuedic)
|
|
|
, "", "泛微OA", "发送"
|
|
|
);
|
|
|
var rtn = WebRequestHelper.DoPost_Header(Url, dic, valuedic);
|
|
|
BasicDataRefDAL.SaveLog(rtn, "", "泛微OA", "返回");
|
|
|
try
|
|
|
{
|
|
|
|
|
|
_res = JsonConvert.Deserialize<SuccessResponse>(rtn);
|
|
|
|
|
|
if (_res.code.Contains("ERROR"))
|
|
|
{
|
|
|
|
|
|
if (_res.reqFailMsg.msgInfo.bottom != null && _res.reqFailMsg.msgInfo.detail != null)
|
|
|
{
|
|
|
|
|
|
var bottom = Regex.Replace(_res.reqFailMsg.msgInfo.bottom, @"\<[^\<]*\>", "");
|
|
|
var detail = Regex.Replace(_res.reqFailMsg.msgInfo.detail, @"\<[^\<]*\>", "");
|
|
|
|
|
|
result.SetErrorInfo(JsonConvert.Serialize(_res.reqFailMsg.msgInfo.title + ":" + bottom + "\r\n\r\n" + detail));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
|
|
|
result.SetErrorInfo("发送失败:" + rtn);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result.Data = _res.data.requestid;
|
|
|
result.OK("发送成功");
|
|
|
}
|
|
|
//要记录requestid
|
|
|
|
|
|
|
|
|
//var logicdic = new Dictionary<string, string> {
|
|
|
// { "requestid", _res.data.requestid }
|
|
|
//};
|
|
|
//BasicDataRefDAL.SaveLogicInfo(headdata.GID, "泛微审批", logicdic);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
|
|
|
result.SetErrorInfo("发送失败:" + rtn);
|
|
|
|
|
|
BILLDONE(headdata.BILLNO);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
BILLDONE(headdata.BILLNO);
|
|
|
return result.SetErrorInfo(e.Message);
|
|
|
}
|
|
|
finally { }
|
|
|
//return _res;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public class 泛微Response
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string code { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string data { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string errMsg { get; set; }
|
|
|
}
|
|
|
|
|
|
public class SuccessResponse : 泛微Response
|
|
|
{
|
|
|
public string code { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public Data data { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public ErrMsg errMsg { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public ReqFailMsg reqFailMsg { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public class FailResponse : 泛微Response
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public ErrMsg errMsg { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public class Data
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public int requestid { get; set; }
|
|
|
}
|
|
|
|
|
|
public class ErrMsg
|
|
|
{
|
|
|
}
|
|
|
|
|
|
public class KeyParameters
|
|
|
{
|
|
|
}
|
|
|
|
|
|
public class MsgInfo
|
|
|
{
|
|
|
public string prompttype { get; set; }
|
|
|
public string bottom { get; set; }
|
|
|
public string detail { get; set; }
|
|
|
public string title { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
public class OtherParams
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public string doAutoApprove { get; set; }
|
|
|
}
|
|
|
|
|
|
public class ReqFailMsg
|
|
|
{
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public KeyParameters keyParameters { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public MsgInfo msgInfo { get; set; }
|
|
|
/// <summary>
|
|
|
///
|
|
|
/// </summary>
|
|
|
public OtherParams otherParams { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
} |