Bladeren bron

台账修订,最新期未审批完成时,判断是否已计量问题

MaiXinRong 5 jaren geleden
bovenliggende
commit
1324fad2fd
2 gewijzigde bestanden met toevoegingen van 3 en 2 verwijderingen
  1. 2 1
      app/service/stage_bills.js
  2. 1 1
      app/service/stage_pos.js

+ 2 - 1
app/service/stage_bills.js

@@ -115,7 +115,7 @@ module.exports = app => {
         }
 
         async getStageUsedBills(tid, sid) {
-            const sql = 'SELECT Bills.lid, (Bills.contract_qty <> 0 and Bills.qc_qty <> 0) As used FROM ' + this.tableName + ' As Bills ' +
+            const sql = 'SELECT Bills.lid, (Bills.contract_qty <> 0 or Bills.qc_qty <> 0) As used FROM ' + this.tableName + ' As Bills ' +
                 '  INNER JOIN ( ' +
                 '    SELECT MAX(`times` * ' + timesLen + ' + `order`) As `progress`, `lid`, `sid` From ' + this.tableName +
                 '      WHERE tid = ? And sid = ?' +
@@ -123,6 +123,7 @@ module.exports = app => {
                 '  ) As MaxFilter ' +
                 '  ON (Bills.times * ' + timesLen + ' + `order`) = MaxFilter.progress And Bills.lid = MaxFilter.lid And Bills.`sid` = MaxFilter.`sid`';
             const sqlParam = [tid, sid];
+            console.log(this.db.format(sql, sqlParam));
             const stageBills = await this.db.query(sql, sqlParam);
             return this._.map(this._.filter(stageBills, 'used'), 'lid');
         }

+ 1 - 1
app/service/stage_pos.js

@@ -128,7 +128,7 @@ module.exports = app => {
             const self = this;
             const stagePos = await this.getLastestStageData2(tid, sid, where);
             const pids = this._.map(stagePos, function (sp) {
-                if (self.ctx.helper.checkZero(sp.contract_qty) && self.ctx.helper.checkZero(sp.qc_qty)) {
+                if (self.ctx.helper.checkZero(sp.contract_qty) || self.ctx.helper.checkZero(sp.qc_qty)) {
                     return sp.pid;
                 } else {
                     return -1;