main
dengyu 1 month ago
parent 50aeba592e
commit e7a569b610

@ -1485,6 +1485,12 @@ namespace DSWeb.Areas.Account.Controllers
/// <param name="BILLNO"></param>
/// <returns></returns>
public ContentResult NNReadInv(string BILLNO, string redirecturl)
{
var headdata = ChinvoiceDAL.GetData(" cm.BILLNO='" + BILLNO + "'");
if (headdata.PTORRED == "2")
{
//如果已有pdf地址 则直接返回
var isfee = ChinvoiceDAL.GetStCount("PAYBILLNO='" + BILLNO + "'");
@ -1495,15 +1501,13 @@ namespace DSWeb.Areas.Account.Controllers
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
}
var canlogin = BasicDataRefDAL.CheckLogin(Session);
if (!canlogin.Success)
{
return (ContentResult)canlogin.Data;
}
var headdata = ChinvoiceDAL.GetData(" cm.BILLNO='" + BILLNO + "'");
JsonResponse result = new JsonResponse();

@ -27,11 +27,15 @@ 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 DSWeb.MvcShipping.DAL.MsSysThirdPartyAccount;
using DSWeb.MvcShipping.Models.MsSysThirdPartyAccount;
using DSWeb.MvcShipping.Models.MsChFee;
using System.Data.Entity.Migrations;
using IKVM.NativeCode.sun.reflect;
using System.Web.UI;
using DSWeb.Areas.SysMng.DAL.SysUser;
namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
@ -467,7 +471,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public string buyerAccount
{
get { return
get
{
return
ChInvoice_HangXin.CUSTBANK.Replace(" ", "");
}
}
@ -945,14 +951,18 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public NuoNuoQuanDian_RedConfirm(ChInvoice_HangXin _ChInvoice)
{
ChInvoice_HangXin = _ChInvoice;
//ChInvoice_HangXin.billUuid= _ChInvoice.billUuid;
}
/// <summary>
/// 红字确认单申请号,需要保持唯一,不传的话系统自动生成一个;
/// 此处使用蓝票的billno
/// 20240423 改为使用红票的GID 并去除-
/// 在初次冲红时记录在蓝票的billUuid
/// </summary>
public string billId { get { return ChInvoice_HangXin.BILLNO; } }
public string billId { get; set; }
/// <summary>
/// 对应蓝票发票种类: bs:电子发票(增值税专用发票) pc:电子发票(普通发票)es:全电纸质发票(增值税专用发票) ec:全电纸质发票(普通发票
@ -1088,8 +1098,19 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public string billStatus { get; set; }
/// <summary>
/// 红字确认单申请号 ds7当中红票的billno
/// 20240423 改为使用红票的GID 并去除-
/// 在初次冲红时记录在蓝票的billUuid
/// </summary>
public string billId { get { return ChInvoice_HangXin.BILLNO; } }
public string billId
{
get
{
return ChInvoice_HangXin.billUuid;
}
}
/// <summary>
/// 红字确认单编号
/// </summary>
@ -1565,7 +1586,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
var result = new HangXinRequestHelper();
var INVITERFACE = MsSysInvInterFaceSetDAL.GetData($"INVITERFACE='诺诺全电发票' and CORPID='{CORPID}'", "");
var INVITERFACE = MsSysInvInterFaceSetDAL.GetData($"INVITERFACE in('诺诺全电发票','东胜乐企他用') and CORPID='{CORPID}'", "");
if (string.IsNullOrWhiteSpace(INVITERFACE.NUONUOAPPKEY))
{
@ -1659,8 +1680,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
};
//诺诺全电token接口
var porturl = "http://47.104.90.170:5200/fp/free_type/";
BasicDataRefDAL.SaveLog(Newtonsoft.Json.JsonConvert.SerializeObject(dic), "诺诺全电", "重置token", "发送值");
var rtn = WebRequestHelper.DoPost(porturl, dic, 10000);
BasicDataRefDAL.SaveLog(rtn, "诺诺全电", "重置token", "返回值");
//var rtn = WebRequestHelper.DoPost(_SandBoxURL, dic, 20000);
//RepCZModel CZM = Newtonsoft.Json.JsonConvert.DeserializeObject<RepCZModel>(rtn);
@ -2268,7 +2290,131 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
head.INVOICECODE = info.invoiceCode;
head.INVOICENO = info.invoiceNo;
head.EINVOICESTATE = info.status;
head.INVOICEINFOURL = info.pdfUrl;
head.INVOICEINFOURL = info.pictureUrl;
head.INVOICEPDFURL = info.pdfUrl;
head.INVOICEMAKETIME = BasicDataRefDAL.Timestamp2Datetime(info.invoiceTime).ToString("yyyy-MM-dd HH:mm:ss");
//if (!string.IsNullOrWhiteSpace(info.invoiceSerialNum))
//{
// head.INVOICESERIALNUM = info.invoiceSerialNum;
//}
//head.REMARK = head.REMARK.Replace(info.remark,"")+ info.remark;
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
//head.INVOICEMAKETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var modb = new ModelObjectDB();
var result = modb.Save(head);
if (!result.Success)
return result;
result.Message = info.statusMsg;
if (result.Message.IndexOf("失败") >= 0)
{
result.Success = false;
result.Message += ":" + info.failCause;
//此处调用一次重推
var hx = getHelper(head);
hx.(head);
}
else
{
result.Message += ":" + info.failCause;
}
result.Data = head;
return result;
}
else
{
var failCause = "";
try
{
var info = _return.result[0];
failCause = "[" + info.failCause + "]";
}
catch
{
}
var msg = _return.code + ":" + _return.describe + failCause;
var result = new DBResult { Success = false, Message = DSWeb.TruckMng.Helper.JsonConvert.Serialize(msg), Data = "" };
return result;
}
}
public DBResult ReadRedInvoice(ChInvoice_HangXin head)
{
if (string.IsNullOrEmpty(head.INVOICESERIALNUM) && !head.())
{
var result = new DBResult { Success = false, Message = "还未成功进行平台开票,无可读数据", Data = "" };
return result;
}
string method = "nuonuo.OpeMplatform.queryInvoiceResult";
var json = "{" + "\"serialNos\":[\"" + head.INVOICESERIALNUM + "\"]," + "\"orderNo\":[]," + "\"isOfferInvoiceDetail\":0 }";
if (string.IsNullOrWhiteSpace(head.INVOICESERIALNUM))
{
//如果流水号为空 则改为按业务编号读取
method = "nuonuo.OpeMplatform.queryInvoiceResult";
json = "{" + "\"orderNos\":[\"" + head.GID.Replace("-", "") + "\"]," + "\"serialNos\":[]," + "\"isOfferInvoiceDetail\":0 }";
}
//读取业务
//string method = "nuonuo.electronInvoice.querySerialNum";
//var json = "{" + "\"orderNo\":[\"" + head.BILLNO + "\"]" + "}";
BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺平台", "读取发票信息", "发送值");
string _r = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json);
BasicDataRefDAL.SaveLog(_r, "诺诺平台", "读取发票信息", "返回值");
var _return = dealresponse_Read(_r);
if (_return.code == "070101" || _return.code == "070301")
{
//appkey与token问题 需要重新认证
//HangXinRequestHelper.clear(accessToken);
var result = new DBResult(false, "需要重新认证", null);
return result;
}
if (_return.code == "070302")
{
//appkey与token问题 需要重新认证
//HangXinRequestHelper.clear(accessToken);
var result = new DBResult(false, "需要联系诺诺平台开通相关权限", null);
return result;
}
if (_return.code == "E0000")
{
//开票信息读取成功
var returndate = new ChInvoice_HangXin();
if (!head.())
{
returndate = ChinvoiceDAL.GetData("cm.INVOICESERIALNUM='" + head.INVOICESERIALNUM + "'");
}
if (head.())
{
returndate = ChinvoiceDAL.GetData("cm.BILLNO='" + head.BILLNO + "'");
}
head = returndate;
//var invoiceSerialNum = _return.result[0].invoiceSerialNum;
var info = _return.result[0];
//立即调用读取发票信息的方法 将返回值设置进head 并保存
//head.INVOICESERIALNUM = invoiceSerialNum;
head.INVOICECODE = info.invoiceCode;
head.INVOICENO = info.invoiceNo;
head.EINVOICESTATE = info.status;
head.INVOICEINFOURL = info.pictureUrl;
head.INVOICEPDFURL = info.pdfUrl;
head.INVOICEMAKETIME = BasicDataRefDAL.Timestamp2Datetime(info.invoiceTime).ToString("yyyy-MM-dd HH:mm:ss");
@ -2532,6 +2678,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
_head.extensionNumber = extensionNumber;
_head.billId = bluehead.GID.Replace("-", "");
var json = DSWeb.TruckMng.Helper.JsonConvert.Serialize(_head);
string method = "nuonuo.OpeMplatform.saveInvoiceRedConfirm";
@ -2541,7 +2689,6 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
BasicDataRefDAL.SaveLog(rtn, "诺诺全电", "红字确认单", "返回值");
var _return = DSWeb.TruckMng.Helper.JsonConvert.Deserialize<>(rtn.Trim('"'));
var result = new DBResult();
@ -2549,14 +2696,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
if (_return.code == "E0000")
{
//红字申请单提交成功
head.billUuid = bluehead.GID.Replace("-", "");
//读取红字确认单
var _r = ReadRedConfirm(ref head, detailList);
if (!_r.Success)
{
if (_r.Message != "红字确认单申请中")
bluehead.billUuid = "";
//if (_r.Message != "红字确认单申请中")
// bluehead.billUuid = "";
return _r;
}
else
@ -2616,16 +2763,11 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
}
result.Data = returndate;
return result;
}
}
//else if (_return.code == "070101" || _return.code == "070301")
//{
@ -2642,7 +2784,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
//}
else
{
bluehead.billUuid = "";
//bluehead.billUuid = "";
var reault = new DBResult(false, _return.message, head);
return reault;
}
@ -2690,6 +2832,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
head.INVOICESERIALNUM = "";
var modb = new ModelObjectDB();
head.BILLNO = _return.result.list[0].orderNo;
head.INVOICESERIALNUM = _return.result.list[0].invoiceSerialNum;
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
if (result.Success == true)
{
@ -3100,6 +3245,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
}
public class PortTokenmb
{
public string message { get; set; }
@ -3223,7 +3369,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public string errormsg()
{
if (list == null || list.Count == 0) return null;
if (list == null || list.Count == 0) return "";
return list[0].billMessage;
}
}
@ -3331,6 +3477,11 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
///
/// </summary>
public string billNo { get; set; }
public string orderNo { get; set; }
public string invoiceSerialNum { get; set; }
/// <summary>
///
/// </summary>

@ -96,7 +96,7 @@ namespace HcUtility.Comm
if (Success != success) Message = "";
Success = success;
if (Message.IndexOf(message) >= 0)
if (!string.IsNullOrWhiteSpace(message) && Message.IndexOf(message) >= 0)
{
}

Loading…
Cancel
Save