From 04adb88a2ed54cdf4c2958c79972c30109b9b5b6 Mon Sep 17 00:00:00 2001 From: wang <3597712270@qq.com> Date: 星期四, 28 三月 2024 16:54:56 +0800 Subject: [PATCH] 内容调整 --- UnLoadGlassModule/src/main/java/com/mes/service/PlcService.java | 139 ++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 139 insertions(+), 0 deletions(-) diff --git a/UnLoadGlassModule/src/main/java/com/mes/service/PlcService.java b/UnLoadGlassModule/src/main/java/com/mes/service/PlcService.java new file mode 100644 index 0000000..581cfe8 --- /dev/null +++ b/UnLoadGlassModule/src/main/java/com/mes/service/PlcService.java @@ -0,0 +1,139 @@ +package com.mes.service; + +import com.mes.entity.DownGlassInfo; +import com.mes.entity.DownStorageCageDetails; +import com.mes.entity.DownWorkstation; +import com.mes.entity.device.PlcParameterObject; +import com.mes.mapper.DownGlassInfoMapper; +import com.mes.mapper.DownWorkstationMapper; +import com.mes.tools.WebSocketServer; +import lombok.Data; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Data +@Service +public class PlcService { + + @Autowired + private DownWorkstationMapper downWorkstationMapper; + private DownGlassInfo downGlassInfo; + private DownWorkstation downWorkstation; + private DownGlassInfoMapper downGlassInfoMapper; + + private DownGlassInfoService downGlassInfoService; + + + + + + private List<DownGlassInfo> glassList; // 瀛樻斁寰呭鐞嗙殑鐜荤拑淇℃伅 + private List<DownStorageCageDetails> cageDetailsList; // 瀛樻斁鐜荤拑鏀剧疆鍦ㄧ紦瀛樼涓殑璇︾粏淇℃伅 + PlcParameterObject plcread=PLCAutoMes.PlcReadObject; + String Robot1PLCrequestword=plcread.getPlcParameter("A01Position").getValue();// 鏈烘鎵�1PLC璇锋眰瀛� + String Robot2PLCrequestword=plcread.getPlcParameter("A01Position").getValue();// 鏈烘鎵�2PLC璇锋眰瀛� + String GlassID=plcread.getPlcParameter("A01Position").getValue();// 鐜荤拑id + String Glasswidth=plcread.getPlcParameter("A01Position").getValue();//鐜荤拑瀹藉害 + String Glassheight=plcread.getPlcParameter("A01Position").getValue();//鐜荤拑楂樺害 + String Glassthickness=plcread.getPlcParameter("A01Position").getValue();//鍘氬害 + String PLCwancheng = plcread.getPlcParameter("A01Position").getValue();// plc瀹屾垚瀛� + + + //褰撲笅鐗囦换鍔¤〃鐘舵�佷负1鏃跺�欏皢鏁版嵁鎻掑叆鍒颁笅鐗囩幓鐠冧俊鎭〃 + public void insertdownglassinfo() { + + + downWorkstationMapper = WebSocketServer.applicationContext.getBean(DownWorkstationMapper.class); + downGlassInfoService = WebSocketServer.applicationContext.getBean(DownGlassInfoService.class); + downGlassInfoMapper = WebSocketServer.applicationContext.getBean(DownGlassInfoMapper.class); + List<DownGlassInfo> taskdownGlassInf = downGlassInfoMapper.selectunloadingtaskstate(); +// + if (taskdownGlassInf != null && !taskdownGlassInf.isEmpty()) { + + + + + for (DownGlassInfo downGlassInfo : taskdownGlassInf) { + // 鍒涘缓鏂扮殑 DownGlassInfo 瀵硅薄骞惰缃浉鍏冲睘鎬� + DownGlassInfo newdownGlassInfo = new DownGlassInfo(); + + newdownGlassInfo.setFlowCardId(downGlassInfo.getFlowCardId()); + Integer maxSequence = downGlassInfoMapper.getMaxSequenceByFlowCardId(downGlassInfo.getFlowCardId()); + int sequence = maxSequence != null ? maxSequence + 1 : 1; // 鍒濆鍖栭『搴忓瓧娈靛�� + + newdownGlassInfo.setWidth(downGlassInfo.getWidth()); + newdownGlassInfo.setHeight(downGlassInfo.getHeight()); + newdownGlassInfo.setThickness(downGlassInfo.getThickness()); + newdownGlassInfo.setFilmsid(downGlassInfo.getFilmsid()); + newdownGlassInfo.setSequence(sequence); // 璁剧疆椤哄簭瀛楁鍊� + + // 鎻掑叆鏁版嵁鍒颁笅鐗囩幓鐠冧俊鎭〃 + downGlassInfoMapper.insert(newdownGlassInfo); + //鎻掑叆鏁版嵁鍒版満姊版墜浠诲姟琛� + downWorkstationMapper.insertdownWorkstationtask(newdownGlassInfo); + //鏇存柊浠诲姟琛ㄧ姸鎬佷负0 + downGlassInfoMapper.updateTaskStateToZero(downGlassInfo.getFlowCardId()); + + sequence++; // 閫掑椤哄簭瀛楁鍊� + + + + + } + } + } + + + //褰撴満姊版墜浠诲姟琛ㄤ腑鐘舵�佷负1锛屽伐浣嶈〃娴佺▼鍗$粦瀹氫簡鏋跺瓙 鏇存柊宸茬粡钀芥灦鏁伴噺锛屽苟涓旀妸涓嬬墖浠诲姟琛ㄧ殑瀵瑰簲璁板綍鍒犳帀 + public void down_workstation(){ + + //downWorkstationMapper = WebSocketServer.applicationContext.getBean(DownWorkstationMapper.class); + //downGlassInfoMapper = WebSocketServer.applicationContext.getBean(DownGlassInfoMapper.class); + try { + List<DownWorkstation> taskdownWorkstation = downWorkstationMapper.selectdownWorkstationstate(); + if (taskdownWorkstation != null && !taskdownWorkstation.isEmpty()) { + //鏌ヨ涓嬬墖宸ヤ綅琛ㄤ腑鏄惁缁戝畾浜嗘灦瀛愭槸鍚︾粦瀹氫簡娴佺▼鍗″彿锛屽鏋滃凡缁忕粦瀹氬垯鏇存柊宸茶惤鏋舵暟閲�,骞朵笖鍒犻櫎涓嬬墖浠诲姟琛ㄤ腑鐨勮褰� + for (DownWorkstation downWorkstation : taskdownWorkstation) { + downWorkstationMapper.update_racks_number(downWorkstation.getFlowCardId(),6 ); + downGlassInfoMapper.deletetask(downWorkstation.getFlowCardId()); + + } + } + } catch (Exception e) { + // 鎵撳嵃寮傚父淇℃伅 + e.printStackTrace(); + // 鎴栬�呭彲浠ヨ繘琛屽叾浠栧紓甯稿鐞嗭紝姣斿璁板綍鏃ュ織鎴栬�呰繑鍥炵壒瀹氱殑閿欒淇℃伅 + } + + + } + + + + //缁戝畾娴佺▼鍗″彿鏋跺瓙 + public void bindingshelf(DownWorkstation downWorkstation){ + + String FlowCardId=downWorkstation.getFlowCardId(); + int WorkstationId=downWorkstation.getWorkstationId(); + + + + } + + + + + + + + + + + + + + + + +} -- Gitblit v1.8.0