|
@@ -403,76 +403,73 @@ let calcTools = {
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
|
- supplyABFee: function (treeNode, baseName) {
|
|
|
+ partASupplyFee: function (treeNode, baseName) {
|
|
|
if (!treeNode.data.gljList) return 0;
|
|
|
let projectGLJ = projectObj.project.projectGLJ;
|
|
|
|
|
|
let supplyT = [];
|
|
|
if (baseName.includes('甲供'))
|
|
|
- supplyT = [supplyType.BFJG, supplyType.WQJG] // 字段中存储的是汉字!
|
|
|
- // supplyT = ['部分甲供', '完全甲供']
|
|
|
+ supplyT = [supplyType.BFJG, supplyType.WQJG] // 字段中存储的是汉字、数字混杂!
|
|
|
else if (baseName.includes('甲定'))
|
|
|
supplyT = [supplyType.JDYG];
|
|
|
- // supplyT = ['甲定乙供'];
|
|
|
|
|
|
- let gljT = [], compositionTypesArr = [];
|
|
|
+ let gljT = [], compT = [];
|
|
|
if (baseName == calcBaseNames.JGDEJJRGF || baseName == calcBaseNames.JDDEJJRGF){
|
|
|
gljT = [gljType.LABOUR];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJCLF || baseName == calcBaseNames.JDDEJJCLF){
|
|
|
gljT = baseMaterialTypes;
|
|
|
- compositionTypesArr = compositionTypes;
|
|
|
+ compT = compositionTypes;
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGDEJJJXF || baseName == calcBaseNames.JDDEJJJXF){
|
|
|
gljT = baseMachineTypes;
|
|
|
- compositionTypesArr = [gljType.GENERAL_MACHINE];
|
|
|
+ compT = [gljType.GENERAL_MACHINE];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGZCF || baseName == calcBaseNames.JDZCF){
|
|
|
gljT = [gljType.MAIN_MATERIAL];
|
|
|
- compositionTypesArr = [gljType.MAIN_MATERIAL];
|
|
|
+ compT = [gljType.MAIN_MATERIAL];
|
|
|
}
|
|
|
else if (baseName == calcBaseNames.JGSBF || baseName == calcBaseNames.JDSBF){
|
|
|
gljT = [gljType.EQUIPMENT];
|
|
|
};
|
|
|
// alert(JSON.stringify(projectGLJ.testGLJs()));
|
|
|
- let supplyProjectGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
- if (supplyProjectGLJs.length == 0) return 0;
|
|
|
-
|
|
|
- let pGLJIdx = {};
|
|
|
- for (let pglj of supplyProjectGLJs){pGLJIdx[pglj.id] = pglj};
|
|
|
+ let supplyGLJs = projectGLJ.getGLJsBySupply(supplyT, gljT);
|
|
|
+ if (supplyGLJs.length == 0) return 0;
|
|
|
+ let supplyGLJsIdx = {};
|
|
|
+ for (let sglj of supplyGLJs){supplyGLJsIdx[sglj.id] = sglj};
|
|
|
+
|
|
|
+ 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.unit_price.base_price;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return false;
|
|
|
+ };
|
|
|
|
|
|
let sum = 0;
|
|
|
for (let glj of treeNode.data.gljList){
|
|
|
// 组成物的母体。母体如果有组成物,则母体无法作为甲供材料,无法设置,此时要看其组成物是否是甲供材料;母体如果没有组成物,则母体有可能成为甲供材料。
|
|
|
- if (compositionTypesArr.includes(glj.type)) {
|
|
|
- if (pGLJIdx[glj.projectGLJID]) { // 组成物的母体是甲供材料
|
|
|
+ if (compT.includes(glj.type)) {
|
|
|
+ if (supplyGLJsIdx[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.unit_price.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);
|
|
|
+ for (let c of compositions){
|
|
|
+ if (isSupply(c, supplyGLJs)) {
|
|
|
+ sum = (sum + c.basePrice * c.consumption * glj.quantity).toDecimal(decimalObj.process);
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- if (pGLJIdx[glj.projectGLJID]) {
|
|
|
+ if (supplyGLJsIdx[glj.projectGLJID]) {
|
|
|
sum = (sum + glj.basePrice * glj.quantity).toDecimal(decimalObj.process);
|
|
|
}
|
|
|
};
|
|
@@ -635,34 +632,34 @@ const rationCalcBases = {
|
|
|
return rst.toDecimal(decimalObj.glj.quantity);
|
|
|
},
|
|
|
'甲供定额基价人工费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JGDEJJRGF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JGDEJJRGF);
|
|
|
},
|
|
|
'甲供定额基价材料费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JGDEJJCLF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JGDEJJCLF);
|
|
|
},
|
|
|
'甲供定额基价机械费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JGDEJJJXF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JGDEJJJXF);
|
|
|
},
|
|
|
'甲供主材费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JGZCF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JGZCF);
|
|
|
},
|
|
|
'甲供设备费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JGSBF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JGSBF);
|
|
|
},
|
|
|
'甲定定额基价人工费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JDDEJJRGF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JDDEJJRGF);
|
|
|
},
|
|
|
'甲定定额基价材料费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JDDEJJCLF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JDDEJJCLF);
|
|
|
},
|
|
|
'甲定定额基价机械费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JDDEJJJXF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JDDEJJJXF);
|
|
|
},
|
|
|
'甲定主材费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JDZCF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JDZCF);
|
|
|
},
|
|
|
'甲定设备费': function (node) {
|
|
|
- return calcTools.supplyABFee(node, calcBaseNames.JDSBF);
|
|
|
+ return calcTools.partASupplyFee(node, calcBaseNames.JDSBF);
|
|
|
},
|
|
|
'暂估材料费': function (node) {
|
|
|
return calcTools.estimateFee(node, true);
|