This commit is contained in:
xd 2024-05-12 11:24:28 +08:00
parent dbac2c0cf7
commit 2b370ca07e
10 changed files with 371 additions and 30 deletions

View File

@ -1,11 +1,17 @@
package com.ruoyi.web.controller.redBook;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.service.IRedBookService;
import com.ruoyi.web.utils.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -20,7 +26,6 @@ import java.util.List;
*/
@RestController
@RequestMapping("/redBook/redBook")
@DataSource(DataSourceType.OAREDBOOK)
public class RedBookController extends BaseController
{
@Autowired
@ -31,6 +36,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productList")
public List<Product> productList(Product product)
{
@ -43,6 +49,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productRemarkList")
public List<Product> productRemarkList(Product product)
{
@ -55,6 +62,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productXinghList")
public List<Product> productXinghList(Product product)
{
@ -67,6 +75,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/judgeparent")
public Boolean judgeparent(Product product)
{
@ -83,6 +92,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productZlList")
public List<Product> productZlList(Product product)
{
@ -95,6 +105,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productYsxhListCheck")
public Boolean productYsxhListCheck(Product product)
{
@ -111,6 +122,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productYsxhList")
public List<Product> productYsxhList(Product product)
{
@ -123,6 +135,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productJmListCheck")
public Boolean productJmListCheck(Product product)
{
@ -138,6 +151,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/productJmList")
public List<Product> productJmList(Product product)
{
@ -150,6 +164,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/searchData")
public List<Product> searchData(Product product)
{
@ -161,6 +176,7 @@ public class RedBookController extends BaseController
* @param product
* @return
*/
@DataSource(DataSourceType.OAREDBOOK)
@GetMapping("/handleSearchData")
public List<Product> handleSearchData(Product product)
{
@ -175,4 +191,16 @@ public class RedBookController extends BaseController
}
return list;
}
@DataSource(DataSourceType.MASTER)
@Log(title = "报价单生成", businessType = BusinessType.OTHER)
@PostMapping("/madeQuot")
public AjaxResult madeQuot(@RequestBody OAQuot quot)
{
quot.setQuot_id(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername());
redBookService.insertOAQuot(quot);
return success();
}
}

View File

@ -0,0 +1,64 @@
package com.ruoyi.redBook.domain;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
public class OAQuot extends BaseEntity {
private String quot_id;
private String quotCode;//报价单号
private String quotCustomer;//报价客户
private String quotProject;//报价项目
private String quotLxr;//联系人
private String quotLxrdh;//联系人电话
private List<OAQuotProduct> selectedResultData;
public String getQuot_id() { return quot_id; }
public void setQuot_id(String quot_id) { this.quot_id = quot_id; }
public String getQuotCode() { return quotCode; }
public void setQuotCode(String quotCode) { this.quotCode = quotCode; }
public String getQuotCustomer() {
return quotCustomer;
}
public void setQuotCustomer(String quotCustomer) {
this.quotCustomer = quotCustomer;
}
public String getQuotProject() {
return quotProject;
}
public void setQuotProject(String quotProject) {
this.quotProject = quotProject;
}
public String getQuotLxr() {
return quotLxr;
}
public void setQuotLxr(String quotLxr) {
this.quotLxr = quotLxr;
}
public String getQuotLxrdh() {
return quotLxrdh;
}
public void setQuotLxrdh(String quotLxrdh) {
this.quotLxrdh = quotLxrdh;
}
public List<OAQuotProduct> getSelectedResultData() {
return selectedResultData;
}
public void setSelectedResultData(List<OAQuotProduct> selectedResultData) {
this.selectedResultData = selectedResultData;
}
}

View File

@ -0,0 +1,87 @@
package com.ruoyi.redBook.domain;
import java.math.BigDecimal;
public class OAQuotProduct {
private String name_0;//型号
private String spec;//规格
private String voltage;//电压
private String stu;//单位
private BigDecimal setPrice;//单价
private BigDecimal count;//数量
private BigDecimal allPrice;//金额
private String quot_product_id;//id
private String quot_id;//报价单id
public String getName_0() {
return name_0;
}
public void setName_0(String name_0) {
this.name_0 = name_0;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public String getVoltage() {
return voltage;
}
public void setVoltage(String voltage) {
this.voltage = voltage;
}
public String getStu() {
return stu;
}
public void setStu(String stu) {
this.stu = stu;
}
public BigDecimal getSetPrice() {
return setPrice;
}
public void setSetPrice(BigDecimal setPrice) {
this.setPrice = setPrice;
}
public BigDecimal getCount() {
return count;
}
public void setCount(BigDecimal count) {
this.count = count;
}
public BigDecimal getAllPrice() {
return allPrice;
}
public void setAllPrice(BigDecimal allPrice) {
this.allPrice = allPrice;
}
public String getQuot_product_id() {
return quot_product_id;
}
public void setQuot_product_id(String quot_product_id) {
this.quot_product_id = quot_product_id;
}
public String getQuot_id() {
return quot_id;
}
public void setQuot_id(String quot_id) {
this.quot_id = quot_id;
}
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.redBook.mapper;
import com.ruoyi.material.domain.CMaterial;
import com.ruoyi.material.domain.CMaterialCost;
import com.ruoyi.material.domain.temp;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product;
import org.apache.ibatis.annotations.Param;
@ -72,4 +74,16 @@ public interface OARedBookMapper
* @return
*/
List<Product> handleSearchData(@Param("name_0")String name_0,@Param("model")String model);
/**
* 保存报价单
* @param quot
*/
void insertOAQuot(OAQuot quot);
/**
* 新增报价单产品信息
* @param list
*/
void batchOAQuotProduct(List<OAQuotProduct> list);
}

View File

@ -1,5 +1,8 @@
package com.ruoyi.redBook.service;
import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.Product;
import java.util.List;
@ -68,4 +71,10 @@ public interface IRedBookService
* @return
*/
List<Product> handleSearchData(String name_0,String model);
/**
* 保存报价单
* @param quot
*/
void insertOAQuot(OAQuot quot);
}

View File

@ -1,11 +1,20 @@
package com.ruoyi.redBook.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.domain.Bank;
import com.ruoyi.customer.domain.Customer;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.mapper.OARedBookMapper;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@ -100,4 +109,41 @@ public class RedBookServiceImpl implements IRedBookService
public List<Product> handleSearchData(String name_0,String model) {
return oaRedBookMapper.handleSearchData(name_0,model);
}
/**
* 保存报价单
* @param quot
*/
@Transactional
@Override
public void insertOAQuot(OAQuot quot) {
quot.setCreateTime(DateUtils.getNowDate());
quot.setUpdateTime(DateUtils.getNowDate());
oaRedBookMapper.insertOAQuot(quot);
insertOAQuotProduct(quot);
}
/**
* 新增报价单产品信息
* @param quot
*/
public void insertOAQuotProduct(OAQuot quot)
{
List<OAQuotProduct> productList = quot.getSelectedResultData();
String quot_id = quot.getQuot_id();
if (StringUtils.isNotNull(productList))
{
List<OAQuotProduct> list = new ArrayList<OAQuotProduct>();
for (OAQuotProduct product : productList)
{
product.setQuot_product_id(UUID.fastUUID().toString());
product.setQuot_id(quot_id);
list.add(product);
}
if (list.size() > 0)
{
oaRedBookMapper.batchOAQuotProduct(list);
}
}
}
}

View File

@ -103,9 +103,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
insert into customer
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="cusId != null">cus_id,</if>
<if test="cusCode != null">cus_code,</if>
<if test="cusCode != null and cusCode != ''">cus_code,</if>
<if test="cusName != null and cusName != ''">cus_name,</if>
<if test="cusSapCode != null">cus_sap_code,</if>
<if test="cusSapCode != null and cusSapCode != ''">cus_sap_code,</if>
<if test="cusStreet != null and cusStreet != ''">cus_street,</if>
<if test="cusQccStreet != null and cusQccStreet != ''">cus_qcc_street,</if>
<if test="cusPaymentTerms != null and cusPaymentTerms != ''">cus_payment_terms,</if>
@ -137,9 +137,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="cusId != null">#{cusId},</if>
<if test="cusCode != null">#{cusCode},</if>
<if test="cusCode != null and cusCode != ''">#{cusCode},</if>
<if test="cusName != null and cusName != ''">#{cusName},</if>
<if test="cusSapCode != null">#{cusSapCode},</if>
<if test="cusSapCode != null and cusSapCode != ''">#{cusSapCode},</if>
<if test="cusStreet != null and cusStreet != ''">#{cusStreet},</if>
<if test="cusQccStreet != null and cusQccStreet != ''">#{cusQccStreet},</if>
<if test="cusPaymentTerms != null and cusPaymentTerms != ''">#{cusPaymentTerms},</if>

View File

@ -78,4 +78,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and A.规格 = #{model}
</if>
</select>
<insert id="insertOAQuot" parameterType="OAQuot">
insert into OAQuot
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="quot_id != null">quot_id,</if>
<if test="quotCode != null and quotCode != ''">quotCode,</if>
<if test="quotCustomer != null and quotCustomer != ''">quotCustomer,</if>
<if test="quotProject != null and quotProject != ''">quotProject,</if>
<if test="quotLxr != null and quotLxr != ''">quotLxr,</if>
<if test="quotLxrdh != null and quotLxrdh != ''">quotLxrdh,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="quot_id != null">#{quot_id},</if>
<if test="quotCode != null and quotCode != ''">#{quotCode},</if>
<if test="quotCustomer != null and quotCustomer != ''">#{quotCustomer},</if>
<if test="quotProject != null and quotProject != ''">#{quotProject},</if>
<if test="quotLxr != null and quotLxr != ''">#{quotLxr},</if>
<if test="quotLxrdh != null and quotLxrdh != ''">#{quotLxrdh},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
getdate()
</trim>
</insert>
<insert id="batchOAQuotProduct">
insert into OAQuotProduct(quot_product_id, name_0, spec, voltage,stu,setPrice,count,allPrice,quot_id) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
</foreach>
</insert>
</mapper>

View File

@ -100,5 +100,14 @@ export function handleSearchData(query) {
})
}
//生成报价单
export function madeQuot(data) {
return request({
url: '/redBook/redBook/madeQuot',
method: 'post',
data: data
})
}

View File

@ -1,13 +1,16 @@
<template>
<div class="app-container">
<el-form label-width="100px" :model="form">
<el-form label-width="80px" :model="form">
<el-row :gutter="5">
<el-col :span="10">
<el-input style="width:30%" size="mini" v-model="queryParams.name_0" placeholder="型号 模糊查询"></el-input>
<el-input style="width:30%;margin-left: 5px;" size="mini" v-model="queryParams.model" placeholder="规格 模糊查询"></el-input>
<el-button style="float: right;" size="mini" type="primary" icon="el-icon-search" @click="handleSearchClick">搜索</el-button>
</el-col>
<el-col :span="14"></el-col>
<el-col :span="14">
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick">生成报价单</el-button>
<el-button style="float: right;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick">保存</el-button>
</el-col>
</el-row>
<el-row :gutter="5"class="mt5">
<el-col :span="10">
@ -49,6 +52,7 @@
<el-table width="100%" v-loading="searchResultLoading" ref="searchResultTable" :data="searchResultPagedData" @row-dblclick="handleRowDblclick">
<el-table-column label="uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="120"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="单位" align="center" prop="stu"/>
@ -63,7 +67,7 @@
/>
</el-card>
</el-col>
<el-col :span="14" rowspan="2">
<el-col :span="14">
<el-card id="scroll" class="box-card scrollable" :style="{'overflow': 'auto','max-height': scrollableHeight,'height': scrollableHeight}">
<el-row :gutter="8">
<el-col :span="12">
@ -79,7 +83,7 @@
</el-row>
<el-row :gutter="8">
<el-col :span="12">
<el-form-item label="业务联系人" prop="cusCode">
<el-form-item label="联系人" prop="cusCode">
<el-input v-model="form.quotLxr" placeholder="请输入业务联系人" />
</el-form-item>
</el-col>
@ -93,14 +97,17 @@
<span>批量调折扣率:
<el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red">{{sumSelectedResultData}}</span>
</span>
<el-table width="100%;" :style="{'margin-top':'5px','height': tableHeight}" ref="selectedResultTable" :data="selectedResultPagedData">
<el-table width="100%;" :height="tableHeight" :row-class-name="selectedResultIndex" style="margin-top:5px" ref="selectedResultTable" :data="selectedResultData">
<el-table-column fixed="left" label="" align="center" prop="index" width="50"/>
<el-table-column fixed="left" label="操作" align="center" width="60" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button type="text" @click="handleDeleteClick(scope.$index)">删除</el-button>
</template>
</el-table-column>
<el-table-column label="型号" align="center" prop="name_0"/>
<el-table-column fixed="left" label="型号" align="center" prop="name_0" width="180"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="100"/>
<el-table-column label="红本价(元)" align="center" prop="price" width="100"/>
<el-table-column label="单位" align="center" prop="stu" width="60"/>
@ -120,17 +127,17 @@
<el-input v-model="scope.row.count" @blur="changeRowData"/>
</template>
</el-table-column>
<el-table-column label="总价" align="center" prop="allPrice" width="80"/>
<el-table-column label="总价" align="center" prop="allPrice"/>
</el-table>
<pagination
<!--<pagination
v-show="selectedResultTotal>0"
:total="selectedResultTotal"
:page.sync="selectedResultCurrentPage"
:page-sizes="[5,10,15,20]"
:page-sizes="[10,20,30,40]"
:limit.sync="selectedResultPageSize"
@size-change="handleSelectedResultSizeChange"
@current-change="handleSelectedResultCurrentChange"
/>
/>-->
</el-card>
</el-col>
</el-row>
@ -161,7 +168,7 @@
}
</style>
<script>
import {toDecimal, productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData} from "@/api/redBook/redBook";
import {toDecimal, productList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData, madeQuot} from "@/api/redBook/redBook";
export default {
name: "productSelect",
@ -225,7 +232,7 @@
//
selectedResultTotal: 0,
selectedResultCurrentPage: 1,
selectedResultPageSize: 5,
selectedResultPageSize: 10,
selectedResultData: [],
//
@ -243,7 +250,7 @@
/*设置内容高度*/
this.scrollableHeight = (window.innerHeight - 160) + 'px';
/*设置已选择结果表格高度*/
this.tableHeight = (window.innerHeight - 400) + 'px';
this.tableHeight = (window.innerHeight - 350) + 'px';
},
methods: {
@ -459,6 +466,7 @@
//
handleRowDblclick(row, event, column) {
const name_0 = row.name_0;
const spec = row.spec;
const voltage = row.voltage;
const price = row.price;
const stu = row.stu;
@ -470,6 +478,7 @@
const rowDate = {
name_0: name_0,
spec: spec,
voltage: voltage,
price: price,
stu: stu,
@ -481,9 +490,19 @@
}
this.selectedResultData.push(rowDate)
this.selectedResultTotal = this.selectedResultData.length;
//
/*this.selectedResultTotal = this.selectedResultData.length;
const page = Math.ceil(this.selectedResultTotal / this.selectedResultPageSize);
this.handleSelectedResultCurrentChange(page)
this.handleSelectedResultCurrentChange(page)*/
this.$nextTick(() => {
this.$refs.selectedResultTable.bodyWrapper.scrollTop = this.$refs.selectedResultTable.bodyWrapper.scrollHeight;
})
},
/** 已选结果数据序号 */
selectedResultIndex({ row, rowIndex }) {
row.index = rowIndex + 1;
},
//
@ -503,14 +522,14 @@
},
/** 切换每页显示条数--已选择结果 */
handleSelectedResultSizeChange(val) {
/*handleSelectedResultSizeChange(val) {
this.selectedResultPageSize = val;
this.selectedResultCurrentPage = 1;
},
},*/
/** 页码选择--已选择结果 */
handleSelectedResultCurrentChange(val) {
/*handleSelectedResultCurrentChange(val) {
this.selectedResultCurrentPage = val;
},
},*/
//
handleSearchClick() {
@ -536,6 +555,21 @@
//
changeData() {
//
const pattern = /^\d+(\.\d+)?$/;
if(this.perc) {
if (!pattern.test(this.perc)) {
this.$message.warning("折扣率格式错误!");
return;
}
}
if(this.perc2) {
if (!pattern.test(this.perc2)) {
this.$message.warning("折扣率格式错误!");
return;
}
}
//
this.selectedResultData.forEach((row, index) => {
//
@ -543,8 +577,8 @@
...row,
percent: this.perc,
percent2: this.perc2,
setPrice: toDecimal(row.price * this.perc * (this.perc2?this.perc2:1)),
allPrice: toDecimal(row.count * row.price * this.perc * (this.perc2?this.perc2:1)),
setPrice: toDecimal(row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
allPrice: toDecimal(row.count * row.price * (this.perc?this.perc:1) * (this.perc2?this.perc2:1)),
});
})
},
@ -560,6 +594,19 @@
});
})
},
//
handleSaveClick() {
},
//
handleMadeQuotClick() {
this.form.selectedResultData = this.selectedResultData;
madeQuot(this.form).then(response => {
this.$modal.msgSuccess("生成报价单成功");
});
},
},
updated(){
//
@ -574,14 +621,19 @@
const endIndex = startIndex + this.searchResultPageSize;
return this.searchResultData.slice(startIndex, endIndex);
},
//
selectedResultPagedData() {
//
/*selectedResultPagedData() {
console.log(this.selectedResultData)
const startIndex = (this.selectedResultCurrentPage - 1) * this.selectedResultPageSize;
const endIndex = startIndex + this.selectedResultPageSize;
return this.selectedResultData.slice(startIndex, endIndex);
},
},*/
//
sumSelectedResultData() {
const allPrice = this.selectedResultData.reduce((sum, row) => sum + parseFloat(row.allPrice), 0);
return allPrice.toFixed(2);
},
},
}
</script>