From f8014b4fb370266a1b2bd73a0266bb66b79d358a Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 08 一月 2026 08:56:00 +0800
Subject: [PATCH] 站点生成入库任务

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java | 1952 +++++++++++++++++-----------------------------------------
 1 files changed, 575 insertions(+), 1,377 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index b07baec..de45437 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1,6 +1,5 @@
 package com.zy.asrs.service.impl;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -9,24 +8,15 @@
 import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.*;
 import com.zy.asrs.entity.result.*;
-import com.zy.asrs.enums.*;
-import com.zy.asrs.enums.LocAreaType;
 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;
 import com.zy.common.model.LocTypeDto;
-import com.zy.common.model.MesCombParam;
 import com.zy.common.model.StartupDto;
 import com.zy.common.model.enums.WorkNoType;
 import com.zy.common.service.CommonService;
-import com.zy.common.utils.HttpHandler;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -34,12 +24,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.math.BigDecimal;
-import java.math.RoundingMode;
 import java.util.*;
-import java.util.concurrent.atomic.AtomicReference;
-import java.util.stream.Collectors;
-
 /**
  * 绉诲姩绔湇鍔℃牳蹇冪被
  * Created by vincent on 2020/6/28
@@ -63,14 +48,6 @@
     @Autowired
     private WrkDetlService wrkDetlService;
     @Autowired
-    private PackService packService;
-    @Autowired
-    private OpenService openService;
-    @Autowired
-    private SnowflakeIdWorker snowflakeIdWorker;
-    @Autowired
-    private ApiLogService apiLogService;
-    @Autowired
     private BasCrnpService basCrnpService;
     @Autowired
     private LocMastService locMastService;
@@ -86,46 +63,26 @@
     private ManLocDetlService manLocDetlService;
     @Autowired
     private ManLocDetlMapper manLocDetlMapper;
-
-    @Autowired
-    private AdjDetlService adjDetlService;
-
     @Resource
     private LocMastMapper locMastMapper;
-
     @Resource
     private DocTypeService docTypeService;
-
     @Resource
     private OrderDetlPakinService orderDetlPakinService;
-
     @Resource
     private OrderPakinService orderPakinService;
-
     @Resource
     private OrderPakoutService orderPakoutService;
-
     @Resource
     private OrderDetlPakoutService orderDetlPakoutService;
-
     @Autowired
     private LocCacheService locCacheService;
-
     @Autowired
     private TaskService taskService;
-
     @Autowired
     private TaskDetlService taskDetlService;
     @Autowired
     private BasStationService basStationService;
-    @Autowired
-    private BasContainerService basContainerService;
-    @Autowired
-    private BasAreasService basAreasService;
-    @Autowired
-    private StationRelaService stationRelaService;
-    @Autowired
-    private BasStationDetlService basStationDetlService;
 
     @Override
     @Transactional
@@ -581,208 +538,208 @@
         return R.ok().add(maps);
     }
 
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void comb(CombParam param, Long userId) {
-        if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
-            throw new CoolException(BaseRes.PARAM);
-        }
-        if (param.getCombMats().size() < 1) {
-            throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒");
-        }
-        // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
-        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
-                .eq("io_status", "N")) > 0) {
-            throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
-        }
-
-        if (Objects.isNull(param.getBarcode())) {
-            throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
-        }
-
-        BasContainer container = basContainerService
-                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
-        if (Objects.isNull(container)) {
-            throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
-        }
-        // if (param.getBarcode().length() != 8) {
-        // throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode());
-        // }
-
-        if (Objects.isNull(param.getType())) {
-            param.setType("0");
-        }
-        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
-        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()));
-        int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>()
-                .eq(!Objects.isNull(param.getType()), "type", param.getType())
-                .eq("zpallet", param.getBarcode()));
-        if (countLoc > 0 || countWrk > 0 || countwait > 0) {
-            throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode());
-        }
-
-        Date now = new Date();
-        // 鏃犲崟缁勬墭
-        if (Cools.isEmpty(param.getOrderNo())) {
-            // 鐢熸垚鍏ュ簱閫氱煡妗�
-            List<DetlDto> detlDtos = new ArrayList<>();
-            param.getCombMats().forEach(elem -> {
-                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
-                        elem.getStandby2(), elem.getStandby3(),
-                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
-                        elem.getThreeCode());
-                if (DetlDto.has(detlDtos, detlDto)) {
-                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
-                    assert one != null;
-                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
-                } else {
-                    detlDtos.add(detlDto);
-                }
-            });
-
-            for (DetlDto detlDto : detlDtos) {
-                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
-                if (Cools.isEmpty(mat)) {
-                    throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
-                }
-                if (mat.getUpQty().compareTo(detlDto.getAnfme()) < 0) {
-                    throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟鏈�澶х粍鎵樹笂闄愪负锛�" + mat.getUpQty());
-                }
-                WaitPakin waitPakin = new WaitPakin();
-                BeanUtils.copyProperties(mat, waitPakin);
-                waitPakin.setBatch(detlDto.getBatch());
-                waitPakin.setZpallet(param.getBarcode());
-                waitPakin.setIoStatus("N");
-                waitPakin.setAnfme(detlDto.getAnfme());
-                waitPakin.setThreeCode(detlDto.getThreeCode());
-                waitPakin.setStatus("Y");
-                waitPakin.setSuppCode(detlDto.getStandby1());
-                waitPakin.setStandby1(detlDto.getStandby1());
-                waitPakin.setStandby2(detlDto.getStandby2());
-                waitPakin.setStandby3(detlDto.getStandby3());
-                waitPakin.setBoxType1(detlDto.getBoxType1());
-                waitPakin.setBoxType2(detlDto.getBoxType2());
-                waitPakin.setBoxType3(detlDto.getBoxType3());
-                waitPakin.setAppeUser(userId);
-                waitPakin.setAppeTime(now);
-                waitPakin.setModiUser(userId);
-                waitPakin.setModiTime(now);
-                if (!waitPakinService.insert(waitPakin)) {
-                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
-                }
-            }
-            // 鍏宠仈缁勬墭
-        } else {
-            // Order order = orderService.selectByNo(param.getOrderNo());
-            // 鐢熸垚鍏ュ簱閫氱煡妗�
-            List<DetlDto> detlDtos = new ArrayList<>();
-            param.getCombMats().forEach(elem -> {
-                Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, elem.getOrderNo());
-                if (Cools.isEmpty(order) || order.getSettle() > 2) {
-                    throw new CoolException("鍗曟嵁缂栧彿宸茶繃鏈�");
-                }
-                // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
-                // OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE,
-                // order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(),
-                // elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
-                // elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
-                OrderDetlPakin detls = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
-                        .eq("order_id", order.getId())
-                        .eq("matnr", elem.getMatnr()));
-
-                if (Objects.isNull(detls)) {
-                    throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗕笉瀛樺湪锛侊紒");
-                }
-
-                if (elem.getAnfme() > detls.getEnableQty()) {
-                    throw new CoolException(detls.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎瑙勫垯");
-                }
-                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),
-                        elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
-                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
-                DetlDto detlDto = new DetlDto(order.getOrderNo(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
-                        elem.getStandby2(), elem.getStandby3(),
-                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
-                        elem.getThreeCode());
-                detlDto.setOrderId(order.getId());
-                detlDto.setOrderNo(order.getOrderNo());
-                if (DetlDto.hasOrder(detlDtos, detlDto)) {
-                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
-                    assert one != null;
-                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
-                } else {
-                    detlDtos.add(detlDto);
-                }
-            });
-
-            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
-            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
-            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
-            if (tagIds.size() > 1) {
-                throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
-            }
-
-            // BasContainer container = basContainerService.selectOne(new
-            // EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
-            // if (Objects.isNull(container)) {
-            // throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
-            // }
-            // if (container.getMixMax() < detlDtos.size()) {
-            // throw new CoolException("瓒呭嚭瀹瑰櫒鏈�澶ф贩瑁呮暟閲忥紝褰撳墠瀹瑰櫒鏈�澶ф暟閲忎负锛�" + container.getMixMax() +
-            // "!!");
-            // }
-            // 杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
-            // Integer suplus = container.getMixMax();
-            for (DetlDto detlDto : detlDtos) {
-                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
-                if (Cools.isEmpty(mat)) {
-                    throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
-                }
-                // //鏈�澶氬彲鏀炬暟閲�
-                // Double singleMax = mat.getUpQty() * suplus;
-                // if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
-                // throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟缁勬墭涓婇檺涓猴細" +
-                // mat.getUpQty() + ",褰撳墠鎬婚噺瓒呭嚭鎵樼洏瑁呰浇涓婇檺!!");
-                // }
-                // BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
-                // //褰撳墠鐗╂枡闇�瑕佸崰鐢ㄦ枡绠辨牸鏁�
-                // Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
-                // suplus = suplus - curr;
-                // if (suplus < 0) {
-                // throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
-                // }
-
-                WaitPakin waitPakin = new WaitPakin();
-                BeanUtils.copyProperties(mat, waitPakin);
-                waitPakin.setOrderNo(detlDto.getOrderNo()); // 鍗曟嵁缂栧彿
-                waitPakin.setType(param.getType());
-                waitPakin.setOrderId(detlDto.getOrderId());
-                waitPakin.setBatch(detlDto.getBatch()); // 搴忓垪鐮�
-                waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮�
-                waitPakin.setThreeCode(detlDto.getThreeCode());
-                waitPakin.setSuppCode(detlDto.getStandby1());
-                waitPakin.setStandby1(detlDto.getStandby1());
-                waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
-                waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
-                waitPakin.setStatus("Y"); // 鐘舵��
-                waitPakin.setAppeUser(userId);
-                waitPakin.setAppeTime(now);
-                waitPakin.setModiUser(userId);
-                waitPakin.setModiTime(now);
-                if (!waitPakinService.insert(waitPakin)) {
-                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
-                }
-            }
-
-            Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo)
-                    .collect(Collectors.toSet());
-            stringSet.forEach(orderNo -> {
-                Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, orderNo);
-                OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId);
-            });
-        }
-
-    }
+//    @Override
+//    @Transactional(rollbackFor = Exception.class)
+//    public void comb(CombParam param, Long userId) {
+//        if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
+//            throw new CoolException(BaseRes.PARAM);
+//        }
+//        if (param.getCombMats().size() < 1) {
+//            throw new CoolException("璇锋彁鍙栦竴涓晢鍝侊紝鎴栬�呭埛鏂伴噸鏂扮粍鎵橈紒");
+//        }
+//        // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
+//        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
+//                .eq("io_status", "N")) > 0) {
+//            throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
+//        }
+//
+//        if (Objects.isNull(param.getBarcode())) {
+//            throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
+//        }
+//
+//        BasContainer container = basContainerService
+//                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
+//        if (Objects.isNull(container)) {
+//            throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
+//        }
+//        // if (param.getBarcode().length() != 8) {
+//        // throw new CoolException("鏉$爜闀垮害涓嶆槸8浣�===>>" + param.getBarcode());
+//        // }
+//
+//        if (Objects.isNull(param.getType())) {
+//            param.setType("0");
+//        }
+//        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
+//        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()));
+//        int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>()
+//                .eq(!Objects.isNull(param.getType()), "type", param.getType())
+//                .eq("zpallet", param.getBarcode()));
+//        if (countLoc > 0 || countWrk > 0 || countwait > 0) {
+//            throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode());
+//        }
+//
+//        Date now = new Date();
+//        // 鏃犲崟缁勬墭
+//        if (Cools.isEmpty(param.getOrderNo())) {
+//            // 鐢熸垚鍏ュ簱閫氱煡妗�
+//            List<DetlDto> detlDtos = new ArrayList<>();
+//            param.getCombMats().forEach(elem -> {
+//                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
+//                        elem.getStandby2(), elem.getStandby3(),
+//                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
+//                        elem.getThreeCode());
+//                if (DetlDto.has(detlDtos, detlDto)) {
+//                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
+//                    assert one != null;
+//                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
+//                } else {
+//                    detlDtos.add(detlDto);
+//                }
+//            });
+//
+//            for (DetlDto detlDto : detlDtos) {
+//                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
+//                if (Cools.isEmpty(mat)) {
+//                    throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
+//                }
+//                if (mat.getUpQty().compareTo(detlDto.getAnfme()) < 0) {
+//                    throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟鏈�澶х粍鎵樹笂闄愪负锛�" + mat.getUpQty());
+//                }
+//                WaitPakin waitPakin = new WaitPakin();
+//                BeanUtils.copyProperties(mat, waitPakin);
+//                waitPakin.setBatch(detlDto.getBatch());
+//                waitPakin.setZpallet(param.getBarcode());
+//                waitPakin.setIoStatus("N");
+//                waitPakin.setAnfme(detlDto.getAnfme());
+//                waitPakin.setThreeCode(detlDto.getThreeCode());
+//                waitPakin.setStatus("Y");
+//                waitPakin.setSuppCode(detlDto.getStandby1());
+//                waitPakin.setStandby1(detlDto.getStandby1());
+//                waitPakin.setStandby2(detlDto.getStandby2());
+//                waitPakin.setStandby3(detlDto.getStandby3());
+//                waitPakin.setBoxType1(detlDto.getBoxType1());
+//                waitPakin.setBoxType2(detlDto.getBoxType2());
+//                waitPakin.setBoxType3(detlDto.getBoxType3());
+//                waitPakin.setAppeUser(userId);
+//                waitPakin.setAppeTime(now);
+//                waitPakin.setModiUser(userId);
+//                waitPakin.setModiTime(now);
+//                if (!waitPakinService.insert(waitPakin)) {
+//                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
+//                }
+//            }
+//            // 鍏宠仈缁勬墭
+//        } else {
+//            // Order order = orderService.selectByNo(param.getOrderNo());
+//            // 鐢熸垚鍏ュ簱閫氱煡妗�
+//            List<DetlDto> detlDtos = new ArrayList<>();
+//            param.getCombMats().forEach(elem -> {
+//                Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, elem.getOrderNo());
+//                if (Cools.isEmpty(order) || order.getSettle() > 2) {
+//                    throw new CoolException("鍗曟嵁缂栧彿宸茶繃鏈�");
+//                }
+//                // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
+//                // OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE,
+//                // order.getId(), elem.getMatnr(), elem.getBatch(), elem.getBrand(),
+//                // elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
+//                // elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3());
+//                OrderDetlPakin detls = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
+//                        .eq("order_id", order.getId())
+//                        .eq("matnr", elem.getMatnr()));
+//
+//                if (Objects.isNull(detls)) {
+//                    throw new CoolException("鏁版嵁閿欒锛氬崟鎹槑缁嗕笉瀛樺湪锛侊紒");
+//                }
+//
+//                if (elem.getAnfme() > detls.getEnableQty()) {
+//                    throw new CoolException(detls.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎瑙勫垯");
+//                }
+//                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), elem.getMatnr(), elem.getBatch(),
+//                        elem.getBrand(), elem.getStandby1(), elem.getStandby2(), elem.getStandby3(),
+//                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme());
+//                DetlDto detlDto = new DetlDto(order.getOrderNo(), elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
+//                        elem.getStandby2(), elem.getStandby3(),
+//                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
+//                        elem.getThreeCode());
+//                detlDto.setOrderId(order.getId());
+//                detlDto.setOrderNo(order.getOrderNo());
+//                if (DetlDto.hasOrder(detlDtos, detlDto)) {
+//                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
+//                    assert one != null;
+//                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
+//                } else {
+//                    detlDtos.add(detlDto);
+//                }
+//            });
+//
+//            Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
+//            List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
+//            Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
+//            if (tagIds.size() > 1) {
+//                throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
+//            }
+//
+//            // BasContainer container = basContainerService.selectOne(new
+//            // EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
+//            // if (Objects.isNull(container)) {
+//            // throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
+//            // }
+//            // if (container.getMixMax() < detlDtos.size()) {
+//            // throw new CoolException("瓒呭嚭瀹瑰櫒鏈�澶ф贩瑁呮暟閲忥紝褰撳墠瀹瑰櫒鏈�澶ф暟閲忎负锛�" + container.getMixMax() +
+//            // "!!");
+//            // }
+//            // 杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
+//            // Integer suplus = container.getMixMax();
+//            for (DetlDto detlDto : detlDtos) {
+//                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
+//                if (Cools.isEmpty(mat)) {
+//                    throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
+//                }
+//                // //鏈�澶氬彲鏀炬暟閲�
+//                // Double singleMax = mat.getUpQty() * suplus;
+//                // if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
+//                // throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟缁勬墭涓婇檺涓猴細" +
+//                // mat.getUpQty() + ",褰撳墠鎬婚噺瓒呭嚭鎵樼洏瑁呰浇涓婇檺!!");
+//                // }
+//                // BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
+//                // //褰撳墠鐗╂枡闇�瑕佸崰鐢ㄦ枡绠辨牸鏁�
+//                // Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
+//                // suplus = suplus - curr;
+//                // if (suplus < 0) {
+//                // throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
+//                // }
+//
+//                WaitPakin waitPakin = new WaitPakin();
+//                BeanUtils.copyProperties(mat, waitPakin);
+//                waitPakin.setOrderNo(detlDto.getOrderNo()); // 鍗曟嵁缂栧彿
+//                waitPakin.setType(param.getType());
+//                waitPakin.setOrderId(detlDto.getOrderId());
+//                waitPakin.setBatch(detlDto.getBatch()); // 搴忓垪鐮�
+//                waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮�
+//                waitPakin.setThreeCode(detlDto.getThreeCode());
+//                waitPakin.setSuppCode(detlDto.getStandby1());
+//                waitPakin.setStandby1(detlDto.getStandby1());
+//                waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
+//                waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
+//                waitPakin.setStatus("Y"); // 鐘舵��
+//                waitPakin.setAppeUser(userId);
+//                waitPakin.setAppeTime(now);
+//                waitPakin.setModiUser(userId);
+//                waitPakin.setModiTime(now);
+//                if (!waitPakinService.insert(waitPakin)) {
+//                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
+//                }
+//            }
+//
+//            Set<String> stringSet = param.getCombMats().stream().map(CombParam.CombMat::getOrderNo)
+//                    .collect(Collectors.toSet());
+//            stringSet.forEach(orderNo -> {
+//                Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, orderNo);
+//                OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId);
+//            });
+//        }
+//
+//    }
 
     // 鍟嗗搧涓婃灦
     @Override
@@ -924,181 +881,6 @@
 
     }
 
-    @Override
-    @Transactional
-    public void packComb(CombParam param, Long userId) {
-        if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
-            throw new CoolException(BaseRes.PARAM);
-        }
-        // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
-        if (waitPakinService.selectCount(
-                new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()).eq("io_status", "N")) > 0) {
-            throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
-        }
-        Date now = new Date();
-
-        boolean packDown = Parameter.get().getPackDown().equals("true");
-
-        // 鏃犲崟缁勬墭
-        if (Cools.isEmpty(param.getOrderNo())) {
-
-            // 鐢熸垚鍏ュ簱閫氱煡妗�
-            List<DetlDto> detlDtos = new ArrayList<>();
-            param.getCombMats().forEach(elem -> {
-                // 鎵撳寘涓婄嚎鏁版嵁鏍¢獙
-                if (packDown) {
-                    Pack pack = packService.selectByBarcode(elem.getMatnr());
-                    if (pack == null) {
-                        throw new CoolException(elem.getMatnr() + "鏉$爜鍐椾綑锛岃妫�鏌ワ紒");
-                    }
-                    if (pack.getSettle() != 1) {
-                        throw new CoolException(elem.getMatnr() + "鏉$爜宸蹭笅绾匡紝璇锋鏌ワ紒");
-                    }
-                }
-                Mat analyse = MatUtils.analyseMat(elem.getMatnr());
-                // 鏉$爜銆佺墿鏂欎唬鐮併�佸簭鍒楀彿銆佹暟閲�
-                DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), analyse.getBrand(), elem.getStandby1(),
-                        elem.getStandby2(), elem.getStandby3(),
-                        elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(),
-                        elem.getThreeCode());
-
-                // DetlDto detlDto = new DetlDto(elem.getMatnr(), analyse.getMatnr(),
-                // analyse.getBarcode(), elem.getAnfme());
-                // DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(),
-                // elem.getAnfme());
-                if (DetlDto.has(detlDtos, detlDto)) {
-                    DetlDto one = DetlDto.findDto(detlDtos, detlDto);
-                    assert one != null;
-                    one.setAnfme(one.getAnfme() + detlDto.getAnfme());
-                } else {
-                    detlDtos.add(detlDto);
-                }
-            });
-
-            if (packDown) {
-                MesCombParam mesCombParam = new MesCombParam();
-                mesCombParam.setZpallet(param.getBarcode());
-                mesCombParam.setPakinTime(DateUtils.convert(now));
-                mesCombParam.setLgort("5008");
-                mesCombParam.setPlantCode("5000");
-                mesCombParam.setFromCode("5012-20");
-                mesCombParam.setStationCode("JJQ-PFZPDB-XX");
-                for (DetlDto detlDto : detlDtos) {
-                    mesCombParam.getList().add(new MesCombParam.Detl(detlDto.getOrderNo(), detlDto.getAnfme()));
-                }
-                String response = "";
-                boolean success = false;
-                try {
-                    response = new HttpHandler.Builder()
-                            .setUri(MesConstant.URL)
-                            .setPath(MesConstant.IN_DISPATCH_RESULT)
-                            .setJson(JSON.toJSONString(mesCombParam))
-                            .build()
-                            .doPost();
-                    JSONObject jsonObject = JSON.parseObject(response);
-                    if (jsonObject.getInteger("code").equals(200)) {
-                        success = true;
-                    } else if (jsonObject.getInteger("code").equals(500)) {
-                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
-                                JSON.toJSONString(mesCombParam), response);
-                        throw new CoolException(jsonObject.getString("msg"));
-                    } else {
-                        log.error("璇锋眰鎺ュ彛澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
-                                JSON.toJSONString(mesCombParam), response);
-                        throw new CoolException("涓婃姤mes绯荤粺澶辫触");
-                    }
-                } catch (Exception e) {
-                    log.error("fail", e);
-                    throw new CoolException(e.getMessage());
-                } finally {
-                    try {
-                        // 淇濆瓨鎺ュ彛鏃ュ織
-                        apiLogService.save(
-                                "鎵撳寘涓嬬嚎甯墭涓婃姤",
-                                MesConstant.URL + MesConstant.IN_DISPATCH_RESULT,
-                                null,
-                                "127.0.0.1",
-                                JSON.toJSONString(mesCombParam),
-                                response,
-                                success);
-                    } catch (Exception e) {
-                        log.error("", e);
-                    }
-                }
-            }
-
-            // 鐢熸垚鍏ュ簱鍗曟嵁
-            String orderNo = "PACK" + snowflakeIdWorker.nextId();
-            OpenOrderPakinParam openParam = new OpenOrderPakinParam();
-            openParam.setOrderNo(orderNo);
-            openParam.setOrderTime(DateUtils.convert(now));
-            openParam.setOrderType("鎵撳寘鍏ュ簱鍗�");
-            openParam.setOrderDetails(detlDtos);
-            openService.pakinOrderCreate(openParam);
-            // Order order = orderService.selectByNo(orderNo);
-            Order order = OrderInAndOutUtil.selectByNo(Boolean.TRUE, param.getOrderNo());
-
-            if (null == order) {
-                throw new CoolException("鐢熸垚鍗曟嵁澶辫触");
-            }
-            // if (!orderService.updateSettle(order.getId(), 2L, userId)) {
-            // throw new CoolException("淇敼鍗曟嵁鐘舵�佸け璐�");
-            // }
-            OrderInAndOutUtil.updateOrder(Boolean.TRUE, order.getId(), 2L, userId);
-
-            // 鐢熸垚鍏ュ簱閫氱煡妗�
-            for (DetlDto detlDto : detlDtos) {
-
-                // 淇敼浣滀笟鏁伴噺 ----------------------------------------
-                // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙
-                // OrderDetl orderDetl = orderDetlService.selectItem(order.getId(),
-                // detlDto.getMatnr(), detlDto.getBatch());
-                OrderDetl orderDetl = OrderInAndOutUtil.selectItem(Boolean.TRUE, order.getId(), detlDto.getMatnr(),
-                        detlDto.getBatch(), detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(),
-                        detlDto.getStandby3(), detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3());
-                if (detlDto.getAnfme() > orderDetl.getEnableQty()) {
-                    throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�");
-                }
-                // 淇敼璁㈠崟浣滀笟鏁伴噺
-                // if (!orderDetlService.increaseWorkQty(order.getId(), detlDto.getMatnr(),
-                // detlDto.getBatch(), detlDto.getAnfme())) {
-                // throw new CoolException("淇敼鍗曟嵁浣滀笟鏁伴噺澶辫触");
-                // }
-                OrderInAndOutUtil.increaseWorkQty(Boolean.TRUE, order.getId(), detlDto.getMatnr(), detlDto.getBatch(),
-                        detlDto.getBrand(), detlDto.getStandby1(), detlDto.getStandby2(), detlDto.getStandby3(),
-                        detlDto.getBoxType1(), detlDto.getBoxType2(), detlDto.getBoxType3(), detlDto.getAnfme());
-                // 淇濆瓨鍏ュ簱閫氱煡妗�
-                Mat mat = matService.selectByMatnr(detlDto.getMatnr());
-                if (Cools.isEmpty(mat)) {
-                    throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
-                }
-                WaitPakin waitPakin = new WaitPakin();
-                BeanUtils.copyProperties(mat, waitPakin);
-                waitPakin.setOrderNo(orderNo);
-                waitPakin.setBatch(detlDto.getBatch());
-                waitPakin.setZpallet(param.getBarcode()); // 鎵樼洏鐮�
-                waitPakin.setIoStatus("N"); // 鍏ュ嚭鐘舵��
-                waitPakin.setAnfme(detlDto.getAnfme()); // 鏁伴噺
-                waitPakin.setStatus("Y"); // 鐘舵��
-                waitPakin.setAppeUser(userId);
-                waitPakin.setAppeTime(now);
-                waitPakin.setModiUser(userId);
-                waitPakin.setModiTime(now);
-                if (!waitPakinService.insert(waitPakin)) {
-                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
-                }
-                // 淇敼鎵撳寘鏁版嵁鐘舵��
-                Pack pack = packService.selectByBarcode(detlDto.getOrderNo());
-                pack.setSettle(2L);
-                pack.setUpdateTime(now);
-                pack.setUpdateBy(userId);
-                if (!packService.updateById(pack)) {
-                    throw new CoolException("淇敼鎵撳寘鏁版嵁寮傚父");
-                }
-            }
-
-        }
-    }
 
     @Override
     @Transactional
@@ -1261,39 +1043,6 @@
                 .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type).orderAsc(Arrays.asList("row1"))));
     }
 
-    /**
-     * @author Ryan
-     * @date 2025/9/22
-     * @description: 鍛煎彨绌鸿溅
-     * @version 1.0
-     */
-    @Override
-    @Transactional
-    public synchronized R callAgvMove(AgvCallParams params, Long userId) {
-        if (Objects.isNull(params.getOrgSite())) {
-            throw new CoolException("婧愮珯鐐逛笉鑳戒负绌猴紒锛�");
-        }
-        BasAreas basAreas = basAreasService
-                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
-        LocCache locCache = locCacheService.selectOne(new EntityWrapper<LocCache>()
-                .eq("area_id", basAreas.getId())
-                .eq("frozen", 0)
-                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                // .eq("loc_no", params.getTarSite())
-                .orderAsc(Arrays.asList("loc_no"))
-                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
-        if (Objects.isNull(locCache)) {
-            throw new CoolException("璇锋鏌ョ洰鏍囧簱浣嶆槸鍚﹂棽缃腑锛侊紒");
-        }
-
-        try {
-            generateAgvTask("agv", locCache, params.getOrgSite(), params.getBarcode(), userId);
-        } catch (Exception e) {
-            throw new CoolException(e.getMessage());
-        }
-
-        return R.ok();
-    }
 
     /**
      * @author Ryan
@@ -1322,431 +1071,6 @@
         }
 
         return R.ok().add(detlPakins);
-    }
-
-    /**
-     * @author Ryan
-     * @date 2025/9/24
-     * @description: AGV鍛煎彨鎼繍
-     * @version 1.0
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public R OutCallAgv(AgvCallParams params, Long userId) {
-        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
-        if (Objects.isNull(basAreas)) {
-            throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
-        }
-        /**鑾峰彇鍏ュ簱鏈�鏃╃殑涓�鏉℃暟鎹�**/
-        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
-                .eq("loc_sts", LocStsType.LOC_STS_TYPE_F.type)
-                .eq("area_id", basAreas.getId())
-                .eq("frozen", 0)
-                .orderDesc(Arrays.asList("sort", "first_time")));
-
-        if (locCaches.isEmpty()) {
-            throw new CoolException("鏆傛棤婊¤冻闇�姹傚簱浣嶏紒");
-        }
-
-        for (LocCache locCache : locCaches) {
-            //鑾峰彇缂撳瓨鍖轰俊鎭�
-//            BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
-            List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
-                    .eq("area_id", basAreas.getId())
-                    .eq("loc_no", locCache.getLocNo()));
-            if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
-                throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
-            }
-
-            Set<String> set = locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
-            List<Mat> matList = matService.selectList(new EntityWrapper<Mat>().in("matnr", set));
-            if (Objects.isNull(matList) || matList.isEmpty()) {
-                throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
-            }
-            Set<Long> longs = matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
-            if (!longs.isEmpty() && longs.size() > 1) {
-                throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
-            }
-
-            Mat mat = matList.stream().findFirst().get();
-
-            BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
-                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                    .eq("ctn_type", mat.getTagId())
-                    .eq("dev_no", params.getTarSite()));
-            if (Objects.isNull(station)) {
-                continue;
-            }
-
-            /**鐢熸垚缂撳瓨鍖哄嚭搴撲换鍔�*/
-            generateCacheOutTask(station, locCache, userId);
-
-            /**鐢熸垚绔嬪簱鍑哄簱浠诲姟*/
-            generateCRNOutTask(station, locCache, userId);
-
-            return R.ok();
-        }
-        return R.error("鏈壘鍒颁笌绔欑偣绫诲瀷鍖归厤鐨勫簱瀛�");
-    }
-
-    @Override
-    public R callEmptyCar(AgvCallParams params, Long userId) {
-
-        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getOrgSite()));
-
-        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
-                .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
-                .eq("area_id", basAreas.getId()));
-        if (locCaches.isEmpty()) {
-            throw new CoolException("鏆傛棤绌烘澘搴撲綅");
-        }
-
-        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
-                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                .eq("dev_no", params.getTarSite()));
-        if (Objects.isNull(station)) {
-            throw new CoolException("绔欑偣姝e湪鎵ц浠诲姟锛侊紒");
-        }
-        generateCacheOutTask(station, locCaches.get(0), userId);
-
-        // HIKApiDTO hikApiDTO =new HIKApiDTO()
-        // .setOrg(locCaches.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();
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public R collectionInCall(AgvCallParams params, Long userId) {
-        if (Objects.isNull(params.getOrgSite())) {
-            throw new CoolException("婧愮珯鐐逛笉鑳戒负绌猴紒锛�");
-        }
-
-        BasAreas basAreas = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("name", params.getTarSite()));
-
-        List<LocCache> locCaches = locCacheService.selectList(new EntityWrapper<LocCache>()
-                .in("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                .eq("area_id", basAreas.getId()));
-        if (locCaches.isEmpty()) {
-            throw new CoolException("褰撳墠鏆傛棤绌哄簱浣嶏紒锛�");
-        }
-
-        BasStation station = basStationService
-                .selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getOrgSite()));
-        if (Objects.isNull(station)) {
-            throw new CoolException("婧愮珯鐐规湭妫�绱㈠埌鏁版嵁锛侊紒");
-        }
-
-        generateSOEOInTask("agv", locCaches.get(0), params.getOrgSite(), station.getBarcode(), userId);
-
-        return R.ok();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void generateSOEOInTask(String type, LocCache loc, String orgSite, String barcode, Long userId) {
-        List<BasStationDetl> basStationDetls = basStationDetlService
-                .selectList(new EntityWrapper<BasStationDetl>().eq("dev_no", orgSite));
-        if (Objects.isNull(basStationDetls) || basStationDetls.isEmpty()) {
-            throw new CoolException("绔欑偣淇℃伅涓嶅瓨鍦紒锛�");
-        }
-
-        List<Task> tasks = taskService.selectList(new EntityWrapper<Task>().eq("barcode", barcode));
-        if (!tasks.isEmpty()) {
-            throw new CoolException("鎵樼洏宸插湪浠诲姟鎵ц涓�..");
-        }
-        // 鑾峰彇宸ヤ綔鍙�
-        int workNo = commonService.getWorkNo(WorkNoType.PICK.type);
-        // 淇濆瓨宸ヤ綔妗�
-        Task task = new Task();
-        task.setWrkNo(workNo)
-                .setIoTime(new Date())
-                .setWrkSts(1L) // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
-                .setIoType(1) // 鍏ュ嚭搴撶姸鎬侊細 11.搴撴牸绉昏浇
-                .setTaskType("agv")
-                .setIoPri(10D)
-                .setLocNo(loc.getLocNo()) // 鐩爣搴撲綅
-                .setFullPlt("Y") // 婊℃澘锛歒
-                .setPicking("N") // 鎷f枡
-                .setExitMk("N")// 閫�鍑�
-                .setSourceStaNo(orgSite)
-                .setEmptyMk(loc.getLocSts().equals("D") ? "Y" : "N")// 绌烘澘
-                .setBarcode(barcode)// 鎵樼洏鐮�
-                .setLinkMis("N")
-                .setAppeUser(userId)
-                .setAppeTime(new Date())
-                .setModiUser(userId)
-                .setModiTime(new Date());
-        if (!taskService.insert(task)) {
-            throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
-        }
-
-        for (BasStationDetl basStationDetl : basStationDetls) {
-            TaskDetl wrkDetl = new TaskDetl();
-            BeanUtils.copyProperties(basStationDetl, wrkDetl);
-            wrkDetl.setWrkNo(workNo)
-                    .setIoTime(new Date())
-                    .setOrderNo(basStationDetl.getOrderNo())
-                    .setAnfme(basStationDetl.getAnfme())
-                    .setZpallet(basStationDetl.getBarcode())
-                    .setBatch(basStationDetl.getBatch())
-                    .setMatnr(basStationDetl.getMatnr())
-                    .setMaktx(basStationDetl.getMaktx())
-                    .setStandby1(basStationDetl.getStandby1())
-                    .setAppeUser(userId)
-                    .setUnit(basStationDetl.getUnit())
-                    .setModel(basStationDetl.getModel())
-                    .setAppeTime(new Date())
-                    .setModiUser(userId);
-
-            // 淇濆瓨宸ヤ綔妗f槑缁�
-            if (!taskDetlService.insert(wrkDetl)) {
-                throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
-            }
-        }
-
-        // 淇敼鐩爣搴撲綅鐘舵��
-        if (loc.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
-            loc.setLocSts(LocStsType.LOC_STS_TYPE_S.type); // S.鍏ュ簱棰勭害
-            loc.setModiTime(new Date());
-            loc.setModiUser(userId);
-            if (!locCacheService.updateById(loc)) {
-                throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
-            }
-        } else {
-            throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + loc.getLocSts$());
-        }
-
-        // 淇敼鐩爣绔欑偣淇℃伅
-        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", orgSite));
-        if (Objects.isNull(station)) {
-            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
-        }
-
-        if (station.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)) {
-            station.setLocSts("R"); // S.鍏ュ簱棰勭害
-            station.setBarcode(barcode);
-            station.setModiTime(new Date());
-            station.setModiUser(userId);
-            if (!basStationService.updateById(station)) {
-                throw new CoolException("鏇存柊鐩爣绔欑偣鐘舵�佸け璐�");
-            }
-        } else {
-            throw new CoolException("绉昏浆澶辫触锛岀洰鏍囧簱浣嶇姸鎬侊細" + station.getLocSts());
-        }
-    }
-
-    /**
-     * 缂撳瓨鍑哄簱缁勬墭涓婃灦
-     *
-     * @param params
-     * @return com.core.common.R
-     * @author Ryan
-     * @date 2025/12/8 13:47
-     */
-    @Override
-    public R combOutPub(AgvCallParams params) {
-
-        return R.ok();
-    }
-
-    /**
-     * 缂撳瓨缁勬墭鏁版嵁
-     *
-     * @param params
-     * @return com.core.common.R
-     * @author Ryan
-     * @date 2025/12/8 15:37
-     */
-    @Override
-    public R combCacehList(AgvCallParams params) {
-        if (Objects.isNull(params.getCarBarcode())) {
-            throw new CoolException("鍙拌溅鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
-        }
-        if (Objects.isNull(params.getBsCode())) {
-            throw new CoolException("BS鐮佷笉鑳戒负绌猴紒锛�");
-        }
-//        Task task = taskService.selectOne(new EntityWrapper<Task>()
-//                .eq("io_type", TaskIOType.PICK_OUT.type)
-//                .eq("wrk_sts", 14)
-//                .eq("barcode", params.getCarBarcode()));
-//        if (Objects.isNull(task)) {
-//            throw new CoolException("鏁版嵁閿欒锛氫换鍔′俊鎭瓨鍦紒锛�");
-//        }
-
-        List<BasStationDetl> taskDetl = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
-                .eq("three_code", params.getBsCode())
-                .eq("zpallet", params.getCarBarcode()));
-
-        if (Objects.isNull(taskDetl) || taskDetl.isEmpty()) {
-            throw new CoolException("褰撳墠BS缂栫爜涓嶅瓨鍦紒锛�");
-        }
-
-        return R.ok().add(taskDetl);
-    }
-
-    /**
-     * 缂撳瓨鍖轰笂鏋剁粍鎵�
-     *
-     * @param param
-     * @param userId
-     * @author Ryan
-     * @date 2025/12/9 13:45
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void cacheComb(CombParam param, Long userId) {
-        if (Objects.isNull(param.getBarcode())) {
-            throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
-        }
-
-        if (Objects.isNull(param.getCombMats()) || param.getCombMats().isEmpty()) {
-            throw new CoolException("缁勬墭鏄庣粏涓嶈兘涓虹┖锛侊紒");
-        }
-        // 鍒ゆ柇鏄惁鏈夌浉鍚屾潯鐮佺殑鏁版嵁
-        if (waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode())
-                .eq("io_status", "N")) > 0) {
-            throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
-        }
-
-        int countLoc = locDetlService.selectCount(new EntityWrapper<LocDetl>().eq("zpallet", param.getBarcode()));
-        int countWrk = wrkDetlService.selectCount(new EntityWrapper<WrkDetl>().eq("zpallet", param.getBarcode()));
-        if (countWrk > 0 || countLoc > 0) {
-            WrkMast wrkDetl = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", param.getBarcode()));
-            if (!wrkDetl.getIoType().equals(TaskIOType.MERGE_OUT.type)) {
-                throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode());
-            }
-        }
-        int countwait = waitPakinService.selectCount(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
-        if (countwait > 0) {
-            throw new CoolException("缁勬墭妗�/宸ヤ綔妗�/搴撳瓨鏉$爜鏁版嵁宸插瓨鍦�===>>" + param.getBarcode());
-        }
-
-        // 鐢熸垚鍏ュ簱閫氱煡妗�
-        List<DetlDto> detlDtos = new ArrayList<>();
-        param.getCombMats().forEach(elem -> {
-            DetlDto detlDto = new DetlDto(elem.getMatnr(), elem.getBatch(), elem.getBrand(), elem.getStandby1(),
-                    elem.getStandby2(), elem.getStandby3(),
-                    elem.getBoxType1(), elem.getBoxType2(), elem.getBoxType3(), elem.getAnfme(), elem.getThreeCode());
-            if (DetlDto.has(detlDtos, detlDto)) {
-                DetlDto one = DetlDto.findDto(detlDtos, detlDto);
-                assert one != null;
-                one.setAnfme(one.getAnfme() + detlDto.getAnfme());
-            } else {
-                detlDtos.add(detlDto);
-            }
-        });
-        BasContainer container = basContainerService
-                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", param.getBarcode()));
-        if (Objects.isNull(container)) {
-            throw new CoolException("鏁版嵁閿欒锛氬鍣ㄧ爜涓嶅瓨鍦紒锛�");
-        }
-        if (container.getMixMax() < detlDtos.size()) {
-            throw new CoolException("瓒呭嚭瀹瑰櫒鏈�澶ф贩瑁呮暟閲忥紝褰撳墠瀹瑰櫒鏈�澶ф暟閲忎负锛�" + container.getMixMax() + "!!");
-        }
-        Set<String> matnrs = detlDtos.stream().map(DetlDto::getMatnr).collect(Collectors.toSet());
-        List<Mat> mats = matService.selectList(new EntityWrapper<Mat>().in("matnr", matnrs));
-        Set<Long> tagIds = mats.stream().map(Mat::getTagId).collect(Collectors.toSet());
-        if (tagIds.size() > 1) {
-            throw new CoolException("缁勬墭鐗╂枡绫诲瀷涓嶄竴鑷达紝鍙湁鐩稿悓鐨勭墿鏂欏垎绫绘墠鍙互缁勬墭锛侊紒");
-        }
-        // 杩樺彲浠ユ斁鍏ュ灏戠鐗╂枡
-        Double suplus = container.getMixMax();
-        Date now = new Date();
-        for (DetlDto detlDto : detlDtos) {
-            Mat mat = matService.selectByMatnr(detlDto.getMatnr());
-            if (Cools.isEmpty(mat)) {
-                throw new CoolException(detlDto.getMatnr() + "鍟嗗搧妗f涓嶅瓨鍦�");
-            }
-            // 鏈�澶氬彲鏀炬暟閲�
-            Double singleMax = mat.getUpQty() * suplus;
-            if (singleMax.compareTo(detlDto.getAnfme()) < 0) {
-                throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + "鍗曟缁勬墭涓婇檺涓猴細" + mat.getUpQty() + ",褰撳墠鎬婚噺瓒呭嚭鎵樼洏瑁呰浇涓婇檺!!");
-            }
-            BigDecimal decimal = new BigDecimal(detlDto.getAnfme() / mat.getUpQty());
-            // 褰撳墠鐗╂枡闇�瑕佸崰鐢ㄦ枡绠辨牸鏁�
-            Integer curr = decimal.setScale(0, RoundingMode.CEILING).intValue();
-            suplus = suplus - curr;
-            if (suplus < 0) {
-                throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
-            }
-
-            BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
-                    .eq("zpallet", param.getCarBarcode())
-                    .eq("three_code", detlDto.getThreeCode()));
-            if (Objects.isNull(stationDetl)) {
-                throw new CoolException("鏄庣粏鍐呭涓嶅瓨鍦紒锛�");
-            }
-
-            Double v = Math.round((stationDetl.getAnfme() - stationDetl.getWorkQty()) * 10000) / 10000.0;
-            if (detlDto.getAnfme().compareTo(v) > 0) {
-                throw new CoolException("缁勬墭涓婇檺涓猴細" + stationDetl.getAnfme() + ", 宸茬粍鎵橈細" + stationDetl.getWorkQty() + ", 杩樺彲缁勬墭锛�" + v);
-            }
-
-            WaitPakin waitPakin = new WaitPakin();
-            BeanUtils.copyProperties(mat, waitPakin);
-            waitPakin.setBatch(detlDto.getBatch());
-            waitPakin.setType(param.getType());
-            waitPakin.setZpallet(param.getBarcode());
-            // 璁剧疆缁勬墭绫诲瀷
-            waitPakin.setType(param.getType());
-            waitPakin.setIoStatus("N");
-            waitPakin.setAnfme(detlDto.getAnfme());
-            waitPakin.setThreeCode(detlDto.getThreeCode());
-            waitPakin.setStatus("Y");
-            waitPakin.setSuppCode(detlDto.getStandby1());
-            waitPakin.setStandby1(detlDto.getStandby1());
-            waitPakin.setStandby2(detlDto.getStandby2());
-            waitPakin.setStandby3(detlDto.getStandby3());
-            waitPakin.setBoxType1(detlDto.getBoxType1());
-            waitPakin.setBoxType2(detlDto.getBoxType2());
-            waitPakin.setBoxType3(detlDto.getBoxType3());
-            waitPakin.setAppeUser(userId);
-            waitPakin.setAppeTime(now);
-            waitPakin.setModiUser(userId);
-            waitPakin.setModiTime(now);
-            if (!waitPakinService.insert(waitPakin)) {
-                throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
-            }
-
-            Double v1 = Math.round((stationDetl.getWorkQty() + detlDto.getAnfme()) * 10000) / 10000.0;
-            stationDetl.setWorkQty(v1);
-
-            if (!basStationDetlService.updateById(stationDetl)) {
-                throw new CoolException("绔欑偣鏄庣粏淇敼澶辫触");
-            }
-
-            if (v1.compareTo(stationDetl.getAnfme()) >= 0) {
-                if (!basStationDetlService.deleteById(stationDetl)) {
-                    throw new CoolException("鍘熷鏁版嵁绉婚櫎澶辫触锛�");
-                }
-            }
-
-            List<BasStationDetl> stas = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
-                    .eq("dev_no", stationDetl.getDevNo()));
-            if (Objects.isNull(stas) || stas.isEmpty()) {
-                BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", stationDetl.getDevNo()));
-                if (Objects.isNull(station)) {
-                    throw new CoolException("鏁版嵁閿欒锛岀珯鐐逛笉瀛樺湪锛侊紒");
-                }
-                station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
-                station.setBarcode("");
-                if (!basStationService.updateById(station)) {
-                    throw new CoolException("绔欑偣鐘舵�佹洿鏂板け璐ワ紒锛�");
-                }
-            }
-        }
     }
 
     /**
@@ -1779,18 +1103,18 @@
 //            throw new CoolException("鏁版嵁閿欒,浠诲姟鏄庣粏涓嶅瓨鍦�!!");
 //        }
 
-        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
-                .eq("dev_no", param.getStation()));
-        if (Objects.isNull(station)) {
-            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
-        }
-
-        station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
-        station.setBarcode("");
-        if (!basStationService.updateById(station)) {
-            throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐�!");
-        }
-        basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
+//        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>()
+//                .eq("dev_no", param.getStation()));
+//        if (Objects.isNull(station)) {
+//            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
+//        }
+//
+//        station.setLocSts(LocStsType.LOC_STS_TYPE_O.type);
+//        station.setBarcode("");
+//        if (!basStationService.updateById(station)) {
+//            throw new CoolException("绔欑偣鐘舵�佷慨鏀瑰け璐�!");
+//        }
+//        basStationDetlService.delete(new EntityWrapper<BasStationDetl>().eq("dev_no", station.getDevNo()));
 
 //        // 浠诲姟瀹屾垚
 //        task.setWrkSts(15L);
@@ -1805,132 +1129,7 @@
             throw new CoolException("鏁版嵁閿欒,缁勬嫋妗e凡涓嶅瓨鍦�!!");
         }
 
-        generateCrnInTask(waitPakins, station, param.getLocType1(), userId);
-    }
-
-    /**
-     * SO/EO 鍖虹粍鎵�
-     * @author Ryan
-     * @date 2025/12/18 15:19
-     * @param params
-     * @return com.core.common.R
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public R collectionPakin(CollectionPakinParams params, Long userId) {
-        List<BasStation> basStations = basStationService
-                .selectList(new EntityWrapper<BasStation>().eq("barcode", params.getTarBarcode()));
-        if (basStations.isEmpty() && Cools.isEmpty(params.getDevNo())) {
-            throw new CoolException("璇疯緭鍏ョ珯鐐瑰彿");
-        }
-        BasStation basStation = null;
-        if (!basStations.isEmpty()) {
-            basStation = basStations.get(0);
-        } else {
-            basStation = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", params.getDevNo()));
-        }
-        if (Cools.isEmpty(basStation)) {
-            throw new CoolException("璇疯緭鍏ユ纭殑绔欑偣鍙�");
-        }
-        for (CollectionPakinParams.CombMat combMat : params.getCombMats()) {
-            if (combMat.getWorkQty().compareTo(BigDecimal.ZERO) == 0) {
-                continue;
-            }
-
-            OrderPakin orderPakin = orderPakinService.selectByNo(combMat.getOrderNo());
-            if (Cools.isEmpty(orderPakin)) {
-                throw new CoolException("鏈壘鍒板璐у叆搴撳崟");
-            }
-
-            UpdateDetailsOfPakin(orderPakin, combMat);
-
-            BasStationDetl basStationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
-                    .eq("dev_no", basStation.getDevNo())
-                    .eq("matnr", combMat.getMatnr())
-                    .eq("batch", combMat.getBatch())
-                    .eq("standby1", combMat.getStandby1()));
-            if (Cools.isEmpty(basStationDetl)) {
-                basStationDetl = new BasStationDetl();
-                Mat mat = matService.selectByMatnr(combMat.getMatnr());
-                BeanUtils.copyProperties(mat, basStationDetl);
-                basStationDetl
-                        .setId(null)
-                        .setOrderNo(orderPakin.getOrderNo())
-                        .setDevNo(basStation.getDevNo())
-                        .setBarcode(params.getTarBarcode())
-                        .setZpallet(params.getTarBarcode())
-                        .setBatch(combMat.getBatch())
-                        .setSuppCode(combMat.getStandby1())
-                        .setStandby1(combMat.getStandby1())
-                        .setAnfme(combMat.getWorkQty().doubleValue());
-                if (!basStationDetlService.insert(basStationDetl)) {
-                    throw new CoolException("鎻掑叆鏄庣粏澶辫触");
-                }
-
-            } else {
-                BigDecimal anfme = new BigDecimal(basStationDetl.getAnfme().toString()).add(combMat.getWorkQty());
-                basStationDetl.setAnfme(anfme.doubleValue());
-                if (!basStationDetlService.updateById(basStationDetl)) {
-                    throw new CoolException("鏇存柊鏄庣粏鏁版嵁澶辫触");
-                }
-            }
-        }
-        if (basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)
-                || basStation.getLocSts().equals(LocStsType.LOC_STS_TYPE_O.type)) {
-            basStation.setBarcode(params.getTarBarcode());
-            basStation.setLocSts(LocStsType.LOC_STS_TYPE_F.type);
-            basStationService.updateById(basStation);
-        }
-
-        return R.ok();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void UpdateDetailsOfPakin(OrderPakin orderPakin, CollectionPakinParams.CombMat combMat) {
-        OrderDetlPakin orderDetlPakin = orderDetlPakinService.selectOne(new EntityWrapper<OrderDetlPakin>()
-                .eq("order_id", orderPakin.getId())
-                .eq("matnr", combMat.getMatnr())
-                .eq("batch", combMat.getBatch())
-                .eq("standby1", combMat.getStandby1()));
-        if (Cools.isEmpty(orderDetlPakin)) {
-            throw new CoolException("妫�绱㈠崟鎹槑缁嗘暟鎹け璐�");
-        }
-        if (orderDetlPakin.getWorkQty() >= orderDetlPakin.getAnfme()) {
-            throw new CoolException("璇峰嬁瓒呭嚭璁㈠崟鏄庣粏鏁伴噺");
-        }
-        BigDecimal workQty = new BigDecimal(orderDetlPakin.getWorkQty().toString()).add(combMat.getWorkQty());
-        orderDetlPakin.setWorkQty(workQty.doubleValue());
-        if (!orderDetlPakinService.updateById(orderDetlPakin)) {
-            throw new CoolException("鏇存柊鍗曟嵁鏄庣粏鏁版嵁澶辫触");
-        }
-        if (!orderPakin.getSettle().equals(2L)) {
-            orderPakin.setSettle(2L);
-            if (!orderPakinService.updateById(orderPakin)) {
-                throw new CoolException("鏇存柊鍗曟嵁鐘舵�佸け璐�");
-            }
-        }
-
-    }
-
-    @Override
-    public R collectionPakinView(CollectionPakinParams params) {
-
-        WrkMast wrkMast = wrkMastService.selectByBarcode(params.getOrgBarcode());
-        if (Cools.isEmpty(wrkMast)) {
-            throw new CoolException("鏈壘鍒颁换鍔�");
-        }
-
-        if (wrkMast.getIoType().equals(TaskIOType.ALL_OUT.type)
-                && wrkMast.getIoType().equals(TaskIOType.PICK_OUT.type)) {
-            throw new CoolException("浜虹墿绫诲瀷閿欒");
-        }
-
-        List<WrkDetl> wrkDetls = wrkDetlService.selectByWrkNo(wrkMast.getWrkNo());
-        if (Cools.isEmpty(wrkDetls)) {
-            throw new CoolException("鏈壘鍒颁换鍔℃槑缁�");
-        }
-
-        return R.ok(wrkDetls);
+        generateCrnInTask(waitPakins, param.getStation(), param.getLocType1(), userId);
     }
 
     /**
@@ -1941,18 +1140,17 @@
      * @date 2025/12/9 13:54
      */
     @Transactional(rollbackFor = Exception.class)
