Browse Source

2026-05-12

RoHs功能优化
master
fengyuan_yang 1 month ago
parent
commit
0f836a8912
  1. 26
      src/main/java/com/spring/modules/rohs/controller/RohsController.java
  2. 57
      src/main/java/com/spring/modules/rohs/entity/RohsEntity.java
  3. 73
      src/main/resources/mapper/rohs/RohsMapper.xml

26
src/main/java/com/spring/modules/rohs/controller/RohsController.java

@ -82,6 +82,7 @@ public class RohsController {
if (StringUtils.isBlank(rohs.getSite()) || StringUtils.isBlank(rohs.getReferenceNo())) {
return R.error("工厂(site)和序列号(referenceNo)不能为空");
}
String currentUserName = getCurrentUserName();
String originalReferenceNo = rohs.getReferenceNo();
String newReferenceNo = originalReferenceNo;
@ -121,6 +122,18 @@ public class RohsController {
if (StringUtils.isBlank(rohs.getStatus())) {
rohs.setStatus("草稿");
}
if (rohs.getCreateDate() == null) {
rohs.setCreateDate(new Date());
}
if (StringUtils.isBlank(rohs.getCreateBy())) {
rohs.setCreateBy(currentUserName);
}
if (rohs.getStepId() == null) {
rohs.setStepId(10);
}
if (StringUtils.isBlank(rohs.getRejectFlag())) {
rohs.setRejectFlag("N");
}
if (rohs.getMaterialList() != null) {
if (!rohs.getMaterialList().isEmpty()) {
rohs.setIfsPartNo(rohs.getMaterialList().get(0).getTestPartNo());
@ -142,6 +155,7 @@ public class RohsController {
if (StringUtils.isBlank(rohs.getSite()) || StringUtils.isBlank(rohs.getReferenceNo())) {
return R.error("工厂(site)和序列号(referenceNo)不能为空");
}
String currentUserName = getCurrentUserName();
RohsEntity exists = rohsService.getDetail(rohs.getSite(), rohs.getReferenceNo());
if (exists == null) {
return R.error("未找到对应RoHs单据");
@ -152,6 +166,10 @@ public class RohsController {
if (StringUtils.isBlank(rohs.getStatus())) {
rohs.setStatus(exists.getStatus());
}
rohs.setUpdateDate(new Date());
if (StringUtils.isBlank(rohs.getUpdateBy())) {
rohs.setUpdateBy(currentUserName);
}
QueryWrapper<RohsEntity> updateWrapper = new QueryWrapper<>();
updateWrapper.eq("site", rohs.getSite()).eq("reference_no", rohs.getReferenceNo());
@ -177,6 +195,7 @@ public class RohsController {
if (StringUtils.isBlank(rohs.getSite()) || StringUtils.isBlank(rohs.getReferenceNo())) {
return R.error("工厂(site)和序列号(referenceNo)不能为空");
}
String currentUserName = getCurrentUserName();
RohsEntity exists = rohsService.getDetail(rohs.getSite(), rohs.getReferenceNo());
if (exists == null) {
return R.error("未找到对应RoHs单据");
@ -193,6 +212,8 @@ public class RohsController {
} else {
updateEntity.setIfsPartNo(null);
}
updateEntity.setUpdateDate(new Date());
updateEntity.setUpdateBy(currentUserName);
QueryWrapper<RohsEntity> updateWrapper = new QueryWrapper<>();
updateWrapper.eq("site", rohs.getSite()).eq("reference_no", rohs.getReferenceNo());
rohsService.update(updateEntity, updateWrapper);
@ -281,4 +302,9 @@ public class RohsController {
return R.ok();
}
private String getCurrentUserName() {
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
return user == null ? "" : user.getUsername();
}
}

57
src/main/java/com/spring/modules/rohs/entity/RohsEntity.java

@ -256,6 +256,63 @@ public class RohsEntity implements Serializable {
*/
private String commGroup3;
/**
* 创建时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createDate;
/**
* 创建人
*/
private String createBy;
/**
* 修改时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateDate;
/**
* 修改人
*/
private String updateBy;
/**
* 流程步骤
*/
private Integer stepId;
/**
* 驳回标识
*/
private String rejectFlag;
/**
* 驳回步骤
*/
private Integer rejectStepId;
/**
* 当前节点ID
*/
@TableField(exist = false)
private String nodeId;
/**
* 当前节点名称
*/
@TableField(exist = false)
private String nodeName;
/**
* 当前节点审批人
*/
@TableField(exist = false)
private String currentApprover;
/**
* 申请人名称
*/

73
src/main/resources/mapper/rohs/RohsMapper.xml

@ -50,6 +50,16 @@
<result column="comm_group1" property="commGroup1" />
<result column="comm_group2" property="commGroup2" />
<result column="comm_group3" property="commGroup3" />
<result column="create_date" property="createDate" />
<result column="create_by" property="createBy" />
<result column="update_date" property="updateDate" />
<result column="update_by" property="updateBy" />
<result column="step_id" property="stepId" />
<result column="reject_flag" property="rejectFlag" />
<result column="reject_step_id" property="rejectStepId" />
<result column="nodeId" property="nodeId" />
<result column="nodeName" property="nodeName" />
<result column="currentApprover" property="currentApprover" />
<result column="applicantName" property="applicantName" />
<result column="pmName" property="pmName" />
<result column="npdEngineerName" property="npdEngineerName" />
@ -64,7 +74,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
site, reference_no, applicant, application_date, process, pm, planned_mass_production_date, color, vendor_code, vendor_material_code, material_classify, other_material_classify, material_use_for, end_customer, project_id, is_macallan_material, need_create_number, npd_engineer, material_validity_time, material_validity_comments, need_deviation, technical_plan, wm_required_spec, is_fiber_material, material_thickness, buyer, expect_report_time, qualification_documents_needed, test_report_including_items, remark, status, sgs_report_number, expired_date, fiber_information, hsf_standard, valid_until, is_meet_rohs_requirement, is_ah_grade, hsf_supplier_classification, material_desc, npd_remark, is_same_material_diff_size, ifs_part_no, comm_group1, comm_group2, comm_group3
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.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
</sql>
<select id="getApprovalList" resultType="com.spring.modules.change.vo.ProcessFormVo">
@ -74,46 +84,51 @@
<select id="queryPageWithNames" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
dbo.get_userDisPlay(applicant) as applicantName,
dbo.get_userDisPlay(pm) as pmName,
dbo.get_userDisPlay(npd_engineer) as npdEngineerName,
dbo.get_userDisPlay(technical_plan) as technicalPlanName,
dbo.get_userDisPlay(buyer) as buyerName,
dbo.plm_get_customer_desc(site, end_customer) as endCustomerName,
dbo.plm_get_project_name(site, project_id) as projectName,
dbo.get_product_group_name(site, comm_group1, '1') as commGroup1Desc,
dbo.get_product_group_name(site, comm_group2, '2') as commGroup2Desc,
dbo.get_product_group_name(site, comm_group3, '3') as commGroup3Desc
from plm_rohs
d.node_id as nodeId,
d.node_name as nodeName,
dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.reference_no) as currentApprover,
dbo.get_userDisPlay(a.applicant) as applicantName,
dbo.get_userDisPlay(a.pm) as pmName,
dbo.get_userDisPlay(a.npd_engineer) as npdEngineerName,
dbo.get_userDisPlay(a.technical_plan) as technicalPlanName,
dbo.get_userDisPlay(a.buyer) as buyerName,
dbo.plm_get_customer_desc(a.site, a.end_customer) as endCustomerName,
dbo.plm_get_project_name(a.site, a.project_id) as projectName,
dbo.get_product_group_name(a.site, a.comm_group1, '1') as commGroup1Desc,
dbo.get_product_group_name(a.site, a.comm_group2, '2') as commGroup2Desc,
dbo.get_product_group_name(a.site, a.comm_group3, '3') as commGroup3Desc
from plm_rohs a
left join plm_request_header prh on a.site = prh.site and prh.menu_id = #{params.menuId} and prh.status = 'Y'
left join plm_request_node d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
where 1 = 1
<if test="params.site != null and params.site != ''">
and site = #{params.site}
and a.site = #{params.site}
</if>
<if test="params.referenceNo != null and params.referenceNo != ''">
and reference_no like #{params.referenceNo}
and a.reference_no like #{params.referenceNo}
</if>
<if test="params.applicant != null and params.applicant != ''">
and applicant like #{params.applicant}
and a.applicant like #{params.applicant}
</if>
order by application_date desc
order by a.application_date desc
</select>
<select id="getDetailWithNames" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>,
dbo.get_userDisPlay(applicant) as applicantName,
dbo.get_userDisPlay(pm) as pmName,
dbo.get_userDisPlay(npd_engineer) as npdEngineerName,
dbo.get_userDisPlay(technical_plan) as technicalPlanName,
dbo.get_userDisPlay(buyer) as buyerName,
dbo.plm_get_customer_desc(site, end_customer) as endCustomerName,
dbo.plm_get_project_name(site, project_id) as projectName,
dbo.get_product_group_name(site, comm_group1, '1') as commGroup1Desc,
dbo.get_product_group_name(site, comm_group2, '2') as commGroup2Desc,
dbo.get_product_group_name(site, comm_group3, '3') as commGroup3Desc
from plm_rohs
where site = #{site}
and reference_no = #{referenceNo}
dbo.get_userDisPlay(a.applicant) as applicantName,
dbo.get_userDisPlay(a.pm) as pmName,
dbo.get_userDisPlay(a.npd_engineer) as npdEngineerName,
dbo.get_userDisPlay(a.technical_plan) as technicalPlanName,
dbo.get_userDisPlay(a.buyer) as buyerName,
dbo.plm_get_customer_desc(a.site, a.end_customer) as endCustomerName,
dbo.plm_get_project_name(a.site, a.project_id) as projectName,
dbo.get_product_group_name(a.site, a.comm_group1, '1') as commGroup1Desc,
dbo.get_product_group_name(a.site, a.comm_group2, '2') as commGroup2Desc,
dbo.get_product_group_name(a.site, a.comm_group3, '3') as commGroup3Desc
from plm_rohs a
where a.site = #{site}
and a.reference_no = #{referenceNo}
</select>
<select id="queryProjectMaterialPage" resultType="java.util.HashMap">

Loading…
Cancel
Save