Forráskód Böngészése

feat:优化加弹排产计划查询

hmc 1 éve
szülő
commit
06b7440fc1

+ 4 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/AmmunitionPlanInformationIntermediateTableController.java

@@ -1,6 +1,8 @@
 package com.zkqy.business.controller;
 
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javax.servlet.http.HttpServletResponse;
 
 import com.zkqy.business.domain.DetailsOfTheRefuelingPlan;
@@ -74,7 +76,8 @@ public class AmmunitionPlanInformationIntermediateTableController extends BaseCo
     @ApiOperation(value = "查询加弹计划信息列表")
     public AjaxResult getAllPlanListByMachineId(@RequestParam("machineId") String machineId) {
         List<DetailsOfTheRefuelingPlan> list = ammunitionPlanInformationIntermediateTableService.getAllPlanListByMachineId(machineId);
-        return AjaxResult.success(list);
+        List<DetailsOfTheRefuelingPlan> newList = list.stream().filter(detailsOfTheRefuelingPlan -> !detailsOfTheRefuelingPlan.getTimestampRandomCode().equals("停机")).collect(Collectors.toList());
+        return AjaxResult.success(newList);
     }
 
     @PreAuthorize("@ss.hasPermi('business:table:list')")

+ 111 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/DetailsOfTheRefuelingPlanController.java

@@ -1,8 +1,12 @@
 package com.zkqy.business.controller;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javax.servlet.http.HttpServletResponse;
 
+import com.zkqy.business.mapper.DetailsOfTheRefuelingPlanMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -37,6 +41,9 @@ public class DetailsOfTheRefuelingPlanController extends BaseController {
     @Autowired
     private IDetailsOfTheRefuelingPlanService detailsOfTheRefuelingPlanService;
 
+    @Autowired
+    private DetailsOfTheRefuelingPlanMapper detailsOfTheRefuelingPlanMapper;
+
     /**
      * 查询加弹计划详细信息列表
      */
@@ -49,6 +56,110 @@ public class DetailsOfTheRefuelingPlanController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询加弹计划详细信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:plan:list')")
+    @GetMapping("/listStatus/{id}")
+    @ApiOperation(value = "查询加弹计划详细信息列表")
+    public AjaxResult listStatus(@PathVariable ("id") String id) {
+        DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan1=new DetailsOfTheRefuelingPlan();
+        detailsOfTheRefuelingPlan1.setTimestampRandomCode("停机");
+        detailsOfTheRefuelingPlan1.setProductType("A面");
+        detailsOfTheRefuelingPlan1.setMachineId(id);
+        List<DetailsOfTheRefuelingPlan> list1 = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan1);
+
+        DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan2=new DetailsOfTheRefuelingPlan();
+        detailsOfTheRefuelingPlan2.setTimestampRandomCode("停机");
+        detailsOfTheRefuelingPlan2.setProductType("B面");
+        detailsOfTheRefuelingPlan2.setMachineId(id);
+        List<DetailsOfTheRefuelingPlan> list2 = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan2);
+        List<String> listArray=new ArrayList<>();
+        if(list1.size()>0){
+            listArray.add("1");
+        }
+        if(list2.size()>0){
+            listArray.add("2");
+        }
+        return AjaxResult.success(listArray);
+    }
+
+    @PreAuthorize("@ss.hasPermi('system:plan:list')")
+    @PostMapping("/updateLineStates/{id}/{mids}")
+    @ApiOperation(value = "查询加弹计划详细信息列表")
+    public AjaxResult updateLineStates(@PathVariable("id") String id,@PathVariable("mids") String ids) {
+        //每次都把那个虚拟状态给他删掉,就好了
+        int i = detailsOfTheRefuelingPlanService.deleteDetailsOfTheRefuelingPlanByMachineId(id);
+        if(ids.indexOf("1")!=-1){
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlan.setMachineId(id);
+            detailsOfTheRefuelingPlan.setPlanStatus("2");
+            detailsOfTheRefuelingPlan.setProductType("A面");
+            detailsOfTheRefuelingPlan.setTimestampRandomCode("停机");
+            detailsOfTheRefuelingPlan.setCurrentColorCode("1");
+            detailsOfTheRefuelingPlanService.insertDetailsOfTheRefuelingPlan(detailsOfTheRefuelingPlan);
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanSelect=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlanSelect.setMachineId(id);
+            detailsOfTheRefuelingPlanSelect.setProductType("A面");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlanSelect);
+            List<DetailsOfTheRefuelingPlan> collect = detailsOfTheRefuelingPlans.stream().filter(item -> item.getPlanStatus().equals("1")).collect(Collectors.toList());
+            if(collect.size()>0){
+                DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanUpdate=new DetailsOfTheRefuelingPlan();
+                detailsOfTheRefuelingPlanUpdate.setPlanStatus("2");
+                detailsOfTheRefuelingPlanUpdate.setMachineId(id);
+                detailsOfTheRefuelingPlanUpdate.setProductType("A面");
+                detailsOfTheRefuelingPlanMapper.updateDetailsOfTheRefuelingPlanByMachineIdAndProductType(detailsOfTheRefuelingPlanUpdate);
+            }
+        }else {
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanConditions=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlanConditions.setMachineId(id);
+            detailsOfTheRefuelingPlanConditions.setPlanStatus("2");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlanConditions);
+            if(detailsOfTheRefuelingPlans.size()>0){//如果有真实的计划停产了,就让他上机
+                DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanUpdate=new DetailsOfTheRefuelingPlan();
+                detailsOfTheRefuelingPlanUpdate.setMachineId(id);
+                detailsOfTheRefuelingPlanUpdate.setPlanStatus("1");
+                detailsOfTheRefuelingPlanUpdate.setProductType("A面");
+                detailsOfTheRefuelingPlanMapper.updateDetailsOfTheRefuelingPlanByMachineIdAndProductType(detailsOfTheRefuelingPlanUpdate);
+            }
+        }
+        if(ids.indexOf("2")!=-1){
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlan.setMachineId(id);
+            detailsOfTheRefuelingPlan.setPlanStatus("2");
+            detailsOfTheRefuelingPlan.setProductType("B面");
+            detailsOfTheRefuelingPlan.setTimestampRandomCode("停机");
+            detailsOfTheRefuelingPlan.setCurrentColorCode("1");
+            detailsOfTheRefuelingPlanService.insertDetailsOfTheRefuelingPlan(detailsOfTheRefuelingPlan);
+            //有真实的计划数据,改成停产
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanSelect=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlanSelect.setMachineId(id);
+            detailsOfTheRefuelingPlanSelect.setProductType("B面");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlanSelect);
+            List<DetailsOfTheRefuelingPlan> collect = detailsOfTheRefuelingPlans.stream().filter(item -> item.getPlanStatus().equals("1")).collect(Collectors.toList());
+            if(collect.size()>0){
+                DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanUpdate=new DetailsOfTheRefuelingPlan();
+                detailsOfTheRefuelingPlanUpdate.setPlanStatus("2");
+                detailsOfTheRefuelingPlanUpdate.setMachineId(id);
+                detailsOfTheRefuelingPlanUpdate.setProductType("B面");
+                detailsOfTheRefuelingPlanMapper.updateDetailsOfTheRefuelingPlanByMachineIdAndProductType(detailsOfTheRefuelingPlanUpdate);
+            }
+        }else {
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanConditions=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlanConditions.setMachineId(id);
+            detailsOfTheRefuelingPlanConditions.setPlanStatus("2");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanService.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlanConditions);
+            if(detailsOfTheRefuelingPlans.size()>0){//如果有真实的计划停产了,就让他上机
+                DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlanUpdate=new DetailsOfTheRefuelingPlan();
+                detailsOfTheRefuelingPlanUpdate.setMachineId(id);
+                detailsOfTheRefuelingPlanUpdate.setPlanStatus("1");
+                detailsOfTheRefuelingPlanUpdate.setProductType("B面");
+                detailsOfTheRefuelingPlanMapper.updateDetailsOfTheRefuelingPlanByMachineIdAndProductType(detailsOfTheRefuelingPlanUpdate);
+            }
+        }
+        return  AjaxResult.success();
+    }
+
     /**
      * 导出加弹计划详细信息列表
      */

