|
@@ -40,6 +40,18 @@ const stageIm = (function () {
|
|
|
}
|
|
|
};
|
|
|
const gsTree = createNewPathTree('stage', gsTreeSetting);
|
|
|
+ const gsPosSetting = {
|
|
|
+ id: 'id', ledgerId: 'lid',
|
|
|
+ updateFields: ['contract_qty', 'qc_qty', 'postil'],
|
|
|
+ };
|
|
|
+ gsPosSetting.calcFun = function (pos) {
|
|
|
+ pos.pre_gather_qty = _.add(pos.pre_contract_qty, pos.pre_qc_qty);
|
|
|
+ pos.gather_qty = _.add(pos.contract_qty, pos.qc_qty);
|
|
|
+ pos.end_contract_qty = _.add(pos.pre_contract_qty, pos.contract_qty);
|
|
|
+ pos.end_qc_qty = _.add(pos.pre_qc_qty, pos.qc_qty);
|
|
|
+ pos.end_gather_qty = _.add(pos.pre_gather_qty, pos.gather_qty);
|
|
|
+ };
|
|
|
+ const gsPos = new StagePosData(gsPosSetting);
|
|
|
|
|
|
function init (s, i) {
|
|
|
stage = s;
|
|
@@ -54,13 +66,17 @@ const stageIm = (function () {
|
|
|
|
|
|
}
|
|
|
|
|
|
- function loadData (ledger, curStage, stageDetail) {
|
|
|
+ function loadData (ledger, curStage, pos, curPosStage, stageDetail) {
|
|
|
gsTree.loadDatas(ledger);
|
|
|
|
|
|
gsTree.loadCurStageData(curStage);
|
|
|
// 根据设置 计算 台账树结构
|
|
|
treeCalc.calculateAll(gsTree);
|
|
|
|
|
|
+ gsPos.loadDatas(pos);
|
|
|
+ gsPos.loadCurStageData(curPosStage);
|
|
|
+ gsPos.calculateAll();
|
|
|
+
|
|
|
initCheck();
|
|
|
details = stageDetail;
|
|
|
}
|
|
@@ -152,6 +168,22 @@ const stageIm = (function () {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ function generatePosData(node, lx) {
|
|
|
+ if (!lx.pos) {
|
|
|
+ lx.pos = [];
|
|
|
+ }
|
|
|
+ const posRange = gsPos.getLedgerPos(node.id);
|
|
|
+ for (const p of posRange) {
|
|
|
+ if (!p.gather_qty || checkZero(p.gather_qty)) { continue; }
|
|
|
+ let lp = _.find(lx.pos, {name: p.name});
|
|
|
+ if (!lp) {
|
|
|
+ lp = {name: p.name, qty: p.quantity};
|
|
|
+ lx.pos.push(lp);
|
|
|
+ }
|
|
|
+ lp.jl = _.round(_.add(lp.jl, p.gather_qty), 6);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成所属项目节数据(取最底层项目节)
|
|
|
* @param node - 生成数据基于的台账节点
|
|
@@ -172,6 +204,7 @@ const stageIm = (function () {
|
|
|
im.leafXmjs.push(lx);
|
|
|
}
|
|
|
lx.jl = _.round(_.add(lx.jl, node[jlField]), 6);
|
|
|
+ generatePosData(node, lx);
|
|
|
}
|
|
|
|
|
|
/**
|