From 2e929cc5c44e4072520aae4c8a9f40029da27405 Mon Sep 17 00:00:00 2001
From: zc <zyzc>
Date: 星期二, 18 十一月 2025 17:29:13 +0800
Subject: [PATCH] 上报站点报异常 二次组托异常

---
 rsf-server/src/main/java/com/vincent/rsf/server/api/service/impl/MobileServiceImpl.java |   58 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 40 insertions(+), 18 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 109120c..6f31073 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
@@ -5,7 +5,7 @@
 import com.vincent.rsf.framework.common.Cools;
 import com.vincent.rsf.framework.common.R;
 import com.vincent.rsf.framework.exception.CoolException;
-import com.vincent.rsf.server.api.controller.params.*;
+import com.vincent.rsf.server.api.controller.erp.params.*;
 import com.vincent.rsf.server.api.entity.dto.*;
 import com.vincent.rsf.server.manager.enums.*;
 import com.vincent.rsf.server.api.service.MobileService;
@@ -243,7 +243,7 @@
                 throw new CoolException("鏁版嵁閿欒锛侊紒");
             }
             if (!one.getExceStatus().equals(AsnExceStatus.OUT_STOCK_STATUS_TASK_DONE.val)) {
-                throw new CoolException("鍑哄簱鍗曟湭瀹屾垚锛屾棤娉曞畬鎴愭敹璐э紒锛�");
+                throw new CoolException("璋冩嫈鍑哄簱鍗曟湭瀹屾垚锛屼笉鍙墽琛屾敹璐ф搷浣滐紒锛�");
             }
         }
 
@@ -251,7 +251,7 @@
             throw new CoolException("鏁版嵁閿欒锛氫富鍗曚笉瀛樺湪锛侊紒");
         }
         //TODO /**鏀惰揣鏁伴噺绱姞锛�1. 浼氬嚭瓒呮敹鎯呭喌 2. 浼氭湁鏀惰揣涓嶈冻鎯呭喌*/
-        Double rcptedQty = Math.round((wkOrder.getQty() + receiptQty) * 10000) / 10000.0;
+        Double rcptedQty = Math.round((wkOrder.getQty() + receiptQty) * 100) / 100.0;
         wkOrder.setQty(rcptedQty).setExceStatus(AsnExceStatus.ASN_EXCE_STATUS_EXCE_ING.val);
         if (!asnOrderMapper.updateById(wkOrder)) {
             throw new CoolException("宸叉敹璐ф暟閲忎慨鏀瑰け璐ワ紒锛�");
@@ -299,7 +299,7 @@
                 throw new CoolException("璇疯緭鍏ユ纭殑鏃堕棿鏍煎紡锛侊紒");
             }
 
-            Double itemRcptQty = Math.round((dto.getReceiptQty() + orderItem.getQty()) * 10000) / 10000.0;
+            Double itemRcptQty = Math.round((dto.getReceiptQty() + orderItem.getQty()) * 100) / 100.0;
             Boolean allowOver = false;
             if (!Objects.isNull(config)) {
                 if (Boolean.parseBoolean(config.getVal())) {
@@ -412,7 +412,7 @@
 
         if (!Objects.isNull(serviceOne)) {
             item.setId(serviceOne.getId());
-            Double anfme = Math.round((item.getAnfme() + serviceOne.getAnfme()) * 10000) / 10000.0;
+            Double anfme = Math.round((item.getAnfme() + serviceOne.getAnfme()) * 100) / 100.0;
             item.setAnfme(anfme);
         }
 
@@ -537,16 +537,32 @@
         Object code = params.get("code");
         Object matnrCode = params.get("matnrCode");
         Object asnCode = params.get("asnCode");
+        Object crushNo = params.get("fieldsIndex");
         Object batch = params.get("batch");
+        String fieldIndex = null;
+        if (!Objects.isNull(crushNo)) {
+            FieldsItem fieldsItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>().eq(FieldsItem::getValue, crushNo).last("Limit 1"));
 
+            if (!Objects.isNull(fieldsItem)) {
+                fieldIndex = fieldsItem.getUuid();
+            }
+        }
         //TODO 鍚庣画闇�鏍规嵁绛栫暐閰嶇疆锛岃幏鍙栫粍鎷栨暟鎹�傚锛氭贩瑁咃紝鎸夋壒娆℃贩瑁呯瓑
         LambdaQueryWrapper<WarehouseAreasItem> queryWrapper = new LambdaQueryWrapper<WarehouseAreasItem>()
                 .or().eq(!Cools.isEmpty(code), WarehouseAreasItem::getTrackCode, code)
                 .or().eq(!Cools.isEmpty(batch), WarehouseAreasItem::getSplrBatch, batch)
+                .or().eq(!Cools.isEmpty(fieldIndex), WarehouseAreasItem::getFieldsIndex, fieldIndex)
                 .or().eq(!Cools.isEmpty(matnrCode), WarehouseAreasItem::getMatnrCode, matnrCode)
                 .or().eq(!Cools.isEmpty(asnCode), WarehouseAreasItem::getAsnCode, asnCode);
         List<WarehouseAreasItem> list = warehouseAreasItemService.list(queryWrapper);
-        list.removeIf(e -> e.getAnfme() <= e.getWorkQty());
+        if (!list.isEmpty()) {
+            list.removeIf(e -> e.getAnfme() <= e.getWorkQty());
+        }
+        list.forEach(item -> {
+            Map<String, String> fields = FieldsUtils.getFields(item.getFieldsIndex());
+            item.setExtendFields(fields);
+        });
+
         return R.ok(list);
     }
 
