10个文件已修改
1个文件已添加
24个文件已删除
| | |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-websocket</artifactId> |
| | | </dependency> |
| | | |
| | | <!-- led sdk --> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>5m3</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.5.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/bx05-0.5.0-SNAPSHOT.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>5m3message</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.5.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/bx05.message-0.5.0-SNAPSHOT.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>5m3doc</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.5.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/bx05-0.5.0-SNAPSHOT-javadoc.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>rxtx</artifactId> |
| | | <scope>system</scope> |
| | | <version>2.1.7</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/rxtx-2.1.7.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>simple-xml</artifactId> |
| | | <scope>system</scope> |
| | | <version>2.7.1</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/simple-xml-2.7.1.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>stax</artifactId> |
| | | <scope>system</scope> |
| | | <version>1.2.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/stax-1.2.0.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>stax-api</artifactId> |
| | | <scope>system</scope> |
| | | <version>1.0.1</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/stax-api-1.0.1.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>uia-comm</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.5.1</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/uia-comm-0.5.1.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>uia-message</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.6.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/uia-message-0.6.0.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>uia-utils</artifactId> |
| | | <scope>system</scope> |
| | | <version>0.2.0</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/uia-utils-0.2.0.jar</systemPath> |
| | | </dependency> |
| | | <dependency> |
| | | <groupId>com.wcs.led</groupId> |
| | | <artifactId>xpp3</artifactId> |
| | | <scope>system</scope> |
| | | <version>1.1.3.3</version> |
| | | <systemPath>${project.basedir}/src/main/resources/lib/xpp3-1.1.3.3.jar</systemPath> |
| | | <groupId>org.springframework.boot</groupId> |
| | | <artifactId>spring-boot-starter-aop</artifactId> |
| | | </dependency> |
| | | </dependencies> |
| | | |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.annotations.ManagerAuth; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.enums.SiteStatusType; |
| | | import com.zy.asrs.domain.param.SystemSwitchParam; |
| | | import com.zy.asrs.domain.vo.*; |
| | | import com.zy.asrs.entity.BasDevp; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.mapper.LocMastMapper; |
| | | import com.zy.asrs.service.BasDevpService; |
| | | import com.zy.asrs.service.BasMapService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.CodeRes; |
| | | import com.zy.common.model.MapNode; |
| | | import com.zy.common.model.enums.NavigationMapType; |
| | | import com.zy.common.utils.NavigateMapData; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.DevpThread; |
| | | import com.zy.core.Slave; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.model.DevpSlave; |
| | | import com.zy.core.model.protocol.StaProtocol; |
| | | import com.zy.core.properties.SlaveProperties; |
| | | import com.zy.core.properties.SystemProperties; |
| | | import com.zy.core.thread.BarcodeThread; |
| | | import com.zy.core.thread.ScaleThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private BasDevpService basDevpService; |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | @Autowired |
| | | private LocMastMapper locMastMapper; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | @Value("${super.pwd}") |
| | |
| | | Thread.sleep(200L); |
| | | SystemProperties.WCS_RUNNING_STATUS.set(param.getOperatorType()==1?Boolean.TRUE:Boolean.FALSE); |
| | | return R.ok().add(Cools.add("status", SystemProperties.WCS_RUNNING_STATUS.get())); |
| | | } |
| | | |
| | | /****************************************************************/ |
| | | /************************** 实时数据 ******************************/ |
| | | /****************************************************************/ |
| | | |
| | | @PostMapping("/latest/data/site") |
| | | @ManagerAuth(memo = "站点实时数据") |
| | | public R siteLatestData(){ |
| | | List<SiteLatestDataVo> vos = new ArrayList<>(); |
| | | Map<Integer, StaProtocol> stations = new HashMap<>(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | if (null != devpThread) { |
| | | stations.putAll(devpThread.getStation()); |
| | | } |
| | | } |
| | | for (Map.Entry<Integer, StaProtocol> entry : stations.entrySet()) { |
| | | SiteLatestDataVo vo = new SiteLatestDataVo(); |
| | | StaProtocol staProtocol = entry.getValue(); |
| | | vo.setSiteId(String.valueOf(entry.getKey())); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | vo.setSiteStatus(SiteStatusType.process(staProtocol)); // 状态 |
| | | vos.add(vo); |
| | | } |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PostMapping("/latest/data/barcode") |
| | | @ManagerAuth(memo = "条码扫描仪实时数据") |
| | | public R barcodeLatestData(){ |
| | | List<BarcodeDataVo> list = new ArrayList<>(); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, barcode.getId()); |
| | | if (null == barcodeThread) { |
| | | continue; |
| | | } |
| | | BarcodeDataVo vo = new BarcodeDataVo(); |
| | | vo.setBarcodeId(barcode.getId()); |
| | | vo.setCodeValue(barcodeThread.getBarcode()); |
| | | list.add(vo); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | @PostMapping("/latest/data/scale") |
| | | @ManagerAuth(memo = "磅秤实时数据") |
| | | public R scaleLatestData(){ |
| | | List<ScaleDataVo> list = new ArrayList<>(); |
| | | for (Slave scale : slaveProperties.getScale()) { |
| | | ScaleThread scaleThread = (ScaleThread) SlaveConnection.get(SlaveType.Scale, scale.getId()); |
| | | if (null == scaleThread) { |
| | | continue; |
| | | } |
| | | ScaleDataVo vo = new ScaleDataVo(); |
| | | vo.setScaleId(scale.getId()); |
| | | vo.setValue(String.valueOf(Arith.multiplys(1, scaleThread.getScale(), 1))); |
| | | list.add(vo); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | /****************************************************************/ |
| | | /************************** 详情操作 ******************************/ |
| | | /****************************************************************/ |
| | | |
| | | @PostMapping("/site/detail") |
| | | @ManagerAuth(memo = "输送设备数据详情") |
| | | public R siteDetail(@RequestParam Integer siteId){ |
| | | if (Cools.isEmpty(siteId)){ |
| | | return R.parse(CodeRes.EMPTY); |
| | | } |
| | | SiteDetailVo vo = new SiteDetailVo(); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | if (null != devpThread) { |
| | | StaProtocol staProtocol = devpThread.getStation().get(siteId); |
| | | if (staProtocol != null) { |
| | | BasDevp basDevp = basDevpService.selectById(siteId); |
| | | if (basDevp == null) { |
| | | return R.error("数据库维护异常"); |
| | | } |
| | | vo.setSiteId(siteId); // 站点编号 |
| | | vo.setWorkNo(staProtocol.getWorkNo()); // 工作号 |
| | | |
| | | if (staProtocol.getWorkNo() > 0) { |
| | | WrkMast wrkMast = wrkMastService.selectById(staProtocol.getWorkNo()); |
| | | if (wrkMast != null) { |
| | | vo.setWrkSts(wrkMast.getWrkSts$()); // 工作状态 |
| | | vo.setIoType(wrkMast.getIoType$()); // 入出库类型 |
| | | vo.setSourceStaNo(wrkMast.getSourceStaNo$()); |
| | | vo.setStaNo(wrkMast.getStaNo$()); |
| | | vo.setSourceLocNo(wrkMast.getSourceLocNo$()); |
| | | vo.setLocNo(wrkMast.getLocNo$()); |
| | | } |
| | | } |
| | | |
| | | vo.setAutoing(staProtocol.isAutoing()?"Y":"N"); // 自动 |
| | | vo.setLoading(staProtocol.isLoading()?"Y":"N"); // 有物 |
| | | |
| | | vo.setCanining(basDevp.getCanining()); // 能入 |
| | | vo.setCanouting(basDevp.getCanouting()); // 能出 |
| | | |
| | | return R.ok().add(vo); |
| | | } |
| | | } |
| | | } |
| | | return R.error(); |
| | | |
| | | } |
| | | |
| | | @Deprecated |
| | | @PostMapping("/site/update") |
| | | @ManagerAuth(memo = "输送设备数据修改") |
| | | public R updateSite(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Deprecated |
| | | @PostMapping("/crn/update") |
| | | @ManagerAuth(memo = "堆垛机数据修改") |
| | | public R updateCrn(){ |
| | | return R.ok(); |
| | | } |
| | | |
| | | @GetMapping("/barcode/output/site") |
| | | public R barcodeOutput(){ |
| | | return R.ok().add(JSON.toJSONString(new ArrayList<>(OutputQueue.BARCODE))); |
| | | } |
| | | |
| | | @GetMapping("/barcode/list") |
| | | public R barcodeList(){ |
| | | ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
| | | for (Slave slave : slaveProperties.getBarcode()) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | BarcodeThread barcodeThread = (BarcodeThread) SlaveConnection.get(SlaveType.Barcode, slave.getId()); |
| | | map.put("id", slave.getId()); |
| | | map.put("barcode", barcodeThread.getBarcode()); |
| | | list.add(map); |
| | | } |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.NotifyDto; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | | import com.zy.asrs.domain.param.*; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.common.annotations.OpenApiLog; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.dispatcher.ShuttleDispatchUtils; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | |
| | | @Slf4j |
| | |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | |
| | | @PostMapping("/createMoveTask") |
| | | @OpenApiLog(memo = "小车移动任务") |
| | | public R createMoveTask(@RequestBody CreateMoveTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean dispatchShuttle = shuttleDispatchUtils.dispatchShuttle(null, param.getLocNo(), param.getShuttleNo()); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "小车移动任务" |
| | | , "/createMoveTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , dispatchShuttle ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (dispatchShuttle) { |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | //移库任务 |
| | | @PostMapping("/createLocMoveTask") |
| | | @OpenApiLog(memo = "移库任务") |
| | | public R createLocMoveTask(@RequestBody CreateLocMoveTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createLocMoveTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "移库任务" |
| | | , "/createLocMoveTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | //入库任务 |
| | | @PostMapping("/createInTask") |
| | | @OpenApiLog(memo = "入库任务") |
| | | public R createInTask(@RequestBody CreateInTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createInTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "入库任务" |
| | | , "/createInTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | return R.ok(); |
| | | } |
| | |
| | | |
| | | //出库任务 |
| | | @PostMapping("/createOutTask") |
| | | @OpenApiLog(memo = "出库任务") |
| | | public R createOutTask(@RequestBody CreateOutTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createOutTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "出库任务" |
| | | , "/createOutTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("/completeTask") |
| | | @OpenApiLog(memo = "任务完成") |
| | | public R completeTask(@RequestBody CompleteTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.completeTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "任务完成" |
| | | , "/completeTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , completeTask ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("/cancelTask") |
| | | @OpenApiLog(memo = "任务取消") |
| | | public R cancelTask(@RequestBody CancelTaskParam param) { |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.cancelTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "任务取消" |
| | | , "/cancelTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , completeTask ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | |
| | | } |
| | | |
| | | @PostMapping("/deviceStatus") |
| | | @OpenApiLog(memo = "获取设备状态") |
| | | public R getDeviceStatus() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | //获取小车数据 |
| | |
| | | |
| | | map.put("shuttle", shuttleProtocols); |
| | | map.put("forkLift", forkLiftProtocols); |
| | | |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "获取设备状态" |
| | | , "/deviceStatus" |
| | | , null |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(map) |
| | | , null |
| | | , null |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.domain.dto.WorkChartAxis; |
| | | import com.zy.asrs.domain.vo.LocChartPie; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface ReportQueryMapper { |
| | | |
| | | |
| | | @Select("select \n" + |
| | | "Min(wm.io_time) as node,\n" + |
| | | "isnull(count(1), 0) as val\n" + |
| | | "from asr_wrk_mast_log wm\n" + |
| | | "where wm.wrk_sts = 5 \n" + |
| | | "and (wm.io_type = 1 OR wm.io_type = 54)\n" + |
| | | "and datediff(d, wm.io_time, getdate())<=7 \n" + |
| | | "group by datediff(day,wm.io_time,getdate())\n" + |
| | | "order by Min(wm.io_time) asc\n") |
| | | List<Map<String, Object>> queryPakinRep(); |
| | | |
| | | @Select("select\n" + |
| | | "Min(wm.io_time) as node,\n" + |
| | | "isnull(count(1), 0) as val\n" + |
| | | "from asr_wrk_mast_log wm\n" + |
| | | "where 1=1\n" + |
| | | "and ((wm.wrk_sts = 15 AND wm.io_type = 101) OR (wm.wrk_sts = 14 AND wm.io_type = 103))\n" + |
| | | "and datediff(d, wm.io_time, getdate())<=7\n" + |
| | | "group by datediff(day,wm.io_time,getdate())\n" + |
| | | "order by Min(wm.io_time) asc") |
| | | List<Map<String, Object>> queryPakOutRep(); |
| | | |
| | | //曲线图 |
| | | @Select("select ymd,SUM(sto_qty) inqty,SUM(ret_qty) outqty from asr_sta_inout_view " |
| | | + "where ymd>CONVERT(char(10), DATEADD(DAY,-12,GETDATE()), 120) group by ymd order by ymd") |
| | | public List<WorkChartAxis> getChartAxis(); |
| | | |
| | | @Select("select * from asr_loc_use_view") |
| | | LocChartPie getLocUseRate(); |
| | | |
| | | @Select("select count(1) as totalWrk from asr_wrk_mast_log where crn_no = #{crnNo}") |
| | | Integer getTotalWrkByCrnId(Integer crnNo); |
| | | |
| | | @Select("select count(1) as totalLoc from asr_loc_mast") |
| | | Integer getTotalLocByCrnId(); |
| | | |
| | | } |
| | |
| | | R result = liftController.liftStateTable(); |
| | | socketMessage.setData(JSON.toJSONString(result)); |
| | | this.sendMessage(JSON.toJSONString(socketMessage)); |
| | | } else if (socketMessage.getUrl().equals("/console/latest/data/site")) { |
| | | R result = consoleController.siteLatestData(); |
| | | socketMessage.setData(JSON.toJSONString(result)); |
| | | this.sendMessage(JSON.toJSONString(socketMessage)); |
| | | } else if (socketMessage.getUrl().equals("/console/map/auth")) { |
| | | R result = consoleController.getMapFromRedis(Integer.parseInt(socketMessage.getData())); |
| | | socketMessage.setData(JSON.toJSONString(result)); |
| | | this.sendMessage(JSON.toJSONString(socketMessage)); |
| | | } else if (socketMessage.getUrl().equals("/console/barcode/output/site")) { |
| | | R result = consoleController.barcodeOutput(); |
| | | socketMessage.setData(JSON.toJSONString(result)); |
| | | this.sendMessage(JSON.toJSONString(socketMessage)); |
| | | } |
New file |
| | |
| | | package com.zy.common.annotations; |
| | | |
| | | import java.lang.annotation.ElementType; |
| | | import java.lang.annotation.Retention; |
| | | import java.lang.annotation.RetentionPolicy; |
| | | import java.lang.annotation.Target; |
| | | |
| | | @Target({ElementType.TYPE, ElementType.METHOD}) |
| | | @Retention(RetentionPolicy.RUNTIME) |
| | | public @interface OpenApiLog { |
| | | boolean value() default true; |
| | | |
| | | String memo() default ""; |
| | | } |
| | |
| | | } |
| | | |
| | | private void initMq(){ |
| | | // 初始化输送线mq |
| | | for (Slave devp : slaveProperties.getDevp()) { |
| | | MessageQueue.init(SlaveType.Devp, devp); |
| | | } |
| | | // 初始化条码扫描仪mq |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | MessageQueue.init(SlaveType.Barcode, barcode); |
| | | } |
| | | // 初始化Led灯mq |
| | | for (Slave led : slaveProperties.getLed()) { |
| | | MessageQueue.init(SlaveType.Led, led); |
| | | } |
| | | // 初始化磅称mq |
| | | for (Slave scale : slaveProperties.getScale()) { |
| | | MessageQueue.init(SlaveType.Scale, scale); |
| | | } |
| | | // 初始化台车mq |
| | | for (Slave car : slaveProperties.getCar()) { |
| | | MessageQueue.init(SlaveType.Car, car); |
| | | } |
| | | // 初始化货叉提升机mq |
| | | for (Slave forkLift : slaveProperties.getForkLift()) { |
| | | MessageQueue.init(SlaveType.ForkLift, forkLift); |
| | |
| | | } |
| | | |
| | | private void initThread(){ |
| | | // 初始化输送线线程 |
| | | News.info("初始化输送线线程..................................................."); |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | DevpThread devpThread = new SiemensDevpThread(devp); |
| | | new Thread((Runnable) devpThread).start(); |
| | | SlaveConnection.put(SlaveType.Devp, devp.getId(), devpThread); |
| | | } |
| | | // 初始化货叉提升机 |
| | | News.info("初始化货叉提升机........................................................"); |
| | | for (ForkLiftSlave forkLiftSlave : slaveProperties.getForkLift()) { |
| | |
| | | new Thread(shuttleThread).start(); |
| | | SlaveConnection.put(SlaveType.Shuttle, shuttleSlave.getId(), shuttleThread); |
| | | } |
| | | // 初始化条码扫描仪线程 |
| | | News.info("初始化条码扫描仪线程..................................................."); |
| | | for (Slave barcode : slaveProperties.getBarcode()) { |
| | | BarcodeThread barcodeThread = new BarcodeThread(barcode); |
| | | if (barcode.getId() >= 11) { |
| | | new Thread(barcodeThread).start(); |
| | | } |
| | | SlaveConnection.put(SlaveType.Barcode, barcode.getId(), barcodeThread); |
| | | } |
| | | // 初始化LED线程 |
| | | News.info("初始化LED线程..................................................."); |
| | | for (LedSlave led : slaveProperties.getLed()) { |
| | | LedThread ledThread = new LedThread(led); |
| | | new Thread(ledThread).start(); |
| | | SlaveConnection.put(SlaveType.Led, led.getId(), ledThread); |
| | | } |
| | | // 初始化磅秤线程 |
| | | // News.info("初始化磅秤线程..................................................."); |
| | | // for (Slave scale : slaveProperties.getScale()) { |
| | | // ScaleThread barcodeThread = new ScaleThread(scale); |
| | | // new Thread(barcodeThread).start(); |
| | | // SlaveConnection.put(SlaveType.Scale, scale.getId(), barcodeThread); |
| | | // } |
| | | } |
| | | |
| | | |
| | |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentLinkedQueue; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | |
| | | /** |
| | | * 消息队列 |
| | |
| | | */ |
| | | public class MessageQueue { |
| | | |
| | | // 输送线mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 条码扫描仪mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> BARCODE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // Led灯 mq交换机 |
| | | private static final Map<Integer, LinkedBlockingQueue<Task>> LED_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 磅称mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> SCALE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | // 台车mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> CAR_EXCHANGE = new ConcurrentHashMap<>(); |
| | | //四向穿梭车mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> SHUTTLE_EXCHANGE = new ConcurrentHashMap<>(); |
| | | //提升机mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> LIFT_EXCHANGE = new ConcurrentHashMap<>(); |
| | | //货叉提升机mq交换机 |
| | | private static final Map<Integer, ConcurrentLinkedQueue<Task>> FORK_LIFT_EXCHANGE = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | | * mq 交换机初始化 |
| | | */ |
| | | public static void init(SlaveType type, Slave slave) { |
| | | switch (type) { |
| | | case Devp: |
| | | DEVP_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Barcode: |
| | | BARCODE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Led: |
| | | LED_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1)); |
| | | break; |
| | | case Scale: |
| | | SCALE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Car: |
| | | CAR_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Shuttle: |
| | | SHUTTLE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case ForkLift: |
| | | FORK_LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | | break; |
| | | case Lift: |
| | | LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>()); |
| | |
| | | */ |
| | | public static boolean offer(SlaveType type, Integer id, Task task) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).offer(task); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).offer(task); |
| | | case Led: |
| | | return LED_EXCHANGE.get(id).offer(task); |
| | | case Scale: |
| | | return SCALE_EXCHANGE.get(id).offer(task); |
| | | case Car: |
| | | return CAR_EXCHANGE.get(id).offer(task); |
| | | case Shuttle: |
| | | return SHUTTLE_EXCHANGE.get(id).offer(task); |
| | | case ForkLift: |
| | | return FORK_LIFT_EXCHANGE.get(id).offer(task); |
| | | case Lift: |
| | | return LIFT_EXCHANGE.get(id).offer(task); |
| | | default: |
| | |
| | | */ |
| | | public static Task poll(SlaveType type, Integer id) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).poll(); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).poll(); |
| | | case Led: |
| | | return LED_EXCHANGE.get(id).poll(); |
| | | case Scale: |
| | | return SCALE_EXCHANGE.get(id).poll(); |
| | | case Car: |
| | | return CAR_EXCHANGE.get(id).poll(); |
| | | case Shuttle: |
| | | return SHUTTLE_EXCHANGE.get(id).poll(); |
| | | case ForkLift: |
| | | return FORK_LIFT_EXCHANGE.get(id).poll(); |
| | | case Lift: |
| | | return LIFT_EXCHANGE.get(id).poll(); |
| | | default: |
| | |
| | | */ |
| | | public static Task peek(SlaveType type, Integer id) { |
| | | switch (type) { |
| | | case Devp: |
| | | return DEVP_EXCHANGE.get(id).peek(); |
| | | case Barcode: |
| | | return BARCODE_EXCHANGE.get(id).peek(); |
| | | case Led: |
| | | return LED_EXCHANGE.get(id).peek(); |
| | | case Scale: |
| | | return SCALE_EXCHANGE.get(id).peek(); |
| | | case Car: |
| | | return CAR_EXCHANGE.get(id).peek(); |
| | | case Shuttle: |
| | | return SHUTTLE_EXCHANGE.get(id).peek(); |
| | | case ForkLift: |
| | | return FORK_LIFT_EXCHANGE.get(id).peek(); |
| | | case Lift: |
| | | return LIFT_EXCHANGE.get(id).peek(); |
| | | default: |
| | |
| | | |
| | | public static void clear(SlaveType type, Integer id){ |
| | | switch (type) { |
| | | case Devp: |
| | | DEVP_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Barcode: |
| | | BARCODE_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Led: |
| | | LED_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Scale: |
| | | SCALE_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Car: |
| | | CAR_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Shuttle: |
| | | SHUTTLE_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case ForkLift: |
| | | FORK_LIFT_EXCHANGE.get(id).clear(); |
| | | break; |
| | | case Lift: |
| | | LIFT_EXCHANGE.get(id).clear(); |
| | | break; |
| | |
| | | */ |
| | | public class OutputQueue { |
| | | |
| | | // 堆垛机输出日志 |
| | | public static ArrayBlockingQueue<String> CRN = new ArrayBlockingQueue<>(32); |
| | | // 输送线输出日志 |
| | | public static ArrayBlockingQueue<String> DEVP = new ArrayBlockingQueue<>(32); |
| | | // 条码器输出日志 |
| | | public static ArrayBlockingQueue<JSONObject> BARCODE = new ArrayBlockingQueue<>(32); |
| | | // 穿梭车输出日志 |
| | | public static ArrayBlockingQueue<String> STE = new ArrayBlockingQueue<>(32); |
| | | //四向穿梭车输出日志 |
| | | public static ArrayBlockingQueue<String> SHUTTLE = new ArrayBlockingQueue<>(32); |
| | | //提升机输出日志 |
| | |
| | | |
| | | public enum SlaveType { |
| | | |
| | | Crn, |
| | | Devp, |
| | | Barcode, |
| | | Led, |
| | | Scale, |
| | | Car, |
| | | Ste, |
| | | Shuttle, |
| | | Lift, |
| | | ForkLift, |
| | |
| | | |
| | | private int groupCount; |
| | | |
| | | private List<String> channel = new ArrayList<>(); |
| | | |
| | | private List<DevpSlave> devp = new ArrayList<>(); |
| | | |
| | | private List<Slave> barcode = new ArrayList<>(); |
| | | |
| | | private List<LedSlave> led = new ArrayList<>(); |
| | | |
| | | private List<Slave> scale = new ArrayList<>(); |
| | | |
| | | private List<Slave> car = new ArrayList<>(); |
| | | |
| | | private List<ShuttleSlave> shuttle = new ArrayList<>(); |
| | | |
| | | private List<ForkLiftSlave> forkLift = new ArrayList<>(); |