From 5eec9b5a9d8bf9e49663d5a51cab7490fef5b204 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 26 八月 2025 15:22:03 +0800
Subject: [PATCH] yys  生产管控(完成基本功能)

---
 main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql     |    2 
 main-business/src/main/java/com/ruoyi/business/mapper/ProductionSchedulingMapper.java                            |   25 +++
 main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java                     |    2 
 main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java                                  |    6 
 main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java                     |   33 ++--
 main-business/src/main/java/com/ruoyi/business/entity/ProductionScheduling.java                                  |  102 ++++++++++++
 main-business/src/main/java/com/ruoyi/business/service/ProductionSchedulingService.java                          |   28 +++
 main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql    |    3 
 main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java                                     |    2 
 main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java                                     |    6 
 main-business/src/main/java/com/ruoyi/business/service/impl/ProductionSchedulingServiceImpl.java                 |  103 ++++++++++++
 main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java                                      |    5 
 main-business/src/main/java/com/ruoyi/business/entity/Production.java                                            |   12 +
 main-business/src/main/java/com/ruoyi/business/service/impl/ProductionServiceImpl.java                           |    2 
 main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql |    6 
 main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql            |    4 
 main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java                 |    1 
 main-business/src/main/resources/db/migration/postgresql/V20250825111200__create_table_production_scheduling.sql |   59 +++++++
 main-business/src/main/java/com/ruoyi/business/controller/ProductionSchedulingController.java                    |   65 ++++++++
 main-business/src/main/resources/mapper/ProductionSchedulingMapper.xml                                           |    8 +
 20 files changed, 455 insertions(+), 19 deletions(-)

