Browse Source

[fix] 工程管理

修改客户报价历史实体的报价时间为yyyy-MM-dd HH:mm:ss这种格式;
新增 客户报价审核后更新客户报价历史后端接口
修改客户报价历史列表页面传入的参数为materialCode和customerCode;
修改客户报价审批接口:在审核通过和拒绝的时候调用客户报价审核后更新客户报价历史方法
客户报价历史新增根据供应商编码查询最新一条记录后端接口
修改查询客户报价历史列表后端接口,在查询的时候通过前端传入的值,逻辑把最新一条的数据和列表数据匹配,匹配上的设置为是最新报价
修改客户报价的新增页面,实现添加物料的时候由只能添加单条数据改为可以遍历添加多条数据
dev
liuxiaoxu 2 months ago
parent
commit
f025e10323
  1. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java
  2. 4
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java
  3. 10
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java
  4. 6
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java
  5. 48
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java
  6. 58
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml
  7. 54
      ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html
  8. 4
      ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html

6
ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java

@ -269,6 +269,8 @@ public class SysCustomerQuoteController extends BaseController
if(!approvedFlag){
// 审核状态-审核拒绝
sysCustomerQuoteVo.setAuditStatus("2");
//客户报价审核后,修改客户报价历史数据
quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo);
}
// 如果任务已结束更新业务表状态 方法中传入的值为原来的instanceId,只是做了调整
boolean processIsFinish = processService.judgeProcessIsFinish(instanceId);
@ -276,6 +278,10 @@ public class SysCustomerQuoteController extends BaseController
// 审核通过
sysCustomerQuoteVo.setAuditStatus("1");
//客户报价审核后,修改客户报价历史数据
quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo);
// 提交
if("submit".equals(instanceType)){
// 使用状态-是

4
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomerQuoteHistory.java

@ -50,8 +50,8 @@ public class SysCustomerQuoteHistory extends BaseEntity
private BigDecimal materialUsd;
/** 报价时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date quoteTime;
/** 审核状态(0待审核、1审核通过、2审核拒绝) */

10
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerQuoteHistoryMapper.java

@ -77,4 +77,14 @@ public interface SysCustomerQuoteHistoryMapper
int insertSysCustomerQuoteHistoryListBatch(List<SysCustomerQuoteHistory> sysCustomerQuoteHistoryList);
int updateSysCustomerQuoteHistoryByCode(SysCustomerQuoteHistory sysCustomerQuoteHistory);
/**
* 根据供应商编码查询最新一条记录
* */
SysCustomerQuoteHistory findLatestQuoteHistory(SysCustomerQuoteHistory sysCustomerQuoteHistory);
int updateOtherQuoteHistoryByCode(SysCustomerQuoteHistory sysCustomerQuoteHistory);
}

6
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteHistoryService.java

@ -81,4 +81,10 @@ public interface ISysCustomerQuoteHistoryService
* @param sysCustomerQuote
*/
int generateSysCustomerQuoteHistory(SysCustomerQuote sysCustomerQuote);
/**
* 客户报价审核后更新客户报价历史
* @param sysCustomerQuoteVo
*/
void updateSysCustomerQuoteHistoryByCustomerQuote(SysCustomerQuoteVo sysCustomerQuoteVo);
}

48
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteHistoryServiceImpl.java

