From 2a21bf56c3296510fa56024b6062aae8e99d2293 Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期四, 08 五月 2025 10:37:13 +0800
Subject: [PATCH] 生成钣金工单计划 基础代码

---
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequire.java                                |   12 
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsBomMapper.java                                           |    6 
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsMaterialStorageManagementMapper.java                     |    4 
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireError.java                           |   60 +++
 aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireErrorService.java                  |   61 +++
 aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml                                               |   21 +
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomStockDetailServiceImpl.java |   41 ++
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBom.java                                                 |    2 
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlatePlan.java                                           |   17 
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsStandardProcessRouteHeaderMapper.java                    |    7 
 aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml                                         |   31 +
 aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateStandardRequireErrorController.java    |  109 +++++
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsMaterialStorageManagement.java                           |   22 +
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateStandardRequireErrorMapper.java                     |   63 +++
 aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessRouteHeaderMapper.xml                        |   13 
 aps-modules/aps-core/src/main/resources/mapper/core/ApsPartPlanMapper.xml                                          |   16 
 aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomStockDetailService.java         |    7 
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java               |  275 ++++++++++++++
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomStockDetail.java                  |    9 
 aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java                                     |   12 
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBomHeader.java                                           |    2 
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomOrderDetailServiceImpl.java |   26 +
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomOrderDetail.java                  |   16 
 aps-modules/aps-core/src/main/java/com/aps/core/service/IApsBomService.java                                        |    2 
 aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomOrderDetailService.java         |    6 
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBatch.java                           |    2 
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsBomServiceImpl.java                                |   29 +
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireErrorServiceImpl.java          |   96 +++++
 aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateStandardRequireErrorMapper.xml                         |  103 +++++
 aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcessRouteLine.java                            |   10 
 aps-modules/aps-core/src/main/resources/mapper/core/ApsMaterialStorageManagementMapper.xml                         |   13 
 31 files changed, 1,051 insertions(+), 42 deletions(-)

diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateStandardRequireErrorController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateStandardRequireErrorController.java
new file mode 100644
index 0000000..1d16672
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/mainPlan/ApsPlateStandardRequireErrorController.java
@@ -0,0 +1,109 @@
+package com.aps.core.controller.mainPlan;
+
+import com.aps.common.core.utils.poi.ExcelUtil;
+import com.aps.common.core.web.controller.BaseController;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.common.log.annotation.Log;
+import com.aps.common.log.enums.BusinessType;
+import com.aps.common.security.annotation.RequiresPermissions;
+import com.aps.core.domain.ApsPlateStandardRequireError;
+import com.aps.core.service.IApsPlateStandardRequireErrorService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭疌ontroller
+ * 
+ * @author zhl
+ * @date 2025-05-08
+ */
+
+@Tag(name = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", description = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭帴鍙�")
+@RestController
+@RequestMapping("/ApsPlateStandardRequireError")
+public class ApsPlateStandardRequireErrorController extends BaseController
+{
+    @Autowired
+    private IApsPlateStandardRequireErrorService apsPlateStandardRequireErrorService;
+
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�
+     */
+
+    @Operation(summary = "鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�", description = "鍒嗛〉鏌ヨ")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:list")
+    @GetMapping("/list")
+    public TableDataInfo list(ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        startPage();
+        List<ApsPlateStandardRequireError> list = apsPlateStandardRequireErrorService.selectApsPlateStandardRequireErrorList(apsPlateStandardRequireError);
+        return getDataTable(list);
+    }
+
+    /**
+     * 瀵煎嚭閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�
+     */
+    @Operation(summary = "瀵煎嚭閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�", description = "瀵煎嚭")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:export")
+    @Log(title = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        List<ApsPlateStandardRequireError> list = apsPlateStandardRequireErrorService.selectApsPlateStandardRequireErrorList(apsPlateStandardRequireError);
+        ExcelUtil<ApsPlateStandardRequireError> util = new ExcelUtil<ApsPlateStandardRequireError>(ApsPlateStandardRequireError.class);
+        util.exportExcel(response, list, "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭暟鎹�");
+    }
+
+    /**
+     * 鑾峰彇閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭缁嗕俊鎭�
+     */
+    @Operation(summary = "鑾峰彇閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭缁嗕俊鎭�", description = "鏍规嵁id鑾峰彇")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:query")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(apsPlateStandardRequireErrorService.selectApsPlateStandardRequireErrorById(id));
+    }
+
+    /**
+     * 鏂板閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    @Operation(summary = "鏂板閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", description = "鍗曚釜鏂板")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:add")
+    @Log(title = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        return toAjax(apsPlateStandardRequireErrorService.insertApsPlateStandardRequireError(apsPlateStandardRequireError));
+    }
+
+    /**
+     * 淇敼閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    @Operation(summary = "淇敼閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", description = "鍗曚釜淇敼")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:edit")
+    @Log(title = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        return toAjax(apsPlateStandardRequireErrorService.updateApsPlateStandardRequireError(apsPlateStandardRequireError));
+    }
+
+    /**
+     * 鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    @Operation(summary = "鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", description = "鎵归噺鍒犻櫎")
+    @RequiresPermissions("ApsPlateStandardRequireError:ApsPlateStandardRequireError:remove")
+    @Log(title = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(apsPlateStandardRequireErrorService.deleteApsPlateStandardRequireErrorByIds(ids));
+    }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBom.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBom.java
index 00845b6..4e3caf4 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBom.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBom.java
@@ -3,6 +3,7 @@
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -17,6 +18,7 @@
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsBom extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBomHeader.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBomHeader.java
index 9725dac..2047632 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBomHeader.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsBomHeader.java
@@ -3,6 +3,7 @@
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -17,6 +18,7 @@
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsBomHeader extends BaseEntity
 {
     @Serial
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsMaterialStorageManagement.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsMaterialStorageManagement.java
index 7e247ae..62e5dfd 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsMaterialStorageManagement.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsMaterialStorageManagement.java
@@ -42,6 +42,13 @@
     @Excel(name = "鍒锋柊鏃ユ湡")
     private String refreshDate;
 
+    /**鍓╀綑搴撳瓨*/
+    private BigDecimal remainderStock;
+
+
+    /**淇敼鐗堟湰*/
+    private Integer version;
+
     public void setId(String id) 
     {
         this.id = id;
@@ -102,6 +109,21 @@
         return refreshDate;
     }
 
+    public BigDecimal getRemainderStock() {
+        return remainderStock;
+    }
+
+    public void setRemainderStock(BigDecimal remainderStock) {
+        this.remainderStock = remainderStock;
+    }
+
+    public Integer getVersion() {
+        return version;
+    }
+
+    public void setVersion(Integer version) {
+        this.version = version;
+    }
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlatePlan.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlatePlan.java
index 7847c91..e032aa6 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlatePlan.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlatePlan.java
@@ -3,9 +3,12 @@
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.io.Serial;
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -13,10 +16,13 @@
  * 閽i噾璁″垝绠$悊瀵硅薄 aps_plate_plan
  * 
  * @author ruoyi
- * @date 2025-04-08
+ * &#064;date  2025-04-08
  */
