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.
873 lines
36 KiB
873 lines
36 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,
|
|
dbo.get_part_name(a.site, a.part_no) 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,
|
|
dbo.get_um_name(b.um_id) as printUnitName
|
|
FROM plm_routing_header as a
|
|
left join part as b on a.site = b.site and a.part_no = b.part_no
|
|
<where>
|
|
a.site = #{query.site}
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND dbo.get_part_name(a.site, a.part_no) like #{query.partDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询物料清单 -->
|
|
<select id="queryPartList" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
um_id as printUnit,
|
|
dbo.get_um_name(um_id) as printUnitName,
|
|
part_type
|
|
FROM part
|
|
<where>
|
|
site = #{site} and active = 'Y'
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND part_no = #{partNo}
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND part_desc like #{partDesc}
|
|
</if>
|
|
<if test = "status != null and status != ''">
|
|
AND status = #{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)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy})
|
|
</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)
|
|
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})
|
|
</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
|
|
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,
|
|
dbo.get_workCenter_desc(site, work_center_no) as workCenterDesc,
|
|
labor_class_no,
|
|
dbo.get_labor_class_desc(site, labor_class_no) as laborClassDesc,
|
|
setup_labor_class_no,
|
|
dbo.get_labor_class_desc(site, setup_labor_class_no) as setupLaborClassDesc,
|
|
overlap,
|
|
note_text
|
|
FROM plm_routing_component
|
|
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
|
|
order by 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_name = #{operationName} 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}
|
|
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="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,
|
|
outside_op_item,
|
|
labor_class_no,
|
|
setup_labor_class_no,
|
|
case when overlap is null then '' else overlap end
|
|
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.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
|
|
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="RoutingToolEntity">
|
|
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,
|
|
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
|
|
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 plm_admin_level g on a.site = g.site AND c.labor_class_no = g.level_id
|
|
LEFT JOIN plm_admin_level j on a.site = j.site AND c.setup_labor_class_no = j.level_id
|
|
<where>
|
|
a.site = #{query.site}
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND a.part_no like #{query.partNo}
|
|
</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
|
|
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
|
|
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
|
|
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>
|
|
|
|
<!-- 获取该替代的全部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>
|
|
|
|
<!-- 根据工序删除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>
|
|
</mapper>
|