diff --git a/src/main/java/com/spring/modules/Tooling/service/impl/ProjectToolingApplyServiceImpl.java b/src/main/java/com/spring/modules/Tooling/service/impl/ProjectToolingApplyServiceImpl.java index 5a17506d..a7cc012a 100644 --- a/src/main/java/com/spring/modules/Tooling/service/impl/ProjectToolingApplyServiceImpl.java +++ b/src/main/java/com/spring/modules/Tooling/service/impl/ProjectToolingApplyServiceImpl.java @@ -103,17 +103,11 @@ public class ProjectToolingApplyServiceImpl implements ProjectToolingApplyServic if(inList.size()==0){ throw new RuntimeException("为选择报价单,请选择报价单!"); } - String projectId="("; - for (int i = 0; i < inList.size(); i++) { - if(i < inList.size()-1){ - projectId+="'"+inList.get(i).getProjectId()+"',"; - }else { - projectId+="'"+inList.get(i).getProjectId()+"'"; - } - } - projectId+=")"; + String projectList = "("; + projectList += inList.stream().map(i -> "'" + i.getProjectId() + "'").collect(Collectors.joining(",")); + projectList += ")"; - List result=projectToolingApplyMapper.getProjectPartToolForApply(inList.get(0).getSite(),projectId); + List result=projectToolingApplyMapper.getProjectPartToolForApply(inList.get(0).getSite(),projectList); return result; } diff --git a/src/main/resources/mapper/Tooling/ProjectToolingApplyMapper.xml b/src/main/resources/mapper/Tooling/ProjectToolingApplyMapper.xml index 7d2e853c..c670f084 100644 --- a/src/main/resources/mapper/Tooling/ProjectToolingApplyMapper.xml +++ b/src/main/resources/mapper/Tooling/ProjectToolingApplyMapper.xml @@ -75,8 +75,8 @@ SELECT b.site, b.project_id, d.part_no, - h.part_desc as partDesc, - h.part_desc as partName, + h.part_desc as partDesc, + h.part_desc as partName, c.routing_revision, c.routing_type, c.alternative_no, @@ -87,21 +87,24 @@ d.tool_qty, d.remark, e.tool_description, - e.standard_cost - ,g.customer_part_no - ,b.final_part_no, + e.standard_cost, + g.customer_part_no + , + b.final_part_no, dbo.plm_get_alternativeDesc(c.site, c.part_no, c.routing_revision, c.routing_type, c.alternative_no) alternativeDescription - FROM plm_project_part b - left join plm_routing_component c on b.site = c.site and b.test_part_no = c.part_no + FROM plm_project_part b + left join plm_routing_component c on b.site = c.site and + (case when isnull(final_part_no, '') is not null then final_part_no else test_part_no end) = c.part_no left join routing_tool d on c.site = d.site and c.part_no = d.part_no and c.routing_revision = d.routing_revision and c.routing_type = d.routing_type and c.operation_id = d.operation_id left join tool_header e on d.site = e.site and d.tool_id = e.tool_id - left join plm_project_info f on b.site=f.site and b.project_id=f.project_id - left join plm_customer_part_info g on b.site=g.site and f.customer_id=g.customer_no and b.test_part_no =g.part_no - left join part h on b.site=h.site and b.test_part_no=h.part_no + left join plm_project_info f on b.site = f.site and b.project_id = f.project_id + left join plm_customer_part_info g + on b.site = g.site and f.customer_id = g.customer_no and b.test_part_no = g.part_no + left join part h on b.site = h.site and b.test_part_no = h.part_no where b.site = #{site} and b.project_id in ${projectId}