| | |
| | | `i`.`available_quantity` DESC ; |
| | | </select> |
| | | |
| | | <!--余料信息--> |
| | | <select id="surplusMaterialsMp"> |
| | | SELECT |
| | | i.id AS id, |
| | | '' AS producer, |
| | | i.quantity AS available_quantity, |
| | | i.width, |
| | | i.height, |
| | | i.thickness, |
| | | i.colour AS name, |
| | | i.colour |
| | | FROM mm.surplus_materials as i |
| | | WHERE |
| | | i.quantity>0 and i.colour=#{model} and i.thickness=#{thickness} |
| | | ORDER BY |
| | | i.quantity DESC ; |
| | | </select> |
| | | |
| | | <!--库存余料信息--> |
| | | <select id="materialStoreSurplusMp"> |
| | | (SELECT |
| | | i.id AS id, |
| | | i.producer AS producer, |
| | | i.available_quantity-i.plan_quantity AS available_quantity, |
| | | JSON_EXTRACT(s.json, '$.width') AS width, |
| | | JSON_EXTRACT(s.json, '$.height') AS height, |
| | | JSON_EXTRACT(s.json, '$.thickness') AS thickness, |
| | | JSON_EXTRACT(s.json, '$.name') AS name, |
| | | JSON_EXTRACT(s.json, '$.model') AS model |
| | | FROM mm.material_inventory as `i` |
| | | LEFT JOIN mm.material_store as s ON ( |
| | | ( |
| | | `i`.`material_code` = `s`.`id` |
| | | ) |
| | | ) |
| | | WHERE |
| | | ( |
| | | (`s`.`type` = '原片') |
| | | AND (`i`.`optimize_state` = 1) |
| | | AND (`i`.`available_quantity`-i.plan_quantity > 0) |
| | | AND JSON_EXTRACT(s.json, '$.thickness') = #{thickness} |
| | | AND JSON_EXTRACT(s.json, '$.model') = #{model} |
| | | ) |
| | | ORDER BY |
| | | `i`.`available_quantity` DESC) union |
| | | (SELECT |
| | | i.id AS id, |
| | | '' AS producer, |
| | | i.quantity AS available_quantity, |
| | | i.width, |
| | | i.height, |
| | | i.thickness, |
| | | i.colour AS name, |
| | | i.colour |
| | | FROM mm.surplus_materials as i |
| | | WHERE |
| | | i.quantity>0 and i.colour=#{model} and i.thickness=#{thickness} |
| | | ORDER BY |
| | | i.quantity DESC ); |
| | | </select> |
| | | |
| | | |
| | | <select id="materialStoreOptimizeUse"> |
| | | select ms.id AS id, |
| | |
| | | <!--模拟计算查询流程卡--> |
| | | <select id="selectProjectComputeMp"> |
| | | select |
| | | 流程卡号 as process_id, |
| | | 层 as technology_number, |
| | | 总层数 as TotalFloors, |
| | | 流程卡号 as processId, |
| | | 层 as technologyNumber, |
| | | 总层数 as total_layers, |
| | | 规格 as TotalNumber, |
| | | 数量 as quantity, |
| | | 数量 as total_num, |
| | | 项目 as project, |
| | | 产品名称 as glass_child, |
| | | 面积 as area, |
| | | 面积 as total_area, |
| | | tempering as tempering, |
| | | merge as merge, |
| | | patch_state as patch_state |
| | | patch_state as patch_state, |
| | | 0 as allow_rotate, |
| | | 0 as curtain_wall, |
| | | 0 as priority_level, |
| | | 1 as is_must |
| | | from pp.v_optimize_init_project_process_summary where project_no = #{projectNo} |
| | | </select> |
| | | |