소스 검색

feat:更新状态按照销售产品id,和订单号更新

hmc 1 년 전
부모
커밋
ebb251f03f

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

@@ -134,6 +134,7 @@ public class DetailsOfTheRefuelingPlanServiceImpl implements IDetailsOfTheRefuel
             detailsOfTheRefuelingPlan.setPlanStatus("3");
         }
         saleProducts.setSaleOrderNo(detailsOfTheRefuelingPlan.getSalesmanId());//合同号
+        saleProducts.setId(Long.valueOf(detailsOfTheRefuelingPlan.getProductId()));//产品iD
         saleProducts.setOnBoardState(detailsOfTheRefuelingPlan.getPlanStatus());//更新上机状态
         saleProducts.setProductionLineNo(detailsOfTheRefuelingPlan.getMacId());//产线号
         //修改产品上机状态

+ 13 - 15
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/DetailsOfTheRefuelingPlanSpinningServiceImpl.java

@@ -208,6 +208,7 @@ public class DetailsOfTheRefuelingPlanSpinningServiceImpl implements IDetailsOfT
             detailsOfTheRefuelingPlanSpinning.setPlanStatus("3");
         }
         saleProducts.setSaleOrderNo(detailsOfTheRefuelingPlanSpinning.getSalesmanId());//合同号
+        saleProducts.setId(Long.valueOf(detailsOfTheRefuelingPlanSpinning.getProductId()));//产品id
         saleProducts.setOnBoardState(detailsOfTheRefuelingPlanSpinning.getPlanStatus());//更新上机状态
         saleProducts.setProductNumber(Double.valueOf(detailsOfTheRefuelingPlanSpinning.getNumber()));//数量
         //插入日志信息
@@ -284,24 +285,20 @@ public class DetailsOfTheRefuelingPlanSpinningServiceImpl implements IDetailsOfT
             saleProducts.setId(Long.valueOf(item.getProductId()));
             saleProducts.setProductionLineNo(item.getMacId());//产线iD
             saleProducts.setLotNumber(item.getCurrentLotNumber().toString());//批号
-            if(item.getPlanStatus().equals("待机")){
-                item.setPlanStatus("0");
-            }
-            if(item.getPlanStatus().equals("上机")){
-                item.setPlanStatus("1");
-            }
-            if(item.getPlanStatus().equals("停机")){
-                item.setPlanStatus("2");
-            }
-            if(item.getPlanStatus().equals("完成")){
-                item.setPlanStatus("3");
+            if(item.getPlanStatus().equals("1")){
+                //产品对应的信息
+                SaleProducts saleProducts1 = saleProductsMapper.selectSaleProductsById(Long.valueOf(item.getProductId()));
+                item.setProductTypeName(saleProducts1.getProductName());
+                saleProductsList.add(saleProducts);
             }
             saleProducts.setOnBoardState(item.getPlanStatus());//状态信息
             saleProducts.setProductNumber(Double.valueOf(item.getNumber()));//数量
-            //产品对应的信息
-            SaleProducts saleProducts1 = saleProductsMapper.selectSaleProductsById(Long.valueOf(item.getProductId()));
-            item.setProductTypeName(saleProducts1.getProductName());
-            saleProductsList.add(saleProducts);
+            if(saleProductsList.size()<=0){
+                //产品对应的信息
+                SaleProducts saleProducts1 = saleProductsMapper.selectSaleProductsById(Long.valueOf(item.getProductId()));
+                item.setProductTypeName(saleProducts1.getProductName());
+                saleProductsList.add(saleProducts);
+            }
             DetailsOfTheRefuelingPlanSpinningLogs detailsOfTheRefuelingPlanSpinningLogs=new DetailsOfTheRefuelingPlanSpinningLogs();
             BeanUtils.copyProperties(item,detailsOfTheRefuelingPlanSpinningLogs);
             detailsOfTheRefuelingPlanSpinningLogs.setCreateBy(SecurityUtils.getUsername());
@@ -311,6 +308,7 @@ public class DetailsOfTheRefuelingPlanSpinningServiceImpl implements IDetailsOfT
             detailsOfTheRefuelingPlanSpinningLogs.setOrderId(item.getSalesmanId());//订单
             detailsOfTheRefuelingPlanSpinningLogs.setOperation("0");
             detailsOfTheRefuelingPlanSpinningLogsMapper.insertDetailsOfTheRefuelingPlanSpinningLogs(detailsOfTheRefuelingPlanSpinningLogs);
+
         });
         //更新产线
         int i2 = saleProductsMapper.updateSaleProductBatch(saleProductsList);

