You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

168 lines
8.0 KiB
XML

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.mes.mapper.ProdPlanInfoMapper">
<resultMap type="ProdPlanInfo" id="ProdPlanInfoResult">
<result property="planId" column="plan_id"/>
<result property="productOrderId" column="product_order_id"/>
<result property="saleOrderId" column="sale_order_id"/>
<result property="saleorderCode" column="saleorder_code"/>
<result property="planCode" column="plan_code"/>
<result property="dispatchCode" column="dispatch_code"/>
<result property="materialId" column="material_id"/>
<result property="materialName" column="material_name"/>
<result property="materialBomId" column="material_bom_id"/>
<result property="materialBomName" column="materialBomName"/>
<result property="processId" column="process_id"/>
<result property="processOrder" column="process_order"/>
<result property="lastProcessId" column="last_process_id"/>
<result property="finalProcessFlag" column="final_process_flag"/>
<result property="lastProcessName" column="lastProcessName"/>
<result property="stationId" column="station_id"/>
<result property="userId" column="user_id"/>
<result property="userName" column="user_name"/>
<result property="productionTime" column="production_time"/>
<result property="dispatchAmount" column="dispatch_amount"/>
<result property="planAmount" column="plan_amount"/>
<result property="completeAmount" column="complete_amount"/>
<result property="planBeginTime" column="plan_begin_time"/>
<result property="planEndTime" column="plan_end_time"/>
<result property="realBeginTime" column="real_begin_time"/>
<result property="realEndTime" column="real_end_time"/>
<result property="attachId" column="attach_id"/>
<result property="planStatus" column="plan_status"/>
<result property="isFlag" column="is_flag"/>
<result property="remark" column="remark"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="planDeliveryDate" column="plan_delivery_date"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="materialClassfication" column="material_classfication"/>
<!-- <result property="processName" column="process_name"/>-->
<result property="processType" column="process_type"/>
<result property="stationName" column="station_name"/>
<result property="sopId" column="sop_id"/>
<result property="orderCode" column="order_code"/>
<result property="saleType" column="sale_type"/>
<result property="displayFlag" column="display_flag"/>
<result property="processProductionTime" column="process_production_time"/>
<result property="nickName" column="nick_name"/>
<result property="cabinetChannel" column="cabinet_channel"/>
<result property="productId" column="product_id"/>
<result property="dispatchType" column="dispatch_type"/>
<result property="dispatchId" column="dispatch_id"/>
<result property="orderStatus" column="order_status"/>
<result property="processType" column="process_type"/>
<result property="productionTime" column="production_time"/>
<result property="releaseName" column="release_name"/>
</resultMap>
<select id="selectProdPlanInfoList" parameterType="ProdPlanInfoBo" resultType="ProdPlanInfoVo">
select
<if test="ew.getSqlSelect != null">
${ew.getSqlSelect},
bmi.material_code,
bmi.material_name,
bomi.material_name material_bom_name,
pbsi.station_name release_name,
pbpi.process_name,
bsi.shift_name,
bcti.team_name
</if>
<if test="ew.getSqlSelect == null">
*
</if>
from ${tableName} t
left join base_material_info bmi on bmi.material_id = t.material_id
left join base_material_info bomi on bomi.material_id = t.material_bom_id
left join prod_base_station_info pbsi on pbsi.station_id = t.release_id
left join prod_base_process_info pbpi on pbpi.process_id = t.process_id
left join base_shift_info bsi on bsi.shift_id = t.shift_id
left join base_class_team_info bcti on bcti.class_team_id = t.class_team_id
${ew.getCustomSqlSegment}
</select>
<select id="selectProdPlanInfoJoinProcessList" parameterType="ProdPlanInfo" resultMap="ProdPlanInfoResult">
select mpp.plan_id,
mpp.product_order_id,
mpp.plan_code,
mpp.dispatch_code,
mpp.material_id,
mpp.material_bom_id,
mpp.process_id,
bpi.process_name,
bpi.process_type,
mpp.process_order,
mpp.last_process_id,
mpp.final_process_flag,
mpp.production_time,
bpi.production_time as process_production_time,
mpp.dispatch_amount,
mpp.plan_amount,
mpp.complete_amount,
mpp.plan_begin_time,
mpp.plan_end_time,
mpp.real_begin_time,
mpp.real_end_time,
mpp.attach_id,
mpp.plan_status,
mpp.remark,
mpp.create_by,
mpp.create_time,
mpp.update_by,
mpp.update_time,
mpp.release_type,
mpp.release_id,
case
when mpp.release_type = 2 then su.user_name
when mpp.release_type = 3 then pbsi_3.station_name
when mpp.release_type = 1 then pbsi_1.station_name
else null
end as release_name
from prod_plan_info mpp
left join prod_base_process_info bpi on bpi.process_id = mpp.process_id
left join sys_user su on mpp.release_type = 2 and mpp.release_id = su.user_id
left join prod_base_station_info pbsi_3 on mpp.release_type = 3 and mpp.release_id = pbsi_3.station_id
left join prod_base_station_info pbsi_1 on mpp.release_type = 1 and mpp.release_id = pbsi_1.station_id
<where>
<if test="productOrderId != null ">and mpp.product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''">and mpp.plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''">and mpp.dispatch_code = #{dispatchCode}</if>
<if test="materialId != null ">and mpp.material_id = #{materialId}</if>
<if test="materialBomId != null ">and mpp.material_bom_id = #{materialBomId}</if>
<if test="processId != null ">and mpp.process_id = #{processId}</if>
<if test="processOrder != null ">and mpp.process_order = #{processOrder}</if>
<if test="lastProcessId != null ">and mpp.last_process_id = #{lastProcessId}</if>
<if test="productionTime != null ">and mpp.production_time = #{productionTime}</if>
<if test="planAmount != null ">and mpp.plan_amount = #{planAmount}</if>
<if test="completeAmount != null ">and mpp.complete_amount = #{completeAmount}</if>
<if test="planBeginTime != null ">and mpp.plan_begin_time = #{planBeginTime}</if>
<if test="planEndTime != null ">and mpp.plan_end_time = #{planEndTime}</if>
<if test="realBeginTime != null ">and mpp.real_begin_time = #{realBeginTime}</if>
<if test="realEndTime != null ">and mpp.real_end_time = #{realEndTime}</if>
<if test="attachId != null and attachId != ''">and mpp.attach_id = #{attachId}</if>
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
</where>
order by mpp.dispatch_code,mpp.process_order
</select>
</mapper>