Explorar el Código

Merge branch 'uat'

MaiXinRong hace 3 años
padre
commit
089f7ded44

+ 1 - 1
app/controller/setting_controller.js

@@ -821,7 +821,7 @@ module.exports = app => {
                 const responseData = { err: 0, msg: '', data: null };
                 switch (data.type) {
                     case 'gxby':
-                        responseData.data = await this.ctx.service.s2bProj.updateGxbyStatus(projectId, data.status, data.limit);
+                        responseData.data = await this.ctx.service.s2bProj.updateGxbyStatus(projectId, data.status, data.limit, data.ratio);
                         break;
                     case 'dagl':
                         responseData.data = await this.ctx.service.s2bProj.updateDaglStatus(projectId, data.status, data.limit, data.ratio);

+ 1 - 1
app/controller/stage_controller.js

@@ -372,7 +372,7 @@ module.exports = app => {
                 projRela.banOver && ctx.tender.info.ledger_check.over && checkData.checkOverRange(['contract_qty', 'qc_qty']);
                 checkData.checkBillsTp([
                     { qty: 'contract_qty', tp: 'contract_tp' }, { qty: 'qc_qty', tp: 'qc_tp' },
-                ], this.ctx.tender.info.decimal);
+                ], this.ctx.tender.info.decimal, x => { return x.is_tp; });
                 ctx.body = { err: 0, msg: '', data: checkData.checkResult };
             } catch (err) {
                 this.log(err);

+ 5 - 4
app/lib/ledger.js

@@ -622,9 +622,9 @@ class checkData {
     }
 
     _getRatio(type, status) {
-        if (type === 'gxby') return null;
-        const gs = this.ctx.session.sessionProject.dagl_status.find(x => { return x.value === status });
-        return gs ? gs.ratio : null;
+        const statusConst = type === 'gxby' ? this.ctx.session.sessionProject.gxby_status : this.ctx.session.sessionProject.dagl_status;
+        const sc = statusConst.find(x => { return x.value === status });
+        return sc ? sc.ratio : null;
     }
 
 
@@ -805,9 +805,10 @@ class checkData {
             }
         }
     }
-    checkBillsTp(field, decimal) {
+    checkBillsTp(field, decimal, filter) {
         for (const b of this.checkBills.nodes) {
             if ((b.children && b.children.length > 0) || !b.check_calc) continue;
+            if (filter && filter(b)) continue;
 
             const checkData = {}, calcData = {};
             for (const f of field) {

+ 3 - 3
app/public/js/ledger_check.js

@@ -157,9 +157,9 @@ const ledgerCheckUtil = {
             return list.other;
         };
         const getRatio = function (type, status) {
-            if (type === 'gxby') return null;
-            const gs = option.status.dagl.find(x => { return x.value === status });
-            return gs ? gs.ratio : null;
+            const statusConst = type === 'gxby' ? option.status.gxby : option.status.dagl;
+            const sc = statusConst.find(x => { return x.value === status });
+            return sc ? sc.ratio : null;
         };
         const getValid = function (type, status, limit) {
             if (limit) {

+ 3 - 2
app/service/s2b_proj.js

@@ -43,11 +43,12 @@ module.exports = app => {
             this.ctx.session.sessionProject.dagl_status = s2bProj ? s2bProj.dagl_status : thirdPartyConst.dagl;
         }
 
-        async updateGxbyStatus(pid, status, limit) {
+        async updateGxbyStatus(pid, status, limit, ratio) {
             const sp = await this.getDataByPid(pid);
             const gs = sp.gxby_status.find(x => { return x.value === status; });
             if (!gs) throw '提交数据错误';
-            gs.limit = limit;
+            if (limit !== undefined && limit !== null) gs.limit = limit;
+            if (ratio !== undefined && ratio !== null) gs.ratio = this.ctx.helper.round(ratio, 2);
             await this.db.update(this.tableName, { gxby_status: JSON.stringify(sp.gxby_status) }, { where: { pid } });
             return gs;
         }

+ 17 - 5
app/view/setting/s2b.ejs

@@ -18,7 +18,7 @@
                             <div class="col-4">
                                 <legend>工序报验</legend>
                                 <table class="table table-hover table-bordered">
-                                    <thead><tr><th>值</th><th>名称</th><th>允许计量</th></tr></thead>
+                                    <thead><tr><th>值</th><th>名称</th><th>允许计量</th><th>计量比例</th></tr></thead>
                                     <tbody id="gxby_list">
                                     <% for (const s of ctx.session.sessionProject.gxby_status) { %>
                                     <tr>
@@ -30,6 +30,18 @@
                                                 <label class="form-check-label" for="inlineCheckbox-g<%- s.value %>"></label>
                                             </div>
                                         </td>
+                                        <% if (s.ratio === undefined) { %>
+                                        <td>-</td>
+                                        <% } else { %>
+                                        <td>
+                                            <div class="input-group input-group-sm" style="width:90px">
+                                                <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 0 %>" status="<%- s.value %>" onchange="updateStatusRatio(this, 'gxby');">
+                                                <div class="input-group-append">
+                                                    <span class="input-group-text">%</span>
+                                                </div>
+                                            </div>
+                                        </td>
+                                        <% } %>
                                     </tr>
                                     <% } %>
                                     </tbody>
@@ -49,12 +61,12 @@
                                                 <label class="form-check-label" for="inlineCheckbox-d<%- s.value %>"></label>
                                             </div>
                                         </td>
-                                        <% if (s.value === 0) { %>
+                                        <% if (s.ratio === undefined) { %>
                                         <td>-</td>
                                         <% } else { %>
                                         <td>
                                             <div class="input-group input-group-sm" style="width:90px">
-                                                <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 0 %>" status="<%- s.value %>" onchange="updateStatusRatio(this);">
+                                                <input type="number" class="form-control" max="100" min="0" step="2" value="<%- s.ratio || 0 %>" status="<%- s.value %>" onchange="updateStatusRatio(this, 'dagl');">
                                                 <div class="input-group-append">
                                                     <span class="input-group-text">%</span>
                                                 </div>
@@ -138,8 +150,8 @@
             obj.checked = !obj.checked;
         });
     }
-    const updateStatusRatio = function (obj) {
-        const data = { type: 'dagl' };
+    const updateStatusRatio = function (obj, type) {
+        const data = { type };
         data.status = parseInt(obj.getAttribute('status'));
         try {
             data.ratio = parseFloat(obj.value);