发票开出修改

main
dengyu 2 months ago
parent 67b459afd0
commit ab1b9d9e77

File diff suppressed because one or more lines are too long

@ -2695,7 +2695,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
bool ishave = false;
if (invdetailDataList != null&& bodyList.Count!=1)
if (invdetailDataList != null && bodyList.Count != 1)
{
foreach (var invdetailData in invdetailDataList)
{
@ -3637,7 +3637,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
#region 提交审核和撤销审核
public static DBResult Lock(String bill,string userid)
public static DBResult Lock(String bill, string userid)
{
var result = new DBResult();
var INVLOCKFEEAUTOAUDIT = MsSysParamSetDAL.GetData("PARAMNAME='INVLOCKFEEAUTOAUDIT'").PARAMVALUE;
@ -3985,6 +3985,26 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
static public int GetStCount(string strCondition)
{
var strSql = new StringBuilder();
strSql.Append("SELECT Count(*) AS CT from v_fee_do_payapplication (NOLOCK) ");
if (strCondition.Trim() != String.Empty)
{
strSql.Append(" where " + strCondition);
}
var ct = 0;
Database db = DatabaseFactory.CreateDatabase();
using (IDataReader reader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
ct = Convert.ToInt16(reader["CT"]);
}
reader.Close();
}
return ct;
}
#endregion
@ -4126,7 +4146,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
var custbank = "";
var custaccount = "";
string[] custbanklist = head.CUSTBANK.Trim().Split(' ');
if (custbanklist.Length == 2) {
if (custbanklist.Length == 2)
{
custbank = custbanklist[0];
custaccount = custbanklist[1];
@ -4225,9 +4246,9 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
str = str.Replace("[折算汇率]", "");
str = str.Replace("[购方银行]",custbank);
str = str.Replace("[购方银行]", custbank);
str = str.Replace("[购方账号]", custaccount);
str = str.Replace("[销方银行]",head.ACCOUNT);
str = str.Replace("[销方银行]", head.ACCOUNT);
str = str.Replace("[外币金额(总计)]", Allusdttl.ToString("#0.00"));
str = str.Replace("[人民币金额(总计)]", Allrmbttl.ToString("#0.00"));
@ -5098,6 +5119,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
}
public static class AES
{
public static string key = ConfigurationManager.AppSettings["AESkey"];

@ -27,6 +27,11 @@ using DSWeb.Areas.CommMng.Controllers;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using System.Web;
using DSWeb.MvcShipping.DAL.MsOpExpressDAL;
using DSWeb.Areas.SysMng.DAL.SysUser;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.Models.MsChFee;
using System.Linq;
using System.Data.Entity.Migrations;
namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
@ -2797,6 +2802,304 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
}
public class
{
public ch_fee_invoice_md InvoiceHead { get; set; }
public ChInvoice_HangXin HXHead { get; set; }
public List<ch_fee_invoicedetail_md> InvoiceHeadDetail { get; set; }
const string APIURL_ = "/api/Invoice/services";
private string USERKEY { get; set; }
private string USERSECRET { get; set; }
private VW_user_md SendUser { get; set; }
public () { }
private DBResult cansend { get; set; } = new DBResult();
public DBResult CanSend()
{
cansend.OK();
//判断能否发出
//1 没有第三方账号密码
if (string.IsNullOrWhiteSpace(USERKEY) || string.IsNullOrWhiteSpace(USERSECRET))
{
cansend.SetErrorInfo("发票接口设置当中 没有设置账号和密钥");
return cansend;
}
if (USERKEY.Length != 32 || USERSECRET.Length != 80)
{
cansend.SetErrorInfo("发票接口设置当中 账号和密钥设置不正确.");
}
//判断开票人的身份证号
var cdc = new CommonDataContext();
var List = cdc.User.Where(x => x.GID == InvoiceHead.OPERATOR).ToList();
if (List == null || List.Count == 0)
{
cansend.SetErrorInfo("没有找到开票人.");
}
else
{
var = SysUserDAL.GetData(" U.GID='" + List[0].GID + "'");
if (string.IsNullOrWhiteSpace(.IDCARD) || .IDCARD.Length < 18)
{
cansend.SetErrorInfo("开票人没有设置身份证号,或者身份证号设置不正确.");
}
}
var apiurlList = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96050).ToList();
if (apiurlList == null || apiurlList.Count == 0)
{
cansend.SetErrorInfo("枚举类型96050没有值应当设定接口名称和地址");
}
else
{
if (!apiurlList.Exists(x => x.EnumValueID == "东胜乐企他用_蓝票"))
{
cansend.SetErrorInfo("枚举类型96050应当有【东胜乐企他用_蓝票】及其地址");
}
if (!apiurlList.Exists(x => x.EnumValueID == "东胜乐企他用_冲红"))
{
cansend.SetErrorInfo("枚举类型96050应当有【东胜乐企他用_冲红】及其地址");
}
if (!apiurlList.Exists(x => x.EnumValueID == "东胜乐企他用_读取"))
{
cansend.SetErrorInfo("枚举类型96050应当有【东胜乐企他用_读取】及其地址");
}
}
//返回
return cansend;
}
public DBResult CanSendRed()
{
cansend.OK();
//判断能否发出
//1 没有第三方账号密码
if (string.IsNullOrWhiteSpace(USERKEY) || string.IsNullOrWhiteSpace(USERSECRET))
{
cansend.SetErrorInfo("发票接口设置当中 没有设置账号和密钥");
}
//返回
return cansend;
}
/// <summary>
/// 通过发票业务号BILLNO 生成开票对象
/// </summary>
/// <param name="BILLNO"></param>
/// <param name="USERID"></param>
public (ChInvoice_HangXin _HXHead, string USERID)
{
var cdc = new CommonDataContext();
HXHead = _HXHead;
var BILLNO = HXHead.BILLNO;
InvoiceHead = cdc.ch_fee_invoice.FirstOrDefault(x => x.BILLNO == BILLNO);
if (InvoiceHead != null)
{
InvoiceHeadDetail = cdc.ch_fee_invoicedetail.Where(x => x.PID == InvoiceHead.GID).ToList();
}
SendUser = cdc.VW_user.FirstOrDefault(x => x.USERID == USERID);
//var APINAME = "东胜乐企他用key";
//var accCfg = MsSysThirdPartyAccountDAL.MakeSureField(APINAME, USERID);
//if (accCfg.Success)
//{
// var accCfgInfo = (SysThirdPartyAccount)accCfg.Data;
// USERKEY = accCfgInfo.ACCOUNT;
// USERSECRET = accCfgInfo.ACCOUNTPSW;
//}
//else
//{
//}
//20040718
//改为通过发票接口设置 sys_inv_interfaceset.INVOICELINE = _head.INVOICELINE 当中
//是否存在 sys_inv_interfaceset.INVITERFACE=="东胜乐企他用"
//且NUONUOAPPKEY NUONUOAPPSECRET不为空的数据
var condition = $" INVOICELINE='{HXHead.INVOICELINEREF}' and INVITERFACE='东胜乐企他用' ";
var invinterfacelist = MsSysInvInterFaceSetDAL.GetDataList(condition, HXHead.SALECORPID);
if (invinterfacelist != null && invinterfacelist.Count > 0)
{
var _iif = invinterfacelist[0];
USERKEY = _iif.NUONUOAPPKEY;
USERSECRET = _iif.NUONUOAPPSECRET;
}
}
public DBResult DoSend_BlueInvoice()
{
var _cansend = CanSend();
if (!_cansend.Success)
{
return _cansend;
}
var result = new DBResult();
//如果当前发票有流水号 读取该流水号发票
if (!string.IsNullOrWhiteSpace(InvoiceHead.INVOICESERIALNUM))
{
return DoReadInvoice();
}
var sendHead = DSWeb.MvcShipping.Models.MsChFee..getHelper(InvoiceHead.BILLNO);
var strJson = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(sendHead);
BasicDataRefDAL.SaveLog(strJson, "", "乐企他用蓝票", "发出");
result = BasicDataRefDAL.SendToDJY("", strJson, SendUser.USERID, "", "东胜乐企他用_蓝票", USERKEY, USERSECRET);
if (result.Success && result.Data != null)
{
var _r = DSWeb.MvcShipping.Helper.JsonConvert.Deserialize<>(result.Data.ToString()); ;
if (_r.success)
{
//记录发票流水号
InvoiceHead.INVOICESERIALNUM = sendHead.senid;
var cdc = new CommonDataContext();
cdc.ch_fee_invoice.AddOrUpdate(InvoiceHead);
cdc.SaveChanges();
}
else
{
result.SetErrorInfo(_r.msg);
}
}
else
{
result.SetErrorInfo(result.Message);
}
return result;
}
public DBResult DoSend_RedInvoice()
{
var _cansend = CanSendRed();
if (!_cansend.Success)
{
return _cansend;
}
var result = new DBResult();
var strJson = "";
var sendobject = new (HXHead);
strJson = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(sendobject);
result = BasicDataRefDAL.SendToDJY("", strJson, SendUser.USERID, "", "东胜乐企他用_冲红", USERKEY, USERSECRET);
return result;
}
public DBResult DoReadInvoice(string PTORRED = "")
{
var result = new DBResult();
var param = new { guid = InvoiceHead.GID };
if (PTORRED == "2")
{
param = new { guid = InvoiceHead.billUuid };
}
var strJson = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(param);
//
result = BasicDataRefDAL.SendToDJY("", strJson, SendUser.USERID, "", "东胜乐企他用_读取", USERKEY, USERSECRET);
if (result.Data == null)
{
result.Data = "";
}
var _r = DSWeb.MvcShipping.Helper.JsonConvert.Deserialize<>(result.Data.ToString());
var cdc = new CommonDataContext();
foreach (var item in _r.data.Order)
{
if (item.State == 0)
{
result.SetErrorInfo("开票失败");
//InvoiceHead.INVOICESERIALNUM = "";
//cdc.ch_fee_invoice.AddOrUpdate(InvoiceHead);
//cdc.SaveChanges();
}
if (item.State == 1)
{
result.OK("已提交待上传");
}
if (item.State == 2)
{
result.OK("已上传待开票");
}
if (item.State == 3)
{
result.OK("开票成功");
InvoiceHead.INVOICENO = item.fphm;
InvoiceHead.INVOICEPDFURL = item.FileUrl;
InvoiceHead.BILLSTATUS = 1;
InvoiceHead.EINVOICESTATE = "2";
cdc.ch_fee_invoice.AddOrUpdate(InvoiceHead);
cdc.SaveChanges();
}
if (item.State == 4)
{
result.SetErrorInfo("开票失败:" + item.UpMessage);
InvoiceHead.INVOICESERIALNUM = "";
cdc.ch_fee_invoice.AddOrUpdate(InvoiceHead);
cdc.SaveChanges();
}
}
return result;
}
}
public class PortTokenmb
{
public string message { get; set; }

@ -62,6 +62,9 @@ using DSWeb.SoftMng.Model;
using System.Configuration;
using ICSharpCode.SharpZipLib.BZip2;
using DSWeb.MvcShipping.Models.CodeCtnEdi;
using DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount;
using DSWeb.MvcShipping.Models.MsSysThirdPartyAccount;
using System.Collections.Specialized;
namespace DSWeb.Areas.CommMng.DAL
{
@ -3494,12 +3497,6 @@ namespace DSWeb.Areas.CommMng.DAL
}
}
public static string Unicode2String(string source)
{
return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(
source, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
}
#region 付费方式
static public List<CodeFrtModel> GetCodeFrtList()
@ -7354,6 +7351,327 @@ namespace DSWeb.Areas.CommMng.DAL
return result;
}
public static DBResult DJYAPICanUse(string USERID, string APINAME = "")
{
var result = new DBResult();
//var DJYUPDATE = MsSysParamSetDAL.GetData("PARAMNAME='DJYUPDATE'");
//if (DJYUPDATE.PARAMVALUE != "1") return result;
result.OK();
var ReceiveDjydc = ConfigurationManager.AppSettings["ReceiveDjydc"];
if (ReceiveDjydc != null && ReceiveDjydc.ToString().ToUpper() == "TRUE")
{
if (ReceiveDjydc == "true")
{
//SaveLog("", "", "接收大简云订舱", "启动接收");
}
else
{
//result.SetErrorInfo("系统参数ReceiveDjydc没有设为true");
//没有设置为true 代表不需要执行
//返回false ""
return result.SetErrorInfo("");
}
}
try
{
var cdc = new CommonDataContext();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var DJYURL = MsSysParamSetDAL.GetData("PARAMNAME='DJYAPIURL'");
if (!string.IsNullOrEmpty(DJYURL.PARAMVALUE))
{
// /Booking/CancelBooking
//string rtn = WebRequestHelper.DoPost(DJYURL.PARAMVALUE + APIUrl, strJson);
var headers = new NameValueCollection();
if (!string.IsNullOrWhiteSpace(APINAME))
{
var accCfg = MsSysThirdPartyAccountDAL.MakeSureField(APINAME, USERID);
if (accCfg.Success)
{
}
else
{
result.SetErrorInfo($"[{APINAME}]没有设置第三方账号;");
}
//headers["USER_KEY"] = "0c635164b5b140828d156f178c86113c";
//headers["USER_SECRET"] = "7d23ef98894358e261996f46fb7d63aa8428a3d558cb21ed116f88c77642ba781c361c94cb1a8031";
}
}
else
{
result.SetErrorInfo($"系统参数中需要配置:大简云接口服务地址(DJYAPIURL)");
//MsSysParamSetDAL.SaveSysParamValue("DJYAPIURL", "大简云接口服务地址", "http://60.209.125.238:35100");
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
SaveLog(JsonConvert.Serialize(e), "", "DJYAPI", "错误");
}
if (!result.Success)
{
SaveLog(JsonConvert.Serialize(result), "", "DJYAPI", "错误");
}
return result;
}
public static DBResult SendToDJY(string APIUrl, string strJson, string USERID, string APINAME = "", string APIDETAILNAME = "", string USERKEY = "", string USERSECRET = "")
{
var result = new DBResult();
//var DJYUPDATE = MsSysParamSetDAL.GetData("PARAMNAME='DJYUPDATE'");
//if (DJYUPDATE.PARAMVALUE != "1") return result;
var ReceiveDjydc = ConfigurationManager.AppSettings["ReceiveDjydc"];
if (ReceiveDjydc != null && ReceiveDjydc.ToString().ToUpper() == "TRUE")
{
//if (ReceiveDjydc == "true")
//{
// //SaveLog("", "", "接收大简云订舱", "启动接收");
//}
//else
//{
// return result.SetErrorInfo("系统参数ReceiveDjydc没有设为true");
//}
}
else
{
return result;
}
try
{
var cdc = new CommonDataContext();
T_ALL_DA T_ALL_DA = new T_ALL_DA();
var DJYURL = MsSysParamSetDAL.GetData("PARAMNAME='DJYAPIURL'");
var headers = new NameValueCollection();
if (!string.IsNullOrEmpty(DJYURL.PARAMVALUE))
{
// /Booking/CancelBooking
//string rtn = WebRequestHelper.DoPost(DJYURL.PARAMVALUE + APIUrl, strJson);
//
if (!string.IsNullOrWhiteSpace(USERKEY) && !string.IsNullOrWhiteSpace(USERSECRET))
{
headers["USER_KEY"] = USERKEY;
headers["USER_SECRET"] = USERSECRET;
}
else
{
if (!string.IsNullOrWhiteSpace(APINAME))
{
var accCfg = MsSysThirdPartyAccountDAL.MakeSureField(APINAME, USERID);
//枚举类型96050 维护api地址。有时一个业务有多个api但是使用同一组userkey和secret
//因此如果通过 apiname=第三方账号密码设置中的类型 找不到内容
//则通过枚举类型96050当中enumvalueid=apiname 查找 enumvaluename(在这里存放apiurl)
if (accCfg.Success)
{
var accCfgInfo = (SysThirdPartyAccount)accCfg.Data;
headers["USER_KEY"] = accCfgInfo.ACCOUNT;
headers["USER_SECRET"] = accCfgInfo.ACCOUNTPSW;
var enumValue = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96020 && x.EnumValueName == APINAME).ToList();
if (enumValue != null && enumValue.Count > 0)
{
APIUrl = enumValue[0].EnumValueName_2;
}
}
else
{
result.SetErrorInfo($"[{APINAME}]没有设置第三方账号;");
return result;
}
}
//headers["USER_KEY"] = "0c635164b5b140828d156f178c86113c";
//headers["USER_SECRET"] = "7d23ef98894358e261996f46fb7d63aa8428a3d558cb21ed116f88c77642ba781c361c94cb1a8031";
}
var apiurlList = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96050).ToList();
if (apiurlList != null && apiurlList.Count > 0 && apiurlList.Exists(x => x.EnumValueID == APIDETAILNAME))
{
APIUrl = apiurlList.First(x => x.EnumValueID == APIDETAILNAME).EnumValueName;
}
BasicDataRefDAL.SaveLog(DJYURL.PARAMVALUE + APIUrl + "////" + strJson, $"{APINAME};{APIDETAILNAME}", "大简云接口调用", "发送");
var rtn = DSWeb.Areas.MvcShipping.Comm.WebRequestHelper.DoPost_JSON_Header(DJYURL.PARAMVALUE + APIUrl, strJson, 30000, headers);
BasicDataRefDAL.SaveLog(rtn, $"{APINAME};{APIDETAILNAME}", "大简云接口调用", "返回");
result.OK("同步完成", rtn);
}
else
{
MsSysParamSetDAL.SaveSysParamValue("LQTYAPIURL", "乐企他用接口服务地址", "http://47.105.115.105:26650");
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
SaveLog(JsonConvert.Serialize(e), "", "SendToDJY", "错误");
}
return result;
}
public static void CheckWebconfig(string itemname, ref DBResult result)
{
var item = ConfigurationManager.AppSettings[itemname];
if (string.IsNullOrWhiteSpace(item))
{
result.SetErrorInfo($"系统配置文件中没有配置【{itemname}】项目");
}
else
{
result.OK();
}
}
public static string GetWebconfig(string itemname)
{
var dbresult = new DBResult();
CheckWebconfig(itemname, ref dbresult);
if (dbresult.Success == true)
{
var item = ConfigurationManager.AppSettings[itemname];
return item == null ? "" : item;
}
return "";
}
/// <summary>
///
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public static DBResult SendEmailByDjy(DjyEmailSendReq req)
{
//从系统参数中寻找某值 如果没有则新建之
var result = new DBResult();
var url = "http://47.104.73.97:8801/mail/send";
var DJYMailInterfaceURL = MsSysParamSetDAL.GetData("PARAMNAME='DJYMAILInterface'");
if (!string.IsNullOrEmpty(DJYMailInterfaceURL.PARAMVALUE))
{
url = DJYMailInterfaceURL.PARAMVALUE;
}
else
{
MsSysParamSetDAL.SaveSysParamValue("DJYMAILInterface", "大简云邮件服务地址", "http://47.104.73.97:8801/mail/send");
}
if (string.IsNullOrWhiteSpace(url))
{
result.SetErrorInfo("未配置大简云邮件接口");
return result;
}
var _json = "[" + JsonConvert.Serialize(req) + "]";
string res1 = DSWeb.Areas.MvcShipping.Comm.WebRequestHelper.DoPost(url, _json);
var res = JsonConvert.Deserialize<DjyEmailSendRes>(res1);
if (res.Success)
{
result.OK(res.Message);
return result;
}
else
{
result.SetErrorInfo(res.Message);
return result;
}
}
/// <summary>
/// 下载指定URL的文件并返回Base64字符串
/// </summary>
/// <param name="URL"></param>
/// <returns></returns>
public static string GetUrlBase64(string URL)
{
try
{
WebClient mywebclient = new WebClient();
byte[] Bytes = mywebclient.DownloadData(URL);
string Base64string = Convert.ToBase64String(Bytes);
return Base64string;
}
catch (Exception ex)
{
}
return "";
}
/// <summary>
/// <summary>
/// 字符串转Unicode
/// </summary>
/// <param name="source">源字符串</param>
/// <returns>Unicode编码后的字符串</returns>
public static string String2Unicode(string source)
{
if (string.IsNullOrWhiteSpace(source)) return "";
byte[] bytes = Encoding.Unicode.GetBytes(source);
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < bytes.Length; i += 2)
{
stringBuilder.AppendFormat("\\u{0}{1}", bytes[i + 1].ToString("x").PadLeft(2, '0'), bytes[i].ToString("x").PadLeft(2, '0'));
}
return stringBuilder.ToString();
}
/// <summary>
/// Unicode转字符串
/// </summary>
/// <param name="source">经过Unicode编码的字符串</param>
/// <returns>正常字符串</returns>
public static string Unicode2String(string source)
{
if (string.IsNullOrWhiteSpace(source)) return "";
return new Regex(@"\\u([0-9A-F]{4})", RegexOptions.IgnoreCase | RegexOptions.Compiled).Replace(
source, x => string.Empty + Convert.ToChar(Convert.ToUInt16(x.Result("$1"), 16)));
}
}
public class BarCodeDrawing

