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. 60
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerQuoteHistoryMapper.xml
  7. 104
      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){ if(!approvedFlag){
// 审核状态-审核拒绝 // 审核状态-审核拒绝
sysCustomerQuoteVo.setAuditStatus("2"); sysCustomerQuoteVo.setAuditStatus("2");
//客户报价审核后,修改客户报价历史数据
quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo);
} }
// 如果任务已结束更新业务表状态 方法中传入的值为原来的instanceId,只是做了调整 // 如果任务已结束更新业务表状态 方法中传入的值为原来的instanceId,只是做了调整
boolean processIsFinish = processService.judgeProcessIsFinish(instanceId); boolean processIsFinish = processService.judgeProcessIsFinish(instanceId);
@ -276,6 +278,10 @@ public class SysCustomerQuoteController extends BaseController
// 审核通过 // 审核通过
sysCustomerQuoteVo.setAuditStatus("1"); sysCustomerQuoteVo.setAuditStatus("1");
//客户报价审核后,修改客户报价历史数据
quoteHistoryService.updateSysCustomerQuoteHistoryByCustomerQuote(sysCustomerQuoteVo);
// 提交 // 提交
if("submit".equals(instanceType)){ 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; private BigDecimal materialUsd;
/** 报价时间 */ /** 报价时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "报价时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date quoteTime; private Date quoteTime;
/** 审核状态(0待审核、1审核通过、2审核拒绝) */ /** 审核状态(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 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 * @param sysCustomerQuote
*/ */
int generateSysCustomerQuoteHistory(SysCustomerQuote 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; package com.ruoyi.system.service.impl;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.SysCustomerQuote; import com.ruoyi.system.domain.SysCustomerQuote;
@ -54,7 +53,18 @@ public class SysCustomerQuoteHistoryServiceImpl implements ISysCustomerQuoteHist
@Override @Override
public List<SysCustomerQuoteHistory> selectSysCustomerQuoteHistoryList(SysCustomerQuoteHistory sysCustomerQuoteHistory) 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) { for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) {
SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory(); SysCustomerQuoteHistory sysCustomerQuoteHistory = new SysCustomerQuoteHistory();
sysCustomerQuoteHistory.setCustomerCode(sysCustomerQuote.getCustomerCode()); sysCustomerQuoteHistory.setCustomerCode(sysCustomerQuote.getCustomerCode());
sysCustomerQuoteHistory.setSupplierCode(supplierCode);
sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode()); sysCustomerQuoteHistory.setMaterialCode(sysCustomerQuoteChild.getMaterialCode());
sysCustomerQuoteHistory.setMaterialRmb(sysCustomerQuoteChild.getMaterialRmb()); sysCustomerQuoteHistory.setMaterialRmb(sysCustomerQuoteChild.getMaterialRmb());
sysCustomerQuoteHistory.setMaterialNoRmb(sysCustomerQuoteChild.getMaterialNoRmb()); 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);
}
}
/** /**
* 修改客户报价历史 * 修改客户报价历史
* *

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

@ -38,7 +38,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectSysCustomerQuoteHistoryVo"/> <include refid="selectSysCustomerQuoteHistoryVo"/>
where quote_history_id = #{quoteHistoryId} where quote_history_id = #{quoteHistoryId}
</select> </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 id="insertSysCustomerQuoteHistory" parameterType="SysCustomerQuoteHistory" useGeneratedKeys="true" keyProperty="quoteHistoryId">
insert into sys_customer_quote_history insert into sys_customer_quote_history
<trim prefix="(" suffix=")" suffixOverrides=","> <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" <insert id="insertSysCustomerQuoteHistoryListBatch" parameterType="java.util.List" useGeneratedKeys="true"
keyProperty="quoteHistoryId"> keyProperty="quoteHistoryId">
insert into sys_customer_quote_history 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) create_time, audit_status, is_latest)
values values
<foreach collection="list" item="item" index="index" open="(" close=")" separator="),("> <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.materialNoUsd}, #{item.materialUsd}, #{item.quoteTime}, #{item.createBy},
#{item.createTime},#{item.auditStatus}, #{item.isLatest} #{item.createTime},#{item.auditStatus}, #{item.isLatest}
</foreach> </foreach>
@ -110,6 +118,52 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where quote_history_id = #{quoteHistoryId} where quote_history_id = #{quoteHistoryId}
</update> </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 id="deleteSysCustomerQuoteHistoryById" parameterType="Long">
delete from sys_customer_quote_history where quote_history_id = #{quoteHistoryId} delete from sys_customer_quote_history where quote_history_id = #{quoteHistoryId}
</delete> </delete>

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

@ -642,53 +642,79 @@
} }
}); });
} }
function doSubmit(index, layero,uniqueId){ function doSubmit(index, layero, uniqueId) {
console.log(uniqueId); console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']]; var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0]; var selectedRows = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections');
console.log("rowData: "+rowData);
//判断是否重复 if (selectedRows.length === 0) {
var rows = $("#bootstrap-sub-table-1").bootstrapTable('getData').length; $.modal.alertError("请选择至少一条物料信息");
for(var i=0;i<rows;i++){ return;
var data = $("#bootstrap-sub-table-1").bootstrapTable('getData')[i]; }
if(data.materialNo==rowData.materialCode){
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;
}
}
if (!isDuplicate) {
// 如果不存在,则准备插入新行
newRows.push({
materialId: rowData.id,
materialCode: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
brand: rowData.brand,
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
materialNum: "",
materialSole: "",
materialRmb: "",
materialNoRmb: "",
materialNoUsd: "",
materialUsd: "",
materialUsdSum: "",
materialNoUsdSum: "",
materialNoRmbSum: "",
materialRmbSum: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
remark: "",
});
} else {
$.modal.alertError("不能选择已添加过的相同料号"); $.modal.alertError("不能选择已添加过的相同料号");
return;
} }
} }
$("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', {
index:1, // 批量插入新行
row: { if (newRows.length > 0) {
materialId:rowData.id, for (var k = 0; k < newRows.length; k++) {
materialCode: rowData.materialNo, $("#bootstrap-sub-table-quoteChild").bootstrapTable('insertRow', { index: 1, row: newRows[k] });
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
brand: rowData.brand,
unit: rowData.unit,
processMethod: rowData.processMethod,
photoUrl: rowData.photoUrl,
countTax: '',
usdTax: '',
materialNum: "",
materialSole: "",
materialRmb: "",
materialNoRmb: "",
materialNoUsd: "",
materialUsd: "",
materialUsdSum: "",
materialNoUsdSum: "",
materialNoRmbSum: "",
materialRmbSum: "",
createBy: "",
createTime: "",
updateBy: "",
updateTime: "",
remark: "",
} }
}) }
layer.close(index); layer.close(index);
} }
function insertRow() { function insertRow() {
if ($("#customerCode").val() == null || $("#customerCode").val() == '') { if ($("#customerCode").val() == null || $("#customerCode").val() == '') {
$.modal.alertWarning("请先选择客户"); $.modal.alertWarning("请先选择客户");

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

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

Loading…
Cancel
Save