You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
210 lines
10 KiB
210 lines
10 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.spring.modules.Tooling.mapper.ProjectToolingApplyMapper">
|
|
<select id="projectInfoForToolApply" parameterType="PlmProjectInfoData" resultType="PlmProjectInfoData">
|
|
SELECT project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
|
|
create_date,update_by,update_date,priority,site,id,project_desc,customer_remark,remark,dbo.get_projectTeamName(site,project_id,'owner') projectOwnerName
|
|
,dbo.get_projectTeamName(site,project_id,'manager') ProjectManagerName,dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
|
|
dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
|
|
dbo.plm_get_customer_desc(site,customer_id) customerName,dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,need_date,
|
|
dbo.get_projectUserRoleName(site,project_id) userRoleName,parent_project_no,
|
|
final_customer_id,dbo.plm_get_customer_desc(site,final_customer_id) finalCustomerName
|
|
FROM plm_project_info
|
|
<where>
|
|
<!-- and dbo.plm_get_projectBaseDesc(status,'project_status') !='未发布'-->
|
|
<!-- <if test="query.id != null">-->
|
|
<!-- AND id = #{query.id}-->
|
|
<!-- </if>-->
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.projectId != null and query.projectId != ''">
|
|
AND project_id like #{query.projectId}
|
|
</if>
|
|
<if test="query.projectType != null and query.projectType != ''">
|
|
AND plm_project_info.project_type_db like #{query.projectType}
|
|
</if>
|
|
<if test="query.projectName != null and query.projectName != ''">
|
|
AND plm_project_info.project_name like #{query.projectName}
|
|
</if>
|
|
<if test="query.projectOwnerName != null and query.projectOwnerName != ''">
|
|
AND dbo.get_projectTeamName(site,project_id,'ProjectOwner') like '%' + #{query.projectOwnerName} +'%'
|
|
</if>
|
|
<!-- <if test="query.userName != null and query.userName != '' and query.userName != 'admin'">-->
|
|
<!-- AND project_id in ( select project_id from AccessProject where site=#{query.site} and username=#{query.userName} and searchFlag='Y' )-->
|
|
<!-- AND bu_no in ( select bu_no from AccessBu where site=#{query.site} and username=#{query.userName})-->
|
|
<!-- </if>-->
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getProjectPartToolForApply" resultType="RoutingToolApplyData">
|
|
SELECT b.site,b.project_id,d.part_no,b.part_desc,c.routing_revision,c.routing_type,c.alternative_no,c.operation_no,c.operation_name,
|
|
d.operation_id,d.tool_id,d.tool_qty,d.remark,e.tool_description,e.standard_cost
|
|
,dbo.plm_get_alternativeDesc(c.site,c.part_no,c.routing_revision,c.routing_type,c.alternative_no) alternativeDescription
|
|
FROM view_Project_Part b
|
|
left join plm_routing_component c on b.site=c.site and b.test_part_no=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
|
|
where b.site=#{site} and b.project_id in ${projectId} and d.tool_id is not null and b.active='Y'
|
|
order by b.project_id,d.part_no,c.routing_revision,c.routing_type,c.alternative_no,c.operation_no
|
|
</select>
|
|
|
|
<insert id="saveApplyHeader">
|
|
INSERT INTO plm_project_tool_applyHeader (site,apply_no,apply_by,status_code,status,apply_date,applySumQty,applyReason,remark,
|
|
create_by,create_date,department,quoter,tp,purchaser)
|
|
values
|
|
(#{site},#{applyNo},#{applyBy},#{statusCode},#{status},#{applyDate},#{applySumQty},#{applyReason},#{remark},#{createBy},
|
|
#{createDate},#{department},#{quoter},#{tp},#{purchaser})
|
|
|
|
</insert>
|
|
|
|
<insert id="saveApplyDetail">
|
|
INSERT INTO plm_project_tool_applyDetail (site,apply_no,seqNo,tool_id,standard_cost,applyQty,remark,orderRef1,orderRef2,orderRef3,orderRef4,orderRef5,orderRef6) values
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site},#{item.applyNo},#{item.seqNo},#{item.toolId},#{item.standardCost},#{item.applyQty},#{item.remark},#{item.orderRef1},
|
|
#{item.orderRef2},#{item.orderRef3},#{item.orderRef4},#{item.orderRef5},#{item.orderRef6})
|
|
</foreach>
|
|
|
|
|
|
</insert>
|
|
<update id="updateRoutingToolRequireFlag">
|
|
|
|
update routing_tool set ApplyFlag='Y' from plm_project_tool_applyDetail b
|
|
where b.site=#{site} and b.apply_no=#{newApplyNo}
|
|
and routing_tool.site=b.Site and routing_tool.part_no=b.orderRef2 and CONVERT(varchar(20),routing_tool.routing_revision) =b.orderRef3 and
|
|
routing_tool.routing_type=b.orderRef4 and routing_tool.alternative_no=b.orderRef5
|
|
and CONVERT(varchar(20), routing_tool.operation_id)=b.orderRef6
|
|
</update>
|
|
|
|
<select id="searchToolApplyHeader" resultType="PlmProjectToolApplyHeaderData">
|
|
SELECT site,apply_no,apply_by,status_code,status,apply_date,applySumQty,applyReason,remark,create_by,create_date,update_by,
|
|
update_date,prNo,remark1,poNo,allCost,remark2,supplierName,department,dbo.plm_get_dictDataLabel('tool_application_department',department,site) departmentDesc
|
|
,tp,dbo.get_userDisPlay(tp) tpName ,quoter,dbo.get_userDisPlay(quoter) quoterName ,purchaser,dbo.get_userDisPlay(purchaser) purchaserName,step_id
|
|
,reject_flag ,reject_step_id
|
|
FROM plm_project_tool_applyHeader
|
|
<where>
|
|
|
|
<if test="query.site != null and query.site != ''">
|
|
AND site = #{query.site}
|
|
</if>
|
|
<if test="query.applyNo != null and query.applyNo != ''">
|
|
AND apply_no like #{query.applyNo}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND apply_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= apply_date
|
|
</if>
|
|
|
|
<!-- <if test="query.projectOwnerName != null and query.projectOwnerName != ''">-->
|
|
<!-- AND dbo.get_projectTeamName(site,project_id,'ProjectOwner') like '%' + #{query.projectOwnerName} +'%'-->
|
|
<!-- </if>-->
|
|
<!-- <if test="query.userName != null and query.userName != '' and query.userName != 'admin'">-->
|
|
<!-- AND project_id in ( select project_id from AccessProject where site=#{query.site} and username=#{query.userName} and searchFlag='Y' )-->
|
|
<!-- AND bu_no in ( select bu_no from AccessBu where site=#{query.site} and username=#{query.userName})-->
|
|
<!-- </if>-->
|
|
</where>
|
|
</select>
|
|
|
|
<select id="searchToolApplyDetail" resultType="PlmProjectToolApplyDetailData">
|
|
select a.site,a.apply_no,a.seqNo,a.tool_id,a.standard_cost,a.applyQty,a.remark,a.orderRef1,a.orderRef2,a.orderRef3,a.orderRef4,
|
|
a.orderRef5,dbo.plm_get_toolDesc(a.site,a.tool_id) toolDesc,a.orderRef6,b.operation_no,b.operation_name
|
|
from plm_project_tool_applyDetail a left join plm_routing_component b on a.site=b.site and a.orderRef6=convert(varchar(20),b.operation_id)
|
|
<where>
|
|
<if test="site != null and site != ''">
|
|
AND a.site = #{site}
|
|
</if>
|
|
<if test="applyNo != null and applyNo != ''">
|
|
AND a.apply_no = #{applyNo}
|
|
</if>
|
|
<if test="orderRef1 != null and orderRef1 != ''">
|
|
AND a.orderRef1 = #{orderRef1}
|
|
</if>
|
|
</where>
|
|
order by a.apply_no, a.seqNo
|
|
</select>
|
|
|
|
<select id="checkToolApplyHeaderData" resultType="PlmProjectToolApplyHeaderData">
|
|
select
|
|
site,
|
|
apply_no,
|
|
apply_by,
|
|
status_code,
|
|
status,
|
|
apply_date,
|
|
applySumQty,
|
|
applyReason,
|
|
remark,
|
|
create_by,
|
|
create_date,
|
|
update_by,
|
|
update_date,
|
|
prNo,
|
|
remark1,
|
|
poNo,
|
|
allCost,
|
|
remark2,
|
|
supplierName,
|
|
step_id,
|
|
reject_flag,
|
|
reject_step_id
|
|
,tp,dbo.get_userDisPlay(tp) tpName ,quoter,dbo.get_userDisPlay(quoter) quoterName ,purchaser,dbo.get_userDisPlay(purchaser) purchaserName
|
|
FROM plm_project_tool_applyHeader
|
|
where site = #{site} and apply_no = #{applyNo}
|
|
</select>
|
|
|
|
<update id="comfirmToolApply">
|
|
update plm_project_tool_applyHeader
|
|
set status_code = #{statusCode},
|
|
status = #{status}
|
|
where site = #{site} and apply_no = #{applyNo}
|
|
</update>
|
|
|
|
<delete id="deletetoolingApplyHeader">
|
|
delete from plm_project_tool_applyHeader where site=#{site} and apply_no=#{applyNo}
|
|
</delete>
|
|
<delete id="deletetoolingApplyDetail">
|
|
delete from plm_project_tool_applyDetail where site=#{site} and apply_no=#{applyNo}
|
|
</delete>
|
|
<update id="saveHeaderMessage">
|
|
update plm_project_tool_applyHeader set prNo=#{prNo},remark1=#{remark1},poNo=#{poNo},
|
|
allCost=#{allCost},remark2=#{remark2},supplierName=#{supplierName} where site=#{site} and apply_no=#{applyNo}
|
|
</update>
|
|
|
|
<update id="updateApplyHeader">
|
|
update plm_project_tool_applyHeader
|
|
set applySumQty = #{applySumQty},
|
|
applyReason = #{applyReason},
|
|
remark = #{remark},
|
|
tp=#{tp},
|
|
quoter=#{quoter},
|
|
purchaser=#{purchaser}
|
|
where site = #{site} and apply_no = #{applyNo}
|
|
</update>
|
|
|
|
<update id="updateApplyDetail">
|
|
update plm_project_tool_applyDetail set applyQty=#{applyQty} where site=#{site} and apply_no=#{applyNo} and seqNo=#{seqNo}
|
|
</update>
|
|
|
|
<select id="getProjectPartToolDetail" resultType="PlmProjectToolApplyDetailData">
|
|
select
|
|
site,
|
|
apply_no,
|
|
seqNo,
|
|
tool_id,
|
|
standard_cost,
|
|
applyQty,
|
|
remark,
|
|
orderRef1,
|
|
orderRef2,
|
|
orderRef3,
|
|
orderRef4,
|
|
orderRef5,
|
|
unit_cost,
|
|
orderRef6
|
|
FROM plm_project_tool_applyDetail
|
|
where site = #{site} and apply_no = #{applyNo}
|
|
</select>
|
|
</mapper>
|