-    public void generateCrnInTask(List<WaitPakin> waitPakins, BasStation station, Short locType, Long userId) {
+    public void generateCrnInTask(List<WaitPakin> waitPakins, String station, Short locType, Long userId) {
         Date now = new Date();
-        StationRela rela = stationRelaService.selectOne(new EntityWrapper<StationRela>()
-                .eq("agv_sta", station.getDevNo())
-                .orderAsc(Arrays.asList("crn_sta"))
-                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
-
-        if (Objects.isNull(rela)) {
-            throw new CoolException("鏈粦瀹氫綔涓氱珯鐐�!!");
-        }
-
-        BasDevp sourceStaNo = basDevpService.checkSiteStatus(Integer.parseInt(rela.getCrnSta()), true);
+//        StationRela rela = stationRelaService.selectOne(new EntityWrapper<StationRela>()
+//                .eq("agv_sta", station.getDevNo())
+//                .orderAsc(Arrays.asList("crn_sta"))
+//                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+//
+//        if (Objects.isNull(rela)) {
+//            throw new CoolException("鏈粦瀹氫綔涓氱珯鐐�!!");
+//        }
+        BasDevp sourceStaNo = basDevpService.checkSiteStatus(Integer.parseInt(station), true);
         sourceStaNo.setLocType1(locType);
         LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
         WaitPakin pakin = waitPakins.stream().findFirst().get();
@@ -1961,7 +1159,7 @@
         WrkMast mast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", pakin.getZpallet()));
         WrkMast wrkMast = new WrkMast();
         if (!Objects.isNull(mast)) {
-            if (mast.getIoType().equals(TaskIOType.MERGE_OUT.type) || mast.getIoType().equals(TaskIOType.PICK_OUT.type) || mast.getIoType().equals(TaskIOType.CHECK_OUT.type)) {
+            if (mast.getIoType().equals(110) || mast.getIoType().equals(103) || mast.getIoType().equals(107)) {
                 int ioType = mast.getIoType() - 50;
                 mast.setIoType(ioType);
                 mast.setWrkSts(2L);
@@ -2068,233 +1266,233 @@
 //        }
     }
 
-    /**
-     * 鐢熸垚绔嬪簱鍑哄簱浠诲姟
-     * 鍙拌溅杩囨潵榛樿鏄悓涓�绉嶇墿鏂欑被鍨�
-     *
-     * @param locCaches
-     * @author Ryan
-     * @date 2025/12/3 8:06
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void generateCRNOutTask(BasStation station, LocCache locCaches, Long userId) {
-        if (Objects.isNull(locCaches)) {
-            throw new CoolException("搴撲綅涓嶈兘涓虹┖锛侊紒");
-        }
-        // 鑾峰彇缂撳瓨鍖轰俊鎭�
-        BasAreas basAreas = basAreasService
-                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
-        if (Objects.isNull(basAreas)) {
-            throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
-        }
-        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
-                .eq("area_id", basAreas.getId())
-                .eq("loc_no", locCaches.getLocNo()));
-        if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
-            throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
-        }
+//    /**
+//     * 鐢熸垚绔嬪簱鍑哄簱浠诲姟
+//     * 鍙拌溅杩囨潵榛樿鏄悓涓�绉嶇墿鏂欑被鍨�
+//     *
+//     * @param locCaches
+//     * @author Ryan
+//     * @date 2025/12/3 8:06
+//     */
+//    @Override
+//    @Transactional(rollbackFor = Exception.class)
+//    public void generateCRNOutTask(BasStation station, LocCache locCaches, Long userId) {
+//        if (Objects.isNull(locCaches)) {
+//            throw new CoolException("搴撲綅涓嶈兘涓虹┖锛侊紒");
+//        }
+//        // 鑾峰彇缂撳瓨鍖轰俊鎭�
+//        BasAreas basAreas = basAreasService
+//                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_IN_CACHE.type));
+//        if (Objects.isNull(basAreas)) {
+//            throw new CoolException("搴撳尯涓嶅瓨鍦紒锛�");
+//        }
+//        List<LocDetl> locDetls = locDetlService.selectList(new EntityWrapper<LocDetl>()
+//                .eq("area_id", basAreas.getId())
+//                .eq("loc_no", locCaches.getLocNo()));
+//        if (Objects.isNull(locDetls) || locDetls.isEmpty()) {
+//            throw new CoolException("搴撳瓨鏄庣粏涓嶅瓨鍦紒锛�");
+//        }
+//
+//        // Set<String> set =
+//        // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
+//        // List<Mat> matList = matService.selectList(new
+//        // EntityWrapper<Mat>().in("matnr", set));
+//        //
+//        // if (Objects.isNull(matList) || matList.isEmpty()) {
+//        // throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
+//        // }
+//        // Set<Long> longs =
+//        // matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
+//        // if (!longs.isEmpty() && longs.size() > 1) {
+//        // throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
+//        // }
+//
+//        // 鑾峰彇绔嬪簱鍖轰俊鎭�
+//        BasAreas one = basAreasService
+//                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
+//        if (Objects.isNull(one)) {
+//            throw new CoolException("鏁版嵁閿欒锛氬簱鍖轰笉瀛樺湪锛侊紒");
+//        }
+//
+//        List<StationRela> relas = stationRelaService
+//                .selectList(new EntityWrapper<StationRela>().eq("agv_sta", station.getDevNo()));
+//        if (Objects.isNull(relas) || relas.isEmpty()) {
+//            throw new CoolException("绔欑偣鏈叧鑱斿爢鍨涙満浣滀笟绔欑偣锛侊紒");
+//        }
+//
+//        Set<String> crnStas = relas.stream().map(StationRela::getCrnSta).collect(Collectors.toSet());
+//
+//        List<BasDevp> devps = basDevpService.selectList(
+//                new EntityWrapper<BasDevp>().in("dev_no", crnStas).eq("loading", CommonStation.COMMON_STATION_Y.type));
+//        if (Objects.isNull(devps) || devps.isEmpty()) {
+//            throw new CoolException("鏃犵珯鐐瑰彲鐢紒");
+//        }
+//        Collections.shuffle(devps);
+//        BasDevp basDevp = devps.stream().findFirst().get();
+//        List<CrnTaskDetlDTO> locMasts = new ArrayList<>();
+//        Map<String, List<LocDetl>> listMap = locDetls.stream().collect(Collectors.groupingBy(LocDetl::getMatnr));
+//        //鑾峰彇鏌ュ簱瀛樻�绘暟閲�
+//        AtomicReference<Double> totalOut = new AtomicReference<>(0.0);
+//        listMap.forEach((matnr, detls) -> {
+//            Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
+//            supIds.forEach((supId, sups) -> {
+//                // 鏍规嵁supId(渚涘簲鍟�)鍒嗙被锛屽緱鍒伴渶瑕佸瓨鏀剧殑鎬荤┖搴撳瓨鏁伴噺
+//                Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
+//                AtomicReference<Double> itemed = new AtomicReference<>(0.0);
+//                // 鑾峰彇褰撳墠渚涘簲鍟�+ 鐗╂枡鍦ㄥ簱
+//                List<LocDetl> detlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
+//                        .eq("matnr", matnr)
+//                        .eq("area_id", one.getId())
+//                        .eq("standby1", supId).orderAsc(Arrays.asList("appe_time")));
+//                // TODO 鍒ゆ柇鏄惁鏈夋柊搴撲綅锛屾病鏈夋柊搴撲綅锛屽啀鎵炬湁绌烘牸鐨勪綅缃斁 1. 鍒ゆ柇褰撳墠鐗╂枡鏄惁鏈夊簱瀛� 2. 娌℃湁浣欐枡鏌ヨ鏂板簱浣�
+//                if (!Objects.isNull(detlList) && !detlList.isEmpty()) {
+//                    Map<String, List<LocDetl>> locMaps = detlList.stream()
+//                            .collect(Collectors.groupingBy(LocDetl::getLocNo));
+//                    locMaps.forEach((locNo, adetls) -> {
+//                        LocMast locMast = locMastService.selectById(locNo);
+//                        if (Objects.isNull(locMast)) {
+//                            throw new CoolException("鏁版嵁閿欒锛屽簱浣嶄俊鎭笉瀛樺湪锛侊紒");
+//                        }
+//                        BasContainer container = basContainerService
+//                                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", locMast.getBarcode()));
+//                        if (Objects.isNull(container)) {
+//                            throw new CoolException("鏁版嵁閿欒锛屽鍣ㄤ笉瀛樺湪锛侊紒");
+//                        }
+//                        Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
+//                        // 鍒ゆ柇瀹瑰櫒鏄惁杩樺彲娣锋斁,鍙婂綋鍓嶇墿鏂欏彲鏀惧灏�
+//                        if (container.getMixMax() > sets.size()) {
+//                            //浣欎笅鍙贩鏀剧绫�
+//                            long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
+//                            Mat mats = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
+//                            if (Objects.isNull(mats)) {
+//                                throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
+//                            }
+//                            //浣欎笅鏈�澶у彲鏀炬暟閲�
+//                            Double v = Math.round((mats.getUpQty() * suplus) * 10000) / 10000.0;
+//                            // 鍏ュ簱鏁伴噺灏忎簬闆朵笖鍏ュ簱鏁伴噺鍑忓幓宸茶鍒掑嚭鏁伴噺澶т簬闆讹紙锛�
+//                            if (sum.compareTo(v) <= 0 && sum.compareTo(itemed.get()) > 0) {
+//                                itemed.set(Math.round((itemed.get() + v) * 10000) / 10000.0);
+//                                // 鍙斁涓�
+//                                CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(adetls);
+//                                locMasts.add(crnTaskDetlDTO);
+//                                totalOut.set(Math.round((totalOut.get() + itemed.get()) * 10000) / 10000.0);
+//                            }
+//                        }
+//                    });
+//                }
+//            });
+//        });
+//
+//        // 鍒ゆ柇鏍规嵁鍒嗘嫞鍑哄簱鍚�,杩橀渶瑕佸嚭澶氬皯鎵樼洏鎴栨枡绠�;濡傛灉浣欐枡澶т簬0, 鍑烘柊鎵樼洏鎴栨枡绠�
+//        if (totalOut.get().compareTo(0.0) > 0) {
+//            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
+//            //TODO 缁嗗寲鍖哄垎锛屽綋鍓嶅嚭搴撴墭鐩樻槸婊¤冻鎷h揣鏁伴噺
+//        } else {
+//            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
+//                    // todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
+//                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
+//                    .orderAsc(Arrays.asList("row1", "bay1", "lev1"))
+//                    .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+//
+//            if (Objects.isNull(locMast)) {
+//                throw new CoolException("鏈煡璇㈠埌鍙敤鐨勭┖鏉夸俊鎭紒锛�");
+//            }
+//
+//            CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls);
+//            locMasts.add(crnTaskDetlDTO);
+//
+//            // 绌烘澘鍑哄簱
+//            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
+//        }
+//    }
 
-        // Set<String> set =
-        // locDetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
-        // List<Mat> matList = matService.selectList(new
-        // EntityWrapper<Mat>().in("matnr", set));
-        //
-        // if (Objects.isNull(matList) || matList.isEmpty()) {
-        // throw new CoolException("鐗╂枡搴撲笉瀛樺湪璇ョ墿鏂�!!");
-        // }
-        // Set<Long> longs =
-        // matList.stream().map(Mat::getTagId).collect(Collectors.toSet());
-        // if (!longs.isEmpty() && longs.size() > 1) {
-        // throw new CoolException("鐗╂枡绫诲瀷涓嶄竴鑷�,璇锋鏌ユ暟鎹槸鍚︽纭�!!");
-        // }
-
-        // 鑾峰彇绔嬪簱鍖轰俊鎭�
-        BasAreas one = basAreasService
-                .selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", LocAreaType.LOC_AREA_TYPE_CRN.type));
-        if (Objects.isNull(one)) {
-            throw new CoolException("鏁版嵁閿欒锛氬簱鍖轰笉瀛樺湪锛侊紒");
-        }
-
-        List<StationRela> relas = stationRelaService
-                .selectList(new EntityWrapper<StationRela>().eq("agv_sta", station.getDevNo()));
-        if (Objects.isNull(relas) || relas.isEmpty()) {
-            throw new CoolException("绔欑偣鏈叧鑱斿爢鍨涙満浣滀笟绔欑偣锛侊紒");
-        }
-
-        Set<String> crnStas = relas.stream().map(StationRela::getCrnSta).collect(Collectors.toSet());
-
-        List<BasDevp> devps = basDevpService.selectList(
-                new EntityWrapper<BasDevp>().in("dev_no", crnStas).eq("loading", CommonStation.COMMON_STATION_Y.type));
-        if (Objects.isNull(devps) || devps.isEmpty()) {
-            throw new CoolException("鏃犵珯鐐瑰彲鐢紒");
-        }
-        Collections.shuffle(devps);
-        BasDevp basDevp = devps.stream().findFirst().get();
-        List<CrnTaskDetlDTO> locMasts = new ArrayList<>();
-        Map<String, List<LocDetl>> listMap = locDetls.stream().collect(Collectors.groupingBy(LocDetl::getMatnr));
-        //鑾峰彇鏌ュ簱瀛樻�绘暟閲�
-        AtomicReference<Double> totalOut = new AtomicReference<>(0.0);
-        listMap.forEach((matnr, detls) -> {
-            Map<String, List<LocDetl>> supIds = detls.stream().collect(Collectors.groupingBy(LocDetl::getStandby1));
-            supIds.forEach((supId, sups) -> {
-                // 鏍规嵁supId(渚涘簲鍟�)鍒嗙被锛屽緱鍒伴渶瑕佸瓨鏀剧殑鎬荤┖搴撳瓨鏁伴噺
-                Double sum = sups.stream().mapToDouble(LocDetl::getAnfme).sum();
-                AtomicReference<Double> itemed = new AtomicReference<>(0.0);
-                // 鑾峰彇褰撳墠渚涘簲鍟�+ 鐗╂枡鍦ㄥ簱
-                List<LocDetl> detlList = locDetlService.selectList(new EntityWrapper<LocDetl>()
-                        .eq("matnr", matnr)
-                        .eq("area_id", one.getId())
-                        .eq("standby1", supId).orderAsc(Arrays.asList("appe_time")));
-                // TODO 鍒ゆ柇鏄惁鏈夋柊搴撲綅锛屾病鏈夋柊搴撲綅锛屽啀鎵炬湁绌烘牸鐨勪綅缃斁 1. 鍒ゆ柇褰撳墠鐗╂枡鏄惁鏈夊簱瀛� 2. 娌℃湁浣欐枡鏌ヨ鏂板簱浣�
-                if (!Objects.isNull(detlList) && !detlList.isEmpty()) {
-                    Map<String, List<LocDetl>> locMaps = detlList.stream()
-                            .collect(Collectors.groupingBy(LocDetl::getLocNo));
-                    locMaps.forEach((locNo, adetls) -> {
-                        LocMast locMast = locMastService.selectById(locNo);
-                        if (Objects.isNull(locMast)) {
-                            throw new CoolException("鏁版嵁閿欒锛屽簱浣嶄俊鎭笉瀛樺湪锛侊紒");
-                        }
-                        BasContainer container = basContainerService
-                                .selectOne(new EntityWrapper<BasContainer>().eq("barcode", locMast.getBarcode()));
-                        if (Objects.isNull(container)) {
-                            throw new CoolException("鏁版嵁閿欒锛屽鍣ㄤ笉瀛樺湪锛侊紒");
-                        }
-                        Set<String> sets = adetls.stream().map(LocDetl::getMatnr).collect(Collectors.toSet());
-                        // 鍒ゆ柇瀹瑰櫒鏄惁杩樺彲娣锋斁,鍙婂綋鍓嶇墿鏂欏彲鏀惧灏�
-                        if (container.getMixMax() > sets.size()) {
-                            //浣欎笅鍙贩鏀剧绫�
-                            long suplus = Math.round((container.getMixMax() - sets.size()) * 10000) / 10000;
-                            Mat mats = matService.selectOne(new EntityWrapper<Mat>().eq("matnr", matnr));
-                            if (Objects.isNull(mats)) {
-                                throw new CoolException("鐗╂枡涓嶅瓨鍦紒锛�");
-                            }
-                            //浣欎笅鏈�澶у彲鏀炬暟閲�
-                            Double v = Math.round((mats.getUpQty() * suplus) * 10000) / 10000.0;
-                            // 鍏ュ簱鏁伴噺灏忎簬闆朵笖鍏ュ簱鏁伴噺鍑忓幓宸茶鍒掑嚭鏁伴噺澶т簬闆讹紙锛�
-                            if (sum.compareTo(v) <= 0 && sum.compareTo(itemed.get()) > 0) {
-                                itemed.set(Math.round((itemed.get() + v) * 10000) / 10000.0);
-                                // 鍙斁涓�
-                                CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(adetls);
-                                locMasts.add(crnTaskDetlDTO);
-                                totalOut.set(Math.round((totalOut.get() + itemed.get()) * 10000) / 10000.0);
-                            }
-                        }
-                    });
-                }
-            });
-        });
-
-        // 鍒ゆ柇鏍规嵁鍒嗘嫞鍑哄簱鍚�,杩橀渶瑕佸嚭澶氬皯鎵樼洏鎴栨枡绠�;濡傛灉浣欐枡澶т簬0, 鍑烘柊鎵樼洏鎴栨枡绠�
-        if (totalOut.get().compareTo(0.0) > 0) {
-            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
-            //TODO 缁嗗寲鍖哄垎锛屽綋鍓嶅嚭搴撴墭鐩樻槸婊¤冻鎷h揣鏁伴噺
-        } else {
-            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
-                    // todo 鏍规嵁鐗╂枡绉嶇被,鍖哄垎搴撳尯绫诲瀷
-                    .eq("loc_sts", LocStsType.LOC_STS_TYPE_D.type)
-                    .orderAsc(Arrays.asList("row1", "bay1", "lev1"))
-                    .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
-
-            if (Objects.isNull(locMast)) {
-                throw new CoolException("鏈煡璇㈠埌鍙敤鐨勭┖鏉夸俊鎭紒锛�");
-            }
-
-            CrnTaskDetlDTO crnTaskDetlDTO = new CrnTaskDetlDTO().setLocNo(locMast.getLocNo()).setLocDetlList(locDetls);
-            locMasts.add(crnTaskDetlDTO);
-
-            // 绌烘澘鍑哄簱
-            generateTask(locMasts, TaskIOType.MERGE_OUT.type, basDevp, userId, station);
-        }
-    }
-
-    /**
-     * 鐢熸垚鍫嗗灈鏈哄嚭搴撲换鍔�
-     *
-     * @param locMasts
-     * @param station
-     * @author Ryan
-     * @date 2025/12/6 14:44
-     */
-    @Transactional(rollbackFor = Exception.class)
-    public void generateTask(List<CrnTaskDetlDTO> locMasts, Integer ioType, BasDevp devp, Long userId, BasStation station) {
-        Date now = new Date();
-
-        for (CrnTaskDetlDTO crnTaskDetlDTO : locMasts) {
-            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", crnTaskDetlDTO.getLocNo()));
-            if (Objects.isNull(ioType)) {
-                continue;
-            }
-            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", locMast.getLocNo()));
-            // 鐢熸垚宸ヤ綔鍙�
-            int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
-            if (Cools.isEmpty(wrkMast1)){
-                Integer outSta = devp.getDevNo();
-                // 鑾峰彇璺緞
-                StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
-
-                // 鐢熸垚宸ヤ綔妗�
-                WrkMast wrkMast = new WrkMast();
-                wrkMast.setWrkNo(workNo);
-                wrkMast.setIoTime(now);
-                wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
-                wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶被鍨�
-                wrkMast.setIoPri(13D); // 浼樺厛绾э細13
-                wrkMast.setCrnNo(locMast.getCrnNo());
-                wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 婧愮珯
-                wrkMast.setStaNo(staDesc.getStnNo() + ""); // 鐩爣绔�
-                wrkMast.setSourceLocNo(locMast.getLocNo()); // 婧愬簱浣�
-                //灏忔澗椤圭洰锛岀紦瀛樺嚭搴揂GV绔欑偣锛岀敤浜庢竻绌虹紦瀛樺尯搴撳瓨
-                wrkMast.setPauseMk(station.getDevNo());
-//                wrkMast.setAvgSta(station.getDevNo());;
-                wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
-                wrkMast.setPicking("N"); // 鎷f枡
-                wrkMast.setExitMk("N"); // 閫�鍑�
-                wrkMast.setEmptyMk("N"); // 绌烘澘
-                wrkMast.setLinkMis("N");
-                wrkMast.setBarcode(locMast.getBarcode());
-                wrkMast.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
-                wrkMast.setAppeTime(now);
-                wrkMast.setModiUser(userId);
-                wrkMast.setModiTime(now);
-                if (!wrkMastService.insert(wrkMast)) {
-                    throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細" + locMast.getLocNo());
-                }
-            }else {
-                workNo = wrkMast1.getWrkNo();
-            }
-            // 鐢熸垚宸ヤ綔妗f槑缁�
-            for (LocDetl detlDto : crnTaskDetlDTO.getLocDetlList()) {
-                WrkDetl wrkDetl = new WrkDetl();
-                BeanUtils.copyProperties(detlDto, wrkDetl);
-                wrkDetl.setOrderNo(""); // 鎵嬪姩鍑哄簱涓嶉渶瑕佸甫鍑哄簱瀛樹腑鐨勫崟鎹紪鍙�
-                wrkDetl.setWrkNo(workNo);
-                wrkDetl.setIoTime(now);
-                wrkDetl.setZpallet(null);
-                wrkDetl.setBarcode(null);
-                wrkDetl.setAppeTime(now);
-                wrkDetl.setAppeUser(userId);
-                wrkDetl.setModiTime(now);
-                wrkDetl.setModiUser(userId);
-                if (!wrkDetlService.insert(wrkDetl)) {
-                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
-                }
-            }
-            // 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
-            locMast = locMastService.selectById(locMast.getLocNo());
-            if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)
-                    || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
-                locMast.setLocSts(ioType == 101 ? "R" : "P");
-                locMast.setModiUser(userId);
-                locMast.setModiTime(now);
-                if (!locMastService.updateById(locMast)) {
-                    throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細" + locMast.getLocNo());
-                }
-            } else {
-                throw new CoolException(locMast.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
-            }
-        }
-    }
+//    /**
+//     * 鐢熸垚鍫嗗灈鏈哄嚭搴撲换鍔�
+//     *
+//     * @param locMasts
+//     * @param station
+//     * @author Ryan
+//     * @date 2025/12/6 14:44
+//     */
+//    @Transactional(rollbackFor = Exception.class)
+//    public void generateTask(List<CrnTaskDetlDTO> locMasts, Integer ioType, BasDevp devp, Long userId, BasStation station) {
+//        Date now = new Date();
+//
+//        for (CrnTaskDetlDTO crnTaskDetlDTO : locMasts) {
+//            LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", crnTaskDetlDTO.getLocNo()));
+//            if (Objects.isNull(ioType)) {
+//                continue;
+//            }
+//            WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_loc_no", locMast.getLocNo()));
+//            // 鐢熸垚宸ヤ綔鍙�
+//            int workNo = commonService.getWorkNo(WorkNoType.getWorkNoType(ioType));
+//            if (Cools.isEmpty(wrkMast1)){
+//                Integer outSta = devp.getDevNo();
+//                // 鑾峰彇璺緞
+//                StaDesc staDesc = staDescService.queryCrnStn(ioType, locMast.getCrnNo(), outSta);
+//
+//                // 鐢熸垚宸ヤ綔妗�
+//                WrkMast wrkMast = new WrkMast();
+//                wrkMast.setWrkNo(workNo);
+//                wrkMast.setIoTime(now);
+//                wrkMast.setWrkSts(11L); // 宸ヤ綔鐘舵�侊細11.鐢熸垚鍑哄簱ID
+//                wrkMast.setIoType(ioType); // 鍏ュ嚭搴撶被鍨�
+//                wrkMast.setIoPri(13D); // 浼樺厛绾э細13
+//                wrkMast.setCrnNo(locMast.getCrnNo());
+//                wrkMast.setSourceStaNo(staDesc.getCrnStn() + ""); // 婧愮珯
+//                wrkMast.setStaNo(staDesc.getStnNo() + ""); // 鐩爣绔�
+//                wrkMast.setSourceLocNo(locMast.getLocNo()); // 婧愬簱浣�
+//                //灏忔澗椤圭洰锛岀紦瀛樺嚭搴揂GV绔欑偣锛岀敤浜庢竻绌虹紦瀛樺尯搴撳瓨
+//                wrkMast.setPauseMk(station.getDevNo());
+////                wrkMast.setAvgSta(station.getDevNo());;
+//                wrkMast.setFullPlt("Y"); // 婊℃澘锛歒
+//                wrkMast.setPicking("N"); // 鎷f枡
+//                wrkMast.setExitMk("N"); // 閫�鍑�
+//                wrkMast.setEmptyMk("N"); // 绌烘澘
+//                wrkMast.setLinkMis("N");
+//                wrkMast.setBarcode(locMast.getBarcode());
+//                wrkMast.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
+//                wrkMast.setAppeTime(now);
+//                wrkMast.setModiUser(userId);
+//                wrkMast.setModiTime(now);
+//                if (!wrkMastService.insert(wrkMast)) {
+//                    throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐ワ紝鍑哄簱搴撲綅鍙凤細" + locMast.getLocNo());
+//                }
+//            }else {
+//                workNo = wrkMast1.getWrkNo();
+//            }
+//            // 鐢熸垚宸ヤ綔妗f槑缁�
+//            for (LocDetl detlDto : crnTaskDetlDTO.getLocDetlList()) {
+//                WrkDetl wrkDetl = new WrkDetl();
+//                BeanUtils.copyProperties(detlDto, wrkDetl);
+//                wrkDetl.setOrderNo(""); // 鎵嬪姩鍑哄簱涓嶉渶瑕佸甫鍑哄簱瀛樹腑鐨勫崟鎹紪鍙�
+//                wrkDetl.setWrkNo(workNo);
+//                wrkDetl.setIoTime(now);
+//                wrkDetl.setZpallet(null);
+//                wrkDetl.setBarcode(null);
+//                wrkDetl.setAppeTime(now);
+//                wrkDetl.setAppeUser(userId);
+//                wrkDetl.setModiTime(now);
+//                wrkDetl.setModiUser(userId);
+//                if (!wrkDetlService.insert(wrkDetl)) {
+//                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+//                }
+//            }
+//            // 淇敼搴撲綅鐘舵��: F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
+//            locMast = locMastService.selectById(locMast.getLocNo());
+//            if (locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_F.type)
+//                    || locMast.getLocSts().equals(LocStsType.LOC_STS_TYPE_D.type)) {
+//                locMast.setLocSts(ioType == 101 ? "R" : "P");
+//                locMast.setModiUser(userId);
+//                locMast.setModiTime(now);
+//                if (!locMastService.updateById(locMast)) {
+//                    throw new CoolException("棰勭害搴撲綅鐘舵�佸け璐ワ紝搴撲綅鍙凤細" + locMast.getLocNo());
+//                }
+//            } else {
+//                throw new CoolException(locMast.getLocNo() + "搴撲綅涓嶆槸鍦ㄥ簱鐘舵��");
+//            }
+//        }
+//    }
 
     /**
      * @author Ryan
@@ -2484,129 +1682,129 @@
         }
     }
 
-    public HIKResultDTO sendAgvTask(HIKApiDTO haiKangApiDTO, String path) {
-        HIKResultDTO result = new HIKResultDTO();
+//    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("鍙戦�乤gv浠诲姟澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", 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("鍙戦�乤gv浠诲姟寮傚父", e);
+//        } finally {
+//            try {
+//                // 淇濆瓨鎺ュ彛鏃ュ織
+//                apiLogService.save(
+//                        "鍙戦�乤gv浠诲姟",
+//                        HIKApiConstant.AGV_IP + path,
+//                        null,
+//                        "127.0.0.1",
+//                        body,
+//                        response,
+//                        result.isSuccess());
+//            } catch (Exception e) {
+//                log.error("", e);
+//            }
+//        }
+//        return result;
+//    }
 
-        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);
+//    /**
+//     * 鍛煎彨AGV绌哄彴杞﹁繑鍥�
+//     * @author Ryan
+//     * @date 2025/9/24
+//     * @param callAgvBackParam
+//     * @return com.core.common.R
+//     */
+//    @Override
+//    @Transactional(rollbackFor = Exception.class)
+//    public R agvCallback(AgvCallParams callAgvBackParam, Long userId) {
+//        if (Objects.isNull(callAgvBackParam.getOrgSite())) {
+//            return R.error("鍙傛暟涓嶈兘涓虹┖!!");
+//        }
+//
+//        // 鎸夊綋鍓嶆煡鎵惧簱浣嶉『搴忥紝鏌ュ埌涓�涓悗锛屼笉鍐嶅線涓嬫煡璇�
+//        LocCache locCache = findPriorityLocCache();
+//
+//        if (Objects.isNull(locCache)) {
+//            return R.error("鏈煡璇㈠埌鍙敤搴撲綅");
+//        }
+//
+//        // 淇敼鐩爣绔欑偣淇℃伅
+//        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite()));
+//        if (Objects.isNull(station)) {
+//            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
+//        }
+//
+//        try {
+//            //绌哄彴杞﹀洖搴�
+//            generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId);
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//            return R.error(e.getMessage());
+//        }
+//
+//        return R.ok(locCache);
+//    }
 
-        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("鍙戦�乤gv浠诲姟澶辫触锛侊紒锛乽rl锛歿}锛況equest锛歿}锛況esponse锛歿}", 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("鍙戦�乤gv浠诲姟寮傚父", e);
-        } finally {
-            try {
-                // 淇濆瓨鎺ュ彛鏃ュ織
-                apiLogService.save(
-                        "鍙戦�乤gv浠诲姟",
-                        HIKApiConstant.AGV_IP + path,
-                        null,
-                        "127.0.0.1",
-                        body,
-                        response,
-                        result.isSuccess());
-            } catch (Exception e) {
-                log.error("", e);
-            }
-        }
-        return result;
-    }
-
-    /**
-     * 鍛煎彨AGV绌哄彴杞﹁繑鍥�
-     * @author Ryan
-     * @date 2025/9/24
-     * @param callAgvBackParam
-     * @return com.core.common.R
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public R agvCallback(AgvCallParams callAgvBackParam, Long userId) {
-        if (Objects.isNull(callAgvBackParam.getOrgSite())) {
-            return R.error("鍙傛暟涓嶈兘涓虹┖!!");
-        }
-
-        // 鎸夊綋鍓嶆煡鎵惧簱浣嶉『搴忥紝鏌ュ埌涓�涓悗锛屼笉鍐嶅線涓嬫煡璇�
-        LocCache locCache = findPriorityLocCache();
-        
-        if (Objects.isNull(locCache)) {
-            return R.error("鏈煡璇㈠埌鍙敤搴撲綅");
-        }
-
-        // 淇敼鐩爣绔欑偣淇℃伅
-        BasStation station = basStationService.selectOne(new EntityWrapper<BasStation>().eq("dev_no", callAgvBackParam.getOrgSite()));
-        if (Objects.isNull(station)) {
-            throw new CoolException("绔欑偣涓嶅瓨鍦�!!");
-        }
-
-        try {
-            //绌哄彴杞﹀洖搴�
-            generateAgvTask("agv_back", locCache, callAgvBackParam.getOrgSite(), station.getBarcode(), userId);
-        } catch (Exception e) {
-            e.printStackTrace();
-            return R.error(e.getMessage());
-        }
-
-        return R.ok(locCache);
-    }
-
-    /**
-     * 鎸変紭鍏堢骇鏌ユ壘鍙敤搴撲綅
-     * 椤哄簭锛氬叆搴撶紦瀛樺尯 -> SO鍖� -> EO鍖�
-     */
-    private LocCache findPriorityLocCache() {
-        // 1. Try Inbound Cache Area
-        LocCache loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_IN_CACHE);
-        if (loc != null) return loc;
-
-        // 2. Try SO Area
-        loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_SO);
-        if (loc != null) return loc;
-
-        // 3. Try EO Area
-        loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_EO);
-        return loc;
-    }
-
-    /**
-     * 鏍规嵁鍖哄煙绫诲瀷鏌ユ壘鍙敤搴撲綅
-     */
-    private LocCache findAvailableLocByAreaType(LocAreaType areaType) {
-        BasAreas area = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", areaType.type));
-        if (area == null) {
-            return null;
-        }
-        return locCacheService.selectOne(new EntityWrapper<LocCache>()
-                .eq("area_id", area.getId())
-                .eq("frozen", 0)
-                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
-                .orderAsc(Arrays.asList("loc_no"))
-                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
-    }
+//    /**
+//     * 鎸変紭鍏堢骇鏌ユ壘鍙敤搴撲綅
+//     * 椤哄簭锛氬叆搴撶紦瀛樺尯 -> SO鍖� -> EO鍖�
+//     */
+//    private LocCache findPriorityLocCache() {
+//        // 1. Try Inbound Cache Area
+//        LocCache loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_IN_CACHE);
+//        if (loc != null) return loc;
+//
+//        // 2. Try SO Area
+//        loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_SO);
+//        if (loc != null) return loc;
+//
+//        // 3. Try EO Area
+//        loc = findAvailableLocByAreaType(LocAreaType.LOC_AREA_TYPE_EO);
+//        return loc;
+//    }
+//
+//    /**
+//     * 鏍规嵁鍖哄煙绫诲瀷鏌ユ壘鍙敤搴撲綅
+//     */
+//    private LocCache findAvailableLocByAreaType(LocAreaType areaType) {
+//        BasAreas area = basAreasService.selectOne(new EntityWrapper<BasAreas>().eq("whs_type_id", areaType.type));
+//        if (area == null) {
+//            return null;
+//        }
+//        return locCacheService.selectOne(new EntityWrapper<LocCache>()
+//                .eq("area_id", area.getId())
+//                .eq("frozen", 0)
+//                .eq("loc_sts", LocStsType.LOC_STS_TYPE_O.type)
+//                .orderAsc(Arrays.asList("loc_no"))
+//                .last("OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY"));
+//    }
 }

--
Gitblit v1.9.1