From f679ac0947417416900ab28308dd3bf235336078 Mon Sep 17 00:00:00 2001
From: chen.lin <1442464845@qq.com>
Date: 星期一, 02 三月 2026 13:00:57 +0800
Subject: [PATCH] 描述修改
---
rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java | 125 ++++++++++++++++++++++++-----------------
1 files changed, 73 insertions(+), 52 deletions(-)
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
index ee5af53..7141848 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java
@@ -623,57 +623,74 @@
//TODO 鍚庣画闇�鏍规嵁绛栫暐閰嶇疆锛岃幏鍙栫粍鎷栨暟鎹�傚锛氭贩瑁咃紝鎸夋壒娆℃贩瑁呯瓑
LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<>();
- // 鏋勫缓OR鏌ヨ鏉′欢缁�
- // 缁熻鏈夋晥鏉′欢鏁伴噺
- int conditionCount = 0;
- if (!Cools.isEmpty(code)) conditionCount++;
- if (!Cools.isEmpty(batch)) conditionCount++;
- if (!Objects.isNull(fieldIndex)) conditionCount++;
- if (!Cools.isEmpty(matnrCode)) conditionCount++;
- if (!Cools.isEmpty(asnCode)) conditionCount++;
-
- // 濡傛灉鍙湁涓�涓潯浠讹紝鐩存帴浣跨敤eq锛涘鏋滄湁澶氫釜鏉′欢锛屼娇鐢╝nd鍖呰9or鏉′欢缁�
- if (conditionCount == 1) {
- // 鍗曚釜鏉′欢锛岀洿鎺ユ煡璇�
+ // 濡傛灉鏈堿SN鍗曞彿锛屽垯鍙煡璇㈣鍗曞彿涓嬬殑鐗╂枡锛圓SN鍗曞彿浣滀负蹇呴』鏉′欢锛�
+ if (!Cools.isEmpty(asnCode)) {
+ // ASN鍗曞彿浣滀负蹇呴』鏉′欢
+ queryWrapper.eq(WarehouseAreasItem::getAsnCode, asnCode);
+
+ // 濡傛灉鍚屾椂鏈夌墿鏂欑紪鐮侊紝鍒欐煡璇㈣ASN鍗曞彿涓嬬殑璇ョ墿鏂�
+ if (!Cools.isEmpty(matnrCode)) {
+ queryWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
+ }
+
+ // 濡傛灉鍚屾椂鏈夋壒娆★紝鍒欐煡璇㈣ASN鍗曞彿涓嬬殑璇ユ壒娆�
+ if (!Cools.isEmpty(batch)) {
+ queryWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ }
+
+ // 濡傛灉鍚屾椂鏈夌エ鍙凤紝鍒欐煡璇㈣ASN鍗曞彿涓嬬殑璇ョエ鍙�
+ if (!Objects.isNull(fieldIndex)) {
+ queryWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ }
+
+ // 濡傛灉鍚屾椂鏈夎窡韪爜锛屽垯鏌ヨ璇SN鍗曞彿涓嬬殑璇ヨ窡韪爜
if (!Cools.isEmpty(code)) {
queryWrapper.eq(WarehouseAreasItem::getTrackCode, code);
- } else if (!Cools.isEmpty(batch)) {
- queryWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
- } else if (!Objects.isNull(fieldIndex)) {
- queryWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
- } else if (!Cools.isEmpty(matnrCode)) {
- queryWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
- } else if (!Cools.isEmpty(asnCode)) {
- queryWrapper.eq(WarehouseAreasItem::getAsnCode, asnCode);
}
} else {
- // 澶氫釜鏉′欢锛屼娇鐢∣R杩炴帴
- queryWrapper.and(wrapper -> {
- boolean first = true;
+ // 娌℃湁ASN鍗曞彿鏃讹紝鍙互鎵弿浠绘剰鐗╂枡缁勬墭锛屼娇鐢∣R杩炴帴澶氫釜鏉′欢
+ // 缁熻鏈夋晥鏉′欢鏁伴噺
+ int conditionCount = 0;
+ if (!Cools.isEmpty(code)) conditionCount++;
+ if (!Cools.isEmpty(batch)) conditionCount++;
+ if (!Objects.isNull(fieldIndex)) conditionCount++;
+ if (!Cools.isEmpty(matnrCode)) conditionCount++;
+
+ // 濡傛灉鍙湁涓�涓潯浠讹紝鐩存帴浣跨敤eq
+ if (conditionCount == 1) {
if (!Cools.isEmpty(code)) {
- wrapper.eq(WarehouseAreasItem::getTrackCode, code);
- first = false;
+ queryWrapper.eq(WarehouseAreasItem::getTrackCode, code);
+ } else if (!Cools.isEmpty(batch)) {
+ queryWrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ } else if (!Objects.isNull(fieldIndex)) {
+ queryWrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ } else if (!Cools.isEmpty(matnrCode)) {
+ queryWrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
}
- if (!Cools.isEmpty(batch)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
- first = false;
- }
- if (!Objects.isNull(fieldIndex)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
- first = false;
- }
- if (!Cools.isEmpty(matnrCode)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
- first = false;
- }
- if (!Cools.isEmpty(asnCode)) {
- if (!first) wrapper.or();
- wrapper.eq(WarehouseAreasItem::getAsnCode, asnCode);
- }
- });
+ } else if (conditionCount > 1) {
+ // 澶氫釜鏉′欢锛屼娇鐢∣R杩炴帴
+ queryWrapper.and(wrapper -> {
+ boolean first = true;
+ if (!Cools.isEmpty(code)) {
+ wrapper.eq(WarehouseAreasItem::getTrackCode, code);
+ first = false;
+ }
+ if (!Cools.isEmpty(batch)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getSplrBatch, batch);
+ first = false;
+ }
+ if (!Objects.isNull(fieldIndex)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getFieldsIndex, fieldIndex);
+ first = false;
+ }
+ if (!Cools.isEmpty(matnrCode)) {
+ if (!first) wrapper.or();
+ wrapper.eq(WarehouseAreasItem::getMatnrCode, matnrCode);
+ }
+ });
+ }
}
// 鎵撳嵃鏌ヨ鍙傛暟鍒版帶鍒跺彴
@@ -945,7 +962,7 @@
@Override
public R operateToStock(OpStockParams params) {
if (org.apache.commons.lang3.StringUtils.isBlank(params.getBarcode())) {
- throw new CoolException("鎵樼洏鐮佷笉鑳戒负绌猴紒锛�");
+ throw new CoolException("鏂欑鐮佷笉鑳戒负绌猴紒锛�");
}
WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
.eq(WaitPakin::getBarcode, params.getBarcode())
@@ -1154,15 +1171,15 @@
.eq(WaitPakin::getFlagDefect, flagDefect)
.in(WaitPakin::getIoStatus, asList));
// if (!Cools.isEmpty(waitPakin)) {
-// throw new CoolException("鎵樼洏涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
+// throw new CoolException("鏂欑涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
// }
List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.get("barcode").toString()));
if (!tasks.isEmpty()) {
- throw new CoolException("鎵樼洏鐮佸凡鍦ㄤ换鍔℃。鎵ц锛侊紒");
+ throw new CoolException("鏂欑鐮佸凡鍦ㄤ换鍔℃。鎵ц锛侊紒");
}
List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.get("barcode").toString()));
if (!Cools.isEmpty(locs)) {
- throw new CoolException("鎵樼洏涓嶅彲鐢紝鍦ㄥ簱浣嶄腑宸插瓨鍦�");
+ throw new CoolException("鏂欑涓嶅彲鐢紝鍦ㄥ簱浣嶄腑宸插瓨鍦�");
}
// List<WaitPakinItem> items = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId()));
// items.forEach(item -> {
@@ -1252,10 +1269,14 @@
*/
@Override
public R getDeviceSites() {
- List<DeviceSite> sites = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>()
+ // 鍏堟煡鍏ㄩ儴鍐嶆寜 site 鍘婚噸锛岄伩鍏� GROUP BY 涓� only_full_group_by 鍐茬獊
+ List<DeviceSite> all = deviceSiteMapper.selectList(new LambdaQueryWrapper<DeviceSite>()
.select(DeviceSite::getId, DeviceSite::getSite, DeviceSite::getName)
- .eq(DeviceSite::getStatus, 1)
- .groupBy(DeviceSite::getSite, DeviceSite::getId, DeviceSite::getName));
+ .eq(DeviceSite::getStatus, 1));
+ List<DeviceSite> sites = all.stream()
+ .collect(Collectors.toMap(DeviceSite::getSite, d -> d, (a, b) -> a))
+ .values().stream()
+ .collect(Collectors.toList());
return R.ok(sites);
}
--
Gitblit v1.9.1