|
@@ -115,6 +115,9 @@ let calcTools = {
|
|
|
isNullBill: function (treeNode) {
|
|
|
return this.isLeafBill(treeNode) && (treeNode.children.length === 0) && (!treeNode.data.calcBase);
|
|
|
},
|
|
|
+ isCalcBaseBill: function(treeNode){
|
|
|
+ return this.isLeafBill(treeNode) && (treeNode.children.length === 0) && (treeNode.data.calcBase);
|
|
|
+ },
|
|
|
isTotalCostBill: function (treeNode) {
|
|
|
return treeNode.data.flagsIndex && treeNode.data.flagsIndex.fixed && treeNode.data.flagsIndex.fixed.flag &&
|
|
|
treeNode.data.flagsIndex.fixed.flag == fixedFlag.ENGINEERINGCOST;
|
|
@@ -131,7 +134,19 @@ let calcTools = {
|
|
|
isGljRation: function (treeNode) {
|
|
|
return this.isRationCategory(treeNode) && treeNode.data.type === rationType.gljRation;
|
|
|
},
|
|
|
- getGLJList: function (treeNode) {
|
|
|
+ isInheritFrom: function (treeNode, flagsArr){
|
|
|
+ let cur = treeNode;
|
|
|
+ while (cur.parent) {
|
|
|
+ cur = cur.parent;
|
|
|
+ };
|
|
|
+
|
|
|
+ let flag = -1;
|
|
|
+ if (cur.data.flagsIndex && cur.data.flagsIndex.fixed && cur.data.flagsIndex.fixed.flag)
|
|
|
+ flag = cur.data.flagsIndex.fixed.flag;
|
|
|
+
|
|
|
+ return flagsArr.includes(flag);
|
|
|
+ },
|
|
|
+ getGLJList: function (treeNode, needOneBill) {
|
|
|
delete treeNode.data.gljList;
|
|
|
if (this.isRationCategory(treeNode)) {
|
|
|
if (treeNode.data.type != rationType.volumePrice) {
|
|
@@ -143,7 +158,7 @@ let calcTools = {
|
|
|
let q = nodeQ ? nodeQ : 1;
|
|
|
let rNodes = projectObj.project.Ration.getRationNodes(treeNode);
|
|
|
let rations = rNodes.map(function (node) {return node.data});
|
|
|
- treeNode.data.gljList = projectObj.project.ration_glj.getGatherGljArrByRations(rations, q);
|
|
|
+ treeNode.data.gljList = projectObj.project.ration_glj.getGatherGljArrByRations(rations, needOneBill, q);
|
|
|
};
|
|
|
},
|
|
|
|
|
@@ -287,7 +302,7 @@ let calcTools = {
|
|
|
let nodeQ = me.uiNodeQty(treeNode);
|
|
|
let isGather = (projectObj.project.property.zanguCalcMode == zanguCalcType.gatherMaterial);
|
|
|
|
|
|
- // 先汇总数量,再乘市场价
|
|
|
+ // 先汇总数量,再乘市场价。如果是叶子清单,进入这里的gljList中的材料,已经是同类材料跨定额汇总过的了。
|
|
|
function eTFee(){
|
|
|
if (!treeNode.data.gljList) return 0;
|
|
|
let GLJObjs = [];
|
|
@@ -295,7 +310,8 @@ let calcTools = {
|
|
|
if (!allMaterialTypes.includes(glj.type)) continue;
|
|
|
if (glj.isEstimate){
|
|
|
GLJObjs.push({code: glj.code, name: glj.name, specs: glj.specs, unit: glj.unit, type: glj.type,
|
|
|
- quantity: (nodeQ * glj.quantity).toDecimal(decimalObj.process),
|
|
|
+ // quantity: (nodeQ * glj.quantity).toDecimal(decimalObj.process),
|
|
|
+ quantity: me.uiGLJQty((glj.totalQuantity)).toDecimal(decimalObj.process),
|
|
|
marketPrice: glj.marketPrice});
|
|
|
}
|
|
|
else{ // 组成物
|
|
@@ -305,8 +321,9 @@ let calcTools = {
|
|
|
for (let md of mds){
|
|
|
if (md.isEstimate){
|
|
|
let isExist = false;
|
|
|
- let totalQ = (nodeQ * me.uiGLJQty(glj.quantity)).toDecimal(decimalObj.glj.quantity);
|
|
|
- let mdQ = (totalQ * me.uiGLJQty(md.consumption)).toDecimal(decimalObj.process);
|
|
|
+ // let totalQ = (nodeQ * me.uiGLJQty(glj.quantity)).toDecimal(decimalObj.glj.quantity);
|
|
|
+ let totalQ = me.uiGLJQty((glj.totalQuantity)).toDecimal(decimalObj.glj.quantity);
|
|
|
+ let mdQ = (totalQ * me.uiGLJQty(md.consumption)).toDecimal(decimalObj.process);
|
|
|
|
|
|
for (let obj of GLJObjs){
|
|
|
if (gljOprObj.getIndex(md, gljKeyArray) == gljOprObj.getIndex(obj, gljKeyArray)){
|
|
@@ -1404,7 +1421,7 @@ class CalcProgram {
|
|
|
|
|
|
let nodes = [];
|
|
|
if (treeNode.calcType == treeNodeCalcType.ctGatherRationsFees){
|
|
|
- calcTools.getGLJList(treeNode);
|
|
|
+ calcTools.getGLJList(treeNode, true);
|
|
|
nodes = me.project.Ration.getRationNodes(treeNode);
|
|
|
}
|
|
|
else nodes = treeNode.children;
|
|
@@ -1533,7 +1550,7 @@ class CalcProgram {
|
|
|
// 定额或叶子清单自己的计算程序计算
|
|
|
else{
|
|
|
let fnArr = [];
|
|
|
- calcTools.getGLJList(treeNode);
|
|
|
+ calcTools.getGLJList(treeNode, true);
|
|
|
|
|
|
if (treeNode.calcType == treeNodeCalcType.ctRationCalcProgram) {
|
|
|
// 量价、工料机类型的定额要求市场合价
|
|
@@ -1580,8 +1597,11 @@ class CalcProgram {
|
|
|
};
|
|
|
};
|
|
|
|
|
|
- if (!calcTools.isTotalCostBill(treeNode)) // 已在上面的分支中计算过
|
|
|
+ if (!calcTools.isTotalCostBill(treeNode)){ // 已在上面的分支中计算过
|
|
|
+ calcTools.getGLJList(treeNode, false);
|
|
|
calcTools.estimateFee(treeNode);
|
|
|
+ }
|
|
|
+
|
|
|
if (treeNode.changed && !changedArr.includes(treeNode)) changedArr.push(treeNode);
|
|
|
};
|
|
|
|