增加对诺诺全电发票的支持。需配合升级脚本。未测试完成;原有的选择诺诺发票或者瑞宏发票的客户不受影响。

DS7_JinGang
ddlucky 2 years ago
parent 927c343e7f
commit 7c99712b3a

@ -35,6 +35,8 @@ using DSWeb.MvcShipping.DAL.MsSysInvInterFaceSet;
using DSWeb.Common.Helper;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using System.ServiceModel.Configuration;
using DSWeb.Areas.MvcShipping.Helper;
using DSWeb.SoftMng.Model;
namespace DSWeb.Areas.Account.Controllers
{
@ -997,7 +999,7 @@ namespace DSWeb.Areas.Account.Controllers
// return View();
//}
private JsonResponse checkinfo(string BILLNO, string redirecturl)
private JsonResponse checkinfo(string BILLNO, string redirecturl,string redReason="")
{
var result = new DBResult();
var head = new ChInvoice_HangXin();
@ -1012,7 +1014,6 @@ namespace DSWeb.Areas.Account.Controllers
{
jsonRespose.Success = false;
jsonRespose.Message = "发票种类不能为空!";
}
if (head.BILLNO != "")
@ -1023,11 +1024,49 @@ namespace DSWeb.Areas.Account.Controllers
if (INVITERFACE.INVITERFACE != "")
head.INVITERFACE = INVITERFACE.INVITERFACE;
else head.INVITERFACE = "诺诺发票接口";
if (head.INVITERFACE == "诺诺全电发票")
{
if (!string.IsNullOrWhiteSpace(redReason))
{
head.redReason = redReason;
}
else
{
jsonRespose.Success = false;
jsonRespose.Message = "必须选择冲红理由!";
return jsonRespose;
}
}
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
var modb = new ModelObjectDB();
result = modb.Save(head);
}
else {
if (head.INVITERFACE == "诺诺全电发票")
{
if (!string.IsNullOrWhiteSpace(redReason))
{
head.redReason = redReason;
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
var modb = new ModelObjectDB();
result = modb.Save(head);
}
else
{
jsonRespose.Success = false;
jsonRespose.Message = "必须选择冲红理由!";
return jsonRespose;
}
}
}
//head = list[0];
jsonRespose.Data = head;
}
@ -1287,7 +1326,16 @@ namespace DSWeb.Areas.Account.Controllers
}
else if (headdata.INVITERFACE == "诺诺全电发票")
{
Do_NuoNuoQuanDianReadInv(BILLNO);
//诺诺全电发票的红票 读取其实是读取 红字确认单查询接口
if (headdata.PTORRED == "1")
{
result=Do_NuoNuoQuanDianReadInv(BILLNO);
}
if (headdata.PTORRED == "2")
{
var _r= NNRedConfirm_Read(BILLNO);
return BasicDataRefDAL.GetContentResult(_r);
}
}
}
return result.getContentReult();
@ -1416,7 +1464,7 @@ namespace DSWeb.Areas.Account.Controllers
return jsonRespose;
}
private JsonResponse Do_NuoNuoQuanDianReadInv(string BILLNO)
public JsonResponse Do_NuoNuoQuanDianReadInv(string BILLNO)
{
//var hx = HangXinRequestHelper.getHelper(taxnum);
@ -1646,7 +1694,7 @@ namespace DSWeb.Areas.Account.Controllers
/// <param name="BILLNO"></param>
/// <param name="redirecturl"></param>
/// <returns></returns>
public ContentResult NNSetRed(string bill, string redirecturl)
public ContentResult NNSetRed(string bill, string redirecturl,string redReason="")
{
//首先判断是否有 modInvLock 发票开出锁定
var result = new DBResult();
@ -1656,7 +1704,7 @@ namespace DSWeb.Areas.Account.Controllers
//首先判断数据完整性与合法性 及检查平台认证
var checkresult = checkinfo(bill, redirecturl);
var checkresult = checkinfo(bill, redirecturl, redReason);
//被冲红的蓝票信息
var BlueInvoice = ChinvoiceDAL.GetData(" cm.billno='" + bill + "'");
@ -1684,6 +1732,7 @@ namespace DSWeb.Areas.Account.Controllers
//else {
// return NNSetRed_QuanDian(bill);
//}
}
if (head.INVITERFACE != "诺诺全电发票")
@ -1706,6 +1755,8 @@ namespace DSWeb.Areas.Account.Controllers
var detailList = ChinvoiceDAL.GetDetailList("PID='" + head.GID + "'");
var redhead = AutoMapperHelper.MapTo<ChInvoice_HangXin, ChInvoice_HangXin>(head);
//如果已经存在一张相应的红票则将现在这个head变成那个红票
var _existRed = ChinvoiceDAL.GetData(" REDNUM='" + head.INVOICENO + "' and REDCODE='" + head.INVOICECODE + "' ");
if (_existRed.BILLNO != "*")
@ -1760,60 +1811,58 @@ namespace DSWeb.Areas.Account.Controllers
if (head.INVITERFACE == "诺诺全电发票")
{
//诺诺全电发票 使用快捷冲红接口,向后台传递的是旧发票信息
//billno保持不变
//获得红票后 获取新的billno 使用新的gid保存
//
var _setred= NNSetRed_QuanDian(ref head);
if (!_setred.Success)
//redhead仅用于向诺诺全电红字申请单接口发送用
//redhead = AutoMapperHelper.MapTo<ChInvoice_HangXin, ChInvoice_HangXin>(head);
redhead.GID = System.Guid.NewGuid().ToString();
redhead.BILLNO = PubSysDAL.GetBillNo("0308");
redhead.PTORRED = "2"; // 开票类型 红票
redhead.redReason = redReason;
redhead.REDCODE = RedCode;
redhead.REDNUM = RedNo;
redhead.INVAMOUNT = redhead.INVAMOUNT * -1;
redhead.INVOICEPDFURL = "";
redhead.INVOICEINFOURL = "";
redhead.DbOperationType = DbOperationType.DbotIns;
redhead.ModelUIStatus = "I";
redhead.BILLSTATUS = 1;
foreach (var detail in detailList)
{
return BasicDataRefDAL.GetContentResult(_setred);
}
else {
head.GID = System.Guid.NewGuid().ToString();
head.BILLNO = PubSysDAL.GetBillNo("0308");
head.PTORRED = "2"; // 开票类型 红票
head.REDCODE = RedCode;
head.REDNUM = RedNo;
head.INVAMOUNT = head.INVAMOUNT * -1;
head.INVOICEPDFURL = "";
head.INVOICEINFOURL = "";
head.DbOperationType = DbOperationType.DbotIns;
head.ModelUIStatus = "I";
head.BILLSTATUS = 1;
foreach (var detail in detailList)
{
//数量 税额 含税金额 不含税金额 取负数
detail.SetRed();
detail.PID = "*";
}
head.REMARK = REDREMARK_Quandian(head);
#region SR2020060200007 红票清空推送模式和推送邮箱
head.PUSHMODE = "-1";
head.PUSHEMAIL = "";
head.PUSHMOBILE = "0";
//数量 税额 含税金额 不含税金额 取负数
detail.SetRed();
detail.PID = "*";
}
redhead.REMARK = REDREMARK_Quandian(redhead);
//红字申请单申请编号 即为发票业务编号 到时候红票的订单编号也是这个
//
head.billUuid = redhead.BILLNO;
}
}
var modb = new ModelObjectDB();
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
if (result.Success == true)
{
result = modb.Save(head);
//ChinvoiceDAL.UpdateInvNoUse(headData.INVOICENO, Convert.ToString(Session["USERID"]),headData.BILLNO);
//if (headData.EXCHANGERATE != 0)
//{
// ChinvoiceDAL.updateFeeTax(headData.BILLNO, headData.EXCHANGERATE);
if (head.INVITERFACE != "诺诺全电发票") {
//一般的红票业务此时保存红票信息
//}
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
if (result.Success == true)
{
result = modb.Save(head);
//ChinvoiceDAL.UpdateInvNoUse(headData.INVOICENO, Convert.ToString(Session["USERID"]),headData.BILLNO);
//if (headData.EXCHANGERATE != 0)
//{
// ChinvoiceDAL.updateFeeTax(headData.BILLNO, headData.EXCHANGERATE);
};
//}
};
}
var returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
@ -1878,8 +1927,11 @@ namespace DSWeb.Areas.Account.Controllers
}
else if (head.INVITERFACE == "诺诺全电发票")
{
var hx = .getHelper(head.TAXCODE);
result = hx.PostRedConfirm( redhead,ref head, detailList);
//诺诺全电票根据红字申请单的结果读取确认单
modb.Save(head);
}
@ -1893,23 +1945,33 @@ namespace DSWeb.Areas.Account.Controllers
}
/// <summary>
/// 诺诺全电发票 快速冲红接口
/// 诺诺全电发票 读取红字申请单
/// </summary>
/// <param name="bill"></param>
/// <returns></returns>
public DBResult NNSetRed_QuanDian(ref ChInvoice_HangXin head)
public DBResult NNRedConfirm_Read(string BILLNO)
{
//首先判断是否有 modInvLock 发票开出锁定
ChInvoice_HangXin head = ChinvoiceDAL.GetData("cm.BILLNO='" + BILLNO + "'");
var result = new DBResult();
var hx = .getHelper(head.TAXCODE);
if (!hx.CanUse)
{
result.SetErrorInfo( hx.ERRORMSG);
result.SetErrorInfo(hx.ERRORMSG);
return result;
}
result=hx.PostRedInvoice(ref head);
result = hx.ReadRedConfirm(ref head);
if (!result.Success) { return result; }
else {
var _r= Do_NuoNuoQuanDianReadInv(head.BILLNO);
result.Success = _r.Success;
result.Message = _r.Message;
result.Data = _r.Data;
}
return result;
}
@ -2572,7 +2634,7 @@ namespace DSWeb.Areas.Account.Controllers
#endregion
#endregion
}
}

