修改预订单出库的错误

This commit is contained in:
lewis 2025-01-20 15:51:42 +08:00
parent 29c7f1494a
commit 63f4285759
2 changed files with 6 additions and 3 deletions

View File

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

View File

@ -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();