From d9b6788c225075e67265ccb48c955db06a32cd5c Mon Sep 17 00:00:00 2001 From: todaywindy Date: Wed, 18 Jun 2025 09:39:43 +0800 Subject: [PATCH 01/35] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/view/order/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/admin/view/order/index.html b/application/admin/view/order/index.html index 45219b3..4e619fe 100644 --- a/application/admin/view/order/index.html +++ b/application/admin/view/order/index.html @@ -131,7 +131,7 @@
- +
From c1d6259bc9faa08a6f1f5ac837b54c5007169e8c Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Wed, 18 Jun 2025 10:08:42 +0800 Subject: [PATCH 02/35] sth --- application/admin/controller/AutoDispatchLogic.php | 4 ++-- application/common/Logic/OrderLogic.php | 6 +++--- application/common/command/CheckOrderDispatchGotCommand.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/application/admin/controller/AutoDispatchLogic.php b/application/admin/controller/AutoDispatchLogic.php index 617cabe..3cca51f 100644 --- a/application/admin/controller/AutoDispatchLogic.php +++ b/application/admin/controller/AutoDispatchLogic.php @@ -59,9 +59,9 @@ class AutoDispatchLogic $hookparams['role'] = 1; $hookparams['auth'] = null; $hookparams['remark'] = '自动完成派单';//. $worker->name.'('.$worker->tel.')'; - if ($isRetry) { + /*if ($isRetry) { $hookparams['remark'] = '订单重派:工程师【'.$worker->name.'】超时不接单,系统自动转派订单'; - } + }*/ Hook::listen('order_change', $hookparams); //日志 diff --git a/application/common/Logic/OrderLogic.php b/application/common/Logic/OrderLogic.php index 6894016..d5b5cba 100644 --- a/application/common/Logic/OrderLogic.php +++ b/application/common/Logic/OrderLogic.php @@ -100,12 +100,12 @@ class OrderLogic * 师傅超时未接单的处理逻辑 * @return void */ - public function noWorkerCanGetIt(OrderDispatch $dispatch,$remark = null) + public function noWorkerCanGetIt(OrderDispatch $dispatch,$remark = null,$isOverTime=false) {//超过三次,直接取消 Db::startTrans(); try { - if (is_null($remark)){ - $remark = '工程师('.$dispatch->worker_name.')超时未接单,任务取消'; + if ($isOverTime){ + $remark = '工程师('.$dispatch->worker_name.')超时未接,系统自动转派订单'; } $this->cancelOrderDispatch($dispatch,null,$remark); Db::commit(); diff --git a/application/common/command/CheckOrderDispatchGotCommand.php b/application/common/command/CheckOrderDispatchGotCommand.php index 482d83b..6a21276 100644 --- a/application/common/command/CheckOrderDispatchGotCommand.php +++ b/application/common/command/CheckOrderDispatchGotCommand.php @@ -49,7 +49,7 @@ class CheckOrderDispatchGotCommand extends Command foreach ($list as $item) { try { //取消旧单 - $OrderLogic->noWorkerCanGetIt($item); + $OrderLogic->noWorkerCanGetIt($item,null,true); //自动重派新单 $order = Order::get($item->order_id); AutoDispatchLogic::autoDispatch($order,null,true); @@ -85,7 +85,7 @@ class CheckOrderDispatchGotCommand extends Command foreach ($list as $item) { try { //取消旧单 - $OrderLogic->noWorkerCanGetIt($item); + $OrderLogic->noWorkerCanGetIt($item,null,true); //自动重派新单 $order = Order::get($item->order_id); AutoDispatchLogic::autoDispatch($order,null,true); From 0103120071ce69fb94c2ed92014ccaada43aa4e6 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Wed, 18 Jun 2025 10:14:29 +0800 Subject: [PATCH 03/35] =?UTF-8?q?=E5=9C=B0=E5=9B=BE=E6=B4=BE=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/workers/Worker.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/application/admin/controller/workers/Worker.php b/application/admin/controller/workers/Worker.php index 094a54c..a44c729 100644 --- a/application/admin/controller/workers/Worker.php +++ b/application/admin/controller/workers/Worker.php @@ -6,6 +6,7 @@ use app\admin\model\Area; use app\admin\model\AuthGroup; use app\admin\model\Item; use app\admin\model\Order; +use app\admin\model\OrderDispatch; use app\admin\model\WorkerItem; use app\common\controller\Backend; use fast\Tree; @@ -319,7 +320,7 @@ class Worker extends Backend $order_id = request()->get('order_id'); $search = request()->get('search'); list($where, $sort, $order, $offset, $limit) = $this->buildparams(); - $order = (new Order())->where('id',$order_id)->field(['id','lng','lat'])->select(); + $order = (new Order())->where('id',$order_id)->field(['id','lng','lat','item_id'])->select(); if (!empty($order)) { $order = $order[0]; @@ -339,9 +340,21 @@ ORDER BY distance;",[$order->lng,$order->lat]); $worker_ids = array_column($worker_distance,'id'); + $worker_items_ids = (new WorkerItem()) + ->where('item_id', $order->item_id) + ->whereIn('worker_id', $worker_ids) + ->column('worker_id'); + +// $out_worker = OrderDispatch::where('order_id',$order->id) +// ->where('status',-30)->column('worker_id'); + + $out_worker_ids = array_intersect($worker_ids, $worker_items_ids); +// $out_worker_ids = array_values(array_diff($out_worker_ids, $out_worker)); + + $build = model('worker') ->where('status', 1) - ->whereIn('id', $worker_ids); + ->whereIn('id', $out_worker_ids); if ($search){ From cf2fa22190a02487341258602ed745ba7b7c84c1 Mon Sep 17 00:00:00 2001 From: todaywindy Date: Wed, 18 Jun 2025 11:14:55 +0800 Subject: [PATCH 04/35] =?UTF-8?q?=E6=B4=BE=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/workers/Worker.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/application/admin/controller/workers/Worker.php b/application/admin/controller/workers/Worker.php index a44c729..6d72192 100644 --- a/application/admin/controller/workers/Worker.php +++ b/application/admin/controller/workers/Worker.php @@ -22,6 +22,7 @@ use think\exception\ValidateException; class Worker extends Backend { + protected $noNeedRight = ['dispatchList','dispatchMapList']; /** * Worker模型对象 * @var \app\admin\model\Worker @@ -283,6 +284,7 @@ class Worker extends Backend $build = model('worker') ->where('status', 1) + ->where('type',2) ->with(['area']) ->withCount(['myorder' => function ($query) { $query->where('status', Order::STATUS_FINISHED); @@ -333,7 +335,7 @@ SELECT id, point(lng, lat), point(?, ?) ) AS distance -FROM fa_worker where status = 1 +FROM fa_worker where status = 1 and type = 2 ) AS t WHERE distance < 50000 ORDER BY distance;",[$order->lng,$order->lat]); From 70b1ff8ce71dee64c390a48694214838f80c070d Mon Sep 17 00:00:00 2001 From: xman <1946321327@qq.com> Date: Wed, 18 Jun 2025 11:21:48 +0800 Subject: [PATCH 05/35] sth --- .../admin/view/orders/configorder/edit.html | 9 +++++++ .../assets/js/backend/orders/configorder.js | 25 +++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/application/admin/view/orders/configorder/edit.html b/application/admin/view/orders/configorder/edit.html index 092c19f..246f193 100644 --- a/application/admin/view/orders/configorder/edit.html +++ b/application/admin/view/orders/configorder/edit.html @@ -263,6 +263,15 @@ --> + +
+ +
+ +
+
+ +