| | |
| | | const { styles } = useStyles(); |
| | | const { curSprite, curFloor } = props; |
| | | |
| | | const [locNo, setLocNo] = useState(''); |
| | | const [activeTabKey, setActiveTabKey] = useState('view'); |
| | | |
| | | const locNo = curSprite.data.no + '-' + curFloor; |
| | | |
| | | useEffect(() => { |
| | | const locNo = curSprite.data.no + '-' + curFloor; |
| | | setLocNo(locNo) |
| | | props.setDrawerTitle(intl.formatMessage({ id: 'map.loc.no', defaultMessage: '库位号' }) + ': ' + locNo); |
| | | }, [curSprite]); |
| | | |
| | |
| | | import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls' |
| | | import TWEEN from '@tweenjs/tween.js'; |
| | | |
| | | const help = false; |
| | | const help = true; |
| | | |
| | | export default class ShelfThree { |
| | | |
| | |
| | | } |
| | | |
| | | build = () => { |
| | | buildDemo(this.scene); |
| | | buildShelf(this.scene); |
| | | buildPallet(this.scene); |
| | | } |
| | | |
| | | handleClick = () => { |
| | |
| | | } |
| | | } |
| | | |
| | | const buildDemo = (scene) => { |
| | | const boxGeometry = new THREE.BoxGeometry(100, 100, 100); |
| | | const buildShelf = (scene) => { |
| | | const boxGeometry = new THREE.BoxGeometry(100, 40, 100); |
| | | const boxMaterial = new THREE.MeshStandardMaterial({ |
| | | color: '#222f3e', |
| | | }); |
| | | const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial); |
| | | boxMesh.position.set(0, 0, 0); |
| | | boxMesh.position.set(0, 20, 0); |
| | | scene.add(boxMesh) |
| | | return boxMesh; |
| | | } |
| | | } |
| | | |
| | | const buildPallet = (scene) => { |
| | | const boxGeometry = new THREE.BoxGeometry(100, 60, 100); |
| | | const boxMaterial = new THREE.MeshStandardMaterial({ |
| | | color: '#b33939', |
| | | }); |
| | | const boxMesh = new THREE.Mesh(boxGeometry, boxMaterial); |
| | | boxMesh.position.set(0, 70, 0); |
| | | scene.add(boxMesh) |
| | | return boxMesh; |
| | | } |
| | |
| | | |
| | | let shelfThree; |
| | | |
| | | const startThree = (dom) => { |
| | | shelfThree = new ShelfThree(dom); |
| | | shelfThree.startup(); |
| | | } |
| | | |
| | | const endThree = () => { |
| | | if (shelfThree) { |
| | | shelfThree.destroy(); |
| | | shelfThree = null; |
| | | } |
| | | } |
| | | |
| | | const ShelfView = (props) => { |
| | | const intl = useIntl(); |
| | | const { styles } = useStyles(); |
| | | const refContainer = useRef(); |
| | | const [loading, setLoading] = React.useState(false); |
| | | |
| | | const startThree = () => { |
| | | shelfThree = new ShelfThree(refContainer.current); |
| | | shelfThree.startup(); |
| | | } |
| | | const [shelfList, setShelfList] = React.useState([]); |
| | | |
| | | const endThree = () => { |
| | | if (shelfThree) { |
| | | shelfThree.destroy(); |
| | | shelfThree = null; |
| | | } |
| | | } |
| | | |
| | | |
| | | useEffect(() => { |
| | | // locNo data |
| | | const fetchShelfInfo = async (locNo) => { |
| | | const res = await Http.doGet('/api/map/shelf/info', { locNo: locNo }); |
| | | if (res?.data) { |
| | | console.log(res.data); |
| | | } |
| | | } |
| | | fetchShelfInfo(props.locNo); |
| | | |
| | | // 3d |
| | | setLoading(true); |
| | | endThree(); |
| | | setTimeout(() => { |
| | | setLoading(false); |
| | | startThree(); |
| | | startThree(refContainer.current); |
| | | }, 300) |
| | | |
| | | return endThree; |
| | |
| | | import com.zy.asrs.wcs.core.map.service.MapService; |
| | | import com.zy.asrs.wcs.system.controller.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * Created by vincent on 3/15/2024 |
| | |
| | | |
| | | // @PreAuthorize("hasAuthority('core:map:save')") |
| | | @PostMapping("/save") |
| | | @Transactional |
| | | public R mapSave(@RequestBody MapDataParam param) { |
| | | mapService.saveMapData(param, getLoginUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | // 货架 - 库位 -------------------------------------------------------- |
| | | @GetMapping("/shelf/info") |
| | | public R shelfInfo(@RequestParam String locNo) { |
| | | return R.ok().add(mapService.getShelfLocNoList(locNo)); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wcs.core.map.controller.result; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * Created by vincent on 3/29/2024 |
| | | */ |
| | | @Data |
| | | public class LocVo { |
| | | |
| | | private String locNo; |
| | | |
| | | private String locSts; |
| | | |
| | | public LocVo(String locNo, String locSts) { |
| | | this.locNo = locNo; |
| | | this.locSts = locSts; |
| | | } |
| | | } |
| | |
| | | import com.zy.asrs.wcs.common.domain.enums.DictType; |
| | | import com.zy.asrs.wcs.core.map.controller.param.MapDataParam; |
| | | import com.zy.asrs.wcs.core.map.controller.param.MapQueryParam; |
| | | import com.zy.asrs.wcs.core.map.controller.result.LocVo; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.system.entity.Dict; |
| | | import com.zy.asrs.wcs.system.service.DictService; |
| | | import com.zy.asrs.wcs.system.service.UserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | /** |
| | |
| | | dict.setName(floorKey); |
| | | dict.setFlag(floorKey); |
| | | dict.setType(DictType.JSON.flag); |
| | | dict.setValue("[\n" + |
| | | " {\n" + |
| | | " label: '1F',\n" + |
| | | " value: 1\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '2F',\n" + |
| | | " value: 2\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '3F',\n" + |
| | | " value: 3\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '4F',\n" + |
| | | " value: 4\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '5F',\n" + |
| | | " value: 5\n" + |
| | | " },\n" + |
| | | "]"); |
| | | dict.setValue(floorListStr); |
| | | dict.setCreateBy(userId); |
| | | dict.setUpdateBy(userId); |
| | | if (!dictService.save(dict)) { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<LocVo> getShelfLocNoList(String locNo) { |
| | | List<LocVo> locVos = new ArrayList<>(); |
| | | int row = Utils.getRow(locNo); |
| | | int bay = Utils.getBay(locNo); |
| | | for (int lev = 1; lev < 6; lev++) { |
| | | locVos.add(new LocVo(Utils.getLocNo(row, bay, lev), "F")); |
| | | } |
| | | return locVos; |
| | | } |
| | | |
| | | private String getMapKey(Integer floor) { |
| | | if (null != floor) { |
| | | return "map-" + floor; |
| | |
| | | return "map"; |
| | | } |
| | | |
| | | private final String floorListStr = "[\n" + |
| | | " {\n" + |
| | | " label: '1F',\n" + |
| | | " value: 1\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '2F',\n" + |
| | | " value: 2\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '3F',\n" + |
| | | " value: 3\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '4F',\n" + |
| | | " value: 4\n" + |
| | | " },\n" + |
| | | " {\n" + |
| | | " label: '5F',\n" + |
| | | " value: 5\n" + |
| | | " },\n" + |
| | | "]"; |
| | | |
| | | } |
| | |
| | | |
| | | public class Utils { |
| | | |
| | | public static final String _LINK = "-"; |
| | | |
| | | /** |
| | | * 通过库位号获取 排 |
| | | */ |
| | | public static int getRow(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(0, 2)); |
| | | String[] split = locNo.split(_LINK); |
| | | return Integer.parseInt(split[0]); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | |
| | | */ |
| | | public static int getBay(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(2, 5)); |
| | | String[] split = locNo.split(_LINK); |
| | | return Integer.parseInt(split[1]); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | |
| | | */ |
| | | public static int getLev(String locNo) { |
| | | if (!Cools.isEmpty(locNo)) { |
| | | return Integer.parseInt(locNo.substring(5, 7)); |
| | | String[] split = locNo.split(_LINK); |
| | | return Integer.parseInt(split[2]); |
| | | } |
| | | throw new RuntimeException("库位解析异常"); |
| | | } |
| | | |
| | | public static String getLocNo(Number row, Number bay, Number lev) { |
| | | return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); |
| | | return row + _LINK + bay + _LINK + lev; |
| | | // return zerofill(String.valueOf(row), 2) + zerofill(String.valueOf(bay), 3) + zerofill(String.valueOf(lev), 2); |
| | | } |
| | | |
| | | public static String zerofill(String msg, Integer count){ |