|
@@ -269,7 +269,7 @@ $(document).ready(() => {
|
|
|
// 台账树结构计算相关设置
|
|
|
stageTreeSetting.updateFields = ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'postil', 'used', 'contract_expr', 'minus_qc_qty'];
|
|
|
stageTreeSetting.calcFields = ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp',
|
|
|
- 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp', 'end_1_tp'];
|
|
|
+ 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp', 'end_contract_tp', 'end_qc_tp', 'end_gather_tp', 'end_correct_tp', 'final_1_tp'];
|
|
|
stageTreeSetting.calcFun = function (node) {
|
|
|
if (!node.children || node.children.length === 0) {
|
|
|
node.pre_gather_qty = ZhCalc.add(node.pre_contract_qty, node.pre_qc_qty);
|
|
@@ -278,8 +278,9 @@ $(document).ready(() => {
|
|
|
node.end_qc_qty = ZhCalc.add(node.pre_qc_qty, node.qc_qty);
|
|
|
node.end_gather_qty = ZhCalc.add(node.pre_gather_qty, node.gather_qty);
|
|
|
node.end_minus_qc_qty = ZhCalc.add(node.pre_minus_qc_qty, node.minus_qc_qty);
|
|
|
- node.end_1_qty = ZhCalc.add(node.end_minus_qc_qty, node.quantity); // 1#台账 台账+负变更
|
|
|
- node.end_1_tp = ZhCalc.mul(node.unit_price, node.end_1_qty, tenderInfo.decimal.tp);
|
|
|
+ node.final_1_qty = ZhCalc.add(node.end_minus_qc_qty, node.quantity); // 1#台账 台账+负变更
|
|
|
+ node.final_1_tp = ZhCalc.mul(node.unit_price, node.final_1_qty, tenderInfo.decimal.tp);
|
|
|
+ node.final_deal_1_qty = ZhCalc.add(node.end_minus_qc_qty, node.deal_qty);
|
|
|
}
|
|
|
node.pre_gather_tp = ZhCalc.add(node.pre_contract_tp, node.pre_qc_tp);
|
|
|
node.gather_tp = ZhCalc.add(node.contract_tp, node.qc_tp);
|
|
@@ -287,7 +288,7 @@ $(document).ready(() => {
|
|
|
node.end_qc_tp = ZhCalc.add(node.pre_qc_tp, node.qc_tp);
|
|
|
node.end_gather_tp = ZhCalc.add(node.pre_gather_tp, node.gather_tp);
|
|
|
node.end_final_tp = ZhCalc.add(node.end_qc_tp, node.total_price);
|
|
|
- node.end_final_1_tp = ZhCalc.add(node.end_qc_tp, node.end_1_tp);
|
|
|
+ node.end_final_1_tp = ZhCalc.add(node.end_qc_tp, node.final_1_tp);
|
|
|
if (!node.children || node.children.length === 0) {
|
|
|
if (node.end_contract_qty) {
|
|
|
node.end_correct_tp = ZhCalc.add(node.end_qc_tp, ZhCalc.mul(node.end_contract_qty, node.unit_price, tenderInfo.decimal.tp));
|
|
@@ -305,7 +306,7 @@ $(document).ready(() => {
|
|
|
// 初始化 计量单元 数据结构
|
|
|
const stagePosSetting = {
|
|
|
id: 'id', ledgerId: 'lid',
|
|
|
- updateFields: ['contract_qty', 'qc_qty', 'postil', 'contract_expr'],
|
|
|
+ updateFields: ['contract_qty', 'qc_qty', 'postil', 'contract_expr', 'minus_qc_qty'],
|
|
|
};
|
|
|
stagePosSetting.calcFun = function (pos) {
|
|
|
pos.pre_gather_qty = ZhCalc.add(pos.pre_contract_qty, pos.pre_qc_qty);
|
|
@@ -318,6 +319,8 @@ $(document).ready(() => {
|
|
|
pos.estimate_qty = !checkZero(pos.real_qty)
|
|
|
? ZhCalc.sub(ZhCalc.sub(pos.real_qty, pos.quantity), pos.end_qc_qty)
|
|
|
: null;
|
|
|
+ pos.end_minus_qc_qty = ZhCalc.add(pos.minus_qc_qty, pos.pre_minus_qc_qty);
|
|
|
+ pos.final_1_qty = ZhCalc.add(pos.end_minus_qc_qty, pos.quantity);
|
|
|
};
|
|
|
const stagePos = new StagePosData(stagePosSetting);
|
|
|
|
|
@@ -2045,20 +2048,32 @@ $(document).ready(() => {
|
|
|
postData(window.location.pathname + '/load', { filter: 'ledger;pos;detail;change;import_change;tag;cooperation;minus_change' }, function (result) {
|
|
|
// 加载树结构
|
|
|
stageTree.loadDatas(result.ledgerData);
|
|
|
+ // 加载部位明细
|
|
|
+ stagePos.loadDatas(result.posData);
|
|
|
let mcIndex = {};
|
|
|
if (result.minus_change && result.minus_change.length > 0) {
|
|
|
for (const mc of result.minus_change) {
|
|
|
if (!mcIndex[mc.lid]) mcIndex[mc.lid] = stageTree.nodes.find(x => { return x.id === mc.lid; });
|
|
|
- if (!mcIndex[mc.lid]) continue;
|
|
|
- mcIndex[mc.lid].pre_minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].pre_minus_qc_qty, mc.qty);
|
|
|
+ if (!mcIndex[mc.lid]) {
|
|
|
+ mcIndex[mc.lid].pre_minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].pre_minus_qc_qty, mc.qty);
|
|
|
+ }
|
|
|
+ const mcP = stagePos.getPos(mc.pid);
|
|
|
+ if (mcP) {
|
|
|
+ mcP.pre_minus_qc_qty = ZhCalc.add(mcP.pre_minus_qc_qty, mc.qty);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (result.changeData && result.changeData.length > 0) {
|
|
|
for (const mc of result.changeData) {
|
|
|
if (!mc.minus || !mc.qty) continue;
|
|
|
if (!mcIndex[mc.lid]) mcIndex[mc.lid] = stageTree.nodes.find(x => { return x.id === mc.lid; });
|
|
|
- if (!mcIndex[mc.lid]) continue;
|
|
|
- mcIndex[mc.lid].minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].minus_qc_qty, mc.qty);
|
|
|
+ if (!mcIndex[mc.lid]) {
|
|
|
+ mcIndex[mc.lid].minus_qc_qty = ZhCalc.add(mcIndex[mc.lid].minus_qc_qty, mc.qty);
|
|
|
+ }
|
|
|
+ const mcP = stagePos.getPos(mc.pid);
|
|
|
+ if (mcP) {
|
|
|
+ mcP.pre_minus_qc_qty = ZhCalc.add(mcP.pre_minus_qc_qty, mc.qty);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
mcIndex = null;
|
|
@@ -2076,8 +2091,6 @@ $(document).ready(() => {
|
|
|
t.node = stageTree.datas.find(x => {return x.id === t.lid});
|
|
|
}
|
|
|
billsTag.loadDatas(result.tags);
|
|
|
- // 加载部位明细
|
|
|
- stagePos.loadDatas(result.posData);
|
|
|
stagePos.calculateAll();
|
|
|
SpreadJsObj.loadSheetData(slSpread.getActiveSheet(), 'tree', stageTree);
|
|
|
SpreadJsObj.loadTopAndSelect(slSpread.getActiveSheet(), ckBillsSpread);
|