Pārlūkot izejas kodu

金川选矿-WCS接口开发

LZH 2 gadi atpakaļ
vecāks
revīzija
c3954c766e

+ 0 - 199
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/HualanApiController.java

@@ -1,199 +0,0 @@
-package com.ruoyi.web.controller.warewms.api;
-
-import cn.hutool.http.HttpRequest;
-import com.alibaba.fastjson.JSON;
-import com.ruoyi.ams.config.domain.dto.LotattDTO;
-import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
-import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
-import com.ruoyi.ams.inv.service.IInvLotLocIdService;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.web.controller.warewms.pda.PdaDocAsnController;
-import com.ruoyi.web.controller.warewms.pda.PdaDocQcController;
-import com.ruoyi.web.controller.warewms.pda.PdaDocSoController;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.Data;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author JWK
- * @version 1.0
- * @date 2022/11/14 14:52
- */
-@Slf4j
-@Api("华兰接口对接")
-@RestController
-@RequestMapping("/hualan")
-public class HualanApiController {
-
-
-    @Autowired
-    private PdaDocAsnController pdaDocAsnController;
-    @Autowired
-    private PdaDocSoController pdaDocSoController;
-    @Autowired
-    private PdaDocQcController pdaDocQcController;
-    @Autowired
-    private IInvLotLocIdService invLotLocIdService;
-
-    /**
-     * 入库
-     *
-     * @param docAsnHeader
-     * @return
-     */
-    @ApiOperation("入库")
-    @PostMapping("asn/inInv")
-    public AjaxResult inInv(@RequestBody DocAsnHeader docAsnHeader) {
-        log.info("华兰接口测试传入数据-入库:" + JSON.toJSONString(docAsnHeader));
-        return AjaxResult.success("调用接口成功!");
-
-//        PdaDocAsnController.DocAsnHeader asnHeader = new PdaDocAsnController.DocAsnHeader();
-//        asnHeader.setLocationFrom(docAsnHeader.getLocationFrom());
-//        ArrayList<PdaDocAsnController.DocAsnDetails> docAsnDetailsList = new ArrayList<>();
-//        PdaDocAsnController.DocAsnDetails docAsnDetails = null;
-//        for (DocAsnDetails asnDetails : docAsnHeader.getDocAsnDetails()) {
-//            docAsnDetails = new PdaDocAsnController.DocAsnDetails();
-//            docAsnDetails.setSku(StringUtils.isEmpty(asnDetails.getMaterial()) ?
-//                    asnDetails.getBatchNum() : asnDetails.getMaterial());
-//            docAsnDetails.setBatchNo(asnDetails.getBatchNum());
-//            docAsnDetails.setQty(asnDetails.getQty());
-//            docAsnDetails.setWeight(asnDetails.getWeight());
-//            docAsnDetails.setBoxNo(asnDetails.getBoxNo() != null ? asnDetails.getBoxNo() : "");
-//            docAsnDetailsList.add(docAsnDetails);
-//        }
-//        asnHeader.setDocAsnDetails(docAsnDetailsList);
-//        return pdaDocAsnController.inToTran(asnHeader);
-    }
-
-    /**
-     * 质检提交
-     *
-     * @param map
-     * @return
-     */
-    @ApiOperation("质检提交")
-    @PostMapping("qc/updateQcStatus")
-    public AjaxResult updateQcStatus(@RequestBody Map<String, String> map) {
-        log.info("华兰接口测试传入数据-质检提交:" + JSON.toJSONString(map));
-        return AjaxResult.success("调用接口成功!");
-
-//        String batchNum = map.get("batchNum");
-//        String qcStatus = map.get("qcStatus");
-//        Map<String, String> mapp = new HashMap<>();
-//        mapp.put("sku", "");
-//        mapp.put("batchNo", batchNum);
-//        mapp.put("status", qcStatus);
-//        return pdaDocQcController.qcSubmit(mapp);
-    }
-
-    /**
-     * 出库
-     *
-     * @param docOrderHeader
-     * @return
-     */
-    @ApiOperation("出库")
-    @PostMapping("so/outInv")
-    public AjaxResult outInv(@RequestBody DocOrderHeader docOrderHeader) {
-        log.info("华兰接口测试传入数据-出库:" + JSON.toJSONString(docOrderHeader));
-        return AjaxResult.success("调用接口成功!");
-
-//        PdaDocSoController.DocOrderHeader header = new PdaDocSoController.DocOrderHeader();
-//        header.setBatchNum(docOrderHeader.getBatchNum());
-//        return  pdaDocSoController.outToTran(header);
-    }
-
-    /**
-     * ERP获取WMS批次号所在库位
-     *
-     * @param batchNum
-     * @return
-     */
-    @ApiOperation("ERP获取WMS批次号所在库位")
-    @GetMapping("getLocByCon")
-    public AjaxResult getLocByCon(String batchNum, String boxNo) {
-        InvLocIdSearchFrom invLotLocIdQuery = new InvLocIdSearchFrom();
-        LotattDTO lotattDTO = new LotattDTO();
-        lotattDTO.setLotatt01(batchNum);
-        lotattDTO.setLotatt07(boxNo);
-        invLotLocIdQuery.setLotattDTO(lotattDTO);
-        List<InvLotLocIdLotattVO> invLotLocIdLotattVOList = invLotLocIdService.selectInvLocIdLotattList(invLotLocIdQuery);
-        Map<String, Set<String>> locMap = new HashMap<>();
-        Set<String> locSet = invLotLocIdLotattVOList.stream().map(v -> v.getLocationNo()).collect(Collectors.toSet());
-        locMap.put(batchNum, locSet);
-        return AjaxResult.success(locMap);
-    }
-
-    /**
-     * 半成品入库时,人工操作PDA扫描周转箱外箱二维码,二维码内容为生产批号,WMS通过批号获取华兰上游系统的生产数据
-     *
-     * @param batchNum
-     * @param boxNo
-     * @return
-     */
-    @ApiOperation("获取产品数据")
-    @GetMapping("getSkuInfo")
-    public AjaxResult getSkuInfo(String batchNum, String boxNo) {
-        HttpRequest httpRequest = HttpRequest.get("");
-        return AjaxResult.success();
-    }
-
-
-    @Data
-    public static class DocAsnHeader {
-        /**
-         * 起始库位 (目前现在就一个入库位,可以不传,系统默认)
-         */
-        private String locationFrom;
-        private List<DocAsnDetails> docAsnDetails;
-    }
-
-    @Data
-    public static class DocAsnDetails {
-        /**
-         * 批号
-         */
-        private String batchNum;
-        /**
-         * 数量
-         */
-        private String qty;
-        /**
-         * 单个周转箱的重量
-         */
-        private String weight;
-        /**
-         * 产品代码 可能不传
-         */
-        private String material;
-        /**
-         * 周转箱号
-         */
-        private String boxNo;
-
-    }
-
-    @Data
-    public static class DocOrderHeader {
-        private String batchNum;
-    }
-
-    @Data
-    public static class SkuInfo {
-        private String material;
-        private String batchNum;
-        private int quantity;
-        private double weight;
-        private Date productDate;
-        private String boxNo;
-    }
-
-
-}

