skyouc
3 天以前 cb2339b2f1530132659c8c320cfdd91ee7f68c61
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TransferServiceImpl.java
@@ -1,6 +1,7 @@
package com.vincent.rsf.server.manager.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -242,7 +243,7 @@
            throw new CoolException("出库单明细保存失败!!");
        }
        transfer.setExceStatus(CheckExceStatus.CHECK_ORDER_STATUS_INIT.val);
        transfer.setExceStatus(CheckExceStatus.CHECK_ORDER_STATUS_EXCE_ING.val);
        if (!this.updateById(transfer)) {
            throw new CoolException("调拔单更新失败!!");
@@ -279,6 +280,7 @@
        BeanUtils.copyProperties(wkOrder, order);
        order.setType(OrderType.ORDER_IN.type)
                .setWkType(OrderWorkType.ORDER_WORK_TYPE_OTHER_TERANSFER.type)
                .setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_UN_EXCE.val)
                .setId(null);
        String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_ASN_ORDER, order);
        if (StringUtils.isBlank(ruleCode)) {
@@ -346,16 +348,19 @@
    @Override
    public IPage<LocItem> getLocsItems(OrgLocParams params, Long loginUserId) {
        List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>()
                .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type)
                .eq(!Objects.isNull(params.getOrgAreaId()), Loc::getAreaId, params.getOrgAreaId()));
        Page<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize());
        LambdaQueryWrapper<LocItem> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(StringUtils.isNotBlank(params.getMatnrCode()), LocItem::getMatnrCode, params.getMatnrCode().trim())
                .like(StringUtils.isNotBlank(params.getMaktx().trim()), LocItem::getMaktx, params.getMaktx().trim());
        QueryWrapper<LocItem> wrapper = new QueryWrapper<>();
        wrapper.select("id, matnr_id, maktx, matnr_code, SUM(anfme) anfme, SUM(work_qty) work_qty, SUM(qty) qty, batch, unit, fields_index, model, spec, loc_id ")
                .lambda()
                .eq(StringUtils.isNotBlank(params.getMatnrCode()), LocItem::getMatnrCode, params.getMatnrCode())
                .like(StringUtils.isNotBlank(params.getMaktx()), LocItem::getMaktx, params.getMaktx());
        if (!locs.isEmpty()) {
            Set<Long> locIds = locs.stream().map(Loc::getId).collect(Collectors.toSet());
            wrapper.in(LocItem::getLocId, locIds);
            wrapper.lambda().in(LocItem::getLocId, locIds)
                    .groupBy(LocItem::getBatch, LocItem::getFieldsIndex, LocItem::getMatnrCode);
            return locItemService.page(page, wrapper);
        } else {
            return locItemService.page(page, wrapper);