|
@@ -369,9 +369,8 @@ class ProductService extends Service
|
|
|
$title = BasicType::where('id',$customer['unit'])->value('title');
|
|
|
$customer['unit_name'] = $title;
|
|
|
//库存
|
|
|
- $customer['product_inventory'] = $depart_id = [];
|
|
|
- if($user['id'] != Employee::SPECIAL_ADMIN) $depart_id = array_column($user['rule_depart'],'depart_id');
|
|
|
- $inventory = $this->getProductInventory([$data['id']], $depart_id);
|
|
|
+ $customer['product_inventory'] = [];
|
|
|
+ $inventory = $this->getProductInventory([$data['id']]);
|
|
|
if(! empty($inventory)) $customer['product_inventory'] = $inventory;
|
|
|
|
|
|
$customer['img'] = $customer['file'] = $customer['depart'] = $customer['employee'] = [];
|
|
@@ -501,14 +500,11 @@ class ProductService extends Service
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
- public function getProductInventory($product_id = [],$depart_id = []){
|
|
|
+ public function getProductInventory($product_id = []){
|
|
|
if(empty($product_id)) return [];
|
|
|
|
|
|
$result = ProductInventory::whereIn('product_id',$product_id)
|
|
|
- ->when(! empty($depart_id), function ($query) use ($depart_id) {
|
|
|
- return $query->whereIn('depart_id', $depart_id);
|
|
|
- })
|
|
|
- ->select('id','product_id','number','depart_id','lock_number')
|
|
|
+ ->select('id','product_id','number','lock_number')
|
|
|
->get()
|
|
|
->toArray();
|
|
|
|