This commit is contained in:
xd 2024-05-31 16:37:12 +08:00
parent c74854b4e2
commit 214c60a713
17 changed files with 329 additions and 27 deletions

View File

@ -1,5 +1,5 @@
#for tests only !
#Wed May 29 13:58:29 CST 2024
#Fri May 31 09:03:02 CST 2024
jco.destination.pool_capacity=10
jco.client.lang=ZH
jco.client.ashost=172.19.0.120
@ -7,5 +7,5 @@ jco.client.saprouter=
jco.client.user=RFC
jco.client.sysnr=00
jco.destination.peak_limit=10
jco.client.passwd=654321
jco.client.passwd=dK4Y;AwNNY+M!AP8*j!bqsNgHiN+no{qJ7swP{yqQ,;.~I8T
jco.client.client=300

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@ -144,8 +144,8 @@ public class QuotController extends BaseController
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<QuotMaterial> util = new ExcelUtil<QuotMaterial>(QuotMaterial.class);
List<QuotMaterial> userList = util.importExcel(file.getInputStream());
return success(userList);
List<QuotMaterial> materialList = util.importExcel(file.getInputStream());
return success(materialList);
}
/**

View File

@ -11,12 +11,11 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.domain.Customer;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.quot.domain.QuotMaterial;
import com.ruoyi.redBook.domain.*;
import com.ruoyi.redBook.service.IRedBookService;
import com.ruoyi.redBook.service.impl.AsyncRbTaskService;
import com.ruoyi.web.utils.IdUtils;
@ -25,6 +24,7 @@ import com.ruoyi.web.utils.rbExcel.excelUtil;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
@ -269,6 +269,75 @@ public class RedBookController extends BaseController
excelUtil.exportExcel(response,quot,list);
}
/**
* 导出产品明细模板
* @param response
*/
@PostMapping("/importTemplate")
public void importTemplate(HttpServletResponse response)
{
ExcelUtil<OAQuotProductTemplate> util = new ExcelUtil<OAQuotProductTemplate>(OAQuotProductTemplate.class);
util.importTemplateExcel(response, "产品数据");
}
/**
* 导入产品明细
* @param file
* @param updateSupport
* @return
* @throws Exception
*/
@PostMapping("/importData")
public AjaxResult importData(String rbUid, MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<OAQuotProductTemplate> util = new ExcelUtil<OAQuotProductTemplate>(OAQuotProductTemplate.class);
List<OAQuotProductTemplate> tempList = util.importExcel(file.getInputStream());
if(tempList.size()==0){
return error("导入文件无产品明细数据");
}else if(tempList.size()>200){
return error("最多导入200条");
}
int index = 1;
for(OAQuotProductTemplate temp:tempList){
temp.setIndex(index);
temp.setRbUid(rbUid);
index++;
}
System.out.println("开始时间:" + DateUtils.getTime());
List<List<OAQuotProductTemplate>> list = ListSplitUtil.averageList(tempList,10);
List<OAQuotProduct> OAQuotProducts = new ArrayList<>();
//定义一个存所有线程回调函数的list
List<Future<List<OAQuotProduct>>> futureList=new ArrayList<>();
int num = 1;
for(List<OAQuotProductTemplate> lt:list){
futureList.add(asyncRbTaskService.executeAsyncTask2("线程"+num+""+lt.size()+"条】",lt));
num++;
}
//判断进程是否全部结束**
while (true){
//回调信息空了就结束**
if (futureList.isEmpty()){
break;
}
for (int i = 0; i < futureList.size(); i++) {
if (futureList.get(i).isDone()){
OAQuotProducts.addAll(futureList.get(i).get());
//判断线程结束输出回调信息并将该回调清除
futureList.remove(i);
}else {
continue;
}
}
}
System.out.println("结束时间:" + DateUtils.getTime());
Collections.sort(OAQuotProducts);
return success(OAQuotProducts);
}
/**
* 获取调价日期
* @param oAQuot

View File

@ -21,6 +21,7 @@ public class quotModel {
@ApiModelProperty("整单料价价差率")
private String quotMatpriceDiff;//整单料价价差率
@ApiModelProperty("产品明细")
private List<quotMaterialModel> quotMaterial;//明细
public String getQuotJswCode() {

View File

@ -2,7 +2,7 @@ package com.ruoyi.redBook.domain;
import java.math.BigDecimal;
public class OAQuotProduct {
public class OAQuotProduct implements Comparable<OAQuotProduct>{
private Integer index;//序号
private String uid_0;//版本uid
private String name_0;//产品型号
@ -95,4 +95,9 @@ public class OAQuotProduct {
public BigDecimal getPer2() { return per2; }
public void setPer2(BigDecimal per2) { this.per2 = per2; }
@Override
public int compareTo(OAQuotProduct p) {
return this.getIndex() - p.getIndex();
}
}

View File

@ -0,0 +1,52 @@
package com.ruoyi.redBook.domain;
import com.ruoyi.common.annotation.Excel;
import java.math.BigDecimal;
public class OAQuotProductTemplate {
private Integer index;
private String rbUid;
@Excel(name = "型号")
private String name_1;//型号
@Excel(name = "规格")
private String spec;//规格
@Excel(name = "数量")
private BigDecimal count;//数量
public Integer getIndex() { return index; }
public void setIndex(Integer index) { this.index = index; }
public String getRbUid() { return rbUid; }
public void setRbUid(String rbUid) { this.rbUid = rbUid; }
public String getName_1() {
return name_1;
}
public void setName_1(String name_1) {
this.name_1 = name_1;
}
public String getSpec() {
return spec;
}
public void setSpec(String spec) {
this.spec = spec;
}
public BigDecimal getCount() {
return count;
}
public void setCount(BigDecimal count) {
this.count = count;
}
}

View File

@ -116,6 +116,15 @@ public interface OARedBookMapper
*/
String getFixDatePrice(@Param("name_0") String name_0,@Param("spec") String spec,@Param("voltage") String voltage, @Param("uid_0") String uid_0);
/**
* 导入明细批量获取红本价格
* @param name_0
* @param spec
* @param rbUid
* @return
*/
OAQuotProduct getFixDatePrice2(@Param("name_1") String name_1, @Param("spec") String spec, @Param("uid_0") String rbUid);
/**
* 查询已生成的报价单列表
* @param oaQuot

View File

@ -4,10 +4,7 @@ import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.customer.domain.Customer;
import com.ruoyi.quote.domain.CalculateRBParamDto;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.redBook.domain.*;
import java.util.List;
@ -136,5 +133,18 @@ public interface IRedBookService
*/
String rb_price_version();
/**
* 选择调价版本批量获取红本价格
* @param list
* @return
*/
List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list);
/**
* 导入明细批量获取红本价格
* @param list
* @return
*/
List<OAQuotProduct> setRedBookPrice2(List<OAQuotProductTemplate> list);
}

