| | |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.StationCommandType; |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.command.StationCommand; |
| | | import com.zy.core.network.api.ZyStationConnectApi; |
| | |
| | | return new CommandResponse(true, "命令已受理(异步执行)"); |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse sendOriginCommand(String address, short[] data) { |
| | | return new CommandResponse(true, "原始命令已受理(异步执行)"); |
| | | } |
| | | |
| | | @Override |
| | | public byte[] readOriginCommand(String address, int length) { |
| | | return new byte[0]; |
| | | } |
| | | |
| | | private void handleCommand(Integer deviceNo, StationCommand command) { |
| | | News.info("[WCS Debug] 站点仿真模拟已启动,命令数据={}", JSON.toJSONString(command)); |
| | | Integer taskNo = command.getTaskNo(); |
| | | Integer stationId = command.getStationId(); |
| | | Integer targetStationId = command.getTargetStaNo(); |
| | | StationCommandType commandType = command.getCommandType(); |
| | | boolean generateBarcode = false; |
| | | |
| | | if(taskNo == 0 && targetStationId == 0){ |
| | | //清空站点 |
| | | resetStation(deviceNo, stationId); |
| | | return; |
| | | if(commandType == StationCommandType.RESET){ |
| | | if(taskNo == 0 && targetStationId == 0){ |
| | | //清空站点 |
| | | resetStation(deviceNo, stationId); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if(commandType == StationCommandType.WRITE_INFO){ |
| | | if (taskNo == 9998 && targetStationId == 0) { |
| | | //生成出库站点仿真数据 |
| | | generateFakeOutStationData(deviceNo, stationId); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //任务号属于仿真入库任务号 |
| | | if (checkTaskNoInArea(taskNo)) { |
| | | //生成仿真数据 |
| | | generateBarcode = true; |
| | | } |
| | | |
| | | if (taskNo == 9998 && targetStationId == 0) { |
| | | //生成出库站点仿真数据 |
| | | generateFakeOutStationData(deviceNo, stationId); |
| | | return; |
| | | } |
| | | |
| | | if (taskNo > 0 && taskNo != 9999 && taskNo != 9998 && stationId == targetStationId) { |