@ -1,8 +1,7 @@
package com.ruoyi.system.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.*;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysCustomerQuote;
@ -54,7 +53,18 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist
@Override
public List<SysCustomerQuoteHistory> selectSysCustomerQuoteHistoryList(SysCustomerQuoteHistory sysCustomerQuoteHistory)
{
return sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory);
//最新的报价
SysCustomerQuoteHistory latestQuoteHistory = sysCustomerQuoteHistoryMapper.findLatestQuoteHistory(sysCustomerQuoteHistory);
List<SysCustomerQuoteHistory> sysCustomerQuoteHistories = sysCustomerQuoteHistoryMapper.selectSysCustomerQuoteHistoryList(sysCustomerQuoteHistory);
sysCustomerQuoteHistories.forEach(customerQuoteHistory -> {
if (Objects.equals(customerQuoteHistory.getQuoteHistoryId(), latestQuoteHistory.getQuoteHistoryId())) {
customerQuoteHistory.setIsLatest("1");
} else {
customerQuoteHistory.setIsLatest("0");
}
});
return sysCustomerQuoteHistories;
}
/**
@ -90,6 +100,7 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist
for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) {
SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory();
sysCustomerQuoteHistory.setCustomerCode(sysCustomerQuote.getCustomerCode());
sysCustomerQuoteHistory.setSupplierCode(supplierCode);
sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode());
sysCustomerQuoteHistory.setMaterialRmb(sysCustomerQuoteChild.getMaterialRmb());
sysCustomerQuoteHistory.setMaterialNoRmb(sysCustomerQuoteChild.getMaterialNoRmb());
@ -108,6 +119,35 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist
}
/**
* 根据客户报价信息更新客户最新报价记录
* @param sysCustomerQuoteVo
*/
@Override
public void updateSysCustomerQuoteHistoryByCustomerQuote(SysCustomerQuoteVo sysCustomerQuoteVo) {
String loginName = ShiroUtils.getLoginName();
String supplierCode = sysCustomerQuoteVo.getSupplierCode();
String auditStatus = sysCustomerQuoteVo.getAuditStatus();
// 获取所有的子项
List<SysCustomerQuoteChild> sysCustomerQuoteChildren = quoteChildMapper.selectSysCustomerQuoteChildByQuoteId(supplierCode);
for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) {
SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory();
// 设置审核状态
sysCustomerQuoteHistory.setAuditStatus(auditStatus.equals("1") ? "1" : "2");
sysCustomerQuoteHistory.setSupplierCode(supplierCode);
// 设置其他字段
sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode());
sysCustomerQuoteHistory.setUpdateBy(loginName);
sysCustomerQuoteHistory.setUpdateTime(new Date());
// 更新报价历史记录
sysCustomerQuoteHistoryMapper.updateSysCustomerQuoteHistoryByCode(sysCustomerQuoteHistory);
}
}
/**
* 修改客户报价历史
*

58
ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml

@ -39,6 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where quote_history_id = #{quoteHistoryId}
</select>
<select id="findLatestQuoteHistory" parameterType="String" resultMap="SysCustomerQuoteHistoryResult" >
<include refid="selectSysCustomerQuoteHistoryVo"/>
where customer_code = #{customerCode} and materialCode = #{materialCode} and audit_status = '1'
order by update_time desc
limit 1
</select>
<insert id="insertSysCustomerQuoteHistory" parameterType="SysCustomerQuoteHistory" useGeneratedKeys="true" keyProperty="quoteHistoryId">
insert into sys_customer_quote_history
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -78,11 +86,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="insertSysCustomerQuoteHistoryListBatch" parameterType="java.util.List" useGeneratedKeys="true"
keyProperty="quoteHistoryId">
insert into sys_customer_quote_history
(customer_code, materialCode, materialRmb, materialNoRmb, materialNoUsd, materialUsd, quote_time, create_by,
(customer_code, materialCode, supplierCode ,materialRmb, materialNoRmb, materialNoUsd, materialUsd, quote_time, create_by,
create_time, audit_status, is_latest)
values
<foreach collection="list" item="item" index="index" open="(" close=")" separator="),(">
#{item.customerCode},#{item.materialCode}, #{item.materialRmb}, #{item.materialNoRmb},
#{item.customerCode},#{item.materialCode}, #{item.supplierCode}, #{item.materialRmb}, #{item.materialNoRmb},
#{item.materialNoUsd}, #{item.materialUsd}, #{item.quoteTime}, #{item.createBy},
#{item.createTime},#{item.auditStatus}, #{item.isLatest}
</foreach>
@ -110,6 +118,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where quote_history_id = #{quoteHistoryId}
</update>
<update id="updateSysCustomerQuoteHistoryByCode" parameterType="SysCustomerQuoteHistory">
update sys_customer_quote_history
<trim prefix="SET" suffixOverrides=",">
<if test="customerCode != null">customer_code = #{customerCode},</if>
<if test="supplierCode != null">supplierCode = #{supplierCode},</if>
<if test="materialCode != null">materialCode = #{materialCode},</if>
<if test="materialRmb != null">materialRmb = #{materialRmb},</if>
<if test="materialNoRmb != null">materialNoRmb = #{materialNoRmb},</if>
<if test="materialNoUsd != null">materialNoUsd = #{materialNoUsd},</if>
<if test="materialUsd != null">materialUsd = #{materialUsd},</if>
<if test="quoteTime != null">quote_time = #{quoteTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="isLatest != null">is_latest = #{isLatest},</if>
</trim>
where supplierCode = #{supplierCode} and materialCode = #{materialCode}
</update>
<update id="updateOtherQuoteHistoryByCode" parameterType="SysCustomerQuoteHistory">
update sys_customer_quote_history
<trim prefix="SET" suffixOverrides=",">
<if test="customerCode != null">customer_code = #{customerCode},</if>
<if test="supplierCode != null">supplierCode = #{supplierCode},</if>
<if test="materialCode != null">materialCode = #{materialCode},</if>
<if test="materialRmb != null">materialRmb = #{materialRmb},</if>
<if test="materialNoRmb != null">materialNoRmb = #{materialNoRmb},</if>
<if test="materialNoUsd != null">materialNoUsd = #{materialNoUsd},</if>
<if test="materialUsd != null">materialUsd = #{materialUsd},</if>
<if test="quoteTime != null">quote_time = #{quoteTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="isLatest != null">is_latest = #{isLatest},</if>
</trim>
where supplierCode = #{supplierCode} and materialCode != #{materialCode}
</update>
<delete id="deleteSysCustomerQuoteHistoryById" parameterType="Long">
delete from sys_customer_quote_history where quote_history_id = #{quoteHistoryId}
</delete>

54
ruoyi-admin/src/main/resources/templates/system/customerQuote/add.html

@ -642,24 +642,38 @@
}
});
}
function doSubmit(index, layero,uniqueId){
function doSubmit(index, layero, uniqueId) {
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
console.log("rowData: "+rowData);
//判断是否重复
var rows = $("#bootstrap-sub-table-1").bootstrapTable('getData').length;
for(var i=0;i<rows;i++){
var data = $("#bootstrap-sub-table-1").bootstrapTable('getData')[i];
if(data.materialNo==rowData.materialCode){
$.modal.alertError("不能选择已添加过的相同料号");
var selectedRows = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
if (selectedRows.length === 0) {
$.modal.alertError("请选择至少一条物料信息");
return;
}
var existingData = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData');
// 存储要插入的新行
var newRows = [];
// 遍历选中的每一行物料信息
for (var i = 0; i < selectedRows.length; i++) {
var rowData = selectedRows[i];
// 检查是否已经存在相同的物料
var isDuplicate = false;
for (var j = 0; j < existingData.length; j++) {
if (existingData[j].materialCode === rowData.materialNo) {
isDuplicate = true;
break;
}
}
$("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', {
index:1,
row: {
materialId:rowData.id,
if (!isDuplicate) {
// 如果不存在,则准备插入新行
newRows.push({
materialId: rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
@ -685,10 +699,22 @@
updateBy: "",
updateTime: "",
remark: "",
});
} else {
$.modal.alertError("不能选择已添加过的相同料号");
}
}
// 批量插入新行
if (newRows.length > 0) {
for (var k = 0; k < newRows.length; k++) {
$("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', { index: 1, row: newRows[k] });
}
}
})
layer.close(index);
}
function insertRow() {
if ($("#customerCode").val() == null || $("#customerCode").val() == '') {
$.modal.alertWarning("请先选择客户");

4
ruoyi-admin/src/main/resources/templates/system/customerQuote/recentQuotationHistory.html

@ -15,7 +15,7 @@
<script th:inline="javascript">
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var isLatestDatas = [[${@dict.getType('is_latest')}]];
var qualityOrderCode = /*[[${materialCode}]]*/ '';
var materialCode = /*[[${materialCode}]]*/ '';
var customerCode = /*[[${customerCode}]]*/ '';
var prefix = ctx + "system/customerQuote";
@ -25,7 +25,7 @@
url: prefix + "/recentQuotationHistoryList",
modalName: "客户报价历史",
queryParams: {
qualityOrderCode: qualityOrderCode,
materialCode: materialCode,
customerCode: customerCode
},
columns: [{

Loading…
Cancel
Save