From 8ac3795a9e96689edb1fc8dc87313c9c0a07f48a Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 28 五月 2025 13:21:57 +0800 Subject: [PATCH] Double类型计算优化 --- rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java | 23 ++++++++++++----------- 1 files changed, 12 insertions(+), 11 deletions(-) diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java index 341ec5b..c670bbc 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java @@ -84,7 +84,7 @@ /**鑾峰彇缁勬嫋*/ List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() .in(WaitPakin::getId, pakins.getId()) - .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); + .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)); if (waitPakins.isEmpty()) { throw new CoolException("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�"); } @@ -169,7 +169,7 @@ /**鑾峰彇缁勬嫋*/ List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() .in(WaitPakin::getId, pakins.getId()) - .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); + .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)); if (waitPakins.isEmpty()) { throw new CoolException("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�"); } @@ -276,7 +276,7 @@ List<Long> ids = waitPakin.getWaitPakins().stream().map(WaitPakin::getId).collect(Collectors.toList()); List<WaitPakin> waitPakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() .in(WaitPakin::getId, ids) - .eq(WaitPakin::getIoStatus, Short.parseShort(PakinIOStatus.PAKIN_IO_STATUS_DONE.val))); + .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val)); if (waitPakins.isEmpty()) { throw new CoolException("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�"); } @@ -582,11 +582,9 @@ throw new CoolException("鏇存柊缁勬墭鐘舵�佸け璐ワ紒锛�"); } } - Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); - if (null != loc - && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) - || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { + Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); + if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); if (!locService.updateById(loc)) { throw new CoolException("鏇存柊搴撲綅鐘舵�佸け璐ワ紒锛�"); @@ -607,8 +605,7 @@ ) { basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() .eq(BasStation::getStationName, task.getTargLoc()) - .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type) - ); + .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); } if (null == basStation) { throw new CoolException("绔欑偣鐘舵�侀敊璇紒锛�"); @@ -617,6 +614,10 @@ if (!basStationService.updateById(basStation)) { throw new CoolException("鏇存柊绔欑偣鐘舵�佸け璐ワ紒锛�"); } + } + + if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) { + throw new CoolException("浠诲姟鏄庣粏鍒犻櫎澶辫触锛侊紒"); } } if (!this.removeByIds(Arrays.asList(ids))) { @@ -965,8 +966,8 @@ if (Objects.isNull(itemServiceOne)) { throw new CoolException("鏁版嵁閿欒锛氳鏌ョ湅璇疯揣鍖哄簱瀛樻槸鍚﹀瓨鍦紒锛�"); } - Double workQty = itemServiceOne.getWorkQty() - pakinItem.getAnfme(); - Double qty = itemServiceOne.getQty() + pakinItem.getAnfme(); + Double workQty = Math.round((itemServiceOne.getWorkQty() - pakinItem.getAnfme()) * 10000) / 10000.0; + Double qty = Math.round((itemServiceOne.getQty() + pakinItem.getAnfme()) * 10000) / 10000.0; itemServiceOne.setWorkQty(workQty).setQty(qty); if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() -- Gitblit v1.9.1