sfd
2025-05-09 a080d67b9964cd632f52c481c0f20ef2e3e7073a
aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
@@ -43,10 +43,23 @@
        <result property="stdOp"    column="std_op"    />
        <result property="opStatus"    column="op_status"    />
        <result property="nextOpName"    column="next_op_name"    />
        <result property="unmatchedQuantity"    column="unmatched_quantity"    />
        <result property="productionBase"    column="production_base"    />
        <result property="orderCreateTime"    column="order_create_time"    />
        <result property="professionalAffiliation"    column="professional_affiliation"    />
        <result property="requireId"    column="require_id"    />
    </resultMap>
    <sql id="selectApsPlatePlanVo">
        select id, master_planner, week_day, week_cycle, main_part_number, main_part_drawing_number, customer, business_type, document_number, requirement_type, document_status, item_number, drawing_no, version_number, production_quantity, good_products_quantity, process_number, work_center, department, plan_start_day, plan_end_day, standby_number, standby_name, standby_stock, next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials, advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete, has_turnback, has_risk, std_op, op_status, next_op_name from aps_plate_plan
        select id, master_planner, week_day, week_cycle, main_part_number, main_part_drawing_number,
               customer, business_type, document_number, requirement_type, document_status, item_number,
               drawing_no, version_number, production_quantity, good_products_quantity, process_number,
               work_center, department, plan_start_day, plan_end_day, standby_number, standby_name,
               standby_stock, next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials,
               advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete,
               has_turnback, has_risk, std_op, op_status, next_op_name ,unmatched_quantity,professional_affiliation
               , production_base, order_create_time
        from aps_plate_plan
    </sql>
    <select id="selectApsPlatePlanList" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
@@ -140,6 +153,7 @@
            <if test="stdOp != null">std_op,</if>
            <if test="opStatus != null">op_status,</if>
            <if test="nextOpName != null">next_op_name,</if>
            <if test="unmatchedQuantity != null">unmatched_quantity,</if>
            create_time,
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
@@ -181,6 +195,7 @@
            <if test="stdOp != null">#{stdOp},</if>
            <if test="opStatus != null">#{opStatus},</if>
            <if test="nextOpName != null">#{nextOpName},</if>
            <if test="unmatchedQuantity != null">#{unmatchedQuantity},</if>
            #{createTime},
         </trim>
    </insert>
@@ -225,6 +240,7 @@
            <if test="stdOp != null">std_op = #{stdOp},</if>
            <if test="opStatus != null"> op_status= #{opStatus},</if>
            <if test="nextOpName != null"> next_op_name= #{nextOpName},</if>
            <if test="unmatchedQuantity != null"> unmatched_quantity = #{unmatchedQuantity},</if>
        </trim>
        where id = #{id}
    </update>
@@ -252,4 +268,47 @@
        update  aps_plate_plan  set del_flag='1' where del_flag ='0'
    </update>
    <select id="selectPlatePlanByPlantMajor" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
        select  id,document_number,plan_end_day, main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id
        from aps_plate_plan
        <where>
            <if test="plant != null "> and plant = #{plant}</if>
            <if test="professionalAffiliation != null "> and professional_affiliation = #{professionalAffiliation}</if>
            and del_flag='0'
        </where>
        order by document_number asc,id asc
    </select>
    <select id="selectUnMatchPlateSubPlan" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
        select  id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,
             unmatched_quantity
        from aps_plate_plan
        where  del_flag='0' and professional_affiliation !='0' and unmatched_quantity > 0
        <if test="plant != null  and plan !='' "> and plant = #{plant}</if>
        order by document_number asc,id asc
        limit 1
    </select>
    <update id="updatePlanUnMatchQtyByVersion" parameterType="ApsPlatePlan">
        update aps_plate_plan
        set unmatched_quantity=#{unmatchedQuantity},version=version+1
        where id=#{id} and version=#{version}
    </update>
    <select id="selectPlateRedundantOrderList" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
        select document_number, item_number, production_quantity, unmatched_quantity, plant, production_base, plan_start_day, plan_end_day, order_create_time
        from aps_plate_plan where unmatched_quantity>0 and professional_affiliation!='0'
        <if test="documentNumber != null and documentNumber != ''">
            and document_number like '%' || #{documentNumber} || '%'
        </if>
        <if test="itemNumber != null and itemNumber != ''">
            and item_number like '%' || #{itemNumber} || '%'
        </if>
    </select>
    <update id="initUnMatchQty" >
        update aps_plate_plan
            set unmatched_quantity=production_quantity, version=0
        where   del_flag='0' and professional_affiliation !='0'
    </update>
</mapper>