From f2a092218ece0821351440331c90064c8cbd5241 Mon Sep 17 00:00:00 2001
From: hdy <1105738590@qq.com>
Date: 星期一, 25 十二月 2023 16:57:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java b/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
index b27667d..d7e1aeb 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/service/impl/OmProductionOrdeInfoServiceImpl.java
@@ -3,6 +3,7 @@
 import java.util.List;
 import java.util.stream.Collectors;
 
+import com.jcdm.common.core.domain.AjaxResult;
 import com.jcdm.common.utils.DateUtils;
 import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
 import com.jcdm.main.om.productionOrde.mapper.OmProductionOrdeInfoMapper;
@@ -59,6 +60,8 @@
     public int insertOmProductionOrdeInfo(OmProductionOrdeInfo omProductionOrdeInfo)
     {
         omProductionOrdeInfo.setCreateTime(DateUtils.getNowDate());
+        Integer streamNumber = omProductionOrdeInfoMapper.getMaxStreamNumber();
+        omProductionOrdeInfo.setStreamNumber(String.valueOf(streamNumber+1));
         return omProductionOrdeInfoMapper.insertOmProductionOrdeInfo(omProductionOrdeInfo);
     }
 
@@ -100,7 +103,7 @@
     }
 
     @Override
-    public int upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) {
+    public AjaxResult upDownMove(OmProductionOrdeInfo omProductionOrdeInfo) {
         long currentId = omProductionOrdeInfo.getFrontEndId();
         List<OmProductionOrdeInfo> omProductionOrdeInfos = omProductionOrdeInfoService.selectOmProductionOrdeInfoList(omProductionOrdeInfo);
         List<Long> idList = omProductionOrdeInfos.stream()
@@ -108,10 +111,14 @@
                 .collect(Collectors.toList());
         int index = idList.indexOf(currentId);
         long moveId = 0L;
-        if(omProductionOrdeInfo.getFlag().equals("up")){
-            moveId = idList.get(index - 1);
-        }else {
-            moveId = idList.get(index + 1);
+        try {
+            if(omProductionOrdeInfo.getFlag().equals("up")){
+                moveId = idList.get(index - 1);
+            }else {
+                moveId = idList.get(index + 1);
+            }
+        }catch (Exception e){
+            return AjaxResult.error("褰撳墠宸ュ崟涓烘渶鍚庝竴涓垨绗竴涓紝鏃犳硶绉诲姩");
         }
         OmProductionOrdeInfo  currentInfo = new OmProductionOrdeInfo();
         currentInfo.setId(currentId);
@@ -125,6 +132,6 @@
         omProductionOrdeInfoService.updateOmProductionOrdeInfo(moveOrdeInfos.get(0));
         currentOrdeInfos.get(0).setStreamNumber(moveStreamNumber);
         omProductionOrdeInfoService.updateOmProductionOrdeInfo(currentOrdeInfos.get(0));
-        return 1;
+        return AjaxResult.success("绉诲姩鎴愬姛");
     }
 }

--
Gitblit v1.9.3