Sfoglia il codice sorgente

指标,材差数据取值

MaiXinRong 2 anni fa
parent
commit
b2aa167b03
2 ha cambiato i file con 9 aggiunte e 4 eliminazioni
  1. 6 1
      app/service/material.js
  2. 3 3
      app/service/stage.js

+ 6 - 1
app/service/material.js

@@ -72,7 +72,12 @@ module.exports = app => {
         async checkMaterial(tid, order) {
             if (this.ctx.material) return;
             const materials = await this.getSelectMaterial(tid, order);
-            this.ctx.material = materials[0]
+            this.ctx.material = materials[0];
+            if (this.ctx.session.sessionUser.accountId === this.ctx.material.user_id) {
+                this.ctx.material.curTimes = this.ctx.material.times;
+            } else {
+                this.ctx.material.curTimes = this.ctx.material.status === status.checkNo ? this.ctx.material.times - 1 : this.ctx.material.times;
+            }
         }
 
         /**

+ 3 - 3
app/service/stage.js

@@ -299,9 +299,6 @@ module.exports = app => {
                 orders: [['order', 'desc']],
             });
             for (const s of stages) {
-                s.tp = this.ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]);
-                s.pre_tp = this.ctx.helper.add(s.pre_contract_tp, s.pre_qc_tp);
-                s.end_tp = this.ctx.helper.add(s.pre_tp, s.tp);
                 s.tp_history = s.tp_history ? JSON.parse(s.tp_history) : [];
             }
             if (stages.length !== 0 && !this.ctx.session.sessionUser.is_admin) {
@@ -319,6 +316,9 @@ module.exports = app => {
 
             await this.checkStageGatherData(stages[0], true);
             for (const s of stages) {
+                s.tp = this.ctx.helper.sum([s.contract_tp, s.qc_tp, s.pc_tp]);
+                s.pre_tp = this.ctx.helper.add(s.pre_contract_tp, s.pre_qc_tp);
+                s.end_tp = this.ctx.helper.add(s.pre_tp, s.tp);
                 if (s.yf_tp && s.sf_tp === 0) {
                     const sf = await this.ctx.service.stagePay.getHistorySf(s);
                     if (sf && s.readOnly) {