|  |  |  | 
|---|
|  |  |  | throw new CoolException("出库单明细保存失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | transfer.setExceStatus(CheckExceStatus.CHECK_ORDER_STATUS_INIT.val); | 
|---|
|  |  |  | transfer.setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!this.updateById(transfer)) { | 
|---|
|  |  |  | throw new CoolException("调拔单更新失败!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | @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()); | 
|---|
|  |  |  | QueryWrapper<LocItem> wrapper = new QueryWrapper<>(); | 
|---|
|  |  |  | wrapper.select("id, matnr_id, maktx, matnr_code, anfme, work_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()) { | 
|---|
|  |  |  | Page<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize()); | 
|---|
|  |  |  | 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, loc_code ") | 
|---|
|  |  |  | .lambda() | 
|---|
|  |  |  | .eq(StringUtils.isNotBlank(params.getMatnrCode()), LocItem::getMatnrCode, params.getMatnrCode()) | 
|---|
|  |  |  | .like(StringUtils.isNotBlank(params.getMaktx()), LocItem::getMaktx, params.getMaktx()); | 
|---|
|  |  |  | Set<Long> locIds = locs.stream().map(Loc::getId).collect(Collectors.toSet()); | 
|---|
|  |  |  | wrapper.lambda().in(LocItem::getLocId, locIds) | 
|---|
|  |  |  | .groupBy(LocItem::getBatch, LocItem::getFieldsIndex, LocItem::getMatnrCode); | 
|---|
|  |  |  | .groupBy(LocItem::getBatch, LocItem::getMatnrId); | 
|---|
|  |  |  | return locItemService.page(page, wrapper); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return locItemService.page(page, wrapper); | 
|---|
|  |  |  | IPage<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize()); | 
|---|
|  |  |  | return page; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|