| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.config.SysStockProperties; |
| | | import com.vincent.rsf.server.common.utils.DateUtils; |
| | |
| | | import com.vincent.rsf.server.system.constant.GlobalConfigCode; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.entity.Config; |
| | | import com.vincent.rsf.server.system.entity.FieldsItem; |
| | | import com.vincent.rsf.server.system.service.ConfigService; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsItemServiceImpl; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | private TransferService transferService; |
| | | @Autowired |
| | | private OutStockService outStockService; |
| | | @Autowired |
| | | private FieldsItemService fieldsItemService; |
| | | |
| | | /** |
| | | * 自动收货:仅当 DirectWaitPakin 配置为 true 时执行,将未执行入库单直接收货并写入收货区,更新单据状态为收货完成。 |
| | |
| | | .setWeight(matnr.getWeight()) |
| | | .setFieldsIndex(orderItem.getFieldsIndex()) |
| | | .setShipperId(matnr.getShipperId()); |
| | | if (StringUtils.isNotBlank(orderItem.getFieldsIndex())) { |
| | | List<WarehouseAreasItem> warehousList = warehouseAreasItemService.list(new LambdaQueryWrapper<WarehouseAreasItem>().eq(WarehouseAreasItem::getFieldsIndex, orderItem.getFieldsIndex())); |
| | | WarehouseAreasItem warehousItem = warehousList.isEmpty() ? null : warehousList.get(0); |
| | | if (Objects.nonNull(warehousItem)) { |
| | | List<FieldsItem> fieldsList = fieldsItemService.list(new LambdaQueryWrapper<FieldsItem>().eq(FieldsItem::getUuid, orderItem.getFieldsIndex()).last("LIMIT 1")); |
| | | FieldsItem fieldsItem = fieldsList.isEmpty() ? null : fieldsList.get(0); |
| | | if (Objects.nonNull(fieldsItem)) { |
| | | // 票号已在收货区时跳过推送,避免定时任务反复抛错;视为已收货,由后续逻辑更新单据状态 |
| | | log.warn("票号:{} 已在收货区,跳过推送", fieldsItem.getValue()); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | // 按 ASN 明细唯一标识落收货区,同一单据不同行不因物料/票号相同而合并成一行 |
| | | LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | .eq(WarehouseAreasItem::getMatnrCode, orderItem.getMatnrCode()) |
| | | .eq(!Cools.isEmpty(orderItem.getFieldsIndex()), WarehouseAreasItem::getFieldsIndex, orderItem.getFieldsIndex()) |
| | | .eq(WarehouseAreasItem::getAsnCode, orderItem.getOrderCode()) |
| | | .eq(StringUtils.isNotBlank(orderItem.getSplrBatch()), WarehouseAreasItem::getSplrBatch, orderItem.getSplrBatch()); |
| | | if (Objects.isNull(orderItem.getIsptResult())) { |
| | | queryWrapper.isNull(WarehouseAreasItem::getIsptResult); |
| | | } else { |
| | | queryWrapper.eq(WarehouseAreasItem::getIsptResult, orderItem.getIsptResult()); |
| | | } |
| | | .eq(WarehouseAreasItem::getAsnItemId, orderItem.getId()) |
| | | .eq(WarehouseAreasItem::getAsnId, wkOrder.getId()); |
| | | WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(queryWrapper); |
| | | if (Objects.nonNull(serviceOne)) { |
| | | item.setId(serviceOne.getId()); |