| | |
| | | <result property="updateBy" column="update_by" /> |
| | | <result property="remarks" column="remarks" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="engineType" column="engine_type" /> |
| | | <result property="engineName" column="engine_name" /> |
| | | <result property="flag" column="flag" /> |
| | | <result property="bodyQty" column="body_qty" /> |
| | | <result property="headQty" column="head_qty" /> |
| | | <result property="preQty" column="pre_qty" /> |
| | | <result property="bodyStatus" column="body_status" /> |
| | | <result property="headStatus" column="head_status" /> |
| | | <result property="preStatus" column="pre_status" /> |
| | | |
| | | </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) |
| | | AND body_qty != plan_qty |
| | | 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 = 4 |
| | | 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) |
| | | AND head_qty != plan_qty |
| | | 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 = 4 |
| | | 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) |
| | | AND pre_qty != plan_qty |
| | | 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 = 4 |
| | | 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"/> |
| | |
| | | <if test="salesOrderCode != null and salesOrderCode != ''"> and sales_order_code = #{salesOrderCode}</if> |
| | | <if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if> |
| | | <if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if> |
| | | and del_flag = "0" |
| | | and del_flag = 0 |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectOmProductionOrderInfoById" parameterType="Long" resultMap="OmProductionOrderInfoResult"> |
| | | <include refid="selectOmProductionOrderInfoVo"/> |
| | | where id = #{id} and del_flag = "0" |
| | | where id = #{id} and del_flag = 0 |
| | | </select> |
| | | |
| | | <insert id="insertOmProductionOrderInfo" parameterType="OmProductionOrderInfo" useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="workOrderNo != null and workOrderNo != ''">work_order_no,</if> |
| | | <if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code,</if> |
| | | <if test="productCode != null and productCode != ''">product_code,</if> |
| | | <if test="lineCode != null and lineCode != ''">line_code,</if> |
| | | <if test="planQty != null">plan_qty,</if> |
| | | <if test="planStartTime != null">plan_start_time,</if> |
| | | <if test="planEndTime != null">plan_end_time,</if> |
| | |
| | | <if test="workOrderNo != null and workOrderNo != ''">#{workOrderNo},</if> |
| | | <if test="salesOrderCode != null and salesOrderCode != ''">#{salesOrderCode},</if> |
| | | <if test="productCode != null and productCode != ''">#{productCode},</if> |
| | | <if test="lineCode != null and lineCode != ''">#{lineCode},</if> |
| | | <if test="planQty != null">#{planQty},</if> |
| | | <if test="planStartTime != null">#{planStartTime},</if> |
| | | <if test="planEndTime != null">#{planEndTime},</if> |
| | |
| | | <if test="updateBy != null">#{updateBy},</if> |
| | | <if test="remarks != null">#{remarks},</if> |
| | | <if test="delFlag != null">#{delFlag},</if> |
| | | set del_flag = 0, |
| | | </trim> |
| | | </insert> |
| | | |
| | |
| | | <if test="workOrderNo != null and workOrderNo != ''">work_order_no = #{workOrderNo},</if> |
| | | <if test="salesOrderCode != null and salesOrderCode != ''">sales_order_code = #{salesOrderCode},</if> |
| | | <if test="productCode != null and productCode != ''">product_code = #{productCode},</if> |
| | | <if test="lineCode != null and lineCode != ''">line_code = #{lineCode},</if> |
| | | <if test="planQty != null">plan_qty = #{planQty},</if> |
| | | <if test="planStartTime != null">plan_start_time = #{planStartTime},</if> |
| | | <if test="planEndTime != null">plan_end_time = #{planEndTime},</if> |
| | |
| | | <if test="updateBy != null">update_by = #{updateBy},</if> |
| | | <if test="remarks != null">remarks = #{remarks},</if> |
| | | <if test="delFlag != null">del_flag = #{delFlag},</if> |
| | | <if test="bodyQty != null">body_qty = #{bodyQty},</if> |
| | | <if test="headQty != null">head_qty = #{headQty},</if> |
| | | <if test="preQty != null">pre_qty = #{preQty},</if> |
| | | <if test="bodyStatus != null">body_status = #{bodyStatus},</if> |
| | | <if test="headStatus != null">head_status = #{headStatus},</if> |
| | | <if test="preStatus != null">pre_status = #{preStatus},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteOmProductionOrderInfoById" parameterType="Long"> |
| | | update om_production_order_info set del_flag = "1" where id = #{id} |
| | | update om_production_order_info set del_flag = 1 where id = #{id} |
| | | </update> |
| | | |
| | | <update id="deleteOmProductionOrderInfoByIds" parameterType="String"> |
| | | update om_production_order_info set del_flag = "1" where id in |
| | | update om_production_order_info set del_flag = 1 where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |