skyouc
2025-01-11 645da5e4e48dd94b760ea4dcbf80e22bf2a3f33c
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/service/impl/MobileServiceImpl.java
@@ -13,6 +13,7 @@
import com.zy.asrs.wms.asrs.entity.param.GeneratePakInParam;
import com.zy.asrs.wms.asrs.entity.param.PageRequest;
import com.zy.asrs.wms.asrs.entity.param.PakinOnShelvesParams;
import com.zy.asrs.wms.asrs.mapper.CacheSiteMapper;
import com.zy.asrs.wms.asrs.service.*;
import com.zy.asrs.wms.system.entity.Host;
import com.zy.asrs.wms.system.service.HostService;
@@ -39,6 +40,8 @@
    @Autowired
    private OrderService orderService;
    @Autowired
    private OrderDetlService orderDetlService;
    @Autowired
    private OrderLogService orderLogService;
    @Autowired
    private LocService locService;
@@ -52,6 +55,14 @@
    private PickSheetService pickSheetService;
    @Autowired
    private PickSheetDetlService pickSheetDetlService;
    @Autowired
    private MatService matService;
    @Autowired
    private WaveService waveService;
    @Autowired
    private WaveDetlService waveDetlService;
    @Autowired
    private CacheSiteMapper cacheSiteMapper;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -140,12 +151,16 @@
            locDetl.setAnfme(pakin.getAnfme());
            locDetl.setBatch(pakin.getBatch());
            locDetl.setMatId(pakin.getMatnrId$());
            ;
            locDetl.setCreateTime(new Date());
            locDetl.setOrderNo(pakin.getOrderNo());
            locDetl.setLocNo(loc.getLocNo());
            locDetl.setLocId(loc.getId());
            locDetl.setMatnr(pakin.getMatnr());
            Mat one = matService.getOne(new LambdaQueryWrapper<Mat>().eq(Mat::getMatnr, pakin.getMatnr()));
            if (!Objects.isNull(one)) {
                throw new CoolException("当前物料不存在!!");
            }
            locDetl.setMatId(one.getId());
            locDetl.setMemo(pakin.getMemo());
            locDetl.setUpdateTime(new Date());
            if (!locDetlService.saveOrUpdate(locDetl)) {
@@ -167,6 +182,7 @@
        if (!waitPakinService.removeBatchByIds(waitPakins)) {
            throw new CoolException("组拖档删除失败!!");
        }
        //通过组拖订单ID获取订单,并删除原单据,加入单据历史档
        List<Long> list = waitPakins.stream().map(WaitPakin::getOrderId).collect(Collectors.toList());
        List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getId, list));
@@ -210,6 +226,9 @@
    @Transactional(rollbackFor = Exception.class)
    public boolean confirmFlatSheet(String code) {
        PickSheet pickSheet = pickSheetService.getOne(new LambdaQueryWrapper<PickSheet>().eq(PickSheet::getPickNo, code));
        if (Objects.isNull(pickSheet)) {
            throw new CoolException("拣货单不存在!!");
        }
        if (pickSheet.getStatus() == 1) {
            //状态修改为: 已转历史档
            pickSheet.setStatus(3);
@@ -262,7 +281,43 @@
                }
            }
        });
        //删除波次及对应明细信息
        if (!waveService.remove(new LambdaQueryWrapper<Wave>().eq(Wave::getId, pickSheet.getWaveId()))) {
            throw new CoolException("波次列表单据删除失败!!");
        }
        if (!waveDetlService.remove(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getWaveId, pickSheet.getWaveId()))) {
            throw new CoolException("波次明细列表删除失败!!");
        }
        List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, pickSheet.getWaveId()));
        List<Long> list = orders.stream().map(Order::getId).collect(Collectors.toList());
        boolean remove = orderDetlService.remove(new LambdaQueryWrapper<OrderDetl>().in(OrderDetl::getOrderId, list));
        if (!remove) {
            throw new CoolException("原始订单明细删除失败!!");
        }
        if (orderService.remove(new LambdaQueryWrapper<Order>().in(Order::getId, list))) {
            throw new CoolException("原始订单删除失败!!");
        }
        return true;
    }
    @Override
    public List<CacheSite> getSeedLocs() {
        return cacheSiteMapper.selectList(new LambdaQueryWrapper<>());
    }
    /**
     * 订单绑定播种墙
     * @param param
     * @return
     */
    @Override
    public boolean bindOrderBySite(Map<String, Object> param) {
//        return cacheSiteMapper.bindOrderBySite(param);
        return false;
    }
}