#
luxiaotao1123
2024-03-29 9e7a181ca269d385392527639084e4b8579c1fd2
#
6个文件已修改
1个文件已添加
173 ■■■■■ 已修改文件
zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/controller/MapController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/controller/result/LocVo.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
zy-asrs-flow/src/pages/map/drawer/shelf/index.jsx
@@ -16,12 +16,11 @@
    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]);
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -3,7 +3,7 @@
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'
import TWEEN from '@tweenjs/tween.js';
const help = false;
const help = true;
export default class ShelfThree {
@@ -163,7 +163,8 @@
    }
    build = () => {
        buildDemo(this.scene);
        buildShelf(this.scene);
        buildPallet(this.scene);
    }
    handleClick = () => {
@@ -233,13 +234,24 @@
    }
}
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;
}
zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -43,30 +43,44 @@
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;
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/controller/MapController.java
@@ -6,11 +6,7 @@
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
@@ -37,10 +33,16 @@
//    @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));
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/controller/result/LocVo.java
New file
@@ -0,0 +1,19 @@
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;
    }
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/map/service/MapService.java
@@ -7,13 +7,17 @@
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;
/**
@@ -35,28 +39,7 @@
            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)) {
@@ -96,6 +79,17 @@
        }
    }
    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;
@@ -103,4 +97,27 @@
        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" +
            "]";
}
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/Utils.java
@@ -7,12 +7,15 @@
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("库位解析异常");
    }
@@ -22,7 +25,8 @@
     */
    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("库位解析异常");
    }
@@ -32,13 +36,15 @@
     */
    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){