From b773030f37dc06a92bdb80e8af9a408843d5b317 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期五, 15 三月 2024 16:47:43 +0800
Subject: [PATCH] 操作看板

---
 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java            |    5 +
 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java |   40 +++++++++
 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java         |   13 +++
 jcdm-ui/src/views/main/kb/stationTerminal/index.vue                                                   |   79 ++++++++++---------
 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java    |   35 ++++++--
 jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java                  |    2 
 jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js                                                  |   10 ++
 jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml                      |   25 ++++--
 8 files changed, 149 insertions(+), 60 deletions(-)

diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
index 7842101..a065715 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -47,19 +47,27 @@
             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
             formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
+            if(formulaChildInfo.getCollectData()!=null&& !"".equals(formulaChildInfo.getCollectData())){
+                if(formulaChildInfo.getCollectData().contains("[")){
+                    String data = formulaChildInfo.getCollectData();
+                    data = data.replace("[", "").replace("]", "").replace(" ", "");
+                    String[] tightenDataParts = data.split(",");
+                    formulaChildInfo.setCollectData("鎵煩"+tightenDataParts[0]+"瑙掑害"+tightenDataParts[1]+"鎵煩缁撴灉"+tightenDataParts[2]+"瑙掑害缁撴灉"+tightenDataParts[3]);
+                }
+            }
         }
         return getDataTable(list);
     }
 
-    /**
-     * 妫�鏌ユ槸鍚﹀彲浠ユ斁琛�
-     */
-    @GetMapping("/releaseCheck")
-    public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
-    {
-        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
-        return AjaxResult.success(i.size());
-    }
+//    /**
+//     * 妫�鏌ユ槸鍚﹀彲浠ユ斁琛�
+//     */
+//    @GetMapping("/releaseCheck")
+//    public AjaxResult releaseCheck(BsFormulaChildInfo bsFormulaChildInfo)
+//    {
+//        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck(bsFormulaChildInfo);
+//        return AjaxResult.success(i.size());
+//    }
 
     /**
      * 鎵爜纭
@@ -80,6 +88,15 @@
     }
 
     /**
+     * 鎷х揣鍚庢洿鏂板搴旀暟鎹�
+     */
+    @GetMapping("/updateTighteningFormula")
+    public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo)
+    {
+        return bsFormulaChildInfoService.updateTighteningFormula(bsFormulaChildInfo);
+    }
+
+    /**
      * 瀵煎嚭閰嶆柟閰嶇疆瀛愪俊鎭垪琛�
      */
     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java
index b2fec38..fd8207b 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java
@@ -122,7 +122,9 @@
 
     private String sfcBarcode;
 
+    private String tightenTheArray;
 