+@EqualsAndHashCode(callSuper = true)
+@Data
 public class ApsPlatePlan extends BaseEntity
 {
+    @Serial
     private static final long serialVersionUID = 1L;
 
     /** 涓婚敭id */
@@ -180,7 +186,14 @@
 
     /** 鏈尮閰嶇殑鐢熶骇鏁伴噺*/
     private BigDecimal unmatchedQuantity;
+    /** 涓撲笟褰掑睘*/
+    private String professionalAffiliation;
 
+    /** 闇�姹傝拷婧疘D*/
+    private String requireId;
+
+    private Integer version;
+/*
     public String getOpStatus() {
         return opStatus;
     }
@@ -605,5 +618,5 @@
 
     public void setPlant(String plant) {
         this.plant = plant;
-    }
+    }*/
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequire.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequire.java
index 71e5891..b7f7d39 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequire.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequire.java
@@ -6,6 +6,8 @@
 import lombok.EqualsAndHashCode;
 
 import java.io.Serial;
+import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * 閽i噾宸ュ崟鏍囧噯闇�姹傚璞� aps_plate_standard_require
@@ -41,7 +43,7 @@
 
     /** BOM鐢ㄩ噺 */
     @Excel(name = "BOM鐢ㄩ噺")
-    private String bomUseAmount;
+    private BigDecimal bomUseAmount;
 
     /** 宸ヨ壓璺嚎ID */
     @Excel(name = "宸ヨ壓璺嚎ID")
@@ -57,19 +59,19 @@
 
     /** 鍑�闇�姹傞噺 */
     @Excel(name = "鍑�闇�姹傞噺")
-    private String netRequirement;
+    private BigDecimal netRequirement;
 
     /** 璁″垝寮�宸ユ棩 */
     @Excel(name = "璁″垝寮�宸ユ棩")
-    private String startDate;
+    private Date startDate;
 
     /** 璁″垝瀹屽伐鏃� */
     @Excel(name = "璁″垝瀹屽伐鏃�")
-    private String completeDate;
+    private Date completeDate;
 
     /** 闇�姹傛棩鏈� */
     @Excel(name = "闇�姹傛棩鏈�")
-    private String demandDate;
+    private Date demandDate;
 
     /** 閫傜敤宸ュ巶 */
     @Excel(name = "閫傜敤宸ュ巶")
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBatch.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBatch.java
index d617f97..0074085 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBatch.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBatch.java
@@ -1,6 +1,7 @@
 package com.aps.core.domain;
 
 import com.aps.common.core.web.domain.BaseEntity;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -14,6 +15,7 @@
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsPlateStandardRequireBatch extends BaseEntity
 {
     @Serial
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomOrderDetail.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomOrderDetail.java
index 1a47782..6bbf5c7 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomOrderDetail.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomOrderDetail.java
@@ -2,10 +2,12 @@
 
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serial;
+import java.math.BigDecimal;
 
 /**
  * ApsPlateStandardRequireBomOrderDetail瀵硅薄 aps_plate_standard_require_bom_order_detail
@@ -15,6 +17,7 @@
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsPlateStandardRequireBomOrderDetail extends BaseEntity
 {
     @Serial
@@ -25,38 +28,31 @@
 
     /** 闇�姹傝拷婧疘D */
     @Excel(name = "闇�姹傝拷婧疘D")
-
     private String requireId;
 
     /** bom_line_id */
     @Excel(name = "bom_line_id")
-
     private String bomLineId;
 
     /** 鏂欏彿 */
     @Excel(name = "鏂欏彿")
-
     private String bomLineCode;
 
     /** 璁㈠崟鍙� */
     @Excel(name = "璁㈠崟鍙�")
-
     private String docNo;
 
     /** 鎵e噺鍓嶆暟閲� */
     @Excel(name = "鎵e噺鍓嶆暟閲�")
-
-    private String beforeProdAmount;
+    private BigDecimal beforeProdAmount;
 
     /** 鍖归厤鏁伴噺 */
     @Excel(name = "鍖归厤鏁伴噺")
-
-    private String deductionAmount;
+    private BigDecimal deductionAmount;
 
     /** 鎵e噺鍚庢暟閲� */
     @Excel(name = "鎵e噺鍚庢暟閲�")
-
-    private String afterProdAmount;
+    private BigDecimal afterProdAmount;
 
 
     private String orgCode;
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomStockDetail.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomStockDetail.java
index 6f4ea1a..25fc2b1 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomStockDetail.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireBomStockDetail.java
@@ -2,10 +2,12 @@
 
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serial;
+import java.math.BigDecimal;
 
 /**
  * ApsPlateStandardRequireBomStockDetail瀵硅薄 aps_plate_standard_require_bom_stock_detail
@@ -15,6 +17,7 @@
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsPlateStandardRequireBomStockDetail extends BaseEntity
 {
     @Serial
@@ -38,15 +41,15 @@
 
     /** 鎵e噺鍓嶅簱瀛橀噺 */
     @Excel(name = "鎵e噺鍓嶅簱瀛橀噺")
-    private String beforeStockAmount;
+    private BigDecimal beforeStockAmount;
 
     /** 鎵e噺搴撳瓨閲� */
     @Excel(name = "鎵e噺搴撳瓨閲�")
-    private String deductionAmount;
+    private BigDecimal deductionAmount;
 
     /** 鎵e噺鍚庡簱瀛橀噺 */
     @Excel(name = "鎵e噺鍚庡簱瀛橀噺")
-    private String afterStockAmount;
+    private BigDecimal afterStockAmount;
 
     private String orgCode;
     private String batchNumber;
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireError.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireError.java
new file mode 100644
index 0000000..e83f199
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsPlateStandardRequireError.java
@@ -0,0 +1,60 @@
+package com.aps.core.domain;
+
+import com.aps.common.core.annotation.Excel;
+import com.aps.common.core.web.domain.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.io.Serial;
+
+/**
+ * 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭璞� aps_plate_standard_require_error
+ * 
+ * @author zhl
+ * @date 2025-05-08
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Schema(description = "閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭疄浣撶被")
+public class ApsPlateStandardRequireError extends BaseEntity
+{
+    @Serial
+    private static final long serialVersionUID = 1L;
+    private Long id;
+
+    /** 鎵规鍙� */
+    @Excel(name = "鎵规鍙�")
+    @Schema(description = "鎵规鍙�")
+    private String batchNumber;
+
+    /** 闇�姹侷d鍙� */
+    @Excel(name = "闇�姹侷d鍙�")
+    @Schema(description = "闇�姹侷d鍙�")
+    private String requireId;
+
+    /** 宸ュ崟鍙� */
+    @Excel(name = "宸ュ崟鍙�")
+    @Schema(description = "宸ュ崟鍙�")
+    private String docNum;
+
+    /** 鏂欏彿 */
+    @Excel(name = "鏂欏彿")
+    @Schema(description = "鏂欏彿")
+    private String itemNum;
+
+    /** 閫傜敤宸ュ巶 */
+    @Excel(name = "閫傜敤宸ュ巶")
+    @Schema(description = "閫傜敤宸ュ巶")
+    private String orgCode;
+
+    /** 寮傚父淇℃伅 */
+    @Excel(name = "寮傚父淇℃伅")
+    @Schema(description = "寮傚父淇℃伅")
+    private String message;
+
+    /** 鏄惁鍒犻櫎锛�0鏈夋晥 1鍒犻櫎 */
+    @Schema(description = "鏄惁鍒犻櫎锛�0鏈夋晥 1鍒犻櫎")
+    private String delFlag;
+
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcessRouteLine.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcessRouteLine.java
index adefdee..c147e2c 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcessRouteLine.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsStandardProcessRouteLine.java
@@ -2,10 +2,12 @@
 
 import com.aps.common.core.annotation.Excel;
 import com.aps.common.core.web.domain.BaseEntity;
+import lombok.Builder;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
 import java.io.Serial;
+import java.math.BigDecimal;
 
 /**
  * 鏍囧噯宸ヨ壓璺嚎Line瀵硅薄 aps_standard_process_route_line
@@ -16,23 +18,20 @@
 
 @EqualsAndHashCode(callSuper = true)
 @Data
+@Builder
 public class ApsStandardProcessRouteLine extends BaseEntity
 {
     @Serial
     private static final long serialVersionUID = 1L;
 
-    /** $column.columnComment */
-
     private Long id;
 
     /** 宸ヨ壓璺嚎ID */
     @Excel(name = "宸ヨ壓璺嚎ID")
-
     private String routeId;
 
     /** 宸ュ簭搴忓彿 */
     @Excel(name = "宸ュ簭搴忓彿")
-
     private String routeNum;
 
     /** 宸ュ簭鍚嶇О */
@@ -61,9 +60,10 @@
 
     /** 璁捐浜ц兘 */
     @Excel(name = "璁捐浜ц兘")
-    private String designCapacity;
+    private BigDecimal designCapacity;
 
     /** 鏄惁鍒犻櫎锛�0鏈夋晥 1鍒犻櫎 */
     private Long delFlag;
 
+    private BigDecimal routeTime;
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsBomMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsBomMapper.java
index 3769713..cb0dfd8 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsBomMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsBomMapper.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 import com.aps.core.domain.ApsBom;
+import jakarta.annotation.Resource;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -13,6 +14,7 @@
 @Mapper
 public interface ApsBomMapper 
 {
+
     /**
      * 鏌ヨBOM鏁版嵁绠$悊
      * 
@@ -60,4 +62,8 @@
      * @return 缁撴灉
      */
     public int deleteApsBomByIds(Long[] ids);
+    /**
+     * 閫氳繃宸ュ巶鍜孊OMHeaderId鏌ヨBOMLine鏁版嵁
+     * */
+    List< ApsBom> selectApsBomLineList(String orgCode,String bomHeaderId);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsMaterialStorageManagementMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsMaterialStorageManagementMapper.java
index befee88..dcfe594 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsMaterialStorageManagementMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsMaterialStorageManagementMapper.java
@@ -1,5 +1,6 @@
 package com.aps.core.mapper;
 
+import java.math.BigDecimal;
 import java.util.List;
 import com.aps.core.domain.ApsMaterialStorageManagement;
 import org.apache.ibatis.annotations.Mapper;
@@ -60,4 +61,7 @@
      * @return 缁撴灉
      */
     public int deleteApsMaterialStorageManagementByIds(String[] ids);
+
+
+   int updateMaterialStorageByVersion(BigDecimal remainderStock, Integer version);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
index a79024b..5f1df59 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlatePlanMapper.java
@@ -64,4 +64,16 @@
     public int insertPlatePlanFromTempByBatchNumber(String batchNumber);
 
     int removeAllPlatePlans();
+
+    List<ApsPlatePlan> selectPlatePlanByPlantMajor(String plant,String professionalAffiliation);
+
+    /**
+     * 鑾峰彇鏈尮閰嶇殑瀛愯鍒�
+     * */
+    ApsPlatePlan selectUnMatchPlateSubPlan(String plant);
+
+    /**
+     * 鏇存柊瀛愯鍒掓湭鍖归厤鏁伴噺
+     * */
+    int updatePlanUnMatchQtyByVersion(ApsPlatePlan plan);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateStandardRequireErrorMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateStandardRequireErrorMapper.java
new file mode 100644
index 0000000..12f5b30
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsPlateStandardRequireErrorMapper.java
@@ -0,0 +1,63 @@
+package com.aps.core.mapper;
+
+import java.util.List;
+import com.aps.core.domain.ApsPlateStandardRequireError;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭疢apper鎺ュ彛
+ * 
+ * @author zhl
+ * @date 2025-05-08
+ */
+@Mapper
+public interface ApsPlateStandardRequireErrorMapper 
+{
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    public ApsPlateStandardRequireError selectApsPlateStandardRequireErrorById(Long id);
+
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭泦鍚�
+     */
+    public List<ApsPlateStandardRequireError> selectApsPlateStandardRequireErrorList(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 鏂板閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    public int insertApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 淇敼閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    public int updateApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 缁撴灉
+     */
+    public int deleteApsPlateStandardRequireErrorById(Long id);
+
+    /**
+     * 鎵归噺鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteApsPlateStandardRequireErrorByIds(Long[] ids);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsStandardProcessRouteHeaderMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsStandardProcessRouteHeaderMapper.java
index 9c88f6c..2d3a6ed 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsStandardProcessRouteHeaderMapper.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsStandardProcessRouteHeaderMapper.java
@@ -8,7 +8,7 @@
  * 鏍囧噯宸ヨ壓璺嚎HeaderMapper鎺ュ彛
  * 
  * @author zhl
- * @date 2025-05-06
+ * &#064;date  2025-05-06
  */
 @Mapper
 public interface ApsStandardProcessRouteHeaderMapper 
@@ -60,4 +60,9 @@
      * @return 缁撴灉
      */
     public int deleteApsStandardProcessRouteHeaderByIds(Long[] ids);
+
+    /**
+     * 鏍规嵁宸ュ巶銆佺墿鏂欏彿鏌ヨ宸ヨ壓璺嚎
+     * */
+    List<ApsStandardProcessRouteHeader>   queryStandardProcessRouteHeaderByPlantAndItemCode(String orgCode, String itemCode);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsBomService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsBomService.java
index f3184f7..c737269 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsBomService.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsBomService.java
@@ -58,4 +58,6 @@
      * @return 缁撴灉
      */
     public int deleteApsBomById(Long id);
+
+    List<ApsBom> selectApsBomLineList(String plant, String itemNumber);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomOrderDetailService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomOrderDetailService.java
index a11066a..6bee8d5 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomOrderDetailService.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomOrderDetailService.java
@@ -1,6 +1,10 @@
 package com.aps.core.service;
 
+import java.math.BigDecimal;
 import java.util.List;
+
+import com.aps.core.domain.ApsPlatePlan;
+import com.aps.core.domain.ApsPlateStandardRequire;
 import com.aps.core.domain.ApsPlateStandardRequireBomOrderDetail;
 
 /**
@@ -58,4 +62,6 @@
      * @return 缁撴灉
      */
     public int deleteApsPlateStandardRequireBomOrderDetailById(Long id);
+
+    void savePlastPlanAndBomOrderDetail(ApsPlateStandardRequire require, ApsPlatePlan platePlan, BigDecimal subtract, BigDecimal stock, BigDecimal netRequirement);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomStockDetailService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomStockDetailService.java
index 78309f8..9a187ed 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomStockDetailService.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireBomStockDetailService.java
@@ -1,6 +1,11 @@
 package com.aps.core.service;
 
+import java.math.BigDecimal;
 import java.util.List;
+
+import com.aps.core.domain.ApsBom;
+import com.aps.core.domain.ApsMaterialStorageManagement;
+import com.aps.core.domain.ApsPlatePlan;
 import com.aps.core.domain.ApsPlateStandardRequireBomStockDetail;
 
 /**
@@ -58,4 +63,6 @@
      * @return 缁撴灉
      */
     public int deleteApsPlateStandardRequireBomStockDetailById(Long id);
+
+    void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount);
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireErrorService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireErrorService.java
new file mode 100644
index 0000000..7919832
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsPlateStandardRequireErrorService.java
@@ -0,0 +1,61 @@
+package com.aps.core.service;
+
+import java.util.List;
+import com.aps.core.domain.ApsPlateStandardRequireError;
+
+/**
+ * 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭疭ervice鎺ュ彛
+ * 
+ * @author zhl
+ * @date 2025-05-08
+ */
+public interface IApsPlateStandardRequireErrorService 
+{
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    public ApsPlateStandardRequireError selectApsPlateStandardRequireErrorById(Long id);
+
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭泦鍚�
+     */
+    public List<ApsPlateStandardRequireError> selectApsPlateStandardRequireErrorList(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 鏂板閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    public int insertApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 淇敼閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    public int updateApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError);
+
+    /**
+     * 鎵归噺鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿泦鍚�
+     * @return 缁撴灉
+     */
+    public int deleteApsPlateStandardRequireErrorByIds(Long[] ids);
+
+    /**
+     * 鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 缁撴灉
+     */
+    public int deleteApsPlateStandardRequireErrorById(Long id);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsBomServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsBomServiceImpl.java
index 6036b4f..0acb385 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsBomServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsBomServiceImpl.java
@@ -1,11 +1,11 @@
 package com.aps.core.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import com.aps.common.core.utils.DateUtils;
+import com.aps.core.domain.ApsBomHeader;
+import com.aps.core.mapper.ApsBomHeaderMapper;
+import jakarta.annotation.Resource;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.aps.core.mapper.ApsBomMapper;
@@ -24,6 +24,8 @@
     @Autowired
     private ApsBomMapper apsBomMapper;
 
+    @Resource
+    private ApsBomHeaderMapper bomHeaderMapper;
     /**
      * 鏌ヨBOM鏁版嵁绠$悊
      * 
@@ -97,10 +99,21 @@
     @Override
     public List<ApsBom> selectApsBomList(ApsBom apsBom)
     {
-
         return apsBomMapper.selectApsBomList(apsBom);
-
     }
-
-
+    /**
+     * 閫氳繃鏂欏彿銆佸伐鍘傛煡璇OMLine鏁版嵁鍒楄〃
+     * */
+    @Override
+    public List<ApsBom> selectApsBomLineList(String plant, String itemNumber)
+    {
+        List<ApsBom> bomLineList =new ArrayList<>();
+        ApsBomHeader headerParam = ApsBomHeader.builder().itemCode(itemNumber).orgCode(plant).build();
+        Optional<ApsBomHeader> first = bomHeaderMapper.selectApsBomHeaderList(headerParam).stream().findFirst();
+        if (first.isPresent()){
+            ApsBomHeader apsBomHeader = first.get();
+            bomLineList = apsBomMapper.selectApsBomLineList(plant, apsBomHeader.getBomHeaderId());
+        }
+        return bomLineList;
+    }
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomOrderDetailServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomOrderDetailServiceImpl.java
index 1dc3338..29b53d1 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomOrderDetailServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomOrderDetailServiceImpl.java
@@ -1,7 +1,13 @@
 package com.aps.core.service.impl;
 
+import java.math.BigDecimal;
 import java.util.List;
+
+import cn.hutool.core.util.IdUtil;
 import com.aps.common.core.utils.DateUtils;
+import com.aps.core.domain.ApsPlatePlan;
+import com.aps.core.domain.ApsPlateStandardRequire;
+import com.aps.core.mapper.ApsPlatePlanMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.aps.core.mapper.ApsPlateStandardRequireBomOrderDetailMapper;
@@ -19,7 +25,8 @@
 {
     @Autowired
     private ApsPlateStandardRequireBomOrderDetailMapper apsPlateStandardRequireBomOrderDetailMapper;
-
+    @Autowired
+    private ApsPlatePlanMapper apsPlatePlanMapper;
     /**
      * 鏌ヨApsPlateStandardRequireBomOrderDetail
      * 
@@ -93,4 +100,21 @@
     {
         return apsPlateStandardRequireBomOrderDetailMapper.deleteApsPlateStandardRequireBomOrderDetailById(id);
     }
+
+    @Override
+    public void savePlastPlanAndBomOrderDetail(ApsPlateStandardRequire require, ApsPlatePlan platePlan, BigDecimal subtract, BigDecimal stock, BigDecimal netRequirement) {
+        platePlan.setUnmatchedQuantity(subtract);
+        apsPlatePlanMapper.updatePlanUnMatchQtyByVersion(platePlan);
+        /* 璁板綍宸ュ崟涓庡噣闇�姹傜殑鍖归厤鍏崇郴*/
+        ApsPlateStandardRequireBomOrderDetail bomOrderDetail = ApsPlateStandardRequireBomOrderDetail.builder()
+                .id(IdUtil.getSnowflakeNextId())
+                .requireId(require.getRequireId())
+                .bomLineId(require.getBomLineId())
+                .bomLineCode(require.getBomLineCode())
+                .docNo(platePlan.getDocumentNumber())
+                .beforeProdAmount(stock)
+                .deductionAmount(netRequirement)
+                .afterProdAmount(subtract).build();
+        apsPlateStandardRequireBomOrderDetailMapper.insertApsPlateStandardRequireBomOrderDetail(bomOrderDetail);
+    }
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomStockDetailServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomStockDetailServiceImpl.java
index d7a13f5..33b8409 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomStockDetailServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireBomStockDetailServiceImpl.java
@@ -1,11 +1,17 @@
 package com.aps.core.service.impl;
 
+import java.math.BigDecimal;
 import java.util.List;
+
+import cn.hutool.core.util.IdUtil;
 import com.aps.common.core.utils.DateUtils;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.domain.*;
+import com.aps.core.mapper.ApsMaterialStorageManagementMapper;
+import jakarta.annotation.Resource;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.aps.core.mapper.ApsPlateStandardRequireBomStockDetailMapper;
-import com.aps.core.domain.ApsPlateStandardRequireBomStockDetail;
 import com.aps.core.service.IApsPlateStandardRequireBomStockDetailService;
 
 /**
@@ -19,7 +25,11 @@
 {
     @Autowired
     private ApsPlateStandardRequireBomStockDetailMapper apsPlateStandardRequireBomStockDetailMapper;
+    @Resource
+    ApsMaterialStorageManagementMapper itemStorageMapper;
 
+    @Resource
+    ApsPlateStandardRequireBomStockDetailMapper plateBomStockDetailMapper;
     /**
      * 鏌ヨApsPlateStandardRequireBomStockDetail
      * 
@@ -93,4 +103,33 @@
     {
         return apsPlateStandardRequireBomStockDetailMapper.deleteApsPlateStandardRequireBomStockDetailById(id);
     }
+
+
+    /**
+     * 璁$畻鐗╂枡鍓╀綑搴撳瓨 骞朵繚瀛樼墿鏂欏墿浣欏簱瀛樻槑缁嗐��
+     * */
+    @Override
+    public void saveStorageAndDetail(ApsMaterialStorageManagement itemStorage, ApsPlatePlan plan, ApsBom bomLine, String batchNum, BigDecimal deductionAmount, BigDecimal afterStockAmount){
+        /*鏇存柊鐗╂枡鍓╀綑搴撳瓨*/
+        itemStorageMapper.updateMaterialStorageByVersion(afterStockAmount,itemStorage.getVersion());
+        /*璁板綍鎵e噺鏄庣粏*/
+        ApsPlateStandardRequireBomStockDetail bomStockDetail = ApsPlateStandardRequireBomStockDetail.builder()
+                .id(IdUtil.getSnowflakeNextId())
+                .requireId(plan.getRequireId())
+                .bomLineId(bomLine.getBomLineId())
+                .bomLineCode(bomLine.getItemCode())
+                .beforeStockAmount(itemStorage.getRemainderStock())
+                .deductionAmount(deductionAmount)
+                .afterStockAmount(afterStockAmount)
+                .batchNumber(batchNum)
+                .orgCode(itemStorage.getApplicableFactories())
+                .delFlag("0")
+                .build();
+        bomStockDetail.setCreateBy(SecurityUtils.getUsername());
+        bomStockDetail.setCreateTime(DateUtils.getNowDate());
+
+        plateBomStockDetailMapper.insertApsPlateStandardRequireBomStockDetail(bomStockDetail);
+
+    }
+
 }
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireErrorServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireErrorServiceImpl.java
new file mode 100644
index 0000000..930cfe5
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireErrorServiceImpl.java
@@ -0,0 +1,96 @@
+package com.aps.core.service.impl;
+
+import java.util.List;
+import com.aps.common.core.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.aps.core.mapper.ApsPlateStandardRequireErrorMapper;
+import com.aps.core.domain.ApsPlateStandardRequireError;
+import com.aps.core.service.IApsPlateStandardRequireErrorService;
+
+/**
+ * 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭疭ervice涓氬姟灞傚鐞�
+ * 
+ * @author zhl
+ * @date 2025-05-08
+ */
+@Service
+public class ApsPlateStandardRequireErrorServiceImpl implements IApsPlateStandardRequireErrorService 
+{
+    @Autowired
+    private ApsPlateStandardRequireErrorMapper apsPlateStandardRequireErrorMapper;
+
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    @Override
+    public ApsPlateStandardRequireError selectApsPlateStandardRequireErrorById(Long id)
+    {
+        return apsPlateStandardRequireErrorMapper.selectApsPlateStandardRequireErrorById(id);
+    }
+
+    /**
+     * 鏌ヨ閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭垪琛�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     */
+    @Override
+    public List<ApsPlateStandardRequireError> selectApsPlateStandardRequireErrorList(ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        return apsPlateStandardRequireErrorMapper.selectApsPlateStandardRequireErrorList(apsPlateStandardRequireError);
+    }
+
+    /**
+     * 鏂板閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        apsPlateStandardRequireError.setCreateTime(DateUtils.getNowDate());
+        return apsPlateStandardRequireErrorMapper.insertApsPlateStandardRequireError(apsPlateStandardRequireError);
+    }
+
+    /**
+     * 淇敼閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param apsPlateStandardRequireError 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateApsPlateStandardRequireError(ApsPlateStandardRequireError apsPlateStandardRequireError)
+    {
+        apsPlateStandardRequireError.setUpdateTime(DateUtils.getNowDate());
+        return apsPlateStandardRequireErrorMapper.updateApsPlateStandardRequireError(apsPlateStandardRequireError);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭�
+     * 
+     * @param ids 闇�瑕佸垹闄ょ殑閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteApsPlateStandardRequireErrorByIds(Long[] ids)
+    {
+        return apsPlateStandardRequireErrorMapper.deleteApsPlateStandardRequireErrorByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭俊鎭�
+     * 
+     * @param id 閽i噾鏍囧噯闇�姹傚紓甯镐俊鎭富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteApsPlateStandardRequireErrorById(Long id)
+    {
+        return apsPlateStandardRequireErrorMapper.deleteApsPlateStandardRequireErrorById(id);
+    }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java
index b6da4b1..3f889a0 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlateStandardRequireServiceImpl.java
@@ -1,11 +1,24 @@
 package com.aps.core.service.impl;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Optional;
+
+import cn.hutool.core.util.IdUtil;
 import com.aps.common.core.utils.DateUtils;
+import com.aps.common.security.utils.DictUtils;
+import com.aps.common.security.utils.SecurityUtils;
+import com.aps.core.domain.*;
+import com.aps.core.mapper.*;
+import com.aps.core.service.IApsBomService;
+import com.aps.core.service.IApsPlateStandardRequireBomOrderDetailService;
+import com.aps.core.service.IApsPlateStandardRequireBomStockDetailService;
+import com.aps.system.api.domain.SysDictData;
+import jakarta.annotation.Resource;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.aps.core.mapper.ApsPlateStandardRequireMapper;
-import com.aps.core.domain.ApsPlateStandardRequire;
 import com.aps.core.service.IApsPlateStandardRequireService;
 
 /**
@@ -19,6 +32,41 @@
 {
     @Autowired
     private ApsPlateStandardRequireMapper apsPlateStandardRequireMapper;
+
+    @Resource
+    private ApsPlateStandardRequireBatchMapper requireBatchMapper;
+
+    @Resource
+    ApsPlatePlanMapper platePlanMapper;
+
+    @Resource
+    ApsBomHeaderMapper bomHeaderMapper;
+    @Resource
+    IApsBomService bomLineService;
+
+    @Resource
+    ApsMaterialStorageManagementMapper itemStorageMapper;
+
+    @Resource
+    ApsPlateStandardRequireBomStockDetailMapper plateBomStockDetailMapper;
+
+    @Resource
+    IApsPlateStandardRequireBomStockDetailService bomStockDetailService;
+    @Resource
+    ApsStandardProcessRouteHeaderMapper standardProcessRouteHeaderMapper;
+
+    @Resource
+    ApsStandardProcessRouteLineMapper ApsStandardProcessRouteLineMapper;
+
+    @Resource
+    ApsPlateStandardRequireBomOrderDetailMapper plateBomOrderDetailMapper;
+
+    @Autowired
+    private ApsPlatePlanMapper apsPlatePlanMapper;
+
+    @Resource
+    IApsPlateStandardRequireBomOrderDetailService bomOrderDetailService;
+
 
     /**
      * 鏌ヨ閽i噾宸ュ崟鏍囧噯闇�姹�
@@ -93,4 +141,227 @@
     {
         return apsPlateStandardRequireMapper.deleteApsPlateStandardRequireById(id);
     }
+
+    private void generatorPlan(){
+
+        /*瀹氫箟宸ュ巶涓哄崡閫� */
+        String plantCode="FORTUNA";
+        /*瀹氫箟涓诲崟绫诲瀷涓洪挘閲戜富鍗�*/
+        String mainOrderType = "閽i噾涓讳欢";
+        /*瀹氫箟瀛愬崟绫诲瀷涓洪挘閲戝瓙鍗�*/
+        String subOrderType = "閽i噾瀛愪欢";
+        /*鐢熸垚鏂版壒娆″彿*/
+        String batchNum=getBatch();
+        /*鑾峰彇閽i噾涓诲崟淇℃伅*/
+        List<ApsPlatePlan> mainPlans = platePlanMapper.selectPlatePlanByPlantMajor(plantCode,mainOrderType);
+        List<ApsPlateStandardRequire> requiresList=new ArrayList<>();
+        for (ApsPlatePlan mainPlan : mainPlans) {
+            String itemNumber = mainPlan.getItemNumber();
+            /*鏍规嵁鏂欏彿 鑾峰彇BOM Header */
+        }
+
+
+
+    }
+    private void getBomRequires(String plant, ApsBom bomLine, String batchNum, Date upLevelStartDate, ApsPlatePlan plan, List<ApsPlateStandardRequire> allRequires, Long level){
+
+        String itemNumber = bomLine.getItemCode();
+        String productivityModel_combined_batch="鍚堟壒";
+        String productivityModel_monopolize="鐙崰";
+        Optional<ApsStandardProcessRouteHeader> firstProcessRoute = standardProcessRouteHeaderMapper.queryStandardProcessRouteHeaderByPlantAndItemCode(plant, itemNumber).stream().findFirst();
+        if (firstProcessRoute.isPresent()) {
+            /*鑾峰彇宸ヨ壓璺嚎Header淇℃伅*/
+            ApsStandardProcessRouteHeader routeHeader = firstProcessRoute.get();
+            /*鏋勫缓闇�姹備俊鎭�*/
+            ApsPlateStandardRequire require = new ApsPlateStandardRequire();
+            require.setId(IdUtil.getSnowflakeNextId());
+            require.setRequireId(plan.getId());
+            require.setBatchNumber(batchNum);
+            require.setOrgCode(plant);
+            require.setBomLineCode(itemNumber);
+            require.setBomLineLevel(level);
+            require.setBomUseAmount(bomLine.getNum());
+            require.setCreateTime(DateUtils.getNowDate());
+            require.setCreateBy(SecurityUtils.getUsername());
+            /*璁$畻闇�姹傛暟閲�*/
+            if (level == 0) {
+                require.setBomUseAmount(BigDecimal.ONE);
+                require.setCompleteDate(plan.getPlanEndDay());
+                require.setDemandDate(plan.getPlanEndDay());
+            } else {
+                require.setBomUseAmount(bomLine.getNum().multiply(plan.getProductionQuantity()));
+            }
+            /*鏌ユ壘搴撳瓨锛岃绠楀噣闇�姹傦紝淇濆瓨鍓╀綑搴撳瓨锛屼繚瀛樺簱瀛樻墸鍑忔槑缁�*/
+            BigDecimal remainderStock = BigDecimal.ZERO;
+            Optional<ApsMaterialStorageManagement> itemStorage = getItemStorage(plant, itemNumber);
+            if (itemStorage.isPresent()) {
+                ApsMaterialStorageManagement storage = itemStorage.get();
+                /*鍓╀綑搴撳瓨*/
+                remainderStock = storage.getRemainderStock();
+                /*璁$畻鍑�闇�姹� 榛樿=闇�姹傛暟閲�*/
+                if (remainderStock.compareTo(BigDecimal.ZERO) == 0) {
+                    require.setNetRequirement(require.getBomUseAmount());
+                }
+                if (remainderStock.compareTo(BigDecimal.ZERO) > 0) {
+                    BigDecimal subtract = require.getBomUseAmount().subtract(remainderStock);
+                    BigDecimal deductionAmount = BigDecimal.ZERO;
+                    BigDecimal afterStockAmount = BigDecimal.ZERO;
+                    if (subtract.compareTo(BigDecimal.ZERO) >= 0) {
+                        deductionAmount = remainderStock;
+                        afterStockAmount = BigDecimal.ZERO;
+                        require.setNetRequirement(subtract);
+                    } else {
+                        deductionAmount = require.getBomUseAmount();
+                        afterStockAmount = remainderStock.subtract(deductionAmount);
+                        require.setNetRequirement(BigDecimal.ZERO);
+                    }
+                    bomStockDetailService.saveStorageAndDetail(storage, plan, bomLine, batchNum, deductionAmount, afterStockAmount);
+                }
+            }
+            /*鍑�闇�姹�*/
+            BigDecimal netRequirement = require.getNetRequirement();
+            /*宸ヨ壓璺嚎鎬婚渶姹�*/
+            BigDecimal totalRouteTime =  getRouteLineTotalTime(routeHeader, productivityModel_monopolize, netRequirement);
+            long millisecond = 60*60*1000L;
+            long totalRouteMillisecond = totalRouteTime.multiply(BigDecimal.valueOf(millisecond)).longValue();
+            /*瀹屾垚鏃堕棿锛宭evel=0 鏃堕粯璁や负宸ュ崟鐨勮鍒掑畬鎴愭棩鏈�*/
+            Date completeDate= plan.getPlanEndDay();
+            /*棰勭暀澶╂暟*/
+            Long reservedDay =  getReservedDays();
+            if(level>0){
+                /* 褰撳墠闇�姹傚畬鎴愭棩鏈熶负涓婇樁灞傞渶姹傜殑寮�濮嬫椂闂� - 棰勭暀澶╂暟(杞崲涓烘绉�)*/
+                long reservedMillisecond = reservedDay *24* millisecond;
+                completeDate.setTime(upLevelStartDate.getTime()-reservedMillisecond);
+            }
+            /*璁剧疆瀹屾垚鏃ユ湡*/
+            require.setCompleteDate(completeDate);
+            require.setDemandDate(require.getCompleteDate());
+            /*璁剧疆寮�濮嬫椂闂�*/
+            Date startDay = new Date();
+            startDay.setTime(completeDate.getTime() - totalRouteMillisecond);
+            require.setStartDate(startDay);
+            require.setMatchState("宸插尮閰�");
+            require.setMatchMode("搴撳瓨鍖归厤");
+            if(require.getNetRequirement().compareTo(BigDecimal.ZERO)>0){
+                require.setMatchState("寰呭尮閰�");
+                require.setMatchMode("宸ュ崟鍖归厤");
+            }
+            require.setHasDelayRisk("鏃犻闄�");
+
+            allRequires.add(require);
+            /*褰撳墠Bom鑺傜偣澶勭悊瀹屾垚鍚庯紝澶勭悊涓嬬骇BOM*/
+            List<ApsBom> bomLineList = bomLineService.selectApsBomLineList(plant, itemNumber);
+            if(!bomLineList.isEmpty()){
+                bomLineList.forEach(line -> {
+                    getBomRequires(plant, line, batchNum, require.getStartDate(), plan, allRequires, level+1);
+                });
+            }
+
+        } else {
+            throw new RuntimeException("鏈壘鍒版爣鍑嗗伐鑹鸿矾绾�");
+        }
+    }
+
+    private BigDecimal getRouteLineTotalTime(ApsStandardProcessRouteHeader routeHeader, String productivityModel_monopolize, BigDecimal netRequirement) {
+        ApsStandardProcessRouteLine routeLineParam = ApsStandardProcessRouteLine.builder()
+                .routeId(routeHeader.getRouteId())
+                .build();
+        List<ApsStandardProcessRouteLine> apsStandardProcessRouteLines = ApsStandardProcessRouteLineMapper.selectApsStandardProcessRouteLineList(routeLineParam);
+        /*宸ヨ壓璺嚎Line 鎬诲伐鏃�*/
+        BigDecimal totalRouteTime = BigDecimal.ZERO;
+        apsStandardProcessRouteLines.forEach(line -> {
+            line.setRouteTime(line.getDesignCapacity());
+            if (line.getProductivityModel().equals(productivityModel_monopolize)) {
+                line.setRouteTime(line.getDesignCapacity().multiply(netRequirement));
+            }
+            totalRouteTime.add(line.getRouteTime());
+        });
+        return totalRouteTime;
+    }
+
+    /**
+     * 鐢熸垚鏂版壒娆″彿
+     * */
+    private  String getBatch() {
+        String batchNum = System.currentTimeMillis() + "";
+        ApsPlateStandardRequireBatch batchBuilder = ApsPlateStandardRequireBatch.builder()
+                .id(IdUtil.getSnowflakeNextId())
+                .batchNumber(batchNum)
+                .delFlag("0").build();
+        batchBuilder.setCreateBy(SecurityUtils.getUsername());
+        batchBuilder.setCreateTime(DateUtils.getNowDate());
+        requireBatchMapper.insertApsPlateStandardRequireBatch(batchBuilder);
+        return batchNum;
+    }
+    /**
+     * 鑾峰彇鐗╂枡搴撳瓨淇℃伅
+     * */
+    private Optional<ApsMaterialStorageManagement> getItemStorage(String plant, String itemNumber) {
+        ApsMaterialStorageManagement storageParam = new ApsMaterialStorageManagement();
+        storageParam.setItemNumber(itemNumber);
+        storageParam.setApplicableFactories(plant);
+        Optional<ApsMaterialStorageManagement> firstStorage = itemStorageMapper.selectApsMaterialStorageManagementList(storageParam).stream()
+                .findFirst();
+
+        return firstStorage;
+    }
+
+    /**
+     * 鑾峰彇閽i噾璁″垝 棰勭暀澶╂暟
+     * */
+    private Long getReservedDays(){
+        Long days=0L;
+        List<SysDictData> dictDataList = DictUtils.getDictCache("aps_is_suspended");
+        if (dictDataList != null) {
+            Long.getLong(dictDataList.get(0).getDictValue());
+        }
+        return days;
+    }
+
+    /**
+    * 浣跨敤瀛愪欢宸ュ崟鍖归厤闇�姹備腑鐨勫噣闇�姹�
+    * */
+    private void matchRequireAndSubPlan(ApsPlateStandardRequire require) {
+        BigDecimal netRequirement = require.getNetRequirement();
+        if (netRequirement.compareTo(BigDecimal.ZERO) > 0) {
+            ApsPlatePlan platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode());
+            /*瀛愪欢宸ュ崟鐨勬湭鍖归厤鏁伴噺 浣滀负褰撳墠鐨勫簱瀛�*/
+            BigDecimal stock = platePlan.getUnmatchedQuantity();
+            if (netRequirement.compareTo(stock) < 0) {
+                /* 搴撳瓨鏁伴噺 澶т簬 鍑�闇�姹傛暟閲�*/
+                /* 鍑�闇�姹傛暟閲�=0 锛屽瓙浠跺伐鍗曟湭鍖归厤鏁伴噺= 搴撳瓨-鍑�闇�姹�*/
+                netRequirement = BigDecimal.ZERO;
+                require.setNetRequirement(netRequirement);
+                BigDecimal subtract = stock.subtract(netRequirement);
+                bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement);
+                /*鍑�闇�姹傚凡缁忚婊¤冻锛屼笉闇�瑕佺户缁尮閰�*/
+
+            } else if (netRequirement.compareTo(stock) == 0) {
+                /*鍑�闇�姹傛暟閲� == 搴撳瓨鏁伴噺*/
+                netRequirement = BigDecimal.ZERO;
+                require.setNetRequirement(netRequirement);
+                BigDecimal subtract = BigDecimal.ZERO;
+                bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, subtract, stock, netRequirement);
+                /*鍑�闇�姹傚凡缁忚婊¤冻锛屼笉闇�瑕佺户缁尮閰�*/
+            }
+            if (netRequirement.compareTo(stock) > 0) {
+                while (platePlan != null && netRequirement.compareTo(BigDecimal.ZERO) > 0) {
+                    /*闇�姹傚ぇ浜庡簱瀛�*/
+                    /*鍑�闇�姹� 琚儴鍒嗘弧瓒� */
+                    BigDecimal rest = netRequirement.subtract(stock);
+                    require.setNetRequirement(rest);
+                    require.setMatchState("鍖归厤涓�");
+                    /*宸ュ崟 鏈尮閰嶆暟閲忎负0 鍏ㄩ儴鐢ㄤ簬鍖归厤闇�姹�*/
+                    bomOrderDetailService.savePlastPlanAndBomOrderDetail(require, platePlan, BigDecimal.ZERO, stock, netRequirement);
+                    /*鍑�闇�姹傛湭琚弧瓒筹紝闇�瑕佺户缁尮閰�*/
+                    platePlan = apsPlatePlanMapper.selectUnMatchPlateSubPlan(require.getOrgCode());
+                    netRequirement = rest;
+                }
+            }
+
+        }
+    }
+
+
+
 }
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
index 35da42e..56269ce 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsBomMapper.xml
@@ -137,4 +137,25 @@
             #{id}
         </foreach>
     </delete>
