新增批量设置采购信息功能并优化搜索条件
- 在 PurchaseProductOfferController 中添加 setBatchProcureInfo 方法,实现批量设置采购信息的功能 - 在 PurchaseProductOfferLogic 中实现 setBatchProcureInfo 逻辑,支持批量保存采购信息 - 更新 BeforehandOrderLists 和 PurchaseProductOfferLists 中的搜索条件,增加新的搜索字段 - 优化 PurchaseProductOfferLogic 中的 outbound_price 字段赋值逻辑,防止空值导致的错误
This commit is contained in:
parent
b37080e873
commit
d1d019ac16
@ -75,10 +75,14 @@ class PurchaseProductOfferController extends BaseAdminController
|
|||||||
{
|
{
|
||||||
$params = $this->request->post();
|
$params = $this->request->post();
|
||||||
PurchaseProductOfferLogic::setProcureInfo($params);
|
PurchaseProductOfferLogic::setProcureInfo($params);
|
||||||
|
|
||||||
return $this->success('设置成功', [], 1, 1);
|
return $this->success('设置成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
|
public function setBatchProcureInfo()
|
||||||
|
{
|
||||||
|
$params = $this->request->post();
|
||||||
|
PurchaseProductOfferLogic::setBatchProcureInfo($params);
|
||||||
|
return $this->success('设置成功', [], 1, 1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 删除采购供应链商品
|
* @notes 删除采购供应链商品
|
||||||
|
@ -27,7 +27,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['store_id', 'order_id', 'uid','paid','status',],
|
'=' => ['store_id', 'order_id', 'uid','paid','status','order_type'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ class PurchaseProductOfferLists extends BaseAdminDataLists implements ListsSearc
|
|||||||
public function setSearch(): array
|
public function setSearch(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'=' => ['order_id'],
|
'=' => ['order_id','buyer_confirm'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
'buyer_nums' => $params['buyer_nums'],
|
'buyer_nums' => $params['buyer_nums'],
|
||||||
'supplier_id' => $params['supplier_id'],
|
'supplier_id' => $params['supplier_id'],
|
||||||
'price' => $params['purchase'],
|
'price' => $params['purchase'],
|
||||||
'outbound_price' => $params['outbound_price'],
|
'outbound_price' => $params['outbound_price']??0,
|
||||||
'total_price' => $params['total_price'],
|
'total_price' => $params['total_price'],
|
||||||
'pay_type' => $params['pay_type']??0,
|
'pay_type' => $params['pay_type']??0,
|
||||||
'buyer_confirm' => 1,
|
'buyer_confirm' => 1,
|
||||||
@ -124,7 +124,38 @@ class PurchaseProductOfferLogic extends BaseLogic
|
|||||||
throw new BusinessException($e->getMessage());
|
throw new BusinessException($e->getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* @notes 设置批量采购信息
|
||||||
|
* @param array $params
|
||||||
|
* @return bool
|
||||||
|
* @author admin
|
||||||
|
* @date 2024/08/14 15:06
|
||||||
|
*/
|
||||||
|
public static function setBatchProcureInfo(array $params): bool
|
||||||
|
{
|
||||||
|
Db::startTrans();
|
||||||
|
try {
|
||||||
|
$data=[];
|
||||||
|
foreach($params['product_arr'] as $k=>$v){
|
||||||
|
$data[]=[
|
||||||
|
'id'=>$v['id'],
|
||||||
|
'total_price'=>$v['total_price'],
|
||||||
|
'price'=>$v['purchase'],
|
||||||
|
'buyer_nums'=>$v['buyer_nums'],
|
||||||
|
'supplier_id'=>$params['supplier_id'],
|
||||||
|
'outbound_price'=>0,
|
||||||
|
'pay_type'=>$v['pay_type']??0,
|
||||||
|
'buyer_confirm'=>1,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
(new PurchaseProductOffer())->saveAll($data);
|
||||||
|
Db::commit();
|
||||||
|
return true;
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
Db::rollback();
|
||||||
|
throw new BusinessException($e->getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 是否需采购
|
* 是否需采购
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user