+ 97 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/XuanKuangApiController.java

@@ -0,0 +1,97 @@
+package com.ruoyi.web.controller.warewms.api;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.web.controller.warewms.api.dto.*;
+import io.swagger.annotations.ApiOperation;
+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;
+
+@RestController
+@RequestMapping("/edi/wcs")
+public class XuanKuangApiController {
+
+
+    /**
+     * WCS组盘完成后上报相关信息并拿到WMS分配的入库信息接口
+     * 情况1:桶装货上报信息:托盘号;
+     * 情况2:袋装货上报信息:物料类型,数量,托盘号;
+     *
+     * @param stackingCompletion
+     * @return
+     */
+    @ApiOperation("组盘上报")
+    @PostMapping("/stackingCompletion")
+    public AjaxResult stackingCompletion(@RequestBody StackingCompletion stackingCompletion) {
+        return AjaxResult.success("仓位获取成功");
+    }
+
+    /**
+     * 用于WCS任务完成时回调的接口,通知WMS对应任务完成
+     *
+     * @param taskStatusResponse
+     * @return
+     */
+    @ApiOperation("任务状态反馈")
+    @PostMapping("/taskStatusResponse")
+    public AjaxResult taskStatusResponse(@RequestBody TaskStatusResponse taskStatusResponse) {
+        return AjaxResult.success("");
+    }
+
+    /**
+     * 用于通知WMS开启破袋机输送线的接口
+     * @param lineOpenNotification
+     * @return
+     */
+    @ApiOperation("破袋机开启通知")
+    @PostMapping("/lineOpenNotification")
+    public AjaxResult lineOpenNotification(@RequestBody LineOpenNotification lineOpenNotification) {
+        return AjaxResult.success("");
+    }
+
+    /**
+     * 空托出入库请求仓位接口
+     * @param emptyPalletLocRequest
+     * @return
+     */
+    @ApiOperation("空托仓位请求")
+    @PostMapping("/emptyPalletLocRequest")
+    public AjaxResult emptyPalletLocRequest(@RequestBody EmptyPalletLocRequest emptyPalletLocRequest) {
+        return AjaxResult.success("仓位获取成功");
+    }
+
+    /**
+     * WCS无托盘等异常状况上报接口
+     * @param errorStatusResponse
+     * @return
+     */
+    @ApiOperation("异常上报接口")
+    @PostMapping("/errorStatusResponse")
+    public AjaxResult errorStatusResponse(@RequestBody ErrorStatusResponse errorStatusResponse) {
+        return AjaxResult.success("");
+    }
+
+    /**
+     * WCS回调AGV安全交握申请结果
+     * @param callbackTask
+     * @return
+     */
+    @ApiOperation("WCS安全交握AGV")
+    @PostMapping("/callback/task")
+    public AjaxResult callbackTask(@RequestBody CallbackTask callbackTask) {
+        return AjaxResult.success("");
+    }
+
+    /**
+     * 当 WCS中存在出库任务时,调用AGV生成搬运任务
+     * @param outboundRequest
+     * @return
+     */
+    @ApiOperation("WCS出库任务下发AGV")
+    @PostMapping("/outboundRequest")
+    public AjaxResult outboundRequest(@RequestBody OutboundRequest outboundRequest) {
+        return AjaxResult.success("任务创建成功");
+    }
+
+}

