| | |
| | | |
| | | @Override |
| | | public byte[] writeToBytes() { |
| | | return new byte[0]; |
| | | |
| | | return Utils.merge( |
| | | Utils.reverse(RadixTools.shortToByte((short) this.faultId)) |
| | | , Utils.reverse(RadixTools.hexStringToBytes(this.hexFaultId)) |
| | | , (byte) this.faultStatus |
| | | , (byte) this.faultLevel |
| | | , Utils.reverse(RadixTools.intToBytes(this.data1)) |
| | | , Utils.reverse(RadixTools.intToBytes(this.data2)) |
| | | , Utils.reverse(RadixTools.intToBytes(this.flag)) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | |
| | | VITE_BASE_IP=localhost |
| | | VITE_BASE_PORT=8088 |
| | | # VITE_BASE_IP=localhost |
| | | # VITE_BASE_PORT=8088 |
| | | |
| | | # VITE_BASE_IP=192.168.1.100 |
| | | # VITE_BASE_PORT=8080 |
| | | VITE_BASE_IP=192.168.1.100 |
| | | VITE_BASE_PORT=8080 |
| | |
| | | workTime: "work time", |
| | | workDistance: "mileage", |
| | | backpack: "backpack", |
| | | password: "password", |
| | | error: "error", |
| | | errorTime: "errorTime", |
| | | online: 'online', |
| | | task: 'task', |
| | | }, |
| | |
| | | workTime: "工作时间", |
| | | workDistance: "累计里程", |
| | | backpack: "背篓", |
| | | password: "密码", |
| | | error: "故障", |
| | | errorTime: "故障时间", |
| | | online: '在线', |
| | | task: '任务', |
| | | }, |
| | |
| | | > |
| | | <AltRoute /> |
| | | </Fab> |
| | | <FakeFab |
| | | /> |
| | | <FakeFab /> |
| | | </> |
| | | )} |
| | | <Fab |
| | |
| | | const handleToggle = () => { |
| | | getFakeSign(null, (res) => { |
| | | let pass = true; |
| | | // if (!res) { |
| | | // const pwd = prompt("please enter password:"); |
| | | // if (pwd === 'xltys1995') { |
| | | // pass = true; |
| | | // } else { |
| | | // pass = false; |
| | | // alert('Incorrect password'); |
| | | // } |
| | | // } |
| | | if (!res) { |
| | | const pwd = prompt("please enter password:"); |
| | | if (pwd === 'xltys1995') { |
| | | pass = true; |
| | | } else { |
| | | pass = false; |
| | | if (!pwd) { |
| | | alert('Incorrect password'); |
| | | } |
| | | } |
| | | } |
| | | if (pass) { |
| | | setFakeSign(!res, (updatedSign) => { |
| | | setFakeRun(updatedSign); |
| | |
| | | source="backpack" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.agvDetail.password" |
| | | source="password" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | |
| | | source="backpack" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.agvDetail.password" |
| | | source="password" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.password" |
| | | property={record.password} |
| | | title="table.field.agvDetail.error" |
| | | property={record.error} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.agvDetail.errorTime" |
| | | property={record.errorTime} |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | |
| | | <ReferenceInput source="taskType" label="table.field.task.taskType" reference="taskType"> |
| | | <AutocompleteInput label="table.field.task.taskType" optionText="name" filterToQuery={(val) => ({ name: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="agvId" label="table.field.task.agvId" reference="agv"> |
| | | <ReferenceInput source="agvId" label="table.field.task.agvId" reference="agv" alwaysOn> |
| | | <AutocompleteInput label="table.field.task.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | | // <DateInput source="ioTime" label="table.field.task.ioTime" />, |
| | | // <DateInput source="startTime" label="table.field.task.startTime" />, |
| | | // <DateInput source="endTime" label="table.field.task.endTime" />, |
| | | // <DateInput source="errTime" label="table.field.task.errTime" />, |
| | | <ReferenceInput source="oriSta" label="table.field.task.oriSta" reference="sta" alwaysOn> |
| | | <ReferenceInput source="oriSta" label="table.field.task.oriSta" reference="sta"> |
| | | <AutocompleteInput label="table.field.task.oriSta" optionText="staNo" filterToQuery={(val) => ({ staNo: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="oriLoc" label="table.field.task.oriLoc" reference="loc" alwaysOn> |
| | |
| | | <ReferenceInput source="oriCode" label="table.field.task.oriCode" reference="code"> |
| | | <AutocompleteInput label="table.field.task.oriCode" optionText="data" filterToQuery={(val) => ({ data: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="destSta" label="table.field.task.destSta" reference="sta" alwaysOn> |
| | | <ReferenceInput source="destSta" label="table.field.task.destSta" reference="sta"> |
| | | <AutocompleteInput label="table.field.task.destSta" optionText="staNo" filterToQuery={(val) => ({ staNo: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="destLoc" label="table.field.task.destLoc" reference="loc" alwaysOn> |
| | |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="uuid" label="table.field.vehFaultRec.uuid" />, |
| | | <ReferenceInput source="agvId" label="table.field.vehFaultRec.agvId" reference="agv"> |
| | | <ReferenceInput source="agvId" label="table.field.vehFaultRec.agvId" reference="agv" alwaysOn> |
| | | <AutocompleteInput label="table.field.vehFaultRec.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | | <TextInput source="faultNo" label="table.field.vehFaultRec.faultNo" />, |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='vehFaultRec' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='vehFaultRec' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <VehFaultRecPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'uuid', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.vehFaultRec.uuid" /> |
| | |
| | | <DateField source="resetTime" label="table.field.vehFaultRec.resetTime" showTime /> |
| | | <TextField source="state" label="table.field.vehFaultRec.state" /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | {/* <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | </ReferenceField> */} |
| | | {/* <DateField source="createTime" label="common.field.createTime" showTime /> */} |
| | | {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | {/* <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </WrapperField> */} |
| | | </StyledDatagrid> |
| | | </List> |
| | | <VehFaultRecCreate |
| | |
| | | package com.zy.acs.manager.core.domain; |
| | | |
| | | import com.zy.acs.common.domain.protocol.IMessageBody; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by vincent on 8/19/2024 |
| | | */ |
| | | @Data |
| | | public class VehicleFaultDto { |
| | | public class VehicleFaultDto<T extends IMessageBody> { |
| | | |
| | | private String vehicle; |
| | | |
| | | private long timestamp; |
| | | |
| | | private T t; |
| | | |
| | | public VehicleFaultDto() { |
| | | } |
| | | |
| | | public VehicleFaultDto(String vehicle, T t) { |
| | | this.vehicle = vehicle; |
| | | this.t = t; |
| | | } |
| | | |
| | | public VehicleFaultDto(String vehicle, long timestamp, T t) { |
| | | this.vehicle = vehicle; |
| | | this.timestamp = timestamp; |
| | | this.t = t; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.DateUtils; |
| | | import com.zy.acs.manager.core.domain.BackpackDto; |
| | | import com.zy.acs.manager.core.domain.VehicleFaultDto; |
| | | import com.zy.acs.manager.manager.entity.Agv; |
| | | import com.zy.acs.manager.manager.entity.AgvDetail; |
| | | import com.zy.acs.manager.manager.entity.Code; |
| | |
| | | if (msgBody instanceof AGV_04_UP) { |
| | | AGV_04_UP agv_04_up = (AGV_04_UP) msgBody; |
| | | log.info("Agv [{}] 故障数据包 ===>> {}", protocol.getAgvNo(), JSON.toJSONString(agv_04_up)); |
| | | // faultProcessor.execute(new VehicleFaultDto()); |
| | | faultProcessor.execute(new VehicleFaultDto<>(protocol.getAgvNo(), protocol.getTimestamp(), agv_04_up)); |
| | | detail.setError(String.valueOf(agv_04_up.getFaultId())); |
| | | detail.setErrorTime(new Date()); |
| | | } |
| | | |
| | | // 故障复位 |
| | | if (!Cools.isEmpty(detail.getError()) && !"NONE".equals(detail.getError())) { |
| | | assert detail.getErrorTime() != null; |
| | | if (DateUtils.diffToSeconds(detail.getErrorTime(), new Date()) > 20) { |
| | | detail.setError("NONE"); |
| | | } |
| | | } |
| | | if (!agvDetailService.updateById(detail)) { |
| | | log.error("Agv [{}] 详情更新失败 !!!", protocol.getAgvNo()); |
| | | } |
| | |
| | | package com.zy.acs.manager.core.service; |
| | | |
| | | import com.zy.acs.common.domain.protocol.AGV_04_UP; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.manager.core.domain.VehicleFaultDto; |
| | | import com.zy.acs.manager.manager.entity.Agv; |
| | | import com.zy.acs.manager.manager.entity.VehFaultRec; |
| | | import com.zy.acs.manager.manager.service.AgvDetailService; |
| | | import com.zy.acs.manager.manager.service.AgvService; |
| | | import com.zy.acs.manager.manager.service.VehFaultRecService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * Created by vincent on 8/19/2024 |
| | |
| | | private VehFaultRecService vehFaultRecService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private AgvService agvService; |
| | | @Autowired |
| | | private AgvDetailService agvDetailService; |
| | | |
| | | @Async |
| | | public void execute(VehicleFaultDto dto) { |
| | | public void execute(VehicleFaultDto<AGV_04_UP> dto) { |
| | | try { |
| | | String vehicle = dto.getVehicle(); |
| | | AGV_04_UP agv_04_up = dto.getT(); |
| | | Date errorTime = new Date(dto.getTimestamp()); |
| | | |
| | | Agv agv = agvService.selectByUuid(vehicle); |
| | | |
| | | VehFaultRec vehFaultRec = new VehFaultRec(); |
| | | vehFaultRec.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | // vehFaultRec.setFaultHex(); |
| | | |
| | | vehFaultRec.setAgvId(agv.getId()); |
| | | vehFaultRec.setFaultNo(String.valueOf(agv_04_up.getFaultId())); |
| | | vehFaultRec.setFaultHex(agv_04_up.getHexFaultId()); |
| | | vehFaultRec.setFaultLev(agv_04_up.getFaultLevel()); |
| | | vehFaultRec.setFaultData(GsonUtils.toJson(Cools.add("data1", agv_04_up.getData1()).add("data2", agv_04_up.getData2()))); |
| | | vehFaultRec.setHappenTime(errorTime); |
| | | vehFaultRec.setProtocol(RadixTools.bytesToHexStr(agv_04_up.writeToBytes())); |
| | | |
| | | if (!vehFaultRecService.save(vehFaultRec)) { |
| | | log.error("{}号车辆故障!记录故障信息失败......", dto.getVehicle()); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | short ss = 8193; // 2001 |
| | | byte[] bytes = RadixTools.shortToByte(ss); |
| | | // byte[] reverse = Utils.reverse(bytes); |
| | | System.out.println(RadixTools.bytesToHexStr(bytes)); |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | private String backpack; |
| | | |
| | | /** |
| | | * 密码 |
| | | * 故障信息 |
| | | */ |
| | | @ApiModelProperty(value= "密码") |
| | | private String password; |
| | | @ApiModelProperty(value= "故障信息") |
| | | private String error; |
| | | |
| | | /** |
| | | * 故障时间 |
| | | */ |
| | | @ApiModelProperty(value= "故障时间") |
| | | private Date errorTime; |
| | | |
| | | /** |
| | | * 状态 |