diff --git a/main-business/src/main/java/com/ruoyi/business/controller/ProductionSchedulingController.java b/main-business/src/main/java/com/ruoyi/business/controller/ProductionSchedulingController.java
new file mode 100644
index 0000000..73574e6
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/ProductionSchedulingController.java
@@ -0,0 +1,65 @@
+package com.ruoyi.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.PurchaseRegistrationDto;
+import com.ruoyi.business.entity.ProductionScheduling;
+import com.ruoyi.business.entity.PurchaseRegistration;
+import com.ruoyi.business.service.ProductionSchedulingService;
+import com.ruoyi.common.core.domain.R;
+import lombok.AllArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/8/25 16:39
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/productionScheduling")
+public class ProductionSchedulingController {
+
+    @Autowired
+    private ProductionSchedulingService productionSchedulingService;
+
+    @GetMapping("/list")
+    public R<IPage<ProductionScheduling>> list(Page<ProductionScheduling> page, ProductionScheduling productionScheduling) {
+        IPage<ProductionScheduling> list = productionSchedulingService.listPage(page,productionScheduling);
+        return R.ok(list);
+    }
+
+    @PostMapping("/addProductionScheduling")
+    @Transactional(rollbackFor = Exception.class)
+    public R addProductionScheduling(@RequestBody List<ProductionScheduling> productionScheduling) {
+        boolean save = productionSchedulingService.addProductionScheduling(productionScheduling);
+        return save ? R.ok() : R.fail();
+    }
+
+    @PostMapping("/updateProductionScheduling")
+    @Transactional(rollbackFor = Exception.class)
+    public R updateProductionScheduling(@RequestBody ProductionScheduling productionScheduling) {
+        boolean update = productionSchedulingService.updateById(productionScheduling);
+        return update ? R.ok() : R.fail();
+    }
+
+    @DeleteMapping("/delProductionScheduling")
+    @Transactional(rollbackFor = Exception.class)
+    public R delProductionScheduling(@RequestBody List<Long> ids) {
+        boolean delete = productionSchedulingService.removeByIds(ids);
+        return delete ? R.ok() : R.fail();
+    }
+
+    @PostMapping("/work")
+    @Transactional(rollbackFor = Exception.class)
+    public R work(@RequestBody ProductionScheduling productionScheduling) {
+        boolean update = productionSchedulingService.work(productionScheduling);
+        return update ? R.ok() : R.fail();
+    }
+
+
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
index 4bc29b1..819a3ca 100644
--- a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
+++ b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
@@ -14,6 +14,8 @@
 
     private List<Long> ids;//瑕佸悎骞剁殑姝e紡搴撶殑id
 
+    private Integer type;
+
     private String coal; //鐓ょ
 
     private String supplierName; //渚涘簲鍟�
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
index d5fcc4e..87ca0f8 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
@@ -38,6 +38,12 @@
     private Long supplierId;
 
     /**
+     * 鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡
+     */
+    @TableField(value = "type")
+    private Integer type;
+
+    /**
      * 鐓ょ
      */
     @TableField(value = "coal_id")
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
index e46fc5a..e797d3f 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
@@ -55,6 +55,11 @@
     @TableField(value = "coal_id")
     private Long coalId;
     /**
+     * 鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡
+     */
+    @TableField(value = "type")
+    private Integer type;
+    /**
      * 鍗曚綅
      */
     @TableField(value = "unit")
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/Production.java b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
index a01fbb6..0220378 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/Production.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
@@ -82,4 +82,16 @@
      */
     @TableField(value = "production_date")
     private LocalDate productionDate;
+
+    /**
+     * 鐓ゆ枡绫诲瀷(1-鎴愬搧 2-鍘熸枡)
+     */
+    @TableField(value = "type")
+    private Integer type;
+
+    /**
+     * 鐘舵�侊紙1-寰呮帓浜� 2-鎺掍骇涓� 3-宸叉帓浜э級
+     */
+    @TableField(value = "status")
+    private Integer status;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/ProductionScheduling.java b/main-business/src/main/java/com/ruoyi/business/entity/ProductionScheduling.java
new file mode 100644
index 0000000..af0b454
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/ProductionScheduling.java
@@ -0,0 +1,102 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.common.core.domain.MyBaseEntity;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * @author :yys
+ * @date : 2025/8/25 16:28
+ */
+@Data
+@TableName("production_scheduling")
+public class ProductionScheduling extends MyBaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 涓婚敭ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     *  鐢熶骇鏄庣粏id
+     */
+    @TableField(value = "production_id")
+    private Long productionId;
+    /**
+     * 鐓ょID
+     */
+    @TableField(value = "coal_id")
+    private Long coalId;
+
+    /**
+     * 鎬绘暟閲�
+     */
+    @TableField(exist = false)
+    private BigDecimal productionQuantity;
+    /**
+     * 鎺掍骇鏁伴噺
+     */
+    @TableField(value = "scheduling_num")
+    private BigDecimal schedulingNum;
+
+    /**
+     * 鍏ュ簱鏁伴噺
+     */
+    @TableField(value = "success_num")
+    private BigDecimal successNum;
+    /**
+     * 鐓ゆ枡绫诲瀷锛�1-鎴愬搧 2-鍘熸枡锛�
+     */
+    @TableField(value = "type")
+    private Integer type;
+    /**
+     *鐘舵�侊紙1-寰呯敓浜� 2-鐢熶骇涓� 3-宸叉姤宸ワ級
+     */
+    @TableField(value = "status")
+    private Integer status;
+
+    /**
+     * 鍗曚綅
+     */
+    @TableField(value = "unit")
+    private String unit;
+    /**
+     * 宸ュ簭锛堝瓧鍏革級
+     */
+    @TableField(value = "process")
+    private String process;
+    /**
+     * 宸ユ椂瀹氶
+     */
+    @TableField(value = "work_hours")
+    private BigDecimal workHours;
+    /**
+     * 鎺掍骇鏃ユ湡
+     */
+    @TableField(value = "scheduling_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private Date schedulingDate;
+    /**
+     * 鎺掍骇浜篿d
+     */
+    @TableField(value = "scheduling_user_id")
+    private Long schedulingUserId;
+    /**
+     * 鎺掍骇浜哄悕绉�
+     */
+    @TableField(value = "scheduling_user_name")
+    private String schedulingUserName;
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java b/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
index 890aa3b..2d0a160 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
@@ -93,4 +93,10 @@
      */
     @TableField(value = "freight")
     private BigDecimal freight;
+
+    /**
+     * 绫诲瀷锛�1-鎴愬搧锛�2-鍘熸枡锛�
+     */
+    @TableField(value = "type")
+    private Integer type;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/ProductionSchedulingMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionSchedulingMapper.java
new file mode 100644
index 0000000..5e1109e
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/ProductionSchedulingMapper.java
@@ -0,0 +1,25 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.entity.ProductionScheduling;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author :yys
+ * @date : 2025/8/25 16:35
+ */
+@Mapper
+public interface ProductionSchedulingMapper extends BaseMapper<ProductionScheduling> {
+
+    /**
+     * 鏌ヨ鍒楄〃
+     *
+     * @param page
+     * @param productionScheduling
+     * @return
+     */
+    IPage<ProductionScheduling> listPage(Page<ProductionScheduling> page,@Param("req") ProductionScheduling productionScheduling);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/ProductionSchedulingService.java b/main-business/src/main/java/com/ruoyi/business/service/ProductionSchedulingService.java
new file mode 100644
index 0000000..51da7a8
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/ProductionSchedulingService.java
@@ -0,0 +1,28 @@
+package com.ruoyi.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.business.entity.ProductionScheduling;
+
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/8/25 16:37
+ */
+public interface ProductionSchedulingService extends IService<ProductionScheduling> {
+    
+    /**
+     * 鍒嗛〉鏌ヨ
+     *
+     * @param page
+     * @param productionScheduling
+     * @return
+     */
+    IPage<ProductionScheduling> listPage(Page<ProductionScheduling> page, ProductionScheduling productionScheduling);
+
+    boolean addProductionScheduling(List<ProductionScheduling> productionScheduling);
+
+    boolean work(ProductionScheduling productionScheduling);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
index e4532e2..9d7cae6 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
@@ -19,6 +19,7 @@
 import com.ruoyi.basic.service.CoalFieldService;
 import com.ruoyi.basic.service.CoalPlanService;
 import com.ruoyi.basic.service.CoalValueService;
+import com.ruoyi.business.constant.InventoryRecordConstant;
 import com.ruoyi.business.dto.PendingInventoryDto;
 import com.ruoyi.business.entity.OfficialInventory;
 import com.ruoyi.business.entity.PendingInventory;
@@ -290,6 +291,7 @@
                 officialInventory.setPendingId(pendingInventoryDto.getPId());
                 officialInventory.setInventoryQuantity(quantity);
                 officialInventory.setRegistrantId(1L);
+                officialInventory.setType(pendingInventory.getType());
                 officialInventory.setSupplierId(pendingInventoryDto.getSupplierId());
                 officialInventoryMapper.insert(officialInventory);
             } else {
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
index 3dab18e..25dae27 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -173,7 +173,7 @@
         batchInsertInventories(masterId, dto.getProductionInventoryList());
 
         // 鎻掑叆寰呭叆搴撴暟鎹�
-        insertPendingInventory(dto.getProductionList());
+//        insertPendingInventory(dto.getProductionList());
 
         return 1;
     }
@@ -263,6 +263,7 @@
             BeanUtils.copyProperties(p, copy);
             copy.setId(null);
             copy.setProductionMasterId(masterId);
+            copy.setStatus(1);
             productionMapper.insert(copy);
         }
     }
@@ -283,7 +284,7 @@
     /**
      * 灏嗗姞宸ヤ骇鐢熺殑浜у搧璁板綍鍒板緟鍏ュ簱琛�
      */
-    private void insertPendingInventory(List<Production> list) {
+    public void insertPendingInventory(List<Production> list) {
         LocalDate currentDate = LocalDate.now();
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         String formattedDate = currentDate.format(formatter);
@@ -402,20 +403,20 @@
         }
 
         // 鎵归噺鏇存柊瀹樻柟搴撳瓨
-        for (Map.Entry<Long, BigDecimal> entry : inventoryAdjustMap.entrySet()) {
-            OfficialInventory official = officialInventoryMapper.selectById(entry.getKey());
-            if (official == null) {
-                throw new BaseException("瀹樻柟搴撳瓨涓嶅瓨鍦紝ID: " + entry.getKey());
-            }
-
-            // 浣跨敤绾跨▼瀹夊叏鐨凚igDecimal鎿嶄綔
-            official.setInventoryQuantity(
-                    Optional.ofNullable(official.getInventoryQuantity())
-                            .orElse(BigDecimal.ZERO)
-                            .add(entry.getValue())
-            );
-            officialInventoryMapper.updateById(official);
-        }
+//        for (Map.Entry<Long, BigDecimal> entry : inventoryAdjustMap.entrySet()) {
+//            OfficialInventory official = officialInventoryMapper.selectById(entry.getKey());
+//            if (official == null) {
+//                throw new BaseException("瀹樻柟搴撳瓨涓嶅瓨鍦紝ID: " + entry.getKey());
+//            }
+//
+//            // 浣跨敤绾跨▼瀹夊叏鐨凚igDecimal鎿嶄綔
+//            official.setInventoryQuantity(
+//                    Optional.ofNullable(official.getInventoryQuantity())
+//                            .orElse(BigDecimal.ZERO)
+//                            .add(entry.getValue())
+//            );
+//            officialInventoryMapper.updateById(official);
+//        }
 
         // 鎵归噺鍒犻櫎鐢熶骇搴撳瓨
         if (!productionIdsToDelete.isEmpty()) {
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionSchedulingServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionSchedulingServiceImpl.java
new file mode 100644
index 0000000..0ce8ddb
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionSchedulingServiceImpl.java
@@ -0,0 +1,103 @@
+package com.ruoyi.business.service.impl;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.business.entity.Production;
+import com.ruoyi.business.entity.ProductionScheduling;
+import com.ruoyi.business.mapper.ProductionMapper;
+import com.ruoyi.business.mapper.ProductionSchedulingMapper;
+import com.ruoyi.business.service.ProductionSchedulingService;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.system.mapper.SysUserMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * @author :yys
+ * @date : 2025/8/25 16:38
+ */
+@Service
+@Slf4j
+public class ProductionSchedulingServiceImpl extends ServiceImpl<ProductionSchedulingMapper, ProductionScheduling> implements ProductionSchedulingService {
+
+    @Autowired
+    private ProductionSchedulingMapper productionSchedulingMapper;
+
+    @Autowired
+    private ProductionMapper productionMapper;
+
+    @Autowired
+    private SysUserMapper sysUserMapper;
+
+    @Autowired
+    private ProductionMasterServiceImpl productionMasterService;
+
+    @Override
+    public IPage<ProductionScheduling> listPage(Page<ProductionScheduling> page, ProductionScheduling productionScheduling) {
+        return productionSchedulingMapper.listPage(page, productionScheduling);
+    }
+
+    @Override
+    public boolean addProductionScheduling(List<ProductionScheduling> productionScheduling) {
+        if (CollectionUtils.isEmpty(productionScheduling)) {
+            return false;
+        }
+        BigDecimal reduce = productionScheduling.stream()
+                .map(ProductionScheduling::getSchedulingNum)
+                .reduce(BigDecimal.ZERO, BigDecimal::add);
+        if(reduce.compareTo(productionScheduling.get(0).getProductionQuantity()) < 0){
+            return false;
+        }
+        Production production = productionMapper.selectById(productionScheduling.get(0).getProductionId());
+        if(production == null){
+            throw new RuntimeException("鐢熶骇璁㈠崟涓虹┖");
+        }
+        production.setStatus(2);
+        if(reduce.compareTo(productionScheduling.get(0).getProductionQuantity()) == 0){
+            production.setStatus(3);
+        }
+        productionMapper.updateById(production);
+        for (ProductionScheduling scheduling : productionScheduling) {
+            SysUser sysUser = sysUserMapper.selectUserById(scheduling.getSchedulingUserId());
+            if(sysUser == null) throw new RuntimeException("鎺掍骇浜哄憳涓嶅瓨鍦�");
+            scheduling.setStatus(1);
+            scheduling.setSchedulingUserName(sysUser.getNickName());
+            productionSchedulingMapper.insert(scheduling);
+        }
+        return true;
+    }
+
+    @Override
+    public boolean work(ProductionScheduling productionScheduling) {
+        ProductionScheduling productionScheduling1 = productionSchedulingMapper.selectById(productionScheduling.getId());
+        if(productionScheduling1 == null){
+            throw new RuntimeException("鐢熶骇鎶ュ伐涓嶅瓨鍦�");
+        }
+        Production production = productionMapper.selectById(productionScheduling1.getProductionId());
+        if(production == null){
+            throw new RuntimeException("鐢熶骇璁㈠崟涓虹┖");
+        }
+        production.setProductionQuantity(productionScheduling.getSuccessNum());
+        production.setProducerId(productionScheduling.getSchedulingUserId());
+        // 鍏ュ簱
+        productionMasterService.insertPendingInventory(Arrays.asList(production));
+        // 淇敼鎶ュ伐琛ㄧ殑鍏ュ簱鏁伴噺
+
+        productionScheduling1.setSuccessNum(productionScheduling1.getSuccessNum().add(productionScheduling.getSuccessNum()));
+        productionScheduling1.setStatus(2);
+        // 鍏ュ簱鏁伴噺 == 鎺掍骇鏁伴噺 鍒欎慨鏀圭敓浜ц鍗曠姸鎬�
+        if(productionScheduling1.getSuccessNum().compareTo(productionScheduling1.getSchedulingNum()) == 0){
+            productionScheduling1.setStatus(3);
+        }
+        productionSchedulingMapper.updateById(productionScheduling1);
+        return true;
+    }
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionServiceImpl.java
index 85cec6d..732c3c8 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionServiceImpl.java
@@ -11,6 +11,7 @@
 import com.ruoyi.business.service.ProductionService;
 import com.ruoyi.common.utils.bean.BeanUtils;
 import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.Objects;
@@ -27,6 +28,7 @@
 @RequiredArgsConstructor
 public class ProductionServiceImpl extends ServiceImpl<ProductionMapper, Production> implements ProductionService {
 
+    @Autowired
     private ProductionMapper productionMapper;
 
     @Override
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
index bbae14c..e5bf02c 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
@@ -127,6 +127,7 @@
         pendingInventory.setPurchaseId(purchaseRegistration.getId());
         pendingInventory.setCoalId(purchaseRegistration.getCoalId());
         pendingInventory.setInventoryQuantity(purchaseRegistration.getPurchaseQuantity());
+        pendingInventory.setType(purchaseRegistration.getType());
         return pendingInventory;
     }
 
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
index 51c1cb1..341a0f4 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
@@ -21,7 +21,8 @@
     create_by                 VARCHAR(255),                      -- 鍒涘缓浜虹敤鎴峰悕
     create_time               TIMESTAMP WITHOUT TIME ZONE,       -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
     update_by                 VARCHAR(255),                      -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
-    update_time               TIMESTAMP WITHOUT TIME ZONE        -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+    update_time               TIMESTAMP WITHOUT TIME ZONE,        -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+    type                      BIGINT,                              -- 绫诲瀷锛�1-鎴愬搧锛�2-鍘熸枡锛�
 );
 
 -- 涓鸿〃娣诲姞娉ㄩ噴
@@ -46,4 +47,5 @@
 COMMENT ON COLUMN purchase_registration.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
 COMMENT ON COLUMN purchase_registration.create_time IS '璁板綍鍒涘缓鏃堕棿';
 COMMENT ON COLUMN purchase_registration.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
-COMMENT ON COLUMN purchase_registration.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
+COMMENT ON COLUMN purchase_registration.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
+COMMENT ON COLUMN purchase_registration.type IS '绫诲瀷锛�1-鎴愬搧锛�2-鍘熸枡锛�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
index a733470..cc091ed 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604101800__create_table_production.sql
@@ -13,6 +13,8 @@
     producer_id             BIGINT,                       -- 鐢熶骇浜篿d
     producer                VARCHAR(50),                       -- 鐢熶骇浜�
     production_date         DATE,                              -- 鐢熶骇鏃ユ湡
+    type                    BIGINT,                                 -- 鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡
+    status                  BIGINT,                           -- 鐘舵�侊紙1-寰呮帓浜� 2-宸叉帓浜э級
 
     deleted                 INT            NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
     create_by               VARCHAR(255),                      -- 鍒涘缓浜虹敤鎴峰悕
@@ -35,6 +37,8 @@
 COMMENT ON COLUMN production.total_cost IS '鎬绘垚鏈�';
 COMMENT ON COLUMN production.producer IS '鐢熶骇浜�';
 COMMENT ON COLUMN production.production_date IS '鐢熶骇鏃ユ湡';
+COMMENT ON COLUMN production.type IS '鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡';
+COMMENT ON COLUMN production.status IS '鐘舵�侊紙1-寰呮帓浜� 2-宸叉帓浜э級';
 
 COMMENT ON COLUMN production.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
 COMMENT ON COLUMN production.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql
index 6a82005..62e3455 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql
@@ -18,6 +18,7 @@
     master_id                 BIGINT,                                 -- 鐢熶骇鍔犲伐id
     purchase_id               BIGINT,                                 -- 閲囪喘id
     coal_plan_id               BIGINT,                                 -- 鐓よ川鏂规id
+    type               BIGINT,                                 -- 鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡
 
     deleted                   INTEGER      DEFAULT 0,                 -- 杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�
     create_by                 VARCHAR(255),                           -- 鍒涘缓璇ヨ褰曠殑鐢ㄦ埛
@@ -37,6 +38,7 @@
 COMMENT ON COLUMN pending_inventory.price_including_tax IS '鍗曚环锛堝惈绋庯級';
 COMMENT ON COLUMN pending_inventory.total_price_including_tax IS '鎬讳环锛堝惈绋庯級';
 COMMENT ON COLUMN pending_inventory.registrant IS '鐧昏浜�';
+COMMENT ON COLUMN pending_inventory.type IS '鐓ゆ枡绫诲瀷 1-鎴愬搧 2-鍘熸枡';
 COMMENT ON COLUMN pending_inventory.registration_time IS '鐧昏鏃堕棿';
 COMMENT ON COLUMN pending_inventory.price_excluding_tax IS '鍗曚环锛堜笉鍚◣锛�';
 COMMENT ON COLUMN pending_inventory.total_price_excluding_tax IS '鎬讳环锛堜笉鍚◣锛�';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
index 5e4b100..739f7ec 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
@@ -12,7 +12,7 @@
     total_price_excluding_tax DECIMAL(10, 2) NOT NULL,           -- 涓嶅惈绋庢�讳环
     pending_replenishment     DECIMAL(10, 0),                    -- 寰呰ˉ搴�
     registrant_id             BIGINT         NOT NULL,           -- 鐧昏浜篿d
-    type                      VARCHAR(50),                       -- 绫诲瀷       1 閲囪喘/ 2 姝e紡   鍏ュ簱
+    type                      BIGINT,                            -- 鐓ゆ枡绫诲瀷       1 鎴愬搧/ 2 鍘熸枡
     pending_id                BIGINT,                            -- 寰呭叆搴搃d
     coal_plan_id               BIGINT,                                 -- 鐓よ川鏂规id
     merge_id                  VARCHAR(255),                      -- 鍚堝苟id
@@ -37,6 +37,7 @@
 COMMENT ON COLUMN official_inventory.price_including_tax IS '鍗曚环锛堝惈绋庯級';
 COMMENT ON COLUMN official_inventory.total_price_including_tax IS '鎬讳环锛堝惈绋庯級';
 COMMENT ON COLUMN official_inventory.pending_replenishment IS '寰呰ˉ搴�';
+COMMENT ON COLUMN official_inventory.type IS '鐓ゆ枡绫诲瀷       1 鎴愬搧/ 2 鍘熸枡';
 COMMENT ON COLUMN official_inventory.registrant_id IS '鐧昏浜篿d';
 COMMENT ON COLUMN official_inventory.registration_date IS '鐧昏鏃ユ湡';
 COMMENT ON COLUMN official_inventory.merge_id IS '鍚堝苟id';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250825111200__create_table_production_scheduling.sql b/main-business/src/main/resources/db/migration/postgresql/V20250825111200__create_table_production_scheduling.sql
new file mode 100644
index 0000000..70cbfd0
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250825111200__create_table_production_scheduling.sql
@@ -0,0 +1,59 @@
+-- 鍒涘缓姝e紡搴撹〃
+CREATE TABLE production_scheduling
+(
+    id BIGSERIAL PRIMARY KEY,  -- BIGSERIAL 瀵瑰簲 int8
+    production_id int8 NOT NULL DEFAULT 0,
+    coal_id                 BIGINT         NOT NULL DEFAULT 0, -- 鐓ょID
+    scheduling_num numeric(10,2),
+    type int8,
+    status int8,
+    unit varchar(50),
+    process varchar(50) NOT NULL,
+    work_hours numeric(10,2) NOT NULL,
+    scheduling_date date,
+    scheduling_user_id int8,
+    scheduling_user_name varchar(50),
+    deleted int4 NOT NULL DEFAULT 0,
+    create_by varchar(255) COLLATE "pg_catalog"."default",
+    create_time timestamp(6),
+    update_by varchar(255) COLLATE "pg_catalog"."default",
+    success_num int8 DEFAULT 0,
+    update_time timestamp(6)
+);
+
+COMMENT ON COLUMN "production_scheduling"."id" IS '涓婚敭ID';
+
+COMMENT ON COLUMN "production_scheduling"."production_id" IS '鐢熶骇鏄庣粏id';
+COMMENT ON COLUMN production_scheduling.coal_id IS '鐓ょID';
+
+COMMENT ON COLUMN "production_scheduling"."scheduling_num" IS '鎺掍骇鏁伴噺';
+
+COMMENT ON COLUMN "production_scheduling"."unit" IS '鍗曚綅';
+
+COMMENT ON COLUMN "production_scheduling"."process" IS '宸ュ簭锛堝瓧鍏革級';
+
+COMMENT ON COLUMN "production_scheduling"."work_hours" IS '宸ユ椂瀹氶';
+
+COMMENT ON COLUMN "production_scheduling"."scheduling_date" IS '鎺掍骇鏃ユ湡';
+
+COMMENT ON COLUMN "production_scheduling"."scheduling_user_id" IS '鎺掍骇浜篿d';
+
+COMMENT ON COLUMN "production_scheduling"."scheduling_user_name" IS '鎺掍骇浜哄悕绉�';
+
+
+COMMENT ON COLUMN "production_scheduling"."deleted" IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+
+COMMENT ON COLUMN "production_scheduling"."create_by" IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+
+COMMENT ON COLUMN "production_scheduling"."create_time" IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT ON COLUMN "production_scheduling"."production_scheduling"."update_by" IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+
+COMMENT ON COLUMN "production_scheduling"."production_scheduling"."update_time" IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
+
+COMMENT ON COLUMN "production_scheduling"."production_scheduling"."type" IS '鐓ゆ枡绫诲瀷锛�1-鎴愬搧 2-鍘熸枡锛�';
+
+COMMENT ON COLUMN "production_scheduling"."production_scheduling"."status" IS '鐘舵�侊紙1-寰呯敓浜� 2-鐢熶骇涓� 3-宸叉姤宸ワ級';
+COMMENT ON COLUMN "production_scheduling"."production_scheduling"."success_num" IS '鍏ュ簱鏁伴噺';
+
+
+COMMENT ON TABLE "public"."production_scheduling" IS '鐢熶骇鎶ュ伐琛�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/ProductionSchedulingMapper.xml b/main-business/src/main/resources/mapper/ProductionSchedulingMapper.xml
new file mode 100644
index 0000000..eb42eb4
--- /dev/null
+++ b/main-business/src/main/resources/mapper/ProductionSchedulingMapper.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruoyi.business.mapper.ProductionSchedulingMapper">
+
+    <select id="listPage" resultType="com.ruoyi.business.entity.ProductionScheduling">
+        select * from production_scheduling where deleted = 0
+    </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3