From fe1b02a121c173e9b2d56bbe5a1982e0e69e0548 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期二, 28 四月 2026 18:06:08 +0800
Subject: [PATCH] feat(production): 新增生产工单管理功能 - 创建 ProductionOperationTask 实体类定义工单数据结构 - 实现 ProductionOperationTaskController 提供工单的增删改查接口 - 开发 ProductionOperationTaskService 和实现类处理业务逻辑 - 配置 ProductionOperationTaskMapper 及 XML 文件实现数据库操作 - 添加 ProductionOperationTaskVo 视图对象用于数据展示 - 扩展 ProductionOrder 实体类增加生产订单相关属性 - 更新 ProductionOrderMapper.xml 完善订单查询映射配置 - 优化 ProductionOrderPickRecordMapper.xml 记录物料领取明细 - 新增 ProductionOrderRoutingOperationParam 参数配置实体 - 完善 工序参数处理逻辑
---
src/main/resources/mapper/production/ProductionOperationTaskMapper.xml | 57 ++++++++++++++++++++++++++++++++++++++++++++++-----------
1 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
index 5a40417..ebafa7a 100644
--- a/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
+++ b/src/main/resources/mapper/production/ProductionOperationTaskMapper.xml
@@ -5,7 +5,7 @@
<!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
<resultMap id="BaseResultMap" type="com.ruoyi.production.pojo.ProductionOperationTask">
<id column="id" property="id" />
- <result column="technology_routing_operation_id" property="technologyRoutingOperationId" />
+ <result column="production_order_routing_operation_id" property="productionOrderRoutingOperationId" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
<result column="work_order_no" property="workOrderNo" />
@@ -21,6 +21,43 @@
<result column="dept_id" property="deptId" />
</resultMap>
+ <select id="pageProductionOperationTask" resultType="com.ruoyi.production.bean.vo.ProductionOperationTaskVo">
+ select pot.*,
+ po.nps_no as npsNo,
+ p.product_name as productName,
+ pm.model as model,
+ pm.unit as unit,
+ poro.operation_name as operationName,
+ ROUND(pot.complete_quantity / pot.plan_quantity * 100, 2) AS completionStatus,
+ CASE
+ WHEN pot.work_order_no LIKE 'FG%' THEN '杩斿伐杩斾慨'
+ ELSE '姝e父'
+ END AS work_order_type
+ from production_operation_task pot
+ left join production_order po on pot.production_order_id = po.id
+ left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
+ left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id)
+ left join product p on pm.product_id = p.id
+ <where>
+ <if test="c != null and c.id != null">
+ and pot.id = #{c.id}
+ </if>
+ <if test="c != null and c.productionOrderId != null">
+ and pot.production_order_id = #{c.productionOrderId}
+ </if>
+ <if test="c != null and c.productionOrderRoutingOperationId != null">
+ and pot.production_order_routing_operation_id = #{c.productionOrderRoutingOperationId}
+ </if>
+ <if test="c != null and c.status != null">
+ and pot.status = #{c.status}
+ </if>
+ <if test="c != null and c.workOrderNo != null and c.workOrderNo != ''">
+ and pot.work_order_no like concat('%', #{c.workOrderNo}, '%')
+ </if>
+ </where>
+ order by pot.id desc
+ </select>
+
<select id="selectTaskStatisticsByDate" resultType="com.ruoyi.home.dto.ProductionTaskStatisticsDto">
select pot.id,
pot.work_order_no,
@@ -30,17 +67,16 @@
pot.actual_end_time as actualEndTime,
pot.plan_quantity as planQuantity,
ifnull(pot.complete_quantity, 0) as completeQuantity,
- top2.name as processName,
+ poro.operation_name as processName,
p.product_name as productName,
pm.model,
pm.unit,
po.nps_no as productOrderNpsNo
from production_operation_task pot
left join production_order po on pot.production_order_id = po.id
- left join product_model pm on po.product_model_id = pm.id
+ left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
+ left join product_model pm on pm.id = ifnull(poro.product_model_id, po.product_model_id)
left join product p on pm.product_id = p.id
- left join technology_routing_operation tro on pot.technology_routing_operation_id = tro.id
- left join technology_operation top2 on tro.technology_operation_id = top2.id
where date(pot.create_time) between #{startDate} and #{endDate}
order by pot.create_time desc
</select>
@@ -55,16 +91,15 @@
</select>
<select id="calculateProductionStatistics" resultType="com.ruoyi.home.dto.processDataProductionStatisticsDto">
- select top2.name as processName,
+ select poro.operation_name as processName,
sum(ifnull(ppi.input_quantity, 0)) as totalInput,
sum(ifnull(ppo.scrap_qty, 0)) as totalScrap,
sum(ifnull(ppo.quantity, 0) - ifnull(ppo.scrap_qty, 0)) as totalOutput
from production_product_output ppo
inner join production_product_main ppm on ppo.production_product_main_id = ppm.id
inner join production_operation_task pot on ppm.production_operation_task_id = pot.id
- inner join technology_routing_operation tro on pot.technology_routing_operation_id = tro.id
- inner join technology_operation top2 on tro.technology_operation_id = top2.id
- left join production_product_input ppi on ppi.production_product_main_id = ppm.id
+ left join production_order_routing_operation poro on pot.production_order_routing_operation_id = poro.id
+ left join production_product_input ppi on ppi.production_product_main_id = ppm.id
<where>
<if test="startDateTime != null">
and ppo.create_time >= #{startDateTime}
@@ -76,13 +111,13 @@
and ppm.create_user = #{userId}
</if>
<if test="processIds != null and processIds.size() > 0">
- and top2.id in
+ and poro.technology_operation_id in
<foreach collection="processIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
- group by top2.id, top2.name
+ group by poro.technology_operation_id, poro.operation_name
</select>
</mapper>
--
Gitblit v1.9.3