@@ -916,27 +932,36 @@
      */
     @Override
     public R getItemByContainer(Map<String, Object> params) {
-//        if (Objects.isNull(params.get("code"))) {
-//            throw new CoolException("鍙傛暟涓嶈兘涓虹┖锛侊紒");
-//        }
         //鑾峰彇缁勬嫋鏈敓鎴愪换鍔$殑缁勬嫋妗�
         List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
         Short flagDefect = 0;
         if (!Objects.isNull(params.get("type")) && params.get("type").equals("defective")) {
             flagDefect = 1;
         }
-        List<WaitPakin> waitPakin = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>()
+        WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                 .eq(WaitPakin::getBarcode, params.get("barcode").toString())
-//                .eq(WaitPakin::getFlagDefect, flagDefect)
+                .eq(WaitPakin::getFlagDefect, flagDefect)
                 .in(WaitPakin::getIoStatus, asList));
-        if (!Cools.isEmpty(waitPakin)) {
-            throw new CoolException("鎵樼洏涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
+//        if (!Cools.isEmpty(waitPakin)) {
+//            throw new CoolException("鎵樼洏涓嶅彲鐢�,鍦ㄧ粍鎵樹腑宸插瓨鍦�");
+//        }
+        List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getBarcode, params.get("barcode").toString()));
+        if (!tasks.isEmpty()) {
+            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("鎵樼洏涓嶅彲鐢紝鍦ㄥ簱浣嶄腑宸插瓨鍦�");
         }
-        return R.ok("鎵樼洏鍙敤");
+//        List<WaitPakinItem> items = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().eq(WaitPakinItem::getPakinId, waitPakin.getId()));
+//        items.forEach(item -> {
+//            FieldsItem fieldsItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>().eq(FieldsItem::getUuid, item.getFieldsIndex()).last("limit 1"));
+//            if (!Objects.isNull(fieldsItem) && !Objects.isNull(item.getFieldsIndex())) {
+//                Map<String, String> fields = FieldsUtils.getFields(item.getFieldsIndex());
+//                item.setExtendFields(fields);
+//            }
+//        });
+        return R.ok();
     }
 
     /**
@@ -951,9 +976,6 @@
         if (Cools.isEmpty(params.get("barcode")) && Cools.isEmpty(params.get("code"))) {
             throw new CoolException("瀹瑰櫒鍙蜂笌缁勬墭妗g紪鐮佷笉鑳藉叏涓虹┖");
         }
-        //鑾峰彇缁勬嫋鏈敓鎴愪换鍔$殑缁勬嫋妗�
-//        List<Short> asList = Arrays.asList(Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val), Short.valueOf(PakinIOStatus.PAKIN_IO_STATUS_DONE.val));
-
         WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>()
                 .eq(!Cools.isEmpty(params.get("barcode")), WaitPakin::getBarcode, params.get("barcode"))
                 .eq(!Cools.isEmpty(params.get("code")), WaitPakin::getCode, params.get("code"))
@@ -1106,7 +1128,7 @@
             if (Objects.isNull(stockItem)) {
                 detlsDto.setStockQty(0.0);
             } else {
-                Double anfme = Math.round((stockItem.getAnfme() + stockItem.getWorkQty()) * 10000) / 10000.0;
+                Double anfme = Math.round((stockItem.getAnfme() + stockItem.getWorkQty()) * 100) / 100.0;
                 detlsDto.setStockQty(anfme);
             }
 

--
Gitblit v1.9.1