MaiXinRong пре 2 месеци
родитељ
комит
880be89dd7
2 измењених фајлова са 27 додато и 14 уклоњено
  1. 15 9
      app/public/js/revise.js
  2. 12 5
      app/service/change_audit_list.js

+ 15 - 9
app/public/js/revise.js

@@ -10,10 +10,10 @@
 
 const ckBillsSpread = window.location.pathname + '-billsSelect';
 const invalidFields = {
-    parent: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'deal_qty', 'deal_tp', 'unit_price'],
+    parent: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'deal_qty', 'deal_tp', 'unit_price', 'ex_qty1', 'ex_tp1'],
     gcl: ['dgn_qty1', 'dgn_qty2'],
     posCode: ['b_code'],
-    posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp'],
+    posCalc: ['sgfh_qty', 'sgfh_tp', 'sjcl_qty', 'sjcl_tp', 'qtcl_qty', 'qtcl_tp', 'ex_qty1', 'ex_tp1'],
     posXmj: ['code'],
 };
 function getExprInfo (field, converse = false) {
@@ -554,7 +554,8 @@ $(document).ready(() => {
                 // if (isTz) {
                     if (col.field === 'sgfh_qty' || col.field === 'sgfh_tp' ||
                         col.field === 'sjcl_qty' || col.field === 'sjcl_tp' ||
-                        col.field === 'qtcl_qty' || col.field === 'qtcl_tp') {
+                        col.field === 'qtcl_qty' || col.field === 'qtcl_tp'||
+                        col.field === 'ex_qty1' || col.field === 'ex_tp1') {
                         if (!node.children || node.children.length ===0) {
                             const lPos = pos.getLedgerPos(node.id);
                             if (lPos && lPos.length > 0) {
@@ -618,7 +619,7 @@ $(document).ready(() => {
                         SpreadJsObj.reLoadRowData(info.sheet, info.row);
                         return;
                     }
-                    data[col.field] = null;
+                    data[col.field] = 0;
                     if (exprInfo) {
                         data[exprInfo.expr] = '';
                     }
@@ -699,7 +700,8 @@ $(document).ready(() => {
                         }
                         if (colSetting.field === 'sgfh_qty' || colSetting.field === 'sgfh_tp' ||
                             colSetting.field === 'sjcl_qty' || colSetting.field === 'sjcl_tp' ||
-                            colSetting.field === 'qtcl_qty' || colSetting.field === 'qtcl_tp') {
+                            colSetting.field === 'qtcl_qty' || colSetting.field === 'qtcl_tp'||
+                            colSetting.field === 'ex_qty1' || colSetting.field === 'ex_tp1') {
                             // if (isTz) {
                                 toastMessageUniq(hint.posQty);
                                 continue;
@@ -799,7 +801,8 @@ $(document).ready(() => {
                             }
                             if (colSetting.field === 'sgfh_qty' || colSetting.field === 'sgfh_tp' ||
                                 colSetting.field === 'sjcl_qty' || colSetting.field === 'sjcl_tp' ||
-                                colSetting.field === 'qtcl_qty' || colSetting.field === 'qtcl_tp') {
+                                colSetting.field === 'qtcl_qty' || colSetting.field === 'qtcl_tp' ||
+                                colSetting.field === 'ex_qty1' || colSetting.field === 'ex_tp1') {
                                 toastMessageUniq(hint.posQty);
                                 continue;
                             }
@@ -933,9 +936,9 @@ $(document).ready(() => {
                     info.sheet.getCell(info.row, info.col).text(node[exprInfo.expr]);
                 }
             }
+            const posRange = pos.getLedgerPos(node.id);
             switch (col.field) {
                 case 'code':
-                    const posRange = pos.getLedgerPos(node.id);
                     info.cancel = posRange && posRange.length > 0;
                     break;
                 case 'unit_price':
@@ -949,7 +952,9 @@ $(document).ready(() => {
                 case 'qtcl_tp':
                 case 'deal_qty':
                 case 'deal_tp':
-                    info.cancel = (node.children && node.children.length > 0) || node.settle_status === settleStatus.finish;
+                case 'ex_qty1':
+                case 'ex_tp1':
+                    info.cancel = (node.children && node.children.length > 0) || node.settle_status === settleStatus.finish || (posRange && posRange.length > 0);
                     break;
                 case 'dgn_qty1':
                 case 'dgn_qty2':
@@ -983,7 +988,8 @@ $(document).ready(() => {
                         const col = sheet.zh_setting.cols[iCol];
                         if (col.field === 'b_code' || col.field === 'sgfh_qty' || col.field === 'sgfh_tp' ||
                             col.field === 'sjcl_qty' || col.field === 'sjcl_tp' ||
-                            col.field === 'qtcl_qty' || col.field === 'qtcl_tp') {
+                            col.field === 'qtcl_qty' || col.field === 'qtcl_tp' ||
+                            col.field === 'ex_qty1' || col.field === 'ex_tp1') {
                             const lPos = pos.getLedgerPos(node.id);
                             if (lPos && lPos.length > 0) {
                                 toastr.error('不可剪切');

+ 12 - 5
app/service/change_audit_list.js

@@ -1007,8 +1007,9 @@ module.exports = app => {
                             info.sjcl_qty = this.ctx.helper.add(info.sjcl_qty, data.sjcl_qty);
                             info.qtcl_qty = this.ctx.helper.add(info.qtcl_qty, data.qtcl_qty);
                             info.quantity = this.ctx.helper.add(info.quantity, data.quantity);
+                            info.ex_qty1 = this.ctx.helper.add(info.ex_qty1, data.ex_qty1);
                         } else {
-                            needUpdateLedgerList.push({ id: data.lid, sgfh_qty: data.sgfh_qty, sjcl_qty: data.sjcl_qty, qtcl_qty: data.qtcl_qty, quantity: data.quantity });
+                            needUpdateLedgerList.push({ id: data.lid, sgfh_qty: data.sgfh_qty, sjcl_qty: data.sjcl_qty, qtcl_qty: data.qtcl_qty, quantity: data.quantity, ex_qty1: data.ex_qty1 });
                         }
                     } else {
                         const info = this._.find(needUpdateChangeLedgerList, { id: data.lid });
@@ -1017,8 +1018,9 @@ module.exports = app => {
                             info.sjcl_qty = this.ctx.helper.add(info.sjcl_qty, data.sjcl_qty);
                             info.qtcl_qty = this.ctx.helper.add(info.qtcl_qty, data.qtcl_qty);
                             info.quantity = this.ctx.helper.add(info.quantity, data.quantity);
+                            info.ex_qty1 = this.ctx.helper.add(info.ex_qty1, data.ex_qty1);
                         } else {
-                            needUpdateChangeLedgerList.push({ id: data.lid, sgfh_qty: data.sgfh_qty, sjcl_qty: data.sjcl_qty, qtcl_qty: data.qtcl_qty, quantity: data.quantity });
+                            needUpdateChangeLedgerList.push({ id: data.lid, sgfh_qty: data.sgfh_qty, sjcl_qty: data.sjcl_qty, qtcl_qty: data.qtcl_qty, quantity: data.quantity, ex_qty1: data.ex_qty1 });
                         }
                     }
                 }
@@ -1034,6 +1036,8 @@ module.exports = app => {
                         now.sjcl_tp = this.ctx.helper.mul(now.sjcl_qty, now.unit_price, tpDecimal);
                         now.qtcl_tp = this.ctx.helper.mul(now.qtcl_qty, now.unit_price, tpDecimal);
                         now.total_price = this.ctx.helper.mul(now.quantity, now.unit_price, tpDecimal);
+                        now.ex_qty1 = nucl.ex_qty1;
+                        now.ex_tp1 = this.ctx.helper.mul(now.ex_qty1, now.unit_price, tpDecimal);
                     }
                 }
                 // 更新到ledger上
@@ -1048,6 +1052,8 @@ module.exports = app => {
                         ledgerInfo.sjcl_tp = this.ctx.helper.mul(ledgerInfo.sjcl_qty, ledgerInfo.unit_price, tpDecimal);
                         ledgerInfo.qtcl_tp = this.ctx.helper.mul(ledgerInfo.qtcl_qty, ledgerInfo.unit_price, tpDecimal);
                         ledgerInfo.total_price = this.ctx.helper.mul(ledgerInfo.quantity, ledgerInfo.unit_price, tpDecimal);
+                        ledgerInfo.ex_qty1 = this.ctx.helper.add(ledgerInfo.ex_qty1, nul.ex_qty1);
+                        ledgerInfo.ex_tp1 = this.ctx.helper.mul(ledgerInfo.ex_qty1, ledgerInfo.unit_price, tpDecimal);
                         await transaction.update(this.ctx.service.ledger.tableName, ledgerInfo);
                     }
                 }
@@ -1093,6 +1099,7 @@ module.exports = app => {
                         l.sgfh_qty, l.sgfh_tp, l.sjcl_qty, l.sjcl_tp, l.qtcl_qty, l.qtcl_tp, l.node_type, l.crid, l.ccid,
                         l.tender_id, l.sgfh_expr, l.sjcl_expr, l.qtcl_expr, l.check_calc,
                         l.ex_memo1, l.ex_memo2, l.ex_memo3,
+                        l.ex_qty1, l.ex_tp1,
                     ];
                     insertLedgerArr.push('(' + this.ctx.helper.getInArrStrSqlFilter(insertL) + ')');
                     await transaction.delete(this.ctx.service.changeLedger.tableName, { id: l.id });
@@ -1105,7 +1112,7 @@ module.exports = app => {
                     '     quantity, total_price, unit_price, drawing_code, memo, features, dgn_qty1, dgn_qty2, deal_qty, deal_tp,' +
                     '     sgfh_qty, sgfh_tp, sjcl_qty, sjcl_tp, qtcl_qty, qtcl_tp, node_type, crid, ccid, tender_id,' +
                     '     sgfh_expr, sjcl_expr, qtcl_expr, check_calc,' +
-                    '     ex_memo1, ex_memo2, ex_memo3) VALUES ' + insertLedgerArr.join(',') + ';';
+                    '     ex_memo1, ex_memo2, ex_memo3, ex_qty1, ex_tp1) VALUES ' + insertLedgerArr.join(',') + ';';
                 await transaction.query(bSql, []);
             }
             if (posList.length > 0) {
@@ -1115,7 +1122,7 @@ module.exports = app => {
                         p.id, p.tid, p.lid, p.name, p.drawing_code, p.quantity, p.add_stage, p.add_stage_order, p.add_times,
                         p.add_user, p.sgfh_qty, p.sjcl_qty, p.qtcl_qty, p.crid, p.ccid, p.porder, p.position,
                         p.sgfh_expr, p.sjcl_expr, p.qtcl_expr, p.real_qty,
-                        p.ex_memo1, p.ex_memo2, p.ex_memo3,
+                        p.ex_memo1, p.ex_memo2, p.ex_memo3, p.ex_qty1,
                     ];
                     insertPosArr.push('(' + this.ctx.helper.getInArrStrSqlFilter(insertp) + ')');
                     await transaction.delete(this.ctx.service.changePos.tableName, { id: p.id });
@@ -1128,7 +1135,7 @@ module.exports = app => {
                     '  (id, tid, lid, name, drawing_code, quantity, add_stage, add_stage_order, add_times, add_user,' +
                     '     sgfh_qty, sjcl_qty, qtcl_qty, crid, ccid, porder, position, ' +
                     '     sgfh_expr, sjcl_expr, qtcl_expr, real_qty,' +
-                    '     ex_memo1, ex_memo2, ex_memo3)  VALUES ' + insertPosArr.join(',') + ';';
+                    '     ex_memo1, ex_memo2, ex_memo3, ex_qty1)  VALUES ' + insertPosArr.join(',') + ';';
                 await transaction.query(pSql, []);
             }
         }