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) {