|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
<?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">
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.hw.mes.mapper.MesProductPlanMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="MesProductPlan" id="MesProductPlanResult">
|
|
|
|
@ -36,61 +36,100 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<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="materialCode" column="material_code"/>
|
|
|
|
|
<result property="materialName" column="material_name"/>
|
|
|
|
|
<result property="processName" column="process_name"/>
|
|
|
|
|
<result property="stationName" column="station_name"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="MesProductPlanMesProductPlanDetailResult" type="MesProductPlan" extends="MesProductPlanResult">
|
|
|
|
|
<collection property="mesProductPlanDetailList" notNullColumn="sub_plan_detail_id" javaType="java.util.List" resultMap="MesProductPlanDetailResult" />
|
|
|
|
|
<collection property="mesProductPlanDetailList" notNullColumn="sub_plan_detail_id" javaType="java.util.List"
|
|
|
|
|
resultMap="MesProductPlanDetailResult"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="MesProductPlanDetail" id="MesProductPlanDetailResult">
|
|
|
|
|
<result property="planDetailId" column="sub_plan_detail_id" />
|
|
|
|
|
<result property="planDetailCode" column="sub_plan_detail_code" />
|
|
|
|
|
<result property="planId" column="sub_plan_id" />
|
|
|
|
|
<result property="planCode" column="sub_plan_code" />
|
|
|
|
|
<result property="userId" column="sub_user_id" />
|
|
|
|
|
<result property="userName" column="sub_user_name" />
|
|
|
|
|
<result property="realBeginTime" column="sub_real_begin_time" />
|
|
|
|
|
<result property="realEndTime" column="sub_real_end_time" />
|
|
|
|
|
<result property="planDetailStatus" column="sub_plan_detail_status" />
|
|
|
|
|
<result property="isFlag" column="sub_is_flag" />
|
|
|
|
|
<result property="remark" column="sub_remark" />
|
|
|
|
|
<result property="createBy" column="sub_create_by" />
|
|
|
|
|
<result property="createTime" column="sub_create_time" />
|
|
|
|
|
<result property="updateBy" column="sub_update_by" />
|
|
|
|
|
<result property="updateTime" column="sub_update_time" />
|
|
|
|
|
<result property="planDetailId" column="sub_plan_detail_id"/>
|
|
|
|
|
<result property="planDetailCode" column="sub_plan_detail_code"/>
|
|
|
|
|
<result property="planId" column="sub_plan_id"/>
|
|
|
|
|
<result property="planCode" column="sub_plan_code"/>
|
|
|
|
|
<result property="userId" column="sub_user_id"/>
|
|
|
|
|
<result property="userName" column="sub_user_name"/>
|
|
|
|
|
<result property="realBeginTime" column="sub_real_begin_time"/>
|
|
|
|
|
<result property="realEndTime" column="sub_real_end_time"/>
|
|
|
|
|
<result property="planDetailStatus" column="sub_plan_detail_status"/>
|
|
|
|
|
<result property="isFlag" column="sub_is_flag"/>
|
|
|
|
|
<result property="remark" column="sub_remark"/>
|
|
|
|
|
<result property="createBy" column="sub_create_by"/>
|
|
|
|
|
<result property="createTime" column="sub_create_time"/>
|
|
|
|
|
<result property="updateBy" column="sub_update_by"/>
|
|
|
|
|
<result property="updateTime" column="sub_update_time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectMesProductPlanVo">
|
|
|
|
|
select plan_id, product_order_id, plan_code, dispatch_code, material_id, material_bom_id, process_id, process_order, last_process_id, station_id, user_id, production_time, plan_amount, complete_amount, plan_begin_time, plan_end_time, real_begin_time, real_end_time, attach_id, plan_status, is_flag, remark, create_by, create_time, update_by, update_time from mes_product_plan
|
|
|
|
|
select mpp.plan_id,
|
|
|
|
|
mpp.product_order_id,
|
|
|
|
|
po.order_code,
|
|
|
|
|
mpp.plan_code,
|
|
|
|
|
mpp.dispatch_code,
|
|
|
|
|
mpp.material_id,
|
|
|
|
|
mi.material_name,
|
|
|
|
|
mpp.material_bom_id,
|
|
|
|
|
concat(mb.material_name, '-', mb.material_bom_desc) materialBomName,
|
|
|
|
|
mpp.process_id,
|
|
|
|
|
bpi.process_name,
|
|
|
|
|
mpp.process_order,
|
|
|
|
|
mpp.last_process_id,
|
|
|
|
|
bp2.process_name lastProcessName,
|
|
|
|
|
mpp.station_id,
|
|
|
|
|
bsi.station_name,
|
|
|
|
|
mpp.user_id,
|
|
|
|
|
mpp.production_time,
|
|
|
|
|
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.is_flag,
|
|
|
|
|
mpp.remark,
|
|
|
|
|
mpp.create_by,
|
|
|
|
|
mpp.create_time,
|
|
|
|
|
mpp.update_by,
|
|
|
|
|
mpp.update_time
|
|
|
|
|
from mes_product_plan mpp
|
|
|
|
|
left join mes_base_process_info bpi on bpi.process_id = mpp.process_id
|
|
|
|
|
left join mes_base_station_info bsi on bsi.station_id = mpp.station_id
|
|
|
|
|
left join mes_base_material_info mi on mi.material_id = mpp.material_id
|
|
|
|
|
left join mes_material_bom mb on mb.material_bom_id = mpp.material_bom_id
|
|
|
|
|
left join mes_base_process_info bp2 on bp2.process_id = mpp.last_process_id
|
|
|
|
|
left join mes_product_order po on po.product_order_id = mpp.product_order_id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectMesProductPlanList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
|
|
|
|
|
<include refid="selectMesProductPlanVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productOrderId != null "> and product_order_id = #{productOrderId}</if>
|
|
|
|
|
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
|
|
|
|
|
<if test="dispatchCode != null and dispatchCode != ''"> and dispatch_code = #{dispatchCode}</if>
|
|
|
|
|
<if test="materialId != null "> and material_id = #{materialId}</if>
|
|
|
|
|
<if test="materialBomId != null "> and material_bom_id = #{materialBomId}</if>
|
|
|
|
|
<if test="processId != null "> and process_id = #{processId}</if>
|
|
|
|
|
<if test="processOrder != null "> and process_order = #{processOrder}</if>
|
|
|
|
|
<if test="lastProcessId != null "> and last_process_id = #{lastProcessId}</if>
|
|
|
|
|
<if test="stationId != null "> and station_id = #{stationId}</if>
|
|
|
|
|
<if test="userId != null "> and user_id = #{userId}</if>
|
|
|
|
|
<if test="productionTime != null "> and production_time = #{productionTime}</if>
|
|
|
|
|
<if test="planAmount != null "> and plan_amount = #{planAmount}</if>
|
|
|
|
|
<if test="completeAmount != null "> and complete_amount = #{completeAmount}</if>
|
|
|
|
|
<if test="planBeginTime != null "> and plan_begin_time = #{planBeginTime}</if>
|
|
|
|
|
<if test="planEndTime != null "> and plan_end_time = #{planEndTime}</if>
|
|
|
|
|
<if test="realBeginTime != null "> and real_begin_time = #{realBeginTime}</if>
|
|
|
|
|
<if test="realEndTime != null "> and real_end_time = #{realEndTime}</if>
|
|
|
|
|
<if test="attachId != null and attachId != ''"> and attach_id = #{attachId}</if>
|
|
|
|
|
<if test="planStatus != null and planStatus != ''"> and plan_status = #{planStatus}</if>
|
|
|
|
|
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
|
|
|
|
|
<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="stationId != null ">and mpp.station_id = #{stationId}</if>
|
|
|
|
|
<if test="userId != null ">and mpp.user_id = #{userId}</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>
|
|
|
|
|
<if test="isFlag != null and isFlag != ''">and mpp.is_flag = #{isFlag}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -258,33 +297,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<insert id="batchMesProductPlanDetail">
|
|
|
|
|
insert into mes_product_plan_detail( plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name, real_begin_time, real_end_time, plan_detail_status, is_flag, remark, create_by, create_time, update_by, update_time) values
|
|
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
|
|
( #{item.planDetailId}, #{item.planDetailCode}, #{item.planId}, #{item.planCode}, #{item.userId}, #{item.userName}, #{item.realBeginTime}, #{item.realEndTime}, #{item.planDetailStatus}, #{item.isFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
|
|
|
|
insert into mes_product_plan_detail( plan_detail_id, plan_detail_code, plan_id, plan_code, user_id, user_name,
|
|
|
|
|
real_begin_time, real_end_time, plan_detail_status, is_flag, remark, create_by, create_time, update_by,
|
|
|
|
|
update_time) values
|
|
|
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
|
|
|
( #{item.planDetailId}, #{item.planDetailCode}, #{item.planId}, #{item.planCode}, #{item.userId},
|
|
|
|
|
#{item.userName}, #{item.realBeginTime}, #{item.realEndTime}, #{item.planDetailStatus}, #{item.isFlag},
|
|
|
|
|
#{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
|
|
|
|
</foreach>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectMesProductPlanJoinList" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
|
|
|
|
|
select mpp.plan_id, mpp.product_order_id, mpp.plan_code, mpp.dispatch_code, mpp.material_id, mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,
|
|
|
|
|
mpp.station_id, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time, mpp.real_begin_time, mpp.real_end_time,
|
|
|
|
|
select mpp.plan_id, mpp.product_order_id, mpp.plan_code, mpp.dispatch_code, mpp.material_id,
|
|
|
|
|
mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,
|
|
|
|
|
mpp.station_id, 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, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name
|
|
|
|
|
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
|
|
|
|
|
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
|
|
|
|
|
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
|
|
|
|
|
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="stationId != null "> and mpp.station_id = #{stationId}</if>
|
|
|
|
|
<if test="planStatus != null and planStatus != ''"> and mpp.plan_status = #{planStatus}</if>
|
|
|
|
|
<if test="stationId != null ">and mpp.station_id = #{stationId}</if>
|
|
|
|
|
<if test="planStatus != null and planStatus != ''">and mpp.plan_status = #{planStatus}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|