commit
7348dd425d
@ -83,6 +83,9 @@ class PurchaseProductOfferController extends BaseAdminController
|
||||
PurchaseProductOfferLogic::setBatchProcureInfo($params);
|
||||
return $this->success('设置成功', [], 1, 1);
|
||||
}
|
||||
/**
|
||||
* 设置仓库商品信息
|
||||
*/
|
||||
public function setStoreroomInfo()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
|
@ -303,6 +303,10 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
throw new BusinessException('该订单已创建出库单');
|
||||
}
|
||||
$info = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->select();
|
||||
$count = BeforehandOrderCartInfo::where('bhoid', $params['bhoid'])->where('cart_num',0)->count('id');
|
||||
if($count > 0){
|
||||
throw new BusinessException('订单中有数量为0的商品,请先处理');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$arr = [
|
||||
|
@ -8,6 +8,7 @@ use app\common\logic\BaseLogic;
|
||||
use app\common\model\beforehand_order\BeforehandOrder;
|
||||
use app\common\model\purchase_product_offer\PurchaseProductOffer;
|
||||
use app\common\model\warehouse_order\WarehouseOrder;
|
||||
use app\common\model\warehouse_product\WarehouseProduct;
|
||||
use support\exception\BusinessException;
|
||||
use think\facade\Db;
|
||||
|
||||
@ -100,9 +101,14 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
if($params['admin_id']==23&&$params['purchases']!=$find['price'] ){
|
||||
throw new BusinessException('当前账号没有权限编辑价格, 请联系管理员修改');
|
||||
}
|
||||
if($params['total_price']<=0){
|
||||
$total_price=bcmul($params['purchases'],$params['nums'],2);
|
||||
}else{
|
||||
$total_price=$params['total_price'];
|
||||
}
|
||||
$find->save([
|
||||
'price' => $params['purchases'],
|
||||
'total_price' => bcmul($params['purchases'],$params['nums'],2),
|
||||
'total_price' => $total_price,
|
||||
'cart_num' => $params['nums'],
|
||||
]);
|
||||
$bhoid = $params['bhoid'];
|
||||
@ -110,7 +116,17 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
if($find['is_buyer']==1){
|
||||
PurchaseProductOffer::where('order_id',$bhoid)->where('product_id',$find['product_id'])->update(['need_num'=>$params['nums']]);
|
||||
}
|
||||
BeforehandOrder::where('id', $bhoid)->update(['total_price' => $info['total_price'], 'total_num' => $info['cart_num']]);
|
||||
$order=BeforehandOrder::where('id', $bhoid)->find();
|
||||
$order->update(['total_price' => $info['total_price'], 'total_num' => $info['cart_num']]);
|
||||
|
||||
if($order['outbound_id']>0){
|
||||
$wp= WarehouseProduct::where('oid',$order['outbound_id'])->where('product_id',$find['product_id'])->where('financial_pm',0)->find();
|
||||
if($wp){
|
||||
$wp->update(['price'=>$params['purchases'],'total_price'=>$total_price]);
|
||||
$wp_total_price=WarehouseProduct::where('oid', $order['outbound_id'])->where('financial_pm',0)->sum('total_price');
|
||||
WarehouseOrder::where('id', $order['outbound_id'])->update(['total_price' => $wp_total_price]);
|
||||
}
|
||||
}
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Throwable $e) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user