ソースを参照

Merge branch 'dev' of http://192.168.1.41:3000/maixinrong/Calculation into dev

laiguoran 3 年 前
コミット
666593ddc9

+ 9 - 5
app/lib/analysis_excel.js

@@ -901,8 +901,9 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
             contract_tp: {value: ['本期合同计量|金额'], type: colDefineType.match},
             deal_dgn_qty1: {value: ['合同|项目节数量1'], type: colDefineType.match},
             deal_dgn_qty2: {value: ['合同|项目节数量2'], type: colDefineType.match},
-            qc_dgn_qty1: {value: ['变更|项目节数量1'], type: colDefineType.match},
-            qc_dgn_qty2: {value: ['变更|项目节数量2'], type: colDefineType.match},
+            c_dgn_qty1: {value: ['变更|项目节数量1'], type: colDefineType.match},
+            c_dgn_qty2: {value: ['变更|项目节数量2'], type: colDefineType.match},
+            postil: {value: ['本期批注'], type: colDefineType.match}
         };
         this.needCols = ['code', 'b_code', 'pos', 'name', 'unit', 'unit_price', 'contract_qty', 'contract_tp'];
     }
@@ -942,6 +943,7 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
             xmj.deal_dgn_qty2 = aeUtils.toNumber(row[this.colsDef.deal_dgn_qty2]);
             xmj.c_dgn_qty1 = aeUtils.toNumber(row[this.colsDef.c_dgn_qty1]);
             xmj.c_dgn_qty2 = aeUtils.toNumber(row[this.colsDef.c_dgn_qty2]);
+            xmj.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
             this.ctx.helper.checkDgnQtyPrecision(xmj);
             return xmj;
         } catch (error) {
@@ -973,12 +975,13 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
         node.unit_price = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.unit_price]), this.decimal.up);
         const precision = this.ctx.helper.findPrecision(this.precision, node.unit);
         node.contract_qty = this.ctx.helper.round(aeUtils.toNumber(row[this.colsDef.contract_qty]), precision.value);
