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')") 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; 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; /** * 配方配置子信息Mapper接口 @@ -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); } 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; /** * 配方配置子信息Service接口 @@ -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); } 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("扫描成功!"); } } 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"> 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({ 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代替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代替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代替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() } }; },