自动化立体仓库 - WMS系统
zhangchao
2024-11-21 f4214b3e0764ab116fc6975dbbc5bb4fc80f9fcd
rcs超时
10个文件已修改
129 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/OpenController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/param/OrderProdSyncParam.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java 90 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/AutoMoveTwoAndThreeGoOneHandler.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-loc.yml 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -156,6 +156,13 @@
            case "生产材料出库补料":
                mappingPakOutOrderParam(param, false, "银座生产材料出库补料");
                break;
            case "半成品入库单":
                mappingPakOutOrderParam(param, true, "半成品入库单");
                break;
            case "成品入库单":
                mappingPakOutOrderParam(param, true, "成品入库单");
                break;
            default:
                log.info("未知的单据类型:{}", param);
                mappingPakOutOrderParam(param, param.getPakin() == 1 ? true : false, param.get操作单据());
src/main/java/com/zy/asrs/entity/param/OrderProdSyncParam.java
@@ -129,7 +129,7 @@
        //物料编码
        //private String cInvCode;
        //数量
        // private Double iQuantity;
        //private Double iQuantity;
        //规格(自由项1)
        // private String bFree1;
        //单据行号
src/main/java/com/zy/asrs/service/impl/AgvWrkMastServiceImp.java
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Service
@Slf4j
@@ -65,17 +66,17 @@
    public void updateWrkStsByWrkNo(int wrkNo, long wrkSts) {
        AgvWrkMast agvWrkMast = this.selectById(wrkNo);
        //判断要修改的工作档状态是否合理,如果不合理则抛出异常
        checkWrkSts(agvWrkMast,wrkSts);
        checkWrkSts(agvWrkMast, wrkSts);
        agvWrkMast.setWrkSts(wrkSts);
        agvWrkMast.setModiTime(new Date());
        this.updateById(agvWrkMast);
    }
    public void updateWrkStsByWrkNo(int wrkNo, long wrkSts,String manuType,long userId) {
    public void updateWrkStsByWrkNo(int wrkNo, long wrkSts, String manuType, long userId) {
        Date now = new Date();
        AgvWrkMast agvWrkMast = this.selectById(wrkNo);
        //判断要修改的工作档状态是否合理,如果不合理则抛出异常
        checkWrkSts(agvWrkMast,wrkSts);
        checkWrkSts(agvWrkMast, wrkSts);
        agvWrkMast.setWrkSts(wrkSts);
        agvWrkMast.setManuType(manuType);
        agvWrkMast.setModiTime(now);
@@ -84,8 +85,7 @@
    }
    // TODO 判断规则
    private boolean checkWrkSts(AgvWrkMast agvWrkMast,long wrkSts){
    private boolean checkWrkSts(AgvWrkMast agvWrkMast, long wrkSts) {
        return true;
@@ -96,9 +96,9 @@
        AgvTaskCreateParam agvTaskCreateParam = new AgvTaskCreateParam();
        //agvTaskCreateParam.setTaskType(taskType);
        getRequestParam(agvTaskCreateParam,agvWrkMast);
        getRequestParam(agvTaskCreateParam, agvWrkMast);
        return doHttpRequest(agvTaskCreateParam,"搬运任务下发",url, taskCreatePath,null,"127.0.0.1");
        return doHttpRequest(agvTaskCreateParam, "搬运任务下发", url, taskCreatePath, null, "127.0.0.1");
        //return containerMoveParam;
    }
@@ -106,7 +106,7 @@
    public int startAllcationIn(AgvWrkMast agvWrkMast) throws IOException {
        AgvBasDevp basDevp = agvBasDevpService.selectByDevNo(agvWrkMast.getSourceLocNo());
        //检索库位,选择合适的库位
        AgvLocMast locMast = agvCommonService.getLocNo(basDevp.getLocType1(),basDevp.getFloor(),false,true);
        AgvLocMast locMast = agvCommonService.getLocNo(basDevp.getLocType1(), basDevp.getFloor(), false, true);
        agvWrkMast.setLocNo(locMast.getLocNo());
        agvWrkMast.setWrkSts(201L);
        agvWrkMast.setLogErrMemo("startAllcationIn");
@@ -122,30 +122,30 @@
    //货架入场
    public int containerMoveIn(List<AgvWrkMast> agvWrkMastList) throws IOException {
        //调用货架入场时所需要参数
        Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>();
        List<Map<String,String>> positionCodeMapList = new ArrayList<>();
        containerMoveParam.put("containerMoveIns",positionCodeMapList);
        Map<String, List<Map<String, String>>> containerMoveParam = new HashMap<>();
        List<Map<String, String>> positionCodeMapList = new ArrayList<>();
        containerMoveParam.put("containerMoveIns", positionCodeMapList);
        getContainerMoveParam(agvWrkMastList,positionCodeMapList);
        getContainerMoveParam(agvWrkMastList, positionCodeMapList);
        if(Cools.isEmpty(positionCodeMapList)){
        if (Cools.isEmpty(positionCodeMapList)) {
            return 0;
        }
        return doHttpRequest(containerMoveParam,"货架入场任务下发",url, containerMoveInPath,null,"127.0.0.1");
        return doHttpRequest(containerMoveParam, "货架入场任务下发", url, containerMoveInPath, null, "127.0.0.1");
    }
    //货架离场
    public int containerMoveOut(List<AgvWrkMast> agvWrkMastList){
        Map<String,List<Map<String,String>>> containerMoveParam = new HashMap<>();
        List<Map<String,String>> positionCodeMapList = new ArrayList<>();
        containerMoveParam.put("containerMoveOuts",positionCodeMapList);
        for(AgvWrkMast agvWrkMast : agvWrkMastList){
            Map<String,String> positionCodeMap = new HashMap<>();
            positionCodeMap.put("positionCode",agvWrkMast.getLocNo());
    public int containerMoveOut(List<AgvWrkMast> agvWrkMastList) {
        Map<String, List<Map<String, String>>> containerMoveParam = new HashMap<>();
        List<Map<String, String>> positionCodeMapList = new ArrayList<>();
        containerMoveParam.put("containerMoveOuts", positionCodeMapList);
        for (AgvWrkMast agvWrkMast : agvWrkMastList) {
            Map<String, String> positionCodeMap = new HashMap<>();
            positionCodeMap.put("positionCode", agvWrkMast.getLocNo());
            positionCodeMapList.add(positionCodeMap);
        }
        return doHttpRequest(containerMoveParam,"货架离场任务下发",url, containerMoveOutPath,null,"127.0.0.1");
        return doHttpRequest(containerMoveParam, "货架离场任务下发", url, containerMoveOutPath, null, "127.0.0.1");
    }
    public boolean insertByIncrease(AgvWrkMast agvWrkMast) {
@@ -162,25 +162,25 @@
    //货架到达通知
    public int containerArrived(AgvWrkMast agvWrkMast) {
        Map<String,String> containerArrivedParam = new HashMap<>();
        containerArrivedParam.put("slotCode",agvWrkMast.getSourceLocNo());
        containerArrivedParam.put("containerCode",agvWrkMast.getBarcode());
        Map<String, String> containerArrivedParam = new HashMap<>();
        containerArrivedParam.put("slotCode", agvWrkMast.getSourceLocNo());
        containerArrivedParam.put("containerCode", agvWrkMast.getBarcode());
        return doHttpRequest(containerArrivedParam,"货架达到通知",url, containerArrivedPath,null,"127.0.0.1");
        return doHttpRequest(containerArrivedParam, "货架达到通知", url, containerArrivedPath, null, "127.0.0.1");
    }
    @Override
    public List<AgvWrkMast> selectReadyAgvWrkMast() {
        List<String> stationCodes = agvBasDevpService.selectAllStationCode();
        Wrapper<AgvWrkMast> wrapper = new EntityWrapper<AgvWrkMast>().eq("wrk_sts", 21L).like(false, "loc_no", "@");
        wrapper.in("loc_no",stationCodes);
        wrapper.in("loc_no", stationCodes);
        return this.selectList(wrapper);
        //return this.baseMapper.selectReadyAgvWrkMast();
    }
    @Override
    public AgvWrkMast selectByContainerCode(String containerCode) {
        return this.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode",containerCode));
        return this.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", containerCode));
    }
    @Override
@@ -189,25 +189,25 @@
        AgvTaskCreateParam agvTaskCreateParam = new AgvTaskCreateParam();
        agvTaskCreateParam.setTaskCode(wrkNo + "");
        return doHttpRequest(agvTaskCreateParam,"取消任务下发",url, taskCancelPath,null,"127.0.0.1");
        return doHttpRequest(agvTaskCreateParam, "取消任务下发", url, taskCancelPath, null, "127.0.0.1");
    }
    private void getContainerMoveParam(List<AgvWrkMast> agvWrkMastList,List<Map<String,String>> positionCodeMapList){
    private void getContainerMoveParam(List<AgvWrkMast> agvWrkMastList, List<Map<String, String>> positionCodeMapList) {
        //往货架入场参数中放入源站点位置
        for(AgvWrkMast agvWrkMast : agvWrkMastList){
        for (AgvWrkMast agvWrkMast : agvWrkMastList) {
            //判断是否为输送线入库,是则不需要货架进场请求
            if("Y".equals(agvWrkMast.getMk())){
            if ("Y".equals(agvWrkMast.getMk())) {
                continue;
            }
            Map<String,String> positionCodeMap = new HashMap<>();
            positionCodeMap.put("positionCode",agvWrkMast.getSourceLocNo());
            Map<String, String> positionCodeMap = new HashMap<>();
            positionCodeMap.put("positionCode", agvWrkMast.getSourceLocNo());
            positionCodeMapList.add(positionCodeMap);
        }
    }
    private void getRequestParam(AgvTaskCreateParam agvTaskCreateParam,AgvWrkMast agvWrkMast){
    private void getRequestParam(AgvTaskCreateParam agvTaskCreateParam, AgvWrkMast agvWrkMast) {
        List<AgvTaskParam> agvTaskParamList = Arrays.asList(
                //起始位
@@ -220,7 +220,7 @@
//        //目标位
//        agvTaskParamList.add(new AgvTaskParam(agvWrkMast.getLocNo()));
        if(agvWrkMast.getIoType() == 53 || agvWrkMast.getIoType() == 57 ){
        if (agvWrkMast.getIoType() == 53 || agvWrkMast.getIoType() == 57) {
            agvWrkMast.setWrkNo(-agvWrkMast.getWrkNo());
        }
        agvTaskCreateParam.setTaskCode(agvWrkMast.getWrkNo().toString());
@@ -270,32 +270,40 @@
    }
    private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip){
    private int doHttpRequest(Object requestParam, String namespace, String url, String path, String appkey, String ip) {
        String response = "";
        boolean success = false;
        try {
            response = new HttpHandler.Builder()
                    .setUri(url)
                    .setPath(path)
                    .setTimeout(30, TimeUnit.SECONDS)
                    .setJson(JSONObject.toJSONString(requestParam))
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            int code = Integer.parseInt(jsonObject.get("code").toString());
            if(code != 0){
                //TODO 张超
            if (code != 0) {
                if (code == 6) {
                    log.info("AGV任务单号已上报:{}", response);
                    String message = jsonObject.getString("message");
                    if (!Cools.isEmpty(message) && message.contains("已存在任务单头为")) {
                        success = true;
                        return 0;
                    }
                }
                throw new CoolException("调用AGV响应错误");
                //return code;
            }
            success = true;
            return code;
        }catch (Exception e){
        } catch (Exception e) {
            log.error(e.getMessage());
            //TODO 张超
            throw new CoolException("调用AGV响应错误");
            //return 1;
        }finally {
        } finally {
            apiLogService.save(
                    namespace,
                    url + path,
src/main/java/com/zy/asrs/service/impl/OrderServiceImpl.java
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service("orderService")
@@ -290,6 +291,7 @@
            response = new HttpHandler.Builder()
                    .setUri(url)
                    .setPath(path)
                    .setTimeout(30, TimeUnit.SECONDS)
                    .setJson(JSONObject.toJSONString(requestParam))
                    .build()
                    .doPost();
src/main/java/com/zy/asrs/task/handler/AgvWrkMastHandler.java
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Slf4j
@@ -704,12 +705,12 @@
                reportMesPakinOrder(agvWrkMast, agvWrkDetls);
            }
        }
//        if (OUT_TYPE_List.contains(agvWrkMast.getIoType())) {
//            reportMesPakoutOrder(agvWrkMast, agvWrkDetls);
//        }
//        if (MOVE_TYPE_List.contains(agvWrkMast.getIoType())) {
//            generateMesParam(agvWrkMast, agvWrkDetls);
//        }
        if (OUT_TYPE_List.contains(agvWrkMast.getIoType())) {
            reportMesPakoutOrder(agvWrkMast, agvWrkDetls);
        }
        if (MOVE_TYPE_List.contains(agvWrkMast.getIoType())) {
            generateMesParam(agvWrkMast, agvWrkDetls);
        }
    }
    private void reportMesPakinOrder(AgvWrkMast agvWrkMast, List<AgvWrkDetl> agvWrkDetls) {
@@ -868,7 +869,7 @@
        boolean success = false;
        try {
            response = new HttpHandler.Builder().setUri(url).setPath(path).setHeaders(headParam).setJson(JSONObject.toJSONString(requestParam)).setHttps(true).build().doPost();
            response = new HttpHandler.Builder().setUri(url).setPath(path).setTimeout(30, TimeUnit.SECONDS).setHeaders(headParam).setJson(JSONObject.toJSONString(requestParam)).setHttps(true).build().doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (Cools.isEmpty(jsonObject.get("code")) || Integer.parseInt(jsonObject.get("code").toString()) != 200) {
src/main/java/com/zy/asrs/task/handler/AutoMoveTwoAndThreeGoOneHandler.java
@@ -21,6 +21,7 @@
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
@Slf4j
@Service
@@ -123,6 +124,7 @@
            response = new HttpHandler.Builder()
                    .setUri(url)
                    .setPath(path)
                    .setTimeout(30, TimeUnit.SECONDS)
                    .setJson(JSONObject.toJSONString(requestParam))
                    .build()
                    .doPost();
src/main/java/com/zy/asrs/task/handler/OrderSyncHandler.java
@@ -49,6 +49,9 @@
    @Value("${spring.profiles.active}")
    private String active;
    @Value("${u8.report}")
    private Boolean report;
    @Value("${u8.url}")
    private String url;
@@ -84,6 +87,9 @@
    @Transactional
    public void timelyStart(Order order) {
        if (!report){
            return;
        }
        List<String> docNames = new ArrayList<>(Arrays.asList("银座采购入库单", "银座委外材料出库单", "银座生产材料出库单"));
src/main/resources/application-dev.yml
@@ -85,6 +85,7 @@
  containerArrivedPath: /conveyor/containerArrived
u8:
  report: false
  url: http://192.168.9.3:8877
  orderReportPath: /DBMS/U8/CM/add
#ERP:
src/main/resources/application-loc.yml
@@ -85,13 +85,14 @@
  containerArrivedPath: /conveyor/containerArrived
u8:
  report: false
  url: http://192.168.9.3:8877
  orderReportPath: /DBMS/U8/CM/add
#ERP:
#  url: http://39.184.149.30:8877
#  orderReportPath: /DBMS/U8/CM/add
mes:
  report: false
  report: true
  url: https://v3-ali.blacklake.cn/api/openapi/domain/web/v1/route
  orderReportPath: /inventory/open/v2/transfer_order/ordinary/_execute
  pakinReportPath: /inventory/open/v2/inbound_order/execute/_inbound
src/main/resources/application-prod.yml
@@ -85,6 +85,7 @@
  containerArrivedPath: /conveyor/containerArrived
u8:
  report: true
  url: http://192.168.9.3:8877
  orderReportPath: /DBMS/U8/CM/add
#ERP: