Explorar el Código

工程清单模式,计量期审批通过,固定存储一份台账历史

MaiXinRong hace 7 meses
padre
commit
7722d68c13
Se han modificado 1 ficheros con 7 adiciones y 4 borrados
  1. 7 4
      app/service/ledger_history.js

+ 7 - 4
app/service/ledger_history.js

@@ -8,6 +8,7 @@
  * @version
  */
 const Ledger = require('../lib/ledger');
+const tenderConst = require('../const/tender');
 
 module.exports = app => {
 
@@ -72,10 +73,12 @@ module.exports = app => {
          * @private
          */
         async checkBackupLedgerHistory(tid, sid = 0, rid = '') {
-            const sbCount = await this.ctx.service.ledger.count({ tender_id: tid });
-            const spCount = await this.ctx.service.pos.count({ tid: tid });
-            const ledgerHis = await this.ctx.service.ledgerHistory.getLatestHistory(tid);
-            if (sbCount === ledgerHis.bills_count && spCount === ledgerHis.pos_count) return ledgerHis.id;
+            if (this.ctx.tender.data.measure_type === tenderConst.measureType.tz.value) {
+                const sbCount = await this.ctx.service.ledger.count({ tender_id: tid });
+                const spCount = await this.ctx.service.pos.count({ tid: tid });
+                const ledgerHis = await this.ctx.service.ledgerHistory.getLatestHistory(tid);
+                if (sbCount === ledgerHis.bills_count && spCount === ledgerHis.pos_count) return ledgerHis.id;
+            }
 
             const now = new Date();
             const timestamp = (now).getTime();