自动化立体仓库 - WMS系统
1
zhangc
2025-01-21 5edbc95f689813cee37ee573af48e59175ddff92
src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -8,6 +8,7 @@
import com.zy.asrs.entity.param.*;
import com.zy.asrs.service.*;
import com.zy.asrs.utils.CodeDetectionUtil;
import com.zy.asrs.utils.OrderUtils;
import com.zy.common.model.DetlDto;
import com.zy.common.service.AgvCommonService;
import lombok.Synchronized;
@@ -179,6 +180,7 @@
            // 更新订单
            OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("order_no", pick.getOrderNo()).eq("matnr", pick.getMatnr()).eq("three_code", pick.getThreeCode()));
            orderDetl.setQty(orderDetl.getQty() + pick.getCount());
            orderDetl.setUpdateTime(new Date());
            if (!orderDetlService.update(orderDetl, new EntityWrapper<OrderDetl>().eq("order_no", pick.getOrderNo()).eq("matnr", pick.getMatnr()).eq("three_code", pick.getThreeCode()))) {
                throw new CoolException("修改订单明细失败,请联系管理员" + pick.getOrderNo() + pick.getMatnr());
            }
@@ -353,6 +355,10 @@
        AgvBasDevp agvBasDevp = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("dev_no", stationCode));
        if (agvBasDevp == null) {
            throw new CoolException(stationCode + "站点信息错误");
        }
        if (Cools.eq(agvBasDevp.getBarcode(), barcode)) {
            return;
        }
@@ -367,9 +373,7 @@
            throw new CoolException(barcode + "已经绑定在" + agvBasDevp.getDevNo() + "站点");
        }
        if (agvBasDevp == null) {
            throw new CoolException(stationCode + "站点信息错误");
        }
        if (!"O".equals(agvBasDevp.getLocSts())) {
            throw new CoolException(stationCode + "该站点货位状态非空");
        }
@@ -651,6 +655,9 @@
    @Transactional
    public String allocationIn(AgvMobileStartPakin param, Long userId) {
        Date now = new Date();
        if (Cools.isEmpty(param.getBarcode())) {
            throw new CoolException("请输入货架码");
        }
        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()));
        if (Cools.isEmpty(agvWrkMast)) {
            throw new CoolException("暂无当前货架码的任务");
@@ -699,6 +706,9 @@
            throw new CoolException("请输入货架码");
        }
        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
        if (agvWrkMast == null) {
            throw new CoolException("当前货架码没有任务");
        }
        Integer oldWrkNo = agvWrkMast.getWrkNo();
        if (Cools.isEmpty(agvWrkMast)) {
            throw new CoolException("工作档中没有此站点任务");
@@ -725,6 +735,9 @@
    @Synchronized
    public String empIn(AgvMobileStartPakin param, Long userId) {
        Date now = new Date();
        if (Cools.isEmpty(param.getBarcode())) {
            throw new CoolException("请输入货架码");
        }
        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()));
        if (Cools.isEmpty(agvWrkMast)) {
            throw new CoolException("工作档中没有此站点任务");
@@ -754,6 +767,9 @@
    public String handBack(AgvMobileStartPakin param, Long userId) {
        Date now = new Date();
        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
        if (agvWrkMast == null) {
            throw new CoolException("工作档中没有此站点任务");
        }
        agvWrkMast.setIoType(113);
        agvWrkMast.setModiUser(userId);
        agvWrkMast.setModiTime(now);
@@ -781,7 +797,17 @@
        agvWrkMastLogService.save(agvWrkMast);
        agvWrkDetlLogService.save(agvWrkMast.getWrkNo());
        String sourceLocNo = agvWrkMast.getSourceLocNo();
        AgvLocMast newLocMast = agvCommonService.getLocNo(3, 1, false, false);
        //AgvLocMast newLocMast = agvCommonService.getLocNo(3, 1, false, false);
        // TODO: 四期
        List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code", param.getBarcode()));
        String factory = null;
        if (!Cools.isEmpty(agvWrkDetls)) {
            factory = OrderUtils.getFactory(agvWrkDetls.get(0).getThreeCode());
        }
        AgvLocMast newLocMast = agvCommonService.getLocByLocRule(3, 1, factory);
        if (newLocMast == null) {
            throw new CoolException("无可用库位");
        }
        agvWrkMast.setSourceLocNo(agvWrkMast.getLocNo());
        agvWrkMast.setLocNo(newLocMast.getLocNo());
        agvWrkMast.setIoType(57);
@@ -801,7 +827,6 @@
        agvLocMastService.updateLocStsByLocNo(sourceLocNo, "O", "", (short) 30);
        agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no", sourceLocNo));
        List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code", param.getBarcode()));
        agvWrkDetls.forEach(agvWrkDetl -> {
            for (AgvWrkDetl wrkDetl : param.getWrkDetls()) {
                if (wrkDetl.getMatnr().equals(agvWrkDetl.getMatnr()) && wrkDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())) {