diff --git a/app/admin/lists/warehouse_order/WarehouseOrderLists.php b/app/admin/lists/warehouse_order/WarehouseOrderLists.php index 9e57f516e..22193d91e 100644 --- a/app/admin/lists/warehouse_order/WarehouseOrderLists.php +++ b/app/admin/lists/warehouse_order/WarehouseOrderLists.php @@ -49,7 +49,7 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter public function lists(): array { return WarehouseOrder::where($this->searchWhere) - ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'code', 'financial_pm', 'admin_id', 'batch', 'mark', 'purchase', 'total_price', 'status', 'create_time', 'completed_amount', 'outstanding_amount']) + ->field(['id', 'warehouse_id', 'supplier_id', 'store_id', 'code', 'financial_pm', 'admin_id', 'batch', 'mark', 'purchase', 'total_price', 'status', 'create_time', 'completed_amount', 'outstanding_amount', 'oid']) ->limit($this->limitOffset, $this->limitLength) ->order(['id' => 'desc']) ->select()->each(function ($item) { diff --git a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php index 13ad4ad0a..214111352 100644 --- a/app/admin/logic/beforehand_order/BeforehandOrderLogic.php +++ b/app/admin/logic/beforehand_order/BeforehandOrderLogic.php @@ -389,7 +389,7 @@ class BeforehandOrderLogic extends BaseLogic Db::startTrans(); try { $arr = [ - 'oid' => 0, + 'oid' => $order['id'], 'warehouse_id' => $warehouse_id, 'store_id' => $store_id, 'supplier_id' => 0, @@ -436,7 +436,10 @@ class BeforehandOrderLogic extends BaseLogic } $finds = WarehouseProduct::where('oid', $res['id'])->field('sum(nums) as nums,sum(total_price) as total_price')->find(); WarehouseOrder::where('id', $res['id'])->update(['total_price' => $totalPrice, 'nums' => $finds['nums']]); - $order->save(['outbound_id' => $res['id'], 'is_outbound' => 1, 'pay_price' => $totalPrice]); + $result = BeforehandOrder::where('id', $order['id'])->where('outbound_id', 0)->where('is_outbound', 0)->update(['outbound_id' => $res['id'], 'is_outbound' => 1, 'pay_price' => $totalPrice]); + if (!$result) { + throw new BusinessException('出库失败,预订单更新出错'); + } BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->update(['is_buyer' => -1]); self::confirm(['id' => $params['bhoid']]); Db::commit();