| | |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.enums.StationCommandType; |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.StationObjModel; |
| | |
| | | } |
| | | |
| | | // 条码扫描器 |
| | | OperateResultExOne<byte[]> result2 = siemensNet.Read("DB101.0", (short) (barcodeOriginList.size() * 16)); |
| | | OperateResultExOne<byte[]> result2 = siemensNet.Read("DB101.16", (short) (barcodeOriginList.size() * 16)); |
| | | if (result2.IsSuccess) { |
| | | for (int i = 0; i < barcodeOriginList.size(); i++) { |
| | | ZyStationStatusEntity barcodeEntity = findStatusEntityByBarcodeIdx(i + 1); |
| | |
| | | } |
| | | |
| | | // 称重 |
| | | OperateResultExOne<byte[]> result3 = siemensNet.Read("DB102.0", (short) (barcodeOriginList.size() * 4)); |
| | | OperateResultExOne<byte[]> result3 = siemensNet.Read("DB102.4", (short) (barcodeOriginList.size() * 4)); |
| | | if (result3.IsSuccess) { |
| | | for (int i = 0; i < barcodeOriginList.size(); i++) { |
| | | ZyStationStatusEntity barcodeEntity = findStatusEntityByBarcodeIdx(i + 1); |
| | |
| | | } |
| | | |
| | | // 报警信息 |
| | | OperateResultExOne<byte[]> result4 = siemensNet.Read("DB103.0", (short) (barcodeOriginList.size() * 2)); |
| | | OperateResultExOne<byte[]> result4 = siemensNet.Read("DB103.2", (short) (barcodeOriginList.size() * 2)); |
| | | if (result4.IsSuccess) { |
| | | for (int i = 0; i < barcodeOriginList.size(); i++) { |
| | | ZyStationStatusEntity barcodeEntity = findStatusEntityByBarcodeIdx(i + 1); |
| | |
| | | OperateResult writeConfirm = siemensNet.Write("DB23." + (enableCommandIdx * taskAddressLength + 46), (short) 1); |
| | | |
| | | if(writeTask.IsSuccess && writeData.IsSuccess && writeConfirm.IsSuccess) { |
| | | log.error("写入输送线命令成功。任务号={},站点数据={}", command.getTaskNo(), JSON.toJSON(command)); |
| | | log.info("写入输送线命令成功。任务号={},站点数据={}", command.getTaskNo(), JSON.toJSON(command)); |
| | | commandResponse.setResult(true); |
| | | }else { |
| | | log.error("写入输送线命令失败。站点编号={},站点数据={}", command.getTaskNo(), JSON.toJSON(command)); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public CommandResponse sendOriginCommand(String address, short[] data) { |
| | | public synchronized CommandResponse sendOriginCommand(String address, short[] data) { |
| | | CommandResponse commandResponse = new CommandResponse(false); |
| | | if (null == data || data.length == 0) { |
| | | commandResponse.setMessage("数据为空"); |