| | |
| | | <result property="status" column="status"/> |
| | | </resultMap> |
| | | |
| | | <!-- <select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto">--> |
| | | <!-- select ppm.*,--> |
| | | <!-- pwo.work_order_no as workOrderNo,--> |
| | | <!-- pwo.status as workOrderStatus,--> |
| | | <!-- u.nick_name as nickName,--> |
| | | <!-- p.product_name as productName,--> |
| | | <!-- pp.name as process,--> |
| | | <!-- pm.model as productModelName,--> |
| | | <!-- ppo.quantity,--> |
| | | <!-- ppo.scrap_qty,--> |
| | | <!-- pm.unit,--> |
| | | <!-- sl.sales_contract_no salesContractNo--> |
| | | <!-- from--> |
| | | <!-- production_product_main ppm--> |
| | | <!-- left join product_work_order pwo on pwo.id = ppm.work_order_id--> |
| | | <!-- left join product_process_route_item ppri on ppri.id = pwo.product_process_route_item_id--> |
| | | <!-- left join product_process pp on pp.id = ppri.process_id--> |
| | | <!-- left join product_order po on po.id = pwo.product_order_id--> |
| | | <!-- left join production_product_output ppo on ppm.id = ppo.product_main_id--> |
| | | <!-- left join product_model pm on pm.id = ppo.product_model_id--> |
| | | <!-- left join product p on p.id = pm.product_id--> |
| | | <!-- left join sales_ledger sl on sl.id = po.sales_ledger_id--> |
| | | <!-- left join sys_user u on u.user_id = ppm.user_id--> |
| | | <!-- <where>--> |
| | | <!-- <if test="c.nickName != null and c.nickName != ''">--> |
| | | <!-- and u.nick_name like concat('%',#{c.nickName},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.workOrderNo != null and c.workOrderNo != ''">--> |
| | | <!-- and pwo.work_order_no like concat('%',#{c.workOrderNo},'%')--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.workOrderStatus != null and c.workOrderStatus != ''">--> |
| | | <!-- and pwo.status = #{c.workOrderStatus}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="c.status != null and c.status != ''">--> |
| | | <!-- and ppm.status = #{c.status}--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- order by ppm.id--> |
| | | <!-- </select>--> |
| | | |
| | | <!-- 新sql 用中间表sales_ledger_production_ref进行关联sales_ledger和product_order,查询出所有关联的sales_ledger_no--> |
| | | <select id="listPageProductionProductMainDto" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | select ppm.*, |
| | | pwo.work_order_no as workOrderNo, |
| | |
| | | ppo.quantity, |
| | | ppo.scrap_qty, |
| | | pm.unit, |
| | | sl.sales_contract_no salesContractNo |
| | | ( |
| | | SELECT GROUP_CONCAT(DISTINCT sl.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl |
| | | INNER JOIN sales_ledger_production_ref ref ON sl.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id |
| | | ) AS salesContractNo |
| | | from |
| | | production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |
| | |
| | | left join production_product_output ppo on ppm.id = ppo.product_main_id |
| | | left join product_model pm on pm.id = ppo.product_model_id |
| | | left join product p on p.id = pm.product_id |
| | | left join sales_ledger sl on sl.id = po.sales_ledger_id |
| | | left join sys_user u on u.user_id = ppm.user_id |
| | | <where> |
| | | <if test="c.nickName != null and c.nickName != ''"> |
| | |
| | | </if> |
| | | </where> |
| | | order by ppm.id |
| | | |
| | | </select> |
| | | |
| | | <select id="getOrderByMainId" resultType="com.ruoyi.production.pojo.ProductOrder"> |
| | | select po.* |
| | | from product_order po |
| | |
| | | left join production_product_main pm on work_order_id = pwo.id |
| | | where pm.id = #{productMainId} |
| | | </select> |
| | | |
| | | <!-- <select id="listProductionDetails" resultType="com.ruoyi.production.dto.ProductionProductMainDto">--> |
| | | <!-- SELECT--> |
| | | <!-- slpa.scheduling_date,--> |
| | | <!-- slpa.scheduling_user_name,--> |
| | | <!-- sl.sales_contract_no,--> |
| | | <!-- sl.customer_name,--> |
| | | <!-- p.product_name,--> |
| | | <!-- pm.model as product_model_name,--> |
| | | <!-- pm.unit,--> |
| | | <!-- slpa.process,--> |
| | | <!-- slpa.finished_num as quantity,--> |
| | | <!-- slpa.work_hours,--> |
| | | <!-- slpa.work_hours * slpa.finished_num AS wages--> |
| | | <!-- FROM--> |
| | | <!-- production_product_main ppm--> |
| | | <!-- LEFT JOIN sales_ledger_production_accounting slpa ON slpa.product_main_id = ppm.id--> |
| | | <!-- LEFT JOIN production_product_output ppo ON ppm.id = ppo.product_main_id--> |
| | | <!-- LEFT JOIN product_work_order pwo ON pwo.id = ppm.work_order_id--> |
| | | <!-- LEFT JOIN product_order po ON po.id = pwo.product_order_id--> |
| | | <!-- LEFT JOIN process_route pr ON pr.id = po.route_id--> |
| | | <!-- LEFT JOIN product_model pm ON po.product_model_id = pm.id--> |
| | | <!-- LEFT JOIN product p ON p.id = pm.product_id--> |
| | | <!-- LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id--> |
| | | <!-- <where>--> |
| | | <!-- <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''">--> |
| | | <!-- and slpa.scheduling_user_name = #{ew.schedulingUserName}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="ew.entryDate != null " >--> |
| | | <!-- and slpa.scheduling_date >= #{ew.entryDate}--> |
| | | <!-- and slpa.scheduling_date < DATE_ADD(#{ew.entryDate}, INTERVAL 1 DAY)--> |
| | | <!-- </if>--> |
| | | <!-- <if test="ew.entryDateStart != null and ew.entryDateEnd != null" >--> |
| | | <!-- and slpa.scheduling_date >= #{ew.entryDateStart}--> |
| | | <!-- and slpa.scheduling_date < date_add(#{ew.entryDateEnd}, INTERVAL 1 DAY)--> |
| | | <!-- </if>--> |
| | | <!-- </where>--> |
| | | <!-- order by ppm.id desc--> |
| | | <!-- </select>--> |
| | | |
| | | <!-- 新sql 用中间表sales_ledger_production_ref进行关联sales_ledger和product_order,查询出所有关联的sales_ledger_no和customer_name--> |
| | | <select id="listProductionDetails" resultType="com.ruoyi.production.dto.ProductionProductMainDto"> |
| | | SELECT |
| | | slpa.scheduling_date, |
| | | slpa.scheduling_user_name, |
| | | sl.sales_contract_no, |
| | | sl.customer_name, |
| | | |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.sales_contract_no SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS sales_contract_no, |
| | | (SELECT GROUP_CONCAT(DISTINCT sl_inner.customer_name SEPARATOR ',') |
| | | FROM sales_ledger sl_inner |
| | | INNER JOIN sales_ledger_production_ref ref ON sl_inner.id = ref.sales_ledger_id |
| | | WHERE ref.product_order_id = po.id) AS customer_name, |
| | | |
| | | p.product_name, |
| | | pm.model as product_model_name, |
| | | pm.unit, |
| | |
| | | LEFT JOIN process_route pr ON pr.id = po.route_id |
| | | LEFT JOIN product_model pm ON po.product_model_id = pm.id |
| | | LEFT JOIN product p ON p.id = pm.product_id |
| | | LEFT JOIN sales_ledger sl ON po.sales_ledger_id = sl.id |
| | | |
| | | <where> |
| | | <if test="ew.schedulingUserName != null and ew.schedulingUserName !=''"> |
| | | and slpa.scheduling_user_name = #{ew.schedulingUserName} |
| | |
| | | </where> |
| | | order by ppm.id desc |
| | | </select> |
| | | |
| | | <select id="listMain" resultType="java.lang.Long"> |
| | | SELECT ppm.id FROM production_product_main ppm |
| | | left join product_work_order pwo on pwo.id = ppm.work_order_id |