@ -96,8 +96,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
strSql.Append(",(select BILLRISES from [company] where gid=cm.SALECORPID) BILLRISES");
strSql.Append(",PAYEE,CHECKER,SETRED,INVITERFACE");
strSql.Append(",redReason,billInfoNo,buyerManagerName,managerCardType,managerCardNo");
strSql.Append(",buyerManagerName,managerCardType,managerCardNo");
strSql.Append(",redReason,billInfoNo,billUUid");
strSql.Append(" FROM ch_fee_invoice cm where 1=1 ");
if (!string.IsNullOrEmpty(strCondition))
@ -188,6 +190,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
strSql.Append(",(select BILLRISES from [company] where gid=cm.SALECORPID) BILLRISES");
strSql.Append(",PAYEE,CHECKER,SETRED,INVITERFACE");
strSql.Append(",buyerManagerName,managerCardType,managerCardNo");
strSql.Append(" FROM ch_fee_invoice cm where 1=1 ");
if (!string.IsNullOrEmpty(strCondition))
@ -343,6 +347,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
data.redReason = Convert.ToString(reader["redReason"]);
data.billInfoNo = Convert.ToString(reader["billInfoNo"]);
data.billUuid = Convert.ToString(reader["billUuid"]);
data.buyerManagerName = Convert.ToString(reader["buyerManagerName"]);
data.managerCardType = Convert.ToString(reader["managerCardType"]);

