计算红本价格

This commit is contained in:
JIAL 2024-03-06 15:50:49 +08:00
parent f5e76bb60e
commit b38c2bf2b5
5 changed files with 186 additions and 64 deletions

View File

@ -5,13 +5,12 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.DataSourceType; import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.quote.domain.MaterialDto; import com.ruoyi.quote.domain.MaterialDto;
import com.ruoyi.quote.service.QuoteService; import com.ruoyi.quote.service.QuoteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -44,4 +43,15 @@ public class QuoteController extends BaseController {
System.out.println("打通接口"); System.out.println("打通接口");
return getDataTable(materialDtos); return getDataTable(materialDtos);
} }
@PostMapping("/redBPrice")
public void queryRedBookPriceByParam(@RequestBody List<CalculateRBParamDto> params) {
System.out.println(params.get(0).getModel());
System.out.println(params.get(0).getSpecification());
System.out.println(params.get(0).getVoltLevel());
}
} }

View File

@ -0,0 +1,40 @@
package com.ruoyi.quote.domain;
/**
* @title CalculateRBParamDto
* @description 用于接受前端传过来的型号规格参数
* @author JIAL
* @updateTime 2024/3/6 15:18
*/
public class CalculateRBParamDto {
private String model;
private String specification;
private String voltLevel;
public String getVoltLevel() {
return voltLevel;
}
public void setVoltLevel(String voltLevel) {
this.voltLevel = voltLevel;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getSpecification() {
return specification;
}
public void setSpecification(String specification) {
this.specification = specification;
}
// 省略构造函数getter和setter
}

View File

@ -19,18 +19,60 @@ public class MaterialDto extends BaseEntity {
private String measureUnit; //单位 private String measureUnit; //单位
private String matCostPrice; //材料成本价格 private double matCostPrice = 0; //材料成本价格
private String redBookPrice; //红本价格 private double redBookPrice = 0; //红本价格
private String redBookCost; //红本成本 private double redBookCost = 0; //红本成本
private String rbFacPrice; //红本厂价 public double getMatCostPrice() {
return matCostPrice;
}
public void setMatCostPrice(double matCostPrice) {
this.matCostPrice = matCostPrice;
}
public double getRedBookPrice() {
return redBookPrice;
}
public void setRedBookPrice(double redBookPrice) {
this.redBookPrice = redBookPrice;
}
public double getRedBookCost() {
return redBookCost;
}
public void setRedBookCost(double redBookCost) {
this.redBookCost = redBookCost;
}
public double getRbFacPrice() {
return rbFacPrice;
}
public void setRbFacPrice(double rbFacPrice) {
this.rbFacPrice = rbFacPrice;
}
private double rbFacPrice = 0; //红本厂价
private String manuCost; //制造成本 private String manuCost; //制造成本
private String wdFSurcharge; //盘具点数 private String wdFSurcharge; //盘具点数
private Integer number = 1;
public Integer getNumber() {
return number;
}
public void setNumber(Integer number) {
this.number = number;
}
public String getUid() { public String getUid() {
return uid; return uid;
} }
@ -87,37 +129,7 @@ public class MaterialDto extends BaseEntity {
this.measureUnit = measureUnit; this.measureUnit = measureUnit;
} }
public String getMatCostPrice() {
return matCostPrice;
}
public void setMatCostPrice(String matCostPrice) {
this.matCostPrice = matCostPrice;
}
public String getRedBookPrice() {
return redBookPrice;
}
public void setRedBookPrice(String redBookPrice) {
this.redBookPrice = redBookPrice;
}
public String getRedBookCost() {
return redBookCost;
}
public void setRedBookCost(String redBookCost) {
this.redBookCost = redBookCost;
}
public String getRbFacPrice() {
return rbFacPrice;
}
public void setRbFacPrice(String rbFacPrice) {
this.rbFacPrice = rbFacPrice;
}
public String getManuCost() { public String getManuCost() {
return manuCost; return manuCost;

View File

@ -7,3 +7,11 @@ export function queryMaterialListByParam(query) {
params: query params: query
}) })
} }
export function queryRedBookPriceByParam (query) {
return request({
url: '/quote/redBPrice',
method: 'post',
data: query
})
}

