|  |  |  | 
|---|
|  |  |  | if (!this.save(task)) { | 
|---|
|  |  |  | throw new CoolException("任务保存失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BasStation station = basStationService.getOne(new LambdaQueryWrapper<BasStation>().eq(BasStation::getStationName, deviceSite.getSite())); | 
|---|
|  |  |  | if (Objects.isNull(station) || station.getUseStatus() != LocStsType.LOC_STS_TYPE_O.type) { | 
|---|
|  |  |  | throw new CoolException("站点不存在或站点不处于空库状态!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | station.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (basStationService.updateById(station)) { | 
|---|
|  |  |  | throw new CoolException("站点状态更新失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) | 
|---|
|  |  |  | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { | 
|---|
|  |  |  | throw new CoolException("库位预约失败!!"); | 
|---|
|  |  |  | 
|---|
|  |  |  | //更新库位明细 | 
|---|
|  |  |  | saveLocItem(taskItems, task.getId(), loginUserId); | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | throw new CoolException("库位明细更新失败!!"); | 
|---|
|  |  |  | throw new CoolException("任务号:" + task.getTaskCode() +  "库位明细更新失败!!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { | 
|---|