@ -1756,6 +1756,122 @@ namespace DSWeb.Areas.CommMng.Models
}
/// 大简云邮箱接口请求
/// </summary>
public class DjyEmailSendReq
{
/// <summary>
/// 接收邮箱
/// </summary>
public string SendTo { get; set; }
/// <summary>
/// 抄送
/// </summary>
public string CCTo { get; set; }
/// <summary>
/// 邮件标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 邮件正文
/// </summary>
public string Body { get; set; }
/// <summary>
/// 邮件显示的发送人 不设置则显示发送的邮箱
/// </summary>
public string ShowName { get; set; }
/// <summary>
/// 发送邮箱配置(发件邮箱)
/// </summary>
public string SmtpConfig { get; set; }
/// <summary>
/// 附件列表
/// </summary>
public List<Attaches> Attaches { get; set; }
/// <summary>
/// 自定义发送的邮箱账号 发件邮箱的账号,使用自定义邮箱发送邮件时,必须指定
/// </summary>
public string Account { get; set; }
/// <summary>
/// 自定义发送的邮箱密码 发件邮箱的密码,使用自定义邮箱发送邮件时,必须指定
/// </summary>
public string Password { get; set; }
/// <summary>
/// 自定义发送的邮箱服务器 发件邮箱的服务器地址,使用自定义邮箱发送邮件时,必须指定
/// </summary>
public string Server { get; set; }
/// <summary>
/// 自定义发送的发件端口 发件邮箱的端口,使用自定义邮箱发送邮件时,必须指定
/// </summary>
public int Port { get; set; }
/// <summary>
/// 自定义发送是否使用ssl 发件邮箱的是否使用SSL使用自定义邮箱发送邮件时必须指定
/// </summary>
public bool UseSSL { get; set; }
}
/// <summary>
/// 附件信息
/// </summary>
public class Attaches
{
/// <summary>
/// 附件名称 在邮件中显示的附件名称
/// </summary>
public string AttachName { get; set; } = string.Empty;
/// <summary>
/// 附件内容 以base64编码的字符串
/// </summary>
public string AttachContent { get; set; } = string.Empty;
}
/// <summary>
/// SmtpConfig选项枚举
/// </summary>
public enum SmtpConfigEnum
{
/// <summary>
/// dongshengcangdan@h8j.top
/// </summary>
CANGDAN,
/// <summary>
/// inv@mail.myshipping.net
/// </summary>
INVOICE,
/// <summary>
/// noreplay@mail.myshipping.net
/// </summary>
NOREPLAY,
/// <summary>
/// service@mail.myshipping.net
/// </summary>
SERVICE,
/// <summary>
/// spot@mail.myshipping.net
/// </summary>
SPOT,
}
/// <summary>
/// 大简云邮箱接口返回
/// </summary>
public class DjyEmailSendRes
{
/// <summary>
/// 是否成功
/// </summary>
public bool Success { get; set; }
/// <summary>
/// 说明文本
/// </summary>
public string Message { get; set; }
/// <summary>
/// 代号
/// </summary>
public string Code { get; set; }
}
}

