Merge pull request '添加预订单商品关联采购订单' (#472) from dev into main

Reviewed-on: #472
This commit is contained in:
mkm 2025-01-16 17:09:41 +08:00
commit 81ba9228c5
4 changed files with 6 additions and 5 deletions

View File

@ -77,7 +77,7 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
}
}
$list = BeforehandOrderCartInfo::where($this->searchWhere)
->field(['id', 'bhoid', 'package', 'store_info', 'marques', 'gross_weight', 'net_weight', 'accept_num', 'after_sales', 'loss', 'uid', 'pay_price', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark','create_time'])
->field(['id', 'bhoid', 'package', 'store_info', 'marques', 'gross_weight', 'net_weight', 'accept_num', 'after_sales', 'loss', 'uid', 'pay_price', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark','create_time', 'procurement_order_id'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()->each(function ($item) use ($system_store, $order_mark) {

View File

@ -370,7 +370,7 @@ class BeforehandOrderLogic extends BaseLogic
$info = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select();
foreach ($info as $k => $v) {
if ($v['pay_price'] <= 0) {
throw new BusinessException('商品价格空 不能生成出库订单,对应id:' . $v['id']);
throw new BusinessException('商品价格空 不能生成出库订单,对应id:' . $v['id']);
}
}
$count = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->where('cart_num', 0)->count('id');
@ -426,6 +426,7 @@ 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' => $finds['total_price'], 'nums' => $finds['nums']]);
$order->save(['outbound_id' => $res['id'], 'is_outbound' => 1, 'pay_price' => $finds['total_price']]);
BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->update(['is_buyer' => -1]);
Db::commit();
return true;
} catch (\Throwable $e) {

View File

@ -99,7 +99,7 @@ class PurchaseProductOfferLogic extends BaseLogic
]
]);
}
BeforehandOrderCartInfo::where(['bhoid' => $params['order_id'], 'product_id' => $params['product_id']])->update(['is_buyer' => 1]);
BeforehandOrderCartInfo::where(['bhoid' => $params['order_id'], 'product_id' => $params['product_id']])->update(['is_buyer' => 1, 'procurement_order_id' => $procurementOrder['id']]);
Db::commit();
return true;
} catch (\Exception $e) {

View File

@ -556,9 +556,9 @@ function channelLog($data, $type, $title = '更新前')
* @param pm 1:增加 -1:减少
* @param url 请求地址
*/
function SqlChannelLog($model='', $id=0, $nums=0,$pm=0,$url='',$admin_id=0):void
function SqlChannelLog($model='', $id=0, $nums=0,$pm=0,$url='',$admin_id=0, $remark = ''):void
{
(new ChangeLogLogic())->insert($model, $id, $nums, $pm, $url,$admin_id);
(new ChangeLogLogic())->insert($model, $id, $nums, $pm, $url,$admin_id, $remark);
}
/**
* 价格日志记录