修改预订单出库的错误
This commit is contained in:
parent
29c7f1494a
commit
63f4285759
@ -49,7 +49,7 @@ class WarehouseOrderLists extends BaseAdminDataLists implements ListsSearchInter
|
|||||||
public function lists(): array
|
public function lists(): array
|
||||||
{
|
{
|
||||||
return WarehouseOrder::where($this->searchWhere)
|
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)
|
->limit($this->limitOffset, $this->limitLength)
|
||||||
->order(['id' => 'desc'])
|
->order(['id' => 'desc'])
|
||||||
->select()->each(function ($item) {
|
->select()->each(function ($item) {
|
||||||
|
@ -389,7 +389,7 @@ class BeforehandOrderLogic extends BaseLogic
|
|||||||
Db::startTrans();
|
Db::startTrans();
|
||||||
try {
|
try {
|
||||||
$arr = [
|
$arr = [
|
||||||
'oid' => 0,
|
'oid' => $order['id'],
|
||||||
'warehouse_id' => $warehouse_id,
|
'warehouse_id' => $warehouse_id,
|
||||||
'store_id' => $store_id,
|
'store_id' => $store_id,
|
||||||
'supplier_id' => 0,
|
'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();
|
$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']]);
|
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]);
|
BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->update(['is_buyer' => -1]);
|
||||||
self::confirm(['id' => $params['bhoid']]);
|
self::confirm(['id' => $params['bhoid']]);
|
||||||
Db::commit();
|
Db::commit();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user