From bf80315e91a0258d1d14ccb1e2d0f5ce6c825097 Mon Sep 17 00:00:00 2001 From: nealo <381020974@qq.com> Date: Sun, 4 Oct 2026 00:21:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=93=E5=8F=96=E6=95=A3=E5=8D=95=E5=8E=BB?= =?UTF-8?q?=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/wms/Wms.php | 55 ++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/application/index/controller/wms/Wms.php b/application/index/controller/wms/Wms.php index 36a95d5..d41c344 100644 --- a/application/index/controller/wms/Wms.php +++ b/application/index/controller/wms/Wms.php @@ -2565,6 +2565,17 @@ class Wms extends Frontend }else{ $Allitems = $OrderModel->field('ID,STOREID,POSTCODE,ITEMS,STOREID,JDFLAG,GOODSCOUNT,POSTNUM,PROVINCE,STOCKS,STORENAME')->where(["WAREHOUSEID"=>$WAREHOUSEID,"plSendFlag"=>0,"FLAG"=>0,"POSTFLAG"=>1,"ISLOCK"=>0])->where('GRABNUM IS NULL or GRABNUM=""')->where(["ASSIGNFLAG"=>1])->where($where)->select(); } + + // 按订单ID去重:避免同一订单被重复计入,导致 ordercount 虚高(显示N单/抓取N-1单) + $__dedup = []; + $__seen = []; + foreach ($Allitems as $__it){ + $__oid = $__it['ID']; + if (isset($__seen[$__oid])) continue; + $__seen[$__oid] = true; + $__dedup[] = $__it; + } + $Allitems = $__dedup; $STOCKSarr = []; foreach ($Allitems as $order){ @@ -2783,6 +2794,17 @@ class Wms extends Frontend }else{ $Allitems = $OrderModel->field('ID,STOREID,POSTCODE,ITEMS,STOREID,JDFLAG,GOODSCOUNT,POSTNUM,PROVINCE,STOCKS,STORENAME,ECNOTES')->where(["WAREHOUSEID"=>$WAREHOUSEID,"PLSENDFLAG"=>0,"FLAG"=>0,"POSTFLAG"=>1,"ISLOCK"=>0])->where('GRABNUM IS NULL or GRABNUM=""')->where(["ASSIGNFLAG"=>1])->where($where)->select(); } + + // 按订单ID去重:避免同一订单被重复计入,导致 ordercount 虚高(显示N单/抓取N-1单) + $__dedup = []; + $__seen = []; + foreach ($Allitems as $__it){ + $__oid = $__it['ID']; + if (isset($__seen[$__oid])) continue; + $__seen[$__oid] = true; + $__dedup[] = $__it; + } + $Allitems = $__dedup; array_push($times,time()-$lastTime); $lastTime = time(); @@ -2987,6 +3009,17 @@ class Wms extends Frontend }else{ $Allitems = $OrderModel->field('ID,STOREID,POSTCODE,ITEMS,STOREID,JDFLAG,ID,GOODSCOUNT,PROVINCE,STOCKS,STORENAME')->where(["WAREHOUSEID"=>$WAREHOUSEID,"plSendFlag"=>0,"ASSIGNFLAG"=>1,"POSTFLAG"=>1,"ISLOCK"=>0,"FLAG"=>0])->where('GRABNUM IS NULL or GRABNUM=""')->where($where)->select(); } + + // 按订单ID去重:避免同一订单被重复计入,导致 ordercount 虚高(显示N单/抓取N-1单) + $__dedup = []; + $__seen = []; + foreach ($Allitems as $__it){ + $__oid = $__it['ID']; + if (isset($__seen[$__oid])) continue; + $__seen[$__oid] = true; + $__dedup[] = $__it; + } + $Allitems = $__dedup; $STOCKSarr = []; foreach ($Allitems as $order){ @@ -3176,6 +3209,17 @@ class Wms extends Frontend }else{ $Allitems = $OrderModel->field('ID,STOREID,POSTCODE,ITEMS,STOREID,JDFLAG,ID,GOODSCOUNT,PROVINCE,STOCKS,STORENAME,ECNOTES')->where(["WAREHOUSEID"=>$WAREHOUSEID,"plSendFlag"=>0,"ASSIGNFLAG"=>1,"POSTFLAG"=>1,"ISLOCK"=>0,"FLAG"=>0])->where('GRABNUM IS NULL or GRABNUM=""')->where($where)->select(); } + + // 按订单ID去重:避免同一订单被重复计入,导致 ordercount 虚高(显示N单/抓取N-1单) + $__dedup = []; + $__seen = []; + foreach ($Allitems as $__it){ + $__oid = $__it['ID']; + if (isset($__seen[$__oid])) continue; + $__seen[$__oid] = true; + $__dedup[] = $__it; + } + $Allitems = $__dedup; $STOCKSarr = []; foreach ($Allitems as $order){ @@ -3468,6 +3512,17 @@ class Wms extends Frontend }else{ $Allitems = $OrderModel->field('ID,STOREID,POSTCODE,ITEMS,STOREID,JDFLAG,GOODSCOUNT,POSTNUM,PROVINCE,STOCKS,STORENAME,ECNOTES')->where(["WAREHOUSEID"=>$WAREHOUSEID,"plSendFlag"=>0,"FLAG"=>0,"POSTFLAG"=>1,"ISLOCK"=>0])->where('GRABNUM IS NULL or GRABNUM=""')->where(["ASSIGNFLAG"=>1])->where($where)->select(); } + + // 按订单ID去重:避免同一订单被重复计入,导致 ordercount 虚高(显示N单/抓取N-1单) + $__dedup = []; + $__seen = []; + foreach ($Allitems as $__it){ + $__oid = $__it['ID']; + if (isset($__seen[$__oid])) continue; + $__seen[$__oid] = true; + $__dedup[] = $__it; + } + $Allitems = $__dedup; foreach ($Allitems as $r){ $r['skucount'] = substr_count($r['ITEMS'],"|"); }