From a9f55fb1ab24f43fee70b16e1a8c58a33fc59fa6 Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期二, 13 五月 2025 18:12:14 +0800
Subject: [PATCH] 钣金工单计划管理:新增 查看上下阶需求接口

---
 aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java |   88 +++++++++++++++++++++++++++++++++-----------
 1 files changed, 66 insertions(+), 22 deletions(-)

diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
index 74f7ae4..6fda182 100644
--- a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsPlatePlanServiceImpl.java
@@ -1,29 +1,37 @@
 package com.aps.core.service.impl;
 
-import java.util.List;
-
+import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
+import com.aps.common.core.utils.DateUtils;
 import com.aps.common.core.utils.uuid.IdUtils;
 import com.aps.common.security.utils.DictUtils;
+import com.aps.core.domain.ApsMaterialStorageManagement;
+import com.aps.core.domain.ApsPlatePlan;
 import com.aps.core.domain.ApsPlatePlanTemp;
+import com.aps.core.domain.ApsPlateStandardRequire;
 import com.aps.core.mapper.ApsPartPlanTempMapper;
+import com.aps.core.mapper.ApsPlatePlanMapper;
 import com.aps.core.mapper.ApsPlatePlanTempMapper;
+import com.aps.core.service.IApsPlatePlanService;
 import com.aps.system.api.domain.SysDictData;
 import org.apache.logging.log4j.util.Strings;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
-import com.aps.core.mapper.ApsPlatePlanMapper;
-import com.aps.core.domain.ApsPlatePlan;
-import com.aps.core.service.IApsPlatePlanService;
+
+import java.util.List;
+import java.util.Optional;
 
 /**
  * 閽i噾璁″垝绠$悊Service涓氬姟灞傚鐞�
- * 
+ *
  * @author ruoyi
  * @date 2025-04-08
  */
 @Service