@ -351,7 +351,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice
set { _pod = value; }
}
/// <summary>
/// 购方税号
/// </summary>
[ModelDB]
public string CUSTRATENO
{

@ -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 否(不传默认 01 是;传 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]
///解析读取发票信息命令返回值

@ -494,6 +494,27 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
});
this.storeRedReason = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeRedReason.load({ params: { enumTypeId: 80008 } });
this.comboxRedReason = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "冲红理由", //业务类型
FLEX: 0.8,
store: this.storeRedReason,
name: 'redReason',
valueField: 'EnumValueId',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
//scope: this,
//'select': function (combo, records, eOpts) {
// if (records.length > 0) {
// _this.setInvTile(records[0].data.EnumValueName);
// }
//}
}
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: {
@ -781,7 +802,13 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
flex: 0,
hidden: true,
margins: '0'
},
}, {
fieldLabel: 'billUuid',//用于放置全电发票冲红时的红票申请单编号
name: 'billUuid',
flex: 0,
hidden: true,
margins: '0'
},
{
fieldLabel: 'BILLSTATUS',
name: 'BILLSTATUS',
@ -1241,6 +1268,7 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
{
xtype: 'textareafield',
grow: true,
flex:4,
labelWidth: labelwidth_sale,
name: 'REMARK',
height: 61,
@ -1252,7 +1280,7 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
defaultType: 'textfield',
layout: 'anchor',
region: 'east',
width: 160,
width: 80,
defaults: {
anchor: '100%'
},
@ -1289,6 +1317,7 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
}]
},
this.comboxRedReason,
//////
{
fieldLabel: '船名航次', hidden: true,
@ -6582,6 +6611,8 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var redReason = this.formEdit.getForm().findField('redReason').getValue();
if (billno == '*' || billno == '') {
Ext.Msg.show({
title: '提示',
@ -6599,7 +6630,8 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
url: '/Account/Chfee_invoice_HangXin/NNSetRed',
params: {
bill: billno,
redirecturl: GetHangXinRedirectUrl()
redirecturl: GetHangXinRedirectUrl(),
redReason: redReason
},
callback: function (options, success, response) {
if (success) {
@ -7940,14 +7972,24 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
var SETRED = this.formEdit.getForm().findField('SETRED').getValue();//true false
var PTORRED = this.formEdit.getForm().findField('PTORRED').getValue();//true false
var INVOICELINE = this.formEdit.getForm().findField('INVOICELINE').getValue();//true false
var btn_KP = Ext.getCmp("btn_KP");
var btn_Invinfo = Ext.getCmp("btn_Invinfo");
var btn_Pdf = Ext.getCmp("btn_Pdf");
var btn_Void = Ext.getCmp("btn_Void");
var btn_Setred = Ext.getCmp("btn_Setred");
var 全电发票 = (INVOICELINE == "bs" || INVOICELINE == "pc" || INVOICELINE == "es" || INVOICELINE == "ec");
///1.如果流水号没有 同时未锁定 而且没有作废 才能点开票
if (isNullorEmpty(INVOICESERIALNUM) && billstatus == 0 && ISDELETE != "True") {
//全电红票不能开票
if (全电发票 && PTORRED == "2") {
btn_KP.disable();
}else
btn_KP.enable();
}
else {
@ -7955,9 +7997,17 @@ Ext.extend(Shipping.MsChInvoiceBLEdit, Ext.Panel, {
}
///2.如果流水号没有 不能点读取
if (isNullorEmpty(INVOICESERIALNUM)) {
btn_Invinfo.disable();
btn_Pdf.disable();
///20230519 但是全电除外 bs:电子发票(增值税专用发票) pc:电子发票(普通发票)es:全电纸质发票(增值税专用发票) ec:全电纸质发票(普通发票
if (isNullorEmpty(INVOICESERIALNUM))
{
if (全电发票)
{
btn_Invinfo.enable();
btn_Pdf.enable();
} else {
btn_Invinfo.disable();
btn_Pdf.disable();
}
}
else {
btn_Invinfo.enable();

@ -82,7 +82,8 @@
{ name: 'INVOICELINEREF', type: 'string' },
{ name: 'EINVOICESTATEREF', type: 'string' },
{ name: 'ISFRINV', type: 'bool' },
{ name: 'SETRED', type: 'string' }
{ name: 'SETRED', type: 'string' },
{ name: 'redReason', type: 'string' }
]

@ -42,6 +42,44 @@ namespace DSWeb.Areas.CommMng.Controllers
return _r;
}
}
/// <summary>
/// 诺诺开票回调 未完成
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
[HttpPost]
public InterfaceResult NNCallBack(InterfaceParam param)
{
try
{
Assembly assembly = Assembly.Load("DSWeb.Areas.Account.Controllers");
var type = assembly.GetType("DSWeb.Areas.CommMng.Controllers.InterfaceBase." + param.PORTNAME);
Object obj = type.Assembly.CreateInstance(type.ToString());
var doset = type.GetMethod("DoSet");
var _param = new object[] { param };
InterfaceResult result = (InterfaceResult)doset.Invoke(obj, BindingFlags.Instance | BindingFlags.NonPublic, null, _param, null);
return result;
}
catch (Exception e)
{
var _r = new InterfaceResult();
_r.errCode = "1";
var msg = e.Message;
if (e.InnerException != null && e.InnerException.Message != null)
{
msg += "//InnerException.Message:" + e.InnerException.Message;
}
var _rs = BasicDataRefDAL.SaveLog(msg, "", param.PORTNAME, "公开接口");
var _rr = JsonConvert.Deserialize<DBResult>(_rs.Content);
_r.errMsg = "未知错误,请联系相关人员,错误日志号【" + _rr.Data.ToString() + "】";
return _r;
}
}
}
public class InterfaceResult {
@ -87,4 +125,21 @@ namespace DSWeb.Areas.CommMng.Controllers
}
}
}
public class NNCallBackInfo {
public string operater { get; set; }
public string billNo { get; set; }
public NNContent content { get; set; }
}
public class NNContent {
List<NNDetail> details { get; set; }
}
public class NNDetail
{
}
}

@ -6303,7 +6303,7 @@ namespace DSWeb.Areas.CommMng.DAL
}
#endregion
#region CheckAuthority
#region 检查USERID对于一个action是否有查看权限 CheckAuthority
public static Boolean CheckAuthority(string USERID, string MODNAME)
{
try

Loading…
Cancel
Save