| | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductionOrder"> |
| | | <id column="id" property="id" /> |
| | | <result column="sales_ledger_id" property="salesLedgerId" /> |
| | | <result column="production_plan_ids" property="productionPlanIds" /> |
| | | <result column="product_model_id" property="productModelId" /> |
| | | <result column="nps_no" property="npsNo" /> |
| | |
| | | <result column="complete_quantity" property="completeQuantity" /> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | | <result column="sale_ledger_product_id" property="saleLedgerProductId" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="dept_id" property="deptId" /> |
| | | </resultMap> |
| | | |
| | | <select id="selectProgressOrders" resultType="com.ruoyi.home.dto.ProductionProgressOrderDto"> |
| | | select po.nps_no, |
| | | sl.sales_contract_no, |
| | | sl.project_name, |
| | | sl.customer_name, |
| | | p.product_name as productCategory, |
| | | pm.model as specificationModel, |
| | | tr.process_route_code as processRouteCode, |
| | | po.quantity, |
| | | ifnull(po.complete_quantity, 0) as completeQuantity, |
| | | round(ifnull(po.complete_quantity, 0) / nullif(po.quantity, 0) * 100, 2) as completionStatus, |
| | | tb.bom_no, |
| | | datediff(sl.delivery_date, curdate()) as deliveryDaysDiff, |
| | | sl.delivery_date, |
| | | false as isFh |
| | | from production_order po |
| | | left join sales_ledger sl on po.sales_ledger_id = sl.id |
| | | left join product_model pm on po.product_model_id = pm.id |
| | | left join product p on pm.product_id = p.id |
| | | left join technology_routing tr on po.technology_routing_id = tr.id |
| | | left join technology_bom tb on tr.bom_id = tb.id |
| | | where po.create_time between #{startTime} and #{endTime} |
| | | order by po.create_time desc |
| | | </select> |
| | | |
| | | <select id="countCreated" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from production_order |
| | | where create_time >= #{startDate} |
| | | and create_time <= #{endDate} |
| | | </select> |
| | | |
| | | <select id="countCompleted" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from production_order |
| | | where end_time >= #{startDate} |
| | | and end_time <= #{endDate} |
| | | and ifnull(complete_quantity, 0) >= quantity |
| | | </select> |
| | | |
| | | <select id="countPending" resultType="java.lang.Integer"> |
| | | select count(1) |
| | | from production_order |
| | | where create_time >= #{startDate} |
| | | and create_time <= #{endDate} |
| | | and ifnull(complete_quantity, 0) < quantity |
| | | </select> |
| | | |
| | | </mapper> |