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.
1835 lines
75 KiB
1835 lines
75 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.part.mapper.RoutingManagementMapper">
|
|
|
|
<!-- 材料信息列表 -->
|
|
<select id="routingManagementSearch" parameterType="com.spring.modules.part.vo.RoutingHeaderVo" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
b.part_desc as partDesc,
|
|
a.routing_revision,
|
|
a.routing_type,
|
|
a.note_text,
|
|
a.phase_in_date,
|
|
a.phase_out_date,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.um_id as printUnit,
|
|
c.um_name as printUnitName,
|
|
b.ifs_part_no,
|
|
b.plm_part_no
|
|
FROM plm_routing_header as a
|
|
left join part as b on a.site = b.site and a.part_no = b.part_no
|
|
left join um as c on b.um_id = c.um_id
|
|
<where>
|
|
a.site = #{query.site}
|
|
AND b.show_in_query_flag = 'Y'
|
|
<if test = "query.plmPartNo != null and query.plmPartNo != ''">
|
|
AND b.plm_part_no like #{query.plmPartNo}
|
|
</if>
|
|
<if test = "query.ifsPartNo != null and query.ifsPartNo != ''">
|
|
AND b.ifs_part_no like #{query.ifsPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND b.part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.routingType != null and query.routingType != ''">
|
|
AND a.routing_type = #{query.routingType}
|
|
</if>
|
|
<if test = "query.routingRevision != null and query.routingRevision != ''">
|
|
AND a.routing_revision like #{query.routingRevision}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询物料清单 -->
|
|
<select id="queryPartList" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.part_desc,
|
|
a.spec,
|
|
a.um_id as printUnit,
|
|
b.um_name as printUnitName,
|
|
a.part_type,
|
|
a.plm_part_no,
|
|
a.ifs_part_no
|
|
FROM part as a
|
|
left join um as b on a.um_id = b.um_id
|
|
<where>
|
|
a.site = #{query.site}
|
|
and a.part_type in ('Manufactured', 'Manufactured Recipe')
|
|
and a.active = 'Y' and a.show_in_query_flag = 'Y'
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no = #{query.partNo}
|
|
</if>
|
|
<if test = "query.plmPartNo != null and query.plmPartNo != ''">
|
|
AND a.plm_part_no = #{query.plmPartNo}
|
|
</if>
|
|
<if test = "query.ifsPartNo != null and query.ifsPartNo != ''">
|
|
AND a.ifs_part_no = #{query.ifsPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查出可创建Routing的物料 -->
|
|
<select id="queryPartListRouting" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.part_desc,
|
|
a.spec,
|
|
a.um_id as printUnit,
|
|
b.um_name as printUnitName,
|
|
a.part_type,
|
|
a.plm_part_no,
|
|
a.ifs_part_no
|
|
FROM part as a
|
|
left join um as b on a.um_id = b.um_id
|
|
<where>
|
|
a.site = #{query.site} and a.active = 'Y' and a.show_in_query_flag = 'Y'
|
|
and a.part_type in ('Manufactured', 'Manufactured Recipe')
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no = #{query.partNo}
|
|
</if>
|
|
<if test = "query.plmPartNo != null and query.plmPartNo != ''">
|
|
AND a.plm_part_no = #{query.plmPartNo}
|
|
</if>
|
|
<if test = "query.ifsPartNo != null and query.ifsPartNo != ''">
|
|
AND a.ifs_part_no = #{query.ifsPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND a.part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 新增Routing主表内容 -->
|
|
<insert id="saveRoutingHeader" parameterType="RoutingHeaderEntity">
|
|
INSERT INTO plm_routing_header
|
|
(site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy}, #{officialFlag})
|
|
</insert>
|
|
|
|
<!-- routing明细新增 -->
|
|
<insert id="routingDetailSave" parameterType="RoutingDetailEntity">
|
|
INSERT INTO plm_routing_detail
|
|
(site, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status, official_flag)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status}, #{officialFlag})
|
|
</insert>
|
|
|
|
<!-- 新增Routing子明细表内容 -->
|
|
<insert id="saveRoutingComponent" parameterType="RoutingComponentEntity" useGeneratedKeys="true" keyProperty="operationId">
|
|
INSERT INTO plm_routing_component
|
|
(site, part_no, routing_revision, routing_type, alternative_no, operation_name, operation_no, efficiency_factor, mach_run_factor, mach_setup_time, run_time_code, labor_run_factor, labor_setup_time, crew_size, setup_crew_size, outside_op_item, machine_no, work_center_no, labor_class_no, setup_labor_class_no, overlap, note_text, create_date, create_by, ifs_row_id, ifs_row_version)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationName}, #{operationNo}, #{efficiencyFactor}, #{machRunFactor}, #{machSetupTime}, #{runTimeCode}, #{laborRunFactor}, #{laborSetupTime}, #{crewSize}, #{setupCrewSize}, #{outsideOpItem}, #{machineNo}, #{workCenterNo}, #{laborClassNo}, #{setupLaborClassNo}, #{overlap}, #{noteText}, getDate(), #{createBy}, #{ifsRowId}, #{ifsRowVersion})
|
|
</insert>
|
|
|
|
<!-- 新增Routing子明细表内容 -->
|
|
<insert id="saveRoutingComponents">
|
|
insert into plm_routing_component
|
|
(site, part_no, routing_revision, routing_type, alternative_no, operation_name, operation_no, efficiency_factor, mach_run_factor, mach_setup_time, run_time_code, labor_run_factor, labor_setup_time, crew_size, setup_crew_size, outside_op_item, machine_no, work_center_no, labor_class_no, setup_labor_class_no, overlap, note_text, create_date, create_by, ifs_row_id, ifs_row_version) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationName}, #{item.operationNo}, #{item.efficiencyFactor}, #{item.machRunFactor}, #{item.machSetupTime}, #{item.runTimeCode}, #{item.laborRunFactor}, #{item.laborSetupTime}, #{item.crewSize}, #{item.setupCrewSize}, #{item.outsideOpItem}, #{item.machineNo}, #{item.workCenterNo}, #{item.laborClassNo}, #{item.setupLaborClassNo}, #{item.overlap}, #{item.noteText}, getDate(), #{item.createBy}, #{item.ifsRowId}, #{item.ifsRowVersion})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查routing明细 -->
|
|
<select id="queryRoutingDetail" parameterType="RoutingHeaderEntity" resultType="RoutingDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
alternative_description,
|
|
rout_template_id,
|
|
plan_date,
|
|
fixed_lead_time_day,
|
|
fixed_lead_time_hour,
|
|
variable_lead_time_day,
|
|
variable_lead_time_hour,
|
|
for_std_lot_by_day,
|
|
for_lot_by_day,
|
|
min_lot_qty,
|
|
note_text as detailNoteText,
|
|
status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
|
|
</select>
|
|
|
|
<!-- 查routing明细对象 -->
|
|
<select id="queryDetailDataByNo" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
alternative_description,
|
|
rout_template_id,
|
|
plan_date,
|
|
fixed_lead_time_day,
|
|
fixed_lead_time_hour,
|
|
variable_lead_time_day,
|
|
variable_lead_time_hour,
|
|
for_std_lot_by_day,
|
|
for_lot_by_day,
|
|
min_lot_qty,
|
|
note_text as detailNoteText,
|
|
status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 查routing子明细 -->
|
|
<select id="queryRoutingComponent" parameterType="RoutingDetailEntity" resultType="com.spring.modules.part.vo.RoutingComponentVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.routing_type,
|
|
a.routing_revision,
|
|
a.alternative_no,
|
|
a.operation_id,
|
|
a.operation_no,
|
|
a.operation_name,
|
|
a.efficiency_factor,
|
|
a.mach_run_factor,
|
|
a.mach_setup_time,
|
|
a.run_time_code,
|
|
case when a.run_time_code = 'Units/Hour' then '单位/小时'
|
|
when a.run_time_code = 'Hours/Unit' then '小时/单位'
|
|
when a.run_time_code = 'Hours' then '小时'
|
|
else '' end as runTimeCodeDesc,
|
|
a.labor_run_factor,
|
|
a.labor_setup_time,
|
|
a.crew_size,
|
|
a.setup_crew_size,
|
|
a.outside_op_item,
|
|
a.machine_no,
|
|
a.work_center_no,
|
|
b.work_center_desc,
|
|
b.work_center_type,
|
|
a.labor_class_no,
|
|
dbo.get_labor_class_desc(a.site, a.labor_class_no) as laborClassDesc,
|
|
a.setup_labor_class_no,
|
|
dbo.get_labor_class_desc(a.site, a.setup_labor_class_no) as setupLaborClassDesc,
|
|
a.overlap,
|
|
a.note_text,
|
|
a.ifs_row_id,
|
|
a.ifs_row_version
|
|
FROM plm_routing_component as a
|
|
LEFT JOIN work_center as b on a.site = b.site and a.work_center_no = b.work_center_no
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
|
|
order by a.operation_no
|
|
</select>
|
|
|
|
<!-- routing主表编辑 -->
|
|
<update id="updateRoutingHeader" parameterType="RoutingAllFieldEntity">
|
|
update plm_routing_header
|
|
set phase_in_date = #{phaseInDate},
|
|
phase_out_date = #{phaseOutDate},
|
|
note_text = #{noteText},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</update>
|
|
|
|
<!-- routing明细表编辑 -->
|
|
<update id="updateRoutingDetail" parameterType="RoutingDetailEntity">
|
|
update plm_routing_detail
|
|
set alternative_description = #{alternativeDescription},
|
|
rout_template_id = #{routTemplateId},
|
|
plan_date = #{planDate},
|
|
fixed_lead_time_day = #{fixedLeadTimeDay},
|
|
fixed_lead_time_hour = #{fixedLeadTimeHour},
|
|
variable_lead_time_day = #{variableLeadTimeDay},
|
|
variable_lead_time_hour = #{variableLeadTimeHour},
|
|
for_std_lot_by_day = #{forStdLotByDay},
|
|
for_lot_by_day = #{forLotByDay},
|
|
min_lot_qty = #{minLotQty},
|
|
note_text = #{detailNoteText},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
status = #{status}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 删除routing子明细 -->
|
|
<delete id="deleteRoutingComponent" parameterType="RoutingAllFieldEntity">
|
|
delete from plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<!-- 删除替代 -->
|
|
<delete id="routingDetailDelete" parameterType="RoutingDetailEntity">
|
|
delete from plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<!-- routing主表查重 -->
|
|
<select id="checkRoutingOnlyOne" parameterType="RoutingAllFieldEntity" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
dbo.get_part_name(site, part_no) as partDesc,
|
|
routing_type,
|
|
routing_revision,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
note_text,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
|
|
</select>
|
|
|
|
<!-- routing明细查重 -->
|
|
<select id="checkRoutingDetailOnlyOne" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
alternative_description,
|
|
rout_template_id,
|
|
plan_date,
|
|
fixed_lead_time_day,
|
|
fixed_lead_time_hour,
|
|
variable_lead_time_day,
|
|
variable_lead_time_hour,
|
|
for_std_lot_by_day,
|
|
for_lot_by_day,
|
|
min_lot_qty,
|
|
note_text as detailNoteText,
|
|
row_key,
|
|
row_version,
|
|
status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 批量删除子明细物料 -->
|
|
<delete id="deleteRoutingComponents" parameterType="RoutingComponentEntity">
|
|
delete from plm_routing_component
|
|
where site = #{site}
|
|
and part_no = #{partNo}
|
|
and routing_revision = #{routingRevision}
|
|
and routing_type = #{routingType}
|
|
and alternative_no = #{alternativeNo}
|
|
and operation_id = #{operationId}
|
|
</delete>
|
|
|
|
<!-- 删除routing子明细 -->
|
|
<delete id="deleteRoutingComponentByPartNo" parameterType="RoutingHeaderEntity">
|
|
delete from plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</delete>
|
|
|
|
<!-- 删除routing明细 -->
|
|
<delete id="deleteRoutingDetailByPartNo" parameterType="RoutingHeaderEntity">
|
|
delete from plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</delete>
|
|
|
|
<!-- 删除routing主记录 -->
|
|
<delete id="deleteRoutingHeaderByPartNo" parameterType="RoutingHeaderEntity">
|
|
delete from plm_routing_header
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</delete>
|
|
|
|
<!-- routing明细查重 -->
|
|
<select id="checkRoutingComponentOnlyOne" parameterType="RoutingComponentEntity" resultType="RoutingComponentEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_no = #{operationNo}
|
|
</select>
|
|
|
|
<!-- 修改routing子明细 -->
|
|
<update id="updateRoutingComponent" parameterType="RoutingComponentEntity">
|
|
update plm_routing_component
|
|
set efficiency_factor = #{efficiencyFactor},
|
|
mach_run_factor = #{machRunFactor},
|
|
mach_setup_time = #{machSetupTime},
|
|
run_time_code = #{runTimeCode},
|
|
labor_run_factor = #{laborRunFactor},
|
|
labor_setup_time = #{laborSetupTime},
|
|
crew_size = #{crewSize},
|
|
setup_crew_size = #{setupCrewSize},
|
|
outside_op_item = #{outsideOpItem},
|
|
machine_no = #{machineNo},
|
|
work_center_no = #{workCenterNo},
|
|
labor_class_no = #{laborClassNo},
|
|
setup_labor_class_no = #{setupLaborClassNo},
|
|
overlap = #{overlap},
|
|
note_text = #{noteText},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
operation_no = #{operationNo},
|
|
operation_name = #{operationName},
|
|
ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</update>
|
|
|
|
<!-- 查询工序清单 -->
|
|
<select id="queryOperationList" parameterType="OperationEntity" resultType="OperationEntity">
|
|
SELECT
|
|
site,
|
|
operation_id,
|
|
operation_name,
|
|
work_center_no
|
|
FROM dbo.operation
|
|
<where>
|
|
site = #{site}
|
|
<if test = "operationId != null and operationId != ''">
|
|
AND operation_id like #{operationId}
|
|
</if>
|
|
<if test = "operationName != null and operationName != ''">
|
|
AND operation_name like #{operationName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 修改替代状态 -->
|
|
<update id="updateAlternativeStatus" parameterType="RoutingDetailEntity">
|
|
update plm_routing_detail
|
|
set status = #{status},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 判断是否已有该物料的 routing -->
|
|
<select id="queryPartRouting" parameterType="RoutingAllFieldEntity" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
|
|
SELECT top 1
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
note_text,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
|
|
</select>
|
|
|
|
<!-- 判断该 routing 是否有 Buildable Obsolete 状态的替代 -->
|
|
<select id="queryAlternativeStatus" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingDetailVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
status
|
|
FROM plm_routing_detail
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and (status = 'Buildable' or status = 'Obsolete')
|
|
</select>
|
|
|
|
<!-- 判断该 routing 是否有正式的替代 -->
|
|
<select id="queryOfficialRoutingDetail" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingDetailVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and official_flag = 'Y'
|
|
</select>
|
|
|
|
<!-- 判断 routing 是否存在子料 -->
|
|
<select id="queryComponentPart" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
operation_id
|
|
FROM plm_routing_component
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</select>
|
|
|
|
<!-- 判断工序是否被引用 -->
|
|
<select id="checkOperatorIsUse" parameterType="RoutingComponentEntity" resultType="com.spring.modules.part.vo.BomComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
component_part
|
|
FROM plm_bom_component
|
|
WHERE site = #{site} and part_no = #{partNo} and operation_id = #{operationId}
|
|
</select>
|
|
|
|
<!-- 获取ifs header 对象-->
|
|
<select id="getRoutingHeader" parameterType="RoutingDetailEntity" resultType="RoutingIfsHeader">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
note_text,
|
|
'add' as histType
|
|
FROM plm_routing_header
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</select>
|
|
|
|
|
|
<!-- 获取ifs component 对象-->
|
|
<select id="getRoutingComponent" parameterType="RoutingDetailEntity" resultType="RoutingIfsItem">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no,
|
|
operation_name as operationDesc,
|
|
work_center_no,
|
|
efficiency_factor,
|
|
mach_setup_time,
|
|
mach_run_factor,
|
|
run_time_code,
|
|
labor_run_factor,
|
|
labor_setup_time,
|
|
crew_size,
|
|
setup_crew_size,
|
|
machine_no,
|
|
note_text,
|
|
case when outside_op_item is null then '' else outside_op_item end as outsideOpItem,
|
|
labor_class_no,
|
|
setup_labor_class_no,
|
|
case when overlap is null then '' else overlap end as overlap,
|
|
ifs_row_id,
|
|
ifs_row_version
|
|
FROM plm_routing_component
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取ifs component 对象-->
|
|
<select id="searchRoutingTools" parameterType="RoutingToolEntity" resultType="com.spring.modules.part.vo.RoutingToolVo">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.part_no,
|
|
a.routing_revision,
|
|
a.routing_type,
|
|
a.alternative_no,
|
|
dbo.plm_get_alternativeDesc(a.site, a.part_no, a.routing_revision, a.routing_type, a.alternative_no) as alternativeDescription,
|
|
a.operation_id,
|
|
b.operation_no,
|
|
b.operation_name,
|
|
a.tool_id,
|
|
dbo.plm_get_toolDesc(a.site, a.tool_id) as toolDescription,
|
|
a.tool_qty,
|
|
a.remark,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.ifs_row_id,
|
|
a.ifs_row_version
|
|
FROM routing_tool as a
|
|
left join plm_routing_component as b on a.operation_id = b.operation_id
|
|
WHERE a.site = #{site} and a.part_no = #{partNo} and a.routing_revision = #{routingRevision} and a.routing_type = #{routingType}
|
|
</select>
|
|
|
|
<!-- 新增 routingTools -->
|
|
<insert id="routingToolSave" parameterType="com.spring.modules.part.vo.RoutingToolVo" keyProperty="id" useGeneratedKeys="true">
|
|
INSERT INTO routing_tool
|
|
(site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationId}, #{toolId}, #{toolQty}, #{remark}, getDate(), #{createBy})
|
|
</insert>
|
|
|
|
<!-- 根据替代查询工序列表 -->
|
|
<select id="queryOperationListByAlternative" parameterType="OperationEntity" resultType="OperationEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no,
|
|
operation_name
|
|
FROM plm_routing_component
|
|
<where>
|
|
site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
<if test = "operationNo != null and operationNo != ''">
|
|
AND operation_no = #{operationNo}
|
|
</if>
|
|
<if test = "operationName != null and operationName != ''">
|
|
AND operation_name like #{operationName}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据替代查询工序列表 -->
|
|
<select id="queryAlternativeListByPartNo" parameterType="AlternativeEntity" resultType="AlternativeEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
alternative_description
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</select>
|
|
|
|
<!-- 编辑 routingTools -->
|
|
<update id="routingToolEdit" parameterType="RoutingToolEntity">
|
|
update routing_tool
|
|
set tool_qty = #{toolQty},
|
|
remark = #{remark},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
|
|
</update>
|
|
|
|
<!-- 删除 routingTools -->
|
|
<delete id="deleteRoutingTool" parameterType="RoutingToolEntity">
|
|
delete from routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
|
|
</delete>
|
|
|
|
<select id="routingAllInfoSearch" parameterType="com.spring.modules.part.vo.RoutingHeaderVo" resultType="com.spring.modules.part.vo.RoutingInfoVo">
|
|
select
|
|
a.site,
|
|
a.part_no,
|
|
e.part_desc partDesc,
|
|
dbo.get_um_name(e.um_id) printUnitName,
|
|
a.routing_revision,
|
|
a.routing_type,
|
|
a.phase_in_date,
|
|
a.phase_out_date,
|
|
a.note_text,
|
|
b.alternative_no,
|
|
b.alternative_description,
|
|
b.rout_template_id,
|
|
b.plan_date,
|
|
b.fixed_lead_time_day,
|
|
b.fixed_lead_time_hour,
|
|
b.variable_lead_time_day,
|
|
b.variable_lead_time_hour,
|
|
b.for_std_lot_by_day,
|
|
b.for_lot_by_day,
|
|
b.min_lot_qty,
|
|
b.note_text alternativeNoteText,
|
|
b.status,
|
|
c.operation_no,
|
|
c.efficiency_factor,
|
|
c.mach_run_factor,
|
|
c.mach_setup_time,
|
|
c.run_time_code,
|
|
case when c.run_time_code = 'Units/Hour' then '单位/小时'
|
|
when c.run_time_code = 'Hours/Unit' then '小时/单位'
|
|
when c.run_time_code = 'Hours' then '小时'
|
|
else '' end as runTimeCodeDesc,
|
|
c.labor_run_factor,
|
|
c.labor_setup_time,
|
|
c.crew_size,
|
|
c.setup_crew_size,
|
|
c.outside_op_item,
|
|
c.machine_no,
|
|
c.work_center_no,
|
|
dbo.get_workCenter_desc(a.site,c.work_center_no) workCenterDesc,
|
|
c.labor_class_no,
|
|
g.level_desc laborClassDesc,
|
|
c.setup_labor_class_no,
|
|
j.level_desc setupLaborClassDesc,
|
|
c.overlap,
|
|
c.operation_name,
|
|
c.operation_id,
|
|
c.note_text operationNoteText,
|
|
d.tool_id,
|
|
f.tool_description toolDescription,
|
|
d.tool_qty,
|
|
d.remark,
|
|
e.plm_part_no,
|
|
e.ifs_part_no
|
|
from plm_routing_header a
|
|
LEFT JOIN part e on a.site = e.site AND a.part_no = e.part_no
|
|
LEFT JOIN plm_routing_detail b on a.site = b.site AND a.part_no =b.part_no AND a.routing_revision = b.routing_revision and a.routing_type = b.routing_type
|
|
LEFT JOIN plm_routing_component c on a.site = c.site AND a.part_no =c.part_no AND a.routing_revision = c.routing_revision and a.routing_type = c.routing_type and b.alternative_no = c.alternative_no
|
|
LEFT JOIN routing_tool d on a.site = d.site AND a.part_no =d.part_no AND a.routing_revision = d.routing_revision and a.routing_type = d.routing_type and c.alternative_no = d.alternative_no and c.operation_id = d.operation_id
|
|
LEFT JOIN tool_header f on a.site = f.site AND d.tool_id =f.tool_id
|
|
LEFT JOIN labor_class g on a.site = g.site AND c.labor_class_no = g.level_id
|
|
LEFT JOIN labor_class j on a.site = j.site AND c.setup_labor_class_no = j.level_id
|
|
<where>
|
|
a.site = #{query.site}
|
|
AND e.show_in_query_flag = 'Y'
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.plmPartNo != null and query.plmPartNo != ''">
|
|
AND e.plm_part_no = #{query.plmPartNo}
|
|
</if>
|
|
<if test = "query.ifsPartNo != null and query.ifsPartNo != ''">
|
|
AND e.ifs_part_no = #{query.ifsPartNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND e.part_desc like #{query.partDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取routing header 对象-->
|
|
<select id="queryRoutingHeader" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
note_text,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
row_version,
|
|
row_key,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</select>
|
|
|
|
<!-- routing主表编辑 -->
|
|
<update id="updateInDate" parameterType="RoutingHeaderEntity">
|
|
update plm_routing_header
|
|
set phase_out_date = #{phaseOutDate},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</update>
|
|
|
|
<!-- 根据RoutingType查询-->
|
|
<select id="selectRoutingHeaderByType" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
note_text,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
row_version,
|
|
row_key,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
|
|
</select>
|
|
|
|
<!-- 校验日期是否冲突-->
|
|
<select id="queryHeaderPhaseDate" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
note_text,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
row_version,
|
|
row_key,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
<where>
|
|
site = #{site} and part_no = #{partNo} and routing_type = #{routingType}
|
|
<if test = "phaseOutDate == null">
|
|
and phase_in_date >= #{phaseInDate}
|
|
</if>
|
|
<if test = "phaseOutDate != null">
|
|
and #{phaseInDate} >= phase_in_date and phase_out_date >= #{phaseOutDate}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 将上一个版本的失效日期改为当前生效日期减一 -->
|
|
<update id="updatePhaseOutDate" parameterType="RoutingHeaderEntity">
|
|
update plm_routing_header
|
|
set phase_out_date = #{phaseOutDate},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
|
|
</update>
|
|
|
|
<!-- 查routing子明细 -->
|
|
<select id="queryComponent" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no,
|
|
operation_name,
|
|
efficiency_factor,
|
|
mach_run_factor,
|
|
mach_setup_time,
|
|
run_time_code,
|
|
labor_run_factor,
|
|
labor_setup_time,
|
|
crew_size,
|
|
setup_crew_size,
|
|
outside_op_item,
|
|
machine_no,
|
|
work_center_no,
|
|
labor_class_no,
|
|
setup_labor_class_no,
|
|
overlap,
|
|
note_text,
|
|
ifs_row_id,
|
|
ifs_row_version
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 判断替代是否为正式 -->
|
|
<select id="queryRoutingDetailOfficialFlag" parameterType="RoutingComponentEntity" resultType="RoutingDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
alternative_description,
|
|
rout_template_id,
|
|
plan_date,
|
|
fixed_lead_time_day,
|
|
fixed_lead_time_hour,
|
|
variable_lead_time_day,
|
|
variable_lead_time_hour,
|
|
for_std_lot_by_day,
|
|
for_lot_by_day,
|
|
min_lot_qty,
|
|
note_text as detailNoteText,
|
|
status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取该routing的全部Tool -->
|
|
<select id="getRoutingToolByHeader" parameterType="RoutingHeaderEntity" resultType="RoutingToolEntity">
|
|
SELECT
|
|
id,
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
tool_id,
|
|
tool_qty,
|
|
remark
|
|
FROM routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
|
|
</select>
|
|
|
|
<!-- 批量新增routingTool -->
|
|
<insert id="saveRoutingTool">
|
|
insert into routing_tool
|
|
(site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationId}, #{item.toolId}, #{item.toolQty}, #{item.remark}, getDate(), #{item.createBy})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 获取该routing的全部guideLine -->
|
|
<select id="getGuideLineByHeader" parameterType="RoutingHeaderEntity" resultType="WorkGuidelineEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
id,
|
|
guideline_seq,
|
|
guideline_desc,
|
|
guideline_text,
|
|
guideline_type,
|
|
sign_off_required,
|
|
inspection_sign_off_required,
|
|
operation_id
|
|
FROM plm_routing_work_guide
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
|
|
</select>
|
|
|
|
<!-- 批量新增guideLine -->
|
|
<insert id="saveGuideLine">
|
|
insert into plm_routing_work_guide
|
|
(site, part_no, routing_revision, routing_type, alternative_no, guideline_seq, guideline_desc, guideline_text, guideline_type, sign_off_required, inspection_sign_off_required, operation_id, create_date, create_by) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.guidelineSeq}, #{item.guidelineDesc}, #{item.guidelineText}, #{item.guidelineType}, #{item.signOffRequired}, #{item.inspectionSignOffRequired}, #{item.operationId}, getDate(), #{item.createBy})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 获取该工序的Tool -->
|
|
<select id="getRoutingToolByOperation" parameterType="RoutingComponentEntity" resultType="RoutingToolEntity">
|
|
SELECT
|
|
id,
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
tool_id,
|
|
tool_qty,
|
|
remark
|
|
FROM routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</select>
|
|
|
|
<!-- 获取该工序的Tool(ifs) -->
|
|
<select id="getRoutingToolByOperationToIfs" resultType="RoutingIfsTool">
|
|
SELECT
|
|
a.id,
|
|
a.site as contract,
|
|
a.part_no,
|
|
a.routing_type,
|
|
a.routing_revision,
|
|
a.alternative_no,
|
|
a.operation_id,
|
|
b.operation_no,
|
|
a.tool_id,
|
|
a.tool_qty as toolQuantity,
|
|
a.remark as noteText,
|
|
b.ifs_row_id,
|
|
b.ifs_row_version
|
|
FROM routing_tool as a
|
|
left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo} and a.operation_id = #{operationId}
|
|
</select>
|
|
|
|
<!-- 修改工序Tool的 rowKey rowRevision -->
|
|
<update id="updateIfsToolRowKeyAndRevision" parameterType="RoutingIfsTool">
|
|
update routing_tool
|
|
set ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 获取该替代的全部guideLine -->
|
|
<select id="getGuideLineByOperation" parameterType="RoutingComponentEntity" resultType="WorkGuidelineEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
id,
|
|
guideline_seq,
|
|
guideline_desc,
|
|
guideline_text,
|
|
guideline_type,
|
|
sign_off_required,
|
|
inspection_sign_off_required,
|
|
operation_id
|
|
FROM plm_routing_work_guide
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</select>
|
|
|
|
<!-- 修改工序Guideline的 rowKey rowRevision -->
|
|
<update id="updateIfsGuidelineRowKeyAndRevision" parameterType="RoutingIfsGuideLine">
|
|
update plm_routing_work_guide
|
|
set ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<!-- 获取该工序的Tool(ifs) -->
|
|
<select id="getRoutingGuidelineByOperationToIfs" resultType="RoutingIfsGuideLine">
|
|
SELECT
|
|
a.id,
|
|
a.site as contract,
|
|
a.part_no,
|
|
a.routing_type,
|
|
a.routing_revision,
|
|
a.alternative_no,
|
|
a.operation_id,
|
|
b.operation_no,
|
|
a.guideline_seq,
|
|
a.guideline_desc,
|
|
a.guideline_text,
|
|
a.guideline_type as operWorkGuideType,
|
|
a.sign_off_required as signOffReq,
|
|
a.inspection_sign_off_required as inspectSignOffReq,
|
|
b.ifs_row_id,
|
|
b.ifs_row_version
|
|
FROM plm_routing_work_guide as a
|
|
left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo} and a.operation_id = #{operationId}
|
|
</select>
|
|
|
|
<!-- 根据工序删除RoutingTool -->
|
|
<delete id="deleteRoutingToolByOperation" parameterType="RoutingComponentEntity">
|
|
delete from routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</delete>
|
|
|
|
<!-- 根据工序删除guideLine -->
|
|
<delete id="deleteGuideLineByOperation" parameterType="RoutingComponentEntity">
|
|
delete from plm_routing_work_guide
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</delete>
|
|
|
|
<!-- 根据替代删除RoutingTool -->
|
|
<delete id="deleteRoutingToolByAlternative" parameterType="RoutingDetailEntity">
|
|
delete from routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<!-- 根据替代删除guideLine -->
|
|
<delete id="deleteGuideLineByAlternative" parameterType="RoutingDetailEntity">
|
|
delete from plm_routing_work_guide
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<select id="queryRoutingDetailList" resultType="com.spring.modules.quotation.entity.QuoteRoutingHeader">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision as version,
|
|
alternative_no
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 查询最大工序号 -->
|
|
<select id="queryMaxOperationNo" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
|
|
SELECT top 1
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
operation_no
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
order by operation_no desc
|
|
</select>
|
|
|
|
<!-- 修改工序的 rowKey rowRevision -->
|
|
<update id="updateIfsRowKeyAndRevision" parameterType="RoutingIfsItem">
|
|
update plm_routing_component
|
|
set ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where site = #{contract} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</update>
|
|
|
|
<!-- 修改工具的 rowKey rowRevision -->
|
|
<update id="updateRoutingToolIfsRow" parameterType="com.spring.modules.part.vo.RoutingToolVo">
|
|
update routing_tool
|
|
set ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="updateRoutingHeaderOfficialFlag" parameterType="com.spring.modules.part.vo.RoutingDetailVo">
|
|
update plm_routing_header
|
|
set official_flag = 'Y'
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
|
|
</update>
|
|
|
|
<update id="updateRoutingDetailOfficialFlag" parameterType="com.spring.modules.part.vo.RoutingDetailVo">
|
|
update plm_routing_detail
|
|
set official_flag = 'Y'
|
|
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 根据routing的替代查Tool -->
|
|
<select id="getRoutingToolByAlternative" parameterType="com.spring.modules.part.vo.RoutingDetailVo" resultType="RoutingIfsTool">
|
|
SELECT
|
|
a.id,
|
|
a.site as contract,
|
|
a.part_no,
|
|
a.routing_type,
|
|
a.routing_revision,
|
|
a.alternative_no,
|
|
a.operation_id,
|
|
b.operation_no,
|
|
a.tool_id,
|
|
a.tool_qty as toolQuantity,
|
|
a.remark as noteText,
|
|
b.ifs_row_id,
|
|
b.ifs_row_version
|
|
FROM routing_tool as a
|
|
left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 根据routing的替代查guideLine -->
|
|
<select id="getGuideLineByAlternative" parameterType="com.spring.modules.part.vo.RoutingDetailVo" resultType="RoutingIfsGuideLine">
|
|
SELECT
|
|
a.site as contract,
|
|
a.part_no,
|
|
a.routing_type,
|
|
a.routing_revision,
|
|
a.alternative_no,
|
|
a.id,
|
|
a.guideline_seq,
|
|
a.guideline_desc,
|
|
a.guideline_text,
|
|
a.guideline_type as operWorkGuideType,
|
|
a.sign_off_required as signOffReq,
|
|
a.inspection_sign_off_required as inspectSignOffReq,
|
|
a.operation_id,
|
|
b.ifs_row_id,
|
|
b.ifs_row_version
|
|
FROM plm_routing_work_guide as a
|
|
left join plm_routing_component as b on a.operation_id = b.operation_id
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取Tool(ifs) -->
|
|
<select id="getRoutingToolToIfs" parameterType="RoutingToolEntity" resultType="RoutingIfsTool">
|
|
SELECT
|
|
id,
|
|
site as contract,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
tool_id,
|
|
tool_qty as toolQuantity,
|
|
remark as noteText,
|
|
ifs_row_id,
|
|
ifs_row_version
|
|
FROM routing_tool
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
|
|
</select>
|
|
|
|
<!-- 修改工序的 rowKey rowRevision -->
|
|
<update id="updateRoutingComponentIfsRow" parameterType="RoutingComponentEntity">
|
|
update plm_routing_component
|
|
set ifs_row_id = #{ifsRowId},
|
|
ifs_row_version = #{ifsRowVersion}
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</update>
|
|
|
|
<!-- 获取工序(ifs) -->
|
|
<select id="getRoutingComponentToIfs" parameterType="RoutingComponentEntity" resultType="RoutingIfsItem">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no,
|
|
efficiency_factor,
|
|
mach_run_factor,
|
|
mach_setup_time,
|
|
run_time_code,
|
|
labor_run_factor,
|
|
labor_setup_time,
|
|
crew_size,
|
|
setup_crew_size,
|
|
outside_op_item,
|
|
machine_no,
|
|
work_center_no,
|
|
labor_class_no,
|
|
setup_labor_class_no,
|
|
overlap,
|
|
note_text,
|
|
operation_name as operationDesc,
|
|
ifs_row_id,
|
|
ifs_row_version
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
|
|
</select>
|
|
|
|
<select id="getPLMLocations" resultType="LocationInformationEntity">
|
|
select
|
|
site,
|
|
location_id,
|
|
location_name,
|
|
warehouse_id,
|
|
active,
|
|
location_type,
|
|
ifs_row_version
|
|
from location
|
|
where site in
|
|
<foreach collection="arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="syncDeleteLocation" parameterType="java.util.List">
|
|
DELETE FROM location WHERE
|
|
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
|
|
location_id = #{item.locationId} AND site = #{item.site}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 批量新增 -->
|
|
<insert id="syncSaveLocation">
|
|
INSERT INTO location (site, location_id, location_name, warehouse_id, active, location_type, ifs_row_version)
|
|
VALUES
|
|
<foreach item="item" collection="list" separator=",">
|
|
(#{item.site}, #{item.locationId}, #{item.locationName}, #{item.warehouseId}, #{item.active}, #{item.locationType}, #{item.ifsRowVersion})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="syncUpdateLocation" parameterType="java.util.List">
|
|
UPDATE location
|
|
SET
|
|
location_name = CASE location_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.locationId} THEN #{item.locationName}
|
|
</foreach>
|
|
ELSE location_name
|
|
END,
|
|
active = CASE location_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.locationId} THEN #{item.active}
|
|
</foreach>
|
|
ELSE active
|
|
END,
|
|
warehouse_id = CASE location_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.locationId} THEN #{item.warehouseId}
|
|
</foreach>
|
|
ELSE warehouse_id
|
|
END,
|
|
location_type = CASE location_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.locationId} THEN #{item.locationType}
|
|
</foreach>
|
|
ELSE location_type
|
|
END,
|
|
ifs_row_version = CASE location_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.locationId} THEN #{item.ifsRowVersion}
|
|
</foreach>
|
|
ELSE ifs_row_version
|
|
END
|
|
WHERE location_id IN
|
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
|
#{item.locationId}
|
|
</foreach>
|
|
AND site = #{list[0].site}
|
|
</update>
|
|
|
|
<!-- <!– 批量更新 –>-->
|
|
<!-- <update id="syncUpdateLocation" parameterType="LocationInformationEntity">-->
|
|
<!-- UPDATE location SET-->
|
|
<!-- location_name = #{locationName},-->
|
|
<!-- active = #{active},-->
|
|
<!-- warehouse_id = #{warehouseId},-->
|
|
<!-- location_type = #{locationType},-->
|
|
<!-- ifs_row_version = #{ifsRowVersion}-->
|
|
<!-- WHERE location_id = #{locationId} AND site = #{site}-->
|
|
<!-- </update>-->
|
|
|
|
<select id="getPLMLaborClasss" resultType="PersonnelLevel">
|
|
select
|
|
site,
|
|
level_id,
|
|
level_desc,
|
|
level_cost,
|
|
active,
|
|
ifs_row_version
|
|
from labor_class
|
|
where site in
|
|
<foreach collection="arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="syncDeleteLaborClass" parameterType="java.util.List">
|
|
DELETE FROM labor_class WHERE
|
|
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
|
|
level_id = #{item.levelId} AND site = #{item.site}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 批量新增 -->
|
|
<insert id="syncSaveLaborClass">
|
|
INSERT INTO labor_class (site, level_id, level_desc, level_cost, active, ifs_row_version)
|
|
VALUES
|
|
<foreach item="item" collection="list" separator=",">
|
|
(#{item.site}, #{item.levelId}, #{item.levelDesc}, #{item.levelCost}, #{item.active}, #{item.ifsRowVersion})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="syncUpdateLaborClass" parameterType="java.util.List">
|
|
UPDATE labor_class
|
|
SET
|
|
level_desc = CASE level_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.levelId} THEN #{item.levelDesc}
|
|
</foreach>
|
|
ELSE level_desc
|
|
END,
|
|
active = CASE level_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.levelId} THEN #{item.active}
|
|
</foreach>
|
|
ELSE active
|
|
END,
|
|
level_cost = CASE level_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.levelId} THEN #{item.levelCost,jdbcType=DECIMAL}
|
|
</foreach>
|
|
ELSE level_cost
|
|
END,
|
|
ifs_row_version = CASE level_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.levelId} THEN #{item.ifsRowVersion}
|
|
</foreach>
|
|
ELSE ifs_row_version
|
|
END
|
|
WHERE level_id IN
|
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
|
#{item.levelId}
|
|
</foreach>
|
|
AND site = #{list[0].site}
|
|
</update>
|
|
|
|
<!-- <!– 批量更新 –>-->
|
|
<!-- <update id="syncUpdateLaborClass" parameterType="PersonnelLevel">-->
|
|
<!-- UPDATE labor_class SET-->
|
|
<!-- level_desc = #{levelDesc},-->
|
|
<!-- active = #{active},-->
|
|
<!-- level_cost = #{levelCost},-->
|
|
<!-- ifs_row_version = #{ifsRowVersion}-->
|
|
<!-- WHERE level_id = #{levelId} AND site = #{site}-->
|
|
<!-- </update>-->
|
|
|
|
<select id="getPLMWorkCenters" resultType="WorkCenter">
|
|
select
|
|
site,
|
|
work_center_no,
|
|
work_center_desc,
|
|
work_center_type_db,
|
|
work_center_type,
|
|
average_capacity,
|
|
efficiency,
|
|
utilization,
|
|
capacity_type_db,
|
|
capacity_type,
|
|
um_id,
|
|
active,
|
|
remark,
|
|
pro_line_no,
|
|
can_create_new_roll_flag,
|
|
need_setup_flag,
|
|
ifs_row_version
|
|
from work_center
|
|
where site in
|
|
<foreach collection="arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!-- 批量删除 -->
|
|
<delete id="syncDeleteWorkCenter" parameterType="java.util.List">
|
|
DELETE FROM work_center WHERE
|
|
<foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
|
|
work_center_no = #{item.workCenterNo} AND site = #{item.site}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<!-- 批量新增 -->
|
|
<insert id="syncSaveWorkCenter">
|
|
INSERT INTO work_center (site, work_center_no, work_center_desc, work_center_type_db, work_center_type, average_capacity, efficiency, utilization, capacity_type_db, capacity_type,
|
|
um_id, active, remark, pro_line_no, can_create_new_roll_flag, need_setup_flag, ifs_row_version)
|
|
VALUES
|
|
<foreach item="item" collection="list" separator=",">
|
|
(#{item.site}, #{item.workCenterNo}, #{item.workCenterDesc}, #{item.workCenterTypeDB}, #{item.workCenterType}, #{item.averageCapacity,jdbcType=DECIMAL}, #{item.efficiency,jdbcType=DECIMAL}, #{item.utilization,jdbcType=DECIMAL}, #{item.capacityTypeDB}, #{item.capacityType},
|
|
#{item.umId}, #{item.active}, #{item.remark}, #{item.proLineNo}, #{item.canCreateNewRollFlag}, #{item.needSetupFlag}, #{item.ifsRowVersion})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="syncUpdateWorkCenter" parameterType="java.util.List">
|
|
UPDATE work_center
|
|
SET
|
|
work_center_desc = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.workCenterDesc}
|
|
</foreach>
|
|
ELSE work_center_desc
|
|
END,
|
|
work_center_type_db = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.workCenterTypeDB}
|
|
</foreach>
|
|
ELSE work_center_type_db
|
|
END,
|
|
work_center_type = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.workCenterType}
|
|
</foreach>
|
|
ELSE work_center_type
|
|
END,
|
|
average_capacity = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.averageCapacity,jdbcType=DECIMAL}
|
|
</foreach>
|
|
ELSE average_capacity
|
|
END,
|
|
efficiency = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.efficiency,jdbcType=DECIMAL}
|
|
</foreach>
|
|
ELSE efficiency
|
|
END,
|
|
utilization = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.utilization,jdbcType=DECIMAL}
|
|
</foreach>
|
|
ELSE utilization
|
|
END,
|
|
capacity_type_db = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.capacityTypeDB}
|
|
</foreach>
|
|
ELSE capacity_type_db
|
|
END,
|
|
capacity_type = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.capacityType}
|
|
</foreach>
|
|
ELSE capacity_type
|
|
END,
|
|
um_id = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.umId}
|
|
</foreach>
|
|
ELSE um_id
|
|
END,
|
|
active = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.active}
|
|
</foreach>
|
|
ELSE active
|
|
END,
|
|
remark = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.remark}
|
|
</foreach>
|
|
ELSE remark
|
|
END,
|
|
pro_line_no = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.proLineNo}
|
|
</foreach>
|
|
ELSE pro_line_no
|
|
END,
|
|
can_create_new_roll_flag = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.canCreateNewRollFlag}
|
|
</foreach>
|
|
ELSE can_create_new_roll_flag
|
|
END,
|
|
need_setup_flag = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.needSetupFlag}
|
|
</foreach>
|
|
ELSE need_setup_flag
|
|
END,
|
|
ifs_row_version = CASE work_center_no
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.workCenterNo} THEN #{item.ifsRowVersion}
|
|
</foreach>
|
|
ELSE ifs_row_version
|
|
END
|
|
WHERE work_center_no IN
|
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
|
#{item.workCenterNo}
|
|
</foreach>
|
|
AND site = #{list[0].site}
|
|
</update>
|
|
|
|
<select id="getPLMWorkCenterCosts" resultType="WorkCenterCost">
|
|
select
|
|
site,
|
|
work_center_no,
|
|
item_no,
|
|
unit_cost,
|
|
overhead1_cost,
|
|
overhead2_cost,
|
|
um_id,
|
|
begin_date,
|
|
end_date,
|
|
remark,
|
|
current_work_center_cost,
|
|
ifs_row_id,
|
|
ifs_row_version,
|
|
cost_set,
|
|
cost_set_desc,
|
|
wc_rate,
|
|
wc_cost_code,
|
|
overhead1_fac,
|
|
overhead2_fac,
|
|
overhead1_appl,
|
|
overhead2_appl
|
|
from work_center_cost
|
|
where site in
|
|
<foreach collection="arr" close=")" open="(" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<!-- 批量新增 -->
|
|
<insert id="syncSaveWorkCenterCost">
|
|
INSERT INTO work_center_cost (site, work_center_no, item_no, unit_cost, overhead1_cost, overhead2_cost, um_id, begin_date, end_date, remark,
|
|
current_work_center_cost, ifs_row_id, ifs_row_version, cost_set, cost_set_desc, wc_rate, wc_cost_code, overhead1_fac, overhead2_fac, overhead1_appl, overhead2_appl)
|
|
VALUES
|
|
<foreach item="item" collection="list" separator=",">
|
|
(#{item.site}, #{item.workCenterNo}, #{item.itemNo,jdbcType=FLOAT}, #{item.unitCost,jdbcType=FLOAT}, #{item.overhead1Cost,jdbcType=FLOAT}, #{item.overhead2Cost,jdbcType=FLOAT}, #{item.umId}, #{item.beginDate,jdbcType=DATE}, #{item.endDate,jdbcType=DATE}, #{item.remark},
|
|
#{item.currentWorkCenterCost,jdbcType=DECIMAL}, #{item.ifsRowId}, #{item.ifsRowVersion}, #{item.costSet}, #{item.costSetDesc}, #{item.wcRate}, #{item.wcCostCode}, #{item.overhead1Fac}, #{item.overhead2Fac}, #{item.overhead1Appl}, #{item.overhead2Appl})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 批量更新 -->
|
|
<update id="syncUpdateWorkCenterCost" parameterType="java.util.List">
|
|
UPDATE work_center_cost
|
|
SET
|
|
item_no = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.itemNo,jdbcType=FLOAT}
|
|
</foreach>
|
|
ELSE item_no
|
|
END,
|
|
unit_cost = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.unitCost,jdbcType=FLOAT}
|
|
</foreach>
|
|
ELSE unit_cost
|
|
END,
|
|
overhead1_cost = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead1Cost,jdbcType=FLOAT}
|
|
</foreach>
|
|
ELSE overhead1_cost
|
|
END,
|
|
overhead2_cost = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead2Cost,jdbcType=FLOAT}
|
|
</foreach>
|
|
ELSE overhead2_cost
|
|
END,
|
|
um_id = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.umId}
|
|
</foreach>
|
|
ELSE um_id
|
|
END,
|
|
begin_date = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.beginDate}
|
|
</foreach>
|
|
ELSE begin_date
|
|
END,
|
|
end_date = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.endDate}
|
|
</foreach>
|
|
ELSE end_date
|
|
END,
|
|
remark = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.remark}
|
|
</foreach>
|
|
ELSE remark
|
|
END,
|
|
current_work_center_cost = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.currentWorkCenterCost}
|
|
</foreach>
|
|
ELSE current_work_center_cost
|
|
END,
|
|
ifs_row_version = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.ifsRowVersion}
|
|
</foreach>
|
|
ELSE ifs_row_version
|
|
END,
|
|
cost_set = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.costSet}
|
|
</foreach>
|
|
ELSE cost_set
|
|
END,
|
|
cost_set_desc = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.costSetDesc}
|
|
</foreach>
|
|
ELSE cost_set_desc
|
|
END,
|
|
wc_rate = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.wcRate}
|
|
</foreach>
|
|
ELSE wc_rate
|
|
END,
|
|
wc_cost_code = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.wcCostCode}
|
|
</foreach>
|
|
ELSE wc_cost_code
|
|
END,
|
|
overhead1_fac = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead1Fac}
|
|
</foreach>
|
|
ELSE overhead1_fac
|
|
END,
|
|
overhead2_fac = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead2Fac}
|
|
</foreach>
|
|
ELSE overhead2_fac
|
|
END,
|
|
overhead1_appl = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead1Appl}
|
|
</foreach>
|
|
ELSE overhead1_appl
|
|
END,
|
|
overhead2_appl = CASE ifs_row_id
|
|
<foreach item="item" index="index" collection="list" open="" close="" separator=" ">
|
|
WHEN #{item.ifsRowId} THEN #{item.overhead2Appl}
|
|
</foreach>
|
|
ELSE overhead2_appl
|
|
END
|
|
WHERE ifs_row_id IN
|
|
<foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
|
|
#{item.ifsRowId}
|
|
</foreach>
|
|
</update>
|
|
|
|
<select id="getRoutingComponentRowKeyAndVersion" resultType="RoutingComponentEntity">
|
|
select
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
alternative_no,
|
|
operation_no,
|
|
operation_name,
|
|
operation_id,
|
|
ifs_row_id,
|
|
ifs_row_version
|
|
from plm_routing_component
|
|
where operation_id = #{operationId}
|
|
</select>
|
|
|
|
<select id="getMaxLocationRowVersion" resultType="java.lang.String">
|
|
select
|
|
isnull(max(ifs_row_version),'')
|
|
from location
|
|
</select>
|
|
|
|
<select id="getMaxLaborClassRowVersion" resultType="java.lang.String">
|
|
select
|
|
isnull(max(ifs_row_version),'')
|
|
from labor_class
|
|
</select>
|
|
|
|
<select id="getMaxWorkCenterRowVersion" resultType="java.lang.String">
|
|
select
|
|
isnull(max(ifs_row_version),'')
|
|
from work_center
|
|
</select>
|
|
|
|
<select id="getMaxWorkCenterCostRowVersion" resultType="java.lang.String">
|
|
select
|
|
isnull(max(ifs_row_version),'')
|
|
from work_center_cost
|
|
</select>
|
|
|
|
<select id="selectRoutingHeaderByPartNo" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_revision,
|
|
routing_type,
|
|
note_text,
|
|
phase_in_date,
|
|
phase_out_date,
|
|
official_flag
|
|
FROM plm_routing_header
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<select id="selectRoutingDetailByPartNo" resultType="com.spring.modules.part.vo.RoutingDetailVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
alternative_description,
|
|
rout_template_id,
|
|
plan_date,
|
|
fixed_lead_time_day,
|
|
fixed_lead_time_hour,
|
|
variable_lead_time_day,
|
|
variable_lead_time_hour,
|
|
for_std_lot_by_day,
|
|
for_lot_by_day,
|
|
min_lot_qty,
|
|
note_text as detailNoteText,
|
|
'Tentative' as status,
|
|
official_flag
|
|
FROM plm_routing_detail
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<select id="selectRoutingComponentByPartNo" resultType="com.spring.modules.part.vo.RoutingComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
operation_no,
|
|
operation_name,
|
|
efficiency_factor,
|
|
mach_run_factor,
|
|
mach_setup_time,
|
|
run_time_code,
|
|
labor_run_factor,
|
|
labor_setup_time,
|
|
crew_size,
|
|
setup_crew_size,
|
|
outside_op_item,
|
|
machine_no,
|
|
work_center_no,
|
|
labor_class_no,
|
|
setup_labor_class_no,
|
|
overlap,
|
|
note_text
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<insert id="saveRoutingHeaderList">
|
|
INSERT INTO plm_routing_header
|
|
(site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.noteText}, #{item.phaseInDate}, #{item.phaseOutDate}, getDate(), #{item.createBy}, #{item.officialFlag})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="saveRoutingDetailList">
|
|
INSERT INTO plm_routing_detail
|
|
(site, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status, official_flag) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.fixedLeadTimeDay}, #{item.fixedLeadTimeHour}, #{item.variableLeadTimeDay}, #{item.variableLeadTimeHour}, #{item.forStdLotByDay}, #{item.forLotByDay}, #{item.minLotQty}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.status}, #{item.officialFlag})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="selectRoutingToolByPartNo" resultType="RoutingToolEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
operation_id,
|
|
tool_id,
|
|
tool_qty,
|
|
remark
|
|
FROM routing_tool
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<select id="selectRoutingGuidelineByPartNo" resultType="WorkGuidelineEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
routing_type,
|
|
routing_revision,
|
|
alternative_no,
|
|
guideline_seq,
|
|
guideline_desc,
|
|
guideline_text,
|
|
guideline_type,
|
|
sign_off_required,
|
|
inspection_sign_off_required,
|
|
operation_id
|
|
FROM plm_routing_work_guide
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<!-- 查工具列表 -->
|
|
<select id="queryToolList" parameterType="ToolHeader" resultType="ToolHeader">
|
|
SELECT
|
|
site,
|
|
tool_id,
|
|
tool_description
|
|
FROM tool_header
|
|
<where>
|
|
site = #{query.site} and active = 'Y'
|
|
<if test = "query.toolId != null and query.toolId != ''">
|
|
AND tool_id like #{query.toolId}
|
|
</if>
|
|
<if test = "query.toolDescription != null and query.toolDescription != ''">
|
|
AND tool_description like #{query.toolDescription}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 清空加工中心成本数据 -->
|
|
<delete id="deleteWorkCenterCostAll">
|
|
TRUNCATE TABLE work_center_cost
|
|
</delete>
|
|
|
|
<!-- 通过加工中心查人员等级 -->
|
|
<select id="queryLaborClassByWorkCenterNo" resultType="com.spring.modules.base.entity.PersonnelLevel">
|
|
select
|
|
site,
|
|
level_id,
|
|
level_desc
|
|
from labor_class
|
|
where site = #{site} and level_id = #{levelId}
|
|
</select>
|
|
</mapper>
|