+ 64 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/CallbackTask.java

@@ -0,0 +1,64 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * WCS安全交握AGV
+ */
+public class CallbackTask {
+    /**
+     * taskNo:任务号
+     * safeCode:安全交握请求结果  1:安全可执行 0:异常不可执行
+     * handshakeType:安全交握类型
+     * 1:申请进入(允许进入)
+     * 2:申请取货(允许取货)
+     * 3:申请卸货(允许卸货)
+     * 4:申请离开(允许离开)
+     * message: 异常信息  (当 SafeCode = 0 时非空)
+     */
+    private String taskNo;
+    private String safeCode;
+    private int handshakeType;
+    private String message;
+
+    public CallbackTask() {
+    }
+
+    public CallbackTask(String taskNo, String safeCode, int handshakeType, String message) {
+        this.taskNo = taskNo;
+        this.safeCode = safeCode;
+        this.handshakeType = handshakeType;
+        this.message = message;
+    }
+
+    public String getTaskNo() {
+        return taskNo;
+    }
+
+    public void setTaskNo(String taskNo) {
+        this.taskNo = taskNo;
+    }
+
+    public String getSafeCode() {
+        return safeCode;
+    }
+
+    public void setSafeCode(String safeCode) {
+        this.safeCode = safeCode;
+    }
+
+    public int getHandshakeType() {
+        return handshakeType;
+    }
+
+    public void setHandshakeType(int handshakeType) {
+        this.handshakeType = handshakeType;
+    }
+
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+}

+ 26 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/EmptyPalletLocRequest.java

@@ -0,0 +1,26 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 空托仓位请求
+ */
+public class EmptyPalletLocRequest {
+    /**
+     * taskType:空托仓位请求类型: 1、入库仓位  2、出库仓位
+     */
+    private int taskType;
+
+    public EmptyPalletLocRequest() {
+    }
+
+    public EmptyPalletLocRequest(int taskType) {
+        this.taskType = taskType;
+    }
+
+    public int getTaskType() {
+        return taskType;
+    }
+
+    public void setTaskType(int taskType) {
+        this.taskType = taskType;
+    }
+}

+ 37 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/ErrorStatusResponse.java

@@ -0,0 +1,37 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 异常上报
+ */
+public class ErrorStatusResponse {
+    private int errorCode;
+    private String errorMsg;
+
+    public ErrorStatusResponse() {
+    }
+
+    public ErrorStatusResponse(int errorCode, String errorMsg) {
+        /**
+         * errorCode :异常编码
+         * errorMsg :异常描述
+         */
+        this.errorCode = errorCode;
+        this.errorMsg = errorMsg;
+    }
+
+    public int getErrorCode() {
+        return errorCode;
+    }
+
+    public void setErrorCode(int errorCode) {
+        this.errorCode = errorCode;
+    }
+
+    public String getErrorMsg() {
+        return errorMsg;
+    }
+
+    public void setErrorMsg(String errorMsg) {
+        this.errorMsg = errorMsg;
+    }
+}

+ 26 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/LineOpenNotification.java

@@ -0,0 +1,26 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 开启破袋机
+ */
+public class LineOpenNotification {
+    /**
+     * lineId:破袋机输送线id
+     */
+    private String lineId;
+
+    public LineOpenNotification() {
+    }
+
+    public LineOpenNotification(String lineId) {
+        this.lineId = lineId;
+    }
+
+    public String getLineId() {
+        return lineId;
+    }
+
+    public void setLineId(String lineId) {
+        this.lineId = lineId;
+    }
+}

