MaiXinRong 6 lat temu
rodzic
commit
cb07017ff3
2 zmienionych plików z 5 dodań i 2 usunięć
  1. 3 2
      app/service/stage_bills.js
  2. 2 0
      app/service/stage_pos.js

+ 3 - 2
app/service/stage_bills.js

@@ -34,12 +34,13 @@ module.exports = app => {
             const lidSql = lid ? ' And lid in (?)' : '';
             const sql = 'SELECT * FROM ' + this.tableName + ' As Bills ' +
                         '  INNER JOIN ( ' +
-                        '    SELECT MAX(`times`) As `times`, MAX(`order`) As `order`, `lid` From ' + this.tableName +
+                        '    SELECT MAX(`times`) As `times`, MAX(`order`) As `order`, `lid`, `sid` From ' + this.tableName +
                         '      WHERE tid = ? And sid = ?' + lidSql +
                         '      GROUP BY `lid`' +
                         '  ) As MaxFilter ' +
-                        '  ON Bills.times = MaxFilter.times And Bills.order = MaxFilter.order And Bills.lid = MaxFilter.lid';
+                        '  ON Bills.times = MaxFilter.times And Bills.order = MaxFilter.order And Bills.lid = MaxFilter.lid And Bills.`sid` = MaxFilter.`sid`';
             const sqlParam = [tid, sid];
+            console.log(this.db.format(sql, sqlParam));
             if (!lid) {
                 return await this.db.query(sql, sqlParam);
             } else if (lid instanceof Array) {

+ 2 - 0
app/service/stage_pos.js

@@ -248,6 +248,7 @@ module.exports = app => {
                 throw err;
             }
 
+            console.log(refreshData);
             try {
                 const result = {ledger: {}, pos: {}};
                 if (refreshData.ledger && refreshData.ledger.length > 0) {
@@ -256,6 +257,7 @@ module.exports = app => {
                         result.ledger.curStageData = await await this.ctx.service.stageBills.getLastestStageData(this.ctx.tender.id, this.ctx.stage.id, refreshData.ledger);
                     }
                 }
+                console.log(result.ledger.curStageData);
                 if (refreshData.pos && refreshData.pos.length > 0) {
                     result.pos.pos = await this.ctx.service.pos.getPosData({id: refreshData.pos});
                     if (refreshData.stageUpdate) {