-        if (node.quantity && node.unit_price) {
-            node.contract_tp = this.ctx.helper.mul(node.quantity, node.unit_price, this.decimal.tp);
+        if (node.contract_qty && node.unit_price) {
+            node.contract_tp = this.ctx.helper.mul(node.contract_qty, node.unit_price, this.decimal.tp);
         } else {
             node.contract_tp = null;
         }
-        if (this.filter.filterZeroGcl && !node.quantity && !node.total_price) return true;
+        node.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
+        if (this.filter.filterZeroGcl && !node.contract_qty && !node.contract_tp) return true;
         return this.cacheTree.addGclNode(node);
     }
     /**
@@ -994,6 +997,7 @@ class AnalysisStageExcelTree extends AnalysisExcelTree {
         pos.quantity = aeUtils.toNumber(row[this.colsDef.contract_qty]);
         pos = this.cacheTree.addPos(pos, true);
         pos.contract_qty = pos.quantity;
+        pos.postil = this.ctx.helper.replaceReturn(row[this.colsDef.postil]);
         return pos;
     }
 

+ 17 - 6
app/public/js/ledger.js

@@ -986,23 +986,34 @@ $(document).ready(function() {
             const select = SpreadJsObj.getSelectObject(sheet);
             if (!select || !select.code) return;
 
-            const recursiveSortCode = function (data, parentCode, children) {
+            const getChildSort = function (i, split) {
+                if (i <= 0) throw '参数错误';
+                switch(split) {
+                    case '0':
+                        return i < 10 ? split + i : i + '';
+                    case '-':
+                    default:
+                        return split + i;
+                }
+            };
+
+            const recursiveSortCode = function (data, parentCode, children, split) {
                 if (!children || children.length === 0) return;
 
                 for (const [i, child] of children.entries()) {
                     if (!child.b_code || child.b_code === '') {
-                        const code = parentCode + '-' + (i + 1);
+                        const code = parentCode + getChildSort(i + 1, split);
                         const cData = tree.getNodeKeyData(child);
                         cData.code = code;
                         data.push(cData);
                         if (!tree.isLeafXmj(child)) {
-                            recursiveSortCode(data, code, child.children);
+                            recursiveSortCode(data, code, child.children, split);
                         }
                     }
                 }
             };
             const data = [];
-            recursiveSortCode(data, select.code, select.children);
+            recursiveSortCode(data, select.code, select.children, tree.getCodeSplit());
             if (data.length > 0) {
                 postData(window.location.pathname + '/update', {postType: 'update', postData: data}, function (result) {
                     const refreshNode = tree.loadPostData(result);
@@ -1420,12 +1431,12 @@ $(document).ready(function() {
             icon: 'fa-sort-numeric-asc',
             disabled: function (key, opt) {
                 const node = SpreadJsObj.getSelectObject(ledgerSpread.getActiveSheet());
-                return !node || !node.code || !node.children || node.children === 0 || node.code.indexOf('-') < 0;
+                return !node || !node.code || !node.children || node.children === 0 || node.code.length < 3;
             },
             callback: function (key, opt) {
                 treeOperationObj.sortCode(ledgerSpread.getActiveSheet());
             },
-            visible: function (key, opt) {;
+            visible: function (key, opt) {
                 return !readOnly;
             }
         };

+ 17 - 0
app/public/js/path_tree.js

@@ -1023,6 +1023,23 @@ const createNewPathTree = function (type, setting) {
                 return false;
             })
         }
+
+        checkCodeType() {
+            for (const node of this.nodes) {
+                if (!node.code) continue;
+
+                if (node.code.indexOf('-') >= 0) {
+                    return '07';
+                } else if (node.code.length > 5) {
+                    const num = _.toNumber(node.code);
+                    if (num && num > 10000) return '18';
+                }
+            }
+            return '18';
+        }
+        getCodeSplit() {
+            return this.checkCodeType() === '07' ? '-' : '0';
+        }
     }
 
     class LedgerTree extends FxTree {

+ 6 - 6
app/service/stage_stash.js

@@ -72,9 +72,9 @@ class loadStageExcelTree {
                 let ssp = sourceStagePos.find(x => { return x.pid === sp.id; });
                 sourceStagePos.splice(sourceStagePos.indexOf(ssp), 1);
                 if (ssp) {
-                    this.updatePos.push({ id: ssp.id, contract_qty: p.contract_qty });
+                    this.updatePos.push({ id: ssp.id, contract_qty: p.contract_qty, postil: p.postil || ssp.postil || '' });
                 } else {
-                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, pid:sp.id, contract_qty: p.contract_qty });
+                    this.insertPos.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, pid:sp.id, contract_qty: p.contract_qty, postil: p.postil || ssp.postil || '' });
                 }
             }
             for (const ssp of sourceStagePos) {
@@ -82,9 +82,9 @@ class loadStageExcelTree {
             }
             const contract_tp = this.ctx.helper.mul(contract_qty, source.unit_price, this.decimal.tp);
             if (curStageBills) {
-                this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp });
+                this.updateBills.push({ id: curStageBills.id, contract_qty, contract_tp, postil: node.postil || source.postil || '' });
             } else {
-                if (contract_qty) this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp });
+                if (contract_qty) this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty, contract_tp, postil: node.postil || source.postil || '' });
             }
         } else {
             if (!node.contract_qty && !node.contract_tp) return;
@@ -94,9 +94,9 @@ class loadStageExcelTree {
                 : this.ctx.helper.round(contract_tp, this.decimal.tp);
 
             if (curStageBills) {
-                this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp });
+                this.updateBills.push({ id: curStageBills.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || source.postil || '' });
             } else {
-                this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty: contract_qty, contract_tp: contract_tp });
+                this.insertBills.push({ tid: this.default.tid, sid: this.default.sid, said: this.default.said, times: 1, order: 0, lid: source.id, contract_qty: contract_qty, contract_tp: contract_tp, postil: node.postil || source.postil || '' });
             }
         }
     }