-public class ApsPlatePlanServiceImpl implements IApsPlatePlanService 
+public class ApsPlatePlanServiceImpl implements IApsPlatePlanService
 {
     @Autowired
     private ApsPlatePlanMapper apsPlatePlanMapper;
@@ -35,7 +43,7 @@
 
     /**
      * 鏌ヨ閽i噾璁″垝绠$悊
-     * 
+     *
      * @param id 閽i噾璁″垝绠$悊涓婚敭
      * @return 閽i噾璁″垝绠$悊
      */
@@ -47,7 +55,7 @@
 
     /**
      * 鏌ヨ閽i噾璁″垝绠$悊鍒楄〃
-     * 
+     *
      * @param apsPlatePlan 閽i噾璁″垝绠$悊
      * @return 閽i噾璁″垝绠$悊
      */
@@ -59,20 +67,21 @@
 
     /**
      * 鏂板閽i噾璁″垝绠$悊
-     * 
+     *
      * @param apsPlatePlan 閽i噾璁″垝绠$悊
      * @return 缁撴灉
      */
     @Override
     public int insertApsPlatePlan(ApsPlatePlan apsPlatePlan)
     {
-        apsPlatePlan.setId(IdUtils.fastUUID());
+        apsPlatePlan.setId(IdUtil.getSnowflakeNextId());
+        apsPlatePlan.setCreateTime(DateUtils.getNowDate());
         return apsPlatePlanMapper.insertApsPlatePlan(apsPlatePlan);
     }
 
     /**
      * 淇敼閽i噾璁″垝绠$悊
-     * 
+     *
      * @param apsPlatePlan 閽i噾璁″垝绠$悊
      * @return 缁撴灉
      */
@@ -84,7 +93,7 @@
 
     /**
      * 鎵归噺鍒犻櫎閽i噾璁″垝绠$悊
-     * 
+     *
      * @param ids 闇�瑕佸垹闄ょ殑閽i噾璁″垝绠$悊涓婚敭
      * @return 缁撴灉
      */
@@ -96,7 +105,7 @@
 
     /**
      * 鍒犻櫎閽i噾璁″垝绠$悊淇℃伅
-     * 
+     *
      * @param id 閽i噾璁″垝绠$悊涓婚敭
      * @return 缁撴灉
      */
@@ -108,6 +117,8 @@
 
     @Override
     public int confirmPlan(ApsPlatePlanTemp tempPlan) {
+        //鍏堝垹闄ゆ墍鏈�
+        apsPlatePlanMapper.removeAllPlatePlans();
         //鏌ヨ涓存椂琛ㄦ暟鎹�
         List<ApsPlatePlanTemp> apsPartPlanTemps=apsPlatePlanTempMapper.selectApsPlatePlanTempList(tempPlan);
         int count=0;
@@ -117,7 +128,8 @@
             ids[i]=apsPartPlanTemps.get(i).getId();
             ApsPlatePlan platePlan=new ApsPlatePlan();
             BeanUtils.copyProperties(apsPartPlanTemps.get(i), platePlan);
-            platePlan.setId(IdUtils.fastUUID());
+            platePlan.setId(IdUtil.getSnowflakeNextId());
+            platePlan.setCreateTime(DateUtils.getNowDate());
             //鎻掑叆姝e紡琛紝骞惰褰�
             apsPlatePlanMapper.insertApsPlatePlan(platePlan);
             count++;
@@ -134,15 +146,37 @@
         String batchNum= IdUtils.fastUUID();
         //鍒ゆ柇瀵煎叆鏁版嵁鏄惁涓虹┖
         if (tempList.size() > 0) {
-            List<SysDictData> dictDataList = DictUtils.getDictCache("aps_is_suspended");
+            /*
+            * aps_business_type aps_document_status aps_is_suspended aps_account
+            * */
+
+            List<SysDictData> suspendedDic = DictUtils.getDictCache("aps_is_suspended");
+            List<SysDictData> businessTypeDic = DictUtils.getDictCache("aps_business_type");
+            List<SysDictData> documentStatusDic = DictUtils.getDictCache("aps_document_status");
+            List<SysDictData> accountDic = DictUtils.getDictCache("aps_account");
             for (int i = 0; i < tempList.size(); i++) {
+
                 ApsPlatePlanTemp planTemp = tempList.get(i);
-                for (int j = 0; j < dictDataList.size(); j++) {
-                    if (planTemp.getIsSuspendedTxt().equals(dictDataList.get(j).getDictLabel())) {
-                        planTemp.setIsSuspended(Integer.parseInt(dictDataList.get(j).getDictValue()));
-                        break;
-                    }
-                }
+
+                String isSuspendedTxt = planTemp.getIsSuspended().trim();
+                String businessType = planTemp.getBusinessType().trim();
+                String documentStatusText = planTemp.getDocumentStatus().trim();
+                String account = planTemp.getAccount().trim();
+
+                Optional<SysDictData> documentStatusFirst = documentStatusDic.stream().filter(x -> x.getDictLabel().equals(documentStatusText)).findFirst();
+                documentStatusFirst.ifPresent(sysDictData -> planTemp.setDocumentStatus(sysDictData.getDictValue()));
+
+                Optional<SysDictData> accountFirst = accountDic.stream().filter(x -> x.getDictLabel().equals(account)).findFirst();
+                accountFirst.ifPresent(sysDictData -> planTemp.setAccount(sysDictData.getDictValue()));
+
+                Optional<SysDictData> businessTypeFirst = businessTypeDic.stream().filter(x -> x.getDictLabel().equals(businessType)).findFirst();
+                businessTypeFirst.ifPresent(sysDictData -> planTemp.setBusinessType(sysDictData.getDictValue()));
+
+
+                Optional<SysDictData> isSuspendedFirst = suspendedDic.stream().filter(x -> x.getDictLabel().equals(isSuspendedTxt)).findFirst();
+                isSuspendedFirst.ifPresent(sysDictData -> planTemp.setIsSuspended(sysDictData.getDictValue()));
+
+                planTemp.setId(IdUtils.fastUUID());
                 //鎻掑叆鐗堟湰鍙�
                 planTemp.setBatchNumber(batchNum);
                 //鎻掑叆涓存椂琛�
@@ -153,4 +187,14 @@
            return Strings.EMPTY;
         }
     }
+
+    /**
+     * 閽i噾鍐椾綑宸ュ崟鎶ヨ〃
+     * @param apsPlatePlan
+     * @return
+     */
+    @Override
+    public List<ApsPlatePlan> selectPlateRedundantOrderList(ApsPlatePlan apsPlatePlan) {
+        return apsPlatePlanMapper.selectPlateRedundantOrderList(apsPlatePlan);
+    }
 }

--
Gitblit v1.9.3