diff --git a/src/views/modules/quotation/sellForQuotation.vue b/src/views/modules/quotation/sellForQuotation.vue index 1907c78..9763988 100644 --- a/src/views/modules/quotation/sellForQuotation.vue +++ b/src/views/modules/quotation/sellForQuotation.vue @@ -89,7 +89,7 @@ - + 查 询 新 增 diff --git a/src/views/modules/quotation/sellForQuotation/quotationDetail.vue b/src/views/modules/quotation/sellForQuotation/quotationDetail.vue index 73ab2f5..32430b4 100644 --- a/src/views/modules/quotation/sellForQuotation/quotationDetail.vue +++ b/src/views/modules/quotation/sellForQuotation/quotationDetail.vue @@ -183,7 +183,7 @@
- +
@@ -282,6 +282,7 @@ + @@ -353,6 +354,7 @@ + @@ -543,7 +545,7 @@ label-width="120px"> - +
@@ -564,7 +566,7 @@
- +
@@ -589,7 +591,7 @@ - @@ -610,23 +612,30 @@
- +
- +
- +
- +
- + +
+
+
+ + +
+
@@ -697,7 +706,7 @@ - + - +
- +
- +
- +
+ +
+ +
+
+
+ + +
+ +
+
+
+ + +
+ +
+
+
+ + style="width: 100%" placeholder="请选择" @change="changeRoutingCost"> - +
- +
- +
- +
- +
- +
- +
- +
- +
- +
- +
@@ -814,6 +844,7 @@ title="报价材料" :visible.sync="quotationPartDialogFlag" @close="closeQuotationPartDialog" + @open="openQuotationPartDialog" :close-on-click-modal="false" width="40%"> @@ -848,7 +879,7 @@
- +
@@ -862,14 +893,21 @@
- +
- + +
+
+
+ + +
+
@@ -1032,6 +1070,7 @@ + + @@ -1431,7 +1471,7 @@ export default { }, selectionQuotationRoutingList:[],//选中的工艺记录集合 umInformationList:[],// 单位集合 - outputUnitList:[{label:"单位/小时"},{label: "小时/单位"},{label: "小时"}],// 产出单位集合 + outputUnitList:[{label: "小时"},{label:"单位/小时"},{label: "小时/单位"},],// 产出单位集合 workCenterList:[],// 加工中心集合 partList:[],//材料信息集合 quotationPartFormTable:{ @@ -1547,9 +1587,10 @@ export default { quotationPartDesc:undefined,//报价材料名称 umId:undefined,//计量单位 unitDosage:1,//单位用量 - attritionRate:1,//损耗率 + attritionRate:0,//损耗率 transferAmount:1,//调机用量 unitCost:1,//单位成本 + quotationUnitCost:0,//单位报价成本 remark:undefined,//备注 }, //报价明细新增对象 @@ -1610,15 +1651,18 @@ export default { machiningCenterNo:undefined,//加工中心编码 machiningCenterDesc:undefined,//加工中心名称 machiningCenterType:undefined,//加工中心类别 - machiningSetupTime:1,//调机时间 - unitOutputQuantity:0,//单位产出量 - outputUnit:'单位/小时',//单位编码 + machiningSetupTime:0,//调机时间 + unitOutputQuantity:1,//单位产出量 + outputUnit:'小时',//单位编码 routingEfficiency:100,//效率 operatorsNumber:1,//操作工人数 unitMachineryCost:0,//单位机器成本 unitLaborCost:0,//单位人工成本 unitManufacturingCost:0,//单位制造费用 unitQuotedCost:0,//单位报价成本 + laborCenterCost:0, + machineryCenterCost:0,//机器成本 + manufacturingCenterCost:0, remark:undefined,//备注 }, //报价工具对象 @@ -1629,6 +1673,7 @@ export default { toolDescription: "", toolQuantity: 1, unitCost: 1, + quotationUnitCost:0, expectedServiceLife: 1, remark: "", }, @@ -1923,6 +1968,10 @@ export default { {required: true, message: ' ', trigger: 'change'}, {required: true, message: ' ', trigger: 'blur'}, ], + quotationRoutingDesc: [ + {required: true, message: ' ', trigger: 'change'}, + {required: true, message: ' ', trigger: 'blur'}, + ], itemNo: [ {required: true, message: ' ', trigger: 'change'}, {required: true, message: ' ', trigger: 'blur'}, @@ -1960,20 +2009,32 @@ export default { {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'blur'}, ], unitMachineryCost: [ - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'change'}, - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'blur'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, ], unitLaborCost: [ - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'change'}, - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'blur'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, ], unitManufacturingCost: [ - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'change'}, - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'blur'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, ], unitQuotedCost: [ - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'change'}, - {required: true, pattern: /^[0-9]+(.[0-9]{1,2})?$/, message: ' ', trigger: 'blur'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, + ], + machineryCenterCost: [ + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, + ], + laborCenterCost: [ + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, + ], + manufacturingCenterCost: [ + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'change'}, + {required: true, pattern: /^[0-9]+(.[0-9]{1,4})?$/, message: ' ', trigger: 'blur'}, ], }, //报价材料 @@ -2730,6 +2791,7 @@ export default { this.batchInsertQuotationPartData(otherSelectionPart); break; case 2: + otherSelectionRouting = this.selectionOtherDetailList.map(item=>{ item.quotationDetailId = this.quotationDetailData.quotationDetailId; item.quotationRoutingId = undefined; @@ -2896,18 +2958,6 @@ export default { this.initQuotationRoutingLoading = false; if (data.code === 200) { this.quotationRoutingFormTable.quotationRoutingList = data.data; - // 计算价格 - let list = this.quotationRoutingFormTable.quotationRoutingList; - this.quotationDetailData.computeLabourCost = 0; - this.quotationDetailData.computeFabricateCost = 0; - this.quotationDetailData.computeMachineCost = 0; - for (let i = 0; i < list.length; i++) { - let item = list[i]; - // 获取总价格 - this.quotationDetailData.computeLabourCost = new Decimal(this.quotationDetailData.computeLabourCost).add(new Decimal(item.unitLaborCost)).toNumber(); - this.quotationDetailData.computeFabricateCost = new Decimal(this.quotationDetailData.computeFabricateCost).add(new Decimal(item.unitManufacturingCost)).toNumber(); - this.quotationDetailData.computeMachineCost = new Decimal(this.quotationDetailData.computeMachineCost).add(new Decimal(item.unitMachineryCost)).toNumber(); - } } }).catch((error)=>{ this.initQuotationRoutingLoading = false; @@ -2923,7 +2973,6 @@ export default { this.initQuotationPartLoading = false; if (data.code === 200){ this.quotationPartFormTable.quotationPartList = data.data; - this.computeQuotationPartCost();// 计算材料 } }).catch((error)=>{ this.initQuotationPartLoading = false; @@ -2939,7 +2988,6 @@ export default { this.initQuotationToolLoading = false; if (data.code === 200) { this.quotationToolFormTable.quotationToolList = data.data; - this.computeQuotationToolCost();// 计算工具价格 } }).catch((error)=>{ this.initQuotationToolLoading = false; @@ -3024,6 +3072,14 @@ export default { }, // ===============================================打开dialog事件================================================== + // 打开材料弹框 + openQuotationPartDialog(){ + this.computePartQuotationUnitCost(this.quotationPart); + }, + // 打开工具弹框 + openQuotationToolDialog(){ + this.computeToolQuotationUnitCost(this.quotationTool); + }, // 点击可选择打开 可选择弹框 chooseModalBtn(row){ this.chooseModalData.itemNo=row.itemNo; @@ -3094,7 +3150,8 @@ export default { }, // 打开报价工序新增 openQuotationRoutingDialog(){ - // this.queryOperationList(); + // this.queryOperationList() + this.changeWorkCenterSelect(this.quotationRouting.machiningCenterNo) }, // 打开 材料信息弹框 openPartDialog(){ @@ -3206,14 +3263,17 @@ export default { machiningCenterNo:undefined,//加工中心编码 machiningCenterDesc:undefined,//加工中心名称 machiningCenterType:undefined,//加工中心类别 - machiningSetupTime:1,//调机时间 - unitOutputQuantity:0,//单位产出量 - outputUnit:'单位/小时',//单位编码 + machiningSetupTime:0,//调机时间 + unitOutputQuantity:1,//单位产出量 + outputUnit:'小时',//单位编码 routingEfficiency:100,//效率 operatorsNumber:1,//操作工人数 unitMachineryCost:0,//单位机器成本 unitLaborCost:0,//单位人工成本 unitManufacturingCost:0,//单位制造费用 + laborCenterCost:0, + machineryCenterCost:0,//机器成本 + manufacturingCenterCost:0, unitQuotedCost:0,//单位报价成本 remark:undefined,//备注 }; @@ -3228,6 +3288,7 @@ export default { toolDescription: "", toolQuantity: 1, unitCost: 1, + quotationUnitCost: 0, expectedServiceLife: 1, remark: "", }; @@ -3257,9 +3318,10 @@ export default { quotationPartDesc:undefined,//报价材料名称 umId:undefined,//计量单位 unitDosage:1,//单位用量 - attritionRate:1,//损耗率 + attritionRate:0,//损耗率 transferAmount:1,//调机用量 unitCost:1,//单位成本 + quotationUnitCost: 0,//报价单位成本 remark:undefined,//备注 }; this.selectionPartList = []; @@ -3385,6 +3447,7 @@ export default { this.quotationPart.quotationPartDesc = row.partDesc; this.quotationPart.umId = row.umId; this.quotationPart.unitCost = row.standardCost; + this.computePartQuotationUnitCost(this.quotationPart); this.partDialogFlag = false; }, // 项目材料双击事件 @@ -3400,34 +3463,47 @@ export default { this.quotationTool.toolNo = row.toolNo; this.quotationTool.toolDescription = row.toolDescription; this.quotationTool.unitCost = row.unitCost ? row.unitCost : 0; + this.computeToolQuotationUnitCost(this.quotationTool) this.toolHeaderDialogFlag= false; }, getComponentRowData (row) { this.quotationRouting.quotationRoutingNo = row.operationId this.quotationRouting.quotationRoutingDesc = row.operationName this.quotationRouting.machiningCenterNo = row.workCenterNo - this.changeWorkCenterSelect(row.workCenterNo, this.quotationRouting) + this.changeWorkCenterSelect(row.workCenterNo) this.componentPartModelFlag = false }, // =============================================输入框输入事件======================================================= // 计算材料总成本 computeQuotationPartCost(){ let amount = this.quotationPartFormTable.quotationPartList.reduce((total,currentValue)=>{ - // 用量 调机用量+单位用量+损耗率 - let count = new Decimal(currentValue.unitDosage).add(new Decimal(currentValue.transferAmount)); - count = count.add(count.mul(new Decimal(currentValue.attritionRate)).div(100)); - return total + count.mul(new Decimal(currentValue.unitCost)).toNumber(); + return total + new Decimal(currentValue.quotationUnitCost).toNumber(); },0); this.quotationDetailData.computePartCost = new Decimal(amount).mul(new Decimal(this.quotationDetailData.quotationDetailQuantity)).toNumber(); }, // 计算 报价工具总成本 computeQuotationToolCost(){ this.quotationDetailData.computeToolCost = this.quotationToolFormTable.quotationToolList.reduce((total, currentValue) => { - return total + new Decimal(currentValue.toolQuantity).mul(new Decimal(currentValue.unitCost)).toNumber(); + return total + new Decimal(currentValue.quotationUnitCost).toNumber(); }, 0); }, + computeQuotationRoutingCost(){ + this.quotationDetailData.computeLabourCost = 0; + this.quotationDetailData.computeFabricateCost = 0; + this.quotationDetailData.computeMachineCost = 0; + for (let i = 0; i < this.quotationRoutingFormTable.quotationRoutingList.length; i++) { + let item = this.quotationRoutingFormTable.quotationRoutingList[i]; + // 获取总价格 + this.quotationDetailData.computeLabourCost = new Decimal(this.quotationDetailData.computeLabourCost).add(new Decimal(item.unitLaborCost)).toNumber(); + this.quotationDetailData.computeFabricateCost = new Decimal(this.quotationDetailData.computeFabricateCost).add(new Decimal(item.unitManufacturingCost)).toNumber(); + this.quotationDetailData.computeMachineCost = new Decimal(this.quotationDetailData.computeMachineCost).add(new Decimal(item.unitMachineryCost)).toNumber(); + } + }, // 计算按钮 adjustCost(){ + this.computeQuotationPartCost();// 计算材料总成本 + this.computeQuotationToolCost();//计算工具成本 + this.computeQuotationRoutingCost();//计算工艺成本 this.quotationDetailData.adjustPartCost = new Decimal(this.quotationDetailData.computePartCost).toSignificantDigits().toNumber(); this.quotationDetailData.adjustToolCost = new Decimal(this.quotationDetailData.computeToolCost).toSignificantDigits().toNumber(); this.quotationDetailData.adjustLabourCost = new Decimal(this.quotationDetailData.computeLabourCost).toSignificantDigits().toNumber(); @@ -3471,29 +3547,54 @@ export default { this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailOtherCost)); this.quotationDetailData.detailTotalCost = this.quotationDetailData.detailTotalCost.add(new Decimal(this.quotationDetailData.detailManageCost)).toSignificantDigits().toNumber(); }, + /** + * 计算材料报价单位成本 + * @param row 计算对象 + */ + computePartQuotationUnitCost(row){ + if (!row.transferAmount || !row.unitDosage || !row.unitCost){ + row.quotationUnitCost = 0; + return + } + if (!row.attritionRate){ + row.attritionRate = 0; + } + // 需求数量 = 调机用量 / 主记录上的报价数量 + 1 * 单位用量 * (1 – 损耗率 / 100) + let transferAmountNumber = new Decimal(row.transferAmount).div(new Decimal(this.quotationDetailData.quotationDetailQuantity)); + let needNumber =transferAmountNumber.add(new Decimal(1).mul(new Decimal(row.unitDosage).mul(new Decimal(1).sub(new Decimal(row.attritionRate).div(new Decimal(100)))))); + // 报价单位成本 = 单位成本 * 需求数量 + row.quotationUnitCost = new Decimal(new Decimal(row.unitCost).mul(needNumber).toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); + }, + computeToolQuotationUnitCost(row){ + //单位报价成本 = 单位成本 * 工具数量 / 预计使用寿命 + if (!row.expectedServiceLife || row.expectedServiceLife <= 0){ + this.quotationTool.expectedServiceLife = 1; + } + if (!row.toolQuantity || row.toolQuantity <= 0){ + this.quotationTool.toolQuantity = 1; + } + if (!row.unitCost || row.unitCost <= 0){ + this.quotationTool.unitCost = 1; + } + if (!row.expectedServiceLife || !row.toolQuantity || !row.unitCost){ + row.quotationUnitCost = 0; + return + } + row.quotationUnitCost = new Decimal(new Decimal(row.unitCost).mul(new Decimal(row.toolQuantity)).div(new Decimal(row.expectedServiceLife)).toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); + }, // ====================================================输入框 事件============================================= - changeWorkCenterSelect(val,obj){ - let value = this.workCenterList.find((item)=>item.workCenterNo == val); + changeWorkCenterSelect(val){ + let value = this.workCenterList.find((item)=>item.workCenterNo === val); if (value){ - obj.machiningCenterDesc = value.workCenterDesc; - obj.machiningCenterType = value.workCenterType; - obj.unitLaborCost = value.laborCost; // 人工成本 - obj.unitMachineryCost = value.unitCost; // 机器成本 - obj.unitManufacturingCost = value.overheadCost;// 制造费用 + this.quotationRouting.machiningCenterNo = value.workCenterNo; + this.quotationRouting.machiningCenterDesc = value.workCenterDesc; + this.quotationRouting.machiningCenterType = value.workCenterType; + this.quotationRouting.laborCenterCost = value.laborCost; // 人工成本 + this.quotationRouting.machineryCenterCost = value.unitCost; // 机器成本 + this.quotationRouting.manufacturingCenterCost = value.overheadCost;// 制造费用 // 计算费用 - // 获得效率 - let efficiency = new Decimal(obj.routingEfficiency).div(new Decimal(100)).toNumber(); - if (obj.outputUnit === '小时'){ - // obj.unitManufacturingCost = obj. - }else if (obj.outputUnit === '小时/单位'){ - - }else if (obj.outputUnit === '单位/小时'){ - - }else { - this.$message.warning("产出单位有误") - } - this.changeRoutingCost();// 工艺 计算单位成本 } + this.changeRoutingCost();// 工艺 计算单位成本 }, machiningCenterNoSelect(e,row){ let value = e.target.value; // 输入框值 @@ -3501,18 +3602,114 @@ export default { row.machiningCenterNo = value } }, + // 计算工艺单位机器成本 + 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){ + this.quotationRouting.machiningSetupTime = 0; + } + total = total.add(new Decimal(unitMachineryCost).mul(this.quotationRouting.machiningSetupTime)) + // 单位机器成本 * 机器需求生产时间 - 机器需求生产时间 = 机器单位生产时间 * (效率 / 100) + let efficiency = new Decimal(this.quotationRouting.routingEfficiency).div(new Decimal(100));//效率 + // 计算单位生产时间 + if (!this.quotationRouting.unitOutputQuantity || this.quotationRouting.unitOutputQuantity <= 0){ + this.quotationRouting.unitOutputQuantity = 0; + total = total.add(new Decimal(0)); + }else { + if (this.quotationRouting.outputUnit === '小时'){ + total = total.add(new Decimal(unitMachineryCost).mul(new Decimal(this.quotationRouting.unitOutputQuantity).mul(efficiency))) + }else if (this.quotationRouting.outputUnit === '小时/单位'){ + total = total.add(new Decimal(unitMachineryCost).mul(new Decimal(1).mul(new Decimal(this.quotationRouting.unitOutputQuantity)).mul(efficiency))) + }else if (this.quotationRouting.outputUnit === '单位/小时'){ + total = total.add(new Decimal(unitMachineryCost).mul(new Decimal(1).div(new Decimal(this.quotationRouting.unitOutputQuantity)).mul(efficiency))) + }else { + total = total.add(new Decimal(0)); + } + } + this.quotationRouting.unitMachineryCost = new Decimal(total.toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); + }, + // 计算工艺单位制造费用 + 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){ + this.quotationRouting.machiningSetupTime = 0; + } + total = total.add(new Decimal(manufacturingCenterCost).mul(this.quotationRouting.machiningSetupTime)) + // 单位机器成本 * 机器需求生产时间 - 机器需求生产时间 = 机器单位生产时间 * (效率 / 100) + let efficiency = new Decimal(this.quotationRouting.routingEfficiency).div(new Decimal(100));//效率 + // 计算单位生产时间 + if (!this.quotationRouting.unitOutputQuantity || this.quotationRouting.unitOutputQuantity <= 0){ + this.quotationRouting.unitOutputQuantity = 0; + total = total.add(new Decimal(0)); + }else { + if (this.quotationRouting.outputUnit === '小时'){ + total = total.add(new Decimal(manufacturingCenterCost).mul(new Decimal(this.quotationRouting.unitOutputQuantity).mul(efficiency))) + }else if (this.quotationRouting.outputUnit === '小时/单位'){ + total = total.add(new Decimal(manufacturingCenterCost).mul(new Decimal(1).mul(new Decimal(this.quotationRouting.unitOutputQuantity)).mul(efficiency))) + }else if (this.quotationRouting.outputUnit === '单位/小时'){ + total = total.add(new Decimal(manufacturingCenterCost).mul(new Decimal(1).div(new Decimal(this.quotationRouting.unitOutputQuantity)).mul(efficiency))) + }else { + total = total.add(new Decimal(0)); + } + } + this.quotationRouting.unitManufacturingCost = new Decimal(total.toFixed(4,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 total = new Decimal(this.quotationRouting.machiningSetupTime).div(new Decimal(this.quotationDetailData.quotationDetailQuantity)); + //效率 + let efficiency = new Decimal(this.quotationRouting.routingEfficiency).div(new Decimal(100)); + // 人工单位生产时间 + let LaborUnitTime = new Decimal(0); + if (this.quotationRouting.outputUnit === '小时'){ + LaborUnitTime = LaborUnitTime.add(new Decimal(this.quotationRouting.unitOutputQuantity)) + }else if (this.quotationRouting.outputUnit === '小时/单位'){ + LaborUnitTime = LaborUnitTime.add(new Decimal(1).mul(new Decimal(this.quotationRouting.unitOutputQuantity))) + }else if (this.quotationRouting.outputUnit === '单位/小时'){ + LaborUnitTime = LaborUnitTime.add(new Decimal(1).div(new Decimal(this.quotationRouting.unitOutputQuantity))) + }else { + LaborUnitTime = LaborUnitTime.add(new Decimal(0)); + } + // 人工需求生产时间 + total = total.add(LaborUnitTime.mul(new Decimal(this.quotationRouting.operatorsNumber)).mul(efficiency)).mul(new Decimal(laborCenterCost)); + this.quotationRouting.unitLaborCost = new Decimal(total.toFixed(4,Decimal.ROUND_HALF_UP)).toSignificantDigits().toNumber(); + }, // 计算工艺单位成本 changeRoutingCost(){ this.quotationRouting.unitQuotedCost = new Decimal(0); - if (this.quotationRouting.unitMachineryCost){ + 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.unitLaborCost){ + 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.unitManufacturingCost){ + if (this.quotationRouting.manufacturingCenterCost && this.quotationRouting.manufacturingCenterCost > 0){ + this.computeManufacturingCenterCost();//制造费用 this.quotationRouting.unitQuotedCost = this.quotationRouting.unitQuotedCost.add(new Decimal(this.quotationRouting.unitManufacturingCost)); } + this.quotationRouting.unitQuotedCost = new Decimal(this.quotationRouting.unitQuotedCost).toSignificantDigits().toNumber(); }, // ==================================================校验工具类==================================================== // 校验处理 @@ -3557,7 +3754,7 @@ export default { // 输入规则 inputRule(value,type){ if (value === undefined || value === null || value === ''){ - this.setInputValue(value,type); + this.setInputValue(0,type); return } if (!isNaN(value)){ @@ -3577,9 +3774,25 @@ export default { switch (type){ case 1: this.quotationPart.attritionRate = value; + this.computePartQuotationUnitCost(this.quotationPart) break case 2: this.quotationRouting.routingEfficiency = value; + this.changeRoutingCost(); + break + } + }, + inputNumberWithReg(value,type){ + if (value === undefined || value === null || value === ''){ + value = 1; + return + } + if (value <= 0){ + value = 1; + } + switch (type){ + case 0: + this.insertQuotationDetail.quotationDetailQuantity = value; break } },