skyouc
2025-01-04 3c52f39678034ce21c1158a01b4885e3afde4443
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
@@ -1,11 +1,16 @@
package com.zy.asrs.wms.asrs.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.exception.CoolException;
import com.zy.asrs.wms.asrs.entity.Order;
import com.zy.asrs.wms.asrs.entity.WaitPakin;
import com.zy.asrs.wms.asrs.entity.enums.LocTypeHeightType;
import com.zy.asrs.wms.asrs.entity.enums.OrderType;
import com.zy.asrs.wms.asrs.entity.enums.TaskStsType;
import com.zy.asrs.wms.asrs.entity.param.BatchMergeOrdersParam;
import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam;
import com.zy.asrs.wms.asrs.service.MobileService;
import com.zy.asrs.wms.asrs.service.OrderService;
import com.zy.asrs.wms.asrs.service.WaitPakinService;
import com.zy.asrs.wms.asrs.service.WorkService;
import com.zy.asrs.wms.system.entity.Host;
@@ -16,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@Service
public class MobileServiceImpl implements MobileService {
@@ -27,31 +33,50 @@
    @Autowired
    private HostService hostService;
    @Autowired
    private OrderService orderService;
    @Override
    @Transactional
    @Transactional(rollbackFor = Exception.class)
    public boolean batchMergeOrders(BatchMergeOrdersParam ordersParam) {
        Order order = orderService.getOne(new LambdaQueryWrapper<Order>().eq(Order::getOrderNo, ordersParam.getOrderNo()));
        if (Objects.isNull(order)) {
            throw new CoolException("订单不存在!!");
        }
        ArrayList<WaitPakin> waitPakins = new ArrayList<>();
        ordersParam.getOrderDetls().forEach(orderdetl -> {
            WaitPakin waitPakin = new WaitPakin();
            waitPakin.setBatch(orderdetl.getBatch()).setAnfme(orderdetl.getMergeNum()).setBarcode(ordersParam.getMergeNo()).setMatnr(orderdetl.getMatnr()).setDetlId(orderdetl.getDetlId()).setIoStatus(0).setOrderNo(orderdetl.getOrderNo()).setOrderId(orderdetl.getOrderId()).setStatus(1);
            waitPakin.setBatch(orderdetl.getBatch())
                    .setAnfme(orderdetl.getMergeNum())
                    .setBarcode(ordersParam.getMergeNo())
                    .setMatnr(orderdetl.getMatnr())
                    .setDetlId(orderdetl.getDetlId())
                    .setIoStatus(0)
                    .setOrderNo(orderdetl.getOrderNo()).setOrderId(orderdetl.getOrderId()).setStatus(1);
            waitPakins.add(waitPakin);
        });
        /*** 项目下发流程 * 1. PDA组拖通知档* 2. 生成任务档* 3. 通过定时任务下发至ESS** */
        //组拖通知档
        waitPakins.forEach(pakin -> {
            waitPakinService.comb(pakin);
        });
        //生成任务档
        GeneratePakInParam generatePakInParam = new GeneratePakInParam();
        //当前没有起始站点,默认101, 高低位默认传低库位
        generatePakInParam.setBarcode(ordersParam.getMergeNo())
                .setOriginSite("101")
                .setTaskType(TaskStsType.GENERATE_IN.id).setLocTypeHeight(LocTypeHeightType.LOW.id);
        if (workService.generatePakIn(generatePakInParam)) {
            return true;
        // UTC入库单据(非平库入库单据)
        if (order.getOrderType() != OrderType.PK_IN_ORDER.id) {
            /*** 项目下发流程 * 1. PDA组拖通知档* 2. 生成任务档* 3. 通过定时任务下发至ESS** */
            //生成任务档
            GeneratePakInParam generatePakInParam = new GeneratePakInParam();
            //当前没有起始站点,默认101, 高低位默认传低库位
            generatePakInParam.setBarcode(ordersParam.getMergeNo())
                    .setOriginSite("101")
                    .setTaskType(TaskStsType.GENERATE_IN.id).setLocTypeHeight(LocTypeHeightType.LOW.id);
            if (workService.generatePakIn(generatePakInParam)) {
                return true;
            }
        } else {
            //fixme 平库是否需要预约入库
        }
        return false;
    }