|
@@ -392,43 +392,66 @@ let calcTools = {
|
|
|
else if (baseName.includes('甲定'))
|
|
|
supplyT = [supplyType.JDYG];
|
|
|
|
|
|
- let gljT = [], compositionArr = [];
|
|
|
+ let gljT = [], compositionTypesArr = [];
|
|
|
if (baseName == calcBaseNames.JGDEJJRGF || baseName == calcBaseNames.JDDEJJRGF){
|
|
|
gljT = [gljType.LABOUR];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJCLF || baseName == calcBaseNames.JDDEJJCLF){
|
|
|
gljT = baseMaterialTypes;
|
|
|
- compositionArr = compositionTypes;
|
|
|
+ compositionTypesArr = compositionTypes;
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJJXF || baseName == calcBaseNames.JDDEJJJXF){
|
|
|
gljT = baseMachineTypes;
|
|
|
- compositionArr = [gljType.GENERAL_MACHINE];
|
|
|
+ compositionTypesArr = [gljType.GENERAL_MACHINE];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGZCF || baseName == calcBaseNames.JDZCF){
|
|
|
gljT = [gljType.MAIN_MATERIAL];
|
|
|
- compositionArr = [gljType.MAIN_MATERIAL];
|
|
|
+ compositionTypesArr = [gljType.MAIN_MATERIAL];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGSBF || baseName == calcBaseNames.JDSBF){
|
|
|
gljT = [gljType.EQUIPMENT];
|
|
|
};
|
|
|
|
|
|
- let pGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
- if (pGLJs.length == 0) return 0;
|
|
|
+ let supplyProjectGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
+ if (supplyProjectGLJs.length == 0) return 0;
|
|
|
|
|
|
let pGLJIdx = {};
|
|
|
- for (let pglj of pGLJs){pGLJIdx[pglj.GLJID] = pglj};
|
|
|
+ for (let pglj of supplyProjectGLJs){pGLJIdx[pglj.projectGLJID] = pglj};
|
|
|
|
|
|
let sum = 0;
|
|
|
for (let glj of treeNode.data.gljList){
|
|
|
- // 组成物
|
|
|
- if (compositionArr.includes(glj.type)) {
|
|
|
+ // 组成物的母体。母体如果有组成物,则母体无法作为甲供材料,无法设置,此时要看其组成物是否是甲供材料;母体如果没有组成物,则母体有可能成为甲供材料。
|
|
|
+ if (compositionTypesArr.includes(glj.type)) {
|
|
|
+ if (pGLJIdx[glj.projectGLJID]) { // 组成物的母体是甲供材料
|
|
|
+ sum = (sum + glj.basePrice * glj.quantity).toDecimal(decimalObj.process);
|
|
|
+ }
|
|
|
+ else{ // 组成物明细
|
|
|
+ let pGLJ = projectGLJ.getDataByID(glj.projectGLJID);
|
|
|
+ let compositions = pGLJ.ratio_data;
|
|
|
+ if (compositions.length > 0){
|
|
|
+ function isSupply(composition, supplies) {
|
|
|
+ for (let supply of supplies){
|
|
|
+ if(supply.code == composition.code && supply.name == composition.name && supply.unit == composition.unit &&
|
|
|
+ supply.specs == composition.specs && supply.type == composition.type ){
|
|
|
+ composition.basePrice = supply.base_price;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ };
|
|
|
|
|
|
+ for (let composition of compositions){
|
|
|
+ if (isSupply(composition, supplyProjectGLJs)) {
|
|
|
+ sum = (sum + composition.basePrice * composition.consumption * glj.quantity).toDecimal(decimalObj.process);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
- if (pGLJIdx[glj.GLJID]) {
|
|
|
-
|
|
|
+ if (pGLJIdx[glj.projectGLJID]) {
|
|
|
+ sum = (sum + glj.basePrice * glj.quantity).toDecimal(decimalObj.process);
|
|
|
}
|
|
|
- sum = sum + glj.basePrice * glj.quantity;
|
|
|
};
|
|
|
|
|
|
};
|
|
@@ -589,24 +612,34 @@ const rationCalcBases = {
|
|
|
return rst.toDecimal(decimalObj.glj.quantity);
|
|
|
},
|
|
|
'甲供定额基价人工费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJRGF);
|
|
|
},
|
|
|
'甲供定额基价材料费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJCLF);
|
|
|
},
|
|
|
'甲供定额基价机械费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGDEJJJXF);
|
|
|
},
|
|
|
'甲供主材费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGZCF);
|
|
|
},
|
|
|
'甲供设备费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JGSBF);
|
|
|
},
|
|
|
'甲定定额基价人工费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJRGF);
|
|
|
},
|
|
|
'甲定定额基价材料费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJCLF);
|
|
|
},
|
|
|
'甲定定额基价机械费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDDEJJJXF);
|
|
|
},
|
|
|
'甲定主材费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDZCF);
|
|
|
},
|
|
|
'甲定设备费': function (node) {
|
|
|
+ return calcTools.supplyABFee(node, calcBaseNames.JDSBF);
|
|
|
},
|
|
|
'暂估材料费': function (node) {
|
|
|
return calcTools.estimateFee(node, true);
|
|
@@ -1177,11 +1210,12 @@ class CalcProgram {
|
|
|
}
|
|
|
|
|
|
let f = treeNode.data.feeRate ? treeNode.data.feeRate : 100;
|
|
|
- let q = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 1;
|
|
|
let b = treeNode.data.calcBaseValue ? treeNode.data.calcBaseValue : 0;
|
|
|
- let uf = (b * f * q / 100).toDecimal(decimalObj.bills.unitPrice);
|
|
|
+ let q = calcTools.uiNodeQty(treeNode) ? calcTools.uiNodeQty(treeNode) : 1;
|
|
|
+ let uf = (b * f * 0.01 / q).toDecimal(decimalObj.bills.unitPrice);
|
|
|
let tuf = uf;
|
|
|
- let tf = (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) ? (b * f / 100).toDecimal(decimalObj.bills.totalPrice) : (uf * q).toDecimal(decimalObj.bills.totalPrice);
|
|
|
+ let tf = (me.project.property.billsCalcMode === leafBillGetFeeType.rationPrice) ? (b * f / 100) : (uf * q);
|
|
|
+ tf = tf.toDecimal(decimalObj.bills.totalPrice);
|
|
|
let ttf = tf;
|
|
|
deleteUselessFees(treeNode);
|
|
|
calcTools.checkFeeField(treeNode, {'fieldName': 'common', 'unitFee': uf, 'totalFee': tf});
|