|
|
|
@ -23,6 +23,8 @@ using DSWeb.Areas.SysMng.DAL.DBTableConn;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysInvInterFaceSet;
|
|
|
|
|
using static System.Net.WebRequestMethods;
|
|
|
|
|
using sun.security.krb5.@internal.crypto;
|
|
|
|
|
using DSWeb.Areas.CommMng.Controllers;
|
|
|
|
|
using DSWeb.MvcShipping.DAL.MsSysParamSet;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
{
|
|
|
|
@ -44,6 +46,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
private string _INVOICELINE = "p";
|
|
|
|
|
//发票种类:p,普通发票(电票)(默认);c,普通发票(纸票);s,专用发票;e,收购发票(电票);f,收购发票(纸质) 80003
|
|
|
|
|
|
|
|
|
|
public bool 全电发票() { return (_INVOICELINE == "bs" || _INVOICELINE == "pc" || _INVOICELINE == "es" || _INVOICELINE == "ec"); }
|
|
|
|
|
|
|
|
|
|
private string _EINVOICESTATE = string.Empty; //接口开票是否成功。开票成功时记录为true 80004
|
|
|
|
|
private string _INVOICEINFOURL = string.Empty; //发票详情地址 一个url 直接显示诺诺开票的发票详情页 开票成功后读取发票详情并记录
|
|
|
|
|
private string _INVOICEPDFURL = string.Empty; //发票PDF地址 开票成功后读取发票详情并记录
|
|
|
|
@ -201,6 +205,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
set { _EINVOICESTATEREF = value; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 销方税号
|
|
|
|
|
/// </summary>
|
|
|
|
|
new public string TAXCODE
|
|
|
|
|
{
|
|
|
|
|
get { return _TAXCODE; }
|
|
|
|
@ -268,6 +275,12 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
[ModelDB]
|
|
|
|
|
public string billInfoNo { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单 uuid
|
|
|
|
|
/// </summary>
|
|
|
|
|
[ModelDB]
|
|
|
|
|
public string billUuid { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -856,6 +869,176 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
|
|
public class NuoNuoQuanDian_RedConfirm : HXInvoice_Head
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public NuoNuoQuanDian_RedConfirm()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public NuoNuoQuanDian_RedConfirm(ChInvoice_HangXin _ChInvoice)
|
|
|
|
|
{
|
|
|
|
|
ChInvoice_HangXin = _ChInvoice;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单申请号,需要保持唯一,不传的话系统自动生成一个;
|
|
|
|
|
/// 此处使用蓝票的billno
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billId { get { return ChInvoice_HangXin.BILLNO; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对应蓝票发票种类: bs:电子发票(增值税专用发票), pc:电子发票(普通发票),es:全电纸质发票(增值税专用发票), ec:全电纸质发票(普通发票
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueInvoiceLine { get { return ChInvoice_HangXin.INVOICELINE; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 申请方(录入方)身份: 0 销方 1 购方
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string applySource { get; set; } = "0";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 对应蓝票全电号码(全电普票、全电专票都需要)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueInvoiceNumber { get { return ChInvoice_HangXin.REDNUM; } }
|
|
|
|
|
|
|
|
|
|
public string billTime { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 销方税号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerTaxNo { get { return ChInvoice_HangXin.TAXCODE; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 销方名称,申请说明为销方申请时可为空
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerName { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 部门门店 id(诺诺网系统中的 id)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string departmentId { get; set; } = "";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 开票员 id(诺诺网系统中的 id)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string clerkId { get; set; } = "";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 购方税号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerTaxNo
|
|
|
|
|
{
|
|
|
|
|
get { return ChInvoice_HangXin.CUSTRATENO; }
|
|
|
|
|
}
|
|
|
|
|
///// <summary>
|
|
|
|
|
///// 购方名称 父类已有
|
|
|
|
|
///// </summary>
|
|
|
|
|
//public string buyerName
|
|
|
|
|
//{
|
|
|
|
|
// get { return ChInvoice_HangXin.INVOICECUSTNAME; }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 蓝字发票增值税用途(预留字段可为空): 1 勾选抵扣 2 出口退税 3 代办出口退税 4 不抵扣
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string vatUsage { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 蓝字发票消费税用途(预留字段可为空)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string saleTaxUsage { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发票入账状态(预留字段可为空): 0 未入账 1已入账
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string accountStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 冲红原因: 1 销货退回 2 开票有误 3 服务中止 4 销售折让
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string redReason { get { return ChInvoice_HangXin.redReason; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 分机号 150
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string extensionNumber { get; set; } = "150";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 是否自动开票,0 否(不传默认 0)1 是;传 1时,
|
|
|
|
|
/// 所申请的确认单变为购销双方已确认或无需确认状态时,
|
|
|
|
|
/// 而自动开具红票。目前该字段不生效,电票都自动开,纸票都不自动
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string autoInvoice { get; set; } = "1";
|
|
|
|
|
|
|
|
|
|
//若有值,则在无需确认或购销双方已确认后去自动开红票,发票的开票单号用该值
|
|
|
|
|
//public string orderNo { get { return ChInvoice_HangXin.BILLNO; } }
|
|
|
|
|
|
|
|
|
|
public string phone { get { return ChInvoice_HangXin.PUSHMOBILE; } }
|
|
|
|
|
public string email { get { return ChInvoice_HangXin.PUSHEMAIL; } }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 依托ds7系统中保存的红票,来读取当时发出的红字发票确认单
|
|
|
|
|
/// 由于当时发出的申请单编号,是红字发票的BILLNO,故可以依据这个进行读取
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonObject]
|
|
|
|
|
public class NuoNuoQuanDian_ReadRedConfirm : HXInvoice_Head
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public NuoNuoQuanDian_ReadRedConfirm()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
public NuoNuoQuanDian_ReadRedConfirm(ChInvoice_HangXin _ChInvoice)
|
|
|
|
|
{
|
|
|
|
|
ChInvoice_HangXin = _ChInvoice;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 操作方身份: 0 销方 1 购方
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string identity { get; set; } = "0";
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单状态(不传则查全部状态):
|
|
|
|
|
/// 01 无需确认
|
|
|
|
|
/// 02销方录入待购方确认 03 购方录入待销方确认
|
|
|
|
|
/// 04 购销双方已确认
|
|
|
|
|
/// 05 作废(销方录入购方否认)
|
|
|
|
|
/// 06 作废(购方录入销方否认) 07 作废(超 72 小时未确认)
|
|
|
|
|
/// 08 作废(发起方已撤销) 09 作废(确认后撤销) 15 申请中 16 申请失败
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单申请号 ds7当中红票的billno
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billId { get { return ChInvoice_HangXin.BILLNO; } }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单编号
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billNo { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 红字确认单 uuid
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billUuid { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 填开起始时间,确认单申请号/编号/uuid 有值时,可为空, 允许最大查询范围为 90 天
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billTimeStart { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 填开结束时间,确认单申请号/编号/uuid 有值时,可为空, 允许最大查询范围为 90 天
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billTimeEnd { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 每页数量(默认 10,最大 50)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string pageSize { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 当前页码(默认 1)
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string pageNo { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 航信接口token管理
|
|
|
|
@ -1880,7 +2063,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
//接口函数的地址不同
|
|
|
|
|
public DBResult ReadInvoice(ChInvoice_HangXin head)
|
|
|
|
|
{
|
|
|
|
|
if (string.IsNullOrEmpty(head.INVOICESERIALNUM))
|
|
|
|
|
if (string.IsNullOrEmpty(head.INVOICESERIALNUM) && !head.全电发票())
|
|
|
|
|
{
|
|
|
|
|
var result = new DBResult { Success = false, Message = "还未成功进行平台开票,无可读数据", Data = "" };
|
|
|
|
|
return result;
|
|
|
|
@ -1926,8 +2109,17 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
if (_return.code == "E0000")
|
|
|
|
|
{
|
|
|
|
|
//开票信息读取成功
|
|
|
|
|
var returndate = ChinvoiceDAL.GetData("cm.INVOICESERIALNUM='" + head.INVOICESERIALNUM + "'");
|
|
|
|
|
head = returndate;
|
|
|
|
|
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];
|
|
|
|
@ -1950,7 +2142,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
head.ModelUIStatus = "E";
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
var result = modb.Save(head);
|
|
|
|
|
if (!result.Success) return result;
|
|
|
|
|
if (!result.Success)
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
result.Message = info.statusMsg;
|
|
|
|
|
if (result.Message.IndexOf("失败") >= 0)
|
|
|
|
@ -1965,7 +2158,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
else {
|
|
|
|
|
result.Message += ":" + info.failCause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
result.Data= head;
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -2172,6 +2365,197 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 诺诺全电 红字确认单申请
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="head"></param>
|
|
|
|
|
/// <param name="detailList"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DBResult PostRedConfirm( ChInvoice_HangXin head,ref ChInvoice_HangXin bluehead,List<ChInvoiceDetail> detailList)
|
|
|
|
|
{
|
|
|
|
|
//var billno = head.BILLNO;
|
|
|
|
|
|
|
|
|
|
var _head = new NuoNuoQuanDian_RedConfirm(head);
|
|
|
|
|
|
|
|
|
|
var json = DSWeb.TruckMng.Helper.JsonConvert.Serialize(_head);
|
|
|
|
|
|
|
|
|
|
string method = "nuonuo.OpeMplatform.saveInvoiceRedConfirm";
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺全电", "红字确认单", "发送值");
|
|
|
|
|
string rtn = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json);
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(rtn, "诺诺全电", "红字确认单", "返回值");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _return = DSWeb.TruckMng.Helper.JsonConvert.Deserialize<红字申请单发送返回值>(rtn.Trim('"'));
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
if (_return.code == "E0000")
|
|
|
|
|
{
|
|
|
|
|
//红字申请单提交成功
|
|
|
|
|
|
|
|
|
|
//读取红字确认单
|
|
|
|
|
var _r= ReadRedConfirm(ref head, detailList);
|
|
|
|
|
|
|
|
|
|
if (!_r.Success)
|
|
|
|
|
{
|
|
|
|
|
return _r;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var hx = 诺诺全电发票.getHelper(head.TAXCODE);
|
|
|
|
|
if (!hx.CanUse)
|
|
|
|
|
{
|
|
|
|
|
result.SetErrorInfo(hx.ERRORMSG);
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
//if (hx.accessToken == "")
|
|
|
|
|
//{
|
|
|
|
|
// BasicDataRefDAL.SaveLog("NNReadInv;税号" + head.TAXCODE + "的 accessToken为空", "", "诺诺平台", "返回认证窗口");
|
|
|
|
|
// var _r = TokenPage();
|
|
|
|
|
// return _r;
|
|
|
|
|
//}
|
|
|
|
|
result = hx.ReadInvoice(head);
|
|
|
|
|
|
|
|
|
|
if (!result.Success)
|
|
|
|
|
{
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (result.Message == "需要重新认证")
|
|
|
|
|
//{
|
|
|
|
|
// //HangXinRequestHelper.clear(hx.accessToken);
|
|
|
|
|
// BasicDataRefDAL.SaveLog("ReadInvoice 反回‘需要重新认证’", "", "诺诺平台", "返回认证窗口");
|
|
|
|
|
// var _r = TokenPage();
|
|
|
|
|
// return _r;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
var returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
|
|
|
|
|
|
|
|
|
|
if (head.PTORRED == "2")
|
|
|
|
|
{
|
|
|
|
|
ChinvoiceDAL.SetRed(head);
|
|
|
|
|
|
|
|
|
|
//将原票内的申请和费用恢复原状
|
|
|
|
|
//var BlueInvoice = ChinvoiceDAL.GetData(" cm.INVOICECODE='" + head.REDCODE + "' and cm.INVOICENO='" + head.REDNUM + "'");
|
|
|
|
|
//result = SetInvoiceFee(BlueInvoice);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果状态为开出成功 则执行锁定
|
|
|
|
|
if (returndate.EINVOICESTATE == "2" && returndate.BILLSTATUS == 0)
|
|
|
|
|
{
|
|
|
|
|
//ChinvoiceDAL.Lock(returndate.BILLNO);
|
|
|
|
|
|
|
|
|
|
//20200106 添加 如sys_param_set.PARAMNAME=INVOICEAUTOLOCK 没有值或值为false 则不执行锁定
|
|
|
|
|
var needautolock = MsSysParamSetDAL.GetSysParam("INVOICEAUTOLOCK").isnullortrue();
|
|
|
|
|
|
|
|
|
|
if (needautolock)
|
|
|
|
|
{
|
|
|
|
|
ChinvoiceDAL.Lock(returndate.BILLNO);
|
|
|
|
|
}
|
|
|
|
|
returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.Data = returndate;
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//else if (_return.code == "070101" || _return.code == "070301")
|
|
|
|
|
//{
|
|
|
|
|
// //appkey与token问题 需要重新认证
|
|
|
|
|
// //HangXinRequestHelper.clear(accessToken);
|
|
|
|
|
// result.SetErrorInfo("需要重新认证");
|
|
|
|
|
// return result;
|
|
|
|
|
//}
|
|
|
|
|
//else if (_return.code == "E9106")
|
|
|
|
|
//{
|
|
|
|
|
// //E9106 订单编号不能重复
|
|
|
|
|
// //同billno重复发送 执行一次用订单号读取
|
|
|
|
|
// return ReadInvoice_BILLNO(head);
|
|
|
|
|
//}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bluehead.billUuid = "";
|
|
|
|
|
var reault = new DBResult(false, _return.message, head);
|
|
|
|
|
return reault;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 用户查询全电发票红字确认单
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="head"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public DBResult ReadRedConfirm(ref ChInvoice_HangXin head, List<ChInvoiceDetail> detailList=null)
|
|
|
|
|
{
|
|
|
|
|
//var billno = head.BILLNO;
|
|
|
|
|
|
|
|
|
|
var _head = new NuoNuoQuanDian_ReadRedConfirm(head);
|
|
|
|
|
|
|
|
|
|
var json = DSWeb.TruckMng.Helper.JsonConvert.Serialize(_head);
|
|
|
|
|
|
|
|
|
|
string method = "nuonuo.OpeMplatform.queryInvoiceRedConfirm";
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog("URL=" + URL + ";appKey=" + appKey + ";appSecret=" + appSecret + ";accessToken=" + accessToken + ";taxnum=" + taxnum + ";method=" + method + ";content=" + json, "诺诺全电", "读红字单", "发送值");
|
|
|
|
|
string rtn = NNOpenSDK.sendPostSyncRequest(URL, getSendid(), appKey, appSecret, accessToken, taxnum, method, json);
|
|
|
|
|
|
|
|
|
|
BasicDataRefDAL.SaveLog(rtn, "诺诺全电", "读红字单", "返回值");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var _return = DSWeb.TruckMng.Helper.JsonConvert.Deserialize<红字申请单读取返回值>(rtn.Trim('"'));
|
|
|
|
|
|
|
|
|
|
var result = new DBResult();
|
|
|
|
|
|
|
|
|
|
if (_return.code == "E0000")
|
|
|
|
|
{
|
|
|
|
|
//根据查询结果读取红票信息
|
|
|
|
|
//税务那边实际的红票的订单编号 即为红字申请单orderno,也就是当时传过去的咱们的发票BILLNO
|
|
|
|
|
|
|
|
|
|
if (_return.申请成功()) {
|
|
|
|
|
//则读取红票
|
|
|
|
|
|
|
|
|
|
//如不为空 这就是发出红字申请单之后返回结果成功立刻读的
|
|
|
|
|
//如为空 就是已产生的红票读取 就不保存了
|
|
|
|
|
if (detailList != null) {
|
|
|
|
|
head.INVOICESERIALNUM = "";
|
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
|
|
|
|
|
|
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
|
|
|
|
|
if (result.Success == true)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
result = modb.Save(head);
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//result = ReadInvoice(head);
|
|
|
|
|
//return result;
|
|
|
|
|
; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result.OK();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var reault = new DBResult(false, _return.message, head);
|
|
|
|
|
return reault;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private KPResponse dealresponse_KP(string json)
|
|
|
|
|
{
|
|
|
|
|
var result = new KPResponse();
|
|
|
|
@ -2317,6 +2701,291 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
|
|
|
|
|
public string invoiceId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
|
|
public class 红字申请单发送返回值 : KPResponse
|
|
|
|
|
{
|
|
|
|
|
//{"code":"E0000","describe":"调用成功","result":"IN2023051900001"}
|
|
|
|
|
public new string result { get; set; }
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
|
|
///解析开票命令返回值;作废命令返回值
|
|
|
|
|
public class 红字申请单读取返回值: KPResponse
|
|
|
|
|
{
|
|
|
|
|
public new 红字申请单result result { get; set; }
|
|
|
|
|
|
|
|
|
|
public bool 申请成功() {
|
|
|
|
|
return result.billStatus() == "01";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class 红字申请单result
|
|
|
|
|
{
|
|
|
|
|
public int total { get; set; }
|
|
|
|
|
public new List<红字申请单> list { get; set; }
|
|
|
|
|
|
|
|
|
|
public string billStatus() {
|
|
|
|
|
if (list == null || list.Count == 0) return null;
|
|
|
|
|
return list[0].billStatus;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class 红字申请单明细
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int id { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int detailIndex { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int blueDetailIndex { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 代理运杂费
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string goodsName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string unit { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string specType { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxExcludedPrice { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxExcludedAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string num { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxRate { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string goodsCode { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string favouredPolicyFlag { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string favouredPolicyName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string zeroRateFlag { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 经纪代理服务
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string goodsCodeAbb { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string price { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int withTaxFlag { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string deduction { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxIncludedAmount { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class 红字申请单
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int id { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billNo { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billUuid { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string requestStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string billMessage { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int openStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int applySource { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime billTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxExcludedAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxIncludeAmount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueElecInvoiceNumber { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueInvoiceNumber { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueInvoiceCode { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime blueInvoiceTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string blueInvoiceLine { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerTaxNo { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 青岛锦海运通供应链有限公司
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerTaxNo { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 青岛东宝电子有限公司
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerName { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime createTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DateTime updateTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string sellerAccount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 中国建设银行平度支行 37101997906051000773
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string buyerAccount { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string vatUsage { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string saleTaxUsage { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string accountStatus { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string departmentId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string clerkId { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string extensionNumber { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string taxNum { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string account { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string redReason { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string confirmAgreement { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string confirmReason { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string confirmTime { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public int requestSrc { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
|
public List<红字申请单明细> detail { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
|
|
///解析读取发票信息命令返回值
|
|
|
|
|