|
|
<?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.BomManagementMapper">
<!-- 材料信息列表 --> <select id="bomManagementSearch" parameterType="com.spring.modules.part.vo.BomHeaderVo" resultType="com.spring.modules.part.vo.BomHeaderVo"> SELECT site, part_no, dbo.get_part_name(site, part_no) as partDesc, eng_chg_level, bom_type, note_text, eff_phase_in_date, eff_phase_out_date, eng_revision, type_flag, net_weight, create_date, create_by, update_date, update_by FROM plm_bom_header <where> site = #{query.site} <if test = "query.partNo != null and query.partNo != ''"> AND part_no like #{query.partNo} </if> <if test = "query.partDesc != null and query.partDesc != ''"> AND dbo.get_part_name(site, part_no) like #{query.partDesc} </if> </where> </select>
<!-- 查询物料清单 --> <select id="queryPartList" parameterType="PartInformationEntity" resultType="BomAllFieldEntity"> SELECT site, part_no, part_desc, um_id as printUnit, dbo.get_um_name(site, um_id) as printUnitName FROM part <where> site = #{site} and active = 'Y' <if test = "partNo != null and partNo != ''"> AND part_no like #{partNo} </if> <if test = "partDesc != null and partDesc != ''"> AND part_desc like #{partDesc} </if> </where> </select>
<!-- 新增BOM主表内容 --> <insert id="saveBomHeader" parameterType="BomHeaderEntity"> INSERT INTO plm_bom_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, create_date, create_by) VALUES (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{noteText}, #{effPhaseInDate}, #{effPhaseOutDate}, #{engRevision}, #{typeFlag}, #{netWeight}, getDate(), #{createBy}) </insert>
<!-- bom明细新增 --> <insert id="bomDetailSave" parameterType="BomDetailEntity"> INSERT INTO plm_bom_detail (site, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, min_lot_qty, default_flag, note_text, create_date, create_by) VALUES (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy}) </insert>
<!-- 新增BOM子明细表内容 --> <insert id="saveBomComponent" parameterType="BomComponentEntity"> INSERT INTO plm_bom_component (site, part_no, eng_chg_level, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_no, note_text, create_date, create_by) VALUES (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType}, #{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy}) </insert>
<!-- 查bom明细 --> <select id="queryBomDetail" parameterType="BomHeaderEntity" resultType="BomDetailEntity"> SELECT site, part_no, bom_type, eng_chg_level, alternative_no, alternative_description, min_lot_qty, default_flag, note_text as detailNoteText FROM plm_bom_detail where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} </select>
<!-- 查bom明细对象 --> <select id="queryDetailDataByNo" parameterType="BomDetailEntity" resultType="BomDetailEntity"> SELECT site, part_no, bom_type, eng_chg_level, alternative_no, alternative_description, min_lot_qty, default_flag, note_text as detailNoteText FROM plm_bom_detail where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} </select>
<!-- 查bom子明细 --> <select id="queryBomComponent" parameterType="BomDetailEntity" resultType="com.spring.modules.part.vo.BomComponentVo"> 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(site, print_unit) as printUnitName, qty_per_assembly, component_scrap, issue_type, case when issue_type = 'A' then '领退料倒冲' when issue_type = 'B' then '工单倒冲' when issue_type = 'C' then '生产订单倒冲' when issue_type = 'D' then '投料倒冲' when issue_type = 'E' then '批次倒冲' when issue_type = 'F' then '销售订单倒冲' when issue_type = 'G' then '项目倒冲' else '' end as issueTypeName, shrinkage_factor, line_item_no, operation_no, issue_to_loc, dbo.get_location_name(site, issue_to_loc) as issueToLocName, note_text as componentNoteText FROM plm_bom_component where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} </select>
<!-- bom主表编辑 --> <update id="updateBomHeader" parameterType="BomAllFieldEntity"> update plm_bom_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>
<!-- bom明细表编辑 --> <update id="updateBomDetail" parameterType="BomAllFieldEntity"> update plm_bom_detail set alternative_description = #{alternativeDescription}, min_lot_qty = #{minLotQty}, note_text = #{detailNoteText}, 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>
<!-- 删除bom子明细 --> <delete id="deleteBomComponent" parameterType="BomAllFieldEntity"> delete from plm_bom_component where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} </delete>
<!-- 删除替代 --> <delete id="bomDetailDelete" parameterType="BomDetailEntity"> delete from plm_bom_detail where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} </delete>
<!-- bom主表查重 --> <select id="checkBomOnlyOne" parameterType="BomAllFieldEntity" resultType="com.spring.modules.part.vo.BomHeaderVo"> 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 FROM plm_bom_header where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} </select>
<!-- bom明细查重 --> <select id="checkBomDetailOnlyOne" parameterType="BomDetailEntity" resultType="BomDetailEntity"> SELECT site, part_no, bom_type, eng_chg_level, alternative_no FROM plm_bom_detail where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} </select>
<!-- 批量删除子明细物料 --> <insert id="deleteBomComponents"> delete from plm_bom_component where <foreach collection="list" item="item" separator=","> (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType} and alternative_no = #{item.alternativeNo} and component_part = #{item.componentPart}) </foreach> </insert>
<!-- 删除bom子明细 --> <insert id="deleteBomComponentByPartNo"> delete from plm_bom_component where <foreach collection="list" item="item" separator=","> (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType}) </foreach> </insert>
<!-- 删除bom明细 --> <insert id="deleteBomDetailByPartNo"> delete from plm_bom_detail where <foreach collection="list" item="item" separator=","> (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType}) </foreach> </insert>
<!-- 删除bom主记录 --> <insert id="deleteBomHeaderByPartNo"> delete from plm_bom_header where <foreach collection="list" item="item" separator=","> (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType}) </foreach> </insert>
<!-- bom明细查重 --> <select id="checkBomComponentOnlyOne" parameterType="BomComponentEntity" resultType="BomComponentEntity"> SELECT site, part_no, bom_type, eng_chg_level, alternative_no, component_part FROM plm_bom_component where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and component_part = #{componentPart} </select>
<!-- 修改bom子明细 --> <update id="updateBomComponent" parameterType="BomComponentEntity"> update plm_bom_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}, 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 component_part = #{componentPart} </update></mapper>
|