dy
2025-04-23 fb4a281ee23c8ddfb6cfc41a7ee6c43fc0eb8885
aps-modules/aps-job/src/main/resources/mapper/job/ApsWorkOrderJobMapper.xml
@@ -35,10 +35,16 @@
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="processStatus"    column="process_status"    />
    </resultMap>
    <sql id="selectApsWorkOrderJobVo">
        select id, order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type, doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center, dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index, del_flag, create_by, create_time, update_by, update_time from aps_work_order_job
        select id, order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type,
               doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center,
               dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index,
               del_flag, create_by, create_time, update_by, update_time , process_status,org_code
        from aps_work_order_job
    </sql>
    <select id="selectApsWorkOrderJobList" parameterType="ApsWorkOrderJob" resultMap="ApsWorkOrderJobResult">
@@ -68,6 +74,8 @@
            <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>
        </where>
    </select>
@@ -109,6 +117,8 @@
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="orgCode != null">org_code,</if>
            <if test="processStatus != null">process_status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="orderId != null">#{orderId},</if>
@@ -140,6 +150,8 @@
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="orgCode != null">#{orgCode},</if>
            <if test="processStatus != null">#{processStatus},</if>
         </trim>
    </insert>
@@ -175,6 +187,8 @@
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="orgCode != null"> org_code= #{orgCode},</if>
            <if test="processStatus != null"> process_status= #{processStatus},</if>
        </trim>
        where id = #{id}
    </update>
@@ -221,7 +235,9 @@
            create_by,
            create_time,
            update_by,
            update_time
            update_time,
            org_code,
            process_status
        </trim>
        values
        <foreach collection="list" item="job" separator=",">
@@ -254,9 +270,56 @@
            #{job.createBy},
            #{job.createTime},
            #{job.updateBy},
            #{job.updateTime}
            #{job.updateTime},
            #{job.orgCode},
            #{job.processStatus}
            )
        </foreach>
    </insert>
    <delete id="deleteWorkOrderJobByOrderIds" parameterType="String">
        delete from aps_work_order_job where order_id in
        <foreach item="id" collection="orderIds" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
    <update id="updateApsWorkOrderJobPrccessStatus" parameterType="map">
        update aps_work_order_job
        set process_status = #{status}
        where doc_no in
        <foreach item="docNo" collection="docNos" open="(" separator="," close=")">
            #{docNo}
        </foreach>
    </update>
    <delete id="deleteAllPartPlan" >
        delete from aps_part_plan where del_flag in ('0','1')
    </delete>
    <insert id="batchInsertPartPlan">
        insert into aps_part_plan
        (
            document_number,main_part_number,main_part_drawing_number,
            customer,business_type,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,next_process_deparment,
            is_suspended,is_outsourcing,account,
            id,create_time,del_flag,plant,order_status
        )
        select
            doc_no,mainitem_code,mainitem_figure,
            customer_name,business_type,demand_type,
            doc_status,item_code,item_figure,
            item_figure_version,pruduct_qty,work_qty,
            op_num,work_center,dept,
            start_date,complete_date,next_dept,
            is_hold_release,is_out_source,org_code,
            order_id,now(),'0',org_code,doc_status
        from aps_work_order_job
        where ( doc_status in (0,1,2,4) 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%')
        );
    </insert>
</mapper>