View File

@ -1,6 +1,8 @@
package com.ruoyi.redBook.service.impl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.OAQuotProductTemplate;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
@ -16,11 +18,31 @@ public class AsyncRbTaskService {
@Resource
private IRedBookService iRedBookService;
/**
* 选择调价版本批量获取红本价格
* @param threadname
* @param list
* @return
*/
@Async
public Future<List<OAQuotProduct>> executeAsyncTask(String threadname, List<OAQuotProduct> list) {
System.out.println(threadname);
List<OAQuotProduct> OAQuotProducts = iRedBookService.setRedBookPrice(list);
return new AsyncResult<>( OAQuotProducts);
}
/**
* 导入明细批量获取红本价格
* @param threadname
* @param list
* @return
*/
@Async
public Future<List<OAQuotProduct>> executeAsyncTask2(String threadname, List<OAQuotProductTemplate> list) {
System.out.println(threadname+"开始时间:" + DateUtils.getTime());
List<OAQuotProduct> OAQuotProducts = iRedBookService.setRedBookPrice2(list);
System.out.println(threadname+"结束时间:" + DateUtils.getTime());
return new AsyncResult<>( OAQuotProducts);
}
}

View File

@ -9,10 +9,7 @@ import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.domain.Bank;
import com.ruoyi.customer.domain.Customer;
import com.ruoyi.material.domain.CMaterialCost;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.redBook.domain.Product;
import com.ruoyi.redBook.domain.RbVersionDateResult;
import com.ruoyi.redBook.domain.*;
import com.ruoyi.redBook.mapper.OARedBookMapper;
import com.ruoyi.redBook.service.IRedBookService;
import org.springframework.beans.factory.annotation.Autowired;
@ -159,7 +156,7 @@ public class RedBookServiceImpl implements IRedBookService
}
if (list.size() > 0)
{
int batchSize = 200; // 每批次插入的数据量
int batchSize = 100; // 每批次插入的数据量
for (int i = 0; i < list.size(); i += batchSize) {
int toIndex = Math.min(i + batchSize, list.size());
List<OAQuotProduct> subList = list.subList(i, toIndex);
@ -199,8 +196,13 @@ public class RedBookServiceImpl implements IRedBookService
return oaRedBookMapper.getFixDatePrice(name_0,spec,voltage,uid_0);
}
/**
* 选择调价版本批量获取红本价格
* @param list
* @return
*/
@Override
@DataSource(DataSourceType.OAREDBOOK)
@DataSource(DataSourceType.REDBOOK)
public List<OAQuotProduct> setRedBookPrice(List<OAQuotProduct> list) {
for(OAQuotProduct oAQuotProduct : list){
String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0());
@ -209,6 +211,35 @@ public class RedBookServiceImpl implements IRedBookService
return list;
}
/**
* 导入明细批量获取红本价格
* @param list
* @return
*/
@Override
@DataSource(DataSourceType.REDBOOK)
public List<OAQuotProduct> setRedBookPrice2(List<OAQuotProductTemplate> list) {
List<OAQuotProduct> OAQuotProducts = new ArrayList<>();
OAQuotProduct oAQuotProduct = new OAQuotProduct();
for(OAQuotProductTemplate oAQuotProductTemplate : list){
OAQuotProduct rbProduct = oaRedBookMapper.getFixDatePrice2(oAQuotProductTemplate.getName_1(),oAQuotProductTemplate.getSpec(),oAQuotProductTemplate.getRbUid());
if(rbProduct!=null){
oAQuotProduct = new OAQuotProduct();
oAQuotProduct.setIndex(oAQuotProductTemplate.getIndex());
oAQuotProduct.setUid_0(rbProduct.getUid_0());
oAQuotProduct.setName_0(rbProduct.getName_0());
oAQuotProduct.setName_1(oAQuotProductTemplate.getName_1());
oAQuotProduct.setSpec(oAQuotProductTemplate.getSpec());
oAQuotProduct.setVoltage(rbProduct.getVoltage());
oAQuotProduct.setStu(rbProduct.getStu());
oAQuotProduct.setPrice(rbProduct.getPrice());
oAQuotProduct.setCount(oAQuotProductTemplate.getCount());
OAQuotProducts.add(oAQuotProduct);
}
}
return OAQuotProducts;
}
/**
* 查询已生成的报价单列表

View File

@ -119,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="quotCode != null and quotCode != ''"> and quot_code like concat('%', #{quotCode}, '%')</if>
<if test="quotCustomerName != null and quotCustomerName != ''"> and quot_customer_name like concat('%', #{quotCustomerName}, '%')</if>
<if test="quotProject != null and quotProject != ''"> and quot_project like concat('%', #{quotProject}, '%')</if>
<if test="quotPrint != null and quotPrint != ''"> and quot_print = #{quotPrint}</if>
<if test="quotApprovalStatus != null and quotApprovalStatus != ''"> and quot_approval_status = #{quotApprovalStatus}</if>
<!-- 数据范围过滤 -->
${params.dataScope}

View File

@ -170,7 +170,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
inner join [rb_productVersion] B on A.version_uid_0=B.uid_0
where A.[namevoltage] = #{name_0} and A.规格 = #{spec}
and A.电压等级 = #{voltage} and B.uid_0 = #{uid_0}
and (B.sta_0=1 or sta_0=0) order by B.uid_0 desc
and (B.sta_0=1 or sta_0=0)
</select>
<select id="getFixDatePrice2" resultType="OAQuotProduct">
select top 1 B.uid_0,A.namevoltage name_0,isnull(A.电压等级,N' - ') voltage ,A.单位 stu,
convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate
from [rb_product_price] A
left join rb_productVersion B on A.version_uid_0=B.uid_0
where A.型号 = #{name_1} and A.规格 = #{spec}
and B.uid_0 = #{uid_0}
and (B.sta_0=1 or sta_0=0)
</select>
<sql id="quotsJoins">

View File

@ -18,7 +18,7 @@ const service = axios.create({
// axios中请求配置有baseURL选项表示请求URL公共部分
baseURL: process.env.VUE_APP_BASE_API,
// 超时
timeout: 60000
timeout: 300000
})
// request拦截器

View File

@ -25,6 +25,16 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="是否打印" prop="quotPrint">
<el-select v-model="queryParams.quotPrint" placeholder="请选择打印状态" clearable>
<el-option
v-for="dict in dict.type.quot_print"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="提交状态" prop="quotApprovalStatus">
<el-select v-model="queryParams.quotApprovalStatus" placeholder="请选择提交状态" clearable>
<el-option
@ -121,7 +131,7 @@
></el-switch>
</template>
</el-table-column>
<el-table-column label="打印人" align="center" prop="quotPrintUserName" width="150px" v-if="checkRole(['SALES_MAN'])"/>
<el-table-column label="打印人" align="center" prop="quotPrintUserName" width="150px"/>
<el-table-column label="业务员" align="center" prop="quotSalesmanName" width="150px"/>
<el-table-column label="客户名称" align="center" prop="quotCustomerName" width="250px"/>
<el-table-column label="项目名称" align="center" prop="quotProject" width="250px"/>
@ -1388,7 +1398,7 @@ export default {
'jsqrDialog': jsqrDialog,
'hjDialog': hjDialog
},
dicts: ['quot_approval_status','quot_jsxz_group','quot_jsxz_chapter','quot_jsxz_approval_status','quot_jsxz_standard','quot_hj_approval_status'],
dicts: ['quot_print', 'quot_approval_status','quot_jsxz_group','quot_jsxz_chapter','quot_jsxz_approval_status','quot_jsxz_standard','quot_hj_approval_status'],
data() {
return {
//
@ -1426,7 +1436,6 @@ export default {
url: process.env.VUE_APP_BASE_API + "/quot/quot/importData"
},
// -
quotXjFileList: [],
// -

View File

@ -10,7 +10,9 @@
<el-col :span="14">
<el-button size="mini" icon="el-icon-refresh" @click="handleRefreshClick">刷新</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成报价单</el-button>
<el-button style="float: right;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
<el-button style="float: right;" size="mini" type="info" plain icon="el-icon-upload2" @click="handleImport">导入</el-button>
</el-col>
</el-row>
@ -197,6 +199,34 @@
</pane>
</splitpanes>
</el-form>
<!-- 产品导入对话框 -->
<el-dialog :title="productUpload.title" :visible.sync="productUpload.open" width="400px" append-to-body>
<el-upload
ref="productUpload"
:limit="1"
accept=".xlsx, .xls"
:headers="productUpload.headers"
:action="productUpload.url"
:disabled="productUpload.isUploading"
:on-progress="handleFileUploadProgress"
:on-success="handleFileSuccess"
:auto-upload="false"
:data="{'rbUid':this.form.rbDateUid}"
drag
>
<i class="el-icon-upload"></i>
<div class="el-upload__text">将文件拖到此处<em>点击上传</em></div>
<div class="el-upload__tip text-center" slot="tip">
<span>仅允许导入xlsxlsx格式文件</span>
<el-link type="primary" :underline="false" style="font-size:12px;vertical-align: baseline;" @click="importTemplate">下载模板</el-link>
</div>
</el-upload>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitFileForm"> </el-button>
<el-button @click="productUpload.open = false"> </el-button>
</div>
</el-dialog>
</div>
</template>
<style>
@ -240,7 +270,7 @@
</style>
<script>
import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData,saveQuot, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook";
import { getToken } from "@/utils/auth";
export default {
name: "productSelect",
data() {
@ -307,6 +337,20 @@
selectedResultPageSize: 10,
selectedResultData: [],
//
productUpload: {
//
open: false,
//
title: "",
//
isUploading: false,
//
headers: { Authorization: "Bearer " + getToken() },
//
url: process.env.VUE_APP_BASE_API + "/redBook/redBook/importData"
},
//
perc: 0.8,
perc2: '',
@ -731,6 +775,45 @@
}
});
},
/** 产品数据导入按钮操作 */
handleImport() {
this.productUpload.title = "产品数据导入";
this.productUpload.open = true;
},
/** 下载模板操作 */
importTemplate() {
this.download('redBook/redBook/importTemplate', {
}, `product_template_${new Date().getTime()}.xlsx`)
},
//
handleFileUploadProgress(event, file, fileList) {
this.productUpload.isUploading = true;
this.madeQuotDis = true;
this.selectedResultLoading = true;
},
//
handleFileSuccess(response, file, fileList) {
if(response.code == 200){
this.$message.success("产品数据导入成功!");
this.selectedResultData = this.selectedResultData.concat(response.data)
this.changeData();
}else{
this.$message.error(response.msg);
}
this.$refs.productUpload.clearFiles();
this.productUpload.open = false;
this.productUpload.isUploading = false;
this.madeQuotDis = false;
this.selectedResultLoading = false;
},
//
submitFileForm() {
this.$refs.productUpload.submit();
},
//
getVersionList(){
versionList(this.queryParams).then(response => {