| | |
| | | <!--库存信息--> |
| | | <select id="materialStoreMp"> |
| | | SELECT |
| | | i.id AS id, |
| | | i.material_code AS id, |
| | | i.producer AS producer, |
| | | i.available_quantity-i.plan_quantity AS available_quantity, |
| | | null as processingQuantity, |
| | |
| | | |
| | | |
| | | <select id="materialStoreOptimizeUse"> |
| | | select ms.id AS id, |
| | | select ou.raw_stock_code AS id, |
| | | ou.use_count AS processingQuantity, |
| | | ou.width, |
| | | ou.height, |
| | |
| | | `p`.`frist_stock_qty` AS `Amount of original glass usage 1`, |
| | | concat(`p`.`frist_cut_pct`, ' %') AS `Average cutting rate 1`, |
| | | `p`.`remark` AS `Notes`, |
| | | `a`.`name` AS `Creator`, |
| | | `u`.`user_name` AS `Creator`, |
| | | `p`.`create_time` AS `Create time`, |
| | | `p`.`update_time` AS `Modify time` |
| | | from pp.optimize_project as p |
| | | left join pp.optimize_admin as a on p.creater = a.Id |
| | | left join erp_user_info.user as u on p.creater = u.login_name |
| | | where (`p`.`state` > 0) |
| | | # and (tempering_state>0 or optimize_state>0) |
| | | and DATE (`p`.`create_time`) BETWEEN #{startSelectTime} AND #{endSelectTime} |
| | |
| | | |
| | | <update id="updateProjectMp"> |
| | | update pp.optimize_project set project_name=#{projectNmae},glass_total=#{sumQuantity},glass_total_area= #{sumArea}, |
| | | type=#{type},process_qty=#{processIdCount},process_cards=#{processId} where project_no=#{projectId} |
| | | type=#{type},process_qty=#{processIdCount},process_cards=#{processId},creater = #{userName} where project_no=#{projectId} |
| | | </update> |
| | | |
| | | <insert id="addProjectMp"> |
| | | insert into pp.optimize_project (project_no, project_name, order_glass_type, order_glass_thickness,glass_type, glass_thickness, |
| | | glass_total,glass_total_area,type,state,process_qty,process_cards) |
| | | glass_total,glass_total_area,type,state,process_qty,process_cards,creater ) |
| | | values (#{projectId}, #{projectNmae}, #{glassType}, #{glassThickness}, #{glassType}, #{glassThickness},#{sumQuantity}, #{sumArea}, |
| | | #{type},1,#{processIdCount},#{processId}) |
| | | #{type},1,#{processIdCount},#{processId},#{userName}) |
| | | </insert> |
| | | |
| | | |
| | |
| | | WHERE |
| | | project_no = #{processId} AND polys_id = #{detail.polySort} |
| | | </update> |
| | | <update id="updateProjectOptimize"> |
| | | update pp.optimize_project as p |
| | | set p.optimize_state = #{states}, |
| | | p.avg_cut_pct = #{optimalResults.avgCutRate}, |
| | | p.valid_cut_pct = #{optimalResults.validCutRate}, |
| | | p.last_cut_pct = #{optimalResults.lastCutRate}, |
| | | p.raw_stock_qty = #{optimalResults.totalQuantity} |
| | | where p.project_no = #{projectId} |
| | | </update> |
| | | |
| | | <select id="simulatedTypesettingUsingOpt"> |
| | | SELECT |
| | |
| | | p.creater = a.Id |
| | | ))) |
| | | WHERE |
| | | ( p.state = 1 ) and p.tempering_state=0 and optimize_state=0 and p.project_no = #{projectNo} |
| | | ( p.state = 1 ) and |
| | | # p.tempering_state=0 and |
| | | # optimize_state=0 and |
| | | p.project_no = #{projectNo} |
| | | ORDER BY |
| | | p.create_time DESC, |
| | | p.project_no |
| | |
| | | </select> |
| | | <select id="getOptimizeDetailsInfo" resultType="java.util.Map"> |
| | | SELECT |
| | | 0 As isRemain, |
| | | width AS realWidth, |
| | | height AS realHeight, |
| | | p_width AS width, |
| | | p_height AS height, |
| | | process_id AS processId, |
| | | layer, |
| | | total_layer AS totalLayer, |
| | | order_sort As orderSort, |
| | | stock_id AS layoutId, |
| | | stock_number AS glassSort, |
| | | x_axis AS x, |
| | | y_axis AS y, |
| | | mark_icon AS markIcon, |
| | | isRotate, |
| | | glass_point AS glassPoint, |
| | | rack_no As rackNo |
| | | 0 AS isRemain, |
| | | od.width AS realWidth, |
| | | od.height AS realHeight, |
| | | od.p_width AS width, |
| | | od.p_height AS height, |
| | | od.process_id AS processId, |
| | | od.layer, |
| | | od.total_layer AS totalLayer, |
| | | od.order_sort AS orderSort, |
| | | od.stock_id AS layoutId, |
| | | od.stock_number AS glassSort, |
| | | od.x_axis AS x, |
| | | od.y_axis AS y, |
| | | od.mark_icon AS markIcon, |
| | | od.isRotate, |
| | | od.glass_point AS glassPoint, |
| | | fc.order_id AS orderNo, |
| | | ogd.process, |
| | | o.customer_name AS customerName, |
| | | o.processing_note AS processingNote, |
| | | o.project AS projectName, |
| | | ord.product_name AS productName, |
| | | ord.building_number AS buildingNumber, |
| | | COALESCE(h.layout_id, 0) as heatLayoutId, |
| | | od.rack_no AS rackNo |
| | | FROM |
| | | pp.optimize_detail |
| | | pp.optimize_detail od |
| | | LEFT JOIN pp.flow_card fc on od.process_id = fc.process_id |
| | | LEFT JOIN sd.order_glass_detail ogd ON fc.order_id = ogd.order_id |
| | | LEFT JOIN sd.ORDER o ON o.order_id = fc.order_id |
| | | LEFT JOIN sd.order_detail ord ON fc.order_id = ord.order_id |
| | | LEFT JOIN pp.optimize_heat_detail h ON h.process_id = fc.process_id |
| | | WHERE |
| | | project_no = #{projectId} |
| | | od.project_no = #{projectId} |
| | | </select> |
| | | <select id="getOptimizeOffsetsInfo" resultType="java.util.Map"> |
| | | SELECT |