| | |
| | | </resultMap> |
| | | |
| | | <select id="getDtoById" resultType="com.chinaztt.mes.plan.dto.MasterProductionScheduleDTO"> |
| | | SELECT * FROM plan_master_production_schedule where ID = #{id} |
| | | SELECT * |
| | | FROM plan_master_production_schedule |
| | | where ID = #{id} |
| | | </select> |
| | | |
| | | <select id="getMasterProductionSchedulePage" resultMap="masterProductionScheduleMap"> |
| | | select |
| | | D.id, |
| | | D.factory_id, |
| | | D.mps_no, |
| | | D.required_date, |
| | | D.remark, |
| | | D.create_time, |
| | | D.update_time, |
| | | D.create_user, |
| | | D.update_user, |
| | | D.part_id, |
| | | D.qty_required, |
| | | D.state, |
| | | D.part_no, |
| | | D.unit, |
| | | D.part_name, |
| | | D.part_description, |
| | | D.inventory_reserved_quantity, |
| | | D.outsourcing_number, |
| | | D.manufacturing_quantity, |
| | | D.customer_order_no, |
| | | D.outer_color, |
| | | D.length_requirement, |
| | | D.order_remark, |
| | | D.print_requirement, |
| | | D.source, |
| | | D.is_audit, |
| | | D.technology_document_id, |
| | | D.doc_number, |
| | | D.manufacture_attr, |
| | | D.promised_delivery_date |
| | | D.id, |
| | | D.factory_id, |
| | | D.mps_no, |
| | | D.required_date, |
| | | D.remark, |
| | | D.create_time, |
| | | D.update_time, |
| | | D.create_user, |
| | | D.update_user, |
| | | D.part_id, |
| | | D.qty_required, |
| | | D.state, |
| | | D.part_no, |
| | | D.unit, |
| | | D.part_name, |
| | | D.part_description, |
| | | D.inventory_reserved_quantity, |
| | | D.outsourcing_number, |
| | | D.manufacturing_quantity, |
| | | D.customer_order_no, |
| | | D.outer_color, |
| | | D.length_requirement, |
| | | D.order_remark, |
| | | D.print_requirement, |
| | | D.source, |
| | | D.is_audit, |
| | | D.technology_document_id, |
| | | D.doc_number, |
| | | D.manufacture_attr, |
| | | D.promised_delivery_date |
| | | FROM ( |
| | | select |
| | | pmps.*, |
| | | bp.part_no, |
| | | bp.part_name, |
| | | bp.description part_description, |
| | | bp.unit, |
| | | pco.customer_order_no, |
| | | pco.outer_color, |
| | | pcop."value" as length_requirement, |
| | | pcop2."value" as order_remark, |
| | | pcop3."value" as print_requirement, |
| | | ( |
| | | SELECT coalesce(sum(wjso.reserved_quantity), 0) |
| | | from |
| | | warehouse_join_stock_order wjso |
| | | left join plan_customer_order pco on pco."id" = wjso.customer_order_id |
| | | left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' |
| | | where wjso.type = '客户订单预留' |
| | | and status = '02confirmed' |
| | | and pjmc.model_id = pmps.id |
| | | ) inventory_reserved_quantity, |
| | | ( |
| | | SELECT coalesce(sum(poo.qty_required), 0) |
| | | from plan_outsourcing_order poo |
| | | where poo.mps_id = pmps.id |
| | | ) outsourcing_number, |
| | | ( |
| | | SELECT coalesce(sum(pmo.qty_required), 0) |
| | | from plan_manufacturing_order pmo |
| | | where pmo.mps_id = pmps.id AND pmo.part_id = pmps.part_id |
| | | ) manufacturing_quantity |
| | | from plan_master_production_schedule pmps |
| | | left join basic_part bp on bp."id" = pmps.part_id |
| | | left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = 'plan_master_production_schedule' |
| | | left join plan_customer_order pco on pco.id = pjmc.customer_order_id |
| | | left join plan_customer_order_param pcop on pcop.order_id = pco.id and pcop.field = 'LengthRequirement' |
| | | left join plan_customer_order_param pcop2 on pcop2.order_id = pco.id and pcop2.field = 'Remark' |
| | | left join plan_customer_order_param pcop3 on pcop3.order_id = pco.id and pcop3.field = 'PrintRequirement' |
| | | ) D |
| | | select |
| | | pmps.*, |
| | | bp.part_no, |
| | | bp.part_name, |
| | | bp.description part_description, |
| | | bp.unit, |
| | | pco.customer_order_no, |
| | | pco.outer_color, |
| | | pcop."value" as length_requirement, |
| | | pcop2."value" as order_remark, |
| | | pcop3."value" as print_requirement, |
| | | ( |
| | | SELECT coalesce(sum(wjso.reserved_quantity), 0) |
| | | from |
| | | warehouse_join_stock_order wjso |
| | | left join plan_customer_order pco on pco."id" = wjso.customer_order_id |
| | | left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = |
| | | 'plan_master_production_schedule' |
| | | where wjso.type = '客户订单预留' |
| | | and status = '02confirmed' |
| | | and pjmc.model_id = pmps.id |
| | | ) inventory_reserved_quantity, |
| | | ( |
| | | SELECT coalesce(sum(poo.qty_required), 0) |
| | | from plan_outsourcing_order poo |
| | | where poo.mps_id = pmps.id |
| | | ) outsourcing_number, |
| | | ( |
| | | SELECT coalesce(sum(pmo.qty_required), 0) |
| | | from plan_manufacturing_order pmo |
| | | where pmo.mps_id = pmps.id AND pmo.part_id = pmps.part_id |
| | | ) manufacturing_quantity |
| | | from plan_master_production_schedule pmps |
| | | left join basic_part bp on bp."id" = pmps.part_id |
| | | left join plan_join_model_customer pjmc on pjmc.model_id = pmps.id and pjmc.model = |
| | | 'plan_master_production_schedule' |
| | | left join plan_customer_order pco on pco.id = pjmc.customer_order_id |
| | | left join plan_customer_order_param pcop on pcop.order_id = pco.id and pcop.field = 'LengthRequirement' |
| | | left join plan_customer_order_param pcop2 on pcop2.order_id = pco.id and pcop2.field = 'Remark' |
| | | left join plan_customer_order_param pcop3 on pcop3.order_id = pco.id and pcop3.field = 'PrintRequirement' |
| | | ) D |
| | | <if test="ew.emptyOfWhere == false"> |
| | | ${ew.customSqlSegment} |
| | | </if> |
| | |
| | | left join plan_mps_source pms on pms.mps_requ_id = pmr."id" |
| | | where pms.mps_id = pmps."id") |
| | | where exists(select 1 from plan_mps_source pms where pms.mps_id = pmps."id" and pms.mps_requ_id = #{param.id}) |
| | | </update> |
| | | </update> |
| | | <select id="getPlanProduction" resultMap="masterProductionScheduleMap"> |
| | | select * |
| | | FROM plan_master_production_schedule a |
| | |
| | | </select> |
| | | |
| | | <select id="getByIdExt" resultMap="masterProductionScheduleMap"> |
| | | select |
| | | D.id, |
| | | D.factory_id, |
| | | D.mps_no, |
| | | D.required_date, |
| | | D.remark, |
| | | D.create_time, |
| | | D.update_time, |
| | | D.create_user, |
| | | D.update_user, |
| | | D.part_id, |
| | | D.qty_required, |
| | | D.state, |
| | | D.part_no, |
| | | D.unit, |
| | | D.part_name, |
| | | D.part_description, |
| | | D.inventory_reserved_quantity, |
| | | D.outsourcing_number, |
| | | D.manufacturing_quantity, |
| | | D.source, |
| | | D.is_audit, |
| | | D.technology_document_id, |
| | | D.doc_number, |
| | | D.manufacture_attr, |
| | | D.promised_delivery_date |
| | | select D.id, |
| | | D.factory_id, |
| | | D.mps_no, |
| | | D.required_date, |
| | | D.remark, |
| | | D.create_time, |
| | | D.update_time, |
| | | D.create_user, |
| | | D.update_user, |
| | | D.part_id, |
| | | D.qty_required, |
| | | D.state, |
| | | D.part_no, |
| | | D.unit, |
| | | D.part_name, |
| | | D.part_description, |
| | | D.inventory_reserved_quantity, |
| | | D.outsourcing_number, |
| | | D.manufacturing_quantity, |
| | | D.source, |
| | | D.is_audit, |
| | | D.technology_document_id, |
| | | D.doc_number, |
| | | D.manufacture_attr, |
| | | D.promised_delivery_date |
| | | FROM ( |
| | | select |
| | | pmps.*, |
| | | bp.part_no, |
| | | bp.part_name, |
| | | bp.description part_description, |
| | | bp.unit, |
| | | ( |
| | | SELECT coalesce(sum(wjso.reserved_quantity), 0) |
| | | from |
| | | warehouse_join_stock_order wjso |
| | | left join plan_customer_order pco on pco."id" = wjso.customer_order_id |
| | | left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND pjmc.model = 'plan_master_production_schedule' |
| | | where wjso.type = '客户订单预留' |
| | | and status = '02confirmed' |
| | | and pjmc.model_id = pmps.id |
| | | ) inventory_reserved_quantity, |
| | | ( |
| | | SELECT coalesce(sum(poo.qty_required), 0) |
| | | from plan_outsourcing_order poo |
| | | where poo.mps_id = pmps.id |
| | | ) outsourcing_number, |
| | | ( |
| | | SELECT coalesce(sum(pmo.qty_required), 0) |
| | | from plan_manufacturing_order pmo |
| | | where pmo.mps_id = pmps.id |
| | | ) manufacturing_quantity |
| | | select pmps.*, |
| | | bp.part_no, |
| | | bp.part_name, |
| | | bp.description part_description, |
| | | bp.unit, |
| | | ( |
| | | SELECT coalesce(sum(wjso.reserved_quantity), 0) |
| | | from warehouse_join_stock_order wjso |
| | | left join plan_customer_order pco on pco."id" = wjso.customer_order_id |
| | | left join plan_join_model_customer pjmc on pjmc.customer_order_id = pco."id" AND |
| | | pjmc.model = |
| | | 'plan_master_production_schedule' |
| | | where wjso.type = '客户订单预留' |
| | | and status = '02confirmed' |
| | | and pjmc.model_id = pmps.id |
| | | ) inventory_reserved_quantity, |
| | | ( |
| | | SELECT coalesce(sum(poo.qty_required), 0) |
| | | from plan_outsourcing_order poo |
| | | where poo.mps_id = pmps.id |
| | | ) outsourcing_number, |
| | | ( |
| | | SELECT coalesce(sum(pmo.qty_required), 0) |
| | | from plan_manufacturing_order pmo |
| | | where pmo.mps_id = pmps.id |
| | | ) manufacturing_quantity |
| | | from plan_master_production_schedule pmps |
| | | left join basic_part bp on bp."id" = pmps.part_id |
| | | where pmps.id = #{id} |