refactor(admin): 优化前置订单出库逻辑
- 将 BeforehandOrderCartInfo 的查询结果转换为数组,以便后续处理 - 注释掉的代码片段显示了库存验证的逻辑,但已被移除 - 移除了冗余的库存验证逻辑,简化了订单处理流程
This commit is contained in:
parent
b793ace840
commit
14b08b8f43
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user