huangjiayang
2025-05-07 dfa0c439d2d7626d56c37dbee2f72f5e5cd0f553
aps-modules/aps-job/src/main/resources/mapper/job/ApsWorkOrderJobMapper.xml
@@ -83,6 +83,42 @@
            <if test="nextOpName != null  and nextOpName != ''"> and next_op_name = #{nextOpName}</if>
        </where>
    </select>
    <select id="selectApsWorkOrderJobListDocNoNotNull" parameterType="ApsWorkOrderJob" resultMap="ApsWorkOrderJobResult">
        <include refid="selectApsWorkOrderJobVo"/>
        <where>
            <if test="orderId != null  and orderId != ''"> and order_id = #{orderId}</if>
            <if test="docNo != null  and docNo != ''"> and doc_no = #{docNo}</if>
            <if test="mainitemCode != null  and mainitemCode != ''"> and mainitem_code = #{mainitemCode}</if>
            <if test="mainitemFigure != null  and mainitemFigure != ''"> and mainitem_figure = #{mainitemFigure}</if>
            <if test="customerName != null  and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
            <if test="businessType != null "> and business_type = #{businessType}</if>
            <if test="demandType != null  and demandType != ''"> and demand_type = #{demandType}</if>
            <if test="docStatus != null "> and doc_status = #{docStatus}</if>
            <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode}</if>
            <if test="itemFigure != null  and itemFigure != ''"> and item_figure = #{itemFigure}</if>
            <if test="itemFigureVersion != null  and itemFigureVersion != ''"> and item_figure_version = #{itemFigureVersion}</if>
            <if test="pruductQty != null "> and pruduct_qty = #{pruductQty}</if>
            <if test="workQty != null "> and work_qty = #{workQty}</if>
            <if test="opNum != null  and opNum != ''"> and op_num = #{opNum}</if>
            <if test="workCenter != null "> and work_center = #{workCenter}</if>
            <if test="dept != null  and dept != ''"> and dept = #{dept}</if>
            <if test="startDate != null  and startDate != ''"> and start_date = #{startDate}</if>
            <if test="completeDate != null  and completeDate != ''"> and complete_date = #{completeDate}</if>
            <if test="nextDept != null  and nextDept != ''"> and next_dept = #{nextDept}</if>
            <if test="isHoldRelease != null "> and is_hold_release = #{isHoldRelease}</if>
            <if test="isOutSource != null  and isOutSource != ''"> and is_out_source = #{isOutSource}</if>
            <if test="org != null  and org != ''"> and org = #{org}</if>
            <if test="pageNum != null "> and page_num = #{pageNum}</if>
            <if test="pageIndex != null "> and page_index = #{pageIndex}</if>
            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
            <if test="processStatus != null  and processStatus != ''"> and process_status = #{processStatus}</if>
            <if test="delFlag != null  and delFlag != ''"> and del_flag = #{delFlag}</if>
            <if test="opStatus != null  and opStatus != ''"> and op_status = #{opStatus}</if>
            <if test="nextOpName != null  and nextOpName != ''"> and next_op_name = #{nextOpName}</if>
            and doc_no is not null
        </where>
    </select>
    
    <select id="selectApsWorkOrderJobById" parameterType="Long" resultMap="ApsWorkOrderJobResult">
        <include refid="selectApsWorkOrderJobVo"/>
@@ -220,6 +256,7 @@
    <insert id="batchInsertApsWorkOrderJob" parameterType="java.util.List">
        insert into aps_work_order_job
        <trim prefix="(" suffix=")" suffixOverrides=",">
            id,
            order_id,
            doc_no,
            mainitem_code,
@@ -258,6 +295,7 @@
        values
        <foreach collection="list" item="job" separator=",">
            (
            #{job.id},
            #{job.orderId},
            #{job.docNo},
            #{job.mainitemCode},
@@ -337,8 +375,8 @@
            order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name
        from aps_work_order_job
        where ( doc_status in (0,1,2,4) and is_hold_release='0'
                and (mainitem_code like 'M01%' or mainitem_code like 'M02%'or mainitem_code like 'M05%' or mainitem_code like 'M10%'
                    or mainitem_code like 'M14%'or mainitem_code like 'M15%' or mainitem_code like 'F%' or mainitem_code like 'Z%'
                and (item_code like 'M01%' or item_code like 'M02%'or item_code like 'M05%' or item_code like 'M10%'
                    or item_code like 'M14%'or item_code like 'M15%' or item_code like 'F%' or item_code like 'Z%'
                )
        );
    </insert>
@@ -355,7 +393,7 @@
            process_number,work_center,department,
            plan_start_day,plan_end_day,next_process_deparment,
            is_suspended,is_outsourcing,account,
            id,create_time,del_flag,plant,order_status,,std_op,op_status,next_op_name
            id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name
        )
        select
            doc_no,mainitem_code,mainitem_figure,
@@ -368,7 +406,7 @@
            order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name
        from aps_work_order_job
        where ( doc_status in (0,1,2,4) and is_hold_release='0'
                and (mainitem_code like 'M03%' or mainitem_code like 'M04%'or mainitem_code like 'A75%')
                and (item_code like 'M03%' or item_code like 'M04%'or item_code like 'A75%')
              );
    </insert>
@@ -385,7 +423,7 @@
            process_number,work_center,department,
            plan_start_day,plan_end_day,next_process_deparment,
            is_suspended,is_outsourcing,account,
            id,create_time,del_flag,plant,order_status,std_op,plan_type,op_status,next_op_name
            id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name,plan_type
        )
        select
            doc_no,mainitem_code,mainitem_figure,
@@ -396,9 +434,9 @@
            start_date,complete_date,next_dept,
            is_hold_release,is_out_source,org_code,
            order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name,
            case when substr(mainitem_code,3)='A65' then 'gas' else  'piping'  end  as  plan_type
            case when substr(item_code,0,4)='A65' then 'gas' else  'piping'  end  as  plan_type
        from aps_work_order_job
        where ( doc_status in (0,1,2,4) and is_hold_release='0'
            and (mainitem_code like 'A65%' or mainitem_code like 'W%'));
            and (item_code like 'A65%' or item_code like 'W%'));
    </insert>
</mapper>