Browse Source

计量台账,查找定位:
1. 去掉空白行
2. 漏计规则调整
3. 完成率
4. 定位清单后,加载清单部位

MaiXinRong 6 years ago
parent
commit
00c5c45ab5
2 changed files with 32 additions and 2 deletions
  1. 1 0
      app/public/js/ledger.js
  2. 31 2
      app/public/js/stage.js

+ 1 - 0
app/public/js/ledger.js

@@ -1575,6 +1575,7 @@ $(document).ready(function() {
                 if (!curBills) { return }
 
                 SpreadJsObj.locateTreeNode(ledgerSpread.getActiveSheet(), curBills.ledger_id, true);
+                posOperationObj.loadCurPosData();
             });
         }
         search () {

+ 31 - 2
app/public/js/stage.js

@@ -1223,7 +1223,7 @@ $(document).ready(() => {
                     {title: '数量', field: 'quantity', hAlign: 2, width: 50},
                     {title: '完成率(%)', field: 'complete_percent', hAlign: 2, width: 70},
                 ],
-                emptyRows: 3,
+                emptyRows: 0,
                 headRows: 1,
                 headRowHeight: [40],
                 defaultRowHeight: 21,
@@ -1236,7 +1236,7 @@ $(document).ready(() => {
             });
             $('#searchLedger', this.obj).bind('click', () => {self.searchText()});
             $('#over', this.obj).bind('change', () => {self.searchOver()});
-            $('#empty', this.obj).bind('change', () => {self.searchEmpty()});
+            $('#empty', this.obj).bind('change', () => {self.searchLess()});
             this.spread.getActiveSheet().bind(GC.Spread.Sheets.Events.CellDoubleClick, function (e, info) {
                 const sheet = info.sheet;
                 const data = sheet.zh_data;
@@ -1246,8 +1246,16 @@ $(document).ready(() => {
                 if (!curBills) { return }
 
                 SpreadJsObj.locateTreeNode(self.mainSpread.getActiveSheet(), curBills.ledger_id);
+                stagePosSpreadObj.loadCurPosData();
             });
         }
+        calculateCompletePercent() {
+            if (!this.searchResult) return;
+            for (const sr of this.searchResult) {
+                const base = ZhCalc.add(sr.total_price, sr.end_qc_tp);
+                sr.complete_percent = base !== 0 ? ZhCalc.mul(ZhCalc.div(sr.end_gather_tp, base), 100, 2) : 0;
+            }
+        }
         searchText() {
             const keyword = $('#keyword', this.obj).val();
             if (keyword !== '') {
@@ -1262,6 +1270,7 @@ $(document).ready(() => {
                         this.searchResult.push(node);
                     }
                 }
+                this.calculateCompletePercent();
                 SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
             }
         }
@@ -1280,6 +1289,7 @@ $(document).ready(() => {
                     }
                 }
             }
+            this.calculateCompletePercent();
             SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
         }
         searchEmpty() {
@@ -1297,6 +1307,25 @@ $(document).ready(() => {
                     }
                 }
             }
+            this.calculateCompletePercent();
+            SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
+        }
+        searchLess() {
+            this.searchResult = [];
+            const sortData = SpreadJsObj.getSortData(this.mainSpread.getActiveSheet());
+            for (const node of sortData) {
+                if (node.children && node.children.length > 0) continue;
+                if (node.quantity) {
+                    if (ZhCalc.sub(node.quantity, node.end_gather_qty) > 0) {
+                        this.searchResult.push(node);
+                    }
+                } else if (node.total_price) {
+                    if (ZhCalc.sub(node.total_price, node.end_gather_tp) > 0) {
+                        this.searchResult.push(node);
+                    }
+                }
+            }
+            this.calculateCompletePercent();
             SpreadJsObj.loadSheetData(this.spread.getActiveSheet(), 'data', this.searchResult);
         }
     }