修复项目上出现的少量BUG

This commit is contained in:
葛林强 2026-03-23 14:24:27 +08:00
parent 525491eaeb
commit 1850059708
6 changed files with 21 additions and 44 deletions

View File

@ -1,11 +1,9 @@
package org.wcs.business.led;
import org.springframework.stereotype.Service;
import org.wcs.model.pojo.led.LedDataDetail;
import org.wcs.model.pojo.led.LedShowData;
import com.listenvision.LxLedCommunication;
import java.util.List;
/**
* 灵信LED屏操作类
@ -20,34 +18,6 @@ public class LxLedOperation implements ledOperation {
*/
@Override
public synchronized String showLedBase(LedShowData ledShowData) {
try {
LxLedCommunication.InitLedType(ledShowData.getLedType()); // 初始化卡型号
// 创建一个节目
long createResult = LxLedCommunication.CreateProgram(ledShowData.getLedWidth(), ledShowData.getLedHeight(), ledShowData.getColorType(), 0, 3);
if (createResult == 0) {
return "节目对象创建失败";
}
List<LedDataDetail> dataDetails = ledShowData.getDataDetails();
if(dataDetails == null || dataDetails.isEmpty()) {
return "显示内容为空";
}
for (int i = 0; i < dataDetails.size(); i++) {
LedDataDetail dataDetail = dataDetails.get(i);
int createAreaResult = LxLedCommunication.AddMultiLineTextToImageTextArea(createResult, 0, i, 0,
dataDetail.getContent(), dataDetail.getFontName(), dataDetail.getFontSize(), dataDetail.getFontColor(), 0, 0, 0,
dataDetail.getInStyle(), dataDetail.getNSpeed(), 0, dataDetail.getNSpeed(), dataDetail.isVCenterIs() ? 1 : 0);
if (createAreaResult != 0) {
return "区域创建失败,错误信息:" + LxLedCommunication.GetErrorCodeInfo(createAreaResult);
}
}
int sendResult = LxLedCommunication.NetWorkSend(ledShowData.getLedIp(), createResult);
if (sendResult != 0) {
return "发送失败,错误信息:" + LxLedCommunication.GetErrorCodeInfo(sendResult);
}
LxLedCommunication.DeleteProgram(createResult);
return "发送成功";
} catch (Exception e) {
return "LED屏显示失败异常信息" + e.getMessage();
}
return null;
}
}

View File

