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.
1131 lines
47 KiB
1131 lines
47 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.RecipeManagementMapper">
|
|
|
|
<!-- 材料信息列表 -->
|
|
<select id="recipeManagementSearch" parameterType="com.spring.modules.part.vo.RecipeHeaderVo" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
dbo.get_part_name(a.site, a.part_no) as partDesc,
|
|
a.eng_chg_level,
|
|
a.bom_type,
|
|
a.note_text,
|
|
a.eff_phase_in_date,
|
|
a.eff_phase_out_date,
|
|
a.eng_revision,
|
|
a.type_flag,
|
|
a.net_weight,
|
|
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,
|
|
a.official_flag,
|
|
b.ifs_part_no
|
|
FROM plm_recipe_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}
|
|
AND NOT (b.status = 'Y' AND (b.plm_part_no IS NULL OR b.plm_part_no = ''))
|
|
<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>
|
|
<if test = "query.bomType != null and query.bomType != ''">
|
|
AND a.bom_type = #{query.bomType}
|
|
</if>
|
|
<if test = "query.engChgLevel != null and query.engChgLevel != ''">
|
|
AND a.eng_chg_level = #{query.engChgLevel}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询物料清单 -->
|
|
<select id="queryPartList" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
um_id as printUnit,
|
|
dbo.get_um_name(um_id) as printUnitName,
|
|
part_type,
|
|
family_id,
|
|
dbo.get_family_name(site, family_id) as familyName,
|
|
part_status,
|
|
dbo.get_part_status_name(site, part_status) as partStatusDesc
|
|
FROM part
|
|
<where>
|
|
site = #{query.site}
|
|
and part_type in ('Manufactured', 'Manufactured Recipe', 'Purchased')
|
|
and active = 'Y'
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no = #{query.partNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND status = #{query.status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查出可创建Recipe的物料 -->
|
|
<select id="queryPartListRecipe" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
um_id as printUnit,
|
|
dbo.get_um_name(um_id) as printUnitName,
|
|
part_type,
|
|
family_id,
|
|
dbo.get_family_name(site, family_id) as familyName,
|
|
part_status,
|
|
dbo.get_part_status_name(site, part_status) as partStatusDesc
|
|
FROM part
|
|
<where>
|
|
site = #{query.site}
|
|
and active = 'Y'
|
|
and part_type <![CDATA[<>]]> 'Purchased (raw)'
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no = #{query.partNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND status = #{query.status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查出所有类型的物料 -->
|
|
<select id="queryPartListAll" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
part_desc,
|
|
spec,
|
|
um_id as printUnit,
|
|
dbo.get_um_name(um_id) as printUnitName,
|
|
part_type,
|
|
family_id,
|
|
dbo.get_family_name(site, family_id) as familyName,
|
|
part_status,
|
|
dbo.get_part_status_name(site, part_status) as partStatusDesc
|
|
FROM part
|
|
<where>
|
|
site = #{query.site}
|
|
and active = 'Y'
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.status != null and query.status != ''">
|
|
AND status = #{query.status}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<!-- 新增Recipe主表内容 -->
|
|
<insert id="saveRecipeHeader" parameterType="RecipeHeaderEntity">
|
|
INSERT INTO plm_recipe_header
|
|
(site, part_no, eng_chg_level, bom_type, note_text, eff_phase_in_date, eff_phase_out_date, eng_revision, type_flag, net_weight, official_flag, create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{noteText}, #{effPhaseInDate}, #{effPhaseOutDate}, #{engRevision}, #{typeFlag}, #{netWeight}, #{officialFlag}, getDate(), #{createBy})
|
|
</insert>
|
|
|
|
<!-- recipe明细新增 -->
|
|
<insert id="recipeDetailSave" parameterType="RecipeDetailEntity">
|
|
INSERT INTO plm_recipe_detail
|
|
(site, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, status, min_lot_qty, default_flag, note_text, create_date, create_by, official_flag, display_weight_uom, display_volume_uom, reg_unit)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy}, #{officialFlag}, #{displayWeightUom}, #{displayVolumeUom}, #{regUnit})
|
|
</insert>
|
|
|
|
<!-- 新增Recipe子明细表内容 -->
|
|
<insert id="saveRecipeComponent" parameterType="RecipeComponentEntity">
|
|
INSERT INTO plm_recipe_component
|
|
(site, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type,
|
|
issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
|
|
fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
|
|
charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
|
|
VALUES
|
|
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType},
|
|
#{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy}, #{lineSequence}, #{consumptionItem}, #{partsByWeight}, #{qtyUom}, #{issuePlannedScrapDb}, #{issueOverreportedQtyDb},
|
|
#{fixedQtyFlag}, #{promisePlanned}, #{phantomConsume}, #{operCostDistribution}, #{genOhCostDistribution}, #{qtyKg}, #{byProdAsSupplyInMrpDb}, #{leadtimeOffset}, #{stdPlannedItem},
|
|
#{chargedItem}, getDate(), #{excludeFromCalculationsDb}, #{excludeFromAsBuiltDb}, #{lotBatchOriginDb}, #{weightShare})
|
|
</insert>
|
|
|
|
<!-- 查recipe明细 -->
|
|
<select id="queryRecipeDetail" parameterType="RecipeHeaderEntity" resultType="RecipeDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
alternative_description,
|
|
status,
|
|
min_lot_qty,
|
|
default_flag,
|
|
note_text as detailNoteText,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
|
|
</select>
|
|
|
|
<!-- 查recipe明细对象 -->
|
|
<select id="queryDetailDataByNo" parameterType="RecipeDetailEntity" resultType="RecipeDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
alternative_description,
|
|
status,
|
|
min_lot_qty,
|
|
default_flag,
|
|
note_text as detailNoteText,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 查recipe子明细 -->
|
|
<select id="queryRecipeComponent" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
a.component_part,
|
|
b.part_desc as componentPartDesc,
|
|
a.print_unit,
|
|
dbo.get_um_name(a.print_unit) as printUnitName,
|
|
a.qty_per_assembly,
|
|
a.component_scrap,
|
|
a.issue_type,
|
|
a.shrinkage_factor,
|
|
a.line_item_no,
|
|
a.operation_no,
|
|
a.issue_to_loc,
|
|
dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName,
|
|
a.note_text,
|
|
a.line_sequence,
|
|
a.consumption_item,
|
|
b.part_status,
|
|
dbo.get_part_status_name(a.site, b.part_status) as partStatusDesc,
|
|
a.parts_by_weight,
|
|
a.qty_uom,
|
|
a.issue_planned_scrap_db,
|
|
a.issue_overreported_qty_db,
|
|
a.fixed_qty_flag,
|
|
a.promise_planned,
|
|
a.phantom_consume,
|
|
a.oper_cost_distribution,
|
|
a.gen_oh_cost_distribution,
|
|
a.qty_kg,
|
|
a.by_prod_as_supply_in_mrp_db,
|
|
a.leadtime_offset,
|
|
a.std_planned_item,
|
|
a.charged_item,
|
|
a.last_activity_date,
|
|
a.exclude_from_calculations_db,
|
|
a.exclude_from_as_built_db,
|
|
a.lot_batch_origin_db,
|
|
a.weight_share
|
|
FROM plm_recipe_component as a
|
|
left join part as b on a.site = b.site and a.component_part = b.part_no
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo} and a.qty_per_assembly <![CDATA[ >= ]]> 0
|
|
order by a.line_sequence
|
|
</select>
|
|
|
|
<!-- 查recipe子明细 -->
|
|
<select id="queryRecipeByProducts" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
a.component_part,
|
|
b.part_desc as componentPartDesc,
|
|
a.print_unit,
|
|
dbo.get_um_name(a.print_unit) as printUnitName,
|
|
abs(a.qty_per_assembly) as qtyPerAssembly,
|
|
a.component_scrap,
|
|
a.issue_type,
|
|
a.shrinkage_factor,
|
|
a.line_item_no,
|
|
a.operation_no,
|
|
a.issue_to_loc,
|
|
dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName,
|
|
a.note_text,
|
|
a.line_sequence,
|
|
a.consumption_item,
|
|
b.part_status,
|
|
dbo.get_part_status_name(a.site, b.part_status) as partStatusDesc,
|
|
a.parts_by_weight,
|
|
a.qty_uom,
|
|
a.issue_planned_scrap_db,
|
|
a.issue_overreported_qty_db,
|
|
a.fixed_qty_flag,
|
|
a.promise_planned,
|
|
a.phantom_consume,
|
|
a.oper_cost_distribution,
|
|
a.gen_oh_cost_distribution,
|
|
a.qty_kg,
|
|
a.by_prod_as_supply_in_mrp_db,
|
|
a.leadtime_offset,
|
|
a.std_planned_item,
|
|
a.charged_item,
|
|
a.last_activity_date,
|
|
a.exclude_from_calculations_db,
|
|
a.exclude_from_as_built_db,
|
|
a.lot_batch_origin_db,
|
|
a.weight_share
|
|
FROM plm_recipe_component as a
|
|
left join part as b on a.site = b.site and a.component_part = b.part_no
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo} and a.qty_per_assembly <![CDATA[ < ]]> 0
|
|
order by a.line_sequence
|
|
</select>
|
|
|
|
<!-- 查recipe子明细 -->
|
|
<select id="queryRecipeComponentAll" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
component_part,
|
|
dbo.get_part_name(site, component_part) as componentPartDesc,
|
|
print_unit,
|
|
dbo.get_um_name(print_unit) as printUnitName,
|
|
qty_per_assembly,
|
|
component_scrap,
|
|
issue_type,
|
|
shrinkage_factor,
|
|
line_item_no,
|
|
operation_no,
|
|
issue_to_loc,
|
|
dbo.get_location_name(site, issue_to_loc) as issueToLocName,
|
|
note_text,
|
|
line_sequence,
|
|
consumption_item,
|
|
parts_by_weight,
|
|
qty_uom,
|
|
issue_planned_scrap_db,
|
|
issue_overreported_qty_db,
|
|
fixed_qty_flag,
|
|
promise_planned,
|
|
phantom_consume,
|
|
oper_cost_distribution,
|
|
gen_oh_cost_distribution,
|
|
qty_kg,
|
|
by_prod_as_supply_in_mrp_db,
|
|
leadtime_offset,
|
|
std_planned_item,
|
|
charged_item,
|
|
last_activity_date,
|
|
exclude_from_calculations_db,
|
|
exclude_from_as_built_db,
|
|
lot_batch_origin_db,
|
|
weight_share
|
|
FROM plm_recipe_component
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
order by line_sequence
|
|
</select>
|
|
|
|
<!-- recipe主表编辑 -->
|
|
<update id="updateRecipeHeader" parameterType="RecipeAllFieldEntity">
|
|
update plm_recipe_header
|
|
set eff_phase_in_date = #{effPhaseInDate},
|
|
eff_phase_out_date = #{effPhaseOutDate},
|
|
eng_revision = #{engRevision},
|
|
type_flag = #{typeFlag},
|
|
net_weight = #{netWeight},
|
|
note_text = #{noteText},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</update>
|
|
|
|
<!-- recipe明细表编辑 -->
|
|
<update id="updateRecipeDetail" parameterType="RecipeDetailEntity">
|
|
update plm_recipe_detail
|
|
set alternative_description = #{alternativeDescription},
|
|
min_lot_qty = #{minLotQty},
|
|
note_text = #{detailNoteText},
|
|
status = #{status},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
display_weight_uom = #{displayWeightUom},
|
|
display_volume_uom = #{displayVolumeUom}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 删除recipe子明细 -->
|
|
<delete id="deleteRecipeComponent" parameterType="RecipeAllFieldEntity">
|
|
delete from plm_recipe_component
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<!-- 删除替代 -->
|
|
<delete id="recipeDetailDelete" parameterType="RecipeDetailEntity">
|
|
delete from plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<!-- recipe主表查重 -->
|
|
<select id="checkRecipeOnlyOne" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
dbo.get_part_name(site, part_no) as partDesc,
|
|
bom_type,
|
|
eng_chg_level,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
eng_revision,
|
|
type_flag,
|
|
net_weight,
|
|
note_text,
|
|
official_flag
|
|
FROM plm_recipe_header
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
|
|
</select>
|
|
|
|
<!-- recipe明细查重 -->
|
|
<select id="checkRecipeDetailOnlyOne" parameterType="RecipeDetailEntity" resultType="RecipeDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
alternative_description,
|
|
bom_type,
|
|
eng_chg_level,
|
|
min_lot_qty,
|
|
default_flag,
|
|
note_text as detailNoteText,
|
|
status,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 批量删除子明细物料 -->
|
|
<delete id="deleteRecipeComponents" parameterType="RecipeComponentEntity">
|
|
delete from plm_recipe_component
|
|
where site = #{site}
|
|
and part_no = #{partNo}
|
|
and eng_chg_level = #{engChgLevel}
|
|
and bom_type = #{bomType}
|
|
and alternative_no = #{alternativeNo}
|
|
and line_item_no = #{lineItemNo}
|
|
</delete>
|
|
|
|
<!-- 删除recipe子明细 -->
|
|
<delete id="deleteRecipeComponentByPartNo" parameterType="RecipeHeaderEntity">
|
|
delete from plm_recipe_component
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</delete>
|
|
|
|
<!-- 删除recipe明细 -->
|
|
<delete id="deleteRecipeDetailByPartNo" parameterType="RecipeHeaderEntity">
|
|
delete from plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</delete>
|
|
|
|
<!-- 删除recipe主记录 -->
|
|
<delete id="deleteRecipeHeaderByPartNo" parameterType="RecipeHeaderEntity">
|
|
delete from plm_recipe_header
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</delete>
|
|
|
|
<!-- recipe明细查重 -->
|
|
<select id="checkRecipeComponentOnlyOne" parameterType="RecipeComponentEntity" resultType="RecipeComponentEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
component_part,
|
|
line_item_no
|
|
FROM plm_recipe_component
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
|
|
</select>
|
|
|
|
<!-- 修改recipe子明细 -->
|
|
<update id="updateRecipeComponent" parameterType="RecipeComponentEntity">
|
|
update plm_recipe_component
|
|
set qty_per_assembly = #{qtyPerAssembly},
|
|
component_scrap = #{componentScrap},
|
|
issue_type = #{issueType},
|
|
shrinkage_factor = #{shrinkageFactor},
|
|
operation_no = #{operationNo},
|
|
issue_to_loc = #{issueToLoc},
|
|
note_text = #{noteText},
|
|
line_sequence = #{lineSequence},
|
|
consumption_item = #{consumptionItem},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
weight_share = #{weightShare},
|
|
parts_by_weight = #{partsByWeight},
|
|
qty_uom = #{qtyUom},
|
|
qty_kg = #{qtyKg}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
|
|
</update>
|
|
|
|
<!-- 修改替代状态 -->
|
|
<update id="updateAlternativeStatus" parameterType="RecipeDetailEntity">
|
|
update plm_recipe_detail
|
|
set status = #{status},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 查recipe明细对象 -->
|
|
<select id="queryOperationList" parameterType="OperationEntity" resultType="OperationEntity">
|
|
select
|
|
a.site,
|
|
a.part_no,
|
|
a.routing_revision,
|
|
a.routing_type,
|
|
a.alternative_no,
|
|
b.alternative_description,
|
|
b.status,
|
|
a.operation_id,
|
|
a.operation_no,
|
|
a.operation_name
|
|
from plm_routing_component as a
|
|
left join plm_routing_detail as 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 and a.alternative_no = b.alternative_no
|
|
<where>
|
|
a.site = #{site} and a.part_no = #{partNo}
|
|
<if test = "routingRevision != null and routingRevision != ''">
|
|
AND a.routing_revision = #{routingRevision}
|
|
</if>
|
|
<if test = "routingType != null and routingType != ''">
|
|
AND a.routing_type = #{routingType}
|
|
</if>
|
|
<if test = "alternativeNo != null and alternativeNo != ''">
|
|
AND a.alternative_no = #{alternativeNo}
|
|
</if>
|
|
<if test = "operationNo != null and operationNo != ''">
|
|
AND a.operation_no = #{operationNo}
|
|
</if>
|
|
<if test = "operationName != null and operationName != ''">
|
|
AND a.operation_name like #{operationName}
|
|
</if>
|
|
<if test = "operationId != null and operationId != ''">
|
|
AND a.operation_id = #{operationId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查 max line_item_no -->
|
|
<select id="selectMaxLineItemNo" parameterType="RecipeComponentEntity" resultType="RecipeComponentEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
component_part,
|
|
line_item_no
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = (
|
|
SELECT MAX(line_item_no)
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo})
|
|
</select>
|
|
|
|
<!-- 判断是否已有该物料的 recipe -->
|
|
<select id="queryPartRecipe" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
|
|
SELECT top 1
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
note_text,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
eng_revision,
|
|
net_weight,
|
|
official_flag
|
|
FROM plm_recipe_header
|
|
WHERE site = #{site} and part_no = #{partNo} and bom_type = #{bomType} order by eng_chg_level desc
|
|
</select>
|
|
|
|
<!-- 获取子料的序号 -->
|
|
<select id="getComponentLineSequence" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT top 1
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
line_sequence
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} order by line_sequence desc
|
|
</select>
|
|
|
|
<!-- 判断该 recipe 是否有 Buildable Obsolete 状态的替代 -->
|
|
<select id="queryAlternativeStatus" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeDetailVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
status,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and (status = 'Buildable' or status = 'Obsolete')
|
|
</select>
|
|
|
|
<!-- 判断该 Recipe 是否有正式的替代 -->
|
|
<select id="queryOfficialRecipeDetail" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeDetailVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
status,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and official_flag = 'Y'
|
|
</select>
|
|
|
|
<!-- 判断 Recipe 是否存在子料 -->
|
|
<select id="queryComponentPart" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
component_part
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</select>
|
|
|
|
<!-- 判断 Recipe 是否存在子料 -->
|
|
<select id="queryComponentPart2" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
component_part
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取ifs header 对象-->
|
|
<select id="getRecipeHeader" parameterType="RecipeDetailEntity" resultType="RecipeIfsHeader">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
note_text,
|
|
create_date,
|
|
'add' as histType
|
|
FROM plm_recipe_header
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</select>
|
|
|
|
<!-- 获取ifs component 对象-->
|
|
<select id="getRecipeComponent" parameterType="RecipeDetailEntity" resultType="RecipeIfsItem">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
alternative_no,
|
|
line_item_no,
|
|
line_sequence,
|
|
component_part,
|
|
qty_per_assembly,
|
|
issue_type,
|
|
component_scrap,
|
|
shrinkage_factor,
|
|
note_text,
|
|
consumption_item,
|
|
operation_no,
|
|
parts_by_weight,
|
|
qty_uom,
|
|
issue_planned_scrap_db,
|
|
issue_overreported_qty_db,
|
|
fixed_qty_flag,
|
|
promise_planned,
|
|
phantom_consume,
|
|
oper_cost_distribution,
|
|
gen_oh_cost_distribution,
|
|
qty_kg,
|
|
by_prod_as_supply_in_mrp_db,
|
|
leadtime_offset,
|
|
std_planned_item,
|
|
charged_item,
|
|
last_activity_date,
|
|
exclude_from_calculations_db,
|
|
exclude_from_as_built_db,
|
|
lot_batch_origin_db,
|
|
weight_share
|
|
FROM plm_recipe_component
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取recipe header 对象-->
|
|
<select id="queryRecipeHeader" parameterType="RecipeHeaderEntity" resultType="RecipeHeaderEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
bom_type,
|
|
note_text,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
eng_revision,
|
|
row_version,
|
|
row_key,
|
|
type_flag,
|
|
net_weight
|
|
FROM plm_recipe_header
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</select>
|
|
|
|
<!-- recipe主表编辑 -->
|
|
<update id="updateInDate" parameterType="RecipeHeaderEntity">
|
|
update plm_recipe_header
|
|
set eff_phase_out_date = #{effPhaseOutDate},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</update>
|
|
|
|
<!-- 校验物料版本是否存在-->
|
|
<select id="queryPartRevision" parameterType="RecipeHeaderEntity" resultType="PartRevisionEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
revision_text,
|
|
product_status,
|
|
repair_status,
|
|
eng_revision,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM part_revision
|
|
WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
|
|
</select>
|
|
|
|
<!-- 新增物料版本 -->
|
|
<insert id="savePartRevision" parameterType="RecipeHeaderEntity">
|
|
insert into part_revision (site, part_no, eng_chg_level, eff_phase_in_date, eff_phase_out_date, revision_text, product_status, repair_status, eng_revision, create_date, create_by)
|
|
values (#{site}, #{partNo}, #{engChgLevel}, #{effPhaseInDate}, #{effPhaseOutDate}, #{noteText}, 'Not In Effect', 'Not In Effect', #{engRevision}, getDate(), #{createBy})
|
|
</insert>
|
|
|
|
<select id="queryRecipeDetailOfficialFlag" parameterType="RecipeComponentEntity" resultType="RecipeDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
alternative_description,
|
|
min_lot_qty,
|
|
default_flag,
|
|
note_text as detailNoteText,
|
|
status,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 获取 component 对象-->
|
|
<select id="queryComponentPartFlag" parameterType="RecipeDetailEntity" resultType="PartInformationEntity">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
b.status
|
|
FROM plm_recipe_component as a
|
|
LEFT JOIN part as b on a.site = b.site and a.component_part = b.part_no
|
|
WHERE a.site = #{site} and a.part_no = #{partNo} and a.eng_chg_level = #{engChgLevel} and a.bom_type = #{bomType} and a.alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<select id="queryRecipeDetailEntityList" resultType="com.spring.modules.part.entity.RecipeDetailEntity">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
alternative_description,
|
|
status,
|
|
min_lot_qty,
|
|
default_flag,
|
|
note_text as detailNoteText,
|
|
official_flag,
|
|
display_weight_uom,
|
|
display_volume_uom,
|
|
reg_unit
|
|
FROM plm_recipe_detail
|
|
where site = #{site} and part_no = #{partNo}
|
|
order by eng_chg_level desc
|
|
</select>
|
|
|
|
<!-- 查询库位 -->
|
|
<select id="selectLocation" parameterType="RecipeComponentEntity" resultType="LocationInformationEntity">
|
|
SELECT
|
|
site,
|
|
location_id,
|
|
location_name
|
|
FROM view_location
|
|
<where>
|
|
site = #{site} AND location_id = #{issueToLoc}
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询part revision -->
|
|
<select id="selectPartRevision" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.PartRevisionVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
eng_chg_level,
|
|
eff_phase_in_date,
|
|
eff_phase_out_date,
|
|
revision_text,
|
|
product_status,
|
|
repair_status,
|
|
eng_revision
|
|
FROM part_revision
|
|
where site = #{site} AND part_no = #{partNo} and eng_chg_level = #{engChgLevel}
|
|
</select>
|
|
|
|
<!-- 修改revision状态 -->
|
|
<update id="updatePartRevisionProductStatus" parameterType="com.spring.modules.part.vo.PartRevisionVo">
|
|
update part_revision
|
|
set product_status = #{productStatus},
|
|
<if test = "bomType == 'Repair'">
|
|
repair_status = 'In Effect',
|
|
</if>
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
|
|
</update>
|
|
|
|
<!-- 新增副产品成本分配数据 -->
|
|
<insert id="saveRecipeManufStructCostDistrib">
|
|
insert into plm_recipe_manuf_struct_cost_distrib
|
|
(site, part_no, eng_chg_level, bom_type, alternative_no, by_prod_line_item_no, component_line_item_no, item_cost_distribution, component_part_no, by_prod_part_no, create_date, create_by) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.byProdLineItemNo}, #{item.componentLineItemNo}, #{item.itemCostDistribution,jdbcType=FLOAT}, #{item.componentPartNo}, #{item.byProdPartNo}, getDate(), #{item.createBy})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查recipe副产品成本分配 -->
|
|
<select id="queryRecipeManufStructCostDistrib" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
by_prod_line_item_no,
|
|
component_line_item_no,
|
|
item_cost_distribution,
|
|
component_part_no,
|
|
dbo.get_part_name(site, component_part_no) as componentPartDesc,
|
|
by_prod_part_no,
|
|
dbo.get_part_name(site, by_prod_part_no) as byProdPartDesc
|
|
FROM plm_recipe_manuf_struct_cost_distrib
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<delete id="deletemanufStructCostDistribByProductPartNo" parameterType="RecipeComponentEntity">
|
|
delete from plm_recipe_manuf_struct_cost_distrib
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{lineItemNo}
|
|
</delete>
|
|
|
|
<delete id="deletemanufStructCostDistribByComponentPartNo" parameterType="RecipeComponentEntity">
|
|
delete from plm_recipe_manuf_struct_cost_distrib
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and component_line_item_no = #{lineItemNo}
|
|
</delete>
|
|
|
|
<!-- 编辑副产品成本分配 -->
|
|
<update id="updateManufStructCostDistrib" parameterType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
|
|
update plm_recipe_manuf_struct_cost_distrib
|
|
set item_cost_distribution = #{itemCostDistribution,jdbcType=FLOAT},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{byProdLineItemNo} and component_line_item_no = #{componentLineItemNo}
|
|
</update>
|
|
|
|
<!-- 查recipe子明细 -->
|
|
<select id="queryRecipeMultiLevelStructureList" parameterType="RecipeDetailEntity" resultType="RecipeMultiLevelStructureData">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
dbo.get_part_name(a.site, a.part_no) as partDesc,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
b.alternative_description,
|
|
a.component_part,
|
|
dbo.get_part_name(a.site, a.component_part) as componentPartDesc,
|
|
a.qty_per_assembly,
|
|
a.print_unit,
|
|
dbo.get_um_name(a.print_unit) as printUnitName,
|
|
c.product_group_id4,
|
|
dbo.get_product_group_name(c.site, c.product_group_id4, '4') as productGroupName4,
|
|
c.min_order_qty,
|
|
c.mul_order_qty,
|
|
c.planning_method,
|
|
c.cum_lead_time,
|
|
c.unprotected_lead_time,
|
|
dbo.get_cum_lead_time(a.site, a.component_part) as componentCumLeadTime,
|
|
dbo.get_unprotected_lead_time(a.site, a.component_part) as componentUnprotectedLeadTime
|
|
FROM plm_recipe_component as a
|
|
LEFT JOIN plm_recipe_detail as b on a.site = b.site and a.part_no = b.part_no and a.bom_type = b.bom_type and a.eng_chg_level = b.eng_chg_level and a.alternative_no = b.alternative_no
|
|
LEFT JOIN part as c on a.site = c.site and a.part_no = c.part_no
|
|
where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<!-- 新增Recipe子明细表内容 -->
|
|
<insert id="saveRecipeComponents">
|
|
insert into plm_recipe_component
|
|
(site, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type,
|
|
issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
|
|
fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
|
|
charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
|
|
VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.componentPart}, #{item.lineItemNo}, #{item.printUnit}, #{item.qtyPerAssembly}, #{item.componentScrap}, #{item.shrinkageFactor}, #{item.issueType},
|
|
#{item.issueToLoc}, #{item.operationNo}, #{item.noteText}, getDate(), #{item.createBy}, #{item.lineSequence}, #{item.consumptionItem}, #{item.partsByWeight}, #{item.qtyUom}, #{item.issuePlannedScrapDb}, #{item.issueOverreportedQtyDb},
|
|
#{item.fixedQtyFlag}, #{item.promisePlanned}, #{item.phantomConsume}, #{item.operCostDistribution}, #{item.genOhCostDistribution}, #{item.qtyKg}, #{item.byProdAsSupplyInMrpDb}, #{item.leadtimeOffset}, #{item.stdPlannedItem},
|
|
#{item.chargedItem}, getDate(), #{item.excludeFromCalculationsDb}, #{item.excludeFromAsBuiltDb}, #{item.lotBatchOriginDb}, #{item.weightShare})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateRecipeHeaderOfficialFlag" parameterType="com.spring.modules.part.vo.RecipeDetailVo">
|
|
update plm_recipe_header
|
|
set official_flag = 'Y'
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
|
|
</update>
|
|
|
|
<update id="updateRecipeDetailOfficialFlag" parameterType="com.spring.modules.part.vo.RecipeDetailVo">
|
|
update plm_recipe_detail
|
|
set official_flag = 'Y'
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</update>
|
|
|
|
<!-- 查recipe副产品成本分配 -->
|
|
<select id="queryRecipeManufStructCostDistribToIfs" resultType="RecipeIfsManufStructCostDistrib">
|
|
SELECT
|
|
site as contract,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
by_prod_line_item_no,
|
|
component_line_item_no,
|
|
item_cost_distribution,
|
|
component_part_no,
|
|
by_prod_part_no as byProductPartNo,
|
|
FROM plm_recipe_manuf_struct_cost_distrib
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
|
|
<delete id="deleteManufStructCostDistribByAlternative" parameterType="RecipeDetailEntity">
|
|
delete from plm_recipe_manuf_struct_cost_distrib
|
|
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
|
|
</delete>
|
|
|
|
<select id="selectRecipeHeaderByPartNo" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.note_text,
|
|
a.eff_phase_in_date,
|
|
a.eff_phase_out_date,
|
|
a.eng_revision,
|
|
a.type_flag,
|
|
a.net_weight,
|
|
a.official_flag
|
|
FROM plm_recipe_header as a
|
|
left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
|
|
where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
|
|
</select>
|
|
|
|
<select id="selectRecipeDetailByPartNo" resultType="com.spring.modules.part.vo.RecipeDetailVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
a.alternative_description,
|
|
a.status,
|
|
a.min_lot_qty,
|
|
a.default_flag,
|
|
a.note_text as detailNoteText,
|
|
a.official_flag,
|
|
a.display_weight_uom,
|
|
a.display_volume_uom,
|
|
a.reg_unit
|
|
FROM plm_recipe_detail as a
|
|
left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
|
|
where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
|
|
</select>
|
|
|
|
<!-- recipe明细查重 -->
|
|
<select id="selectRecipeComponentByPartNo" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
a.component_part,
|
|
a.print_unit,
|
|
a.qty_per_assembly,
|
|
a.component_scrap,
|
|
a.issue_type,
|
|
a.shrinkage_factor,
|
|
a.line_item_no,
|
|
a.operation_no,
|
|
a.issue_to_loc,
|
|
a.note_text,
|
|
a.line_sequence,
|
|
a.consumption_item,
|
|
a.parts_by_weight,
|
|
a.qty_uom,
|
|
a.issue_planned_scrap_db,
|
|
a.issue_overreported_qty_db,
|
|
a.fixed_qty_flag,
|
|
a.promise_planned,
|
|
a.phantom_consume,
|
|
a.oper_cost_distribution,
|
|
a.gen_oh_cost_distribution,
|
|
a.qty_kg,
|
|
a.by_prod_as_supply_in_mrp_db,
|
|
a.leadtime_offset,
|
|
a.std_planned_item,
|
|
a.charged_item,
|
|
a.last_activity_date,
|
|
a.exclude_from_calculations_db,
|
|
a.exclude_from_as_built_db,
|
|
a.lot_batch_origin_db,
|
|
a.weight_share
|
|
FROM plm_recipe_component as a
|
|
left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
|
|
where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
|
|
</select>
|
|
|
|
<!-- 查recipe副产品成本分配 -->
|
|
<select id="selectRecipeManufStructCostDistribByPartNo" resultType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
|
|
SELECT
|
|
a.site,
|
|
a.part_no,
|
|
a.bom_type,
|
|
a.eng_chg_level,
|
|
a.alternative_no,
|
|
a.by_prod_line_item_no,
|
|
a.component_line_item_no,
|
|
a.item_cost_distribution,
|
|
a.component_part_no,
|
|
a.by_prod_part_no
|
|
FROM plm_recipe_manuf_struct_cost_distrib as a
|
|
left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
|
|
where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
|
|
</select>
|
|
|
|
<!-- 查recipe子明细 -->
|
|
<select id="queryRecipeComponentList" parameterType="RecipeComponentEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
|
|
SELECT
|
|
site,
|
|
part_no,
|
|
bom_type,
|
|
eng_chg_level,
|
|
alternative_no,
|
|
component_part,
|
|
print_unit,
|
|
qty_per_assembly,
|
|
component_scrap,
|
|
issue_type,
|
|
shrinkage_factor,
|
|
line_item_no,
|
|
operation_no,
|
|
issue_to_loc,
|
|
note_text,
|
|
line_sequence,
|
|
consumption_item,
|
|
parts_by_weight,
|
|
qty_uom,
|
|
issue_planned_scrap_db,
|
|
issue_overreported_qty_db,
|
|
fixed_qty_flag,
|
|
promise_planned,
|
|
phantom_consume,
|
|
oper_cost_distribution,
|
|
gen_oh_cost_distribution,
|
|
qty_kg,
|
|
by_prod_as_supply_in_mrp_db,
|
|
leadtime_offset,
|
|
std_planned_item,
|
|
charged_item,
|
|
last_activity_date,
|
|
exclude_from_calculations_db,
|
|
exclude_from_as_built_db,
|
|
lot_batch_origin_db,
|
|
weight_share
|
|
FROM plm_recipe_component
|
|
where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
|
|
</select>
|
|
</mapper>
|