huangjiayang
2025-04-29 7a31cf800bcc70d598c63863f637cf0a183a940e
aps-modules/aps-core/src/main/resources/mapper/core/ApsGasPipingRouteStatMapper.xml
@@ -26,10 +26,20 @@
        <result property="planStartYear"    column="plan_start_year"    />
        <result property="planStartMonth"    column="plan_start_month"    />
        <result property="planStartDay"    column="plan_start_day"    />
        <result property="processPlanEndDay"    column="process_plan_end_day"    />
        <result property="orderPlanEndDay"    column="order_plan_end_day"    />
        <result property="routeProcessNumber"    column="route_process_number"    />
        <result property="warning"    column="warning"    />
    </resultMap>
    <sql id="selectApsGasPipingRouteStatVo">
        select id, work_order_no, road_process_number, current_process_number, production_quantity, standard_time, process_total_time, process_plan_start_day, design_times, del_flag, create_by, process_name, create_time, item_number, standard_dosage, process_total_dosage, design_capacity, major, plan_start_year, plan_start_month, plan_start_day from aps_gas_piping_route_stat
        select id, work_order_no, road_process_number, current_process_number,
               production_quantity, standard_time, process_total_time,
               process_plan_start_day, design_times, del_flag, create_by,
               process_name, create_time, item_number, standard_dosage,
               process_total_dosage, design_capacity, major, plan_start_year,
               plan_start_month, plan_start_day , warning
        from aps_gas_piping_route_stat
    </sql>
    <select id="selectApsGasPipingRouteStatList" parameterType="ApsGasPipingRouteStat" resultMap="ApsGasPipingRouteStatResult">
@@ -75,7 +85,7 @@
            <if test="productionQuantity != null">production_quantity,</if>
            <if test="standardTime != null">standard_time,</if>
            <if test="processTotalTime != null">process_total_time,</if>
            <if test="processPlanStartDay != null and processPlanStartDay != ''">process_plan_start_day,</if>
            <if test="processPlanStartDay != null ">process_plan_start_day,</if>
            <if test="designTimes != null">design_times,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
@@ -89,6 +99,10 @@
            <if test="planStartYear != null">plan_start_year,</if>
            <if test="planStartMonth != null">plan_start_month,</if>
            <if test="planStartDay != null">plan_start_day,</if>
            <if test="processPlanEndDay != null">process_plan_end_day,</if>
            <if test="orderPlanEndDay != null">order_plan_end_day,</if>
            <if test="batchNumber != null">batch_number,</if>
            <if test="warning != null">warning,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
@@ -98,7 +112,7 @@
            <if test="productionQuantity != null">#{productionQuantity},</if>
            <if test="standardTime != null">#{standardTime},</if>
            <if test="processTotalTime != null">#{processTotalTime},</if>
            <if test="processPlanStartDay != null and processPlanStartDay != ''">#{processPlanStartDay},</if>
            <if test="processPlanStartDay != null ">#{processPlanStartDay},</if>
            <if test="designTimes != null">#{designTimes},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
@@ -112,6 +126,10 @@
            <if test="planStartYear != null">#{planStartYear},</if>
            <if test="planStartMonth != null">#{planStartMonth},</if>
            <if test="planStartDay != null">#{planStartDay},</if>
            <if test="processPlanEndDay != null">#{processPlanEndDay},</if>
            <if test="orderPlanEndDay != null">#{orderPlanEndDay},</if>
            <if test="batchNumber != null">#{batchNumber},</if>
            <if test="warning != null">#{warning},</if>
         </trim>
    </insert>
@@ -163,7 +181,7 @@
        id,work_order_no, road_process_number, current_process_number, production_quantity, standard_time,
        process_total_time, process_plan_start_day, design_times, del_flag, create_by, process_name,
        create_time, item_number, standard_dosage, process_total_dosage, design_capacity, major,
        plan_start_year, plan_start_month, plan_start_day,batch_number,process_plan_end_day
        plan_start_year, plan_start_month, plan_start_day,batch_number,process_plan_end_day,warning
        )
        VALUES
        <foreach collection="apsGasPipingRouteStatList" item="stat" separator=",">
@@ -172,10 +190,32 @@
            #{stat.standardTime}, #{stat.processTotalTime}, #{stat.processPlanStartDay}, #{stat.designTimes}, #{stat.delFlag},
            #{stat.createBy}, #{stat.processName}, #{stat.createTime}, #{stat.itemNumber}, #{stat.standardDosage},
            #{stat.processTotalDosage}, #{stat.designCapacity}, #{stat.major}, #{stat.planStartYear},
            #{stat.planStartMonth}, #{stat.planStartDay}, #{stat.batchNumber}, #{stat.processPlanEndDay}
            #{stat.planStartMonth}, #{stat.planStartDay}, #{stat.batchNumber}, #{stat.processPlanEndDay},#{stat.warning}
            )
        </foreach>
    </insert>
    <select id="queryTempStat"  resultMap="ApsGasPipingRouteStatResult" >
        select row_number() over (partition by rt.work_order_no order by rt.process_number desc ) as num,
                rt.work_order_no,
               rt.process_name,
               cast(rt.process_number as numeric(18, 2))           as road_process_number,
               cast(rt.process_number as numeric(18, 2))           as route_process_number,
               cast(pl.process_number as numeric(18, 2))           as current_process_number,
               pl.production_quantity,
               rt.standard_time,
               (rt.standard_time * pl.production_quantity)        as process_total_time,
               rt.process_plan_start_day,
               rt.process_plan_end_day,
               pl.plan_end_day                         as order_plan_end_day,
                rt.item_no as item_number,
                pl.plan_type as major,
               false as warning
        from aps_gas_piping_plan as pl
                 left join aps_process_route as rt on pl.document_number = rt.work_order_no
        where pl.document_number is not null and rt.work_order_no is not null
        order by rt.work_order_no asc, rt.process_number desc
    </select>
</mapper>