| | |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.aps.core.mapper.ApsPartRouteStatMapper"> |
| | | |
| | | <resultMap type="ApsPartRouteStat" id="ApsPartRouteStatResult"> |
| | | <resultMap type="com.aps.core.domain.ApsPartRouteStat" id="ApsPartRouteStatResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="workOrderNo" column="work_order_no" /> |
| | | <result property="roadProcessNumber" column="road_process_number" /> |
| | |
| | | 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"> |
| | | <select id="selectApsPartRouteStatList" parameterType="com.aps.core.domain.ApsPartRouteStat" resultMap="ApsPartRouteStatResult"> |
| | | <include refid="selectApsPartRouteStatVo"/> |
| | | <where> |
| | | <if test="workOrderNo != null and workOrderNo != ''"> and work_order_no = #{workOrderNo}</if> |
| | |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertApsPartRouteStat" parameterType="ApsPartRouteStat"> |
| | | <insert id="insertApsPartRouteStat" parameterType="com.aps.core.domain.ApsPartRouteStat"> |
| | | insert into aps_part_route_stat |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | |
| | | <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 id="updateApsPartRouteStat" parameterType="ApsPartRouteStat"> |
| | | <update id="updateApsPartRouteStat" parameterType="com.aps.core.domain.ApsPartRouteStat"> |
| | | update aps_part_route_stat |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="workOrderNo != null">work_order_no = #{workOrderNo},</if> |
| | |
| | | </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, |
| | |
| | | from aps_part_plan as pl |
| | | left join aps_process_route as rt on pl.document_number=rt.work_order_no |
| | | 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.document_status is not null and ( pl.document_status!='3' or pl.order_status!='完工') ) |
| | | /*工序计划开工日 小于等于 资源组的截止日期*/ |
| | | and rt.process_plan_start_day <= rs.request_date |
| | | where pl.document_number is not null and rt.work_order_no is not null |
| | | and rt.process_plan_start_day <= rs.request_date |
| | | order by rt.work_order_no,process_plan_start_day |
| | | </select> |
| | | <select id="selectResourceDateStat" resultMap="com.aps.core.domain.ApsResourceDateStat"> |
| | | 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 |
| | | |
| | | <resultMap type="com.aps.core.domain.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.resource_name |
| | | ,pl.plan_day |
| | | ,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_group_name=gp.resource_group_name |
| | | where gp.del_flag='0' |
| | | </select> |
| | | select |
| | | pl.plan_day |
| | | ,pl.resource_name |
| | | , require_times |
| | | , (gp.theory_hours * gp.devices_quantity) as design_times |
| | | , cast ( require_times / cast (gp.theory_hours * gp.devices_quantity as numeric(18,4)) as numeric(18,4)) *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> |