懒羊羊
2024-01-29 a36b834b2957440a755652ff17d067b18f4e9250
工位终端
已修改12个文件
306 ■■■■■ 文件已修改
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java 70 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/router/index.js 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/bs/formula/index.vue 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/bs/formulaChild/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-ui/src/views/main/kb/stationTerminal/index.vue 48 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/controller/BsFormulaChildInfoController.java
@@ -52,6 +52,25 @@
    }
    /**
     * 检查是否可以放行
     */
    @GetMapping("/releaseCheck")
    public AjaxResult releaseCheck()
    {
        List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck();
        return AjaxResult.success(i.size());
    }
    /**
     * 扫码确认
     */
    @GetMapping("/updateResults")
    public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
    {
        return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
    }
    /**
     * 导出配方配置子信息列表
     */
    @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/domain/BsFormulaChildInfo.java
@@ -90,12 +90,36 @@
    /** 预留字段4 */
    private String spareField4;
    /** 采集数据 */
    @Excel(name = "采集数据")
    private String collectData;
    /** 结果 */
    @Excel(name = "结果")
    private String results;
    private String sort;
    private String address;
    private String img;
    public String getCollectData() {
        return collectData;
    }
    public void setCollectData(String collectData) {
        this.collectData = collectData;
    }
    public String getResults() {
        return results;
    }
    public void setResults(String results) {
        this.results = results;
    }
    public String getSort() {
        return sort;
    }
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/mapper/BsFormulaChildInfoMapper.java
@@ -58,4 +58,8 @@
     * @return 结果
     */
    public int deleteBsFormulaChildInfoByIds(Long[] ids);
    BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(BsFormulaChildInfo bsFormulaChildInfo);
    List<BsFormulaChildInfo> releaseCheck();
}
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/IBsFormulaChildInfoService.java
@@ -1,6 +1,8 @@
package com.jcdm.main.bs.formulaChild.service;
import java.util.List;
import com.jcdm.common.core.domain.AjaxResult;
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
/**
@@ -58,4 +60,10 @@
     * @return 结果
     */
    public int deleteBsFormulaChildInfoById(Long id);
    public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode);
    List<BsFormulaChildInfo> releaseCheck();
    AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo);
}
jcdm-main/src/main/java/com/jcdm/main/bs/formulaChild/service/impl/BsFormulaChildInfoServiceImpl.java
@@ -1,6 +1,8 @@
package com.jcdm.main.bs.formulaChild.service.impl;
import java.util.List;
import com.jcdm.common.core.domain.AjaxResult;
import com.jcdm.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -93,4 +95,30 @@
    {
        return bsFormulaChildInfoMapper.deleteBsFormulaChildInfoById(id);
    }
    @Override
    public BsFormulaChildInfo selectBsFormulaChildInfoByTypeTopOne(String type,String productCode,String processesCode) {
        BsFormulaChildInfo info = new BsFormulaChildInfo();
        info.setOperationType(type);
        info.setProcessesCode(processesCode);
        info.setProductCode(productCode);
        return bsFormulaChildInfoMapper.selectBsFormulaChildInfoByTypeTopOne(info);
    }
    @Override
    public List<BsFormulaChildInfo> releaseCheck() {
        return bsFormulaChildInfoMapper.releaseCheck();
    }
    @Override
    public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo) {
        List<BsFormulaChildInfo> bsFormulaChildInfos = bsFormulaChildInfoMapper.selectBsFormulaChildInfoList(bsFormulaChildInfo);
        if(bsFormulaChildInfos.size()>0){
            bsFormulaChildInfos.get(0).setResults("OK");
            bsFormulaChildInfoMapper.updateBsFormulaChildInfo(bsFormulaChildInfos.get(0));
        }else {
            return AjaxResult.error("非本工位物料,请重新扫描");
        }
        return AjaxResult.success("成功");
    }
}
jcdm-main/src/main/java/com/jcdm/main/da/opcuaconfig/cert/MethodName.java
@@ -2,6 +2,8 @@
import com.jcdm.framework.websocket.WebSocketServer;
import com.jcdm.framework.websocket.WebSocketUsers;
import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
import com.jcdm.main.da.collectionParamConf.domain.DaCollectionParamConf;
import com.jcdm.main.da.collectionParamConf.service.IDaCollectionParamConfService;
import com.jcdm.main.da.opcuaconfig.client.ClientHandler;
@@ -29,6 +31,7 @@
    private IDaCollectionParamConfService collectionParamConfService = BeanUtils.getBean(IDaCollectionParamConfService.class);
    private IDaParamCollectionService daParamCollectionService = BeanUtils.getBean(IDaParamCollectionService.class);
    private IDaPassingStationCollectionService daPassingStationCollectionService = BeanUtils.getBean(IDaPassingStationCollectionService.class);
    private IBsFormulaChildInfoService bsFormulaChildInfoService = BeanUtils.getBean(IBsFormulaChildInfoService.class);
    private List<DataValue> s=null;
    public void Transit(String Node, String value) throws Exception {
        log.info(Node+":"+value);
@@ -96,4 +99,71 @@
                break;
        }
    }
    public void tighten(String Node, String value) throws Exception {
        String[] parts = Node.split("[.]");
        ClientHandler clientHandler=new ClientHandler();
        System.out.println("Node:"+Node+"value:"+value);
        switch (value){
            case "1":
                //读扭矩
                NodeEntity SN_node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSN").value("").type("").build();
                String SNCode=clientHandler.read(SN_node);
                //读角度
                NodeEntity SNDone= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSNDone").value("").type("").build();
                String RecordSNDone = clientHandler.read(SNDone);
                //读结果
                NodeEntity SNDone1= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".WorkID").value("").type("").build();
                String WorkID = clientHandler.read(SNDone1);
                //保存参数采集表
                DaParamCollection paramCollection = new DaParamCollection();
                paramCollection.setLocationCode(parts[1]);
                paramCollection.setParamCode("RecordSN");
                paramCollection.setParamValue(SNCode);
                paramCollection.setParamName(parts[0]+"."+parts[1]+".RecordSN");
                daParamCollectionService.insertDaParamCollection(paramCollection);
                DaParamCollection paramCollection1 = new DaParamCollection();
                paramCollection1.setLocationCode(parts[1]);
                paramCollection1.setParamCode("RecordSNDone");
                paramCollection1.setParamValue(RecordSNDone);
                paramCollection1.setParamName(parts[0]+"."+parts[1]+".RecordSNDone");
                daParamCollectionService.insertDaParamCollection(paramCollection1);
                DaParamCollection paramCollection2 = new DaParamCollection();
                paramCollection2.setLocationCode(parts[1]);
                paramCollection2.setParamCode("WorkID");
                paramCollection2.setParamValue(WorkID);
                paramCollection2.setParamName(parts[0]+"."+parts[1]+".WorkID");
                daParamCollectionService.insertDaParamCollection(paramCollection2);
                //保存状态更新前端表单
                BsFormulaChildInfo test = bsFormulaChildInfoService.selectBsFormulaChildInfoByTypeTopOne("1", "test", parts[1]);
                test.setResults(WorkID);
                bsFormulaChildInfoService.updateBsFormulaChildInfo(test);
                WebSocketUsers.sendMessageToUserByText(map.get(parts[1]), "TIGHTEN");
                System.out.println("SNCode:"+SNCode);
                System.out.println("Node:"+Node+"value:"+value);
                NodeEntity node= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".StationStatus").value("0").type("short").build();
                Boolean out=clientHandler.write(node);
                NodeEntity RecordSN= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSN").value("0").type("short").build();
                Boolean out1=clientHandler.write(RecordSN);
                NodeEntity riteRecordSNDone= NodeEntity.builder().index(2).identifier(parts[0]+"."+parts[1]+".RecordSNDone").value("0").type("short").build();
                Boolean out2=clientHandler.write(riteRecordSNDone);
                log.info("节点:{},响应结果:{}", node.getIdentifier(),out);
            default:
                break;
        }
    }
}
jcdm-main/src/main/resources/mapper/bs/formulaChild/BsFormulaChildInfoMapper.xml
@@ -27,10 +27,12 @@
        <result property="spareField2"    column="spare_field_2"    />
        <result property="spareField3"    column="spare_field_3"    />
        <result property="spareField4"    column="spare_field_4"    />
        <result property="collectData"    column="collect_data"    />
        <result property="results"    column="results"    />
    </resultMap>
    <sql id="selectBsFormulaChildInfoVo">
        select id, workshop_code, line_code, processes_code, product_code, operation_steps, tech_requirement, operation_type, step_sort, param_code, material_code, formula_code, picture, remarks, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4 from bs_formula_child_info
        select id, workshop_code, line_code, processes_code, product_code, operation_steps, tech_requirement, operation_type, step_sort, param_code, material_code, formula_code, picture, remarks, create_user, create_time, update_user, update_time, spare_field_1, spare_field_2, spare_field_3, spare_field_4, collect_data, results from bs_formula_child_info
    </sql>
    <select id="selectBsFormulaChildInfoList" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
