|
@@ -26,8 +26,8 @@
|
|
|
<!-- 通用查询结果列 -->
|
|
<!-- 通用查询结果列 -->
|
|
|
<sql id="Base_Column_List">
|
|
<sql id="Base_Column_List">
|
|
|
id,create_time,update_time,
|
|
id,create_time,update_time,
|
|
|
- plan_no, order_id, audit_status, remark, create_user, plan_status, update_user, start_time, end_time, scheduling_status, produce_status,partsNo,partsAlias,bomAlias,
|
|
|
|
|
- prority, status,rhythm_type,orderNo,orderStatus,bomDesc,process,planBomNum,zoenDesc,completeNum,qualification
|
|
|
|
|
|
|
+ plan_no, order_id, audit_status, remark, create_user, plan_status, update_user, start_time, end_time, scheduling_status, produce_status,partsNo,partsAlias,bomAlias,deliveryTime,pdeliveryTime,
|
|
|
|
|
+ prority, status,rhythm_type,orderNo,orderStatus,orderName,source,bomDesc,process,planBomNum,zoenDesc,completeNum,qualification
|
|
|
</sql>
|
|
</sql>
|
|
|
|
|
|
|
|
<!-- 分页 -->
|
|
<!-- 分页 -->
|
|
@@ -35,21 +35,21 @@
|
|
|
select
|
|
select
|
|
|
<include refid="Base_Column_List"/>
|
|
<include refid="Base_Column_List"/>
|
|
|
from (
|
|
from (
|
|
|
- select a.*,b.order_no as orderNo,b.order_status as orderStatus,b.custDesc as customDesc,c.bomDesc,c.partsNo,c.partsAlias,c.bomAlias,
|
|
|
|
|
|
|
+ select a.*,b.order_no as orderNo,b.order_name orderName,b.source,b.order_status as orderStatus,c.bomDesc,c.partsNo,c.partsAlias,c.bomAlias,c.pdeliveryTime,b.delivery_time deliveryTime,
|
|
|
CASE WHEN ifnull(v.completeCount ,0)=0 then 0 else round(100 *( v.verifyCount / v.completeCount),2) end qualification, ifnull(v.completeCount ,0) as completeNum,
|
|
CASE WHEN ifnull(v.completeCount ,0)=0 then 0 else round(100 *( v.verifyCount / v.completeCount),2) end qualification, ifnull(v.completeCount ,0) as completeNum,
|
|
|
CASE WHEN ifnull(w.taskCount,0)=0 then 0 else round(100 *( wcCount / taskCount),2) end process,ifnull(c.plan_bom_num,0) as planBomNum,d.name as zoenDesc from imcs_p_plan a
|
|
CASE WHEN ifnull(w.taskCount,0)=0 then 0 else round(100 *( wcCount / taskCount),2) end process,ifnull(c.plan_bom_num,0) as planBomNum,d.name as zoenDesc from imcs_p_plan a
|
|
|
left join (
|
|
left join (
|
|
|
- select ord.*,cu.cust_name as custDesc from imcs_o_order ord
|
|
|
|
|
- left join imcs_c_cust cu on ord.cust_id = cu.id
|
|
|
|
|
|
|
+ select ord.* from imcs_o_order ord
|
|
|
)b on a.order_id = b.id
|
|
)b on a.order_id = b.id
|
|
|
left join (
|
|
left join (
|
|
|
- select pp.*,bo.name as bomDesc,bo.parts_no partsNo,bo.parts_alias partsAlias,bo.bom_alias bomAlias from imcs_p_plan_product pp
|
|
|
|
|
- left join imcs_b_bom bo on pp.bom_id = bo.id
|
|
|
|
|
- ) c on a.id= c.plan_id
|
|
|
|
|
|
|
+ select pp.*,bo.name as bomDesc,bo.parts_no partsNo,bo.parts_alias partsAlias,bo.bom_alias bomAlias,op.delivery_time pdeliveryTime from imcs_p_plan_product pp
|
|
|
|
|
+ left join imcs_b_bom bo on pp.bom_id = bo.id
|
|
|
|
|
+ left join imcs_o_order_product op on pp.order_product_id = op.id
|
|
|
|
|
+ ) c on a.id= c.plan_id
|
|
|
left join (
|
|
left join (
|
|
|
- select pz.plan_id,GROUP_CONCAT(ze.name) name from imcs_p_plan_zone pz
|
|
|
|
|
- left join imcs_z_zone ze on pz.zone_id = ze.id
|
|
|
|
|
- GROUP BY pz.plan_id
|
|
|
|
|
|
|
+ select pz.plan_id,GROUP_CONCAT(ze.name) name from imcs_p_plan_zone pz
|
|
|
|
|
+ left join imcs_z_zone ze on pz.zone_id = ze.id
|
|
|
|
|
+ GROUP BY pz.plan_id
|
|
|
) d on a.id = d.plan_id
|
|
) d on a.id = d.plan_id
|
|
|
LEFT JOIN ( SELECT t.plan_id, count(1) taskCount, sum(CASE WHEN t. STATUS = '3' THEN 1 ELSE 0 END) wcCount FROM imcs_t_task t GROUP BY t.plan_id) w ON a.id = w.plan_id
|
|
LEFT JOIN ( SELECT t.plan_id, count(1) taskCount, sum(CASE WHEN t. STATUS = '3' THEN 1 ELSE 0 END) wcCount FROM imcs_t_task t GROUP BY t.plan_id) w ON a.id = w.plan_id
|
|
|
LEFT JOIN ( SELECT i.plan_id, count(1) completeCount, sum(CASE WHEN i. test_result = '1' THEN 1 ELSE 0 END) verifyCount FROM imcs_t_workpiece i GROUP BY i.plan_id ) v ON a.id = v.plan_id
|
|
LEFT JOIN ( SELECT i.plan_id, count(1) completeCount, sum(CASE WHEN i. test_result = '1' THEN 1 ELSE 0 END) verifyCount FROM imcs_t_workpiece i GROUP BY i.plan_id ) v ON a.id = v.plan_id
|
|
@@ -60,8 +60,29 @@
|
|
|
<if test="orderProduceStatus != null and orderProduceStatus != ''">
|
|
<if test="orderProduceStatus != null and orderProduceStatus != ''">
|
|
|
and b.order_status in(${orderProduceStatus})
|
|
and b.order_status in(${orderProduceStatus})
|
|
|
</if>
|
|
</if>
|
|
|
- <if test="customDesc != null and customDesc != ''">
|
|
|
|
|
- and b.custDesc like concat('%', #{customDesc}, '%')
|
|
|
|
|
|
|
+ <if test="bomDesc != null and bomDesc != ''">
|
|
|
|
|
+ and c.bomDesc like concat('%', #{bomDesc}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderName != null and orderName != ''">
|
|
|
|
|
+ and b.order_name like concat('%', #{orderName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="orderName != null and orderName != ''">
|
|
|
|
|
+ and b.order_name like concat('%', #{orderName}, '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+<!-- <if test="customDesc != null and customDesc != ''">-->
|
|
|
|
|
+<!-- and b.custDesc like concat('%', #{customDesc}, '%')-->
|
|
|
|
|
+<!-- </if>-->
|
|
|
|
|
+ <if test="pdeliveryTimeStart != null and pdeliveryTimeStart != '' ">
|
|
|
|
|
+ AND c.pdeliveryTime <![CDATA[ >= ]]> #{pdeliveryTimeStart}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="pdeliveryTimeEnd != null and pdeliveryTimeEnd != '' ">
|
|
|
|
|
+ AND c.pdeliveryTime <![CDATA[ <= ]]> #{pdeliveryTimeEnd}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deliveryTimeStart != null and deliveryTimeStart != '' ">
|
|
|
|
|
+ AND b.pdeliveryTime <![CDATA[ >= ]]> #{deliveryTimeStart}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="deliveryTimeEnd != null and deliveryTimeEnd != '' ">
|
|
|
|
|
+ AND b.pdeliveryTime <![CDATA[ <= ]]> #{deliveryTimeEnd}
|
|
|
</if>
|
|
</if>
|
|
|
) s ${ew.customSqlSegment}
|
|
) s ${ew.customSqlSegment}
|
|
|
</select>
|
|
</select>
|