@ -56,6 +56,7 @@ public class StackerTaskCreator {
task.setTaskType(StackerTaskTypeEnum.IN.getCode().shortValue());
task.setGetStand(AppStringUtils.forceToShort(origin));
task.setGetLaneId(originLocation.getLaneId().shortValue());
task.setSetLaneId(destinationLocation.getLaneId().shortValue());
task.setSetDepth(destinationLocation.getLaneId().shortValue());
task.setSetStand(AppStringUtils.forceToShort(destination));
task.setGetRow(AppObjectUtils.stringToInteger(originLocationData.length > 0, originLocationData[0]).shortValue());
@ -117,6 +118,7 @@ public class StackerTaskCreator {
task.setTaskType(StackerTaskTypeEnum.ERROR.getCode().shortValue());
task.setGetStand(AppStringUtils.forceToShort(origin));
task.setGetLaneId(originLocation.getLaneId().shortValue());
task.setSetLaneId(destinationLocation.getLaneId().shortValue());
task.setSetDepth(destinationLocation.getLaneId().shortValue());
task.setSetStand(AppStringUtils.forceToShort(destination));
task.setGetRow(AppObjectUtils.stringToInteger(originLocationData.length > 0, originLocationData[0]).shortValue());
@ -170,6 +172,7 @@ public class StackerTaskCreator {
task.setTaskType(StackerTaskTypeEnum.OUT.getCode().shortValue());
task.setGetStand(AppStringUtils.forceToShort(origin));
task.setGetLaneId(originLocation.getLaneId().shortValue());
task.setSetLaneId(destinationLocation.getLaneId().shortValue());
task.setSetDepth(destinationLocation.getLaneId().shortValue());
task.setSetStand(AppStringUtils.forceToShort(destination));
task.setGetRow(originLocation.getLRow().shortValue());
@ -221,6 +224,7 @@ public class StackerTaskCreator {
task.setTaskType(StackerTaskTypeEnum.MOVE.getCode().shortValue());
task.setGetStand(AppStringUtils.forceToShort(origin));
task.setGetLaneId(originLocation.getLaneId().shortValue());
task.setSetLaneId(destinationLocation.getLaneId().shortValue());
task.setSetDepth(destinationLocation.getLaneId().shortValue());
task.setSetStand(AppStringUtils.forceToShort(destination));
task.setGetRow(originLocation.getLRow().shortValue());

View File

@ -396,14 +396,15 @@ public class PlcSiemensCommunication implements IPlcCommunication {
return new Tuple2<>(readResult.Message, null);
}
byte[] readBytes = readResult.Content; // 读到的数据
ScanInfo scanInfo = new ScanInfo();
scanInfo.setTag(siemensS7Net.getByteTransform().TransInt16(readBytes, 0));
scanInfo.setVehicleSize(siemensS7Net.getByteTransform().TransInt16(readBytes, 2));
scanInfo.setLength(siemensS7Net.getByteTransform().TransInt32(readBytes, 4));
scanInfo.setWidth(siemensS7Net.getByteTransform().TransInt32(readBytes, 8));
scanInfo.setHeight(siemensS7Net.getByteTransform().TransInt32(readBytes, 12));
scanInfo.setWeight(siemensS7Net.getByteTransform().TransInt32(readBytes, 16));
scanInfo.setVehicleNo(siemensS7Net.getByteTransform().TransString(readBytes, 20 , PlcConfig.PLC_CONFIG_TASK_CONVEY_CODE_LENGTH, StandardCharsets.US_ASCII));
ScanInfo scanInfo = ScanInfo.builder()
.tag(siemensS7Net.getByteTransform().TransInt16(readBytes, 0))
.vehicleSize(siemensS7Net.getByteTransform().TransInt16(readBytes, 2))
.length(siemensS7Net.getByteTransform().TransInt32(readBytes, 4))
.width(siemensS7Net.getByteTransform().TransInt32(readBytes, 8))
.height(siemensS7Net.getByteTransform().TransInt32(readBytes, 12))
.weight(siemensS7Net.getByteTransform().TransInt32(readBytes, 16))
.vehicleNo(siemensS7Net.getByteTransform().TransString(readBytes, 20 , PlcConfig.PLC_CONFIG_TASK_CONVEY_CODE_LENGTH, StandardCharsets.US_ASCII))
.build();
return new Tuple2<>(null, scanInfo);
}

View File

@ -1,5 +1,6 @@
package org.wcs.plugin.plc.model;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
@ -8,6 +9,7 @@ import lombok.Setter;
*/
@Setter
@Getter
@Builder
public class ScanInfo {
/**

View File

@ -225,7 +225,7 @@ public class ResolveStockTaskJob implements Job {
*/
private void resolveEndStockTask(List<AppStockComposeTask> endTaskList) {
for (AppStockComposeTask composeTask : endTaskList) {
List<AppStockSingleTask> stockSingleTasks = stockSingleTaskService.queryByUpperTaskId(composeTask.getUpperTaskId());
List<AppStockSingleTask> stockSingleTasks = stockSingleTaskService.queryByUpperTaskId(composeTask.getTaskId());
if(stockSingleTasks == null) {
continue;
}
@ -234,7 +234,7 @@ public class ResolveStockTaskJob implements Job {
Tuple2<String, String> reporterResult = ReportStandard.stockTaskReport(StockCallBackStatusEnum.FINISH, composeTask, composeTask.getTaskMsg());
if(reporterResult.getItem1() != null) {
log.info("任务完成上报失败组合任务ID{},错误信息:{}", composeTask.getTaskId(), reporterResult.getItem1());
dataRecorder.recordStockMsg(composeTask.getUpperTaskId(), composeTask.getVehicleNo(), "任务完成上报失败,错误信息:" + reporterResult.getItem1());
dataRecorder.recordStockMsg(composeTask.getTaskId(), composeTask.getVehicleNo(), "任务完成上报失败,错误信息:" + reporterResult.getItem1());
return;
}
log.info("任务完成上报成功组合任务ID{},返回信息:{}", composeTask.getTaskId(), reporterResult.getItem2());
@ -258,7 +258,7 @@ public class ResolveStockTaskJob implements Job {
Tuple2<String, String> reporterResult = ReportStandard.stockTaskReport(StockCallBackStatusEnum.CANCEL, composeTask, composeTask.getTaskMsg());
if(reporterResult.getItem1() != null) {
log.info("任务取消上报失败组合任务ID{},错误信息:{}", composeTask.getTaskId(), reporterResult.getItem1());
dataRecorder.recordStockMsg(composeTask.getUpperTaskId(), composeTask.getVehicleNo(), "任务取消上报失败,错误信息:" + reporterResult.getItem1());
dataRecorder.recordStockMsg(composeTask.getTaskId(), composeTask.getVehicleNo(), "任务取消上报失败,错误信息:" + reporterResult.getItem1());
return;
}
log.info("任务取消上报成功组合任务ID{},返回信息:{}", composeTask.getTaskId(), reporterResult.getItem2());

View File

@ -1,6 +1,6 @@
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/wcs?characterEncoding=utf8&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/wcs?characterEncoding=utf8&useSSL=false&useUnicode=true&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
username: root
password: Root123456
data: