| | |
| | | <result column="work_order_no" property="workOrderNo"/> |
| | | <result column="status" property="status"/> |
| | | <result column="tenant_id" property="tenantId"/> |
| | | <result column="actual_end_time" property="planStartTime"/> |
| | | <result column="plan_start_time" property="planStartTime"/> |
| | | <result column="plan_end_time" property="planEndTime"/> |
| | | <result column="actual_start_time" property="actualStartTime"/> |
| | | <result column="actualEndTime" property="actualEndTime"/> |
| | | <result column="actual_end_time" property="actualEndTime"/> |
| | | </resultMap> |
| | | |
| | | <select id="pageProductWorkOrder" resultType="com.ruoyi.production.dto.ProductWorkOrderDto"> |
| | | SELECT |
| | | pwo.*, |
| | | pp.NAME as processName, |
| | | CASE pp.type |
| | | WHEN 1 THEN '加工' |
| | | WHEN 2 THEN '刮板冷芯制作' |
| | | WHEN 3 THEN '管路组对' |
| | | WHEN 4 THEN '罐体连接及调试' |
| | | WHEN 5 THEN '测试打压' |
| | | WHEN 6 THEN '其他' |
| | | ELSE pp.NAME |
| | | END as processName, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name AS productName, |
| | | po.nps_no AS productOrderNpsNo, |
| | | pp.salary_quota, |
| | | ROUND(pwo.complete_quantity / pwo.plan_quantity * 100, 2) AS completionStatus, |
| | | CASE |
| | | WHEN pwo.work_order_no LIKE 'FG%' THEN '返工返修' |
| | |
| | | and pwo.work_order_no like concat('%',#{c.workOrderNo},'%') |
| | | </if> |
| | | <if test="c.planStartTime != null and c.planEndTime != null"> |
| | | and DATE(pwo.create_time) between #{c.planStartTime} and #{c.planEndTime} |
| | | and pwo.create_time <![CDATA[ >= ]]> #{c.planStartTime} |
| | | and pwo.create_time <![CDATA[ <= ]]> #{c.planEndTime} |
| | | </if> |
| | | <if test="c.productOrderId != null and c.productOrderId != ''"> |
| | | and pwo.product_order_id = #{c.productOrderId} |
| | | </if> |
| | | <if test="c.type != null and c.type == 2 and c.currentUserId != null"> |
| | | and exists ( |
| | | select 1 |
| | | from product_work_order_rapporteur pwor |
| | | where pwor.work_order_id = pwo.id |
| | | and pwor.user_id = #{c.currentUserId} |
| | | ) |
| | | </if> |
| | | </select> |
| | | <select id="getProductWorkOrderFlowCard" resultType="com.ruoyi.production.dto.ProductWorkOrderDto"> |
| | | SELECT |
| | | pwo.*, |
| | | pp.NAME as processName, |
| | | CASE pp.type |
| | | WHEN 1 THEN '加工' |
| | | WHEN 2 THEN '刮板冷芯制作' |
| | | WHEN 3 THEN '管路组对' |
| | | WHEN 4 THEN '罐体连接及调试' |
| | | WHEN 5 THEN '测试打压' |
| | | WHEN 6 THEN '其他' |
| | | ELSE pp.NAME |
| | | END as processName, |
| | | pm.model, |
| | | pm.unit, |
| | | p.product_name AS productName, |
| | |
| | | p.product_name, |
| | | po.nps_no |
| | | </select> |
| | | <select id="selectWorkOrderStartStats" resultType="com.ruoyi.production.dto.ProductWorkOrderDto"> |
| | | SELECT |
| | | id, |
| | | actual_start_time AS planStartTime, |
| | | plan_quantity |
| | | FROM |
| | | product_work_order |
| | | WHERE |
| | | actual_start_time >= #{startDate} |
| | | AND actual_start_time <= #{endDate} |
| | | </select> |
| | | <select id="selectMax" resultType="com.ruoyi.production.pojo.ProductWorkOrder"> |
| | | SELECT SUBSTRING(work_order_no, 3) as work_order_no |
| | | FROM product_work_order |
| | | WHERE SUBSTRING(work_order_no, 3) like concat(#{datePrefix},'%') |
| | | order by work_order_no desc |
| | | limit 1 |
| | | ; |
| | | </select> |
| | | |
| | | <update id="addCompleteQtyIfNotExceed"> |
| | | update product_work_order |
| | | set |
| | | complete_quantity = complete_quantity + #{delta}, |
| | | actual_start_time = ifnull(actual_start_time, now()), |
| | | actual_end_time = case when (complete_quantity + #{delta}) = plan_quantity then now() else actual_end_time end |
| | | where id = #{id} |
| | | and (complete_quantity + #{delta}) <![CDATA[ <= ]]> plan_quantity |
| | | </update> |
| | | </mapper> |