+    private Integer counts;
 
     public String getParamName() {
         return paramName;
diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java
index 695115c..8d4eb4c 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java
@@ -2,6 +2,7 @@
 
 import java.util.List;
 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
+import org.springframework.data.repository.query.Param;
 
 /**
  * 閰嶆柟閰嶇疆瀛愪俊鎭疢apper鎺ュ彛
@@ -61,7 +62,9 @@
 
     BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(BsFormulaChildInfo bsFormulaChildInfo);
 
-    List<BsFormulaChildInfo> releaseCheck(BsFormulaChildInfo bsFormulaChildInfo);
+    BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo);
 
     void workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo);
+
+    BsFormulaChildInfo getCount(BsFormulaChildInfo info);
 }
diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java
index 5c85566..ac3573b 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java
@@ -4,6 +4,7 @@
 
 import com.jcdm.common.core.domain.AjaxResult;
 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
+import org.springframework.data.repository.query.Param;
 
 /**
  * 閰嶆柟閰嶇疆瀛愪俊鎭疭ervice鎺ュ彛
@@ -63,9 +64,19 @@
 
     public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode);
 
-    List<BsFormulaChildInfo> releaseCheck(BsFormulaChildInfo bsFormulaChildInfo);
+    BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo);
 
     AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo);
 
     AjaxResult workpieceRelease(BsFormulaChildInfo bsFormulaChildInfo);
+
+    AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo);
+
+    public BsFormulaChildInfo getCount(String productCode,String processesCode);
+
+
+
+
+
+
 }
diff --git a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
index 584ba79..3081f83 100644
--- a/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
+++ b/jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -7,6 +7,7 @@
 import com.jcdm.common.utils.DateUtils;
 import com.jcdm.main.da.paramCollection.domain.DaParamCollection;
 import com.jcdm.main.da.paramCollection.mapper.DaParamCollectionMapper;
+import org.aspectj.weaver.loadtime.Aj;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.jcdm.main.bs.formulaChild.mapper.BsFormulaChildInfoMapper;
@@ -112,12 +113,23 @@
     }
 
     @Override
-    public List<BsFormulaChildInfo> releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) {
+    public BsFormulaChildInfo getCount(String productCode, String processesCode) {
+        BsFormulaChildInfo info = new BsFormulaChildInfo();
+        info.setProcessesCode(processesCode);
+        info.setProductCode(productCode);
+        return bsFormulaChildInfoMapper.getCount(info);
+    }
+
+    @Override
+    public BsFormulaChildInfo releaseCheck(BsFormulaChildInfo bsFormulaChildInfo) {
         return bsFormulaChildInfoMapper.releaseCheck(bsFormulaChildInfo);
     }
 
     @Override
     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) {
+        BsFormulaChildInfo checkInfo = new BsFormulaChildInfo();
+        checkInfo.setProcessesCode(bsFormulaChildInfo.getLocationCode());
+        checkInfo.setProductCode(bsFormulaChildInfo.getProductCode());
         bsFormulaChildInfo.setMaterialCode(bsFormulaChildInfo.getScanBarcode().substring(1,2));
         List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
         if(bsFormulaChildInfos.size()>0){
@@ -127,6 +139,8 @@
             bsFormulaChildInfo.setParamCode(bsFormulaChildInfos.get(0).getParamCode());
             bsFormulaChildInfo.setSfcBarcode(bsFormulaChildInfo.getSfcBarcode());
             addParameterCollection(bsFormulaChildInfo);
+//            BsFormulaChildInfo count = bsFormulaChildInfoMapper.getCount(checkInfo);
+//            Integer i = count.getCounts();
         }else {
             return AjaxResult.error("闈炴湰宸ヤ綅鐗╂枡锛岃閲嶆柊鎵弿");
         }
@@ -150,4 +164,28 @@
         bsFormulaChildInfoMapper.workpieceRelease(bsFormulaChildInfo);
         return AjaxResult.success();
     }
+
+    @Override
+    public AjaxResult updateTighteningFormula(BsFormulaChildInfo bsFormulaChildInfo) {
+        BsFormulaChildInfo listQuery = new BsFormulaChildInfo();
+        listQuery.setParamCode(bsFormulaChildInfo.getParamCode());
+        String paramCode = bsFormulaChildInfo.getTightenTheArray();
+        if(paramCode.contains("N")){
+            List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery);
+            bsFormulaChildInfos.get(0).setResults("NG");
+            bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
+            bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
+            return AjaxResult.error("鎵弿缁撴灉NG,璇烽噸鏂版壂鎻忥紒");
+        }else {
+            List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(listQuery);
+            bsFormulaChildInfos.get(0).setResults("OK");
+            bsFormulaChildInfos.get(0).setCollectData(bsFormulaChildInfo.getTightenTheArray());
+            bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
+        }
+        return AjaxResult.success("鎵弿鎴愬姛锛�");
+    }
+
+
+
+
 }
diff --git a/jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml b/jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml
index 750f29a..e274ea8 100644
--- a/jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml
+++ b/jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml
@@ -29,6 +29,8 @@
         <result property="spareField4"    column="spare_field_4"    />
         <result property="collectData"    column="collect_data"    />
         <result property="results"    column="results"    />
+        <result property="counts"    column="counts"    />
+
     </resultMap>
 
     <sql id="selectBsFormulaChildInfoVo">
@@ -47,6 +49,8 @@
             <if test="collectData != null  and collectData != ''"> and collect_data = #{collectData}</if>
             <if test="results != null  and result != ''"> and result = #{results}</if>
             <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
+            <if test="paramCode != null  and paramCode != ''"> and param_code = #{paramCode}</if>
+
 
         </where>
         ORDER BY step_sort ASC
@@ -174,15 +178,18 @@
         ORDER BY step_sort ASC
     </select>
 
-    <select id="releaseCheck" resultMap="BsFormulaChildInfoResult" parameterType="BsFormulaChildInfo">
-        SELECT
-            *
-        FROM
-            bs_formula_child_info
-        WHERE
-            NOT results = 'OK'
-          AND product_code = #{productCode}
-          AND processes_code = #{processesCode};
+    <select id="getCount" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
+        SELECT COUNT(*) AS counts
+        FROM bs_formula_child_info
+        WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
+          AND (results IS NULL OR results = '');
+    </select>
+
+    <select id="releaseCheck" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
+        SELECT COUNT(*) AS counts
+        FROM bs_formula_child_info
+        WHERE (processes_code = #{processesCode} AND product_code = #{productCode})
+          AND (results IS NULL OR results = '');
     </select>
 
     <update id="workpieceRelease" parameterType="BsFormulaChildInfo">
diff --git a/jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js b/jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js
index ff841b7..9ed8494 100644
--- a/jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js
+++ b/jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js
@@ -38,6 +38,16 @@
   })
 }
 
+// 鏌ヨ閰嶆柟閰嶇疆瀛愪俊鎭垪琛�
+export function updateTighteningFormula(query) {
+  return request({
+    url: '/bs/formulaChild/updateTighteningFormula',
+    method: 'get',
+    params: query
+
+  })
+}
+
 // 鏌ヨ閰嶆柟閰嶇疆瀛愪俊鎭缁�
 export function getFormulaChild(id) {
   return request({
diff --git a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
index 0f16945..55e2968 100644
--- a/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
+++ b/jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -111,11 +111,11 @@
                </el-table-column>
                <el-table-column label="鎿嶄綔鍐呭" :show-overflow-tooltip='true' align="center" prop="operationSteps">
                </el-table-column>
-               <el-table-column label="浜у搧缂栧彿" width="150" align="center" prop="productCode">
+               <el-table-column label="浜у搧缂栧彿" align="center" prop="productCode">
                </el-table-column>
-               <el-table-column label="閲囬泦鍊�" width="150" align="center" prop="productCode">
+               <el-table-column label="閲囬泦鍊�" align="center" prop="collectData">
                </el-table-column>
-               <el-table-column label="缁撴灉" width="150" align="center" prop="results">
+               <el-table-column label="缁撴灉" align="center" prop="results">
                </el-table-column>
              </el-table>
            </el-col>
@@ -292,7 +292,13 @@
 <script>
 import {listWorkReport} from "@/api/main/om/workReport/workReport";
 import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
-import {listFormulaChild, releaseCheck, updateResults, workpieceRelease} from "@/api/main/bs/formulaChild/formulaChild";
+import {
+  listFormulaChild,
+  releaseCheck,
+  updateResults,
+  updateTighteningFormula,
+  workpieceRelease
+} from "@/api/main/bs/formulaChild/formulaChild";
 import MySerialPort from "@/utils/MySerialPort";
 import USBDevice from "@/utils/usb.json";
 import {listProductionOrde} from "@/api/main/om/productionOrde/productionOrde";
@@ -451,30 +457,28 @@
       // });
     },
     serialPortMethod(value){
-      console.log(value.includes('C'));
-      let formulaChilds = '';
-      console.log(this.formulaChildList)
-      this.formulaChildList.forEach((formulaChild) => {
-        formulaChilds = formulaChild;
-        let operationType = formulaChild.operationType;
-        let results = formulaChild.results;
-        let materialCode = formulaChild.materialCode;
-        if(operationType === '2' && value.includes(materialCode) && (results === '' || results === null || results === 'NG')){
-          return; // 浣跨敤return浠f浛break
-        }
-      });
-      console.log(formulaChilds)
-      // let formulaChildParams = {
-      //   scanBarcode: value,
-      //   sfcBarcode: this.headContent.sfcCode,
-      //   workOrderNo: this.workpieceInformation.workOrderNo,
-      //   productCode: this.workpieceInformation.productCode,
-      //   locationCode: this.headContent.processesCode,
-      //   collectionTime: new Date()
-      // }
-      // updateResults(formulaChildParams).then(response => {
-      //   this.getListFormulaChild()
+      // let formulaChilds = "";
+      // this.formulaChildList.forEach((formulaChild) => {
+      //   let operationType = formulaChild.operationType;
+      //   let results = formulaChild.results;
+      //   let materialCode = formulaChild.materialCode;
+      //   if(operationType === '2' && value.includes(materialCode) && (results === "" || results === null || results === 'NG')){
+      //     formulaChilds = formulaChild;
+      //     return; // 浣跨敤return浠f浛break
+      //   }
       // });
+      // console.log(formulaChilds)
+      let formulaChildParams = {
+        scanBarcode: value,
+        sfcBarcode: this.headContent.sfcCode,
+        workOrderNo: this.workpieceInformation.workOrderNo,
+        productCode: this.workpieceInformation.productCode,
+        locationCode: this.headContent.processesCode,
+        collectionTime: new Date()
+      }
+      updateResults(formulaChildParams).then(response => {
+        this.getListFormulaChild()
+      });
     },
     rowStyle({ row }) {
       if (row.results === 'OK') {
@@ -638,27 +642,21 @@
           this.formulaChildList = [];
           self.getListFormulaChild();
         } else if (event.data.includes("[")) {
+          // console.log('event.data'+event.data)
+          // let eventArr = event.data.split("[")[1].split("]")[0].split(", ");
+          // let eventArr1 = event.data.replace('[', '').replace(']', '').trim().split(', ');
+          // console.log(eventArr1)
+          // console.log(Array.isArray(eventArr))
           let formulaChilds = "";
-          // for(let i=0;i<self.formulaChildList.length;i++){
-          //   formulaChilds = self.formulaChildList[i];
-          //   let operationType = formulaChild.operationType;
-          //   let results = formulaChild.results;
-          //   if(operationType === '1' &&
-          //     (results === '' || results === null ||results === 'NG')){
-          //         break;
-          //   }
-          // }
           self.formulaChildList.forEach((formulaChild) => {
-            formulaChilds = formulaChild;
             let operationType = formulaChild.operationType;
             let results = formulaChild.results;
             if(operationType === '1' && (results === '' || results === null || results === 'NG')){
+              formulaChilds = formulaChild;
               return; // 浣跨敤return浠f浛break
             }
             // 鎵ц鍏朵粬鎿嶄綔
           });
-          console.log(formulaChilds)
-          console.log(formulaChilds.paramCode)
           const param = {
             tightenTheArray: event.data,
             paramCode: formulaChilds.paramCode,
@@ -668,6 +666,9 @@
             productBarcode: self.headContent.sfcCode,
           }
           addTighteningParameters(param).then(response => {});
+          updateTighteningFormula(param).then(response => {
+          });
+          self.getListFormulaChild()
         }
       };
     },

--
Gitblit v1.9.3