+ 13 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/DetailsOfTheRefuelingPlanMapper.java

@@ -65,6 +65,12 @@ public interface DetailsOfTheRefuelingPlanMapper
      */
     public int updateDetailsOfTheRefuelingPlan(DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan);
 
+    /**
+     * 修改加弹计划根据产线、和面
+     * @param detailsOfTheRefuelingPlan
+     * @return
+     */
+    public int updateDetailsOfTheRefuelingPlanByMachineIdAndProductType(DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan);
     /**
      * 删除加弹计划详细信息
      * 
@@ -80,4 +86,11 @@ public interface DetailsOfTheRefuelingPlanMapper
      * @return 结果
      */
     public int deleteDetailsOfTheRefuelingPlanByIds(Long[] ids);
+
+    /**
+     * 删除当前机台下的虚拟数据,不管AB面
+     * @param machineId
+     * @return
+     */
+    int deleteDetailsOfTheRefuelingPlanByMachineId(String machineId);
 }

+ 4 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IDetailsOfTheRefuelingPlanService.java

@@ -2,6 +2,7 @@ package com.zkqy.business.service;
 
 import java.util.List;
 import com.zkqy.business.domain.DetailsOfTheRefuelingPlan;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 加弹计划详细信息Service接口
@@ -65,4 +66,7 @@ public interface IDetailsOfTheRefuelingPlanService
      * @return 结果
      */
     public int deleteDetailsOfTheRefuelingPlanById(Long id);
+
+
+    public int deleteDetailsOfTheRefuelingPlanByMachineId(@Param("machineId") String machineId);
 }

+ 74 - 118
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/AmmunitionPlanInformationIntermediateTableServiceImpl.java

@@ -4,6 +4,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import com.zkqy.business.domain.*;
 import com.zkqy.business.domain.vo.AmmunitionPlanInformationIntermediateTableRVo;
@@ -132,13 +133,14 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
             detailsOfTheRefuelingPlan3.setPlanStatus("0");
             detailsOfTheRefuelingPlan3.setProductType("B面");
             List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans3 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan3);
-
             //查询产线A面上机的
             DetailsOfTheRefuelingPlan Asj=new DetailsOfTheRefuelingPlan();
             Asj.setMachineId(item.getProductionLineNo());//产线号
             Asj.setPlanStatus("1");
             Asj.setProductType("A面");
             List<DetailsOfTheRefuelingPlan> AList = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(Asj);