+ 37 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/OutboundRequest.java

@@ -0,0 +1,37 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 出库任务下发
+ */
+public class OutboundRequest {
+    /**
+     * wcsid:WCS任务ID
+     * palletNO:托盘号
+     */
+    private String wcsId;
+    private String palletNo;
+
+    public OutboundRequest() {
+    }
+
+    public OutboundRequest(String wcsId, String palletNo) {
+        this.wcsId = wcsId;
+        this.palletNo = palletNo;
+    }
+
+    public String getWcsId() {
+        return wcsId;
+    }
+
+    public void setWcsId(String wcsId) {
+        this.wcsId = wcsId;
+    }
+
+    public String getPalletNo() {
+        return palletNo;
+    }
+
+    public void setPalletNo(String palletNo) {
+        this.palletNo = palletNo;
+    }
+}

+ 83 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/StackingCompletion.java

@@ -0,0 +1,83 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 组盘上报
+ */
+public class StackingCompletion {
+    /**
+     * reportType:上报类型
+     * 情况1:桶装货上报信息:托盘号;
+     * 情况2:袋装货上报信息:物料类型,数量,托盘号;
+     * pannetNo:托盘号
+     * materialType:物料类型
+     * qty:数量
+     * relatedWmsNo:WMS入库单号
+     * taskNo:阻盘任务号,回库单号
+     */
+    private int reportType;
+    private String palletNo;
+    private String materialType;
+    private int qty;
+    private String relatedWmsNo;
+    private String taskNo;
+
+    public int getReportType() {
+        return reportType;
+    }
+
+    public void setReportType(int reportType) {
+        this.reportType = reportType;
+    }
+
+    public String getPalletNo() {
+        return palletNo;
+    }
+
+    public void setPalletNo(String palletNo) {
+        this.palletNo = palletNo;
+    }
+
+    public String getMaterialType() {
+        return materialType;
+    }
+
+    public void setMaterialType(String materialType) {
+        this.materialType = materialType;
+    }
+
+    public int getQty() {
+        return qty;
+    }
+
+    public void setQty(int qty) {
+        this.qty = qty;
+    }
+
+    public String getRelatedWmsNo() {
+        return relatedWmsNo;
+    }
+
+    public void setRelatedWmsNo(String relatedWmsNo) {
+        this.relatedWmsNo = relatedWmsNo;
+    }
+
+    public String getTaskNo() {
+        return taskNo;
+    }
+
+    public void setTaskNo(String taskNo) {
+        this.taskNo = taskNo;
+    }
+
+    public StackingCompletion(int reportType, String palletNo, String materialType, int qty, String relatedWmsNo, String taskNo) {
+        this.reportType = reportType;
+        this.palletNo = palletNo;
+        this.materialType = materialType;
+        this.qty = qty;
+        this.relatedWmsNo = relatedWmsNo;
+        this.taskNo = taskNo;
+    }
+
+    public StackingCompletion() {
+    }
+}

+ 38 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/api/dto/TaskStatusResponse.java

@@ -0,0 +1,38 @@
+package com.ruoyi.web.controller.warewms.api.dto;
+
+/**
+ * 任务状态反馈
+ */
+public class TaskStatusResponse {
+    /**
+     * taskNo: WCS任务号
+     * status: 任务执行状态
+     */
+    private String taskNo;
+    private int status;
+
+    public TaskStatusResponse() {
+    }
+
+    public TaskStatusResponse(String taskNo, int status) {
+        this.taskNo = taskNo;
+        this.status = status;
+    }
+
+    public String getTaskNo() {
+        return taskNo;
+    }
+
+    public void setTaskNo(String taskNo) {
+        this.taskNo = taskNo;
+    }
+
+    public int getStatus() {
+        return status;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+}

+ 1 - 1
ruoyi-admin/src/main/resources/application-dev.yml

@@ -6,7 +6,7 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://47.100.220.92:3306/wareams?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+                url: jdbc:mysql://47.100.220.92:3306/wareams-xuankuang?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
                 username: warewms
                 password: warewms123
             # 从库数据源

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -37,7 +37,7 @@ spring:
     # 国际化资源文件路径
     basename: i18n/messages
   profiles:
-    active: dev
+    active: prod
   # 文件上传
   servlet:
     multipart:

+ 1 - 0
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -115,6 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 .antMatchers("/wcs/**").anonymous()
                 .antMatchers("/api/wcstask/**").permitAll()
                 .antMatchers("/test/**").permitAll()
+                .antMatchers("/edi/wcs/**").permitAll()
                 // 库位视图
                 .antMatchers("/ams/locationView/**").permitAll()
                 // 除上面外的所有请求全部需要鉴权认证