From 025a143de9028ccfaee6be1e81ebc2dfb2e79944 Mon Sep 17 00:00:00 2001 From: lewis <604446095@qq.com> Date: Fri, 7 Feb 2025 15:20:42 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A2=84=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=BD=AC=E6=AC=A0=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BeforehandOrderController.php | 8 ++++++++ .../beforehand_order/BeforehandOrderLists.php | 2 +- .../beforehand_order/BeforehandOrderLogic.php | 17 +++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/app/admin/controller/beforehand_order/BeforehandOrderController.php b/app/admin/controller/beforehand_order/BeforehandOrderController.php index 23295ae45..c7a40e5d4 100644 --- a/app/admin/controller/beforehand_order/BeforehandOrderController.php +++ b/app/admin/controller/beforehand_order/BeforehandOrderController.php @@ -353,5 +353,13 @@ class BeforehandOrderController extends BaseAdminController BeforehandOrderLogic::copy($params); return $this->success('复制成功'); } + + public function transfer() + { + $params = $this->request->post(); + $params['admin_id'] = $this->adminId; + BeforehandOrderLogic::transfer($params); + return $this->success('操作成功'); + } } diff --git a/app/admin/lists/beforehand_order/BeforehandOrderLists.php b/app/admin/lists/beforehand_order/BeforehandOrderLists.php index bb29f26d3..131bdea1e 100644 --- a/app/admin/lists/beforehand_order/BeforehandOrderLists.php +++ b/app/admin/lists/beforehand_order/BeforehandOrderLists.php @@ -88,7 +88,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte $oid=WarehouseOrder::where('financial_pm',0)->where('code','like','%'.$order_ck)->column('id'); $this->searchWhere[] = ['outbound_id','in',$oid]; } - $file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status', 'store_staff_id']; + $file=['id','uid', 'order_id', 'order_sn','store_id', 'order_type', 'total_num', 'total_price', 'outbound_id', 'admin_id', 'create_time', 'status', 'mark', 'warehousing_id', 'file','other_data', 'audit_status', 'store_staff_id', 'is_arrears']; $query = BeforehandOrder::where($this->searchWhere); return $query ->field($file) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index c492c2105..63bdb3a90 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -1133,4 +1133,21 @@ class BeforehandOrderLogic extends BaseLogic } } + public static function transfer($params) + { + Db::startTrans(); + try { + $order = BeforehandOrder::where('id', $params['id'])->findOrEmpty()->toArray(); + if ($order['is_arrears'] != 1) { + throw new BusinessException('该订单已转欠款'); + } + AccountsReceivableLogic::add($order); + BeforehandOrder::where('id', $params['id'])->update(['is_arrears' => 2]); + Db::commit(); + } catch (\Exception $e) { + Db::rollback(); + throw new BusinessException($e->getMessage()); + } + } + }