@@ -42,8 +44,12 @@
            <if test="productCode != null  and productCode != ''"> and product_code like concat('%', #{productCode}, '%')</if>
            <if test="operationType != null  and operationType != ''"> and operation_type like concat('%', #{operationType}, '%')</if>
            <if test="formulaCode != null  and formulaCode != ''"> and formula_code like concat('%', #{formulaCode}, '%')</if>
            <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>
        </where>
        ORDER BY step_sort ASC
    </select>
    
    <select id="selectBsFormulaChildInfoById" parameterType="Long" resultMap="BsFormulaChildInfoResult">
@@ -75,6 +81,8 @@
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="spareField3 != null">spare_field_3,</if>
            <if test="spareField4 != null">spare_field_4,</if>
            <if test="collectData != null">collect_data,</if>
            <if test="results != null">results,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="workshopCode != null">#{workshopCode},</if>
@@ -98,6 +106,8 @@
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="spareField3 != null">#{spareField3},</if>
            <if test="spareField4 != null">#{spareField4},</if>
            <if test="collectData != null">collect_data,</if>
            <if test="results != null">results,</if>
         </trim>
    </insert>
@@ -125,6 +135,8 @@
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
            <if test="spareField4 != null">spare_field_4 = #{spareField4},</if>
            <if test="collectData != null">collect_data = #{collectData},</if>
            <if test="results != null">results = #{results},</if>
        </trim>
        where id = #{id}
    </update>
@@ -139,4 +151,24 @@
            #{id}
        </foreach>
    </delete>
    <select id="selectBsFormulaChildInfoByTypeTopOne" parameterType="BsFormulaChildInfo" resultMap="BsFormulaChildInfoResult">
        SELECT
            TOP 1 *
        FROM
            bs_formula_child_info
        WHERE NOT results = 'OK'
          AND product_code =  #{productCode}
          AND processes_code = #{processesCode}
          AND operation_type = #{operationType}
        ORDER BY step_sort ASC
    </select>
    <select id="releaseCheck" resultMap="BsFormulaChildInfoResult">
        SELECT
            *
        FROM
            bs_formula_child_info
        WHERE NOT results = 'OK'
    </select>
</mapper>
jcdm-ui/src/api/main/bs/formulaChild/formulaChild.js
@@ -9,6 +9,24 @@
  })
}
// 查询配方配置子信息列表
export function releaseCheck() {
  return request({
    url: '/bs/formulaChild/releaseCheck',
    method: 'get',
  })
}
// 查询配方配置子信息列表
export function updateResults(query) {
  return request({
    url: '/bs/formulaChild/updateResults',
    method: 'get',
    params: query
  })
}
// 查询配方配置子信息详细
export function getFormulaChild(id) {
  return request({
jcdm-ui/src/router/index.js
@@ -141,7 +141,7 @@
    permissions: ['bs:formulaChild:list'],
    children: [
      {
        path: 'index/:formulaCode(\\d+)',
        path: 'index',
        component: () => import('@/views/main/bs/formulaChild/index'),
        name: 'Data',
        meta: { title: '配方详情', activeMenu: '/main/bs/formulaChild' }
jcdm-ui/src/views/main/bs/formula/index.vue
@@ -96,7 +96,8 @@
<!--          </el-table-column>-->
          <el-table-column label="配方编码" width="130" align="center" :show-overflow-tooltip="true">
            <template slot-scope="scope">
              <router-link :to="'/main/formula-data/index/' + scope.row.formulaCode" class="link-type">
              <router-link :to="{path: '/main/formula-data/index/', query: {formulaCode: scope.row.formulaCode} }" class="link-type">
                <span>{{ scope.row.formulaCode }}</span>
              </router-link>
            </template>
jcdm-ui/src/views/main/bs/formulaChild/index.vue
@@ -107,7 +107,7 @@
          <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row>
        <el-descriptions class="margin-top" :column="4" :size="size" border>
        <el-descriptions class="margin-top" :column="4" border>
          <el-descriptions-item :span="1">
            <template slot="label">
              <i class="el-icon-user"></i>
@@ -150,26 +150,29 @@
          </el-table-column>
          <el-table-column label="操作内容" :show-overflow-tooltip='true' width="150" align="center" prop="operationSteps">
          </el-table-column>
          <el-table-column label="技术要求" width="150" :show-overflow-tooltip='true' align="center" prop="techRequirement">
          <el-table-column label="技术要求"  width="150" :show-overflow-tooltip='true' align="center" prop="techRequirement">
          </el-table-column>
          <el-table-column label="类型" width="90" align="center" prop="operationType">
            <template slot-scope="scope">
              <dict-tag :options="dict.type.operation_type" :value="scope.row.operationType"/>
            </template>
          </el-table-column>
          <el-table-column label="排序" width="90" align="center" prop="stepSort">
          </el-table-column>
          <el-table-column label="参数编码" width="130" align="center" prop="paramCode">
          <el-table-column label="参数编码" :show-overflow-tooltip='true' width="130" align="center" prop="paramCode">
          </el-table-column>
          <el-table-column label="物料编码" width="130" align="center" prop="materialCode">
          <el-table-column label="物料编码" :show-overflow-tooltip='true' width="130" align="center" prop="materialCode">
          </el-table-column>
          <el-table-column label="配方编码" width="130" align="center" prop="formulaCode">
          </el-table-column>
          <el-table-column label="图片" :show-overflow-tooltip='true' width="130" align="center" prop="picture">
            <template slot-scope="scope">
              <el-image
                style="width: 100px; height: 100px"
                :src="pjtUrl+scope.row.picture"
                :fit="fit">
              </el-image>
            </template>
<!--            <template slot-scope="scope">-->
<!--              <el-image-->
<!--                style="width: 100px; height: 100px"-->
<!--                :src="pjtUrl+scope.row.picture"-->
<!--                :fit="fit">-->
<!--              </el-image>-->
<!--            </template>-->
          </el-table-column>
          <el-table-column label="备注" width="130" align="center" prop="remarks">
          </el-table-column>
@@ -242,16 +245,16 @@
        <el-form-item label="技术要求" prop="techRequirement">
          <el-input v-model="form.techRequirement" placeholder="请输入技术要求" />
        </el-form-item>
<!--        <el-form-item label="类型" prop="operationType">-->
<!--          <el-select v-model="form.operationType" placeholder="请选择类型">-->
<!--            <el-option-->
<!--              v-for="dict in dict.type.${dictType}"-->
<!--              :key="dict.value"-->
<!--              :label="dict.label"-->
<!--              :value="dict.value"-->
<!--            ></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->
        <el-form-item label="类型" prop="operationType">
          <el-select style="width: 100%" v-model="form.operationType" placeholder="请选择类型">
            <el-option
              v-for="dict in dict.type.operation_type"
              :key="dict.value"
              :label="dict.label"
              :value="dict.value"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="排序" prop="stepSort">
          <el-input v-model="form.stepSort" placeholder="请输入排序" />
        </el-form-item>
@@ -285,6 +288,7 @@
export default {
  name: "FormulaChild",
  dicts: ['operation_type'],
  data() {
    return {
      pjtUrl: process.env.VUE_APP_BASE_API,
@@ -336,7 +340,7 @@
    };
  },
  created() {
    const formulaCode = this.$route.params && this.$route.params.formulaCode;
    let formulaCode = this.$route.query.formulaCode;
    this.queryParams.formulaCode = formulaCode;
    this.formulaCode = formulaCode;
    this.headerInformation();
jcdm-ui/src/views/main/kb/stationTerminal/index.vue
@@ -93,6 +93,9 @@
           </el-col>
         </el-row>
         <el-row style="margin-top: 20px">
             <el-button @click="Release" type="primary">放行</el-button>
         </el-row>
       </el-card>
     </el-col>
@@ -101,7 +104,7 @@
         <el-tab-pane name="first">
           <span slot="label"> <a class="el-icon-date"></a>首页</span>
           <el-col :span="8">
             <el-table :data="formulaChildList">
             <el-table :cell-style="rowStyle" :data="formulaChildList">
               <el-table-column label="排序" width="60" align="center" prop="stepSort">
               </el-table-column>
               <el-table-column label="操作内容" :show-overflow-tooltip='true' align="center" prop="operationSteps">
@@ -144,7 +147,7 @@
<script>
import {listWorkReport} from "@/api/main/om/workReport/workReport";
import {listStationConf,getIpv4} from "@/api/main/sc/stationConf";
import {listFormulaChild} from "@/api/main/bs/formulaChild/formulaChild";
import {listFormulaChild, releaseCheck, updateResults} from "@/api/main/bs/formulaChild/formulaChild";
export default {
  name: "stationTerminal",
@@ -195,7 +198,7 @@
      },
      content: '',
      activeName: 'first',
      url: "ws://192.168.10.184:8080/websocket/message/",
      url: "ws://192.168.11.60:8080/websocket/message/",
      message: "",
      text_content: "",
      ws: null,
@@ -216,8 +219,32 @@
  },
  methods: {
    serialPortMethod(){
    Release(){
      releaseCheck().then(response => {
        if(response.data === 0){
          //改变状态
          this.$message('放行成功!');
        }else {
          this.$message('步骤未完成不许放行!');
        }
      });
    },
    serialPortMethod(){
      let formulaChildParams = {
        materialCode: this.serialPortContent
      }
      updateResults(formulaChildParams).then(response => {
        this.getListFormulaChild()
      });
    },
    rowStyle({ row }) {
      if (row.results === 'OK') {
        return 'background-color: PaleGreen';
      } else if (row.results === 'NG') {
        return 'background-color: LightSalmon';
      }
      return '';
    },
    /** 查询配方配置子信息列表 */
    getListFormulaChild() {
@@ -238,7 +265,7 @@
      this.headContent.sfcCode = this.content
      this.queryParams.sfcCode = this.content
      this.getList()
      // this.getListFormulaChild()
      this.getListFormulaChild()
      this.cakeLamp.scanFinish = 1
      this.cakeLamp.startWork = 1
@@ -247,6 +274,7 @@
    async getList() {
      await listWorkReport(this.queryParams).then(response => {
        let rowsData = response.rows[0];
        console.log(rowsData)
        this.workpieceInformation.workOrderCode = rowsData.workOrderCode;
        this.workpieceInformation.productCode = rowsData.productCode;
        this.workpieceInformation.productModel = rowsData.productModel;
@@ -345,6 +373,9 @@
          setTimeout(() => {
            this.resetting()
          }, 2000); // 延时2秒触发
        }else if(event.data === 'TIGHTEN'){
          console.log('开始拧紧')
          self.getListFormulaChild()
        }
      };
    },
@@ -393,5 +424,12 @@
span{
  font-size: 15px;
}
.el-table .warning-row {
  background: oldlace;
}
.el-table .success-row {
  background: #f0f9eb;
}
</style>