+
+            //A上机数据
             if(AList.size()>0){
                 //A面上机产品
                 AList.stream().forEach(item1->{
@@ -154,15 +156,18 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
                     rs1.setListOfPendingProduction(collect);
                     list.add(rs1);
                 });
-                //A停机的
-                DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan4=new DetailsOfTheRefuelingPlan();
-                detailsOfTheRefuelingPlan4.setMachineId(item.getProductionLineNo());//产线号
-                detailsOfTheRefuelingPlan4.setPlanStatus("2");
-                detailsOfTheRefuelingPlan4.setProductType("A面");
-                List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans4 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan4);
-
-                if(detailsOfTheRefuelingPlans4.size()>0){
-                    detailsOfTheRefuelingPlans4.stream().forEach(item1->{
+            }
+            //A面有没有停机的
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan4=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlan4.setMachineId(item.getProductionLineNo());//产线号
+            detailsOfTheRefuelingPlan4.setPlanStatus("2");
+            detailsOfTheRefuelingPlan4.setProductType("A面");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans4 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan4);
+            if(detailsOfTheRefuelingPlans4.size()>0){
+                List<DetailsOfTheRefuelingPlan> tjSize = detailsOfTheRefuelingPlans4.stream().filter(item1 -> !item1.getTimestampRandomCode().equals("停机")).collect(Collectors.toList());
+                //不需要假数据来顶替,因为真实数据有停机的出现
+                if(tjSize.size()>0){
+                    tjSize.stream().forEach(item1->{
                         //拿到了某个车间的所有产线
                         AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
                         rs1.setMachineId(item.getProductionLineNo());//产线号
@@ -176,21 +181,38 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
                         list.add(rs1);
                     });
                 }
-            }else {
-                if(detailsOfTheRefuelingPlans2.size()>0){
-                    AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
-                    rs1.setMachineId(item.getProductionLineNo());//产线号
-                    String collect = detailsOfTheRefuelingPlans2.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
-                    rs1.setListOfPendingProduction(collect);
-                    rs1.setProductType("A面");
-                    list.add(rs1);
-                }else {
+                if(tjSize.size()==0){
+                    //假数据停机
+                    detailsOfTheRefuelingPlans4.stream().forEach(item1->{
+                        //拿到了某个车间的所有产线
+                        AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
+                        rs1.setMachineId(item.getProductionLineNo());//产线号
+                        rs1.setProductType("A面");
+                        rs1.setPlannedEndTime("停机");
+                        //当前产线A面待生产
+                        String collect = detailsOfTheRefuelingPlans2.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
+                        rs1.setListOfPendingProduction(collect);
+                        list.add(rs1);
+                    });
+                }
+            }
+            //A面有没有待机的
+            if(detailsOfTheRefuelingPlans2.size()>0&&AList.size()<=0){
+                AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
+                rs1.setMachineId(item.getProductionLineNo());//产线号
+                String collect = detailsOfTheRefuelingPlans2.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
+                rs1.setListOfPendingProduction(collect);
+                rs1.setProductType("A面");
+                list.add(rs1);
+            }
+            //A待机没有、停机没有、上机也没有
+            if(detailsOfTheRefuelingPlans2.size()<=0&&detailsOfTheRefuelingPlans4.size()<=0&&AList.size()<=0){
                     AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
                     rs1.setMachineId(item.getProductionLineNo());//产线号
                     rs1.setProductType("A面");
                     list.add(rs1);
-                }
             }
+
             //查询B面上机的
             DetailsOfTheRefuelingPlan Bsj=new DetailsOfTheRefuelingPlan();
             Bsj.setMachineId(item.getProductionLineNo());//产线号
@@ -212,109 +234,43 @@ public class AmmunitionPlanInformationIntermediateTableServiceImpl implements IA
                     rs1.setListOfPendingProduction(collect);
                     list.add(rs1);
                 });
-                        //            //B停机的
-                    DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan5=new DetailsOfTheRefuelingPlan();
-                    detailsOfTheRefuelingPlan5.setMachineId(item.getProductionLineNo());//产线号
-                    detailsOfTheRefuelingPlan5.setPlanStatus("2");
-                    detailsOfTheRefuelingPlan5.setProductType("B面");
-                    List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans5 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan5);
-
-                    if(detailsOfTheRefuelingPlans5.size()>0){
-                        detailsOfTheRefuelingPlans5.stream().forEach(item1->{
-                            //拿到了某个车间的所有产线
-                            AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
-                            rs1.setMachineId(item.getProductionLineNo());//产线号
-                            rs1.setProductType("B面");
-                            rs1.setPlannedEndTime(rs1.getPlannedEndTime()+"停机");
-                            rs1.setCurrentLotNumber(item1.getCurrentLotNumber().toString());
-                            //当前产线b面待生产
-                            String collect = detailsOfTheRefuelingPlans3.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
-                            rs1.setListOfPendingProduction(collect);
-                            list.add(rs1);
-                        });
-                    }
-
-            }else {
-                //A面上没有上级产品(看看他有没有待机产品)
-                if(detailsOfTheRefuelingPlans3.size()>0){
-                    AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
-                    rs1.setMachineId(item.getProductionLineNo());//产线号
-                    String collect = detailsOfTheRefuelingPlans3.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
-                    rs1.setListOfPendingProduction(collect);
-                    rs1.setProductType("B面");
-                    list.add(rs1);
-                }else {
-                    AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
-                    rs1.setMachineId(item.getProductionLineNo());//产线号
-                    rs1.setProductType("B面");
-                    list.add(rs1);
-                }
             }
