const common = require("./common");
const system = require("../../../system");
const applyDao = system.getObject("db.invoice.applyDao");
//完成 1090
module.exports.finish=async function (params){
  console.log("完成 1090");
  let _apply =await common.applyVerification(params);
  if(_apply.status==-1){return _apply;}
  let applyData = {};
  applyData.status = common.trim(params.nextStatus);
  applyData.customerStatus = common.trim(params.nextStatus);
  applyData.id = common.trim(params.id);

  // invoiceData.status = common.trim(params.nextStatus);
  // invoiceData.id=common.trim(params.id);

  await applyDao.db.transaction(async (t) => {
    //更新 申请单和发票单
    await applyDao.update(applyData, t);
    // await this.invoiceDao.update(invoiceData,t);
  }).catch(error => {
    return system.getResult(null, `系统错误 错误信息 ${error}`);
  });
  return system.getResultSuccess();
}