自动化立体仓库 - WMS系统
#
zwl
7 小时以前 44b6b79dd5dee0ebbd2d11b08abbc2be275bed58
src/main/java/com/zy/api/controller/WcsApiController.java
@@ -1,19 +1,23 @@
package com.zy.api.controller;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.core.annotations.ManagerAuth;
import com.core.common.R;
import com.zy.api.controller.params.ReceviceTaskParams;
import com.zy.api.controller.params.WorkTaskParams;
import com.zy.api.service.WcsApiService;
import com.zy.asrs.entity.LocAroundBind;
import com.zy.asrs.entity.WaitPakin;
import com.zy.asrs.service.LocAroundBindService;
import com.zy.asrs.service.WaitPakinService;
import com.zy.asrs.utils.Utils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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.*;
import java.util.List;
import java.util.Objects;
@Api("WCS交互接口")
@@ -23,7 +27,11 @@
    @Autowired
    private WcsApiService wcsApiService;
    @Autowired
    private WaitPakinService waitPakinService;
    @Autowired
    private LocAroundBindService locAroundBindService;
    /**
     * 通知WCS锁定周边库位,及禁止任务执行
     * @author Ryan
@@ -37,7 +45,7 @@
        if (Objects.isNull(params)) {
            return R.error("参数不能为空!!");
        }
        if (Objects.isNull(params.getDeviceNo())) {
        if (Objects.isNull(params.getDevNo())) {
            return R.error("机台号不能为空!!");
        }
@@ -52,10 +60,10 @@
     * @param params
     * @return com.core.common.R
     */
    @ManagerAuth
//    @ManagerAuth
    @ApiOperation("堆垛机回库搬运指令")
    @PostMapping("/back/loc")
    public R backLoc(@RequestBody WorkTaskParams params) {
    public synchronized R backLoc(@RequestBody String params) {
        if (Objects.isNull(params)) {
            return R.error("参数不能为空!!");
        }
@@ -81,7 +89,7 @@
    }
    @ManagerAuth
    @ApiOperation("设备执行状态回写")
    @ApiOperation("设备执行状态回写-wcs任务完成回写")
    @PostMapping("/openapi/report")
    public R receviceTaskFromWcs(@RequestBody ReceviceTaskParams params) {
        if (Objects.isNull(params)) {
@@ -91,5 +99,51 @@
    }
    @ManagerAuth
    @ApiOperation("获取组托入库托盘信息")
    @PostMapping("/openapi/waitPakins")
    public R waitPakins() {
        List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("io_status", "N"));
        return R.ok().add(waitPakins);
    }
    @ManagerAuth
    @ApiOperation("获取机台库位的数组")
    @GetMapping("/openapi/arr")
    public R arr() {
        int i = 0;
        int[] k = new  int[] { 3, 0, 4, 1, 5, 2};
        int c=0;
        int h=0;
        int i1 = 15;
        List<LocAroundBind> locAroundBinds = locAroundBindService.selectList(new EntityWrapper<LocAroundBind>().orderBy("dev_id"));
        String[] arr = new String[90];
        for (LocAroundBind locAroundBind : locAroundBinds) {
            String s = Utils.WMSLocToWCSLoc(locAroundBind.getBlocNo());
            int index = i*6+k[c];
            arr[index] = s;
            c++;
            if (c==k.length) {
                c=0;
                i++;
            }
            if (i==i1){
                i=0;
                h++;
                System.out.print("[");
                for (int j=0;j<i1*6;j++){
                    System.out.print(arr[j]+",");
                }
                System.out.println("]");
                if (h==2){
                    i1 = 13;
                }else if (h==3){
                   i1 = 8;
                }
            }
        }
        return R.ok();
    }
}