| | |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="createBy" column="create_by" /> |
| | | <result property="batchNumber" column="batch_number" /> |
| | | <result property="resourceGroupName" column="resource_group_name" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectApsPartRouteStatVo"> |
| | | 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, batch_number from aps_part_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, batch_number ,resource_group_name from aps_part_route_stat |
| | | </sql> |
| | | |
| | | <select id="selectApsPartRouteStatList" parameterType="ApsPartRouteStat" resultMap="ApsPartRouteStatResult"> |
| | |
| | | <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> |
| | | <if test="batchNumber != null">batch_number,</if> |
| | | <if test="resourceGroupName != null">resource_group_name,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | |
| | | <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> |
| | | <if test="batchNumber != null">#{batchNumber},</if> |
| | | <if test="resourceGroupName != null">#{resourceGroupName},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | </update> |
| | | <select id="selectPartRoutStat" resultMap="ApsPartRouteStatResult" > |
| | | select rt.work_order_no, |
| | | rt.process_name, |
| | | rt.process_name as resource_group_name, |
| | | cast( rt.process_number as numeric(18,2)) as road_process_number, |
| | | cast( pl.process_number as numeric(18,2)) as current_process_number, |
| | | pl.production_quantity, |
| | |
| | | left join aps_resource_group as rs on rs.resource_group_name=rt.process_name |
| | | where pl.del_flag='0' and rt.del_flag='0' |
| | | /*零件计划状态为:非完工 */ |
| | | and ( pl.order_status!='' and ( pl.order_status!='3' or pl.order_status!='完工') ) |
| | | /*工艺路线的工序号>=零件计划的当前工序*/ |
| | | and cast( rt.process_number as decimal(18,2)) >= cast( pl.process_number as decimal(18,2)) |
| | | /*工序计划开工日 <= 资源组的截止日期*/ |
| | | and rt.process_plan_start_day<=rs.request_date |
| | | /*资源组需求截止日期<=当前日期+15天*/ |
| | | and rs.request_date<=(current_date + INTERVAL '15 day') |
| | | and ( pl.document_status is not null and ( pl.document_status!='3' or pl.order_status!='完工') ) |
| | | /*工序计划开工日 小于等于 资源组的截止日期*/ |
| | | and rt.process_plan_start_day <= rs.request_date |
| | | order by rt.work_order_no,process_plan_start_day |
| | | </select> |
| | | |
| | | <resultMap type="ApsResourceDateStat" id="ApsResourceDateStatResult"> |
| | | <result property="planDay" column="plan_day" /> |
| | | <result property="resourceName" column="resource_name" /> |
| | | <result property="requireTimes" column="require_times" /> |
| | | <result property="designTimes" column="design_times" /> |
| | | <result property="capacityLoad" column="capacity_load" /> |
| | | <result property="resourceGroupName" column="resource_name" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectResourceDateStat" resultMap="ApsResourceDateStatResult"> |
| | | |
| | | with pl as (select DATE(st.process_plan_start_day) AS plan_day, |
| | | resource_group_name as resource_name, |
| | | sum(process_total_time) as require_times |
| | | from aps_part_route_stat as st |
| | | where st.del_flag = '0' |
| | | group by resource_group_name, plan_day |
| | | order by plan_day,resource_group_name |
| | | ) |
| | | select |
| | | pl.plan_day |
| | | ,pl.resource_name |
| | | , require_times |
| | | , (gp.theory_hours * gp.devices_quantity) as design_times |
| | | , ((gp.theory_hours * gp.devices_quantity) / require_times*100) as capacity_load |
| | | from pl |
| | | left join aps_resource_group as gp on pl.resource_name = gp.resource_group_name |
| | | where gp.del_flag = '0' |
| | | </select> |
| | | |
| | | </mapper> |