From 4420bfb992da73896ae21107ae45b981df4c726e Mon Sep 17 00:00:00 2001 From: lsh <lsh123456> Date: 星期四, 29 十二月 2022 11:38:36 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | 45 ++++++++++++++++++++++ src/main/webapp/views/console.html | 6 +- src/main/java/com/zy/asrs/controller/MonitorController.java | 41 ++++++++++++++++++++ src/main/java/com/zy/asrs/mapper/WrkMastMapper.java | 2 + src/main/resources/mapper/WrkMastMapper.xml | 3 + 5 files changed, 92 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/MonitorController.java b/src/main/java/com/zy/asrs/controller/MonitorController.java index 32f943a..796ecff 100644 --- a/src/main/java/com/zy/asrs/controller/MonitorController.java +++ b/src/main/java/com/zy/asrs/controller/MonitorController.java @@ -11,7 +11,10 @@ import com.zy.core.CrnThread; import com.zy.core.cache.SlaveConnection; import com.zy.core.enums.SlaveType; +import com.zy.core.model.LedSlave; +import com.zy.core.model.command.LedCommand; import com.zy.core.model.protocol.CrnProtocol; +import com.zy.core.properties.SlaveProperties; import com.zy.core.thread.LedThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -33,6 +36,8 @@ @Autowired private ReportQueryMapper reportQueryMapper; + @Autowired + private SlaveProperties slaveProperties; /** * 鑾峰彇褰撳墠鏃堕棿 @@ -62,7 +67,7 @@ case 101: ledId=1; break; - case 107: + case 109: ledId=2; break; case 117: @@ -264,7 +269,41 @@ ); } + /** + * 鑾峰彇鍏朵粬淇℃伅 + */ + @GetMapping("/led") + public R monitorLed(@RequestParam("ledId") Integer ledId) { + String ledContent = ""; + List<LedCommand> commandList = null; + for (LedSlave slave : slaveProperties.getLed()) { + if (slave.getStaArr().contains(ledId)) { + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); + if (null != ledThread) { + ledContent = ledThread.getStringBuffer().toString(); + commandList = ledThread.getCommandList(); + } + } + } + return R.ok().add(commandList); + } + /** + * 寮傚父閫氱煡 + */ + @GetMapping("/led/error") + public R monitorLedError(@RequestParam("ledId") Integer ledId) { + String errorMsg = ""; + for (LedSlave slave : slaveProperties.getLed()) { + if (slave.getStaArr().contains(ledId)) { + LedThread ledThread = (LedThread) SlaveConnection.get(SlaveType.Led, slave.getId()); + if (null != ledThread) { + errorMsg = ledThread.getErrorMsg().toString(); + } + } + } + return R.ok().add(errorMsg); + } diff --git a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java index 4685cbd..7386c18 100644 --- a/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java +++ b/src/main/java/com/zy/asrs/mapper/WrkMastMapper.java @@ -25,6 +25,8 @@ // @Select("select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=2 and barcode=#{barcode} and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC") WrkMast selectPakInStep1(@Param("sourceStaNo")Integer sourceStaNo, @Param("barcode")String barcode); + WrkMast selectPakInStepBarcode(@Param("barcode")String barcode); + WrkMast selectPakInStep11(@Param("sourceStaNo")Integer sourceStaNo); // 鍏ュ簱绗簩姝ワ紝褰撴墭鐩樼墿鏂欏湪鍫嗗灈鏈哄叆搴撶珯鏃舵椂鏌ヨ diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java index 4c8e014..b609a62 100644 --- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java @@ -150,11 +150,31 @@ // 鍒ゆ柇閲嶅宸ヤ綔妗� WrkMast wrkMast = wrkMastMapper.selectPakInStep1(inSta.getStaNo(), barcode); + WrkMast wrkMast1 = wrkMastMapper.selectPakInStepBarcode(barcode); + if (wrkMast1 !=null){ + if (wrkMast1.getIoType()==103 || wrkMast1.getIoType()==107 || wrkMast1.getIoType()==104){ + continue; + } + } if (wrkMast != null) { log.error("宸ヤ綔妗d腑宸插瓨鍦ㄨ绔欑姸鎬佷负锛� 2.璁惧涓婅蛋 锛夌殑鏁版嵁,宸ヤ綔鍙�={}", wrkMast.getWrkNo()); - if (inSta.getStaNo()==100 || inSta.getStaNo()==108 || inSta.getStaNo()==116){ + if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ staProtocol.setWorkNo((short)9999); staProtocol.setStaNo((short)100); + devpThread.setPakMk(staProtocol.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + if (!result) { + throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); + } + }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ + staProtocol.setWorkNo((short)9999); + if (inSta.getStaNo()==201){ + staProtocol.setStaNo((short)200); + }else if (inSta.getStaNo()==207){ + staProtocol.setStaNo((short)206); + }else if (inSta.getStaNo()==213){ + staProtocol.setStaNo((short)212); + } devpThread.setPakMk(staProtocol.getSiteId(), false); boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); if (!result) { @@ -199,6 +219,29 @@ } } else { log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); + if (inSta.getStaNo()==101 || inSta.getStaNo()==109 || inSta.getStaNo()==117){ + staProtocol.setWorkNo((short)9999); + staProtocol.setStaNo((short)100); + devpThread.setPakMk(staProtocol.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + if (!result) { + throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); + } + }else if (inSta.getStaNo()==201 || inSta.getStaNo()==207 || inSta.getStaNo()==213){ + staProtocol.setWorkNo((short)9999); + if (inSta.getStaNo()==201){ + staProtocol.setStaNo((short)200); + }else if (inSta.getStaNo()==207){ + staProtocol.setStaNo((short)206); + }else if (inSta.getStaNo()==213){ + staProtocol.setStaNo((short)212); + } + devpThread.setPakMk(staProtocol.getSiteId(), false); + boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); + if (!result) { + throw new CoolException("鏇存柊plc绔欑偣淇℃伅澶辫触"); + } + } } diff --git a/src/main/resources/mapper/WrkMastMapper.xml b/src/main/resources/mapper/WrkMastMapper.xml index d078984..247a32a 100644 --- a/src/main/resources/mapper/WrkMastMapper.xml +++ b/src/main/resources/mapper/WrkMastMapper.xml @@ -86,6 +86,9 @@ <select id="selectPakInStep1" resultMap="BaseResultMap"> select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=2 and barcode=#{barcode} and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC </select> + <select id="selectPakInStepBarcode" resultMap="BaseResultMap"> + select top 1 * from dbo.asr_wrk_mast where barcode = #{barcode} + </select> <select id="selectPakInStep11" resultMap="BaseResultMap"> select top 1 * from asr_wrk_mast where source_sta_no=#{sourceStaNo} and wrk_sts=1 and (io_type=1 or io_type=10) order by io_pri desc,io_time,wrk_no ASC diff --git a/src/main/webapp/views/console.html b/src/main/webapp/views/console.html index a8d4498..dee93e6 100644 --- a/src/main/webapp/views/console.html +++ b/src/main/webapp/views/console.html @@ -605,11 +605,11 @@ var offSet = 0; switch (i) { case 0: - case 1:; + case 1: case 2: case 3: - unit = 150; - offSet = 550; + unit = 35; + offSet = 500; break; case 5: unit = 124; -- Gitblit v1.9.1