Merge branch 'rcs_master' into ctu_conveyor
| | |
| | | alter table man_code |
| | | add dir_rule varchar(255) null comment 'æ¹åè§å' after corner; |
| | | alter table man_travel |
| | | add roller_waiting int(1) default 0 null comment 'æ»ç线çå¾
' after task_ids; |
| | | |
| | | alter table man_travel |
| | | add roller_waiting_code bigint null comment 'æ»ç线çå¾
å°ç ' after roller_waiting; |
| | | |
| | | alter table man_travel_log |
| | | add roller_waiting int(1) default 0 null comment 'æ»ç线çå¾
' after task_ids; |
| | | |
| | | alter table man_travel_log |
| | | add roller_waiting_code bigint null comment 'æ»ç线çå¾
å°ç ' after roller_waiting; |
| | | |
| | | CREATE INDEX idx_agv_state_wait |
| | | ON man_travel (agv_id, state, roller_waiting, deleted); |
| | | |
| | | |
| | | |
| | | |
| | | alter table man_sta |
| | | add height decimal(24, 9) null comment 'ä½ä¸é«åº¦' after offset; |
| | | |
| | | alter table man_sta |
| | | add depth decimal(24, 9) null comment 'ä½ä¸æ·±åº¦' after height; |
| | | |
| | | |
| | | |
| | | alter table man_sta |
| | | add inbound_wait int null comment 'è¿ç»å
¥åºçå¾
' after angle; |
| | | |
| | | alter table man_sta |
| | | add outbound_wait int null comment 'è¿ç»åºåºçå¾
' after inbound_wait; |
| | |
| | | # todo idx ==> deleted |
| | | # man_action |
| | | CREATE INDEX idx_agv_action ON man_action(agv_id, action_sts); |
| | | CREATE INDEX idx_group_io_time ON man_action(group_id, io_time); |
| | |
| | | # man_action_type |
| | | CREATE INDEX idx_action_type_uuid ON man_action_type(uuid); |
| | | # man_travel |
| | | CREATE INDEX idx_agv_id_state on man_travel(agv_id, state); |
| | | CREATE INDEX idx_agv_id_state ON man_travel(agv_id, state); |
| | | CREATE INDEX idx_agv_state_wait ON man_travel (agv_id, state, roller_waiting, deleted); |
| | | # man_agv_model |
| | | CREATE INDEX idx_agv_model_type ON man_agv_model(type); |
| | | # man_bus_sts |
| New file |
| | |
| | | package com.zy.acs.common.domain; |
| | | |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class HeightDepthDto implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1304095271854524735L; |
| | | |
| | | // é«åº¦ï¼mmï¼ |
| | | private Short height; |
| | | |
| | | // 深度ï¼mmï¼ |
| | | private Short depth; |
| | | |
| | | public HeightDepthDto() { |
| | | } |
| | | |
| | | public HeightDepthDto(Number height, Number depth) { |
| | | this.height = toShort(height); |
| | | this.depth = toShort(depth); |
| | | } |
| | | |
| | | private static Short toShort(Number value) { |
| | | if (value == null) { |
| | | throw new CoolException("HeightDepthDto parameter is null"); |
| | | } |
| | | return value.shortValue(); |
| | | } |
| | | |
| | | } |
| | |
| | | @Override |
| | | public byte[] writeToBytes() { |
| | | return Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | |
| | | // byte[] heightBytes = Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | // byte[] depthBytes = Utils.reverse(RadixTools.shortToByte(this.depth)); |
| | | // return Utils.merge(heightBytes, depthBytes); |
| | | |
| | | // byte heightByte = (byte) ((this.height == null ? 0 : this.height) & 0xFF); |
| | | // byte depthByte = (byte) ((this.depth == null ? 0 : this.depth) & 0xFF); |
| | | // return Utils.merge(heightByte, depthByte); |
| | | // return new byte[]{ heightByte, depthByte }; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // åè´§é«åº¦ |
| | | private Short height; |
| | | |
| | | // å货深度 |
| | | private Short depth; |
| | | |
| | | } |
| | |
| | | package com.zy.acs.common.domain.protocol.action; |
| | | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.domain.protocol.IActionBody; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @Override |
| | | public byte[] writeToBytes() { |
| | | return Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | |
| | | // byte[] heightBytes = Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | // byte[] depthBytes = Utils.reverse(RadixTools.shortToByte(this.depth)); |
| | | // return Utils.merge(heightBytes, depthBytes); |
| | | |
| | | // byte heightByte = (byte) ((this.height == null ? 0 : this.height) & 0xFF); |
| | | // byte depthByte = (byte) ((this.depth == null ? 0 : this.depth) & 0xFF); |
| | | // return Utils.merge(heightByte, depthByte); |
| | | // return new byte[]{ heightByte, depthByte }; |
| | | } |
| | | |
| | | @Override |
| | |
| | | // åè´§é«åº¦ |
| | | private Short height; |
| | | |
| | | // å货深度 |
| | | private Short depth; |
| | | |
| | | } |
| | |
| | | @Override |
| | | public byte[] writeToBytes() { |
| | | return Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | |
| | | // byte[] heightBytes = Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | // byte[] depthBytes = Utils.reverse(RadixTools.shortToByte(this.depth)); |
| | | // return Utils.merge(heightBytes, depthBytes); |
| | | |
| | | // byte heightByte = (byte) ((this.height == null ? 0 : this.height) & 0xFF); |
| | | // byte depthByte = (byte) ((this.depth == null ? 0 : this.depth) & 0xFF); |
| | | // return Utils.merge(heightByte, depthByte); |
| | | // return new byte[]{ heightByte, depthByte }; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] messageBodyBytes) { |
| | |
| | | // åè´§é«åº¦ |
| | | private Short height; |
| | | |
| | | // å货深度 |
| | | private Short depth; |
| | | |
| | | } |
| | |
| | | package com.zy.acs.common.domain.protocol.action; |
| | | |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import com.zy.acs.common.domain.protocol.IActionBody; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.RadixTools; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | @Override |
| | | public byte[] writeToBytes() { |
| | | return Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | |
| | | // byte[] heightBytes = Utils.reverse(RadixTools.shortToByte(this.height)); |
| | | // byte[] depthBytes = Utils.reverse(RadixTools.shortToByte(this.depth)); |
| | | // return Utils.merge(heightBytes, depthBytes); |
| | | |
| | | // byte heightByte = (byte) ((this.height == null ? 0 : this.height) & 0xFF); |
| | | // byte depthByte = (byte) ((this.depth == null ? 0 : this.depth) & 0xFF); |
| | | // return Utils.merge(heightByte, depthByte); |
| | | // return new byte[]{ heightByte, depthByte }; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void readFromBytes(byte[] messageBodyBytes) { |
| | |
| | | // åè´§é«åº¦ |
| | | private Short height; |
| | | |
| | | // å货深度 |
| | | private Short depth; |
| | | |
| | | } |
| New file |
| | |
| | | package com.zy.acs.common.utils; |
| | | |
| | | public class Base62 { |
| | | |
| | | private static final char[] CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); |
| | | |
| | | public static String encode(long value) { |
| | | if (value == 0) return "0"; |
| | | StringBuilder sb = new StringBuilder(); |
| | | while (value > 0) { |
| | | sb.append(CHARS[(int) (value % 62)]); |
| | | value /= 62; |
| | | } |
| | | return sb.reverse().toString(); |
| | | } |
| | | |
| | | } |
| | |
| | | package com.zy.acs.common.utils; |
| | | |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | |
| | | import java.util.*; |
| | | import java.util.concurrent.ThreadLocalRandom; |
| | |
| | | return str; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.out.println(Base62.encode(new SnowflakeIdWorker().nextId())); |
| | | } |
| | | |
| | | public static String generateSeqNum(String lastSeqNum) { |
| | | if (Cools.isEmpty(lastSeqNum)) { |
| | | return zeroFill("1", 4); |
| | |
| | | earlier: 'Earlier...', |
| | | }, |
| | | validate: { |
| | | pwdMisMatch: 'The password confirmation is not the same as the password.' |
| | | pwdMisMatch: 'The password confirmation is not the same as the password.', |
| | | gtZero: 'The value must be greater than 0.', |
| | | }, |
| | | settings: { |
| | | base: 'Base', |
| | |
| | | staType: "station type", |
| | | code: "code", |
| | | offset: "offset", |
| | | height: "height", |
| | | depth: "depth", |
| | | angle: 'angle', |
| | | inboundWait: 'inbound wait(ms)', |
| | | outboundWait: 'outbound wait(ms)', |
| | | autoing: "autoing", |
| | | loading: "loading", |
| | | inEnable: "in enable", |
| | |
| | | currSeg: "curr seg", |
| | | taskContent: "tasks", |
| | | taskIds: "task list", |
| | | rollerWaiting: 'roller waiting', |
| | | rollerWaitingCode: 'waiting code', |
| | | state: "state", |
| | | }, |
| | | segment: { |
| | |
| | | bottomOffset: 'bottom offset', |
| | | }, |
| | | sta: { |
| | | depthHint: 'Set depth to 0 to keep the default value.', |
| | | enums: { |
| | | type: { |
| | | in: 'UNLOAD', |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | travel: { |
| | | enums: { |
| | | state: { |
| | | running: 'RUNNING', |
| | | finish: 'FINISH', |
| | | }, |
| | | }, |
| | | }, |
| | | jam: { |
| | | enums: { |
| | | state: { |
| | |
| | | earlier: 'æ´æ©...', |
| | | }, |
| | | validate: { |
| | | pwdMisMatch: 'å¯ç ä¸ä¸è´' |
| | | pwdMisMatch: 'å¯ç ä¸ä¸è´', |
| | | gtZero: '请è¾å
¥å¤§äº0çæ°å¼', |
| | | }, |
| | | settings: { |
| | | base: 'åºæ¬è®¾ç½®', |
| | |
| | | staType: "ç«ç¹ç±»å", |
| | | code: "å°é¢ç ", |
| | | offset: "åç§»é", |
| | | height: "ä½ä¸é«åº¦", |
| | | depth: "ä½ä¸æ·±åº¦", |
| | | angle: 'ä½ä¸è§åº¦', |
| | | inboundWait: 'å
¥åºçå¾
(毫ç§)', |
| | | outboundWait: 'åºåºçå¾
(毫ç§)', |
| | | autoing: "èªå¨", |
| | | loading: "载货", |
| | | inEnable: "å¯å
¥", |
| | |
| | | currSeg: "å½åä½ä¸", |
| | | taskContent: "ä»»å¡å
容", |
| | | taskIds: "ä»»å¡å表", |
| | | rollerWaiting: 'æ»ç线çå¾
', |
| | | rollerWaitingCode: 'çå¾
ä½å°ç ', |
| | | state: "ç¶æ", |
| | | }, |
| | | segment: { |
| | |
| | | bottomOffset: 'åºé¨åç§»é', |
| | | }, |
| | | sta: { |
| | | depthHint: '深度设置为 0 表示沿ç¨é»è®¤å¼ã', |
| | | enums: { |
| | | type: { |
| | | in: 'æ¾è´§', |
| | |
| | | }, |
| | | }, |
| | | }, |
| | | travel: { |
| | | enums: { |
| | | state: { |
| | | running: 'æ£å¨è¿è¡', |
| | | finish: '已宿', |
| | | }, |
| | | }, |
| | | }, |
| | | jam: { |
| | | enums: { |
| | | state: { |
| | |
| | | y: (event.global.y - batchMoveStartPos.y) / scaleY |
| | | }; |
| | | for (let sprite of selectedSprites) { |
| | | sprite.position.x = sprite.batchMoveStartPos.x - mouseMovement.x; |
| | | sprite.position.y = sprite.batchMoveStartPos.y - mouseMovement.y; |
| | | sprite.position.x = sprite.batchMoveStartPos.x + mouseMovement.x; |
| | | sprite.position.y = sprite.batchMoveStartPos.y + mouseMovement.y; |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | if (backpackCount !== prevBackpackCount || battery !== prevBattery) { |
| | | const agvStatusMode = getAgvStatusMode(backpackCount, battery); |
| | | const agvTexture = generateAgvSpriteTexture(agvStatusMode); |
| | | const agvTexture = generateAgvSpriteTexture(agvModel, agvStatusMode); |
| | | agvSprite.texture = PIXI.Texture.from(agvTexture, { resourceOptions: { scale: 1 } }); |
| | | // update backpackCount and battery |
| | | agvSprite.data.backpackCount = backpackCount; |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import React, { useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const greaterThanZero = useMemo(() => (value) => { |
| | | if (value === undefined || value === null || value === '') { |
| | | return undefined; |
| | | } |
| | | return Number(value) >= 0 ? undefined : translate('validate.gtZero'); |
| | | }, [translate]); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | |
| | | <NumberInput |
| | | label="table.field.sta.capacity" |
| | | source="capacity" |
| | | validate={required()} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.offset" |
| | | source="offset" |
| | | validate={required()} |
| | | /> |
| | | </Grid> */} |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.height" |
| | | source="height" |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.depth" |
| | | source="depth" |
| | | helperText={translate('page.sta.depthHint')} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.angle" |
| | | source="angle" |
| | | validate={required()} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.inboundWait" |
| | | source="inboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.sta.outboundWait" |
| | | source="outboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | </ReferenceInput> |
| | | </Grid> */} |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | </Grid> */} |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |
| | |
| | | |
| | | const StaEdit = () => { |
| | | const translate = useTranslate(); |
| | | const greaterThanZero = useMemo(() => (value) => { |
| | | if (value === undefined || value === null || value === '') { |
| | | return undefined; |
| | | } |
| | | return Number(value) >= 0 ? undefined : translate('validate.gtZero'); |
| | | }, [translate]); |
| | | |
| | | return ( |
| | | <Edit |
| | |
| | | <NumberInput |
| | | label="table.field.sta.capacity" |
| | | source="capacity" |
| | | validate={required()} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.sta.angle" |
| | | source="angle" |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | {/* <NumberInput |
| | | label="table.field.sta.offset" |
| | | source="offset" |
| | | validate={required()} |
| | | /> */} |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.sta.height" |
| | | source="height" |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.sta.depth" |
| | | source="depth" |
| | | helperText={translate('page.sta.depthHint')} |
| | | validate={[required(), greaterThanZero]} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.sta.angle" |
| | | source="angle" |
| | | validate={required()} |
| | | label="table.field.sta.inboundWait" |
| | | source="inboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | <NumberInput |
| | | label="table.field.sta.outboundWait" |
| | | source="outboundWait" |
| | | validate={greaterThanZero} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | {/* <NumberInput |
| | | label="table.field.sta.occCnt" |
| | | source="occCnt" |
| | |
| | | <NumberInput |
| | | label="table.field.sta.rsvInCnt" |
| | | source="rsvInCnt" |
| | | // InputProps={{ readOnly: true }} |
| | | // disabled |
| | | // InputProps={{ readOnly: true }} |
| | | // disabled |
| | | /> |
| | | <NumberInput |
| | | label="table.field.sta.rsvOutCnt" |
| | | source="rsvOutCnt" |
| | | // InputProps={{ readOnly: true }} |
| | | // disabled |
| | | // InputProps={{ readOnly: true }} |
| | | // disabled |
| | | /> |
| | | </Stack> |
| | | </Grid> |
| | |
| | | expand={() => <StaPanel />} |
| | | expandSingle={true} |
| | | rowSx={rowSx(drawerVal || null)} |
| | | omit={['id', 'uuid', 'name', 'zpallet', 'updateBy', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'uuid', 'name', 'offset', 'zpallet' |
| | | , 'updateTime', 'updateBy', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <ReferenceField source="zoneId" label="table.field.sta.zoneId" reference="zone" link={false} sortable={false}> |
| | |
| | | <NumberField source="rsvInCnt" label="table.field.sta.rsvInCnt" /> |
| | | <NumberField source="rsvOutCnt" label="table.field.sta.rsvOutCnt" /> |
| | | <NumberField source="offset" label="table.field.sta.offset" /> |
| | | <NumberField source="height" label="table.field.sta.height" /> |
| | | <NumberField source="depth" label="table.field.sta.depth" /> |
| | | <NumberField source="angle" label="table.field.sta.angle" /> |
| | | <NumberField source="inboundWait" label="table.field.sta.inboundWait" /> |
| | | <NumberField source="outboundWait" label="table.field.sta.outboundWait" /> |
| | | {/* <TextField source="autoing" label="table.field.sta.autoing" /> |
| | | <TextField source="loading" label="table.field.sta.loading" /> |
| | | <TextField source="inEnable" label="table.field.sta.inEnable" /> |
| | |
| | | { labelKey: 'table.field.sta.capacity', valueKey: 'capacity' }, |
| | | { labelKey: 'table.field.sta.rsvInCnt', valueKey: 'rsvInCnt' }, |
| | | { labelKey: 'table.field.sta.rsvOutCnt', valueKey: 'rsvOutCnt' }, |
| | | { labelKey: 'table.field.sta.offset', valueKey: 'offset' }, |
| | | // { labelKey: 'table.field.sta.offset', valueKey: 'offset' }, |
| | | { labelKey: 'table.field.sta.height', valueKey: 'height' }, |
| | | { labelKey: 'table.field.sta.depth', valueKey: 'depth' }, |
| | | { labelKey: 'table.field.sta.inboundWait', valueKey: 'inboundWait' }, |
| | | { labelKey: 'table.field.sta.outboundWait', valueKey: 'outboundWait' }, |
| | | { labelKey: 'table.field.sta.zpallet', valueKey: 'zpallet' }, |
| | | ]; |
| | | |
| | |
| | | {/* <Typography variant="subtitle2" color="textSecondary" gutterBottom> |
| | | {translate('common.field.status')} |
| | | </Typography> */} |
| | | <Grid container spacing={2}> |
| | | {/* <Grid container spacing={2}> |
| | | {STATUS_FIELDS.map(({ key, labelKey }) => ( |
| | | <Grid item xs={6} sm={3} key={key}> |
| | | <StatusIndicator labelKey={labelKey} value={record[key]} /> |
| | | </Grid> |
| | | ))} |
| | | </Grid> |
| | | <Divider sx={{ my: 2 }} /> |
| | | <Divider sx={{ my: 2 }} /> */} |
| | | |
| | | <Box> |
| | | <Typography variant="subtitle1" gutterBottom> |
| | |
| | | backgroundColor: 'action.selected', |
| | | }; |
| | | } |
| | | if (record.staType$ === 'ROLLER') |
| | | return { |
| | | ...style, |
| | | borderLeftColor: orange[500], |
| | | borderLeftWidth: 5, |
| | | borderLeftStyle: 'solid', |
| | | }; |
| | | if (record.staType$ === 'RACK') |
| | | return { |
| | | ...style, |
| | | borderLeftColor: blue[500], |
| | | borderLeftWidth: 5, |
| | | borderLeftStyle: 'solid', |
| | | }; |
| | | if (record.connect) |
| | | return { |
| | | ...style, |
| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | FunctionField, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | }, |
| | | })); |
| | | |
| | | const tabs = [ |
| | | { id: 'RUNNING', name: 'page.travel.enums.state.running' }, |
| | | { id: 'FINISH', name: 'page.travel.enums.state.finish' }, |
| | | ]; |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <TextInput source="uuid" label="table.field.travel.uuid" />, |
| | | <TextInput source="travelId" label="table.field.travel.travelId" />, |
| | | <ReferenceInput source="agvId" label="table.field.travel.agvId" reference="agv"> |
| | | <ReferenceInput source="agvId" label="table.field.travel.agvId" reference="agv" alwaysOn> |
| | | <AutocompleteInput label="table.field.travel.agvId" optionText="uuid" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | | <ReferenceInput source="currSeg" label="table.field.travel.currSeg" reference="segment"> |
| | | <AutocompleteInput label="table.field.travel.currSeg" optionText="id" filterToQuery={(val) => ({ id: val })} /> |
| | | <SelectInput |
| | | label="table.field.travel.rollerWaiting" |
| | | source="rollerWaiting" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | alwaysOn |
| | | />, |
| | | <ReferenceInput source="rollerWaitingCode" label="table.field.travel.rollerWaitingCode" reference="code"> |
| | | <AutocompleteInput label="table.field.travel.rollerWaitingCode" optionText="data" filterToQuery={(val) => ({ uuid: val })} /> |
| | | </ReferenceInput>, |
| | | <TextInput source="taskContent" label="table.field.travel.taskContent" />, |
| | | <TextInput source="taskIds" label="table.field.travel.taskIds" />, |
| | | <TextInput source="state" label="table.field.travel.state" />, |
| | | |
| | | // <ReferenceInput source="currSeg" label="table.field.travel.currSeg" reference="segment"> |
| | | // <AutocompleteInput label="table.field.travel.currSeg" optionText="id" filterToQuery={(val) => ({ id: val })} /> |
| | | // </ReferenceInput>, |
| | | <SelectInput |
| | | source="state" |
| | | label="table.field.travel.state" |
| | | choices={tabs} |
| | | translateChoice |
| | | alwaysOn |
| | | />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='travel' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <TravelPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'updateBy', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'currSeg', 'rollerWaitingCode', 'updateBy', 'createTime', 'createBy', 'memo']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="uuid" label="table.field.travel.uuid" /> |
| | |
| | | <TextField source="id" /> |
| | | </ReferenceField> |
| | | <TextField source="taskIds" label="table.field.travel.taskIds" /> |
| | | <TextField source="state" label="table.field.travel.state" /> |
| | | |
| | | <BooleanField source="rollerWaitingBool" label="table.field.travel.rollerWaiting" sortable={false} /> |
| | | <ReferenceField source="rollerWaitingCode" label="table.field.travel.rollerWaitingCode" reference="code" link={false} sortable={false}> |
| | | <TextField source="data" /> |
| | | </ReferenceField> |
| | | {/* <TextField source="state" label="table.field.travel.state" /> */} |
| | | <FunctionField label="table.field.travel.state" cellClassName="state" render={record => ( |
| | | <> |
| | | {translate(tabs.find(item => item.id === record.state)?.name)} |
| | | </> |
| | | )} /> |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" 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} /> */} |
| | | <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> |
| | | <TravelCreate |
| | |
| | | package com.zy.acs.manager.core; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.domain.HeightDepthDto; |
| | | import com.zy.acs.common.enums.AgvStatusType; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.manager.core.integrate.conveyor.ConveyorStationService; |
| | |
| | | import com.zy.acs.manager.core.service.PatrolService; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.FuncStaType; |
| | | import com.zy.acs.manager.manager.enums.StaReserveType; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private StaService staService; |
| | | @Autowired |
| | | private SegmentService segmentService; |
| | | // @Autowired |
| | | // private ConveyorStationService siemensConveyorStationService; |
| | | @Autowired |
| | | private ConveyorStationService siemensConveyorStationService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | |
| | | @RequestMapping(value = "/system/info", method = {RequestMethod.GET, RequestMethod.POST}) |
| | | public R systemInfo() { |
| | |
| | | |
| | | @RequestMapping(value = "/system/demo", method = {RequestMethod.GET, RequestMethod.POST}) |
| | | public R demo() { |
| | | Sta sta = staService.selectByStaNo("1006"); |
| | | boolean b = siemensConveyorStationService.allowAgvWork(sta, null, null, StaReserveType.IN); |
| | | return R.ok().add(b); |
| | | Double defaultShelfDepth = configService.getVal("defaultShelfDepth", Double.class); |
| | | |
| | | defaultShelfDepth = Optional.ofNullable(defaultShelfDepth).orElse((double) 0); |
| | | Double ss = 10.0; |
| | | String jsonString = JSON.toJSONString(new HeightDepthDto(ss, defaultShelfDepth)); |
| | | return R.ok(jsonString); |
| | | } |
| | | |
| | | // http://localhost:8088/demo/auto/go/standby |
| | |
| | | |
| | | @Autowired |
| | | private MapService mapService; |
| | | @Autowired |
| | | private SegmentService segmentService; |
| | | |
| | | @GetMapping("/astarDemo") // astar spend time: 3866, count:3855 |
| | | public R astarDemo() { |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | | import com.zy.acs.common.utils.Base62; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | |
| | | task.setAgvId(agv.getId()); |
| | | task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId)); |
| | | task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | // task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | task.setSeqNum(Base62.encode(snowflakeIdWorker.nextId())); |
| | | |
| | | task.setTaskType(param.getTaskMode().val()); |
| | | task.setTaskSts(TaskStsType.WAITING.val()); |
| | |
| | | import com.zy.acs.manager.core.integrate.dto.ConveyorQueryParam; |
| | | import com.zy.acs.manager.core.integrate.dto.ConveyorQueryResult; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.StaService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | |
| | | .orderByAsc(Sta::getStaNo) |
| | | ); |
| | | for (Sta sta : list) { |
| | | resultList.add(new ConveyorQueryResult(sta.getStaNo() |
| | | , !staService.hasWorkingAgv(sta.getId()))); |
| | | Long staId = sta.getId(); |
| | | boolean conveyable = !staService.hasWorkingAgv(staId); |
| | | String taskNo = null; |
| | | if (conveyable) { |
| | | Task task = staService.checkoutTask(staId); |
| | | if (null != task) { |
| | | taskNo = task.getSeqNum(); |
| | | } |
| | | } |
| | | resultList.add(new ConveyorQueryResult(sta.getStaNo(), conveyable, taskNo)); |
| | | } |
| | | } else { |
| | | for (String staNo : staNos) { |
| | |
| | | resultList.add(new ConveyorQueryResult(staNo, Boolean.FALSE)); |
| | | continue; |
| | | } |
| | | resultList.add(new ConveyorQueryResult(staNo |
| | | , !staService.hasWorkingAgv(sta.getId()))); |
| | | Long staId = sta.getId(); |
| | | boolean conveyable = !staService.hasWorkingAgv(staId); |
| | | String taskNo = null; |
| | | if (conveyable) { |
| | | Task task = staService.checkoutTask(staId); |
| | | if (null != task) { |
| | | taskNo = task.getSeqNum(); |
| | | } |
| | | } |
| | | resultList.add(new ConveyorQueryResult(staNo, conveyable, taskNo)); |
| | | } |
| | | } |
| | | |
| | |
| | | final String staNo = sta.getStaNo(); |
| | | |
| | | // url |
| | | String url = this.buildUrl("/station/query"); |
| | | String url = this.buildUrl("/cv/station/query"); |
| | | // headers |
| | | Map<String, String> headers = new HashMap<>(); |
| | | // params |
| | |
| | | |
| | | private Boolean conveyable; |
| | | |
| | | private String taskNo; |
| | | |
| | | public ConveyorQueryResult() { |
| | | } |
| | | |
| | |
| | | this.conveyable = conveyable; |
| | | } |
| | | |
| | | public ConveyorQueryResult(String staNo, Boolean conveyable, String taskNo) { |
| | | this.staNo = staNo; |
| | | this.conveyable = conveyable; |
| | | this.taskNo = taskNo; |
| | | } |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private MainService mainService; |
| | | |
| | | @PreAuthorize("hasAuthority('open:bus:submit')") |
| | | // @PreAuthorize("hasAuthority('open:bus:submit')") |
| | | @PostMapping("/bus/submit") |
| | | @OperationLog("generate task from open api") |
| | | public R save(@RequestBody OpenBusSubmitParam param) { |
| New file |
| | |
| | | package com.zy.acs.manager.core.scheduler; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SnowflakeIdWorker; |
| | | import com.zy.acs.manager.common.domain.TaskDto; |
| | | import com.zy.acs.manager.core.service.AreaGovernService; |
| | | import com.zy.acs.manager.core.service.MainService; |
| | | import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.AgvModelType; |
| | | import com.zy.acs.manager.manager.enums.BusStsType; |
| | | import com.zy.acs.manager.manager.enums.LocStsType; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import com.zy.acs.manager.manager.service.impl.CodeServiceImpl; |
| | | import com.zy.acs.manager.system.service.ConfigService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Component |
| | | public class ConveyorAutoRunScheduler { |
| | | |
| | | private static final AgvModelType DEFAULT_AGV_MODEL = AgvModelType.CTU_BOX_TRANSPORT_AGV; |
| | | |
| | | private final RedisSupport redis = RedisSupport.defaultRedisSupport; |
| | | |
| | | @Autowired |
| | | private AgvService agvService; |
| | | @Autowired |
| | | private BusService busService; |
| | | @Autowired |
| | | private MainService mainService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private StaService staService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | @Autowired |
| | | private SnowflakeIdWorker snowflakeIdWorker; |
| | | @Autowired |
| | | private AreaGovernService areaGovernService; |
| | | @Autowired |
| | | private CodeServiceImpl codeService; |
| | | |
| | | // @Scheduled(fixedRate = 500) // åºå®é¢çæ§è¡ï¼ä¸åæ¥ |
| | | @Scheduled(fixedDelay = 1000) // åºå®é¢çæ§è¡ï¼åæ¥ |
| | | // @Scheduled(cron = "0/1 * * * * ? ") |
| | | private void execute() { |
| | | //if (!configService.getVal("ConveyorTaskAssignMode", Boolean.class)) { return; } |
| | | AgvModel agvModel = agvModelService.getOne(new LambdaQueryWrapper<AgvModel>().eq(AgvModel::getType, DEFAULT_AGV_MODEL.toString())); |
| | | if (null == agvModel) { return; } |
| | | |
| | | //this.autoRun(agvModel); |
| | | } |
| | | |
| | | private void autoRun(AgvModel agvModel) { |
| | | int availableAgvCount = this.getAvailableAgvCount(); |
| | | if (0 == availableAgvCount) { return; } |
| | | |
| | | // List<String> staPreNos = getStaPrefixes(staGroupList); |
| | | List<String> staPreNos = new ArrayList<>(); |
| | | String memo = "DEMO_STA_" + String.join("-", staPreNos); |
| | | |
| | | |
| | | // æå¤ ? ç»busè¿è¡ |
| | | if (1 <= busService.count(new LambdaQueryWrapper<Bus>() |
| | | .in(Bus::getBusSts, BusStsType.RECEIVE.val(), BusStsType.PROGRESS.val()) |
| | | .in(Bus::getMemo, memo) |
| | | )) { return; } |
| | | |
| | | |
| | | // åºåº |
| | | this.runLocToSta(agvModel, memo); |
| | | |
| | | } |
| | | |
| | | |
| | | // åºåº |
| | | private void runLocToSta(AgvModel agvModel, String memo) { |
| | | |
| | | // IDLE STA |
| | | List<Sta> idleList = new ArrayList<>(); |
| | | idleList.add(staService.selectByStaNo("1001")); |
| | | idleList.add(staService.selectByStaNo("1007")); |
| | | if (Cools.isEmpty(idleList)) { return; } |
| | | Collections.shuffle(idleList); |
| | | |
| | | OpenBusSubmitParam param = new OpenBusSubmitParam(); |
| | | param.setBatch(String.valueOf(snowflakeIdWorker.nextId()).substring(13, 19)); |
| | | for (int i = 0; i < agvModel.getBackpack() ; i++) { |
| | | Sta idleSta = idleList.get(i); |
| | | String staCode = codeService.getCacheById(idleSta.getCode()).getData(); |
| | | |
| | | Loc stockLoc = null; |
| | | |
| | | // æå¨åºåçæ¡ç ï¼å¦ææ²¡æareaç»å®ï¼å°±å
¨å°å¾ |
| | | List<String> codeList = areaGovernService.queryCodesByOneCode(staCode); |
| | | if (Cools.isEmpty(codeList)) { |
| | | stockLoc = locService.selectRandOneByLocSts(LocStsType.STOCK.val(), 1); |
| | | } else { |
| | | Collections.shuffle(codeList); |
| | | for (String codeData : codeList) { |
| | | Code code = codeService.getCacheByData(codeData); |
| | | if (null == code) { break; } |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getCode, code.getId()).eq(Loc::getLocSts, LocStsType.STOCK.val())); |
| | | if (Cools.isEmpty(locList)) { |
| | | break; |
| | | } else if (locList.size() == 1) { |
| | | stockLoc = locList.get(0); |
| | | } else { |
| | | Collections.shuffle(locList); |
| | | stockLoc = locList.get(0); |
| | | } |
| | | if (null != stockLoc) { |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (null == stockLoc) { break; } |
| | | |
| | | TaskDto taskDto = new TaskDto(); |
| | | taskDto.setOriLoc(stockLoc.getLocNo()); |
| | | taskDto.setDestSta(idleSta.getStaNo()); |
| | | taskDto.setPriority(100); |
| | | taskDto.setSeqNum(String.valueOf(snowflakeIdWorker.nextId()).substring(15, 19)); |
| | | |
| | | param.getTaskList().add(taskDto); |
| | | } |
| | | if (Cools.isEmpty(param.getTaskList())) { return; } |
| | | |
| | | mainService.generateBusAndTask(param, memo); |
| | | } |
| | | |
| | | |
| | | |
| | | public static List<String> getStaPrefixes(List<String> staGroupList) { |
| | | Set<String> rowSet = new HashSet<>(); |
| | | for (String s : staGroupList) { |
| | | rowSet.add(s.split("-")[0]); |
| | | } |
| | | List<String> result = new ArrayList<>(rowSet); |
| | | result.sort(Comparator.comparingInt(Integer::parseInt)); |
| | | return result; |
| | | } |
| | | |
| | | private int getAvailableAgvCount() { |
| | | int res = 0; |
| | | List<Agv> agvList = agvService.list(new LambdaQueryWrapper<Agv>().eq(Agv::getStatus, StatusType.ENABLE.val)); |
| | | if (Cools.isEmpty(agvList)) { |
| | | return res; |
| | | } |
| | | for (Agv agv : agvList) { |
| | | if (null == redis.getObject(RedisConstant.AGV_ONLINE_FLAG, agv.getUuid())) { |
| | | continue; |
| | | } |
| | | if (!agv.getStatusBool()) { |
| | | continue; |
| | | } |
| | | res++; |
| | | } |
| | | |
| | | return res; |
| | | } |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private LocService locService; |
| | | @Autowired |
| | | private AgvModelService agvModelService; |
| | | private TravelService travelService; |
| | | @Autowired |
| | | private TransferStationHandler transferStationHandler; |
| | | |
| | |
| | | for (Segment segment : segments) { |
| | | if (transferStationHandler.hasDelayAtSta(segment)) { |
| | | continue; |
| | | } else { |
| | | travelService.clearRollerWaiting(segment.getTravelId()); |
| | | } |
| | | try { |
| | | txTemplate.executeWithoutResult(status -> { |
| | |
| | | private AgvAreaDispatcher agvAreaDispatcher; |
| | | @Autowired |
| | | private SegmentService segmentService; |
| | | @Autowired |
| | | private TravelService travelService; |
| | | |
| | | /** |
| | | * get available agv list which is idle |
| | |
| | | List<String> result = new ArrayList<>(); |
| | | for (Agv agv : agvList) { |
| | | if (!hasRunning) { |
| | | // 1. without running tasks |
| | | if (0 < taskService.count(new LambdaQueryWrapper<Task>() |
| | | .eq(Task::getAgvId, agv.getId()) |
| | | .and(i -> i |
| | |
| | | )) { |
| | | continue; |
| | | } |
| | | } |
| | | // 2. in idle status |
| | | if (!agvService.judgeEnable(agv.getId(), true)) { |
| | | continue; |
| | | if (!agvService.judgeEnable(agv.getId(), true, true)) { |
| | | continue; |
| | | } |
| | | } else { |
| | | if (!agvService.judgeEnable(agv.getId(), true, false)) { |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | result.add(agv.getUuid()); |
| | |
| | | // continue; |
| | | // } |
| | | // in TransferStationHandler.hasDelayAtSta |
| | | Segment currSeg = segmentService.getRollerWaiting(agvId, sta.getCode(), TaskPosDto.PosType.ORI_STA); |
| | | if (null == currSeg) { |
| | | Travel currTravelInRollerWaiting = travelService.findRollerWaitingTravel(agvId, currentCode.getId()); |
| | | if (null == currTravelInRollerWaiting) { |
| | | continue; |
| | | } |
| | | |
| | | // has enough backpack space to load |
| | | Integer backpack = agvService.getBackpack(agvId); |
| | | List<Integer> usedBackpacks = segmentService.selectUsedBackpacks(null, agvId); |
| | | if (usedBackpacks.size() >= backpack) { |
| | | Integer backpackCap = agvService.getBackpack(agvId); |
| | | List<Integer> usedBackpacks = segmentService.selectUsedBackpacks(currTravelInRollerWaiting.getId(), agvId); |
| | | if (usedBackpacks.size() >= backpackCap) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.zy.acs.common.constant.RedisConstant; |
| | | import com.zy.acs.common.domain.AgvAction; |
| | | import com.zy.acs.common.domain.AgvActionItem; |
| | | import com.zy.acs.common.domain.AgvProtocol; |
| | | import com.zy.acs.common.domain.BaseResult; |
| | | import com.zy.acs.common.domain.*; |
| | | import com.zy.acs.common.domain.protocol.*; |
| | | import com.zy.acs.common.domain.protocol.action.*; |
| | | import com.zy.acs.common.enums.*; |
| | | import com.zy.acs.common.utils.Base62; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.RedisSupport; |
| | | import com.zy.acs.common.utils.Utils; |
| | |
| | | , (task, agvNo, sta) -> { |
| | | Long agvId = agvService.getAgvId(agvNo); |
| | | |
| | | // List<Travel> travelList = travelService.list(new LambdaQueryWrapper<Travel>() |
| | | // .eq(Travel::getAgvId, agvId) |
| | | // .eq(Travel::getState, TravelStateType.RUNNING.toString()) |
| | | // .orderByDesc(Travel::getCreateTime)); |
| | | // if (Cools.isEmpty(travelList)) { |
| | | // throw new BusinessException("[Agv: " + agvNo + "]allocate inbound failed to find travel"); |
| | | Travel travel = travelService.findRunningTravel(agvId); |
| | | if (null == travel) { |
| | | throw new CoolException("[Agv:" + agvNo + "] allocate inbound failed: no roller waiting travel"); |
| | | } |
| | | |
| | | // curr segment |
| | | Segment currSeg = segmentService.getCurrWaitingSeg(travel.getId(), agvId); |
| | | // if (null == currSeg) { |
| | | // currSeg = segmentService.getCurrRunningSeg(travel.getId(), agvId, null); |
| | | // } |
| | | // Travel travel = travelList.get(0); |
| | | // |
| | | // List<Segment> currSegments = segmentService.list(new LambdaQueryWrapper<Segment>() |
| | | // .eq(Segment::getAgvId, agvId) |
| | | // .eq(Segment::getTravelId, travel.getId()) |
| | | // ); |
| | | // load segment |
| | | Segment currSeg = segmentService.getRollerWaiting(agvId, sta.getCode(), TaskPosDto.PosType.ORI_STA); |
| | | if (null == currSeg) { |
| | | throw new BusinessException("[Agv:" + agvNo + "] allocate inbound failed: no roller waiting segment"); |
| | | throw new CoolException("[Agv:" + agvNo + "] allocate inbound failed: no waiting segment"); |
| | | } |
| | | |
| | | // get backpack lev |
| | | int backpackLev = 0; |
| | | int backpack = agvService.getBackpack(agvId); |
| | | int backpackCap = agvService.getBackpack(agvId); |
| | | List<Integer> usedBackpacks = segmentService.selectUsedBackpacks(currSeg.getTravelId(), agvId); |
| | | if (usedBackpacks.size() >= backpack) { |
| | | if (usedBackpacks.size() >= backpackCap) { |
| | | throw new CoolException("[Agv:" + agvNo + "] allocate inbound segment failed: no idle backpack to use"); |
| | | } |
| | | for (int lev = 1; lev <= backpack; lev++) { |
| | | for (int lev = 1; lev <= backpackCap; lev++) { |
| | | if (!usedBackpacks.contains(lev)) { |
| | | backpackLev = lev; |
| | | break; |
| | |
| | | |
| | | // DEST-only sort |
| | | destPosList.sort((a, b) -> { |
| | | |
| | | // 主轴 |
| | | double aFirst = a.getFirstWeight(sameGroupXy); |
| | | double bFirst = b.getFirstWeight(sameGroupXy); |
| | |
| | | |
| | | // get placeSeg serial |
| | | int placeSegSerial; |
| | | // query placeSeg idx |
| | | int idx = -1; |
| | | for (int i = 0; i < destPosList.size(); i++) { |
| | | if (Objects.equals(destPosList.get(i).getCodeId(), newDto.getCodeId()) |
| | | && Objects.equals(destPosList.get(i).getTaskId(), newDto.getTaskId())) { |
| | | if (Objects.equals(destPosList.get(i).getTaskId(), newDto.getTaskId()) |
| | | && Objects.equals(destPosList.get(i).getCodeId(), newDto.getCodeId())) { |
| | | idx = i; |
| | | break; |
| | | } |
| | |
| | | try { |
| | | // valid ----------------------------------------------- |
| | | Agv agv = agvService.getById(agvId); |
| | | if (!agvService.judgeEnable(agv.getId(), false)) { |
| | | if (!agvService.judgeEnable(agv.getId())) { |
| | | return; |
| | | } |
| | | if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { |
| | |
| | | return o2.getPriority() - o1.getPriority(); |
| | | } |
| | | }); |
| | | Integer backpack = agvService.getBackpack(agvId); |
| | | if (taskList.size() > backpack) { |
| | | taskList = taskList.subList(0, backpack); |
| | | Integer backpackCap = agvService.getBackpack(agvId); |
| | | if (taskList.size() > backpackCap) { |
| | | taskList = taskList.subList(0, backpackCap); |
| | | } |
| | | |
| | | AgvDetail agvDetail = agvDetailService.selectByAgvId(agvId); |
| | |
| | | |
| | | } |
| | | |
| | | if (backpackLev > backpack) { |
| | | if (backpackLev > backpackCap) { |
| | | throw new BusinessException("è§£æTask失败,AGVèç¯å·²æ»¡......"); |
| | | } |
| | | |
| | |
| | | task.setAgvId(agvId); |
| | | task.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); |
| | | List<Task> lastTasks = taskService.list(new LambdaQueryWrapper<Task>().orderByDesc(Task::getId)); |
| | | task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | // task.setSeqNum(Utils.generateSeqNum(Cools.isEmpty(lastTasks)?null:lastTasks.get(0).getSeqNum())); |
| | | task.setSeqNum(Base62.encode(snowflakeIdWorker.nextId())); |
| | | task.setOriCode(agvDetail.getCode()); |
| | | task.setDestCode(endCode.getId()); |
| | | // lane |
| | |
| | | long actionPrepareSts = ActionStsType.PREPARE.val(); |
| | | // JSONObject storeDirection = configService.getVal("storeDirection", JSONObject.class); |
| | | int angleOffsetVal = configService.getVal("mapAngleOffsetVal", Integer.class); |
| | | Double defaultShelfDepth = configService.getVal("defaultShelfDepth", Double.class); |
| | | defaultShelfDepth = Optional.ofNullable(defaultShelfDepth).orElse((double) 0); |
| | | String agvNo = agvService.getAgvNo(agvId); |
| | | // if (!agvService.judgeEnable(agvId)) { |
| | | // throw new CoolException("AGV[" + agvNo + "]å½åä¸å¯ç¨..."); |
| | |
| | | ActionTypeType.ReadyTakeFromShelvesLoc.desc, // åç§° |
| | | (double) agvDirectionType.val, // 屿§å¼ |
| | | lastCode.getData(), // å°é¢ç |
| | | String.valueOf(oriLoc.getOffset()), // å¨ä½åæ° |
| | | JSON.toJSONString(new HeightDepthDto(oriLoc.getOffset(), defaultShelfDepth)), // å¨ä½åæ° |
| | | ActionTypeType.ReadyTakeFromShelvesLoc.val(), // å¨ä½ç±»å |
| | | actionPrepareSts, // å¨ä½è¿åº¦ |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyReleaseToShelvesLoc.desc, // åç§° |
| | | (double) agvDirectionType.val, // 屿§å¼ |
| | | lastCode.getData(), // å°é¢ç |
| | | String.valueOf(destLoc.getOffset()), // å¨ä½åæ° |
| | | JSON.toJSONString(new HeightDepthDto(destLoc.getOffset(), defaultShelfDepth)), // å¨ä½åæ° |
| | | ActionTypeType.ReadyReleaseToShelvesLoc.val(), // å¨ä½ç±»å |
| | | actionPrepareSts, // å¨ä½è¿åº¦ |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyTakeFromConveyorSta.desc, // åç§° |
| | | staWorkDirection, // 屿§å¼ |
| | | lastCode.getData(), // å°é¢ç |
| | | String.valueOf(oriSta.getOffset()), // å¨ä½åæ° |
| | | JSON.toJSONString(new HeightDepthDto(oriSta.getHeight(), Optional.ofNullable(oriSta.getDepth()).orElse((double) 0))), // å¨ä½åæ° |
| | | ActionTypeType.ReadyTakeFromConveyorSta.val(), // å¨ä½ç±»å |
| | | actionPrepareSts, // å¨ä½è¿åº¦ |
| | | agvId, // AGV |
| | |
| | | ActionTypeType.ReadyReleaseToConveyorSta.desc, // åç§° |
| | | staWorkDirection, // 屿§å¼ |
| | | lastCode.getData(), // å°é¢ç |
| | | String.valueOf(destSta.getOffset()), // å¨ä½åæ° |
| | | JSON.toJSONString(new HeightDepthDto(destSta.getHeight(), Optional.ofNullable(destSta.getDepth()).orElse((double) 0))), // å¨ä½åæ° |
| | | ActionTypeType.ReadyReleaseToConveyorSta.val(), // å¨ä½ç±»å |
| | | actionPrepareSts, // å¨ä½è¿åº¦ |
| | | agvId, // AGV |
| | |
| | | agvAction.add(new AgvActionItem<>(ReadyTakeFromShelvesLoc.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyTakeFromConveyorSta: |
| | | agvAction.add(new AgvActionItem<>(ReadyTakeFromConveyorSta.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyTakeFromAgvSite: |
| | |
| | | agvAction.add(new AgvActionItem<>(ReadyReleaseToShelvesLoc.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case LoadPlatformLift: |
| | | agvAction.add(new AgvActionItem<>(LoadPlatformLift.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyReleaseToConveyorSta: |
| | | agvAction.add(new AgvActionItem<>(ReadyReleaseToConveyorSta.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | .bodySync((body) -> { |
| | | HeightDepthDto heightDepthDto = JSON.parseObject(action.getParams(), HeightDepthDto.class); |
| | | body.setHeight(heightDepthDto.getHeight()); |
| | | body.setDepth(heightDepthDto.getDepth()); |
| | | }) |
| | | ); |
| | | break; |
| | | case ReadyReleaseToAgvSite: |
| | |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setDepth((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case LoadPlatformLift: |
| | | agvAction.add(new AgvActionItem<>(LoadPlatformLift.class) |
| | | .setVal(action.getVal().intValue()) |
| | | .setQrCode(action.getCode()) |
| | | .bodySync(body -> body.setHeight((short) Double.parseDouble(action.getParams()))) |
| | | ); |
| | | break; |
| | | case FinishPath: |
| | |
| | | Code code = codeService.getCacheByData(agv_06_up.getQrCode()); |
| | | |
| | | // query current segment |
| | | Segment currSeg = segmentService.getCurrRunningSeg(agv.getId(), code.getId()); |
| | | Segment currSeg = segmentService.getCurrRunningSeg(null, agv.getId(), code.getId()); |
| | | if (null == currSeg) { |
| | | log.error("failed to find curr segment [{}]", agv.getUuid()); |
| | | } else { |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.OUT); |
| | | break; |
| | | } |
| | | log.info("AGV [{}] load permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | success = true; |
| | | break; |
| | | case DEST_STA: |
| | |
| | | staReserveService.rollbackWaitingToReserved(sta, currTask, StaReserveType.IN); |
| | | break; |
| | | } |
| | | log.info("AGV [{}] unload permitted at conveyor station [{}]", protocol.getAgvNo(), sta.getStaNo()); |
| | | success = true; |
| | | break; |
| | | default: |
| | | log.error("agv[{}] has wrong posType [{}], segment [{}]", protocol.getAgvNo(), posType.toString(), currSeg.getId()); |
| | | log.error("AGV [{}] has wrong posType [{}], segment [{}]", protocol.getAgvNo(), posType.toString(), currSeg.getId()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | AGV_06_DOWN agv_06_down = new AGV_06_DOWN(); |
| | | agv_06_down.setSerialNo(agv_06_up.getSerialNo()); |
| | | agv_06_down.setActionCode(agv_06_up.getActionCode()); |
| | | //agv_06_down.setResult(success ? 1 : 0); |
| | | agv_06_down.setResult(1); |
| | | agv_06_down.setResult(success ? 1 : 0); |
| | | redis.push(RedisConstant.AGV_PATH_DOWN_FLAG, AgvProtocol.build(protocol.getAgvNo()).setMessageBody(agv_06_down)); |
| | | } |
| | | |
| | |
| | | continue; |
| | | } |
| | | // å½åvehicleæ£å¨è¿è¡æ»çè¾é线çå¾
|
| | | if (segmentService.isRollerWaiting(agvId)) { |
| | | if (travelService.hasRollerWaiting(agvId)) { |
| | | continue; |
| | | } |
| | | // if (segmentService.isRollerWaiting(agvId)) { |
| | | // continue; |
| | | // } |
| | | return blockVehicleDto.getVehicle(); |
| | | } |
| | | return null; |
| | |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class TransferStationHandler { |
| | | |
| | | private static final long LOAD_DELAY_MS = 15000L; // load ( inbound ) delay timeout |
| | | private static final long PLACE_DELAY_MS = 15000L; // place ( outbound ) delay timeout |
| | | private static final int DEFAULT_LOAD_DELAY_MS = 15000; // load ( inbound ) delay timeout |
| | | private static final int DEFAULT_PLACE_DELAY_MS = 1000; // place ( outbound ) delay timeout |
| | | |
| | | @Autowired |
| | | private SegmentService segmentService; |
| | |
| | | private CodeService codeService; |
| | | @Autowired |
| | | private StaService staService; |
| | | @Autowired |
| | | private TravelService travelService; |
| | | |
| | | /** |
| | | * åè´§ï¼å
¥åºï¼ï¼å¨åå®ç¬¬ä¸ä¸ªè´§çæ¶åï¼æ
å¿æ»çè¾éçº¿ä¼æä¸ä¸ä¸ªè´§ç©ï¼æä»¥å»ºè®®AGVå¨åå°çå¾
䏿®µæ¶é´ |
| | |
| | | if (prePosType.equals(TaskPosDto.PosType.ORI_STA)) { |
| | | |
| | | // èç¯æªæ»¡æç |
| | | Integer backpack = agvService.getBackpack(agvId); |
| | | Integer backpackCap = agvService.getBackpack(agvId); |
| | | List<Integer> usedBackpacks = segmentService.selectUsedBackpacks(currSeg.getTravelId(), agvId); |
| | | if (usedBackpacks.size() >= backpack) { |
| | | if (usedBackpacks.size() >= backpackCap) { |
| | | return false; |
| | | } |
| | | |
| | | // sign waiting |
| | | if (currSeg.getRollerWaiting() == 0) { |
| | | currSeg.setRollerWaiting(1); |
| | | segmentService.updateById(currSeg); |
| | | } |
| | | // mark roller waiting |
| | | travelService.markRollerWaiting(currSeg.getTravelId(), currentCode.getId()); |
| | | // if (currSeg.getRollerWaiting() == 0) { |
| | | // currSeg.setRollerWaiting(1); |
| | | // segmentService.updateById(currSeg); |
| | | // } |
| | | |
| | | // timeout |
| | | return (now - preEndTime) < LOAD_DELAY_MS; |
| | | return (now - preEndTime) < Optional.ofNullable(rollerSta.getInboundWait()).orElse(DEFAULT_LOAD_DELAY_MS); |
| | | } |
| | | |
| | | // outbound |
| | |
| | | return false; |
| | | } |
| | | |
| | | // sign waiting |
| | | if (currSeg.getRollerWaiting() == 0) { |
| | | currSeg.setRollerWaiting(1); |
| | | segmentService.updateById(currSeg); |
| | | } |
| | | // mark roller waiting |
| | | travelService.markRollerWaiting(currSeg.getTravelId(), currentCode.getId()); |
| | | // if (currSeg.getRollerWaiting() == 0) { |
| | | // currSeg.setRollerWaiting(1); |
| | | // segmentService.updateById(currSeg); |
| | | // } |
| | | |
| | | // timeout |
| | | return (now - preEndTime) < PLACE_DELAY_MS; |
| | | return (now - preEndTime) < Optional.ofNullable(rollerSta.getOutboundWait()).orElse(DEFAULT_PLACE_DELAY_MS); |
| | | } |
| | | |
| | | return false; |
| | |
| | | import com.zy.acs.manager.common.utils.ExcelUtil; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.StaReserve; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.service.StaReserveService; |
| | | import com.zy.acs.manager.manager.service.StaService; |
| | | import com.zy.acs.manager.system.controller.BaseController; |
| | |
| | | sta.setCreateTime(now); |
| | | sta.setUpdateBy(loginUserId); |
| | | sta.setUpdateTime(now); |
| | | sta.setStatus(StatusType.ENABLE.val); |
| | | if (!staService.save(sta)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | |
| | | import com.zy.acs.manager.manager.service.AgvService; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.TaskService; |
| | | import com.zy.acs.manager.manager.service.TravelService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String memo; |
| | | |
| | | public Segment() {} |
| | | |
| | | public String getTravelId$(){ |
| | | TravelService service = SpringUtils.getBean(TravelService.class); |
| | | Travel travel = service.getById(this.travelId); |
| | | if (!Cools.isEmpty(travel)){ |
| | | return String.valueOf(travel.getUuid()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getTaskId$(){ |
| | | TaskService service = SpringUtils.getBean(TaskService.class); |
| | |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SpringUtils; |
| | | import com.zy.acs.manager.manager.service.CodeService; |
| | | import com.zy.acs.manager.manager.service.StaTypeService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | @ApiModelProperty(value= "åç§»é") |
| | | private Double offset; |
| | | |
| | | @ApiModelProperty(value= "ä½ä¸é«åº¦") |
| | | private Double height; |
| | | |
| | | @ApiModelProperty(value= "ä½ä¸æ·±åº¦") |
| | | private Double depth; |
| | | |
| | | @ApiModelProperty(value= "ä½ä¸è§åº¦") |
| | | private String angle; |
| | | |
| | | @ApiModelProperty(value= "è¿ç»å
¥åºçå¾
(ms)") |
| | | private Integer inboundWait; |
| | | |
| | | @ApiModelProperty(value= "è¿ç»åºåºçå¾
(ms)") |
| | | private Integer outboundWait; |
| | | |
| | | @ApiModelProperty(value= "èªå¨") |
| | | private String autoing; |
| | |
| | | // return null; |
| | | // } |
| | | // |
| | | // public String getStaType$(){ |
| | | // StaTypeService service = SpringUtils.getBean(StaTypeService.class); |
| | | // StaType staType = service.getById(this.staType); |
| | | // if (!Cools.isEmpty(staType)){ |
| | | // return String.valueOf(staType.getName()); |
| | | // } |
| | | // return null; |
| | | // } |
| | | public String getStaType$(){ |
| | | StaTypeService service = SpringUtils.getBean(StaTypeService.class); |
| | | StaType staType = service.getById(this.staType); |
| | | if (!Cools.isEmpty(staType)){ |
| | | return String.valueOf(staType.getUuid()); |
| | | } |
| | | return null; |
| | | } |
| | | // |
| | | public String getCode$(){ |
| | | CodeService service = SpringUtils.getBean(CodeService.class); |
| | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.SpringUtils; |
| | | import com.zy.acs.manager.manager.service.AgvService; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | |
| | | private String taskIds; |
| | | |
| | | /** |
| | | * æ»ç线çå¾
1: æ¯ 0: å¦ |
| | | */ |
| | | @ApiModelProperty(value= "æ»ç线çå¾
1: æ¯ 0: å¦ ") |
| | | private Integer rollerWaiting; |
| | | |
| | | /** |
| | | * æ»ç线çå¾
å°ç |
| | | */ |
| | | @ApiModelProperty(value= "æ»ç线çå¾
å°ç ") |
| | | private Long rollerWaitingCode; |
| | | |
| | | /** |
| | | * è¿åº¦ |
| | | */ |
| | | @ApiModelProperty(value= "è¿åº¦") |
| | |
| | | @ApiModelProperty(value= "夿³¨") |
| | | private String memo; |
| | | |
| | | public Travel() {} |
| | | |
| | | public Travel(String uuid,String travelId,Long agvId,Long currSeg,String taskContent,String taskIds,String state,Integer status,Integer deleted,Long tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.uuid = uuid; |
| | | this.travelId = travelId; |
| | | this.agvId = agvId; |
| | | this.currSeg = currSeg; |
| | | this.taskContent = taskContent; |
| | | this.taskIds = taskIds; |
| | | this.state = state; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.tenantId = tenantId; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateBy = updateBy; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // Travel travel = new Travel( |
| | | // null, // ç¼å· |
| | | // null, // ç»ç¼å· |
| | | // null, // AGV |
| | | // null, // å½åèç¹ |
| | | // null, // å
容 |
| | | // null, // ä»»å¡å表 |
| | | // null, // è¿åº¦ |
| | | // null, // ç¶æ[é空] |
| | | // null, // æ¯å¦å é¤[é空] |
| | | // null, // ç§æ· |
| | | // null, // æ·»å 人å |
| | | // null, // æ·»å æ¶é´[é空] |
| | | // null, // ä¿®æ¹äººå |
| | | // null, // ä¿®æ¹æ¶é´ |
| | | // null // 夿³¨ |
| | | // ); |
| | | |
| | | public String getAgvId$(){ |
| | | AgvService service = SpringUtils.getBean(AgvService.class); |
| | | Agv agv = service.getById(this.agvId); |
| | | if (!Cools.isEmpty(agv)){ |
| | | return String.valueOf(agv.getUuid()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | public Boolean getRollerWaitingBool(){ |
| | | if (null == this.rollerWaiting){ return null; } |
| | | switch (this.rollerWaiting){ |
| | | case 1: |
| | | return "æ£å¸¸"; |
| | | return true; |
| | | case 0: |
| | | return "å»ç»"; |
| | | return false; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | |
| | | |
| | | Boolean judgeEnable(Long agvId); |
| | | |
| | | Boolean judgeEnable(Long agvId, Boolean withBattery); |
| | | Boolean judgeEnable(Long agvId, Boolean withBattery, Boolean idleStatus); |
| | | |
| | | Boolean judgeOnline(Long agvId); |
| | | |
| | |
| | | package com.zy.acs.manager.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.enums.SegmentStateType; |
| | | |
| | |
| | | |
| | | Boolean cancel(Long segmentId, Long userId); |
| | | |
| | | Segment getCurrRunningSeg(Long agvId, Long codeId); |
| | | Segment getCurrWaitingSeg(Long travelId, Long agvId); |
| | | |
| | | Segment getCurrRunningSeg(Long travelId, Long agvId, Long codeId); |
| | | |
| | | List<Integer> selectUsedBackpacks(Long travelId, Long agvId); |
| | | |
| | | Segment getRollerWaiting(Long agvId, Long codeId, TaskPosDto.PosType posType); |
| | | |
| | | Boolean isRollerWaiting(Long agvId); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.acs.manager.manager.entity.Sta; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.StaTypeType; |
| | | |
| | | import java.util.List; |
| | |
| | | |
| | | List<Sta> queryAvailableInSta(Integer minAvailableQty); |
| | | |
| | | Task checkoutTask(Long staId); |
| | | |
| | | boolean isRoller(Long staId); |
| | | |
| | | Boolean hasWorkingAgv(Long staId); |
| | |
| | | |
| | | void finishAll(Long agvId); |
| | | |
| | | Travel findRunningTravel(Long agvId); |
| | | |
| | | Travel findRollerWaitingTravel(Long agvId, Long code); |
| | | |
| | | Boolean hasRollerWaiting(Long agvId); |
| | | |
| | | Boolean markRollerWaiting(Long travelId, Long codeId); |
| | | |
| | | Boolean clearRollerWaiting(Long travelId); |
| | | |
| | | } |
| | |
| | | |
| | | @Override |
| | | public Boolean judgeEnable(Long agvId) { |
| | | return this.judgeEnable(agvId, false); |
| | | return this.judgeEnable(agvId, false, true); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean judgeEnable(Long agvId, Boolean isLowBattery) { |
| | | public Boolean judgeEnable(Long agvId, Boolean isLowBattery, Boolean idleStatus) { |
| | | String agvNo = this.getAgvNo(agvId); |
| | | AgvModel agvModel = agvModelService.getByAgvId(agvId); |
| | | if (0 < segmentService.count(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()) |
| | | )) { |
| | | if (idleStatus) { |
| | | if (0 < segmentService.count(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()) |
| | | )) { |
| | | // log.warn("[{}]å·Agvæ£å¨å¿ç¢ - segment......", agvNo); |
| | | return false; |
| | | return false; |
| | | } |
| | | } |
| | | if (!this.judgeOnline(agvId)) { |
| | | // log.warn("[{}]å·Agv䏿¯å¨çº¿ç¶æ......", agvNo); |
| | |
| | | if (null == agvDetail.getSoc() || agvDetail.getSoc() == 0) { |
| | | return false; |
| | | } |
| | | if (!agvDetail.getAgvStatus().equals(AgvStatusType.IDLE) && !agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | log.warn("[{}]å·Agv䏿¯ç©ºé²ç¶æ......", agvNo); |
| | | return false; |
| | | if (idleStatus) { |
| | | if (!agvDetail.getAgvStatus().equals(AgvStatusType.IDLE) && !agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | log.warn("[{}]å·Agv䏿¯ç©ºé²ç¶æ......", agvNo); |
| | | return false; |
| | | } |
| | | } |
| | | if (agvDetail.getAgvStatus().equals(AgvStatusType.CHARGE)) { |
| | | if (agvDetail.getSoc() < agvModel.getQuaBattery()) { |
| | |
| | | import com.zy.acs.manager.common.domain.TaskDto; |
| | | import com.zy.acs.manager.manager.controller.param.OpenBusSubmitParam; |
| | | import com.zy.acs.manager.manager.entity.Bus; |
| | | import com.zy.acs.manager.manager.entity.Loc; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.BusStsType; |
| | | import com.zy.acs.manager.manager.enums.LocStsType; |
| | | import com.zy.acs.manager.manager.enums.TaskStsType; |
| | | import com.zy.acs.manager.manager.mapper.BusMapper; |
| | | import com.zy.acs.manager.manager.service.BusService; |
| | | import com.zy.acs.manager.manager.service.LocService; |
| | | import com.zy.acs.manager.manager.service.TaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @Override |
| | | public Bus selectByUuid(String uuid) { |
| | | return this.getOne(new LambdaQueryWrapper<Bus>().eq(Bus::getUuid, uuid)); |
| | | } |
| | | |
| | | private void test(OpenBusSubmitParam param) { |
| | | if (Cools.isEmpty(param)) { |
| | | return; |
| | | } |
| | | List<TaskDto> taskList = param.getTaskList(); |
| | | if (Cools.isEmpty(taskList)) { |
| | | return; |
| | | } |
| | | for (TaskDto dto : taskList) { |
| | | if (dto.getPriority() == 9527) { |
| | | if (Cools.isEmpty(dto.getDestLoc())) { |
| | | List<Loc> locList = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .ge(Loc::getRow, 31).eq(Loc::getLocSts, LocStsType.IDLE.val())); |
| | | if (Cools.isEmpty(locList)) { |
| | | log.error("there is no such idle loc"); |
| | | break; |
| | | } |
| | | Collections.shuffle(locList); |
| | | Loc loc = locList.get(0); |
| | | dto.setDestLoc(loc.getLocNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (Cools.isEmpty(param.getBatch())) { |
| | | return "Batch cannot be empty!"; |
| | | } |
| | | this.test(param); |
| | | Set<String> oriStaNoSet = new HashSet<>(); |
| | | Set<String> oriLocNoSet = new HashSet<>(); |
| | | Set<String> destStaNoSet = new HashSet<>(); |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.entity.Task; |
| | | import com.zy.acs.manager.manager.enums.ActionStsType; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Segment getCurrRunningSeg(Long agvId, Long codeId) { |
| | | public Segment getCurrWaitingSeg(Long travelId, Long agvId) { |
| | | List<Segment> segments = this.list(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getTravelId, travelId) |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()) |
| | | .eq(Segment::getEndNode, codeId) |
| | | .eq(Segment::getState, SegmentStateType.WAITING.toString()) |
| | | .orderByDesc(Segment::getId) |
| | | ); |
| | | |
| | | if (Cools.isEmpty(segments)) { |
| | | } |
| | | return segments.stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public Segment getCurrRunningSeg(Long travelId, Long agvId, Long codeId) { |
| | | if (null == agvId) { |
| | | return null; |
| | | } |
| | | LambdaQueryWrapper<Segment> wrapper = new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.RUNNING.toString()); |
| | | if (null != travelId) { |
| | | wrapper.eq(Segment::getTravelId, travelId); |
| | | } |
| | | if (null != codeId) { |
| | | wrapper.eq(Segment::getEndNode, codeId); |
| | | } |
| | | wrapper.orderByDesc(Segment::getId); |
| | | List<Segment> segments = this.list(wrapper); |
| | | if (Cools.isEmpty(segments)) { |
| | | } |
| | | return segments.stream().findFirst().orElse(null); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> selectUsedBackpacks(Long travelId, Long agvId) { |
| | | return this.baseMapper.selectUsedBackpacks(agvId, travelId); |
| | | } |
| | | |
| | | @Override |
| | | public Segment getRollerWaiting(Long agvId, Long codeId, TaskPosDto.PosType posType) { |
| | | List<Segment> segments = this.list(new LambdaQueryWrapper<Segment>() |
| | | .eq(Segment::getAgvId, agvId) |
| | | .eq(Segment::getState, SegmentStateType.WAITING.toString()) |
| | | .eq(Segment::getEndNode, codeId) |
| | | .eq(Segment::getPosType, posType.toString()) |
| | | .eq(Segment::getRollerWaiting, 1) |
| | | .orderByDesc(Segment::getId) |
| | | ); |
| | | if (Cools.isEmpty(segments)) { |
| | | return null; |
| | | } |
| | | return segments.get(0); |
| | | return this.baseMapper.selectUsedBackpacks(travelId, agvId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.manager.core.domain.TaskPosDto; |
| | | import com.zy.acs.manager.manager.entity.*; |
| | | import com.zy.acs.manager.manager.enums.SegmentStateType; |
| | | import com.zy.acs.manager.manager.enums.StaTypeType; |
| | | import com.zy.acs.manager.manager.enums.StatusType; |
| | | import com.zy.acs.manager.manager.enums.TravelStateType; |
| | | import com.zy.acs.manager.manager.enums.*; |
| | | import com.zy.acs.manager.manager.mapper.StaMapper; |
| | | import com.zy.acs.manager.manager.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private SegmentService segmentService; |
| | | @Autowired |
| | | private TravelService travelService; |
| | | @Autowired |
| | | private StaReserveService staReserveService; |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | @Override |
| | | public Sta selectByStaNo(String staNo) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Task checkoutTask(Long staId) { |
| | | StaReserve reserve = staReserveService.getOne(new LambdaQueryWrapper<StaReserve>() |
| | | .eq(StaReserve::getStaId, staId) |
| | | .eq(StaReserve::getState, StaReserveStateType.CONFIRMED.toString()) |
| | | .eq(StaReserve::getType, StaReserveType.IN.toString()) |
| | | .eq(StaReserve::getStatus, StatusType.ENABLE.val) |
| | | .orderByDesc(StaReserve::getConfirmedAt) |
| | | .last("limit 1") |
| | | ); |
| | | if (null == reserve) { |
| | | return null; |
| | | } |
| | | return taskService.getById(reserve.getTaskId()); |
| | | } |
| | | |
| | | @Override |
| | | public boolean isRoller(Long staId) { |
| | | if (staId == null) { |
| | | return false; |
| | |
| | | package com.zy.acs.manager.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import com.zy.acs.manager.manager.entity.Segment; |
| | | import com.zy.acs.manager.manager.entity.Travel; |
| | | import com.zy.acs.manager.manager.enums.SegmentStateType; |
| | |
| | | import com.zy.acs.manager.manager.mapper.TravelMapper; |
| | | import com.zy.acs.manager.manager.service.SegmentService; |
| | | import com.zy.acs.manager.manager.service.TravelService; |
| | | import com.zy.acs.framework.exception.CoolException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Slf4j |
| | | @Service("travelService") |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public Travel findRunningTravel(Long agvId) { |
| | | return this.getOne(new LambdaQueryWrapper<Travel>() |
| | | .eq(Travel::getAgvId, agvId) |
| | | .eq(Travel::getState, TravelStateType.RUNNING.toString()) |
| | | .orderByDesc(Travel::getCreateTime) |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public Travel findRollerWaitingTravel(Long agvId, Long code) { |
| | | return this.getOne(new LambdaQueryWrapper<Travel>() |
| | | .eq(Travel::getAgvId, agvId) |
| | | .eq(Travel::getState, TravelStateType.RUNNING.toString()) |
| | | .eq(Travel::getRollerWaiting, 1) |
| | | .eq(Travel::getRollerWaitingCode, code) |
| | | .orderByDesc(Travel::getCreateTime) |
| | | .last("limit 1") |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean hasRollerWaiting(Long agvId) { |
| | | if (null == agvId) { |
| | | return false; |
| | | } |
| | | return 0 < this.count(new LambdaQueryWrapper<Travel>() |
| | | .eq(Travel::getAgvId, agvId) |
| | | .eq(Travel::getState, TravelStateType.RUNNING.toString()) |
| | | .eq(Travel::getRollerWaiting, 1) |
| | | ); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean markRollerWaiting(Long travelId, Long codeId) { |
| | | if (Cools.isEmpty(travelId, codeId)) { |
| | | return false; |
| | | } |
| | | Travel travel = this.getById(travelId); |
| | | if (travel == null) { |
| | | return false; |
| | | } |
| | | if (!TravelStateType.RUNNING.toString().equals(travel.getState())) { |
| | | return false; |
| | | } |
| | | if (travel.getRollerWaiting() == 1 |
| | | && Objects.equals(travel.getRollerWaitingCode(), codeId)) { |
| | | return true; |
| | | } |
| | | travel.setRollerWaiting(1); |
| | | travel.setRollerWaitingCode(codeId); |
| | | if (!this.updateById(travel)) { |
| | | log.error("travel [{}] failed to mark roller waiting (code={})", travelId, codeId); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public Boolean clearRollerWaiting(Long travelId) { |
| | | if (null == travelId) { |
| | | return false; |
| | | } |
| | | Travel travel = this.getById(travelId); |
| | | if (travel == null) { |
| | | return false; |
| | | } |
| | | // if (!TravelStateType.RUNNING.toString().equals(travel.getState())) { |
| | | // return false; |
| | | // } |
| | | if (travel.getRollerWaiting() == 0 && Cools.isEmpty(travel.getRollerWaitingCode())) { |
| | | return true; |
| | | } |
| | | if (!this.update( |
| | | new LambdaUpdateWrapper<Travel>() |
| | | .eq(Travel::getId, travelId) |
| | | .set(Travel::getRollerWaiting, 0) |
| | | .set(Travel::getRollerWaitingCode, null) |
| | | )) { |
| | | log.error("travel [{}] failed to clear roller waiting", travelId); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | } |
| | |
| | | index: 8 |
| | | |
| | | convey-plc: |
| | | host: 10.10.10.212 |
| | | host: 10.10.10.222 |
| | | port: 9090 |
| | | |
| | | floyd: |