Explorar el Código

部位台账相关

MaiXinRong hace 5 años
padre
commit
1945a79a93
Se han modificado 3 ficheros con 28 adiciones y 7 borrados
  1. 21 5
      app/lib/bills_pos_convert.js
  2. 1 1
      app/service/external_data.js
  3. 6 1
      app/view/stage/bwtz.ejs

+ 21 - 5
app/lib/bills_pos_convert.js

@@ -78,7 +78,7 @@ class BillsPosConvert {
         }
     }
     // v2
-    _loadCalcFields(node, data) {
+    _loadPosCalcFields(node, data) {
         const tpDecimal = this.ctx.tender.info.decimal.tp;
         node.quantity = this.ctx.helper.add(node.quantity, data.quantity);
         node.total_price = this.ctx.helper.add(node.total_price, this.ctx.helper.mul(node.unit_price, data.quantity, tpDecimal));
@@ -95,6 +95,22 @@ class BillsPosConvert {
         node.pre_qc_tp = this.ctx.helper.add(node.pre_qc_tp, this.ctx.helper.mul(node.unit_price, data.pre_qc_qty, tpDecimal));
         node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
     }
+    _loadBillsCalcFields(node, data) {
+        node.quantity = this.ctx.helper.add(node.quantity, data.quantity);
+        node.total_price = this.ctx.helper.add(node.total_price, data.total_price);
+
+        node.contract_qty = this.ctx.helper.add(node.contract_qty, data.contract_qty);
+        node.contract_tp = this.ctx.helper.add(node.contract_tp, data.contract_tp);
+        node.qc_qty = this.ctx.helper.add(node.qc_qty, data.qc_qty);
+        node.qc_tp = this.ctx.helper.add(node.qc_tp, );
+        node.gather_qty = this.ctx.helper.add(node.gather_qty, data.gather_qty);
+
+        node.pre_contract_qty = this.ctx.helper.add(node.pre_contract_qty, data.pre_contract_qty);
+        node.pre_contract_tp = this.ctx.helper.add(node.pre_contract_tp, data.pre_contract_tp);
+        node.pre_qc_qty = this.ctx.helper.add(node.pre_qc_qty, data.pre_qc_qty);
+        node.pre_qc_tp = this.ctx.helper.add(node.pre_qc_tp, data.pre_qc_tp);
+        node.pre_gather_qty = this.ctx.helper.add(node.pre_gather_qty, data.pre_gather_qty);
+    }
     _convertGcl(node, xmj) {
         if (!xmj) return;
 
@@ -110,7 +126,7 @@ class BillsPosConvert {
                     b_code: node.b_code, name: node.name, unit: node.unit, unit_price: node.unit_price
                 }, posUnit);
                 //loadField(gclUnit, p, baseCalcFields);
-                this._loadCalcFields(gclUnit, p);
+                this._loadPosCalcFields(gclUnit, p);
                 if (!gclUnit.changes) gclUnit.changes = [];
                 for (const c of this.bpcChange) {
                     if (c.lid === node.id && c.pid === p.id && c.qty && c.qty !== 0) {
@@ -119,10 +135,10 @@ class BillsPosConvert {
                 }
             }
         } else {
-            const unit = xmj.unitTree.addNode({pos_name: null,
+            const unit = xmj.unitTree.addNode({pos_name: '',
                 b_code: node.b_code, name: node.name, unit: node.unit, unit_price: node.unit_price});
             //loadField(unit, node, baseCalcFields);
-            this._loadCalcFields(unit, node);
+            this._loadBillsCalcFields(unit, node);
             if (!unit.changes) unit.changes = [];
             for (const c of this.bpcChange) {
                 if (c.lid === node.id && c.pid == -1 && c.qty && c.qty !== 0) {
@@ -155,7 +171,7 @@ class BillsPosConvert {
         //const tpDecimal = this.ctx.tender.info.decimal.tp;
 
         child.gather_qty = this.ctx.helper.add(child.contract_qty, child.qc_qty);
-        child.pre_gather_qty = this.ctx.helper.add(child.pre_contract_qty, child.pre_gather_qty);
+        child.pre_gather_qty = this.ctx.helper.add(child.pre_contract_qty, child.pre_qc_qty);
         child.end_contract_qty = this.ctx.helper.add(child.contract_qty, child.pre_contract_qty);
         child.end_qc_qty = this.ctx.helper.add(child.qc_qty, child.pre_qc_qty);
         child.end_gather_qty = this.ctx.helper.add(child.gather_qty, child.pre_gather_qty);

+ 1 - 1
app/service/external_data.js

@@ -33,7 +33,7 @@ module.exports = app => {
                 tid: tid, sid: sid,
                 ex_type: ex_type, ex_field: ex_field
             };
-            const count = this.count(filter);
+            const count = await this.count(filter);
             if (count >= 0) {
                 await this.db.update(this.tableName, { ex_value: JSON.stringify(ex_value) }, filter);
             } else {

+ 6 - 1
app/view/stage/bwtz.ejs

@@ -67,7 +67,12 @@
         cols: [
             {title: '计量单元', colSpan: '1', rowSpan: '2', field: 'code', hAlign: 0, width: 120, formatter: '@', cellType: 'tree'},
             {title: '清单编号', colSpan: '1', rowSpan: '2', field: 'b_code', hAlign: 0, width: 70, formatter: '@'},
-            {title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@'},
+            {
+                title: '名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 185, formatter: '@',
+                getValue: function (data) {
+                    return data.pos_name + data.name;
+                }
+            },
             {title: '单位', colSpan: '1', rowSpan: '2', field: 'unit', hAlign: 1, width: 60, formatter: '@', cellType: 'unit'},
             {title: '单价', colSpan: '1', rowSpan: '2', field: 'unit_price', hAlign: 2, width: 60, type: 'Number'},
             {title: '台账|数量', colSpan: '2|1', rowSpan: '1|1', field: 'quantity', hAlign: 2, width: 60, type: 'Number'},