-/*            //所有的计划都属于这个产线、所以不能根据产线去查,计划详情
-            //查这个产线的待生产产品
-            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan=new DetailsOfTheRefuelingPlan();
-            detailsOfTheRefuelingPlan.setMachineId(item.getProductionLineNo());//产线号
-            detailsOfTheRefuelingPlan.setPlanStatus("1");
-            //查询都是上机的产品(不管A面还是B面)
-            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan);
-            //查询未上级的产品 (不管A面还是B面)
-            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan4=new DetailsOfTheRefuelingPlan();
-            detailsOfTheRefuelingPlan4.setMachineId(item.getProductionLineNo());//产线号
-            detailsOfTheRefuelingPlan4.setPlanStatus("1");
-
-            //A面的待生产
-            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan2=new DetailsOfTheRefuelingPlan();
-            detailsOfTheRefuelingPlan2.setMachineId(item.getProductionLineNo());//产线号
-            detailsOfTheRefuelingPlan2.setPlanStatus("0");
-            detailsOfTheRefuelingPlan2.setProductType("A面");
-            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans2 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan2);
-            //B面的待生产
-            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan3=new DetailsOfTheRefuelingPlan();
-            detailsOfTheRefuelingPlan3.setMachineId(item.getProductionLineNo());//产线号
-            detailsOfTheRefuelingPlan3.setPlanStatus("0");
-            detailsOfTheRefuelingPlan3.setProductType("B面");
-            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans3 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan3);
-
-               boolean isFlagA=false;
-                          boolean isFlagB=false;
-                           //循环每个上机产品
-                           detailsOfTheRefuelingPlans.forEach(it->{
-                               //查询他的待上机(A面待上机或者B面待上机)
-                               if(it.getProductType().contains("A面")||it.getProductType().contains("B面")){
-                                   //执行待产列表上位逻辑
-
-                               }
-                          });
-
-            //正在生产中的
-            if(detailsOfTheRefuelingPlans.size()>0){
-                detailsOfTheRefuelingPlans.forEach(it->{
-                    //拿到了某个车间的所有产线
-                    AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
-                    rs1.setMachineId(item.getProductionLineNo());//产线号
-
-                    BeanUtils.copyProperties(it,rs1);
-                    rs1.setCurrentLotNumber(it.getCurrentLotNumber().toString());
-                    String collect;// 将色号和批号拼接成字符串
-                    if(it.getProductType().equals("A面")){
-                        collect = detailsOfTheRefuelingPlans2.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")") // 将色号和批号拼接成字符串
-                                .collect(Collectors.joining(","));
-                    }else {
-                        collect = detailsOfTheRefuelingPlans3.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")") // 将色号和批号拼接成字符串
-                                .collect(Collectors.joining(","));
-                    }
-                    rs1.setListOfPendingProduction(collect);
-                    list.add(rs1);
-                });
-            }else {
+            //B停机的
+            DetailsOfTheRefuelingPlan detailsOfTheRefuelingPlan5=new DetailsOfTheRefuelingPlan();
+            detailsOfTheRefuelingPlan5.setMachineId(item.getProductionLineNo());//产线号
+            detailsOfTheRefuelingPlan5.setPlanStatus("2");
+            detailsOfTheRefuelingPlan5.setProductType("B面");
+            List<DetailsOfTheRefuelingPlan> detailsOfTheRefuelingPlans5 = detailsOfTheRefuelingPlanMapper.selectDetailsOfTheRefuelingPlanList(detailsOfTheRefuelingPlan5);
+            if(detailsOfTheRefuelingPlans5.size()>0){
+                    detailsOfTheRefuelingPlans5.stream().forEach(item1->{
+                        //拿到了某个车间的所有产线
+                        AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
+                        rs1.setMachineId(item.getProductionLineNo());//产线号
+                        rs1.setProductType("B面");
+                        rs1.setPlannedEndTime("停机");
+                        //当前产线b面待生产
+                        String collect = detailsOfTheRefuelingPlans3.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
+                        rs1.setListOfPendingProduction(collect);
+                        list.add(rs1);
+                    });
+            }
+            //B待机
+            if(detailsOfTheRefuelingPlans3.size()>0&&BList.size()<=0){
                 AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
                 rs1.setMachineId(item.getProductionLineNo());//产线号
+                String collect = detailsOfTheRefuelingPlans3.stream().map(plan -> plan.getCurrentColorCode() + "-(" + plan.getCurrentLotNumber() + ")").collect(Collectors.joining(","));
+                rs1.setListOfPendingProduction(collect);
+                rs1.setProductType("B面");
                 list.add(rs1);
             }
-            //待生产的,
-            detailsOfTheRefuelingPlans3.forEach(ac->{
-
-            });*/
+            //待机没有,停机没有,上机没有
+            if(detailsOfTheRefuelingPlans3.size()<=0&&detailsOfTheRefuelingPlans5.size()<=0&&BList.size()<=0){
+                AmmunitionPlanInformationIntermediateTableRVo rs1=new AmmunitionPlanInformationIntermediateTableRVo();
+                rs1.setMachineId(item.getProductionLineNo());//产线号
+                rs1.setProductType("B面");
+                list.add(rs1);
+            }
+            //如果包含一个停机的假数据,
         });
         return list;
         /**

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/DetailsOfTheRefuelingPlanServiceImpl.java

@@ -163,4 +163,9 @@ public class DetailsOfTheRefuelingPlanServiceImpl implements IDetailsOfTheRefuel
     {
         return detailsOfTheRefuelingPlanMapper.deleteDetailsOfTheRefuelingPlanById(id);
     }
+
+    @Override
+    public int deleteDetailsOfTheRefuelingPlanByMachineId(String machineId) {
+        return detailsOfTheRefuelingPlanMapper.deleteDetailsOfTheRefuelingPlanByMachineId(machineId);
+    }
 }

+ 23 - 0
zkqy-custom-business/src/main/resources/mapper/business/DetailsOfTheRefuelingPlanMapper.xml

@@ -160,6 +160,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+    <update id="updateDetailsOfTheRefuelingPlanByMachineIdAndProductType" parameterType="com.zkqy.business.domain.DetailsOfTheRefuelingPlan">
+        update {DBNAME}.details_of_the_refueling_plan
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="timestampRandomCode != null">timestamp_random_code = #{timestampRandomCode},</if>
+            <if test="machineId != null">machine_id = #{machineId},</if>
+            <if test="currentColorCode != null and currentColorCode != ''">current_color_code = #{currentColorCode},</if>
+            <if test="currentSpecification != null">current_specification = #{currentSpecification},</if>
+            <if test="currentLotNumber != null">current_lot_number = #{currentLotNumber},</if>
+            <if test="currentSpindleCount != null">current_spindle_count = #{currentSpindleCount},</if>
+            <if test="startTime != null">start_time = #{startTime},</if>
+            <if test="plannedEndTime != null">planned_end_time = #{plannedEndTime},</if>
+            <if test="planStatus != null">plan_status = #{planStatus},</if>
+            <if test="number != null">`number` = #{number},</if>
+            <if test="productType != null  and productType != ''">`productType`= #{productType},</if>
+            <if test="productId != null  and productId != ''">`product_id`= #{productId},</if>
+            <if test="salesmanId != null  and salesmanId != ''">`salesman_id`= #{salesmanId},</if>
+        </trim>
+        where machine_id = #{machineId} and productType=#{productType}
+    </update>
     <delete id="deleteDetailsOfTheRefuelingPlanById" parameterType="Long">
         delete from {DBNAME}.details_of_the_refueling_plan where id = #{id}
     </delete>
@@ -170,4 +189,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <delete id="deleteDetailsOfTheRefuelingPlanByMachineId">
+        delete from {DBNAME}.details_of_the_refueling_plan where machine_id = #{machineId} and timestamp_random_code='停机';
+    </delete>
 </mapper>

+ 23 - 0
zkqy-ui/src/api/plan/paln.js

@@ -144,3 +144,26 @@ export function spinningFrameWinding(id) {
     baseURL: process.env.VUE_APP_BASE_API1
   })
 }
+
+/**
+ * 加弹AB面是否停机,返回的是一个数组
+ * id是机台号
+ */
+export function whetherTheFeederIsShutDown(id) {
+  return request({
+    url: '/system/plan/listStatus/'+id,
+    method: 'get',
+    baseURL: process.env.VUE_APP_BASE_API1
+  })
+}
+
+/**
+ * 更改加弹机状态
+ */
+export function updateLineStates(id,mids) {
+  return request({
+    url: '/system/plan/updateLineStates/'+id+'/'+mids,
+    method: 'POST',
+    baseURL: process.env.VUE_APP_BASE_API1
+  })
+}