+
+    <resultMap type="ApsBom" id="ApsBomLineResult">
+        <result property="bomLineId"    column="bom_line_id"    />
+        <result property="itemCode"    column="item_code"    />
+        <result property="itemName"    column="item_name"    />
+        <result property="num"    column="num"    />
+    </resultMap>
+    <sql id="selectApsBomLineVo">
+        select bom_line_id,  item_code, item_name,  num
+        from aps_bom_line
+    </sql>
+
+    <select id="selectApsBomLineList" parameterType="ApsBom" resultMap="ApsBomLineResult">
+        <include refid="selectApsBomLineVo"/>
+        <where>
+            <if test="bomHeaderId != null  and bomHeaderId != ''"> and bom_header_id = #{bomHeaderId}</if>
+            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
+            and del_flag='0'
+        </where>
+        order by bom_header_id,bom_line_id
+    </select>
 </mapper>
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsMaterialStorageManagementMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsMaterialStorageManagementMapper.xml
index 02347ca..747cd2a 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsMaterialStorageManagementMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsMaterialStorageManagementMapper.xml
@@ -15,16 +15,22 @@
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="version"    column="version"    />
+        <result property="remainderStock"    column="remainder_stock"    />
+
     </resultMap>
 
     <sql id="selectApsMaterialStorageManagementVo">