@ -6,6 +6,9 @@ using DSWeb.MvcShipping.Models.MsSysThirdPartyAccount;
using Microsoft.Practices.EnterpriseLibrary.Data;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using DSWeb.Common.DB;
using HcUtility.Core;
using System.Linq;
namespace DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount
@ -218,6 +221,84 @@ namespace DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount
#endregion
public static DBResult MakeSureField(string THIRDPARTY, string USERID)
{
var result = new DBResult();
var currList = GetDataList($" THIRDPARTY='{THIRDPARTY}' and USERID='{USERID}' ").ToList();
if (currList == null || currList.Count == 0)
{
currList = GetDataList($" THIRDPARTY='{THIRDPARTY}' and (isnull(USERID,'')='') ").ToList();
}
if (currList == null || currList.Count == 0)
{
result.SetErrorInfo($"没有找到第三方账号类型【{THIRDPARTY}】");
var newrec = new SysThirdPartyAccount();
newrec.GID = Guid.NewGuid().ToString();
newrec.USERID = USERID;
newrec.THIRDPARTY = THIRDPARTY;
newrec.ACCOUNT = "";
newrec.ACCOUNTPSW = "";
newrec.CREATEUSER = USERID;
newrec.CREATETIME = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
newrec.MODIFIEDUSER = USERID;
newrec.MODIFIEDTIME = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
newrec.CUSTOMERNAME = "";
newrec.DbOperationType = DbOperationType.DbotIns;
newrec.ModelUIStatus = "I";
var modb = new ModelObjectDB();
var _r = modb.Save(newrec);
var cdc = new CommonDataContext();
var djyapiNameDic = new Dictionary<string, string>
{
{ "客户(往来单位)同步", "/DataSync/SyncCustomer" },
{ "批量同步客户无返回值", "/DataSync/SyncCustomerList" },
{ "批量同步船期无返回值", "/DataSync/SyncVesselDateList" },
{ "批量删除船期", "/DataSync/DeletaVesselDate" },
};
//第三方软件类型 受枚举类型96020的内容管理
var currEnumList = cdc.tSysEnumValue.Where(x => x.EnumTypeID == 96020).ToList();
if (!currEnumList.Exists(x => x.EnumValueName == THIRDPARTY))
{
var newenumValue = new tSysEnumValue_md();
newenumValue.LangID = 0;
newenumValue.EnumTypeID = 96020;
newenumValue.EnumValueID = THIRDPARTY;
newenumValue.EnumValueName = THIRDPARTY;
if (djyapiNameDic.ContainsKey(THIRDPARTY))
{
newenumValue.EnumValueName_2 = djyapiNameDic[THIRDPARTY];
}
cdc.tSysEnumValue.Add(newenumValue);
cdc.SaveChanges();
}
}
else
{
var _r = currList[0];
if (string.IsNullOrWhiteSpace(_r.ACCOUNT))
{
result.SetErrorInfo($"第三方账号类型【{THIRDPARTY}】目前没有设置值;");
}
else
{
result.OK("", currList[0]);
}
}
return result;
}
}
}