View File

@ -274,6 +274,7 @@
<!-- 添加物料和计算数据的按钮div --> <!-- 添加物料和计算数据的按钮div -->
<div class="button-box"> <div class="button-box">
<el-button type="text" @click="addMaterial">添加物料</el-button> <el-button type="text" @click="addMaterial">添加物料</el-button>
<el-button type="text" @click="calculateRedBookPrice">计算红本价格</el-button>
<el-button type="text" >计算数据</el-button> <el-button type="text" >计算数据</el-button>
</div> </div>
<!-- 物料表格控件 --> <!-- 物料表格控件 -->
@ -350,8 +351,8 @@
width="180" width="180"
prop="number" prop="number"
label="数量"> label="数量">
<template slot-scope="scope"> <template v-slot="scope">
<el-input v-model="scope.row.number" @blur="validateNumber(scope.row)"> <el-input v-model="scope.row.number">
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
@ -426,18 +427,18 @@
<div slot="title" style="margin: 0px"> <div slot="title" style="margin: 0px">
<el-form> <el-form>
<el-form-item > <el-form-item >
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.precMaterialName" placeholder="开头物料名称精确查询"> <el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.precMaterialName" placeholder="开头物料名称精确查询">
</el-input> </el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.vagueMaterialName" placeholder="物料名称模糊查询"> <el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueMaterialName" placeholder="物料名称模糊查询">
</el-input> </el-input>
<el-input style="width: 180px; margin-right: 20px" v-model="queryParams.vagueModel" placeholder="规格模糊查询"> <el-input style="width: 180px; margin-right: 20px" v-model="materialQueryParams.vagueModel" placeholder="规格模糊查询">
</el-input> </el-input>
<el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button> <el-button type="primary" size="small" @click="searchMaterial">查询物料</el-button>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div style="display: flex; flex-direction: row;"> <div style="display: flex; flex-direction: row;">
<div style="width: 758px"> <div style="width: 700px">
<el-table <el-table
:data="materialDialogData" :data="materialDialogData"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
@ -455,7 +456,7 @@
<el-table-column <el-table-column
label="序号" label="序号"
type="index" type="index"
width="50"> width="55">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="120" width="120"
@ -468,7 +469,7 @@
label="型号"> label="型号">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="120" width="125"
prop="specification" prop="specification"
label="规格"> label="规格">
</el-table-column> </el-table-column>
@ -478,7 +479,7 @@
label="电压"> label="电压">
</el-table-column> </el-table-column>
<el-table-column <el-table-column
width="100" width="102"
prop="measureUnit" prop="measureUnit"
label="单位"> label="单位">
</el-table-column> </el-table-column>
@ -486,8 +487,8 @@
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="materialQueryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="materialQueryParams.pageSize"
@pagination="searchMaterial" @pagination="searchMaterial"
/> />
</div> </div>
@ -505,8 +506,8 @@
<div style="text-align: center; padding-top: 20px"> <div style="text-align: center; padding-top: 20px">
<el-button-group> <el-button-group>
<el-button type="primary" size="small" style="margin-right: 80px" >确认</el-button> <el-button type="primary" size="small" style="margin-right: 80px" @click="addMaterialToTable">确认</el-button>
<el-button type="warning" size="small" >取消</el-button> <el-button type="warning" size="small" @click="closeMaterialDialog">取消</el-button>
</el-button-group> </el-button-group>
</div> </div>
</el-dialog> </el-dialog>
@ -514,7 +515,7 @@
</template> </template>
<script> <script>
import {queryMaterialListByParam } from "@/api/quote/quote"; import {queryMaterialListByParam, queryRedBookPriceByParam } from "@/api/quote/quote";
const commonRule = [ const commonRule = [
{ required: true, message: '不能为空值可填0', trigger: 'blur' }, { required: true, message: '不能为空值可填0', trigger: 'blur' },
{ pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' } { pattern: /^(([1-9]{1}\d{0,9})|(0{1}))(\.\d{1,3})?$/, message: '格式有误,只能为数字格式', trigger: 'blur' }
@ -589,7 +590,7 @@ export default {
], ],
dialogMaterialVisible: false, dialogMaterialVisible: false,
queryParams: { materialQueryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
precMaterialName: '', precMaterialName: '',
@ -660,7 +661,7 @@ export default {
}, },
/**--------查询物料---------**/ /**--------查询物料---------**/
searchMaterial() { searchMaterial() {
queryMaterialListByParam(this.queryParams).then(response => { queryMaterialListByParam(this.materialQueryParams).then(response => {
this.materialDialogData = response.rows; this.materialDialogData = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -670,6 +671,7 @@ export default {
selection.forEach(item => { selection.forEach(item => {
// //
if (!this.selectedMaterialItems.some(selectedItem => selectedItem.uid === item.uid)) { if (!this.selectedMaterialItems.some(selectedItem => selectedItem.uid === item.uid)) {
console.log(item)
this.selectedMaterialItems.push(item); this.selectedMaterialItems.push(item);
} }
}); });
@ -677,7 +679,7 @@ export default {
}, },
removeSelectedItem(selectedItem) { removeSelectedItem(selectedItem) {
// //
const isSelected = this.$refs.materialTable.selection.includes(selectedItem); const isSelected = this.$refs.materialDialogData.selection.includes(selectedItem);
// //
const index = this.selectedMaterialItems.findIndex(item => item.uid === selectedItem.uid); const index = this.selectedMaterialItems.findIndex(item => item.uid === selectedItem.uid);
@ -687,25 +689,36 @@ export default {
// el-table // el-table
if (isSelected) { if (isSelected) {
this.$refs.materialTable.toggleRowSelection(selectedItem, false); this.$refs.materialDialogData.toggleRowSelection(selectedItem, false);
} }
}, },
/**-------------dialog确认按钮将物料添加进表格-----------------**/
addMaterialToTable() { addMaterialToTable() {
// //
this.materialData = this.materialData.concat(this.selectedMaterialItems); this.materialData = this.materialData.concat(this.selectedMaterialItems);
console.log(this.materialData) console.log(this.materialData)
// //
this.selectedMaterialItems = []; this.selectedMaterialItems = [];
this.$refs.materialTable.clearSelection(); this.$refs.materialDialogData.clearSelection();
this.dialogMaterialVisible = false; this.dialogMaterialVisible = false;
}, },
closeMaterialDialog() { closeMaterialDialog() {
this.dialogMaterialVisible = false; this.dialogMaterialVisible = false;
}, },
/**----------------计算红本价格--------------------**/
calculateRedBookPrice() {
const param = this.materialData.map(item => ({
model: item.model,
specification: item.specification,
voltLevel: item.voltLevel
}));
queryRedBookPriceByParam(param).then(response => {
});
}
}, },
} }
</script> </script>
@ -749,13 +762,52 @@ export default {
} }
.changed-field { .changed-field {
background-color: #ffe6e6; /* 更改后的背景颜色 */ background-color: #add8e6; /* 更改后的背景颜色 */
} }
.materialDialogTable .el-dialog__header{ ::v-deep .materialDialogTable .el-dialog__header {
padding: 20px 20px 0px !important; padding-bottom: 0px;
} }
.materialDialogTable .el-dialog__body{
padding: 0px 20px !important; ::v-deep .materialDialogTable .el-dialog__body {
padding-top: 0px;
}
.selected-item {
background-color: #f0f0f0;
border: 1px solid #ccc;
border-radius: 5px;
padding: 5px;
margin-bottom: 5px;
display: flex;
justify-content: space-between;
}
.remove-btn {
padding: 0px;
color: red;
}
.table-box {
width: 98%;
margin: auto;
}
::v-deep .el-input__inner {
height: 30px;
/*font-family: Roboto, serif;*/
font-size: 12px;
line-height: 14px;
}
::v-deep .el-input-group {
margin-top: 3px;
}
::v-deep .total-box input {
background: #f0f0f0 !important;
font-weight: bold !important;
color: black !important;
} }
</style> </style>