|
|
@ -1737,9 +1737,15 @@ namespace DSWeb.Areas.Account.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//else {
|
|
|
|
|
|
|
|
// return NNSetRed_QuanDian(bill);
|
|
|
|
//增加判断 如果原票createtime晚于当前时间24小时之前,则报错不允许开出
|
|
|
|
//}
|
|
|
|
if ( BlueInvoice.INVOICEMAKETIME==null|| BlueInvoice.INVOICEMAKETIME == "" || Convert.ToDateTime(BlueInvoice.INVOICEMAKETIME) >DateTime.Now.AddDays(-1))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
jsonRespose.Success = false;
|
|
|
|
|
|
|
|
jsonRespose.Message = $"该蓝票为{BlueInvoice.INVOICEMAKETIME}开出,当前无法冲红";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1849,7 +1855,7 @@ namespace DSWeb.Areas.Account.Controllers
|
|
|
|
|
|
|
|
|
|
|
|
//红字申请单申请编号 即为发票业务编号 到时候红票的订单编号也是这个
|
|
|
|
//红字申请单申请编号 即为发票业务编号 到时候红票的订单编号也是这个
|
|
|
|
//
|
|
|
|
//
|
|
|
|
head.billUuid = redhead.BILLNO;
|
|
|
|
//head.billUuid = redhead.BILLNO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
|
var modb = new ModelObjectDB();
|
|
|
@ -1861,14 +1867,10 @@ namespace DSWeb.Areas.Account.Controllers
|
|
|
|
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
|
|
|
|
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
|
|
|
|
if (result.Success == true)
|
|
|
|
if (result.Success == true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
//主要保存了红票的billno在billUuid当中
|
|
|
|
result = modb.Save(head);
|
|
|
|
result = modb.Save(head);
|
|
|
|
//ChinvoiceDAL.UpdateInvNoUse(headData.INVOICENO, Convert.ToString(Session["USERID"]),headData.BILLNO);
|
|
|
|
|
|
|
|
//if (headData.EXCHANGERATE != 0)
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// ChinvoiceDAL.updateFeeTax(headData.BILLNO, headData.EXCHANGERATE);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1938,7 +1940,91 @@ namespace DSWeb.Areas.Account.Controllers
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var hx = 诺诺全电发票.getHelper(head.TAXCODE);
|
|
|
|
var hx = 诺诺全电发票.getHelper(head.TAXCODE);
|
|
|
|
|
|
|
|
|
|
|
|
result = hx.PostRedConfirm(redhead, ref head, detailList);
|
|
|
|
//20230529
|
|
|
|
|
|
|
|
//1 如果ch_fee_invoice.billuuid有值的话
|
|
|
|
|
|
|
|
//这个值是最近一次提交的红字确认单订单编码
|
|
|
|
|
|
|
|
//用这个值读取红字确认单状态 如成功则做红票相应的处理
|
|
|
|
|
|
|
|
//如状态15申请中 则不做操作返回申请中
|
|
|
|
|
|
|
|
//如非成功和15 则返回错误 并清空billuuid;
|
|
|
|
|
|
|
|
//2 如果ch_fee_invoice.billuuid无值 则重新产生值并发出红字确认单
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//此时head.billUuid如果不为空 代表是第一次冲红
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(head.billUuid))//&&
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var _r = hx.ReadRedConfirm(ref redhead, detailList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!_r.Success)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return BasicDataRefDAL.GetContentResult( _r);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
//var hx = 诺诺全电发票.getHelper(head.TAXCODE);
|
|
|
|
|
|
|
|
if (!hx.CanUse)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result.SetErrorInfo(hx.ERRORMSG);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//if (hx.accessToken == "")
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// BasicDataRefDAL.SaveLog("NNReadInv;税号" + head.TAXCODE + "的 accessToken为空", "", "诺诺平台", "返回认证窗口");
|
|
|
|
|
|
|
|
// var _r = TokenPage();
|
|
|
|
|
|
|
|
// return _r;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
result = hx.ReadInvoice(head);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.Success)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return BasicDataRefDAL.GetContentResult(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//if (result.Message == "需要重新认证")
|
|
|
|
|
|
|
|
//{
|
|
|
|
|
|
|
|
// //HangXinRequestHelper.clear(hx.accessToken);
|
|
|
|
|
|
|
|
// BasicDataRefDAL.SaveLog("ReadInvoice 反回‘需要重新认证’", "", "诺诺平台", "返回认证窗口");
|
|
|
|
|
|
|
|
// var _r = TokenPage();
|
|
|
|
|
|
|
|
// return _r;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 BasicDataRefDAL.GetContentResult(result);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
head.billUuid = redhead.BILLNO;
|
|
|
|
|
|
|
|
result = hx.PostRedConfirm(redhead, ref head, detailList);
|
|
|
|
|
|
|
|
}
|
|
|
|
//诺诺全电票根据红字申请单的结果读取确认单
|
|
|
|
//诺诺全电票根据红字申请单的结果读取确认单
|
|
|
|
modb.Save(head);
|
|
|
|
modb.Save(head);
|
|
|
|
}
|
|
|
|
}
|
|
|
|