pang.jiabao
2024-10-24 c7338c0fc1513507c05c1a7fd00bff8c11ad5d1e
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -12,6 +12,7 @@
import com.zy.asrs.utils.RouteUtils;
import com.zy.asrs.utils.Utils;
import com.zy.asrs.utils.VersionUtils;
import com.zy.common.constant.GhjtApiConstant;
import com.zy.common.model.LocTypeDto;
import com.zy.common.model.MatDto;
import com.zy.common.model.SearchLocParam;
@@ -37,6 +38,8 @@
import com.zy.core.thread.LedThread;
import com.zy.core.thread.RgvThread;
import com.zy.core.thread.SiemensDevpThread;
import com.zy.system.entity.Config;
import com.zy.system.mapper.ConfigMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -44,6 +47,7 @@
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -99,6 +103,9 @@
    private BasRgvMapMapper basRgvMapMapper;
    @Autowired
    private RgvOneSignMapper rgvOneSignMapper;
    @Resource
    private ConfigMapper configMapper;
    @Value("${wms.url}")
    private String wmsUrl;
@@ -1591,8 +1598,10 @@
                continue;
            }
            log.info("{}号堆垛机选定的出库口是{}",crnProtocol.getCrnNo(),crnStn.getPlatNo());
            // 工作档状态判断
            if (wrkMast.getIoType() < 100 || wrkMast.getSourceStaNo() == null) {
            if ((wrkMast.getIoType() < 100 && wrkMast.getIoType()!=12) || wrkMast.getSourceStaNo() == null) {
                log.error("查询工作档数据不符合条件--入出类型/站点, 工作号={},源库位={},入出类型={}", wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), wrkMast.getIoType());
                continue;
            }
@@ -1725,9 +1734,6 @@
     */
    private boolean crnEnabled(WrkMast wrkMast) {
        String url = "http://192.168.14.249:8008";
        String path = "/api/Task/DockStatus";
        // 获取请求头
        Map<String,Object> headers = new HashMap<>();
        headers.put("digi-type","sync ");
@@ -1744,8 +1750,8 @@
        String response;
        try {
            response = new HttpHandler.Builder()
                    .setUri(url)
                    .setPath(path)
                    .setUri(GhjtApiConstant.GWCS_IP_PORT)
                    .setPath(GhjtApiConstant.GWCS_CKMT_URL)
                    .setHeaders(headers)
                    .setJson(body)
                    .build()
@@ -1758,8 +1764,8 @@
                    success = false;
                }
            } else {
                log.error("请求接口失败!!!url:{};request:{};response:{}", url + path, body, response);
                throw new CoolException("下发出库任务给GWCS(从出库码头到出库口)失败");
                log.error("确认出库码头是否可用失败!!!url:{};request:{};response:{}", GhjtApiConstant.GWCS_IP_PORT + GhjtApiConstant.GWCS_CKMT_URL, body, response);
                throw new CoolException("确认出库码头是否可用失败");
            }
        } catch (Exception e) {
            success = false;
@@ -2714,9 +2720,18 @@
        try {
            List<Integer> rows = locMastService.queryDistinctRow(crn.getId());
            LocMast loc = null;
            // 获取备货区配置
            Config config = configMapper.selectConfigByCode("auto_stock_up");
            if (config == null) {
                return;
            }
            // 备货取是前几列
            int bay1 = Integer.parseInt(config.getValue());
            for (Integer row : rows) {
                if (Utils.isDeepLoc(slaveProperties, row)) {
                    loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1());
                    loc = locMastService.queryFreeLocMastNotBay(row, shallowLoc.getLocType1(),bay1);
                    if (loc != null) {
                        if (Utils.isDeepLoc(slaveProperties, loc.getLocNo())) {
@@ -2735,7 +2750,7 @@
            if (null == loc) {
                for (Integer row : rows) {
                    if (Utils.isShallowLoc(slaveProperties, row)) {
                        loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1());
                        loc = locMastService.queryFreeLocMastNotBay(row, shallowLoc.getLocType1(),bay1);
                        if (null != loc) {//对应深库位非在库状态,不能移库
                            String deepLoc = Utils.getDeepLoc(slaveProperties, loc.getLocNo());
@@ -4684,4 +4699,11 @@
            }
        }
    }
    /**
     * 12.跨巷道移库
     */
    public synchronized void autoMoveLoc() {
    }
}