+ 1 - 1
zkqy-custom-business/src/main/resources/mapper/business/SaleProductsMapper.xml

@@ -284,7 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="lotNumber != null">lot_number = #{lotNumber},</if>
             <if test="onBoardState != null">on_board_state = #{onBoardState},</if>
         </trim>
-        where sale_order_no = #{saleOrderNo}
+        where sale_order_no = #{saleOrderNo} and id=#{id}
     </update>
 
     <delete id="deleteSaleProductsById" parameterType="Long">

+ 105 - 59
zkqy-ui/src/views/orderMange/planTable/fangsi.vue

@@ -402,48 +402,48 @@ export default {
     },
     // 点击编辑行
     handleRowClick(row) {
-      this.isEditLine = true;
-      //找到当前行的编辑索引
-      var rowIndex = this.tableData2.indexOf(row);
-      console.log(rowIndex)
-      if (this.lastEditLine != 0 &&
-        this.editingRowIndex !== rowIndex &&
-        this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
-        this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
-        });
-        return;
-      }
-      //编辑索引不等于当前编辑行索引
-      if (this.editingRowIndex !== rowIndex) {
-        // alert(this.editingRowIndex);
-        if (this.editingRowIndex !== -1) {
-          //把当前行变成不可编辑的
-          this.tableData2[this.editingRowIndex].isEditing = false;
-        }
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }else {
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }
+      // this.isEditLine = true;
+      // //找到当前行的编辑索引
+      // var rowIndex = this.tableData2.indexOf(row);
+      // console.log(rowIndex)
+      // if (this.lastEditLine != 0 &&
+      //   this.editingRowIndex !== rowIndex &&
+      //   this.editingRowIndex !== -1 &&
+      //   !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+      //   this.$message({
+      //     message: '请先完成上一条数据的填写',
+      //     type: 'warning'
+      //   });
+      //   return;
+      // }
+      // //编辑索引不等于当前编辑行索引
+      // if (this.editingRowIndex !== rowIndex) {
+      //   // alert(this.editingRowIndex);
+      //   if (this.editingRowIndex !== -1) {
+      //     //把当前行变成不可编辑的
+      //     this.tableData2[this.editingRowIndex].isEditing = false;
+      //   }
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }else {
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }
 
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
-      let rowIndex = this.tableData2.indexOf(row);
-      //编辑索引不等于当前编辑行索引
-      if(row.isEditing="true"){
-        row.isEditing = false;
-        //对于整个表格来说
-        this.isEditLine = false;
-        //当前编辑行置为-1
-        this.editingRowIndex = -1;
-      }
+      // let rowIndex = this.tableData2.indexOf(row);
+      // //编辑索引不等于当前编辑行索引
+      // if(row.isEditing="true"){
+      //   row.isEditing = false;
+      //   //对于整个表格来说
+      //   this.isEditLine = false;
+      //   //当前编辑行置为-1
+      //   this.editingRowIndex = -1;
+      // }
       // if (this.editingRowIndex !== rowIndex) {
       //   if (this.isRowFilled(row)) {
       //     row.isEditing = false;
@@ -476,10 +476,10 @@ export default {
           });
           return;
         }
