Pārlūkot izejas kodu

2023年9月25日09:44:55

纪新园 1 gadu atpakaļ
vecāks
revīzija
1401b7fdd1

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/domain/Order.java

@@ -1,6 +1,7 @@
 package com.ruoyi.web.controller.iot.domain;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @author :jixinyuan
@@ -98,6 +99,16 @@ public class Order {
      */
     private Integer workOrderNum;
 
+    private List<ProductOrder> productOrderList;
+
+    public List<ProductOrder> getProductOrderList() {
+        return productOrderList;
+    }
+
+    public void setProductOrderList(List<ProductOrder> productOrderList) {
+        this.productOrderList = productOrderList;
+    }
+
     public Long getId() {
         return id;
     }

+ 54 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/domain/ProductOrder.java

@@ -5,4 +5,58 @@ package com.ruoyi.web.controller.iot.domain;
  * @date : 2023/9/25
  */
 public class ProductOrder {
+
+    /**
+     * 主键
+     */
+    private Long id;
+     /**
+     * 工单id
+     */
+    private Long orderId;
+     /**
+     * 工序id
+     */
+    private Long processId;
+     /**
+     * 设备id
+     */
+    private Long equipmentId;
+     /**
+     * 用户id
+     */
+    private Long userId;
+     /**
+     * 用户名
+     */
+    private String userName;
+     /**
+     * 开始时间
+     */
+    private String startTime;
+     /**
+     * 结束时间
+     */
+    private String endTime;
+     /**
+     * 订单id
+     */
+    private Long taskId;
+     /**
+     * 实际生产数
+     */
+    private Integer productNum;
+     /**
+     * 0:执行中 1:待质检 2:完成
+     */
+    private Integer status;
+     /**
+     * 暂停时间
+     */
+    private String stopTime;
+     /**
+     * 暂停时产量
+     */
+    private Integer stopNumber;
+
 }

+ 6 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/service/impl/OrderServiceImpl.java

@@ -6,6 +6,7 @@ import com.ruoyi.common.core.page.PageDomain;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.core.page.TableSupport;
 import com.ruoyi.web.controller.iot.domain.Order;
+import com.ruoyi.web.controller.iot.domain.ProductOrder;
 import com.ruoyi.web.controller.iot.service.IOrderService;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
@@ -84,6 +85,11 @@ public class OrderServiceImpl implements IOrderService {
             dataSource.setPassword("By@#5c9i75sgtx3b620g6m6e");
             JdbcTemplate template = new JdbcTemplate(dataSource);
             detail = template.queryForObject("SELECT * FROM t_factory_order where id = ;" + order.getId(), Order.class);
+            if (!ObjectUtils.isEmpty(detail)){
+                List<ProductOrder> productOrderList = template.query("SELECT * FROM t_product_order_detail where order_id = ;"+ detail.getId(),
+                        new BeanPropertyRowMapper<ProductOrder>(ProductOrder.class));
+                detail.setProductOrderList(productOrderList);
+            }
         } catch (Exception e) {
             throw new RuntimeException(e.getMessage());
         }