| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectOmProductionOrderInfoVo"> |
| | | select id, work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info |
| | | select id,body_status,head_status,pre_status,body_qty,head_qty,pre_qty,work_order_no, sales_order_code, product_code, line_code, plan_qty, plan_start_time, plan_end_time, order_status, create_time, update_time, create_by, update_by, remarks, del_flag from om_production_order_info |
| | | </sql> |
| | | |
| | | <!-- 查询 order_status 为 1 且 plan_start_time 最早的一条记录 --> |
| | | <select id="getBodyOrder" resultType="OmProductionOrderInfo"> |
| | | SELECT TOP 1 * |
| | | FROM om_production_order_info |
| | | WHERE body_status IN (0,1) |
| | | ORDER BY plan_start_time ASC |
| | | </select> |
| | | <select id="updateBodyStatus1" resultType="OmProductionOrderInfo"> |
| | | UPDATE o |
| | | SET body_status = 1, body_qty = body_qty + 1 |
| | | FROM om_production_order_info AS o |
| | | INNER JOIN ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE body_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ) AS sub ON o.id = sub.id; |
| | | </select> |
| | | <select id="updateBodyStatus2" resultType="OmProductionOrderInfo"> |
| | | UPDATE om_production_order_info |
| | | SET body_status = 2 |
| | | WHERE id = ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE body_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ); |
| | | </select> |
| | | <select id="getHeadOrder" resultType="OmProductionOrderInfo"> |
| | | SELECT TOP 1 * |
| | | FROM om_production_order_info |
| | | WHERE head_status IN (0,1) |
| | | ORDER BY plan_start_time ASC |
| | | </select> |
| | | <select id="updateHeadStatus1" resultType="OmProductionOrderInfo"> |
| | | UPDATE o |
| | | SET head_status = 1, head_qty = head_qty + 1 |
| | | FROM om_production_order_info AS o |
| | | INNER JOIN ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE head_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ) AS sub ON o.id = sub.id; |
| | | </select> |
| | | <select id="updateHeadStatus2" resultType="OmProductionOrderInfo"> |
| | | UPDATE om_production_order_info |
| | | SET head_status = 2 |
| | | WHERE id = ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE head_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ); |
| | | </select> |
| | | <select id="getPreOrder" resultType="OmProductionOrderInfo"> |
| | | SELECT TOP 1 * |
| | | FROM om_production_order_info |
| | | WHERE pre_status IN (0,1) |
| | | ORDER BY plan_start_time ASC |
| | | </select> |
| | | <select id="updatePreStatus1" resultType="OmProductionOrderInfo"> |
| | | UPDATE o |
| | | SET pre_status = 1, pre_qty = pre_qty + 1 |
| | | FROM om_production_order_info AS o |
| | | INNER JOIN ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE pre_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ) AS sub ON o.id = sub.id; |
| | | </select> |
| | | <select id="updatePreStatus2" resultType="OmProductionOrderInfo"> |
| | | UPDATE om_production_order_info |
| | | SET pre_status = 2 |
| | | WHERE id = ( |
| | | SELECT TOP 1 id |
| | | FROM om_production_order_info |
| | | WHERE pre_status IN (0, 1) |
| | | ORDER BY plan_start_time ASC |
| | | ); |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="selectOmProductionOrderInfoList" parameterType="OmProductionOrderInfo" resultMap="OmProductionOrderInfoResult"> |
| | | <include refid="selectOmProductionOrderInfoVo"/> |
| | | <where> |