From 14b08b8f4352806573a7125cf2d1f14a37dcc8f2 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Wed, 5 Feb 2025 11:23:55 +0800 Subject: [PATCH] =?UTF-8?q?refactor(admin):=20=E4=BC=98=E5=8C=96=E5=89=8D?= =?UTF-8?q?=E7=BD=AE=E8=AE=A2=E5=8D=95=E5=87=BA=E5=BA=93=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 BeforehandOrderCartInfo 的查询结果转换为数组,以便后续处理 - 注释掉的代码片段显示了库存验证的逻辑,但已被移除 - 移除了冗余的库存验证逻辑,简化了订单处理流程 --- .../logic/beforehand_order/BeforehandOrderLogic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index de88b04fc..27b5b6c4d 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -29,6 +29,7 @@ use app\common\model\user_ship\UserShip; use app\common\model\warehouse_order\WarehouseOrder; use app\common\model\warehouse_product\WarehouseProduct; use app\common\model\warehouse_product_return\WarehouseProductReturn; +use app\common\model\warehouse_product_storege\WarehouseProductStorege; use app\common\service\xlsx\OrderAllocation; use app\common\service\xlsx\OrderInfo; use app\common\service\xlsx\OrderList; @@ -373,11 +374,20 @@ class BeforehandOrderLogic extends BaseLogic if ($order['outbound_id'] > 0) { throw new BusinessException('该订单已创建出库单'); } - $info = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select(); + $info = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select()->toArray(); + // $product_column = array_column($info, 'product_id'); + // $storege_arr=WarehouseProductStorege::where('warehouse_id', $params['warehouse_id'])->where('product_id','in',$product_column)->select(); foreach ($info as $k => $v) { if ($v['pay_price'] <= 0) { throw new BusinessException('商品价格为空 不能生成出库订单,对应id:' . $v['id']); } + // foreach ($storege_arr as $key => $value) { + // if ($value['is_verify']==1 && $v['product_id'] == $value['product_id']) { + // if ($v['cart_num'] > $value['nums']) { + // throw new BusinessException('仓库库存不足 不能生成出库订单,对应id:' . $v['id']); + // } + // } + // } } $count = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->where('cart_num', 0)->count('id'); if ($count > 0) {