-        select id, item_number, num, applicable_factories, integration_date, refresh_date, create_by, create_time, update_by, update_time from aps_material_storage_management
+        select id, item_number, num, applicable_factories, integration_date, refresh_date, create_by,
+               create_time, update_by, update_time ,remainderStock,version
+        from aps_material_storage_management
     </sql>
 
     <select id="selectApsMaterialStorageManagementList" parameterType="ApsMaterialStorageManagement" resultMap="ApsMaterialStorageManagementResult">
         <include refid="selectApsMaterialStorageManagementVo"/>
         <where>  
             <if test="itemNumber != null  and itemNumber != ''"> and item_number = #{itemNumber}</if>
+            <if test="applicableFactories != null  and applicableFactories != ''"> and applicable_factories = #{applicableFactories}</if>
         </where>
     </select>
     
@@ -87,4 +93,9 @@
             #{id}
         </foreach>
     </delete>
+    <update id="updateMaterialStorageByVersion" parameterType="ApsMaterialStorageManagement">
+        update aps_material_storage_management
+        set remainder_stock=#{remainderStock},version=version+1
+        where id=#{id} and version=#{version}
+    </update>
 </mapper>
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPartPlanMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPartPlanMapper.xml
index 7384204..4db91eb 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPartPlanMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPartPlanMapper.xml
@@ -43,10 +43,24 @@
         <result property="stdOp"    column="std_op"    />
         <result property="opStatus"    column="op_status"    />
         <result property="nextOpName"    column="next_op_name"    />
