Browse Source

2023-12-19 plm报价价格计算

master
zelian_wu 2 years ago
parent
commit
4b7b1e353e
  1. 2
      src/views/modules/quotation/sellForQuotation.vue
  2. 391
      src/views/modules/quotation/sellForQuotation/quotationDetail.vue

2
src/views/modules/quotation/sellForQuotation.vue

@ -89,7 +89,7 @@
</el-col>
</el-row>
</el-col>
<el-col :span="2">
<el-col :span="4">
<el-form-item label=" ">
<el-button plain type="primary" @click="initDataBtn" @keyup.enter.native="initDataBtn"> </el-button>
<el-button type="primary" @click="insertDiaLogFlag = true"> </el-button>

391
src/views/modules/quotation/sellForQuotation/quotationDetail.vue

@ -183,7 +183,7 @@
<el-col :span="8">
<el-form-item label="报价数量" prop="quotationDetailQuantity">
<div class="right">
<el-input v-model="insertQuotationDetail.quotationDetailQuantity" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input v-model="insertQuotationDetail.quotationDetailQuantity" type="number" @input="value=>inputNumberWithReg(value,0)" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
@ -282,6 +282,7 @@
<el-table-column label="损耗率%" header-align="center" align="right" show-overflow-tooltip prop="attritionRate"/>
<el-table-column label="调机用量" header-align="center" align="right" show-overflow-tooltip prop="transferAmount"/>
<el-table-column label="单位成本" header-align="center" align="right" show-overflow-tooltip prop="unitCost"/>
<el-table-column label="单位报价成本" header-align="center" align="right" show-overflow-tooltip prop="quotationUnitCost"/>
<el-table-column label="备注" header-align="center" align="left" show-overflow-tooltip prop="remark"/>
</el-table>
</el-form>
@ -353,6 +354,7 @@
<el-table-column label="工具数量" header-align="center" align="right" prop="toolQuantity" show-overflow-tooltip/>
<el-table-column label="单位成本" header-align="center" align="right" prop="unitCost" show-overflow-tooltip/>
<el-table-column label="预计使用寿命" header-align="center" align="right" prop="expectedServiceLife" show-overflow-tooltip/>
<el-table-column label="单位报价成本" header-align="center" align="right" prop="quotationUnitCost" show-overflow-tooltip/>
<el-table-column label="备注" header-align="center" align="left" prop="remark" show-overflow-tooltip/>
</el-table>
</el-form>
@ -543,7 +545,7 @@
label-width="120px">
<el-row>
<el-col :span="4">
<el-form-item label="未税总:" prop="systemComputeAmount">
<el-form-item label="未税总:" prop="systemComputeAmount">
<div class="right">
<el-input v-model="quotationDetailData.systemComputeAmount" type="number" disabled/>
</div>
@ -564,7 +566,7 @@
</el-form-item>
</el-col>
<el-col :span="4" :offset="1">
<el-form-item label="含税总:" prop="systemComputePrice">
<el-form-item label="含税总:" prop="systemComputePrice">
<div class="right">
<el-input v-model="quotationDetailData.systemComputePrice" type="number" disabled/>
</div>
@ -589,7 +591,7 @@
</el-dialog>
<!--quotationTool新增-->
<el-dialog title="报价工具" @close="closeQuotationToolDialog" :visible.sync="saveQuotationToolFlag" width="40%"
<el-dialog title="报价工具" @close="closeQuotationToolDialog" @open="openQuotationToolDialog" :visible.sync="saveQuotationToolFlag" width="40%"
top="15vh" :close-on-click-modal="false">
<el-form :rules="quotationToolRules" ref="quotationToolForm" :model="quotationTool" label-position="top"
style="height: 260px">
@ -610,23 +612,30 @@
<el-col :span="8">
<el-form-item label="工具数量" prop="toolQuantity">
<div class="right">
<el-input v-model="quotationTool.toolQuantity" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.toolQuantity" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="单位成本" prop="unitCost">
<el-form-item label="预计使用寿命" prop="expectedServiceLife">
<div class="right">
<el-input v-model="quotationTool.unitCost" :disabled="quotationTool.toolNo !== '*'" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.expectedServiceLife" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<el-form-item label="预计使用寿命" prop="expectedServiceLife">
<el-form-item label="单位成本" prop="unitCost">
<div class="right">
<el-input @input="computeToolQuotationUnitCost(quotationTool)" v-model="quotationTool.unitCost" :disabled="quotationTool.toolNo !== '*'" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="单位报价成本" prop="unitCost">
<div class="right">
<el-input v-model="quotationTool.expectedServiceLife" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input v-model="quotationTool.quotationUnitCost" disabled onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
@ -697,7 +706,7 @@
<el-row>
<el-col :span="8" >
<el-form-item label="加工中心编码" prop="machiningCenterNo">
<el-select v-model="quotationRouting.machiningCenterNo" filterable clearable style="width: 100%" @change="(val) => changeWorkCenterSelect(val, quotationRouting)" placeholder="请选择">
<el-select v-model="quotationRouting.machiningCenterNo" filterable style="width: 100%" @change="changeWorkCenterSelect" placeholder="请选择">
<el-option
key="*"
label="*"
@ -727,23 +736,44 @@
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="调机时间" prop="machiningSetupTime">
<el-form-item label="加工中心机器成本" prop="machineryCenterCost">
<div class="right">
<el-input v-model="quotationRouting.machiningSetupTime" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.machineryCenterCost" @input="changeRoutingCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8" >
<el-form-item label="单位产出量" prop="unitOutputQuantity">
<el-form-item label="加工中心人工成本" prop="laborCenterCost">
<div class="right">
<el-input :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.laborCenterCost" @input="changeRoutingCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="加工制造费用" prop="manufacturingCenterCost">
<div class="right">
<el-input :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.manufacturingCenterCost" @input="changeRoutingCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="调机时间" prop="machiningSetupTime">
<div class="right">
<el-input v-model="quotationRouting.unitOutputQuantity" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input v-model="quotationRouting.machiningSetupTime" @input="changeRoutingCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="单位产出量" prop="unitOutputQuantity">
<div class="right">
<el-input v-model="quotationRouting.unitOutputQuantity" @input="changeRoutingCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产出单位" prop="outputUnit">
<el-select v-model="quotationRouting.outputUnit"
style="width: 100%" clearable placeholder="请选择">
style="width: 100%" placeholder="请选择" @change="changeRoutingCost">
<el-option
v-for="item in outputUnitList"
:key="item.label"
@ -753,45 +783,45 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="8" >
<el-col :span="12" :offset="2" >
<el-form-item label="效率%" prop="routingEfficiency">
<div class="right">
<el-input v-model="quotationRouting.routingEfficiency" min="0" max="100" @input="value=>inputRule(value,2)" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-col :span="8">
<el-form-item label="操作工人数" prop="operatorsNumber">
<div class="right">
<el-input v-model="quotationRouting.operatorsNumber" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input v-model="quotationRouting.operatorsNumber" @input="changeRoutingCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8" >
<el-col :span="12" :offset="2" >
<el-form-item label="单位机器成本" prop="unitMachineryCost">
<div class="right">
<el-input @input="changeRoutingCost" :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.unitMachineryCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input disabled v-model="quotationRouting.unitMachineryCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-col :span="8">
<el-form-item label="单位人工成本" prop="unitLaborCost">
<div class="right">
<el-input @input="changeRoutingCost" :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.unitLaborCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input disabled v-model="quotationRouting.unitLaborCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8" >
<el-col :span="12" :offset="2" >
<el-form-item label="单位制造费用" prop="unitManufacturingCost">
<div class="right">
<el-input @input="changeRoutingCost" :disabled="quotationRouting.machiningCenterNo !== '*'" v-model="quotationRouting.unitManufacturingCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
<el-input disabled v-model="quotationRouting.unitManufacturingCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))" type="number"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-col :span="8">
<el-form-item label="单位报价成本" prop="unitQuotedCost">
<div class="right">
<el-input disabled v-model="quotationRouting.unitQuotedCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input disabled type="number" v-model="quotationRouting.unitQuotedCost" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
@ -814,6 +844,7 @@
title="报价材料"
:visible.sync="quotationPartDialogFlag"
@close="closeQuotationPartDialog"
@open="openQuotationPartDialog"
:close-on-click-modal="false"
width="40%">
<el-form :model="quotationPart" :rules="quotationPartRules" ref="quotationPartForm" label-position="top">
@ -848,7 +879,7 @@
<el-col :span="12" :offset="2">
<el-form-item label="单位用量" prop="unitDosage">
<div class="right">
<el-input v-model="quotationPart.unitDosage" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input @input="computePartQuotationUnitCost(quotationPart)" v-model="quotationPart.unitDosage" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
@ -862,14 +893,21 @@
<el-col :span="12" :offset="2">
<el-form-item label="调机用量" prop="transferAmount">
<div class="right">
<el-input v-model="quotationPart.transferAmount" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input @input="computePartQuotationUnitCost(quotationPart)" v-model="quotationPart.transferAmount" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="单位成本" prop="unitCost">
<div class="right">
<el-input :disabled="quotationPart.quotationPartNo !== '*'" v-model="quotationPart.unitCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
<el-input @input="computePartQuotationUnitCost(quotationPart)" :disabled="quotationPart.quotationPartNo !== '*'" v-model="quotationPart.unitCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
<el-col :span="12" :offset="2">
<el-form-item label="单位报价成本">
<div class="right">
<el-input disabled v-model="quotationPart.quotationUnitCost" type="number" onKeypress="return (/[\d\.]/.test(String.fromCharCode(event.keyCode)))"/>
</div>
</el-form-item>
</el-col>
@ -1032,6 +1070,7 @@
<el-table-column label="损耗率%" show-overflow-tooltip prop="attritionRate"/>
<el-table-column label="调机用量" show-overflow-tooltip prop="transferAmount"/>
<el-table-column label="单位成本" show-overflow-tooltip prop="unitCost"/>
<el-table-column label="单位报价成本" show-overflow-tooltip prop="quotationUnitCost"/>
</el-table>
<el-table v-if="options===2" key="otherQuotationRoutingTable" :data="otherQuotationRoutingList" ref="otherQuotationRoutingTable" :style="{marginTop:'10px'}"
@ -1073,6 +1112,7 @@
<el-table-column label="工具描述" prop="toolDescription" show-overflow-tooltip/>
<el-table-column label="工具数量" prop="toolQuantity" show-overflow-tooltip/>
<el-table-column label="工具成本" prop="unitCost" show-overflow-tooltip/>
<el-table-column label="单位报价成本" prop="quotationUnitCost" show-overflow-tooltip/>
<el-table-column label="预计使用寿命" prop="expectedServiceLife" show-overflow-tooltip/>
</el-table>
<span slot="footer" class="dialog-footer" style="margin-top: 5px">
@ -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();//
}
},
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
}
},

Loading…
Cancel
Save