From c8673cbde4538b109e43042dc93cf33c46dca37e Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期二, 31 十二月 2024 10:56:57 +0800
Subject: [PATCH] 每日排产计划修改

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcProductDayScheduleServiceImpl.java |   55 +++++++++++++++++++++++++++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcProductDayScheduleServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcProductDayScheduleServiceImpl.java
index c55f23a..bc20942 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcProductDayScheduleServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcProductDayScheduleServiceImpl.java
@@ -1,6 +1,7 @@
 package org.jeecg.modules.mdcJc.service.impl;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.mdc.mapper.MdcEquipmentMapper;
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule;
 import org.jeecg.modules.mdcJc.entity.ProductDayschedule;
@@ -11,11 +12,10 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.time.LocalDate;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * @author Lius
@@ -26,6 +26,11 @@
 
     @Resource
     private IClassMonthlyScheduleService classMonthlyScheduleService;
+
+    @Resource
+    private MdcEquipmentMapper mdcEquipmentMapper;
+
+    private final List<String> equipments = Stream.of("5045-7110", "5045-7115", "5045-7118").collect(Collectors.toList());
 
 
     @Override
@@ -40,10 +45,39 @@
             this.removeBatchByIds(mdcListIds);
         }
         List<MdcProductDayschedule> mesC = new ArrayList<>();
+        Map<String, String> map = new HashMap<>();
+        map.put("5899-8026", "1818119280110690306");
+        map.put("5899-8027", "1818119094416269313");
+        map.put("5899-8060", "1818118942234337281");
+        map.put("5899-8061", "1818119019862515714");
         for (ProductDayschedule c : list) {
-            MdcProductDayschedule mdc = new MdcProductDayschedule();
-            BeanMapper.copy(c, mdc);
-            mesC.add(mdc);
+            if (map.containsKey(c.getEquipmentId())) {
+                String productionId = map.get(c.getEquipmentId());
+                List<String> equipmentList = new ArrayList<>();
+                if ("5899-8060".equals(c.getEquipmentId()) && "鍚庝紶鍔ㄧ澹充綋".equals(c.getProductName())) {
+                    // 3.8.11鍙锋満 鍚庝紶鍔ㄧ澹充綋
+                    equipmentList = equipments;
+                } else if ("5899-8060".equals(c.getEquipmentId()) && "浼犲姩绠卞3浣�".equals(c.getProductName())) {
+                    // 闄� 3.8.11鍙锋満涔嬪 浼犲姩绠卞3浣�
+                    List<String> queryIdsByProduction = mdcEquipmentMapper.queryIdsByProduction(productionId);
+                    equipmentList = queryIdsByProduction.stream().filter(equipment -> !equipments.contains(equipment)).collect(Collectors.toList());
+                } else {
+                    equipmentList = mdcEquipmentMapper.queryIdsByProduction(productionId);
+                }
+
+                if (equipmentList != null && !equipmentList.isEmpty()) {
+                    for (String equipmentId : equipmentList) {
+                        MdcProductDayschedule mdc = new MdcProductDayschedule();
+                        BeanMapper.copy(c, mdc);
+                        mdc.setEquipmentId(equipmentId);
+                        mesC.add(mdc);
+                    }
+                }
+            } else {
+                MdcProductDayschedule mdc = new MdcProductDayschedule();
+                BeanMapper.copy(c, mdc);
+                mesC.add(mdc);
+            }
         }
         boolean b = this.saveBatch(mesC);
         return b;
@@ -52,6 +86,11 @@
     @Override
     public MdcProductDayschedule findYesterdayData() {
         String date = LocalDate.now().plusDays(-1).toString();
-        return classMonthlyScheduleService.findYesterdayData(date);
+        return this.baseMapper.findYesterdayData(date);
+    }
+
+    @Override
+    public String findClazz(String equipmentId) {
+        return this.baseMapper.findClazz(equipmentId);
     }
 }

--
Gitblit v1.9.3