+ 270 - 82
zkqy-ui/src/views/orderMange/planTable/index.vue

@@ -126,7 +126,7 @@
             </el-table-column>
             <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
               <template v-slot:default="scope">
-                <el-select  v-model="scope.row.planStatus" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select  v-model="scope.row.planStatus" placeholder="计划状态">
                   <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
               </template>
@@ -148,7 +148,7 @@
            </span>
         </el-dialog>
         <!--修改计划弹窗-->
-        <el-dialog title="修改计划"  :visible.sync="nanUpdateDialogTableVisible" width="1200px">
+        <el-dialog title="修改计划"  :visible.sync="nanUpdateDialogTableVisible" width="1400px">
           <!--查询条件-->
           <el-form ref="form"  :model="formData" label-width="80px" :inline="true">
              <el-form-item label="产品类别:">
@@ -163,7 +163,7 @@
               </el-form-item>
               <el-form-item>
                 <el-button type="primary" @click="onSubmit">查询</el-button>
-                <el-button>重置</el-button>
+                <el-button @click="reset">重置</el-button>
               </el-form-item>
           </el-form>
           <!--表格-->
@@ -243,25 +243,29 @@
             <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
               <template v-slot:default="scope">
                 <!--上机变停机待机-->
-                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态">
                   <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
                 <!--待机可以上机-->
-                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
                 <!--停机变上机-->
-                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column label="操作">
+            <el-table-column label="操作"   align="center" width="200px">
               <template slot-scope="scope">
                 <el-button
                   size="mini"
                   type="danger"
                   @click.stop.prevent="updateStatus(scope.$index, scope.row)">更新状态</el-button>
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="deletePlan(scope.$index, scope.row)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
@@ -316,6 +320,7 @@
                 <el-dropdown-menu slot="dropdown">
                   <el-dropdown-item @click.native.prevent="handleAddPlan(scope.row)">新增计划</el-dropdown-item>
                   <el-dropdown-item @click.native.prevent="handleEditPlan(scope.row)">修改计划</el-dropdown-item>
+                  <el-dropdown-item @click.native.prevent="handleStopProductionLine(scope.row)">机台状态</el-dropdown-item>
                 </el-dropdown-menu>
               </el-dropdown>
             </template>
@@ -399,12 +404,12 @@
             </el-table-column>
             <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
               <template v-slot:default="scope">
-                <el-select  v-model="scope.row.planStatus" placeholder="请选择业务员" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select  v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column label="操作">
+            <el-table-column label="操作" >
               <template slot-scope="scope">
                 <el-button
                   size="mini"
@@ -416,7 +421,7 @@
           </el-table>
           <el-button type="primary" style="width: 100%;margin-top: 30px"  @click="addEditableRow">新增计划产品</el-button>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="nanInsertDialogTableVisible = false">取 消</el-button>
+            <el-button @click="beiInsertDialogTableVisible = false">取 消</el-button>
             <el-button type="primary" @click="addPlanInfo">确 定</el-button>
            </span>
         </el-dialog>
@@ -436,7 +441,7 @@
             </el-form-item>
             <el-form-item>
               <el-button type="primary" @click="onSubmit">查询</el-button>
-              <el-button>重置</el-button>
+              <el-button @click="reset">重置</el-button>
             </el-form-item>
           </el-form>
           <!--表格-->
@@ -516,31 +521,35 @@
             <el-table-column prop="planStatus" label="计划状态" header-align="center" align="center" width="100px">
               <template v-slot:default="scope">
                 <!--上机变停机待机-->
-                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==1" v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList1" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
                 <!--待机可以上机-->
-                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==0" v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList0" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
                 <!--停机变上机-->
-                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" @change="selectedSalesmanItem(scope.row,scope.row.planStatus)">
+                <el-select v-if="scope.row.planStatus==2" v-model="scope.row.planStatus" placeholder="计划状态" >
                   <el-option v-for="stateItem in stateList2" :key="stateItem.id" :label="stateItem.name" :value="stateItem.id" ></el-option>
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column label="操作">
+            <el-table-column label="操作"  align="center" width="200px">
               <template slot-scope="scope">
                 <el-button
                   size="mini"
                   type="danger"
                   @click.stop.prevent="updateStatus(scope.$index, scope.row)">更新状态</el-button>
+                <el-button
+                  size="mini"
+                  type="danger"
+                  @click.stop.prevent="deletePlan(scope.$index, scope.row)">删除</el-button>
               </template>
             </el-table-column>
           </el-table>
           <span slot="footer" class="dialog-footer">
-            <el-button @click="nanUpdateDialogTableVisible = false">取 消</el-button>
-            <el-button type="primary" @click="nanUpdateDialogTableVisible = false">确 定</el-button>
+            <el-button @click="beiUpdateDialogTableVisible = false">取 消</el-button>
+            <el-button type="primary" @click="beiUpdateDialogTableVisible = false">确 定</el-button>
            </span>
         </el-dialog>
       </el-tab-pane>
