Browse Source

接口相关问题

MaiXinRong 4 years ago
parent
commit
fb47d19ff3
4 changed files with 29 additions and 11 deletions
  1. 9 4
      app/lib/ledger.js
  2. 9 4
      app/public/js/ledger_check.js
  3. 7 0
      app/public/js/stage.js
  4. 4 3
      app/service/pos.js

+ 9 - 4
app/lib/ledger.js

@@ -601,7 +601,7 @@ class checkData {
         }
         if (limit === 1) {
             if (ratio === 0) {
-                if (!data.contract_qty && data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
+                if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
             } else {
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, unit);
                 const checkQty = this.ctx.helper.mul(data.quantity, ratio, precision.value);
@@ -618,10 +618,15 @@ class checkData {
         const posRange = this.checkPos.getLedgerPos(bills.id);
         if (posRange && posRange.length > 0) {
             for (const p of posRange) {
+                const posCheckInfo = _.assign({}, checkInfo);
+                for (const ct of option.checkType) {
+                    if (p[ct + '_limit'] >= 0) {
+                        posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
+                        posCheckInfo[ct + '_ratio'] = p[ct + '_ratio'];
+                    }
+                }
                 for (const ct of checkType) {
-                    const checkResult = bills.is_tp
-                        ? this._check3f(p, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'])
-                        : this._check3fQty(p, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'], bills.unit);
+                    const checkResult = this._check3fQty(p, posCheckInfo[ct + '_limit'], posCheckInfo[ct + '_ratio'], bills.unit);
                     if (checkResult === 1) {
                         if (over.indexOf(ct) === -1) over.push(ct);
                     }

+ 9 - 4
app/public/js/ledger_check.js

@@ -166,7 +166,7 @@ const ledgerCheckUtil = {
             }
             if (limit === 1) {
                 if (ratio <= 0) {
-                    if (!data.contract_qty && data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
+                    if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
                 } else {
                     const precision = findPrecision(tenderInfo.precision, unit);
                     const checkQty = ZhCalc.mul(data.quantity, ratio, precision.value);
@@ -182,10 +182,15 @@ const ledgerCheckUtil = {
             const posRange = ledgerPos.getLedgerPos(bills.id);
             if (posRange && posRange.length > 0) {
                 for (const p of posRange) {
+                    const posCheckInfo = _.assign({}, checkInfo);
                     for (const ct of option.checkType) {
-                        const checkResult = bills.is_tp
-                            ? check3f(p, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'])
-                            : check3fQty(p, checkInfo[ct + '_limit'], checkInfo[ct + '_ratio'], bills.unit);
+                        if (p[ct + '_limit'] >= 0) {
+                            posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
+                            posCheckInfo[ct + '_ratio'] = p[ct + '_ratio'];
+                        }
+                    }
+                    for (const ct of option.checkType) {
+                        const checkResult = check3fQty(p, posCheckInfo[ct + '_limit'], posCheckInfo[ct + '_ratio'], bills.unit);
                         if (checkResult === 1) {
                             if (over.indexOf(ct) === -1) over.push(ct);
                         }

+ 7 - 0
app/public/js/stage.js

@@ -633,6 +633,12 @@ $(document).ready(() => {
     // 初始化 台账 spread
     const slSpread = SpreadJsObj.createNewSpread($('#stage-ledger')[0]);
     customizeStageTreeSetting(ledgerSpreadSetting, customColDisplay());
+    ledgerSpreadSetting.cols.push(
+        {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+    );
+    posSpreadSetting.cols.push(
+        {title: '工序限制', colSpan: '1', rowSpan: '2', field: 'gxby_limit', hAlign: 0, width: 80, readOnly: true},
+    );
     // 数量变更列,添加按钮
     const qcCol = _.find(ledgerSpreadSetting.cols, {field: 'qc_qty'});
     qcCol.readOnly = true;
@@ -1919,6 +1925,7 @@ $(document).ready(() => {
         },
         selectionChanged: function (e, info) {
             stagePosSpreadObj.loadExprToInput(info.sheet);
+            console.log(SpreadJsObj.getSelectObject(info.sheet));
         },
         addPegs: function (pegs) {
             if (!pegs || pegs.length <= 0) return;

+ 4 - 3
app/service/pos.js

@@ -29,7 +29,7 @@ module.exports = app => {
                 where: condition,
                 columns: ['id', 'tid', 'lid', 'name', 'quantity', 'position', 'drawing_code', 'sgfh_qty', 'sjcl_qty',
                     'qtcl_qty', 'in_time', 'porder', 'add_stage', 'sgfh_expr', 'sjcl_expr', 'qtcl_expr', 'real_qty',
-                    'dagl_status', 'dagl_url', 'gxby_status'],
+                    'dagl_status', 'dagl_url', 'gxby_status', 'gxby_limit', 'gxby_ratio', 'dagl_limit', 'dagl_status'],
                 order: [['porder', 'ASC']],
             });
         }
@@ -37,7 +37,8 @@ module.exports = app => {
         async getPosDataWithAddStageOrder(condition) {
             const sql = 'SELECT p.id, p.tid, p.lid, p.name, p.quantity, p.position, p.drawing_code,' +
                 '    p.sgfh_qty, p.sjcl_qty, p.qtcl_qty, p.porder, p.add_stage, p.add_times, p.add_user, s.order As add_stage_order,' +
-                '    p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty, p.gxby_status, p.dagl_status, p.dagl_url' +
+                '    p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty, p.gxby_status, p.dagl_status, p.dagl_url,' +
+                '    p.gxby_limit, p.dagl_limit, p.gxby_ratio, p.dagl_ratio' +
                 '  FROM ' + this.tableName + ' p ' +
                 '  LEFT JOIN ' + this.ctx.service.stage.tableName + ' s' +
                 '  ON p.add_stage = s.id'
@@ -49,7 +50,7 @@ module.exports = app => {
             if (ids instanceof Array && ids.length > 0) {
                 const sql = 'SELECT id, tid, lid, name, quantity, position, drawing_code,' +
                     '    sgfh_qty, sjcl_qty, qtcl_qty, add_stage, add_times, add_user, sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                    '    dagl_status, dagl_url, gxby_status' +
+                    '    dagl_status, dagl_url, gxby_status, gxby_limit, dagl_limit, gxby_ratio, dagl_ratio' +
                     '  FROM ' + this.tableName +
                     '  WHERE id in (' + this.ctx.helper.getInArrStrSqlFilter(ids) + ')';
                 return await this.db.query(sql, []);