diff --git a/src/views/modules/quotation/sellForQuotation/quotationDetail.vue b/src/views/modules/quotation/sellForQuotation/quotationDetail.vue index 1c9d7d9..258856c 100644 --- a/src/views/modules/quotation/sellForQuotation/quotationDetail.vue +++ b/src/views/modules/quotation/sellForQuotation/quotationDetail.vue @@ -314,7 +314,8 @@ - + + @@ -778,7 +779,7 @@ - + - + - + + @@ -3569,10 +3571,6 @@ export default { // 计算工艺单位机器成本 computeUnitMachine(){ let unitMachineryCost = this.quotationRouting.machineryCenterCost; - if (!unitMachineryCost){ - this.quotationRouting.unitMachineryCost = 0; - return - } let total = new Decimal(0); // 单位机器成本 * 机器调机时间 if (!this.quotationRouting.machiningSetupTime || this.quotationRouting.machiningSetupTime < 0){ @@ -3601,10 +3599,6 @@ export default { // 计算工艺单位制造费用 computeManufacturingCenterCost(){ let manufacturingCenterCost = this.quotationRouting.manufacturingCenterCost; - if (!manufacturingCenterCost){ - this.quotationRouting.manufacturingCenterCost = 0; - return - } let total = new Decimal(0); // 单位机器成本 * 机器调机时间 if (!this.quotationRouting.machiningSetupTime || this.quotationRouting.machiningSetupTime < 0){ @@ -3631,14 +3625,8 @@ export default { this.quotationRouting.unitManufacturingCost = new Decimal(total.toFixed(16,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); }, computeLaborCenterCost(){ - let laborCenterCost = this.quotationRouting.laborCenterCost; - if (!laborCenterCost){ - this.quotationRouting.laborCenterCost = 0; - return - } - if (!this.quotationRouting.machiningSetupTime || this.quotationRouting.machiningSetupTime < 0){ - this.quotationRouting.machiningSetupTime = 0; - } + let operatorsCost = this.personnelLevelList.find(item=>item.levelId == this.quotationRouting.operatorsLevel).levelCost; + let tuneInCost = this.personnelLevelList.find(item=>item.levelId == this.quotationRouting.tuneInLevel).levelCost; // 单位调机时间 调机时间/主记录报价数量 let total = new Decimal(this.quotationRouting.machiningSetupTime).div(new Decimal(this.quotationDetailData.quotationDetailQuantity)); //效率 @@ -3655,24 +3643,38 @@ export default { LaborUnitTime = LaborUnitTime.add(new Decimal(0)); } // 人工需求生产时间 - total = total.add(LaborUnitTime.mul(new Decimal(this.quotationRouting.operatorsNumber)).mul(efficiency)).mul(new Decimal(laborCenterCost)); + total = total.add(LaborUnitTime.mul(new Decimal(this.quotationRouting.operatorsNumber)).mul(efficiency)).mul(new Decimal(operatorsCost)); + total = total.add(new Decimal(this.quotationRouting.tuneInNumber).mul(new Decimal(tuneInCost)).mul(new Decimal(this.quotationRouting.machiningSetupTime))) this.quotationRouting.unitLaborCost = new Decimal(total.toFixed(16,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); }, // 计算工艺单位成本 changeRoutingCost(){ this.quotationRouting.unitQuotedCost = new Decimal(0); - if (this.quotationRouting.machineryCenterCost && this.quotationRouting.machineryCenterCost > 0){ - this.computeUnitMachine();// 单位机械成本 - this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitMachineryCost)); - } - if (this.quotationRouting.laborCenterCost && this.quotationRouting.laborCenterCost > 0){ - this.computeLaborCenterCost(); - this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitLaborCost)); + // 判断加工中心机器成本 + if (!this.quotationRouting.machineryCenterCost || this.quotationRouting.machineryCenterCost < 0){ + this.quotationRouting.machineryCenterCost = 0; } - if (this.quotationRouting.manufacturingCenterCost && this.quotationRouting.manufacturingCenterCost > 0){ - this.computeManufacturingCenterCost();//制造费用 - this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitManufacturingCost)); + // 判断加工中心制造费用 + if (!this.quotationRouting.manufacturingCenterCost || this.quotationRouting.manufacturingCenterCost < 0){ + this.quotationRouting.manufacturingCenterCost = 0; } + // 判断 调机人数 + if (!this.quotationRouting.tuneInNumber || this.quotationRouting.tuneInNumber < 0){ + this.quotationRouting.tuneInNumber = 0; + } + // 判断 操作人数 + if (!this.quotationRouting.operatorsNumber || this.quotationRouting.operatorsNumber < 0){ + this.quotationRouting.operatorsNumber = 0; + } + // 计算机器成本 + this.computeUnitMachine(); + this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitMachineryCost)); + // 计算 人工成本 + this.computeLaborCenterCost(); + this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitLaborCost)); + //计算制造费用 + this.computeManufacturingCenterCost(); + this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitManufacturingCost)); this.quotationRouting.unitQuotedCost = new Decimal(this.quotationRouting.unitQuotedCost).toSignificantDigits().toNumber(); }, // ==================================================校验工具类====================================================