From 07c50359f3f60a777be4987ad833e8c2270018ba Mon Sep 17 00:00:00 2001 From: fengyuan_yang <1976974459@qq.com> Date: Tue, 26 May 2026 14:13:07 +0800 Subject: [PATCH] =?UTF-8?q?2026-05-26=20RoHs=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../quote/service/impl/QuoteServiceImpl.java | 48 +++++++++++++++---- .../rohs/entity/RohsMaterialEntity.java | 8 ++-- .../modules/rohs/mapper/RohsMapper.java | 3 ++ .../rohs/service/impl/RohsServiceImpl.java | 15 ++---- src/main/resources/mapper/rohs/RohsMapper.xml | 41 ++++++++++++---- 5 files changed, 82 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java index 09d23b69..56f431ff 100644 --- a/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java +++ b/src/main/java/com/spring/modules/quote/service/impl/QuoteServiceImpl.java @@ -472,8 +472,8 @@ public class QuoteServiceImpl extends ServiceImpl implements if ("plm_quote".equals(nodeDetail.getPlmTable()) && quoteInfo != null) { // 判断是否为金额类型 if ("C".equals(nodeDetail.getFieldType())) { - BigDecimal v = (BigDecimal) getPropertyValue(quoteInfo, nodeDetail.getPlmField()); - fieldValue = v == null ? "0" : v.toString(); + Object value = getPropertyValue(quoteInfo, nodeDetail.getPlmField()); + fieldValue = toNumericFlowValue(value, nodeDetail.getPlmTable(), nodeDetail.getPlmField()); } else { Object value = getPropertyValue(quoteInfo, nodeDetail.getPlmField()); fieldValue = value == null ? "" : value.toString(); @@ -483,8 +483,8 @@ public class QuoteServiceImpl extends ServiceImpl implements else if ("plm_quote_detail".equals(nodeDetail.getPlmTable()) && defaultQuoteDetail != null) { // 判断是否为金额类型 if ("C".equals(nodeDetail.getFieldType())) { - BigDecimal v = (BigDecimal) getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); - fieldValue = v == null ? "0" : v.toString(); + Object value = getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); + fieldValue = toNumericFlowValue(value, nodeDetail.getPlmTable(), nodeDetail.getPlmField()); } else { Object value = getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); fieldValue = value == null ? "" : value.toString(); @@ -740,8 +740,8 @@ public class QuoteServiceImpl extends ServiceImpl implements if ("plm_quote".equals(nodeDetail.getPlmTable()) && quoteInfo != null) { // 判断是否为金额类型 if ("C".equals(nodeDetail.getFieldType())) { - BigDecimal v = (BigDecimal) getPropertyValue(quoteInfo, nodeDetail.getPlmField()); - fieldValue = v == null ? "0" : v.toString(); + Object value = getPropertyValue(quoteInfo, nodeDetail.getPlmField()); + fieldValue = toNumericFlowValue(value, nodeDetail.getPlmTable(), nodeDetail.getPlmField()); } else { Object value = getPropertyValue(quoteInfo, nodeDetail.getPlmField()); fieldValue = value == null ? "" : value.toString(); @@ -751,8 +751,8 @@ public class QuoteServiceImpl extends ServiceImpl implements else if ("plm_quote_detail".equals(nodeDetail.getPlmTable()) && defaultQuoteDetail != null) { // 判断是否为金额类型 if ("C".equals(nodeDetail.getFieldType())) { - BigDecimal v = (BigDecimal) getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); - fieldValue = v == null ? "0" : v.toString(); + Object value = getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); + fieldValue = toNumericFlowValue(value, nodeDetail.getPlmTable(), nodeDetail.getPlmField()); } else { Object value = getPropertyValue(defaultQuoteDetail, nodeDetail.getPlmField()); fieldValue = value == null ? "" : value.toString(); @@ -777,6 +777,38 @@ public class QuoteServiceImpl extends ServiceImpl implements return mainData; } + /** + * OA流程字段值转换:金额字段(C)统一按数值字符串输出。 + * 兼容 BigDecimal / Number / String,避免直接强转导致 ClassCastException。 + */ + private String toNumericFlowValue(Object value, String plmTable, String plmField) { + if (value == null) { + return "0"; + } + if (value instanceof BigDecimal) { + return ((BigDecimal) value).toString(); + } + if (value instanceof Number) { + return new BigDecimal(value.toString()).toString(); + } + if (value instanceof String) { + String strValue = ((String) value).trim(); + if (!StringUtils.hasText(strValue)) { + return "0"; + } + try { + return new BigDecimal(strValue).toString(); + } catch (NumberFormatException ex) { + throw new RuntimeException(String.format( + "流程字段配置异常:[%s.%s] 被配置为金额(C),但值[%s]不是数字", + plmTable, plmField, strValue)); + } + } + throw new RuntimeException(String.format( + "流程字段配置异常:[%s.%s] 被配置为金额(C),但值类型[%s]不支持", + plmTable, plmField, value.getClass().getSimpleName())); + } + /** * 获取默认报价行的条目明细(QuoteDetail) * @param quoteId 报价单ID diff --git a/src/main/java/com/spring/modules/rohs/entity/RohsMaterialEntity.java b/src/main/java/com/spring/modules/rohs/entity/RohsMaterialEntity.java index d072d595..ef091397 100644 --- a/src/main/java/com/spring/modules/rohs/entity/RohsMaterialEntity.java +++ b/src/main/java/com/spring/modules/rohs/entity/RohsMaterialEntity.java @@ -1,6 +1,7 @@ package com.spring.modules.rohs.entity; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -30,11 +31,8 @@ public class RohsMaterialEntity implements Serializable { private String finalPartNo; - private String customerPartNo; - private String partDesc; - private String partSpec; - - private String remark; + @TableField(exist = false) + private String partStatus; } diff --git a/src/main/java/com/spring/modules/rohs/mapper/RohsMapper.java b/src/main/java/com/spring/modules/rohs/mapper/RohsMapper.java index 32ddf3f0..83cc3683 100644 --- a/src/main/java/com/spring/modules/rohs/mapper/RohsMapper.java +++ b/src/main/java/com/spring/modules/rohs/mapper/RohsMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.spring.modules.change.vo.ProcessFormVo; import com.spring.modules.rohs.entity.RohsEntity; +import com.spring.modules.rohs.entity.RohsMaterialEntity; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Mapper; @@ -22,4 +23,6 @@ public interface RohsMapper extends BaseMapper { RohsEntity getDetailWithNames(@Param("site") String site, @Param("referenceNo") String referenceNo); IPage> queryProjectMaterialPage(IPage page, @Param("params") Map params); + + List queryMaterialList(@Param("site") String site, @Param("referenceNo") String referenceNo); } diff --git a/src/main/java/com/spring/modules/rohs/service/impl/RohsServiceImpl.java b/src/main/java/com/spring/modules/rohs/service/impl/RohsServiceImpl.java index 650c64be..f6b50b82 100644 --- a/src/main/java/com/spring/modules/rohs/service/impl/RohsServiceImpl.java +++ b/src/main/java/com/spring/modules/rohs/service/impl/RohsServiceImpl.java @@ -353,10 +353,9 @@ public class RohsServiceImpl extends ServiceImpl impleme @Override public PageUtils queryProjectMaterialPage(Map params) { - params.put("testPartNo", toLikeParam((String) params.get("testPartNo"))); - params.put("partDesc", toLikeParam((String) params.get("partDesc"))); params.put("finalPartNo", toLikeParam((String) params.get("finalPartNo"))); - params.put("customerPartNo", toLikeParam((String) params.get("customerPartNo"))); + params.put("partDesc", toLikeParam((String) params.get("partDesc"))); + params.put("partStatus", toLikeParam((String) params.get("partStatus"))); IPage> page = this.baseMapper.queryProjectMaterialPage( new Query>().getPage(params), @@ -370,12 +369,7 @@ public class RohsServiceImpl extends ServiceImpl impleme if (StringUtils.isBlank(site) || StringUtils.isBlank(referenceNo)) { return Collections.emptyList(); } - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("site", site) - .eq("reference_no", referenceNo) - .orderByAsc("line_no") - .orderByAsc("id"); - return rohsMaterialService.list(queryWrapper); + return this.baseMapper.queryMaterialList(site, referenceNo); } @Override @@ -413,10 +407,7 @@ public class RohsServiceImpl extends ServiceImpl impleme entity.setProjectId(StringUtils.isNotBlank(material.getProjectId()) ? material.getProjectId() : rohs.getProjectId()); entity.setTestPartNo(uniqueKey); entity.setFinalPartNo(material.getFinalPartNo()); - entity.setCustomerPartNo(material.getCustomerPartNo()); entity.setPartDesc(material.getPartDesc()); - entity.setPartSpec(material.getPartSpec()); - entity.setRemark(material.getRemark()); saveList.add(entity); } diff --git a/src/main/resources/mapper/rohs/RohsMapper.xml b/src/main/resources/mapper/rohs/RohsMapper.xml index 1526edf0..e54b3b8b 100644 --- a/src/main/resources/mapper/rohs/RohsMapper.xml +++ b/src/main/resources/mapper/rohs/RohsMapper.xml @@ -75,6 +75,18 @@ + + + + + + + + + + + + a.site, a.reference_no, a.applicant, a.application_date, a.process, a.pm, a.planned_mass_production_date, a.color, a.vendor_code, a.vendor_material_code, a.material_classify, a.other_material_classify, a.material_use_for, a.end_customer, a.project_id, a.is_macallan_material, a.need_create_number, a.npd_engineer, a.material_validity_time, a.material_validity_comments, a.need_deviation, a.technical_plan, a.wm_required_spec, a.is_fiber_material, a.material_thickness, a.buyer, a.expect_report_time, a.qualification_documents_needed, a.test_report_including_items, a.remark, a.status, a.sgs_report_number, a.expired_date, a.fiber_information, a.hsf_standard, a.hsf_approver, a.related_people, a.valid_until_value, a.valid_until, a.is_meet_rohs_requirement, a.is_ah_grade, a.hsf_supplier_classification, a.material_desc, a.npd_remark, a.is_same_material_diff_size, a.ifs_part_no, a.comm_group1, a.comm_group2, a.comm_group3, a.create_date, a.create_by, a.update_date, a.update_by, a.step_id, a.reject_flag, a.reject_step_id @@ -149,14 +161,12 @@ a.project_id as projectId, a.test_part_no as testPartNo, a.final_part_no as finalPartNo, - c.customer_part_no as customerPartNo, a.part_desc as partDesc, - a.part_spec as partSpec, + d.part_status as partStatus, b.final_customer_id as finalCustomerId, b.customer_id as customerId from view_Project_Part as a left join plm_project_info as b on a.site = b.site and a.project_id = b.project_id - left join plm_customer_part_info as c on b.site = c.site and b.customer_id = c.customer_no and a.test_part_no = c.part_no left join part as d on a.site = d.site and a.test_part_no = d.part_no where a.site = #{params.site} and d.status = 'Y' @@ -166,19 +176,34 @@ and (b.final_customer_id = #{params.endCustomer} or b.customer_id = #{params.endCustomer}) - - and a.test_part_no like #{params.testPartNo} - and a.part_desc like #{params.partDesc} and a.final_part_no like #{params.finalPartNo} - - and c.customer_part_no like #{params.customerPartNo} + + and d.part_status like #{params.partStatus} order by a.project_id, a.test_part_no + +