+        <result property="plant"    column="plant"    />
+        <result property="unmatchedQuantity"    column="unmatched_quantity"    />
+        <result property="professionalAffiliation"    column="professional_affiliation"    />
+        <result property="requireId"    column="require_id"    />
+        <result property="version"    column="version"    />
+
     </resultMap>
 
     <sql id="selectApsPartPlanVo">
-        select id, master_planner, week_day, week_cycle, main_part_number, main_part_drawing_number, customer, business_type, document_number, requirement_type, document_status, item_number, drawing_no, version_number, production_quantity, good_products_quantity, process_number, work_center, department, plan_start_day, plan_end_day, standby_number, standby_name, standby_stock, next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials, advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete, has_turnback, has_risk, std_op, op_status, next_op_name from aps_part_plan
+        select id, master_planner, week_day, week_cycle, main_part_number, main_part_drawing_number,
+               customer, business_type, document_number, requirement_type, document_status, item_number,
+               drawing_no, version_number, production_quantity, good_products_quantity, process_number,
+               work_center, department, plan_start_day, plan_end_day, standby_number, standby_name, standby_stock,
+               next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials,
+               advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete,
+               has_turnback, has_risk, std_op, op_status, next_op_name ,
+               plant,  unmatched_quantity, professional_affiliation, require_id, version, unmatchedQuantity
+        from aps_part_plan
     </sql>
 
     <select id="selectApsPartPlanList" parameterType="com.aps.core.domain.ApsPartPlan" resultMap="ApsPartPlanResult">
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
index 5bf67f2..84ab2b7 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlatePlanMapper.xml
@@ -44,6 +44,8 @@
         <result property="opStatus"    column="op_status"    />
         <result property="nextOpName"    column="next_op_name"    />
         <result property="unmatchedQuantity"    column="unmatched_quantity"    />