@ -0,0 +1,878 @@
using System;
using System.Collections.Generic;
using System.EnterpriseServices.CompensatingResourceManager;
using System.Linq;
using AutoMapper;
using DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin;
using DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin;
using DSWeb.Areas.Account.Models.Chfee_Invoiceapplication;
using DSWeb.Areas.MvcShipping.Helper;
using DSWeb.Areas.MvcShipping.Models.Message.VGM;
using DSWeb.Areas.SysMng.DAL.SysUser;
using DSWeb.Common.DB;
using DSWeb.MvcShipping.Models.GOODS;
using HcUtility.Comm;
using HcUtility.Core;
using Newtonsoft.Json;
using sun.tools.tree;
namespace DSWeb.MvcShipping.Models.MsChFee
{
public class LQTYInvResult
{
public string code { get; set; }
public bool success { get; set; }=false;
public string msg { get; set; }
public string msgDev { get; set; }
public string data { get; set; }
}
#region 开票请求参数
/// <summary>
/// 开票请求
/// </summary>
public class
{
public () { }
//public 乐企他用发票(ch_fee_invoice_md InvoiceHead, List<ch_fee_invoicedetail_md> InvoiceHeadDetail)
//{
// senid = InvoiceHead.GID;
// IgnoreSphfwssflhbbm = true;
// order = new List<Order>();
// var invrec = Order.getHelper(InvoiceHead, InvoiceHeadDetail);
// order.Add(invrec);
//}
public static getHelper(string BILLNO)
{
var result = new ();
var _head = ChinvoiceDAL.GetData("cm.BILLNO='" + BILLNO + "'");
var detailList = ChinvoiceDAL.GetDetailList("PID='" + _head.GID + "'");
var nuonuohead = new NuoNuoQuanDianInvoice(_head, detailList);
//var _order = AutoMapperHelper.MapTo<NuoNuoQuanDian_Head, Order>(nuonuohead.order);
//在诺诺报文的基础上再做修改
//_order.invoiceDetail = AutoMapperHelper.MapTo<List<NuoNuoQuanDian_Detail>, List<Invoicedetail>>(nuonuohead.order.invoiceDetail);
var _order = new Order();
_order.invoiceType = nuonuohead.order.invoiceType;
_order.orderNo=nuonuohead.order.orderNo;
_order.email= nuonuohead.order.email;
_order.xsfkhh = "";
_order.xsfzh = "";
_order.salerTel = nuonuohead.order.salerTel;
_order.salerAddress = nuonuohead.order.salerAddress;
_order.buyerTaxNum = nuonuohead.order.buyerTaxNum;
_order.buyerName = nuonuohead.order.buyerName;
_order.buyerAddress = nuonuohead.order.buyerAddress;
_order.buyerTel = nuonuohead.order.buyerTel;
_order.gmfkhh = "";
_order.gmfzh = "";
_order.buyerManagerName = nuonuohead.order.buyerManagerName;
_order.jbrsfzjhm = "";//购买方经办人证件号码
_order.gmfjbrlxdh = "";
_order.skyhmc = "";
_order.skyhzh = "";
_order.checker = nuonuohead.order.checker;
_order.payee = nuonuohead.order.payee;
_order.hjse = detailList.Sum(s => s.TAX);//税额
_order.hjje = _head.INVAMOUNT- _order.hjse;//发票金额
_order.jshj = _head.INVAMOUNT;//发票金额
_order.clerk = nuonuohead.order.clerk;
var = SysUserDAL.GetData(" SHOWNAME='" + _order.clerk + "'");
_order.kprzjhm = .IDCARD;
_order.kprzjlx = "201";
_order.remark = nuonuohead.order.remark;
_order.invoiceLine = nuonuohead.order.invoiceLine;
_order.gmfzrrbz = "";
_order.tdys = "";//特定要素
_order.cezslxDm = "";//差额征税类型代码
_order.sgfplxDm = "";//收购发票类型代码
_order.ckywsyzcDm = "";//出口业务适用政策代码
_order.zzsjzjtDm = "";//增值税即征即退代码 暂时保持为空
_order.jsfs = "";//结算方式 //暂时保持为空
_order.invoiceDetail = new List<Invoicedetail>();
var cdc = new CommonDataContext();
var goodsinv = cdc.code_goods_inv.Where(x => 1 == 1).ToList();
var mxxh = 1;
foreach (var detail in nuonuohead.order.invoiceDetail)
{
var newdetail = new Invoicedetail();
newdetail.mxxh=mxxh;
newdetail.xmmc = detail.goodsName;
newdetail.spfwjc = "";//商品服务简称 大类目 由服务端根据goodsCode现查
newdetail.goodsCode = detail.goodsCode;//商品和服务税收分类合并编码
newdetail.specType=detail.specType;
newdetail.unit=detail.unit;
newdetail.price=detail.price;
newdetail.num=detail.num;
newdetail.taxExcludedAmount = Convert.ToDecimal( detail.taxExcludedAmount);
newdetail.taxRate = Convert.ToDecimal(detail.taxRate);
newdetail.tax= Convert.ToDecimal(detail.tax);
newdetail.taxIncludedAmount = Convert.ToDecimal(detail.taxIncludedAmount);
newdetail.deduction = "";
newdetail.invoiceLineProperty = detail.invoiceLineProperty;
//newdetail.favouredPolicyFlag = detail.favouredPolicyFlag;
newdetail.favouredPolicyFlag = "";
//if (goodsinv.Exists(x => x.GID == detail.goodsName))
//{
// //newdetail.favouredPolicyFlag = detail.favouredPolicyFlag;
// var gi = goodsinv.First(x => x.GID == detail.goodsName);
// if (gi.DEFREMARK == "免税")
// {
// newdetail.favouredPolicyFlag = "03";
// }
//}
if (detail.favouredPolicyName == "免税") {
newdetail.favouredPolicyFlag = "03";
}
_order.invoiceDetail.Add(newdetail);
mxxh++;
}
result.order = new List<Order>();
result.order.Add(_order);
result.senid = _head.GID;
result.IgnoreSphfwssflhbbm = true;
return result;
}
/// <summary>
/// 唯一标识由企业自己生成32位随机码【消息体】
/// </summary>
public string senid { get; set; }
/// <summary>
/// 忽略商品和服务税收分类合并编码提醒
/// </summary>
public bool IgnoreSphfwssflhbbm { get; set; }
/// <summary>
/// 请求体
/// </summary>
///
public List<Order> order { get; set; }
}
public class Order
{
DBResult CanSend { get; set; }
public Order() { }
public string invoiceType { get; set; }
public string orderNo { get; set; }
public string email { get; set; }
/// <summary>
/// 销售方开户行
/// </summary>
public string xsfkhh { get; set; }
/// <summary>
/// 销售方账号
/// </summary>
public string xsfzh { get; set; }
/// <summary>
/// 销方电话
/// </summary>
public string salerTel { get; set; }
/// <summary>
/// 销方地址
/// </summary>
public string salerAddress { get; set; }
/// <summary>
/// 购方税号
/// </summary>
public string buyerTaxNum { get; set; }
/// <summary>
/// 购方名称
/// </summary>
public string buyerName { get; set; }
/// <summary>
/// 购方地址
/// </summary>
public string buyerAddress { get; set; }
/// <summary>
/// 购方电话
/// </summary>
public string buyerTel { get; set; }
/// <summary>
/// 购买方开户行
/// </summary>
public string gmfkhh { get; set; }
/// <summary>
/// 购买方账号
/// </summary>
public string gmfzh { get; set; }
/// <summary>
/// 购买方经办人姓名
/// </summary>
public string buyerManagerName { get; set; }
/// <summary>
/// 经办人证件号码
/// </summary>
public string jbrsfzjhm { get; set; }
/// <summary>
/// 购买方经办人联系电话
/// </summary>
public string gmfjbrlxdh { get; set; }
/// <summary>
/// 收款银行名称
/// </summary>
public string skyhmc { get; set; }
/// <summary>
/// 收款银行账号
/// </summary>
public string skyhzh { get; set; }
/// <summary>
/// 复核人
/// </summary>
public string checker { get; set; }
/// <summary>
/// 收款人
/// </summary>
public string payee { get; set; }
/// <summary>
/// 合计金额
/// </summary>
public decimal hjje { get; set; }
/// <summary>
/// 合计税额
/// </summary>
public decimal hjse { get; set; }
/// <summary>
/// 金税合计
/// </summary>
public decimal jshj { get; set; }
/// <summary>
/// 开票员
/// </summary>
public string clerk { get; set; }
/// <summary>
/// 开票人证件号码
/// </summary>
public string kprzjhm { get; set; }
/// <summary>
/// 开票人证件类型
/// </summary>
public string kprzjlx { get; set; }
/// <summary>
/// 备注
/// </summary>
public string remark { get; set; }
/// <summary>
/// 发票种类 bs:电子发票(增值税专用发票)-即数电专票(电子), pc:电子发票(普通发票)-即数电普票(电子)
/// </summary>
public string invoiceLine { get; set; }
/// <summary>
/// 购买方自然人标志
/// </summary>
public string gmfzrrbz { get; set; }
/// <summary>
/// 特定要素
/// </summary>
public string tdys { get; set; }
/// <summary>
/// 差额征税类型代码
/// </summary>
public string cezslxDm { get; set; }
/// <summary>
/// 收购发票类型代码
/// </summary>
public string sgfplxDm { get; set; }
/// <summary>
/// 出口业务适用政策代码
/// </summary>
public string ckywsyzcDm { get; set; }
/// <summary>
/// 增值税即征即退代码
/// </summary>
public string zzsjzjtDm { get; set; }
/// <summary>
/// 结算方式
/// </summary>
public string jsfs { get; set; }
/// <summary>
/// 应税发生地
/// </summary>
public string ysxwfsd { get; set; }
/// <summary>
/// 是否展示销售方银行账号标签
/// </summary>
public string sfzsxsfyhzhbq { get; set; }
/// <summary>
/// 是否展示购买方银行账号标签
/// </summary>
public string sfzsgmfyhzhbq { get; set; }
public List<Invoicedetail> invoiceDetail { get; set; }
public List<fjysList> fjysList { get; set; }=new List<fjysList>();
public List<cekcList> cekcList { get; set; } = new List<cekcList>();
}
public class Invoicedetail
{
public Invoicedetail getHelper(ch_fee_invoicedetail_md invDetail)
{
var result = new Invoicedetail();
result.mxxh = Convert.ToInt32( invDetail.SerialNo);
return result;
}
/// <summary>
/// 明细序号
/// </summary>
public int mxxh { get; set; } = 0;
/// <summary>
/// 项目名称
/// </summary>
public string xmmc { get; set; } = "";
/// <summary>
/// 商品服务简称
/// </summary>
public string spfwjc { get; set; } = "";
/// <summary>
/// 规格号型
/// </summary>
public string specType { get; set; }
/// <summary>
/// 发票行性质
/// </summary>
public string invoiceLineProperty { get; set; }
/// <summary>
/// 数量
/// </summary>
public string num { get; set; }
/// <summary>
/// 单价
/// </summary>
public string price { get; set; }
/// <summary>
/// 税额
/// </summary>
public decimal? tax { get; set; }
/// <summary>
/// 含税金额
/// </summary>
public decimal? taxIncludedAmount { get; set; }
/// <summary>
/// 金额
/// </summary>
public decimal? taxExcludedAmount { get; set; }
/// <summary>
/// 增值税税率/征收率
/// </summary>
public decimal taxRate { get; set; }
/// <summary>
/// 单位
/// </summary>
public string unit { get; set; }
/// <summary>
/// 扣除额
/// </summary>
public string deduction { get; set; } = "";
/// <summary>
/// 商品和服务税收分类合并编码
/// </summary>
public string goodsCode { get; set; }
/// <summary>
/// 优惠政策表示
/// </summary>
public string favouredPolicyFlag { get; set; }
}
public class fjysList
{
/// <summary>
/// 附加要素名称
/// </summary>
public string fjysmc { get; set; }
/// <summary>
/// 附加要素类型
/// </summary>
public string fjyslx { get; set; }
/// <summary>
/// 附加要素值
/// </summary>
public string fjysz { get; set; }
}
public class cekcList
{
/// <summary>
/// 序号
/// </summary>
public int xh { get; set; }
/// <summary>
/// 凭证类型
/// </summary>
public string pzlx { get; set; }
/// <summary>
/// 发票代码
/// </summary>
public string fpdm { get; set; }
/// <summary>
/// 发票号码
/// </summary>
public string fphm { get; set; }
/// <summary>
/// 差额凭证号码
/// </summary>
public string cepzhm { get; set; }
/// <summary>
/// 开具日期
/// </summary>
public string kjrq { get; set; }
/// <summary>
/// 凭证合计金额
/// </summary>
public string pzhjje { get; set; }
/// <summary>
/// 本次扣除金额
/// </summary>
public string bckcje { get; set; }
/// <summary>
/// 备注
/// </summary>
public string bz { get; set; }
}
public class : LQTYInvResult
{
}
public class : LQTYInvResult
{
public new readdata data { get; set; }
}
public class readdata
{
public List<readOrder> Order { get; set; }
}
public class readOrder
{
public int State { get; set; }
public string fphm { get; set; }
public string UpMessage { get; set; }
public string FileUrl { get; set; }
public string orderNo { get; set; }
}
public class
{
/// <summary>
/// 随机GID
/// </summary>
public string senid { get; set; }
/// <summary>
/// 蓝票的BILLNO
/// </summary>
public string orderNo { get; set;}
/// <summary>
/// 冲红原因
/// </summary>
public string chyyDm { get; set; }
/// <summary>
/// 录入方身份 0销方 1购方 暂时固定为 0
/// </summary>
public string lrfsf { get; set; } = "0";
public () { }
public (ChInvoice_HangXin head)
{
senid=Guid.NewGuid().ToString();
orderNo = head.BILLNO;
chyyDm = head.redReason;
lrfsf = "0";
}
}
public class : LQTYInvResult
{
public new data { get; set; }
}
public class
{
public string hzqrxxztDm { get; set; }
public string senid { get; set; }
}
#endregion
#region 读取参数
#endregion
}

@ -333,6 +333,8 @@ namespace DSWeb.Areas.SysMng.Models.SysUser
public string USERCOMPANYGID { get; set; }
public string USERBASEINFOGID { get; set; }
public string IDCARD { get; set; }
#region private Fields
private string _isUseSystem = string.Empty;
private string _isOperator = string.Empty;

@ -8543,6 +8543,7 @@
<Compile Include="Areas\MvcShipping\Models\MsChFee\MsDjyFee.cs" />
<Compile Include="Areas\MvcShipping\Models\MsChFee\MsDjyInvoiceFee.cs" />
<Compile Include="Areas\MvcShipping\Models\MsChFee\MsInvoiceFee.cs" />
<Compile Include="Areas\MvcShipping\Models\MsChFee\MsLeQiTaYongInvoice.cs" />
<Compile Include="Areas\MvcShipping\Models\MsCodeStlMode\CodeStlModeModel.cs" />
<Compile Include="Areas\MvcShipping\Models\MsCodeExcelImpFormat\MsCodeExcelImpFormat.cs" />
<Compile Include="Areas\MvcShipping\Models\MsCodeFeeTemplateAuto\CodeFeeTemplateAuto.cs" />

Loading…
Cancel
Save