自动化立体仓库 - WMS系统
b06233aa71b70f7a30ff382ae1ba19c29b134d7c..071b6b6eb7add4aa6e067b87259697101bff4119
6 天以前 zhou zhou
#AGV
071b6b 对比 | 目录
6 天以前 zhou zhou
#调整盘点
3c5771 对比 | 目录
4个文件已添加
7个文件已修改
273 ■■■■■ 已修改文件
src/main/java/com/zy/asrs/controller/CheckOrderController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/MobileController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/result/ForwardAGVTaskDTO.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/result/HIKApiDTO.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/entity/result/HIKResultDTO.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/CheckOrderService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/MobileService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java 71 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/LocCacheServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/common/constant/HIKApiConstant.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/zy/asrs/controller/CheckOrderController.java
@@ -49,7 +49,7 @@
    @PostMapping(value = "/checkOrder/pdaComplete/auth")
    @ManagerAuth(memo = "pda:完成盘点")
    public R checkOrderPdaComplete(@RequestBody CheckTaskListParam checkTaskListParam) {
        checkOrderService.pdaComplete(checkTaskListParam);
        checkOrderService.pdaComplete(checkTaskListParam,getUserId());
        return R.ok();
    }
src/main/java/com/zy/asrs/controller/MobileController.java
@@ -60,6 +60,13 @@
    @Resource
    private StaDescService staDescService;
    @PostMapping("/agv/callEmptyCar")
    @ManagerAuth
    public R pdaAgvFinishedCall(@RequestBody AgvCallParams params){
        return mobileService.callEmptyCar(params);
    }
    @RequestMapping("/pda/WarehouseOut/v1")
    @ManagerAuth(memo = "并板途中拣料-参考念初")
    public R WarehouseOutV1(@RequestBody CombParam combParam) {
src/main/java/com/zy/asrs/entity/result/ForwardAGVTaskDTO.java
New file
@@ -0,0 +1,39 @@
package com.zy.asrs.entity.result;
import lombok.Data;
import java.util.List;
@Data
public class ForwardAGVTaskDTO {
    private String reqCode;
    private String reqTime;
    private String taskTyp;
    private String ctnrCode;
    private List<PositionCodePaths> positionCodePath;
    private String clientCode = "";
    private String tokenCode = "";
    private String ctnrTyp = "";
    private String ctnrNum = "";
    private String wbCode = "";
    private String podCode = "";
    private String podDir = "";
    private String podTyp = "";
    private String materialLot = "";
    private String priority = "";
    private String taskCode;
    private String agvCode = "";
    private String data = "";
    @Data
    public static class PositionCodePaths{
        private String positionCode;
        private String type;
        public PositionCodePaths(String positionCode, String type){
            this.positionCode = positionCode;
            this.type = type;
        }
    }
}
src/main/java/com/zy/asrs/entity/result/HIKApiDTO.java
New file
@@ -0,0 +1,38 @@
package com.zy.asrs.entity.result;
import lombok.Data;
import lombok.experimental.Accessors;
@Data
@Accessors(chain = true)
public class HIKApiDTO {
    /**
     * 源站
     */
    private String org;
    /**
     * 源站类型
     */
    private String orgType;
    /**
     * 目标站
     */
    private String tar;
    /**
     * 目标站类型
     */
    private String tarType;
    /**
     * 任务类型
     */
    private String taskType;
    /**
     * 容器类型
     */
    private String ctnrType;
    /**
     * 优先级
     */
    private String priority;
}
src/main/java/com/zy/asrs/entity/result/HIKResultDTO.java
New file
@@ -0,0 +1,9 @@
package com.zy.asrs.entity.result;
import lombok.Data;
@Data
public class HIKResultDTO {
    private boolean success = false;
    private String message;
}
src/main/java/com/zy/asrs/service/CheckOrderService.java
@@ -3,7 +3,6 @@
import com.zy.asrs.entity.CheckOrder;
import com.baomidou.mybatisplus.service.IService;
import com.zy.asrs.entity.CheckOrderDetl;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.param.CheckTaskListParam;
import com.zy.common.model.LocDto;
import com.core.common.R;
@@ -18,7 +17,7 @@
    List<CheckOrderDetl> getTaskList(String barcode);
    R pdaComplete(CheckTaskListParam checkTaskListParam);
    R pdaComplete(CheckTaskListParam checkTaskListParam, Long userId);
    void adjustOrderComplete(Long orderId, Long userId);
}
src/main/java/com/zy/asrs/service/MobileService.java
@@ -8,6 +8,7 @@
import com.zy.asrs.entity.param.*;
import java.util.Date;
import java.util.Map;
public interface MobileService {
@@ -99,4 +100,6 @@
     * @version 1.0
     */
    R OutCallAgv(AgvCallParams params, Long userId);
    R callEmptyCar(AgvCallParams params);
}
src/main/java/com/zy/asrs/service/impl/CheckOrderServiceImpl.java
@@ -1,7 +1,6 @@
package com.zy.asrs.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.core.common.Cools;
import com.core.common.R;
import com.core.exception.CoolException;
@@ -12,13 +11,13 @@
import com.zy.asrs.service.*;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.zy.common.model.LocDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
@@ -123,21 +122,68 @@
    @Override
    @Transactional(rollbackFor = Exception.class)
    public R pdaComplete(CheckTaskListParam checkTaskListParam) {
    public R pdaComplete(CheckTaskListParam checkTaskListParam, Long userId) {
        WrkMast wrkMast = wrkMastService.selectByBarcode(checkTaskListParam.getBarcode());
        if (Cools.isEmpty(wrkMast)) {
            throw new CoolException("未找到任务");
        }
        for (CheckOrderDetl checkOrderDetl: checkTaskListParam.getCheckOrderDetlList()){
            checkOrderDetl.setDiffQty(checkOrderDetl.getWorkQty().subtract(checkOrderDetl.getAnfme()));
            checkOrderDetl.setStatus(3);
            if (!checkOrderDetlService.updateById(checkOrderDetl)){
                throw new CoolException("更新盘点状态失败");
            }
        }
        CheckOrder checkOrder = this.selectOne(new EntityWrapper<CheckOrder>().eq("order_no", checkTaskListParam.getCheckOrderDetlList().get(0).getOrderNo()));
        for (CheckOrderDetl checkOrderDetl: checkTaskListParam.getCheckOrderDetlList()){
            if (Cools.isEmpty(checkOrderDetl.getId()) && !Cools.isEmpty(checkOrderDetl.getWorkQty())){
                LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("barcode", checkTaskListParam.getBarcode()));
                if (Cools.isEmpty(locMast)){
                    throw new CoolException("未找到库位数据");
                }
                LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>()
                        .eq("loc_no", locMast.getLocNo())
                        .eq("matnr", checkOrderDetl.getMatnr())
                        .eq(!Cools.isEmpty(checkOrderDetl.getBatch()),"batch", checkOrderDetl.getBatch())
                        .eq("supp_code", checkOrderDetl.getSuppCode())
                );
                if (!Cools.isEmpty(locDetl)){
                    throw new CoolException("当前库位有相同库存信息");
                }
                Date now = new Date();
                CheckOrderDetl checkOrderDetl1 = new CheckOrderDetl();
                checkOrderDetl1.sync(checkOrderDetl);
                checkOrderDetl1.setLocNo(locMast.getLocNo());
                checkOrderDetl1.setOrderId(checkOrder.getId());
                checkOrderDetl1.setOrderNo(checkOrder.getOrderNo());
                checkOrderDetl1.setAnfme(checkOrderDetl.getAnfme());
                checkOrderDetl1.setDiffQty(checkOrderDetl.getWorkQty().subtract(checkOrderDetl.getAnfme()));
                checkOrderDetl1.setWorkQty(checkOrderDetl.getWorkQty());
                checkOrderDetl1.setStatus(3);
                checkOrderDetl1.setZpallet(checkTaskListParam.getBarcode());
                checkOrderDetl1.setCreateBy(userId);
                checkOrderDetl1.setCreateTime(now);
                checkOrderDetl1.setUpdateBy(userId);
                checkOrderDetl1.setUpdateTime(now);
                checkOrderDetlService.insert(checkOrderDetl1);
                LocDetl locDetl1 = new LocDetl();
                locDetl1.sync(checkOrderDetl);
                BeanUtils.copyProperties(checkOrderDetl, locDetl1);
                locDetl1.setLocNo(locMast.getLocNo());
                locDetl1.setZpallet(checkTaskListParam.getBarcode());
                locDetl1.setAnfme(checkOrderDetl.getAnfme().doubleValue());
                locDetl1.setDiffQty(checkOrderDetl.getWorkQty().subtract(checkOrderDetl.getAnfme()));
                locDetl1.setAppeUser(userId);
                locDetl1.setAppeTime(now);
                locDetl1.setModiUser(userId);
                locDetl1.setModiTime(now);
                locDetlService.insert(locDetl1);
            }else if (!Cools.isEmpty(checkOrderDetl.getId())){
                checkOrderDetl.setDiffQty(checkOrderDetl.getWorkQty().subtract(checkOrderDetl.getAnfme()));
                checkOrderDetl.setStatus(3);
                if (!checkOrderDetlService.updateById(checkOrderDetl)){
                    throw new CoolException("更新盘点状态失败");
                }
            }else {
                throw new CoolException("数据错误");
            }
        }
        List<CheckOrderDetl> checkOrderDetls = checkOrderDetlService.selectList(new EntityWrapper<CheckOrderDetl>().eq("order_id", checkOrder.getId()));
        boolean is = checkOrderDetls.stream().allMatch(item -> item.getStatus().equals(3));
        if (is){
@@ -166,6 +212,9 @@
            if (Cools.isEmpty(locDetl)) {
                throw new CoolException("未找到库存数据,数据错误");
            }
            if (locDetl.getDiffQty().compareTo(BigDecimal.ZERO) == 0) {
                throw new CoolException("库存无盘点差异记录,数据错误");
            }
            if (checkOrderDetl.getStatus().equals(CheckStatusEnum.ALLOW.type)) {
                BigDecimal decimal = locDetl.getBookQty().add(checkOrderDetl.getDiffQty());
                locDetl.setAnfme(decimal.doubleValue());
src/main/java/com/zy/asrs/service/impl/LocCacheServiceImpl.java
@@ -50,7 +50,7 @@
                for (int b = param.getStartBay(); b <= param.getEndBay(); b++) {
                    for (int l = param.getStartLev(); l <= param.getEndLev(); l++) {
                        // 获取库位号
                        String locNo = String.format("CA") + String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l);
                        String locNo = areas.getAreaNo() + String.format("%02d", r) + String.format("%03d", b) + String.format("%02d", l);
                        Date now = new Date();
                        LocCache locMast = new LocCache();
                        locMast.setLocNo(locNo);
src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -8,13 +8,16 @@
import com.core.exception.CoolException;
import com.zy.asrs.entity.*;
import com.zy.asrs.entity.param.*;
import com.zy.asrs.enums.CommonEnum;
import com.zy.asrs.entity.result.ForwardAGVTaskDTO;
import com.zy.asrs.entity.result.HIKApiDTO;
import com.zy.asrs.entity.result.HIKResultDTO;
import com.zy.asrs.enums.LocStsType;
import com.zy.asrs.mapper.LocMastMapper;
import com.zy.asrs.mapper.ManLocDetlMapper;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.MatUtils;
import com.zy.asrs.utils.OrderInAndOutUtil;
import com.zy.common.constant.HIKApiConstant;
import com.zy.common.constant.MesConstant;
import com.zy.common.entity.Parameter;
import com.zy.common.model.DetlDto;
@@ -1272,6 +1275,31 @@
        return R.ok();
    }
    @Override
    public R callEmptyCar(AgvCallParams params) {
        List<LocCache> locSts = locCacheService.selectList(new EntityWrapper<LocCache>().eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type));
        if (locSts.isEmpty()){
            throw new CoolException("暂无空板库位");
        }
        HIKApiDTO hikApiDTO =new HIKApiDTO()
                .setOrg(locSts.get(0).getLocNo())
                .setOrgType("05")
                .setTar(params.getTarSite())
                .setTarType("05")
                .setTaskType("GT5")
                .setPriority("1")
                .setCtnrType("2")
                ;
        HIKResultDTO hikResultDTO = sendAgvTask(hikApiDTO, HIKApiConstant.AGV_CALL_IN_PATH);
        if (!hikResultDTO.isSuccess()){
            return R.error(hikResultDTO.getMessage());
        }
        return R.ok();
    }
    /**
     * @author Ryan
     * @date 2025/9/25
@@ -1429,4 +1457,58 @@
            throw new CoolException("移转失败,目标库位状态:" + loc.getLocSts$());
        }
    }
    public HIKResultDTO sendAgvTask(HIKApiDTO haiKangApiDTO,String path){
        HIKResultDTO result = new HIKResultDTO();
        ForwardAGVTaskDTO forwardAGVTaskParam = new ForwardAGVTaskDTO();
        forwardAGVTaskParam.setReqCode(UUID.randomUUID().toString().replace("-", ""));
        forwardAGVTaskParam.setClientCode("IWMS");
        forwardAGVTaskParam.setTaskTyp(haiKangApiDTO.getTaskType());
        forwardAGVTaskParam.setCtnrTyp(haiKangApiDTO.getCtnrType());
        forwardAGVTaskParam.setPriority(haiKangApiDTO.getPriority());
        List<ForwardAGVTaskDTO.PositionCodePaths> positionCodePathsList = new ArrayList<>();
        positionCodePathsList.add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getOrg(), haiKangApiDTO.getOrgType()));
        positionCodePathsList.add(new ForwardAGVTaskDTO.PositionCodePaths(haiKangApiDTO.getTar(), haiKangApiDTO.getTarType()));
        forwardAGVTaskParam.setPositionCodePath(positionCodePathsList);
        String body = JSON.toJSONString(forwardAGVTaskParam);
        String response = "";
        try {
            response = new HttpHandler.Builder()
                    .setUri(HIKApiConstant.AGV_IP)
                    .setPath(path)
                    .setJson(body)
                    .build()
                    .doPost();
            JSONObject jsonObject = JSON.parseObject(response);
            if (jsonObject.getInteger("code").equals(0)) {
                result.setSuccess(true);
            } else {
                result.setMessage(jsonObject.getString("message"));
                log.error("发送agv任务失败!!!url:{};request:{};response:{}", HIKApiConstant.AGV_IP + path, body, response);
            }
//            {"code":"1","data":"","interrupt":false,"message":"重复提交","msgErrCode":"0x3a80D012","reqCode":"fa92b49481a44627ae4d80c1400f28f6"}
        } catch (Exception e) {
            result.setMessage(e.getMessage());
            log.error("发送agv任务异常", e);
        } finally {
            try {
                // 保存接口日志
                apiLogService.save(
                        "发送agv任务",
                        HIKApiConstant.AGV_IP + path,
                        null,
                        "127.0.0.1",
                        body,
                        response,
                        result.isSuccess()
                );
            } catch (Exception e) {
                log.error("", e);
            }
        }
        return result;
    }
}
src/main/java/com/zy/common/constant/HIKApiConstant.java
New file
@@ -0,0 +1,15 @@
package com.zy.common.constant;
public class HIKApiConstant {
    // AGV IP地址
    public static final String AGV_IP = "10.0.100.110:8182";
    // 入库呼叫AGV取货
    public static final String AGV_CALL_IN_PATH = "/rcms/services/rest/hikRpcService/genAgvSchedulingTask";
    // AGV绑定仓位
    public static final String AGV_BIND_PATH = "/rcms/services/rest/hikRpcService/bindCtnrAndBin";
}