-        //新增行之前先让以前的行不能编辑
-        this.tableData2.forEach(item => {
-          item.isEditing = false;
-        })
+        // //新增行之前先让以前的行不能编辑
+        // this.tableData2.forEach(item => {
+        //   item.isEditing = false;
+        // })
       }
       this.tableData2.push({
         currentColorCode: '',
@@ -514,21 +514,28 @@ export default {
         return ;
       }
       const datatime=Date.now()+this.machineId;
+      let i=0
+      //处理表格数据
+      this.tableData2.forEach(item=>{
+        item.timestampRandomCode=datatime;
+        item.macId=this.macId;
+        item.machineId=this.machineId;
+        if(item.planStatus==1){
+          i++
+        }
+      })
+      if(i>=2){
+        this.$message({
+          message: '不能同时添加俩上机计划',
+          type: 'warning'
+        });
+        return;
+      }
       //先查询计划表中有没有正在上机的
       getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
-          let i=0
-          //处理表格数据
-          this.tableData2.forEach(item=>{
-            item.timestampRandomCode=datatime;
-            item.macId=this.macId;
-            item.machineId=this.machineId;
-            if(item.planStatus==1){
-              i++
-            }
-          })
           if(i>=1&&response.data.length>0){
             this.$message({
-              message: '只能有一个产品的状态为上机',
+              message: '当前产线已有上机产品',
               type: 'warning'
             });
             return;
@@ -607,20 +614,60 @@ export default {
     // 更新状态
     updateStatus(ind, row){
       row.planType="纺丝计划"
-      console.log(row,"当前行数据---------------------------")
       if(!this.isRowFilled(row)){
         this.$message({message: '请完善当前行数据', type: 'warning'});
         return;
       }
-      // if(row.planType="")
+      if(row.planStatus=="2"){
+        //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
+        getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
+          if(response.data.length>0) {
+            this.$message({message: '已有停机产品不能在停机', type: 'warning'});
+            return;//证明有在上级的产品--zhi能有一个上级产品
+          }else {
+            getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
+              if(response.data.length>0){
+                this.$message({message: '已有一个其他产品正在上机,不能在停机,如需要停机,请停机在机产品', type: 'warning'});
+                return;//证明有在上级的产品--zhi能有一个上级产品
+              }else {
+                updateSpinningInfoPlanOne(row).then(response=>{
+                  if (response.code == 200) {
+                    this.$message({
+                      message: '修改成功',
+                      type: 'success'
+                    });
+                    this.getSpinningPlanList();
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  } else {
+                    this.$message({
+                      message: '修改失败',
+                      type: 'error'
+                    });
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  }
+                })
+              }
+            })
+          }
+        });
+        return;
+      }
+
       //判断当前计划是否已经投产
       getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
         if(resp.data.length>0){
           this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
+
           return;//证明有在上级的产品--zhi能有一个上级产品
         }
         //不等于0待机才去校验是否重复
-        if(row.planStatus!=0){
+        if(row.planStatus!=0){//上机/停机校验是否重复
+          if(resp.data.length>0){
+            this.$message({message: '当前计划订单产品在生产中已经不能修改', type: 'warning'});
+            return;//证明有在上级的产品--zhi能有一个上级产品
+          }
           //先查询计划表中有没有正在上机的或者停机的
           getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
             if(response.data.length>0){
@@ -628,7 +675,7 @@ export default {
                 this.$message({message: '只能有一个产品的状态为上机', type: 'warning'});
                 return;//证明有在上级的产品--zhi能有一个上级产品
               }else {
-                this.$message({message: '已停机不能在停机', type: 'warning'});
+                this.$message({message: '已停机产品不能在停机', type: 'warning'});
                 return;//证明有在上级的产品--zhi能有一个上级产品
               }
             }else {
@@ -638,7 +685,6 @@ export default {
                     this.$message({message: '已停机,请先处理停机产品,然后上机', type: 'warning'});
                     return;//证明有在上级的产品--zhi能有一个上级产品
                   }else {
-                      row.playType="纺丝计划"
                       updateSpinningInfoPlanOne(row).then(response=>{
                         if (response.code == 200) {
                           this.$message({
@@ -710,8 +756,8 @@ export default {
             }
           })
         }
-
       })
+
     }
   }
 }

+ 91 - 48
zkqy-ui/src/views/orderMange/planTable/fankuang.vue

@@ -402,48 +402,48 @@ export default {
     },
     // 点击编辑行
     handleRowClick(row) {
-      this.isEditLine = true;
-      //找到当前行的编辑索引
-      var rowIndex = this.tableData2.indexOf(row);
-      console.log(rowIndex)
-      if (this.lastEditLine != 0 &&
-        this.editingRowIndex !== rowIndex &&
-        this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
-        this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
-        });
-        return;
-      }
-      //编辑索引不等于当前编辑行索引
-      if (this.editingRowIndex !== rowIndex) {
-        // alert(this.editingRowIndex);
-        if (this.editingRowIndex !== -1) {
-          //把当前行变成不可编辑的
-          this.tableData2[this.editingRowIndex].isEditing = false;
-        }
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }else {
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }
+      // this.isEditLine = true;
+      // //找到当前行的编辑索引
+      // var rowIndex = this.tableData2.indexOf(row);
+      // console.log(rowIndex)
+      // if (this.lastEditLine != 0 &&
+      //   this.editingRowIndex !== rowIndex &&
+      //   this.editingRowIndex !== -1 &&
+      //   !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+      //   this.$message({
+      //     message: '请先完成上一条数据的填写',
+      //     type: 'warning'
+      //   });
+      //   return;
+      // }
+      // //编辑索引不等于当前编辑行索引
+      // if (this.editingRowIndex !== rowIndex) {
+      //   // alert(this.editingRowIndex);
+      //   if (this.editingRowIndex !== -1) {
+      //     //把当前行变成不可编辑的
+      //     this.tableData2[this.editingRowIndex].isEditing = false;
+      //   }
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }else {
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }
 
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
-      let rowIndex = this.tableData2.indexOf(row);
-      //编辑索引不等于当前编辑行索引
-      if(row.isEditing="true"){
-        row.isEditing = false;
-        //对于整个表格来说
-        this.isEditLine = false;
-        //当前编辑行置为-1
-        this.editingRowIndex = -1;
-      }
+      // let rowIndex = this.tableData2.indexOf(row);
+      // //编辑索引不等于当前编辑行索引
+      // if(row.isEditing="true"){
+      //   row.isEditing = false;
+      //   //对于整个表格来说
+      //   this.isEditLine = false;
+      //   //当前编辑行置为-1
+      //   this.editingRowIndex = -1;
+      // }
       //编辑索引不等于当前编辑行索引
       // if (this.editingRowIndex !== rowIndex) {
       //   if (this.isRowFilled(row)) {
@@ -515,18 +515,25 @@ export default {
         return ;
       }
       const datatime=Date.now()+this.machineId;
+      let i=0
+      //处理表格数据
+      this.tableData2.forEach(item=>{
+        item.timestampRandomCode=datatime;
+        item.macId=this.macId;
+        item.machineId=this.machineId;
+        if(item.planStatus==1){
+          i++
+        }
+      })
+      if(i>=2){
+        this.$message({
+          message: '不能同时添加俩上机计划',
+          type: 'warning'
+        });
+        return;
+      }
       //先查询计划表中有没有正在上机的
       getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
-        let i=0
-        //处理表格数据
-        this.tableData2.forEach(item=>{
-          item.timestampRandomCode=datatime;
-          item.macId=this.macId;
-          item.machineId=this.machineId;
-          if(item.planStatus==1){
-            i++
-          }
-        })
         if(i>=1&&response.data.length>0){
           this.$message({
             message: '只能有一个产品的状态为上机',
@@ -612,6 +619,42 @@ export default {
         this.$message({message: '请完善当前行数据', type: 'warning'});
         return;
       }
+      if(row.planStatus=="2"){
+        //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
+        getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
+          if(response.data.length>0) {
+            this.$message({message: '已有停机产品不能在停机', type: 'warning'});
+            return;//证明有在上级的产品--只能有一个上级或者停机的产品
+          }else {
+            getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
+              if(response.data.length>0){
+                this.$message({message: '已有一个其他产品正在上机,不能在停机,如需要停机,请停机在机产品', type: 'warning'});
+                return;//证明有在上级的产品--zhi能有一个上级产品
+              }else {
+                updateSpinningInfoPlanOne(row).then(response=>{
+                  if (response.code == 200) {
+                    this.$message({
+                      message: '修改成功',
+                      type: 'success'
+                    });
+                    this.getSpinningPlanList();
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  } else {
+                    this.$message({
+                      message: '修改失败',
+                      type: 'error'
+                    });
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  }
+                })
+              }
+            })
+          }
+        });
+        return;
+      }
       //判断当前计划是否已经投产
       getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
         if(resp.data.length>0){

+ 41 - 38
zkqy-ui/src/views/orderMange/planTable/index.vue

@@ -563,7 +563,10 @@ import {
   updatePlanOne,
   whetherTheFeederIsShutDown,
   updateLineStates,
-  getIsTheOrderProductProduced, getJtIsTheOrderProductProduced
+  getIsTheOrderProductProduced,
+  getJtIsTheOrderProductProduced,
+  getCurrentProductionLineSuperior,
+  updateSpinningInfoPlanOne
 } from "@/api/plan/paln.js";
 export default {
   data() {
@@ -1022,47 +1025,47 @@ export default {
     },
     // 点击编辑行
     handleRowClick(row) {
-      this.isEditLine = true;
-      // alert(this.lastEditLine+"编辑行")
-      //找到当前行的编辑索引
-      var rowIndex = this.tableData2.indexOf(row);
-
-      if (this.lastEditLine != 0 &&
-        this.editingRowIndex !== rowIndex &&
-        this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
-        this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
-        });
-        return;
-      }
-      //编辑索引不等于当前编辑行索引
-      if (this.editingRowIndex !== rowIndex) {
-        // alert(this.editingRowIndex);
-        if (this.editingRowIndex !== -1) {
-          //把当前行变成不可编辑的
-          this.tableData2[this.editingRowIndex].isEditing = false;
-        }
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }
+      // this.isEditLine = true;
+      // // alert(this.lastEditLine+"编辑行")
+      // //找到当前行的编辑索引
+      // var rowIndex = this.tableData2.indexOf(row);
+      //
+      // if (this.lastEditLine != 0 &&
+      //   this.editingRowIndex !== rowIndex &&
+      //   this.editingRowIndex !== -1 &&
+      //   !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+      //   this.$message({
+      //     message: '请先完成上一条数据的填写',
+      //     type: 'warning'
+      //   });
+      //   return;
+      // }
+      // //编辑索引不等于当前编辑行索引
+      // if (this.editingRowIndex !== rowIndex) {
+      //   // alert(this.editingRowIndex);
+      //   if (this.editingRowIndex !== -1) {
+      //     //把当前行变成不可编辑的
+      //     this.tableData2[this.editingRowIndex].isEditing = false;
+      //   }
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }
 
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
-      let rowIndex = this.tableData2.indexOf(row);
-      //编辑索引不等于当前编辑行索引
-      if (this.editingRowIndex !== rowIndex) {
-        if (this.isRowFilled(row)) {
-          row.isEditing = false;
-          //对于整个表格来说
-          this.isEditLine = false;
-          //当前编辑行置为-1
-          this.editingRowIndex = -1;
-        }
-      }
+      // let rowIndex = this.tableData2.indexOf(row);
+      // //编辑索引不等于当前编辑行索引
+      // if (this.editingRowIndex !== rowIndex) {
+      //   if (this.isRowFilled(row)) {
+      //     row.isEditing = false;
+      //     //对于整个表格来说
+      //     this.isEditLine = false;
+      //     //当前编辑行置为-1
+      //     this.editingRowIndex = -1;
+      //   }
+      // }
     },
     // 检查行是否填写完毕的示例方法
     isRowFilled(row) {

+ 90 - 49
zkqy-ui/src/views/orderMange/planTable/luotong.vue

@@ -402,48 +402,48 @@ export default {
     },
     // 点击编辑行
     handleRowClick(row) {
-      this.isEditLine = true;
-      //找到当前行的编辑索引
-      var rowIndex = this.tableData2.indexOf(row);
-      console.log(rowIndex)
-      if (this.lastEditLine != 0 &&
-        this.editingRowIndex !== rowIndex &&
-        this.editingRowIndex !== -1 &&
-        !this.isRowFilled(this.tableData2[this.lastEditLine])) {
-        this.$message({
-          message: '请先完成上一条数据的填写',
-          type: 'warning'
-        });
-        return;
-      }
-      //编辑索引不等于当前编辑行索引
-      if (this.editingRowIndex !== rowIndex) {
-        // alert(this.editingRowIndex);
-        if (this.editingRowIndex !== -1) {
-          //把当前行变成不可编辑的
-          this.tableData2[this.editingRowIndex].isEditing = false;
-        }
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }else {
-        //把当前行变成可编辑的
-        row.isEditing = true;
-        this.editingRowIndex = rowIndex;
-      }
+      // this.isEditLine = true;
+      // //找到当前行的编辑索引
+      // var rowIndex = this.tableData2.indexOf(row);
+      // console.log(rowIndex)
+      // if (this.lastEditLine != 0 &&
+      //   this.editingRowIndex !== rowIndex &&
+      //   this.editingRowIndex !== -1 &&
+      //   !this.isRowFilled(this.tableData2[this.lastEditLine])) {
+      //   this.$message({
+      //     message: '请先完成上一条数据的填写',
+      //     type: 'warning'
+      //   });
+      //   return;
+      // }
+      // //编辑索引不等于当前编辑行索引
+      // if (this.editingRowIndex !== rowIndex) {
+      //   // alert(this.editingRowIndex);
+      //   if (this.editingRowIndex !== -1) {
+      //     //把当前行变成不可编辑的
+      //     this.tableData2[this.editingRowIndex].isEditing = false;
+      //   }
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }else {
+      //   //把当前行变成可编辑的
+      //   row.isEditing = true;
+      //   this.editingRowIndex = rowIndex;
+      // }
 
     },
     // 光标失去焦点变成不可编辑
     handleInputBlur(row) {
-      let rowIndex = this.tableData2.indexOf(row);
-      //编辑索引不等于当前编辑行索引
-      if(row.isEditing="true"){
-        row.isEditing = false;
-        //对于整个表格来说
-        this.isEditLine = false;
-        //当前编辑行置为-1
-        this.editingRowIndex = -1;
-      }
+      // let rowIndex = this.tableData2.indexOf(row);
+      // //编辑索引不等于当前编辑行索引
+      // if(row.isEditing="true"){
+      //   row.isEditing = false;
+      //   //对于整个表格来说
+      //   this.isEditLine = false;
+      //   //当前编辑行置为-1
+      //   this.editingRowIndex = -1;
+      // }
       //编辑索引不等于当前编辑行索引
       // if (this.editingRowIndex !== rowIndex) {
       //   if (this.isRowFilled(row)) {
@@ -514,19 +514,24 @@ export default {
         this.$message({message: '请完善表格行数据', type: 'warning'});
         return ;
       }
-      const datatime=Date.now()+this.machineId;
+      //处理表格数据
+      this.tableData2.forEach(item=>{
+        item.timestampRandomCode=datatime;
+        item.macId=this.macId;
+        item.machineId=this.machineId;
+        if(item.planStatus==1){
+          i++
+        }
+      })
+      if(i>=2){
+        this.$message({
+          message: '不能同时添加俩上机计划',
+          type: 'warning'
+        });
+        return;
+      }
       //先查询计划表中有没有正在上机的
       getPlanSpinningInfo({"machineId":this.machineId,"macId":this.macId,"planStatus":1}).then(response => {
-        let i=0
-        //处理表格数据
-        this.tableData2.forEach(item=>{
-          item.timestampRandomCode=datatime;
-          item.macId=this.macId;
-          item.machineId=this.machineId;
-          if(item.planStatus==1){
-            i++
-          }
-        })
         if(i>=1&&response.data.length>0){
           this.$message({
             message: '只能有一个产品的状态为上机',
@@ -612,6 +617,42 @@ export default {
         this.$message({message: '请完善当前行数据', type: 'warning'});
         return;
       }
+      if(row.planStatus=="2"){
+        //如果说我要去停机一个产品我只需要去鉴别你这个产线上有没有停机或者上其他上机的产品
+        getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":row.planStatus}).then(response => {
+          if(response.data.length>0) {
+            this.$message({message: '已有停机产品不能在停机', type: 'warning'});
+            return;//证明有在上级的产品--只能有一个上级或者停机的产品
+          }else {
+            getCurrentProductionLineSuperior({"id":row.id,"macId":row.macId,"planStatus":"1"}).then(response => {
+              if(response.data.length>0){
+                this.$message({message: '已有一个其他产品正在上机,不能在停机,如需要停机,请停机在机产品', type: 'warning'});
+                return;//证明有在上级的产品--zhi能有一个上级产品
+              }else {
+                updateSpinningInfoPlanOne(row).then(response=>{
+                  if (response.code == 200) {
+                    this.$message({
+                      message: '修改成功',
+                      type: 'success'
+                    });
+                    this.getSpinningPlanList();
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  } else {
+                    this.$message({
+                      message: '修改失败',
+                      type: 'error'
+                    });
+                    //最后把弹窗关掉
+                    this.nanInsertDialogTableVisible=false
+                  }
+                })
+              }
+            })
+          }
+        });
+        return;
+      }
       //判断当前计划是否已经投产
       getIsTheOrderProductProduced({"id":row.id}).then(resp=>{
         if(resp.data.length>0){