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 | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 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 2e3cd67..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
@@ -82,10 +82,9 @@
throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
}
/**鑾峰彇缁勬嫋*/
-// List<Long> ids = pakins.stream().map(WaitPakin::getId).collect(Collectors.toList());
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("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�");
}
@@ -105,7 +104,7 @@
task.setTaskCode(ruleCode)
.setTaskStatus(TaskStsType.GENERATE_IN.id)
.setTaskType(TaskType.TASK_TYPE_IN.type)
- .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.id)
+ .setWarehType(WarehType.WAREHOUSE_TYPE_AGV.val)
.setTargLoc(targetLoc)
.setOrgSite(orgSta)
.setBarcode(pakin.getBarcode())
@@ -170,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("璇锋鏌ョ粍鎵樼姸鎬佹槸鍚﹀畬鎴愶紒锛�");
}
@@ -190,7 +189,7 @@
task.setTaskCode(ruleCode)
.setTaskStatus(TaskStsType.COMPLETE_IN.id)
.setTaskType(TaskType.TASK_TYPE_IN.type)
- .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.id)
+ .setWarehType(WarehType.WAREHOUSE_TYPE_PLAT.val)
.setTargLoc(targetLoc)
.setBarcode(pakin.getBarcode())
.setCreateBy(loginUserId)
@@ -277,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("璇锋鏌ョ粍鎷栫姸鎬佹槸鍚﹀畬鎴愶紒锛�");
}
@@ -583,17 +582,15 @@
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("鏇存柊搴撲綅鐘舵�佸け璐ワ紒锛�");
}
}
- if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.id)) {
+ if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) {
BasStation basStation = null;
if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) {
basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>()
@@ -608,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("绔欑偣鐘舵�侀敊璇紒锛�");
@@ -618,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))) {
@@ -966,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