@@ -567,11 +576,12 @@
 import {
   ammunitionPlanInfo,
   getProductsInfo,
+  removeBombLoadingPlan,
   getMaterielInfo,
   addMaterielInfo,
   getSalesman,
   getAllPlanListByMachineId,
-  getAllPlanListByProductTypeAndStatus, updatePlanOne
+  getAllPlanListByProductTypeAndStatus, updatePlanOne, whetherTheFeederIsShutDown, updateLineStates
 } from "@/api/plan/paln.js";
 export default {
   data() {
@@ -638,63 +648,171 @@ export default {
     this.getProductsInfo();
   },
   methods: {
+    //删除计划
+    deletePlan($index,row){
+      console.log(row)
+      removeBombLoadingPlan(row.id).then(res=>{
+        if(res.code==200){
+          this.$message({
+            message: '删除成功',
+            type: 'success'
+          });
+        }else{
+          this.$message({message:"删除失败",type: 'error'})
+        }
+        this.onSubmit();
+        this.getAmmunitionPlanInfo();
+      })
+    },
+    //打开修改机台信息
     handleStopProductionLine(row){
       this.modifyMachineStatus=true;
       console.log("停机");
       this.machineId=row.machineId;
+      // this.modifyMachineStatusFrom.type=[];
+      // this.modifyMachineStatusFrom.type.push("1")
+      // this.modifyMachineStatusFrom.type.push("2")
+      //当前操作机台号
+      this.machineId=row.machineId;
+      //查询当前机台A、面B面的状态
+      whetherTheFeederIsShutDown(this.machineId).then(res=>{
+        this.modifyMachineStatusFrom.type=res.data;
+      })
     },
-    confirmStopProductionLine(rwo){
-      if (this.modifyMachineStatusFrom.includes(1)) {
-          console.log('数组中包含数字 1');
-         //新增一条数据,
-         let aStopInfo=   {
-              currentColorCode: '',
-              currentSpecification: '',
-              currentLotNumber: '',
-              currentSpindleCount: '',
-              number: '',
-              productType:'A面',
-              startTime: '',
-              plannedEndTime:'',
-              planStatus:2,
-              productId:'',
-              machineId:this.machineId,
-              salesmanId:'',
-              timestampRandomCode:Date.now()+this.machineId,
-         }
-         let aStoptableList=[];
-        aStoptableList.push(aStopInfo)
-        //时间戳
-        let data={
-          //机台号
-          machineId: this.machineId,
-          timestampRandomCode:Date.now()+this.machineId,
-          //计划信息
-          detailsOfTheRefuelingPlans: aStoptableList
-        }
-        //添加计划信息
-        addMaterielInfo(data).then(response => {
-          if (response.code == 200) {
-            this.$message({
-              message: '添加成功',
-              type: 'success'
-            });
-            this.getAmmunitionPlanInfo();
-            //最后把弹窗关掉
-            this.nanInsertDialogTableVisible=false
-            //更改订单投产信息的批号,
-          } else {
-            this.$message({
-              message: '添加失败',
-              type: 'error'
-            });
-            //最后把弹窗关掉
-            this.nanInsertDialogTableVisible=false
-          }
-        });
-      } else if(this.modifyMachineStatusFrom.includes(2)) {
-         console.log('数组中不包含数字 2');
+    //确认修改产线信息
+    confirmStopProductionLine(){
+      console.log(this.modifyMachineStatusFrom.type);
+      if(this.modifyMachineStatusFrom.type.length==0){
+        this.modifyMachineStatusFrom.type.push("3")
       }
+      //更改状态
+      updateLineStates(this.machineId,this.modifyMachineStatusFrom.type.join(",")).then(res=>{
+        if(res.code==200){
+          this.$message({
+            message: '修改状态成功',
+            type: 'success'
+          });
+        }else{
+          this.$message({message:"修改状态成功",type: 'error'})
+        }
+        this.modifyMachineStatus=false;
+        this.getAmmunitionPlanInfo();
+      })
+      // //如果为空代表都不停机
+      // if(this.modifyMachineStatusFrom.type.length<=0){
+      //   this.modifyMachineStatus=false;
+      //   //发送请求删除,A面-timestampRandomCode="停机" B-timestampRandomCode="停机"的数据、并把所有上机产品的状态改为上机
+      //   return;
+      // }
+      // // 包含1A停机---插入一条 timestampRandomCode=停机,状态为停机的数据
+      // if (this.modifyMachineStatusFrom.type.includes("1")) {
+      //     //查询当前机台A、面B面的状态
+      //     whetherTheFeederIsShutDown(this.machineId).then(res=>{
+      //      //后台没有虚拟的假数据,就插入
+      //      if(!res.data.includes("1")){
+      //        console.log('数组中不包含数字 1');
+      //        //新增一条数据,
+      //        let aStopInfo=   {
+      //          currentColorCode: '1',
+      //          //产品规格
+      //          currentSpecification: '1',
+      //          currentLotNumber: '1',
+      //          currentSpindleCount: '1',
+      //          number: '1',
+      //          productType:'A面',
+      //          startTime: '1',
+      //          plannedEndTime:'1',
+      //          planStatus:2,
+      //          productId:'1',
+      //          machineId:this.machineId,
+      //          salesmanId:'1',
+      //          timestampRandomCode:"停机",
+      //        }
+      //        let aStoptableList=[];
+      //        aStoptableList.push(aStopInfo)
+      //        //时间戳
+      //        let data={
+      //          //机台号
+      //          machineId: this.machineId,
+      //          //计划信息
+      //          detailsOfTheRefuelingPlans: aStoptableList
+      //        }
+      //        //添加计划信息
+      //        addMaterielInfo(data).then(response => {
+      //          if (response.code == 200) {
+      //            this.$message({
+      //              message: '停机成功',
+      //              type: 'success'
+      //            });
+      //            this.getAmmunitionPlanInfo();
+      //            //最后把弹窗关掉
+      //            this.nanInsertDialogTableVisible=false
+      //            //更改订单投产信息的批号,
+      //          } else {
+      //            this.$message({
+      //              message: '停机失败,请联系管理员',
+      //              type: 'error'
+      //            });
+      //            //最后把弹窗关掉
+      //            this.nanInsertDialogTableVisible=false
+      //          }
+      //        });
+      //      }
+      //     })
+      // }
+      // if(this.modifyMachineStatusFrom.type.includes("2")) {
+      //   whetherTheFeederIsShutDown(this.machineId).then(res=>{
+      //     if(!res.data.includes("2")) {
+      //       console.log('数组中不包含数字2');
+      //       //新增一条数据,
+      //       let aStopInfo= {
+      //         currentColorCode: '1',
+      //         //产品规格
+      //         currentSpecification: '1',
+      //         currentLotNumber: '1',
+      //         currentSpindleCount: '1',
+      //         number: '1',
+      //         productType:'B面',
+      //         startTime: '1',
+      //         plannedEndTime:'1',
+      //         planStatus:2,
+      //         productId:'1',
+      //         machineId:this.machineId,
+      //         salesmanId:'1',
+      //         timestampRandomCode:"停机",
+      //       }
+      //       let aStoptableList=[];
+      //       aStoptableList.push(aStopInfo)
+      //       //时间戳
+      //       let data={
+      //         //机台号
+      //         machineId: this.machineId,
+      //         //计划信息
+      //         detailsOfTheRefuelingPlans: aStoptableList
+      //       }
+      //       //添加计划信息
+      //       addMaterielInfo(data).then(response => {
+      //         if (response.code == 200) {
+      //           this.$message({
+      //             message: '停机成功',
+      //             type: 'success'
+      //           });
+      //           this.getAmmunitionPlanInfo();
+      //           //最后把弹窗关掉
+      //           this.nanInsertDialogTableVisible=false
+      //           //更改订单投产信息的批号,
+      //         } else {
+      //           this.$message({
+      //             message: '停机失败,请联系管理员',
+      //             type: 'error'
+      //           });
+      //           //最后把弹窗关掉
+      //           this.nanInsertDialogTableVisible=false
+      //         }
+      //       });
+      //     }
+      //   })
+      // }
     },
     // 查询排产信息
     getAmmunitionPlanInfo() {
@@ -874,18 +992,45 @@ export default {
     },
     // 新增计划产品信息
     handleAddPlan(row) {
-      if(this.selectedWorkshop=="南车间"){
-        this.nanInsertDialogTableVisible = true
-      }else{
-        this.beiInsertDialogTableVisible = true
-      }
-      this.tableData2=[]
-      //先清空
-      this.machineId=""
-      //当前操作机台号
-      this.machineId=row.machineId;
-    },
+      //查询当前机台A、面B面的状态
+      whetherTheFeederIsShutDown(row.machineId).then(res=>{
+        this.modifyMachineStatusFrom.type=res.data;
+        if(this.modifyMachineStatusFrom.type.includes("2")&&this.modifyMachineStatusFrom.type.includes("1")){
+          this.$message({
+            message: 'AB都已停机请更改机台状态',
+            type: 'warning'
+          });
+          return;
+        }else {
+          if(this.modifyMachineStatusFrom.type.includes("1")){
+            this.productTypeList=[]
+            this.productTypeList.push({value:"B面",lable:"B面"})
+          }
+          if(this.modifyMachineStatusFrom.type.includes("2")){
+            this.productTypeList=[]
+            this.productTypeList.push({value:"A面",lable:"A面"})
+          }
+          if(this.modifyMachineStatusFrom.type.length<=0){
+            this.productTypeList=[]
+            this.productTypeList.push({value:"A面",lable:"A面"})
+            this.productTypeList.push({value:"B面",lable:"B面"})
+          }
+          //否则就打开弹窗添加计划
+          if(this.selectedWorkshop=="南车间"){
+            this.nanInsertDialogTableVisible = true
+          }else{
+            this.beiInsertDialogTableVisible = true
+          }
+          this.tableData2=[]
+          //先清空
+          this.machineId=""
+          //当前操作机台号
+          this.machineId=row.machineId;
+        }
+      })
 
+
+    },
     // tab栏点击切换
     tabClick(tab, event) {
       // console.log('当前点击的标签名称:', tab.name);
@@ -984,6 +1129,13 @@ export default {
     },
     // 添加计划
     addPlanInfo(){
+      if(this.tableData2.length<=0){
+        this.$message({
+          message: '请先添加表格数据',
+          type: 'warning'
+        });
+        return;
+      }
       const datatime=Date.now()+this.machineId;
       //处理表格数据
       this.tableData2.forEach(item=>{
@@ -1029,7 +1181,10 @@ export default {
       }else{
         this.beiUpdateDialogTableVisible = true
       }
-      this.tableData2=[];
+      //先清空
+      this.machineId=""
+      //当前操作机台号
+      this.machineId=row.machineId;
       getAllPlanListByMachineId(row.machineId).then((response) => {
         //得到生产中,停产的,待产的
         response.data.forEach(item => {
@@ -1054,8 +1209,41 @@ export default {
 
         });
       })
+    },
+    //重置按钮
+    reset(){
+      this.tableData2=[];
+      //弹窗
+      if(this.selectedWorkshop=="南车间"){
+        this.nanUpdateDialogTableVisible = true
+      }else{
+        this.beiUpdateDialogTableVisible = true
+      }
+      console.log(this.machineId,"dddd")
+      getAllPlanListByMachineId(this.machineId).then((response) => {
+        //得到生产中,停产的,待产的
+        response.data.forEach(item => {
+          item.isEditing=false;
+          item.planStatus=parseInt(item.planStatus);
+          item.productId=parseInt(item.productId)
+        })
+        this.tableData2=response.data;
+        // console.log( this.tableData2)
+        // 在数据加载完成后,手动触发每个行的第一个下拉框的 change 事件
+        this.$nextTick(() => {
+          // 获取第一个业务员选择框(假设表格只有一行)
+          for (let i = 0; i < this.tableData2.length; i++) {
+            const firstSalesmanSelect = this.$refs['salesmanSelect'+i];
+            // 触发 change 事件
+            if (firstSalesmanSelect) {
+              firstSalesmanSelect.$emit('change', {
+                target: {value: "ddd"},
+              });
+            }
+          }
 
-
+        });
+      })
     },
     //弹窗里边的点击查询
     onSubmit(){