From 28ded8102d83cf74bc232d1cdfc89b7f22c41952 Mon Sep 17 00:00:00 2001 From: wu <731351411@qq.com> Date: 星期二, 03 十二月 2024 09:09:31 +0800 Subject: [PATCH] 增加点击防抖事件 增加笼子使用详情的计算优化。 增加数据推送时的报错处理 测量台交互逻辑增加 参数界面增加翻转加减速度 --- springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java | 204 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 166 insertions(+), 38 deletions(-) diff --git a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java index 3a79434..0024a4c 100644 --- a/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java +++ b/springboot-vue3/src/main/java/com/example/springboot/service/StorageCageService.java @@ -228,7 +228,12 @@ // 澧炲姞/鍑忓皯鐞嗙墖绗肩幓鐠冩暟 public Result UpdateStroageCageByCell(Integer cell, Integer num) { if (num == 0) { - homeMapper.DeleteStroageCageByCell(cell); + int sumcell=albaniaMapper.SelectOutTasksum(cell); + if(sumcell==0){ + homeMapper.DeleteStroageCageByCell(cell); + } + }else if(num==-1){ + homeMapper.updateStroageCageByCell(cell, num); } else { homeMapper.updateStroageCageByCell(cell, num); homeMapper.UpdateStroageCageWidthByCell(cell);// 淇敼绗煎瓙瀹藉害 @@ -237,20 +242,36 @@ map.put("message", "200"); return Result.success(map); } + // 鐣岄潰澧炲姞/鍑忓皯鐞嗙墖绗肩幓鐠冩暟 + public Result UpdateStroageCageByCells(Integer cell, Integer num) { + if (num == 0) { + int sumcell=albaniaMapper.SelectOutTasksum(cell); + if(sumcell==0){ + homeMapper.DeleteStroageCageByCell(cell); + } + } else { + homeMapper.updateStroageCageByCell(cell, num); + homeMapper.UpdateStroageCageWidthByCell(cell);// 淇敼绗煎瓙瀹藉害 + } + Map<String, Object> map = new HashMap<>(); + map.put("message", "200"); + return Result.success(map); + } + // 鎸囧畾鏍煎瓙鍑虹墖 - public Result AddOutGlass(Integer cell,Integer glasstype) { + public Result AddOutGlass(Integer cell, Integer glasstype) { GlassInfo glass = albaniaMapper.SelectGlassInfo(glasstype); Map<String, Object> map = new HashMap<>(); - if(glass!=null){ - albaniaMapper.AddFinishNumber(glass.getFlowcard(),glass.getMateid(), glass.getTier()); - UpdateStroageCageByCell(cell, -1);// 鐜荤拑鏁伴噺-1 - // 澧炲姞鍑虹墖闃熷垪鐨勪换鍔� - albaniaMapper.InsertOutTask(1, 0, cell, 2001,glass.getGlassid(), - glass.getGlasstype(), glass.getFlowcard(),glass.getMateid(),glass.getTier()); - map.put("message", "200"); - }else{ - map.put("message", "300"); + if (glass != null) { + albaniaMapper.AddFinishNumber(glass.getFlowcard(), glass.getMateid(), glass.getTier()); + UpdateStroageCageByCell(cell, -1);// 鐜荤拑鏁伴噺-1 + // 澧炲姞鍑虹墖闃熷垪鐨勪换鍔� + albaniaMapper.InsertOutTask(1, 0, cell, 2001, glass.getGlassid(), + glass.getGlasstype(), glass.getFlowcard(), glass.getMateid(), glass.getTier()); + map.put("message", "200"); + } else { + map.put("message", "300"); } return Result.success(map); } @@ -277,6 +298,16 @@ return storageTasks; } + // 鏌ヨ鍑虹墖闃熷垪 + public List<Map> SelectOutTask() { + return homeMapper.SelectOutTask(); + } + + // 鏌ヨ鍑虹墖闃熷垪 + public List<Map> SelectOutLog() { + return homeMapper.SelectOutLog(); + } + // 鏌ヨ杩�/鍑虹墖浠诲姟 public List<GlassInfo> SelectMeasure() { return homeMapper.SelectMeasure(); @@ -294,6 +325,13 @@ // 鎵嬪姩缁撴潫浠诲姟 public Result TerminateTask(int id) { + PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; + // 娓呴櫎浠诲姟鍦板潃 + for (int i = 1; i < 7; i++) { + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart" + i).getAddress(), (short) 0);// 娓呴櫎浠诲姟鍦板潃 + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget" + i).getAddress(), (short) 0);// 娓呴櫎浠诲姟鍦板潃 + } + System.out.println("缁撴潫浠诲姟鍦板潃"); for (int i = 1; i < 7; i++) { int taskcont = albaniaMapper.SelectTaskcount(); // 姝e湪杩涜鐨勪换鍔℃暟閲� System.out.println("浠诲姟鏁伴噺:" + taskcont); @@ -306,6 +344,10 @@ homeMapper.FinishTask(storageTask.getId(), 2);// 瀹屾垚浠诲姟 homeMapper.DeletequeueByGlassid(storageTask.getGlasstype().toString()); glassInfoMapper.updateGlassNumber(storageTask.getGlasstype());// 鍑忓皯鎵弿娆℃暟 + StorageCage storageCage = homeMapper.SelectStorageByCell(storageTask.getLoadrack()); + if (storageCage.getNumber() == null || storageCage.getNumber() == 0) { + UpdateStroageCageByCell(Integer.parseInt(storageTask.getShelfRack()), 0);// 娓呴櫎鏍煎唴淇℃伅 + } } else { System.out.println("缁撴潫鍑虹墖浠诲姟:" + storageTask.getId()); homeMapper.FinishTask(storageTask.getId(), 2);// 瀹屾垚浠诲姟 @@ -319,6 +361,13 @@ // 鎵嬪姩瀹屾垚浠诲姟 public Result FinishTask() { + PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; + // 娓呴櫎浠诲姟鍦板潃 + for (int i = 1; i < 7; i++) { + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCStart" + i).getAddress(), (short) 0);// 娓呴櫎浠诲姟鍦板潃 + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToPLCTarget" + i).getAddress(), (short) 0);// 娓呴櫎浠诲姟鍦板潃 + } + System.out.println("缁撴潫浠诲姟鍦板潃"); for (int i = 1; i < 7; i++) { int taskcont = albaniaMapper.SelectTaskcount(); // 姝e湪杩涜鐨勪换鍔℃暟閲� System.out.println("浠诲姟鏁伴噺:" + taskcont); @@ -342,6 +391,7 @@ // storageTask.geTier());// 娣诲姞鍑虹墖瀹屾垚鏁伴噺 } + } Map<String, Object> map = new HashMap<>(); map.put("message", "200"); @@ -381,8 +431,8 @@ } // 鏌ヨ鐜荤拑淇℃伅 - public Result SelectGlassInfo(String width, String height, String thickness, String films) { - List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films); + public Result SelectGlassInfo(String width, String height, String thickness, String films, String tier) { + List<GlassInfo> glassInfoList = homeMapper.SelectGlassInfo(width, height, thickness, films, tier); Map<String, Object> map = new HashMap<>(); map.put("StorageCageAddInfo", glassInfoList); return Result.success(map); @@ -391,7 +441,7 @@ // 娣诲姞鐜荤拑鍒版牸瀛愬唴 public Result StorageCageAddGlass(String cell, GlassInfo glassInfo) { homeMapper.StorageCageAddGlass(cell, glassInfo); - UpdateStroageCageByCell(Integer.parseInt(cell), 1); + UpdateStroageCageByCells(Integer.parseInt(cell), 1); Map<String, Object> map = new HashMap<>(); map.put("message", "200"); return Result.success(map); @@ -436,17 +486,48 @@ return Result.success(map); } + // 鎵爜鍖归厤鎴愬姛 + public int ScanMatch(String Order, Integer Mateid, Integer tier) { + + GlassInfo glass = homeMapper.SelectCodeGlass(Order, Mateid, tier); + System.out.println("glass:" + glass); + System.out.println("order" + Order + "mateid" + Mateid + "tier" + tier); + if (glass == null) { + return 0; + } else { + int cont = QueueMapper.insertQueueCode(glass.getFlowcard(), glass.getGlassid(), glass.getMateid(), + glass.getGlasstype(), glass.getWidth(), glass.getHeight(), glass.getThickness()); + glassInfoMapper.updatemeasurenumber(glass.getId()); + return cont; + } + } + // 浜哄伐鍖归厤淇敼娴嬮噺淇℃伅 public Result UpdateQueue(GlassInfo glassInfo) { // 鍒犻櫎鏁版嵁 + PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; Map<String, Object> map = new HashMap<>(); - // QueueMapper.DeleteQueue(); - int count = homeMapper.SelectQueue(); - if (count > 0) { - homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), + QueueMapper.DeleteQueue(); + String mestoplc = plcmes.getPlcParameter("MESToGaStatus").getValue(); + String A02Plc = plcmes.getPlcParameter("GaToMES").getValue(); + System.out.println("浜哄伐鍖归厤mestoplc:" + mestoplc); + // int count = homeMapper.SelectQueue(); + if (("0".equals(mestoplc) && "0".equals(A02Plc)) || ("1".equals(A02Plc) && "4".equals(mestoplc))) { + // homeMapper.UpdateQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), + // glassInfo.getHeight(), + // glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), + // glassInfo.getMateid()); + homeMapper.AddQueue(glassInfo.getFlowcard(), glassInfo.getWidth(), glassInfo.getHeight(), glassInfo.getGlasstype(), glassInfo.getThickness(), glassInfo.getTier(), glassInfo.getMateid()); - PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; - S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); + glassInfoMapper.updatemeasurenumber(glassInfo.getId()); + if ("0".equals(mestoplc)) { + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 1); + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); + System.out.println("鎻愬墠鍖归厤"); + } else { + System.out.println("娴嬮噺鍖归厤"); + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 1); + } map.put("message", "200"); } else { map.put("message", "300"); @@ -462,14 +543,35 @@ public Result ManualTake(String glassInfo) { // 璇诲彇DB105鍖烘枃浠� PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; - // 绉婚櫎 - S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3); - // 鍒犻櫎鏁版嵁 - QueueMapper.DeleteErrorQueue(); - - // plcmes.getPlcParameter("GaToMES").setValue("3"); + String A02Plc = plcmes.getPlcParameter("GaToMES").getValue(); + String A01Plc = plcmes.getPlcParameter("A01ToMES").getValue(); + String A02Mes = plcmes.getPlcParameter("MESToGaStatus").getValue(); Map<String, Object> map = new HashMap<>(); - map.put("message", "200"); + // 绉婚櫎 + if ("1".equals(A02Plc)||"2".equals(A02Plc)||"1".equals(A02Mes)) { + Queue queue = QueueMapper.selectLastQueue3(); + if (queue != null) { + // 鍑忓皯鍖归厤娆℃暟 + glassInfoMapper.updateGlassNumber(queue.getglasstype()); + } + // 鍒犻櫎闃熷垪 + QueueMapper.DeletefromQueue(); + if("0".equals(A02Plc)){ + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 0); + }else{ + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 3); + } + + System.out.println("浜哄伐鎷胯蛋A02Plc:" + A02Plc); + map.put("message", "200"); + }else{ + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToA01").getAddress(), (short) 3); + QueueMapper.DeletefromQueue(); + map.put("message", "300"); + System.out.println("浜哄伐鎷胯蛋A01Plc:" + A01Plc); + } + // plcmes.getPlcParameter("GaToMES").setValue("3"); + return Result.success(map); } @@ -482,14 +584,37 @@ return Result.success(map); } + // 寮�濮�/鏆傚仠鍑虹墖闃熷垪 + public Result UpdateOutTask(Integer id, Integer state) { + homeMapper.UpdateOutTask(id, state); + Map<String, Object> map = new HashMap<>(); + map.put("message", "200"); + return Result.success(map); + } + + // 鍒犻櫎鍑虹墖闃熷垪 + public Result DeleteOutTask(Integer id) { + int cell = homeMapper.SelectOutTaskId(id); + UpdateStroageCageByCell(cell, 1);// 鐜荤拑鏁伴噺+1 + homeMapper.DeleteOutTask(id); + Map<String, Object> map = new HashMap<>(); + map.put("message", "200"); + return Result.success(map); + } + // 鍒犻櫎宸ョ▼ public Result deleteTasks(Map num) { - String flowcard = (String) num.get("num"); - int aa = homeMapper.deleteFlowcard(flowcard.trim()); - homeMapper.deleteGlassinfo(flowcard.trim()); - System.out.println(flowcard); Map<String, Object> map = new HashMap<>(); - map.put("message", flowcard.trim()); + String flowcard = (String) num.get("num"); + int cagenum=homeMapper.selectflowcardCage(flowcard); + if(cagenum==0){ + int aa = homeMapper.deleteFlowcard(flowcard.trim()); + map.put("message","200"); + homeMapper.deleteGlassinfo(flowcard.trim()); + }else{ + map.put("message", "300"); + } + System.out.println("鍒犻櫎宸ョ▼"+flowcard); return Result.success(map); } @@ -506,7 +631,10 @@ // 璇诲彇DB105鍖烘枃浠� PlcParameterObject plcmes = PLCAutoMes.PlcMesObject; // 閲嶆柊娴嬮噺 - S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2); + String PlcRequest = plcmes.getPlcParameter("GaToMES").getValue();// plc璇锋眰瀛� + if ("1".equals(PlcRequest)) { + S7control.getinstance().WriteWord(plcmes.getPlcParameter("MESToGaStatus").getAddress(), (short) 2); + } // 鍒犻櫎鏁版嵁 QueueMapper.DeleteErrorQueue(); // plcmes.getPlcParameter("GaToMES").setValue("2"); @@ -565,8 +693,7 @@ for (Map map : RemoveErrorData) { String key = map.get("base").toString() + "_" + map.get("height").toString() + "_" + map.get("thickness").toString() + "_" + map.get("films").toString() + "_" - + map.get("order").toString() + "_" + map.get("matching").toString(); - + + map.get("order").toString() + "_" + map.get("matching").toString() + map.get("tier").toString(); String tierkey = map.get("order").toString() + "_" + map.get("matching").toString(); String value = TypeData.get(key); @@ -585,16 +712,17 @@ glasstype = Integer.valueOf(value); } // - homeMapper.AddGlassinfo(map.get("order").toString(), glasstype, Integer.parseInt(map.get("matching").toString()) // 闇�瑕佽绠� 閰嶇墖ID , map.get("order").toString() + "-" + count + "" // 闇�瑕佽绠� 鐜荤拑ID , Integer.parseInt(map.get("tier").toString()), map.get("films").toString(), Double.parseDouble(map.get("base").toString()), Double.parseDouble(map.get("height").toString()), Double.parseDouble(map.get("thickness").toString()), - Integer.parseInt(map.get("quantity").toString()), groupby.get(tierkey));// 闇�瑕佽绠楁�诲眰鏁� + Integer.parseInt(map.get("quantity").toString()), groupby.get(tierkey), + map.get("Customer").toString());// 闇�瑕佽绠楁�诲眰鏁� // 璁㈠崟鍐呮�诲眰鏁� - homeMapper.InsertFlowcard(map.get("order").toString(), OrderFinishedProduct.get(tierkey + "_Sum")); + homeMapper.InsertFlowcard(map.get("order").toString(), OrderFinishedProduct.get(tierkey + "_Sum"), + map.get("Customer").toString()); count++; } Map<String, Object> ResultCode = new HashMap<>(); -- Gitblit v1.8.0