+        <result property="professionalAffiliation"    column="professional_affiliation"    />
+        <result property="requireId"    column="require_id"    />
     </resultMap>
 
     <sql id="selectApsPlatePlanVo">
@@ -53,7 +55,7 @@
                work_center, department, plan_start_day, plan_end_day, standby_number, standby_name,
                standby_stock, next_process_deparment, is_suspended, is_outsourcing, account, advanced_materials,
                advanced_document_number, advanced_requirement_day, is_plan_complete, is_stock_complete,
-               has_turnback, has_risk, std_op, op_status, next_op_name ,unmatched_quantity
+               has_turnback, has_risk, std_op, op_status, next_op_name ,unmatched_quantity,professional_affiliation
         from aps_plate_plan
     </sql>
 
@@ -263,4 +265,31 @@
         update  aps_plate_plan  set del_flag='1' where del_flag ='0'
     </update>
 
+    <select id="selectPlatePlanByPlantMajor" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
+        select  id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,require_id
+        from aps_plate_plan
+        <where>
+            <if test="plant != null "> and plant = #{plant}</if>
+            <if test="professionalAffiliation != null "> and professional_affiliation = #{professionalAffiliation}</if>
+            and del_flag='0'
+        </where>
+        order by document_number asc,id asc
+    </select>
+
+    <select id="selectUnMatchPlateSubPlan" parameterType="ApsPlatePlan" resultMap="ApsPlatePlanResult">
+        select  id,document_number,main_part_number,item_number,plant,professional_affiliation,production_quantity,
+             ,unmatched_quantity
+        from aps_plate_plan
+        where  del_flag='0' and professional_affiliation !='0' and unmatched_quantity > 0
+        <if test="plant != null  and plan !='' "> and plant = #{plant}</if>
+        order by document_number asc,id asc
+        limit 1
+    </select>
+
+
+    <update id="updatePlanUnMatchQtyByVersion" parameterType="ApsPlatePlan">
+        update aps_plate_plan
+        set unmatched_quantity=#{unmatched_quantity},version=version+1
+        where id=#{id} and version=#{version}
+    </update>
 </mapper>
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateStandardRequireErrorMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateStandardRequireErrorMapper.xml
new file mode 100644
index 0000000..3899980
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsPlateStandardRequireErrorMapper.xml
@@ -0,0 +1,103 @@
+<?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.aps.core.mapper.ApsPlateStandardRequireErrorMapper">
+    
+    <resultMap type="ApsPlateStandardRequireError" id="ApsPlateStandardRequireErrorResult">
+        <result property="id"    column="id"    />
+        <result property="batchNumber"    column="batch_number"    />
+        <result property="requireId"    column="require_id"    />
+        <result property="docNum"    column="doc_num"    />
+        <result property="itemNum"    column="item_num"    />
+        <result property="orgCode"    column="org_code"    />
+        <result property="message"    column="message"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+    </resultMap>
+
+    <sql id="selectApsPlateStandardRequireErrorVo">
+        select id, batch_number, require_id, doc_num, item_num, org_code, message, del_flag, create_by, create_time, update_by, update_time from aps_plate_standard_require_error
+    </sql>
+
+    <select id="selectApsPlateStandardRequireErrorList" parameterType="ApsPlateStandardRequireError" resultMap="ApsPlateStandardRequireErrorResult">
+        <include refid="selectApsPlateStandardRequireErrorVo"/>
+        <where>  
+            <if test="batchNumber != null  and batchNumber != ''"> and batch_number = #{batchNumber}</if>
+            <if test="requireId != null  and requireId != ''"> and require_id = #{requireId}</if>
+            <if test="docNum != null  and docNum != ''"> and doc_num = #{docNum}</if>
+            <if test="itemNum != null  and itemNum != ''"> and item_num = #{itemNum}</if>
+            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
+            <if test="message != null  and message != ''"> and message = #{message}</if>
+        </where>
+    </select>
+    
+    <select id="selectApsPlateStandardRequireErrorById" parameterType="Long" resultMap="ApsPlateStandardRequireErrorResult">
+        <include refid="selectApsPlateStandardRequireErrorVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertApsPlateStandardRequireError" parameterType="ApsPlateStandardRequireError">
+        insert into aps_plate_standard_require_error
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="batchNumber != null">batch_number,</if>
+            <if test="requireId != null">require_id,</if>
+            <if test="docNum != null">doc_num,</if>
+            <if test="itemNum != null">item_num,</if>
+            <if test="orgCode != null">org_code,</if>
+            <if test="message != null">message,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="batchNumber != null">#{batchNumber},</if>
+            <if test="requireId != null">#{requireId},</if>
+            <if test="docNum != null">#{docNum},</if>
+            <if test="itemNum != null">#{itemNum},</if>
+            <if test="orgCode != null">#{orgCode},</if>
+            <if test="message != null">#{message},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateApsPlateStandardRequireError" parameterType="ApsPlateStandardRequireError">
+        update aps_plate_standard_require_error
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="batchNumber != null">batch_number = #{batchNumber},</if>
+            <if test="requireId != null">require_id = #{requireId},</if>
+            <if test="docNum != null">doc_num = #{docNum},</if>
+            <if test="itemNum != null">item_num = #{itemNum},</if>
+            <if test="orgCode != null">org_code = #{orgCode},</if>
+            <if test="message != null">message = #{message},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteApsPlateStandardRequireErrorById" parameterType="Long">
+        delete from aps_plate_standard_require_error where id = #{id}
+    </delete>
+
+    <delete id="deleteApsPlateStandardRequireErrorByIds" parameterType="String">
+        delete from aps_plate_standard_require_error where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessRouteHeaderMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessRouteHeaderMapper.xml
index 8ba123e..7b152eb 100644
--- a/aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessRouteHeaderMapper.xml
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsStandardProcessRouteHeaderMapper.xml
@@ -22,7 +22,9 @@
     </resultMap>
 
     <sql id="selectApsStandardProcessRouteHeaderVo">
-        select id, route_id, version, start_date, end_date, org_code, del_flag, create_by, create_time, update_by, update_time, item_code, drawing_number, process_all_time from aps_standard_process_route_header
+        select id, route_id, version, start_date, end_date, org_code, del_flag, create_by,
+               create_time, update_by, update_time, item_code, drawing_number, process_all_time
+        from aps_standard_process_route_header
     </sql>
 
     <select id="selectApsStandardProcessRouteHeaderList" parameterType="ApsStandardProcessRouteHeader" resultMap="ApsStandardProcessRouteHeaderResult">
@@ -101,4 +103,13 @@
             #{id}
         </foreach>
     </delete>
+
+    <select id="queryStandardProcessRouteHeaderByPlantAndItemCode" parameterType="String" resultMap="ApsStandardProcessRouteHeaderResult">
+        <include refid="selectApsStandardProcessRouteHeaderVo"/>
+        <where>
+            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
+            <if test="itemCode != null  and itemCode != ''"> and item_code = #{itemCode} </if>
+            and del_flag = '0'
+        </where>
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3