Commit a781c844 by 王昆

dd

parent a116d058
...@@ -21,7 +21,7 @@ class InvoiceCtl extends CtlBase { ...@@ -21,7 +21,7 @@ class InvoiceCtl extends CtlBase {
} }
/** /**
* 发票申请列表-平台 * 发票申请列表-平台(管理员)
* @param {*} pobj * @param {*} pobj
*/ */
async invoicePage(pobj, pobj2, req) { async invoicePage(pobj, pobj2, req) {
...@@ -105,6 +105,20 @@ class InvoiceCtl extends CtlBase { ...@@ -105,6 +105,20 @@ class InvoiceCtl extends CtlBase {
} }
} }
/**
* 发票推送
* @param {*} pobj
* @param {*} pobj2
* @param {*} req
*/
async uploadDetailSve(pobj, pobj2, req){
if(!pobj.invoice_id){
return system.getResult(null,`参数错误 发票ID 不能为空`);
}
let res = await this.invoiceSve.uploadDetailSve(pobj.invoice_id);
return res;
}
// /** // /**
// * 申请发票校验 // * 申请发票校验
// * @param {*} pobj // * @param {*} pobj
......
...@@ -45,22 +45,7 @@ class InvoiceService extends ServiceBase { ...@@ -45,22 +45,7 @@ class InvoiceService extends ServiceBase {
} }
async handleStatus(params) { async handleStatus(params) {
var rs = await this.callms("invoice", "handleStatus", params); return await this.callms("invoice", "handleStatus", params);
if(params.stataus=="1120"){
try {
if(res.status===0){
await uploadDetailSve(params.invoice_id);
return rs;
}else{
return system.getResult(null,`提交发票失败 非法的发票ID`);
}
} catch (error) {
console.log(error);
return system.getResult("提交财税系统失败,请联系管理员");
}
}else{
return rs;
}
} }
async invoice(params) { async invoice(params) {
...@@ -185,6 +170,12 @@ class InvoiceService extends ServiceBase { ...@@ -185,6 +170,12 @@ class InvoiceService extends ServiceBase {
return system.getResult(`交付商不存在`); return system.getResult(`交付商不存在`);
} }
var deliver = await this.callms("common", "deliverInfo", {id: invoice.data.invoicedeliver[0].deliver_id}); var deliver = await this.callms("common", "deliverInfo", {id: invoice.data.invoicedeliver[0].deliver_id});
if(!deliver.data ){
return system.getResult(null,`交付商不存在`);
}
if(!deliver.data.nt_company_id){
return system.getResult(null,`个体户还未建账,请先建账`);
}
let _params=await this.buildParams(businessmen.data,invoice.data,deliver.data) || {}; let _params=await this.buildParams(businessmen.data,invoice.data,deliver.data) || {};
try { try {
if(!_params){ if(!_params){
...@@ -197,6 +188,8 @@ class InvoiceService extends ServiceBase { ...@@ -197,6 +188,8 @@ class InvoiceService extends ServiceBase {
if(!res || !res.data) { if(!res || !res.data) {
return system.getResult(null, "提交发票失败"); return system.getResult(null, "提交发票失败");
} }
//更新发票建账
await this.callms("invoice", "updateAccountCreation", {id:invoice_id});
return system.getResultSuccess(); return system.getResultSuccess();
} catch (error) { } catch (error) {
console.log(error); console.log(error);
...@@ -213,7 +206,7 @@ class InvoiceService extends ServiceBase { ...@@ -213,7 +206,7 @@ class InvoiceService extends ServiceBase {
return system.getResult(null, `系统错误 发票信息错误`); return system.getResult(null, `系统错误 发票信息错误`);
} }
let params = { let params = {
companyId:deliver.nt_company_id, //公司ID companyId:deliver.nt_company_id, //公司ID
customerId:businessmen.customer_id, //客户ID customerId:businessmen.customer_id, //客户ID
uploadPeriod:moment(businessmen.create_account_time).format('YYYYMM'), //上传账期 uploadPeriod:moment(businessmen.create_account_time).format('YYYYMM'), //上传账期
imageName: invoice['invoice_img'].slice(str.lastIndexOf("/")+1,-1) ||"", //图片名称 imageName: invoice['invoice_img'].slice(str.lastIndexOf("/")+1,-1) ||"", //图片名称
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment