自动化立体仓库 - WMS系统
skyouc
1 天以前 44bc5cf48fa23a1bf5fcefedce1b4686033b245a
src/main/java/com/zy/api/service/impl/KopenApiServiceImpl.java
@@ -472,10 +472,15 @@
     */
    @Override
    public XSR getStockInfo(PageRequestParams params) {
        Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()),
                new EntityWrapper<LocDetl>()
                        .eq(!Objects.isNull(params.getPro_komcode()), "matnr", params.getPro_komcode())
                        .eq(Objects.isNull(params.getPro_id()), "supp_code", params.getPro_id()));
        EntityWrapper<LocDetl> wrapper = new EntityWrapper<>();
        if (!Objects.isNull(params.getPro_id())) {
            wrapper.eq("supp_code", params.getPro_id());
        }
        if (!Objects.isNull(params.getPro_komcode())) {
            wrapper.eq("matnr", params.getPro_komcode());
        }
        Page<LocDetl> locDetls = locDetlService.selectPage(new Page<>(params.getCurr(), params.getLimit()),  wrapper);
        return XSR.ok(locDetls.getRecords());
    }
@@ -490,25 +495,13 @@
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public XSR sendStockAdjust(StockAdjustParams params, Long userId) {
    public XSR sendStockAdjust(List<StockAdjustParams> params, Long userId) {
        if (Objects.isNull(params)) {
            return XSR.error("参数不能为空!!");
        }
        if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) {
            return XSR.error("订单明细不能为空!!");
        }
        // 校验参数
        if (Objects.isNull(params.getBsby_no())) {
            return XSR.error("损溢单编号不能为空!!");
        }
        CheckOrder checkOrder = checkOrderService
                .selectOne(new EntityWrapper<CheckOrder>().eq("order_no", params.getBsby_no()));
        if (!Objects.isNull(checkOrder)) {
            return XSR.error("损溢单已存在!!");
        }
        gentCheckOrders(params, userId);
        params.forEach(param -> {
            gentCheckOrders(param, userId);
        });
        return XSR.ok("零件损溢单下发成功!!");
    }
@@ -516,18 +509,32 @@
    /** 生成新的零件损溢单 
     * @param userId */
    @Transactional(rollbackFor = Exception.class)   
    public void gentCheckOrders(StockAdjustParams checkOrder, Long userId) {
    public void gentCheckOrders(StockAdjustParams params, Long userId) {
        if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) {
            throw new CoolException("订单明细不能为空!!");
        }
        // 校验参数
        if (Objects.isNull(params.getBsby_no())) {
            throw new CoolException("损溢单编号不能为空!!");
        }
        CheckOrder checkOrder = checkOrderService
                .selectOne(new EntityWrapper<CheckOrder>().eq("order_no", params.getBsby_no()));
        if (!Objects.isNull(checkOrder)) {
            throw new CoolException("损溢单已存在!!");
        }
        CheckOrder order = new CheckOrder();
        order.setOrderNo(checkOrder.getBsby_no());
        order.setCstmrName(checkOrder.getCompany_id());
        order.setDefNumber(checkOrder.getKopen_id());
        order.setOrderNo(params.getBsby_no());
        order.setCstmrName(params.getCompany_id());
        order.setDefNumber(params.getKopen_id());
        order.setDocType(4L);
        order.setUuid(String.valueOf(snowflakeIdWorker.nextId()));
        order.setSettle(Long.valueOf(CommonEnum.COMMON_ENUM_Y.type + ""));
        order.setStatus(CommonEnum.COMMON_ENUM_Y.type);
        order.setOrderTime(checkOrder.getUpdate_time());
        order.setMemo(checkOrder.getResason());
        order.setShipName(checkOrder.getReason_name());
        order.setOrderTime(params.getUpdate_time());
        order.setMemo(params.getResason());
        order.setShipName(params.getReason_name());
        order.setCreateTime(new Date());
        order.setUpdateTime(new Date());
@@ -535,11 +542,11 @@
            throw new CoolException("损溢单新增失败!!");
        }
        if (Objects.isNull(checkOrder.getDetails()) || checkOrder.getDetails().isEmpty()) {
        if (Objects.isNull(params.getDetails()) || params.getDetails().isEmpty()) {
            throw new CoolException("订单明细不能为空!!");
        }
        checkOrder.getDetails().forEach(item -> {
        params.getDetails().forEach(item -> {
            CheckOrderDetl checkOrderDetl = new CheckOrderDetl();
            //通过托盘, 物料编码, 供应商编码查询库存明细
            LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>()