New file |
| | |
| | | package com.mes.job; |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import com.mes.common.S7object; |
| | | import com.mes.device.PlcParameterObject; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author SNG-010 |
| | | */ |
| | | @Component |
| | | @Slf4j |
| | | public class PLCManualReporting { |
| | | |
| | | PlcParameterObject plcParameterObject = S7object.getinstance().PlcMesObject; |
| | | @Autowired |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | @Autowired |
| | | PrimitiveTaskService primitiveTaskService; |
| | | |
| | | //@Scheduled(fixedDelay = 500) |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void manualReporting() { |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | List<PrimitiveTask> taskingList = primitiveTaskService.selectPrimitiveTask(new PrimitiveTask()); |
| | | jsonObject.append("taskingList", taskingList); |
| | | ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("manualReporting"); |
| | | if (sendwServer != null) { |
| | | for (WebSocketServer webserver : sendwServer) { |
| | | if (webserver != null) { |
| | | webserver.sendMessage(jsonObject.toString()); |
| | | List<String> messages = webserver.getMessages(); |
| | | if (!messages.isEmpty()) { |
| | | // // 将最后一个消息转换为整数类型的列表 |
| | | webserver.clearMessages(); |
| | | } |
| | | } else { |
| | | log.info("Home is closed"); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.mapper.MachineMapper; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.tools.WebSocketServer; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import com.mes.device.PlcParameterObject; |
| | | |
| | |
| | | TaskingService taskingService; |
| | | @Autowired |
| | | MachineMapper machineMapper; |
| | | @Autowired |
| | | PrimitiveTaskService primitiveTaskService; |
| | | //@Scheduled(fixedDelay = 500) |
| | | public void pLCScanQR() { |
| | | //获取当前任务表最新的一块任务状态 |
| | | //扫码线程 |
| | | //电气去根据上一个任务传递下来的状态自己判断需不需要扫码,如果需要扫码直接传输扫码id |
| | | String scanId = plcParameterObject.getPlcParameter("scanId").getValue(); |
| | | if(!Objects.equals(scanId, "")){ |
| | | boolean result = taskingService.insertTaskingPro(scanId); |
| | | boolean result = primitiveTaskService.updateReportCount(scanId); |
| | | if (result){ |
| | | //添加成功时发送过片信号 |
| | | S7object.getinstance().plccontrol.writeWord(plcParameterObject.getPlcParameter("scan").getAddress(), Integer.parseInt("1")); |
| | |
| | | } |
| | | |
| | | } |
| | | // @Scheduled(fixedDelay = 1000) |
| | | @Scheduled(fixedDelay = 1000) |
| | | public void scanQrCode() { |
| | | //获取当前任务表最新的一块任务状态 |
| | | JSONObject jsonObject = new JSONObject(); |
| | |
| | | // //log.info("报警信息:"+warning); |
| | | // jsonObject.append("warning", warning); |
| | | // } |
| | | Machine machine=machineMapper.selectById(25L); |
| | | Machine machine=machineMapper.selectById(23L); |
| | | List<Tasking> taskingList=taskingService.findMachineTask(machine); |
| | | jsonObject.append("taskingList", taskingList); |
| | | jsonObject.append("machine", machine); |
| | |
| | | package com.mes.md.controller; |
| | | |
| | | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import com.mes.md.entity.Machine; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.entity.Tasking; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.mes.md.service.TaskingService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/primitiveTask") |
| | | public class PrimitiveTaskController { |
| | | @Autowired |
| | | private PrimitiveTaskService primitiveTaskService; |
| | | @ApiOperation("查询当前设备,未完工状态的线上任务") |
| | | @PostMapping("/selectPrimitiveTask") |
| | | @ResponseBody |
| | | public Result findMachineTask(@RequestBody PrimitiveTask primitiveTask) { |
| | | List<PrimitiveTask> list =primitiveTaskService.selectPrimitiveTask(primitiveTask); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | |
| | | @ApiOperation("根据批次号进行手动报工") |
| | | @PostMapping("/updatePrimitiveTask") |
| | | @ResponseBody |
| | | public Result updatePrimitiveTask(@RequestBody PrimitiveTask primitiveTask) { |
| | | boolean list =primitiveTaskService.updatePrimitiveTask(primitiveTask); |
| | | return Result.build(200,"成功",list); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 原始任务表 服务类 |
| | |
| | | * @since 2024-08-28 |
| | | */ |
| | | public interface PrimitiveTaskService extends MPJBaseService<PrimitiveTask> { |
| | | // 更新报工数量 |
| | | /** |
| | | *扫码更新定制玻璃的报工数量 |
| | | * @return |
| | | */ |
| | | boolean updateReportCount(String scanId); |
| | | /** |
| | | *手动更新报工数量 |
| | | * @return |
| | | */ |
| | | boolean updatePrimitiveTask(PrimitiveTask task); |
| | | /** |
| | | *查询待报工的数据 |
| | | * @return |
| | | */ |
| | | List<PrimitiveTask> selectPrimitiveTask(PrimitiveTask task); |
| | | |
| | | } |
| | |
| | | package com.mes.md.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.github.yulichang.base.MPJBaseServiceImpl; |
| | | import com.mes.md.entity.PrimitiveTask; |
| | | import com.mes.md.mapper.PrimitiveTaskMapper; |
| | | import com.mes.md.service.PrimitiveTaskService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Override |
| | | public boolean updateReportCount(String scanId) { |
| | | //更新报工数量 |
| | | return false; |
| | | UpdateWrapper<PrimitiveTask> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("scan_id", scanId) |
| | | .set("report_count",1); |
| | | return update(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public boolean updatePrimitiveTask(PrimitiveTask task) { |
| | | //手动报工更改数量 |
| | | UpdateWrapper<PrimitiveTask> wrapper = new UpdateWrapper<>(); |
| | | wrapper.eq("batch_number", task.getBatchNumber()) |
| | | .set("report_count", task.getReportCount()); |
| | | return update(wrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<PrimitiveTask> selectPrimitiveTask(PrimitiveTask task) { |
| | | //查询报工数据 |
| | | return list(new QueryWrapper<>(task)) ; |
| | | } |
| | | } |
| | |
| | | return resultCount; |
| | | } |
| | | |
| | | public int test(List<Tasking> taskingList) { |
| | | int resultCount=0; |
| | | // |
| | | return resultCount; |
| | | } |
| | | |
| | | // |
| | | // @Override |
| | |
| | | workState: '任务状态', |
| | | lineConfigurationId: '所在位置', |
| | | state: '生产状态', |
| | | glassState: '玻璃状态' |
| | | glassState: '玻璃状态', |
| | | reportCount: '报工数量', |
| | | }, |
| | | machine: { |
| | | upperSlice:'自动上片机', |
| | |
| | | rotate:'旋转台', |
| | | lamination:'贴膜机', |
| | | scanQrCodesReport:'扫码报工', |
| | | manualReporting:'手动报工', |
| | | }, |
| | | functionState:{ |
| | | deleteTips:'是否确认破损?', |
| | |
| | | topLine :'上线', |
| | | start :'开工', |
| | | stop :'暂停', |
| | | bound:'绑定' |
| | | bound:'绑定', |
| | | reporting:'报工', |
| | | reportingcount:'报工数量', |
| | | |
| | | } |
| | | , |
| | |
| | | // } |
| | | // ] |
| | | // }, |
| | | // { |
| | | // /*----------- 报工管理 ----------------*/ |
| | | // path: 'ZiDongShangpian', |
| | | // name: 'zidongshangpian', |
| | | // component: () => import('../views/Marking/marking.vue'), |
| | | // children: [ |
| | | // { |
| | | // path: '/Marking/marking', |
| | | // name: 'marking', |
| | | // component: () => import('../views/Marking/marking.vue'), |
| | | // } |
| | | // ] |
| | | // }, |
| | | { |
| | | /*----------- 报工管理 ----------------*/ |
| | | path: 'ManualReporting', |
| | | name: 'manualReporting', |
| | | component: () => import('../views/ManualReporting/manualReporting.vue'), |
| | | children: [ |
| | | { |
| | | path: '/ManualReporting/manualReporting', |
| | | name: 'manualReporting', |
| | | component: () => import('../views/ManualReporting/manualReporting.vue'), |
| | | } |
| | | ] |
| | | }, |
| | | // { |
| | | // /*----------- 报表管理 ----------------*/ |
| | | // path: 'ZiDongShangpian', |
| | |
| | | const machineId=23;//当前页面的设备ID |
| | | //使用WebSocket方式展示数据 |
| | | let socket = null; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/edging`; |
| | | const socketUrl = `ws://${WebSocketHost}:${host}/api/deviceInteraction/api/talk/scanQrCodesReport`; |
| | | // 定义消息处理函数,更新 receivedData 变量 |
| | | const handleMessage = (data) => { |
| | | // 更新 tableData 的数据 |
| | | loadData.value = data.taskingList[0]; |
| | | findMachine.value = data.machine[0]; |
| | | // console.log(data); |
| | | }; |
| | | onUnmounted(() => { |
| | | if (socket) { |
| | |
| | | onMounted(async () => { |
| | | //使用WebSocket方式展示数据 |
| | | socket = initializeWebSocket(socketUrl, handleMessage);// 初始化 WebSocket,并传递消息处理函数 |
| | | |
| | | |
| | | //使用接口方式展示数据 |
| | | //load(); |
| | |
| | | return; |
| | | } |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | |
| | |
| | | //开工/暂停 |
| | | const machineStatus = async(state) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //破损 |
| | | const damagedTask = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | | //下线(拿走) |
| | | const glassDownLine = async(row) => { |
| | | ElMessageBox.confirm( |
| | | t('marking.tips'), |
| | | t('functionState.tips'), |
| | | t('delivery.prompt'), |
| | | { |
| | | confirmButtonText: t('marking.sure'), |
| | | cancelButtonText: t('marking.cancel'), |
| | | confirmButtonText: t('functionState.sure'), |
| | | cancelButtonText: t('functionState.cancel'), |
| | | type: 'warning', |
| | | } |
| | | ) |
| | |
| | | .catch(() => { |
| | | ElMessage({ |
| | | type: 'info', |
| | | message: t('marking.cancel'), |
| | | message: t('functionState.cancel'), |
| | | }) |
| | | }) |
| | | } |
| | |
| | | <template> |
| | | <div ref="content" style="padding:0 20px;"> |
| | | <div id="div-title" style="font-size: 20px; font-weight: bold; margin:10px 0 10px 0;padding-left: 20px;"> |
| | | {{$t('machine.edging')}} |
| | | {{$t('machine.scanQrCodesReport')}} |
| | | </div> |
| | | <hr /> |
| | | <br> |
| | | <div id="search" > |
| | | <!-- 功能 --> |
| | | <el-button type="primary" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> |
| | | <!-- <el-button :type="(findMachine['state']=='暂停'?'danger':'success')" id="ButtonMachineStatus" @click="machineStatus((findMachine['state']=='暂停'?'开工':'暂停'))">{{findMachine['state']=='开工'?$t('functionState.start'):$t('functionState.stop')}}</el-button> |
| | | <el-button type="primary" id="ButtonTopLine" @click="topLine">{{$t('functionState.topLine')}}</el-button> --> |
| | | <!-- <el-button type="primary" id="searchButton" @click="downLine('下线')">下线</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('破损')">破损</el-button> |
| | | <el-button type="primary" id="searchButton" @click="workStatus('完工')">完工</el-button> --> |
| | |
| | | <el-table-column prop="width" :label="$t('glassInfo.width')"/> |
| | | <el-table-column prop="thickness" :label="$t('glassInfo.thickness')"/> |
| | | <el-table-column prop="workState" :label="$t('glassInfo.workState')"/> |
| | | <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <!-- <el-table-column fixed="right" :label="$t('productStock.operate')" align="center" width="270"> |
| | | <template #default="scope"> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '重发')" >{{$t('functionState.anew')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="workStatus(scope.row, '完工')">{{$t('functionState.finish')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="damagedTask(scope.row)">{{$t('functionState.lose')}}</el-button> |
| | | <el-button size="mini" link type="primary" plain @click="glassDownLine(scope.row)">{{$t('functionState.downLine')}}</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | </div> |
| | | |
| | | <div id="main-body" |
| | | style="width: 50%; height: 460px; margin: auto;background-image: url(../../src/assets/扫码识别.png) ;background-size: 100% 100%;"> |
| | | <div id="main-body1" |
| | | style="width: 70%; height: 400px;margin:20px auto;background-size: 100% 100%;"> |
| | | <!-- 画图内容 --> |
| | | <div style="width: 150px; height: 100px; background-color: red; position: relative; top: 171px; left: 328px"> |
| | | <div :style="{ |
| | | width: loadData.length > 0 ? loadData[0]['length'] + 'px' : '200px', |
| | | height: loadData.length > 0 ? loadData[0]['width'] + 'px' : '100px', |
| | | backgroundColor: 'red', |
| | | position: 'relative', |
| | | top: '60px', |
| | | left: '28px', |
| | | textAlign: 'center' |
| | | }"> |
| | | <p v-if="loadData.length > 0">{{ loadData[0]['scanId'] }}</p> |
| | | <p v-if="loadData.length > 0"> |
| | | {{ loadData[0]['length'] }} * {{ loadData[0]['width'] }} |
| | | </p> |
| | | <p v-else>暂无数据</p> <!-- 可选:显示默认消息 --> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | | <style scoped> |
| | | |
| | | table { |
| | | text-align: center; |
| | | width: 100%; |