feat(erp): 补充合同信息字段并完善采购计划关联显示
- 在ErpContractOptionVo中添加crm_order全量字段包括订单类型、交货日期、订单状态等 - 添加@JsonFormat注解支持日期格式化 - 新增selectContractsByOrderCodes方法支持按合同编号批量查询 - 更新SQL映射文件中的selectContractPage和新增selectContractsByOrderCodes查询 - 在采购计划服务实现中查询时刷新进度并关联合同详情 - 在前端界面中新增关联合同标签页显示合同详细信息表格 - 重构采购到货界面将采购要求和到货明细合并显示 - 添加合同状态文本转换方法和相关样式定义
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package com.klp.erp.domain.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 采购计划左侧「合同列表」视图对象:crm_order + 该合同已有的采购计划数。
|
||||
@@ -42,4 +44,101 @@ public class ErpContractOptionVo implements Serializable {
|
||||
|
||||
/** 该合同已挂接的采购计划数 */
|
||||
private Integer planCount;
|
||||
|
||||
// ====== 以下为 crm_order 全量补充字段 ======
|
||||
|
||||
/** 订单类型:pre-预订单,formal-正式订单 */
|
||||
private Long orderType;
|
||||
|
||||
/** 交货日期 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date deliveryDate;
|
||||
|
||||
/** 订单状态 */
|
||||
private Long orderStatus;
|
||||
|
||||
/** 财务状态 */
|
||||
private Long financeStatus;
|
||||
|
||||
/** 未结款数额 */
|
||||
private BigDecimal unpaidAmount;
|
||||
|
||||
/** 签订时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
private Date signTime;
|
||||
|
||||
/** 签订地点 */
|
||||
private String signLocation;
|
||||
|
||||
/** 产品内容 */
|
||||
private String productContent;
|
||||
|
||||
/** 合同内容 */
|
||||
private String contractContent;
|
||||
|
||||
/** 供方地址 */
|
||||
private String supplierAddress;
|
||||
|
||||
/** 供方电话 */
|
||||
private String supplierPhone;
|
||||
|
||||
/** 供方开户行 */
|
||||
private String supplierBank;
|
||||
|
||||
/** 供方账号 */
|
||||
private String supplierAccount;
|
||||
|
||||
/** 供方税号 */
|
||||
private String supplierTaxNo;
|
||||
|
||||
/** 需方地址 */
|
||||
private String customerAddress;
|
||||
|
||||
/** 需方电话 */
|
||||
private String customerPhone;
|
||||
|
||||
/** 需方开户行 */
|
||||
private String customerBank;
|
||||
|
||||
/** 需方账号 */
|
||||
private String customerAccount;
|
||||
|
||||
/** 需方税号 */
|
||||
private String customerTaxNo;
|
||||
|
||||
/** 技术附件 */
|
||||
private String techAnnex;
|
||||
|
||||
/** 商务附件 */
|
||||
private String businessAnnex;
|
||||
|
||||
/** 排产函 */
|
||||
private String productionSchedule;
|
||||
|
||||
/** 算单价备注 */
|
||||
private String unitPriceRemark;
|
||||
|
||||
/** 应付定金(万元) */
|
||||
private BigDecimal depositPayable;
|
||||
|
||||
/** 已付定金(万元) */
|
||||
private BigDecimal depositPaid;
|
||||
|
||||
/** 定金比例(%) */
|
||||
private BigDecimal depositRatio;
|
||||
|
||||
/** 合同状态 0=草稿 1=生效 2=作废 3=已完成 */
|
||||
private Long status;
|
||||
|
||||
/** 关联合同ID */
|
||||
private Long contractId;
|
||||
|
||||
/** 附件 */
|
||||
private String annexFiles;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 是否置顶 */
|
||||
private Integer isTop;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,9 @@ public class ErpPurchasePlanVo implements Serializable {
|
||||
/** 关联销售合同编号(展示用) */
|
||||
private List<String> contractCodes;
|
||||
|
||||
/** 关联销售合同信息(来自 crm_order,含客户、金额、销售员等) */
|
||||
private List<ErpContractOptionVo> contractInfos;
|
||||
|
||||
/** 审核历史(每次审核/驳回留痕) */
|
||||
private List<ErpPurchasePlanAuditLogVo> auditLogs;
|
||||
}
|
||||
|
||||
@@ -61,4 +61,9 @@ public interface ErpPurchasePlanMapper extends BaseMapperPlus<ErpPurchasePlanMap
|
||||
* 厂商历史记忆:已保存过的厂商去重(可按关键字过滤),用于手填自动补全。
|
||||
*/
|
||||
List<String> selectDistinctManufacturers(@Param("kw") String kw);
|
||||
|
||||
/**
|
||||
* 根据合同编号(order_code)批量查询 crm_order 合同信息。
|
||||
*/
|
||||
List<ErpContractOptionVo> selectContractsByOrderCodes(@Param("codes") List<String> codes);
|
||||
}
|
||||
|
||||
@@ -73,6 +73,8 @@ public class ErpPurchasePlanServiceImpl implements IErpPurchasePlanService {
|
||||
|
||||
@Override
|
||||
public ErpPurchasePlanVo queryById(Long planId) {
|
||||
// 刷新到货进度(含在途统计),确保每次查看都是最新数据
|
||||
refreshProgress(planId);
|
||||
ErpPurchasePlanVo vo = baseMapper.selectVoById(planId);
|
||||
if (vo == null) {
|
||||
return null;
|
||||
@@ -88,6 +90,10 @@ public class ErpPurchasePlanServiceImpl implements IErpPurchasePlanService {
|
||||
if (!orderIds.isEmpty()) {
|
||||
vo.setContractCodes(baseMapper.selectOrderCodes(orderIds));
|
||||
}
|
||||
// 关联合同详情(从 crm_order 按 contractCodes 批量查)
|
||||
if (vo.getContractCodes() != null && !vo.getContractCodes().isEmpty()) {
|
||||
vo.setContractInfos(baseMapper.selectContractsByOrderCodes(vo.getContractCodes()));
|
||||
}
|
||||
fillProgress(vo);
|
||||
// 审核历史(含每次驳回理由)
|
||||
vo.setAuditLogs(queryAuditLogs(planId));
|
||||
@@ -484,6 +490,9 @@ public class ErpPurchasePlanServiceImpl implements IErpPurchasePlanService {
|
||||
if (!orderIds.isEmpty()) {
|
||||
v.setContractCodes(baseMapper.selectOrderCodes(orderIds));
|
||||
}
|
||||
if (v.getContractCodes() != null && !v.getContractCodes().isEmpty()) {
|
||||
v.setContractInfos(baseMapper.selectContractsByOrderCodes(v.getContractCodes()));
|
||||
}
|
||||
}
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@@ -32,17 +32,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
ORDER BY order_id, item_id
|
||||
</select>
|
||||
|
||||
<!-- 合同列表 + 该合同已挂接的采购计划数 -->
|
||||
<!-- 合同列表 + 该合同已挂接的采购计划数(全字段) -->
|
||||
<select id="selectContractPage" resultType="com.klp.erp.domain.vo.ErpContractOptionVo">
|
||||
SELECT
|
||||
o.order_id AS orderId,
|
||||
o.order_code AS orderCode,
|
||||
o.contract_code AS contractCode,
|
||||
o.contract_name AS contractName,
|
||||
o.customer AS customer,
|
||||
o.supplier AS supplier,
|
||||
o.order_amount AS orderAmount,
|
||||
o.salesman AS salesman,
|
||||
o.order_id AS orderId,
|
||||
o.order_code AS orderCode,
|
||||
o.contract_code AS contractCode,
|
||||
o.contract_name AS contractName,
|
||||
o.customer AS customer,
|
||||
o.supplier AS supplier,
|
||||
o.order_amount AS orderAmount,
|
||||
o.salesman AS salesman,
|
||||
o.order_type AS orderType,
|
||||
o.delivery_date AS deliveryDate,
|
||||
o.order_status AS orderStatus,
|
||||
o.finance_status AS financeStatus,
|
||||
o.unpaid_amount AS unpaidAmount,
|
||||
o.sign_time AS signTime,
|
||||
o.sign_location AS signLocation,
|
||||
o.product_content AS productContent,
|
||||
o.contract_content AS contractContent,
|
||||
o.supplier_address AS supplierAddress,
|
||||
o.supplier_phone AS supplierPhone,
|
||||
o.supplier_bank AS supplierBank,
|
||||
o.supplier_account AS supplierAccount,
|
||||
o.supplier_tax_no AS supplierTaxNo,
|
||||
o.customer_address AS customerAddress,
|
||||
o.customer_phone AS customerPhone,
|
||||
o.customer_bank AS customerBank,
|
||||
o.customer_account AS customerAccount,
|
||||
o.customer_tax_no AS customerTaxNo,
|
||||
o.tech_annex AS techAnnex,
|
||||
o.business_annex AS businessAnnex,
|
||||
o.production_schedule AS productionSchedule,
|
||||
o.unit_price_remark AS unitPriceRemark,
|
||||
o.deposit_payable AS depositPayable,
|
||||
o.deposit_paid AS depositPaid,
|
||||
o.deposit_ratio AS depositRatio,
|
||||
o.status AS status,
|
||||
o.contract_id AS contractId,
|
||||
o.annex_files AS annexFiles,
|
||||
o.remark AS remark,
|
||||
o.is_top AS isTop,
|
||||
(SELECT COUNT(*) FROM erp_purchase_plan_contract_rel r
|
||||
JOIN erp_purchase_plan p ON p.plan_id = r.plan_id AND p.del_flag = '0'
|
||||
WHERE r.del_flag = '0' AND r.order_id = o.order_id) AS planCount
|
||||
@@ -88,6 +119,57 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 根据合同编号(order_code)批量查询合同信息(全字段) -->
|
||||
<select id="selectContractsByOrderCodes" resultType="com.klp.erp.domain.vo.ErpContractOptionVo">
|
||||
SELECT
|
||||
order_id AS orderId,
|
||||
order_code AS orderCode,
|
||||
contract_code AS contractCode,
|
||||
contract_name AS contractName,
|
||||
customer AS customer,
|
||||
supplier AS supplier,
|
||||
order_amount AS orderAmount,
|
||||
salesman AS salesman,
|
||||
order_type AS orderType,
|
||||
delivery_date AS deliveryDate,
|
||||
order_status AS orderStatus,
|
||||
finance_status AS financeStatus,
|
||||
unpaid_amount AS unpaidAmount,
|
||||
sign_time AS signTime,
|
||||
sign_location AS signLocation,
|
||||
product_content AS productContent,
|
||||
contract_content AS contractContent,
|
||||
supplier_address AS supplierAddress,
|
||||
supplier_phone AS supplierPhone,
|
||||
supplier_bank AS supplierBank,
|
||||
supplier_account AS supplierAccount,
|
||||
supplier_tax_no AS supplierTaxNo,
|
||||
customer_address AS customerAddress,
|
||||
customer_phone AS customerPhone,
|
||||
customer_bank AS customerBank,
|
||||
customer_account AS customerAccount,
|
||||
customer_tax_no AS customerTaxNo,
|
||||
tech_annex AS techAnnex,
|
||||
business_annex AS businessAnnex,
|
||||
production_schedule AS productionSchedule,
|
||||
unit_price_remark AS unitPriceRemark,
|
||||
deposit_payable AS depositPayable,
|
||||
deposit_paid AS depositPaid,
|
||||
deposit_ratio AS depositRatio,
|
||||
status AS status,
|
||||
contract_id AS contractId,
|
||||
annex_files AS annexFiles,
|
||||
remark AS remark,
|
||||
is_top AS isTop
|
||||
FROM crm_order
|
||||
WHERE del_flag = 0
|
||||
AND order_code IN
|
||||
<foreach collection="codes" item="code" open="(" separator="," close=")">
|
||||
#{code}
|
||||
</foreach>
|
||||
ORDER BY order_id DESC
|
||||
</select>
|
||||
|
||||
<!-- 厂商历史记忆(去重,可按关键字过滤) -->
|
||||
<select id="selectDistinctManufacturers" resultType="java.lang.String">
|
||||
SELECT manufacturer FROM (
|
||||
|
||||
Reference in New Issue
Block a user