|
|
@ -14,6 +14,9 @@ import a8k.service.appeventbus.appevent.AppEvent; |
|
|
|
import a8k.service.hardware.canbus.A8kCanBusService; |
|
|
|
import a8k.service.hardware.canbus.protocol.A8kPacket; |
|
|
|
import a8k.service.hardware.canbus.protocol.CmdId; |
|
|
|
import a8k.service.hardware.canbus.protocol.MId; |
|
|
|
import a8k.service.hardware.canbus.protocol.RegIndex; |
|
|
|
import a8k.service.state_service.A8kStateMgrService; |
|
|
|
import a8k.utils.wq.ZWorkQueue; |
|
|
|
import jakarta.annotation.PostConstruct; |
|
|
|
import jakarta.annotation.Resource; |
|
|
@ -35,10 +38,21 @@ public class ProjectItemMgrService implements AppEventListener { |
|
|
|
@Resource |
|
|
|
AppEventBusService eventBus; |
|
|
|
|
|
|
|
@Resource |
|
|
|
A8kStateMgrService stateMgr; |
|
|
|
|
|
|
|
ZWorkQueue workQueue = new ZWorkQueue(2, 1); |
|
|
|
|
|
|
|
@PostConstruct |
|
|
|
public void init() { |
|
|
|
try { |
|
|
|
if (canBus.moduleGetReg(MId.A8kIdCardReader, RegIndex.kreg_id_card_reader_is_online) == 1) { |
|
|
|
logger.info("ID卡读卡器在线"); |
|
|
|
workQueue.addTask(this::readIDCard); |
|
|
|
} |
|
|
|
} catch (HardwareException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
|
eventBus.regListener(this); |
|
|
|
} |
|
|
|
|
|
|
@ -85,7 +99,8 @@ public class ProjectItemMgrService implements AppEventListener { |
|
|
|
// 判断是否是新的ProjectInfo (by call isNewProjectInfo) |
|
|
|
// 构造NewAppIDCardDetectEvent |
|
|
|
// 发送事件到事件总线上去,事件将由 FrontEndEventRouter 路由到前端 |
|
|
|
// |
|
|
|
// 存储项目信息到数据库中 |
|
|
|
// 调用 stateMgr.setCurrentIdCardInfo(); 将ID卡信息存储到状态管理器中 |
|
|
|
} catch (HardwareException e) { |
|
|
|
throw new RuntimeException(e); |
|
|
|
} |
|
|
@ -101,17 +116,17 @@ public class ProjectItemMgrService implements AppEventListener { |
|
|
|
return AppRet.success(dbGetProjectInfos()); |
|
|
|
} |
|
|
|
|
|
|
|
@EnginnerPageAction(name = "插入项目信息") |
|
|
|
public AppRet<String> InsertProjectInfo(ProjectInfo newpinfo) { |
|
|
|
@EnginnerPageAction(name = "添加项目信息") |
|
|
|
public AppRet<String> addProjectInfo(ProjectInfo newpinfo) { |
|
|
|
var pinfo = ProjectInfo.findOne(ProjectInfo.class, Map.of("lotName", newpinfo.lotName)); |
|
|
|
if (pinfo != null && newpinfo.updateChipVersion < pinfo.updateChipVersion) { |
|
|
|
return AppRet.message("新项目版本低于数据库中的项目版本,不更新",""); |
|
|
|
return AppRet.success("新项目版本低于数据库中的项目版本,不更新"); |
|
|
|
} else { |
|
|
|
if (pinfo != null) { |
|
|
|
pinfo.delete(); |
|
|
|
} |
|
|
|
newpinfo.save(); |
|
|
|
} |
|
|
|
return AppRet.message("插入成功",""); |
|
|
|
return AppRet.success("添加成功"); |
|
|
|
} |
|
|
|
} |