|
@@ -12,7 +12,7 @@ use App\Model\InvoiceOrderInfo;
|
|
|
use App\Model\Product;
|
|
|
use App\Model\ProductCategory;
|
|
|
use App\Model\ProductInventory;
|
|
|
-use App\Model\ProductInventorySet;
|
|
|
+use App\Model\ProductInventorySettings;
|
|
|
use App\Model\PurchaseOrder;
|
|
|
use App\Model\ReturnExchangeOrder;
|
|
|
use App\Model\SalesOrder;
|
|
@@ -101,7 +101,7 @@ class ProductInventoryService extends Service
|
|
|
//是否使用锁定库存校验 默认使用
|
|
|
$depart = array_shift($user['rule_depart']);
|
|
|
$is_stock = empty($depart['is_stock']) ? 1 : $depart['is_stock'];
|
|
|
- if($is_stock == ProductInventorySet::type_two) return;
|
|
|
+ if($is_stock == ProductInventorySettings::type_two) return;
|
|
|
|
|
|
//产品数扣减
|
|
|
if(! empty($save_total)){
|
|
@@ -154,7 +154,7 @@ class ProductInventoryService extends Service
|
|
|
if(! isset($stock[$key])) return [false,'产品:'. $pro_title .'库存不存在'];
|
|
|
$stock_product = $stock[$key];
|
|
|
|
|
|
- if($is_stock == ProductInventorySet::type_one){
|
|
|
+ if($is_stock == ProductInventorySettings::type_one){
|
|
|
//校验锁定库存
|
|
|
$save_data = $product_save[$key] ?? 0;//已保存数量
|
|
|
$tmp_lock = ($stock_product['lock_number'] > 0 ? $stock_product['lock_number'] : 0) - $save_data;
|
|
@@ -338,13 +338,38 @@ class ProductInventoryService extends Service
|
|
|
return $array;
|
|
|
}
|
|
|
|
|
|
- //库存设置列表
|
|
|
- public function productInventorySetList($data, $user){
|
|
|
- $model = new ProductInventorySet(['userData' => $user, 'search' => $data]);
|
|
|
+ //库存设置列表 todo
|
|
|
+ public function productInventorySetList1($data, $user){
|
|
|
+ $model = new ProductInventorySettings(['userData' => $user, 'search' => $data]);
|
|
|
$list = $model->where('del_time',0)
|
|
|
->where('param_one','>',0)
|
|
|
->select('id','top_depart_id','param_one')
|
|
|
->get()->toArray();
|
|
|
+dump($list);die;
|
|
|
+ $map = Depart::whereIn('id',array_column($list,'top_depart_id'))->pluck('title','id')->toArray();
|
|
|
+ foreach ($list as $key => $value){
|
|
|
+ $list[$key]['top_depart_title'] = $map[$value['top_depart_id']] ?? "";
|
|
|
+ }
|
|
|
+
|
|
|
+ return [true, $list];
|
|
|
+ }
|
|
|
+
|
|
|
+ //库存设置列表
|
|
|
+ public function productInventorySetList($data, $user){
|
|
|
+ $model = new ProductInventorySettings();
|
|
|
+ $model = $model->where('del_time',0)
|
|
|
+ ->where('param_one','>',0)
|
|
|
+ ->select('id','top_depart_id','param_one');
|
|
|
+
|
|
|
+ if(empty($data['top_depart_id'])){
|
|
|
+ //默认进来 只显示自己公司下的 自己权限范围下的部门数据
|
|
|
+ $top_depart_id = $user['depart_top'][0] ?? [];
|
|
|
+ $top_depart_id = $top_depart_id['depart_id'] ?? 0;
|
|
|
+ }else{
|
|
|
+ $top_depart_id = $data['top_depart_id'];
|
|
|
+ }
|
|
|
+ $model->where('top_depart_id', $top_depart_id);
|
|
|
+ $list = $model->get()->toArray();
|
|
|
|
|
|
$map = Depart::whereIn('id',array_column($list,'top_depart_id'))->pluck('title','id')->toArray();
|
|
|
foreach ($list as $key => $value){
|
|
@@ -358,7 +383,7 @@ class ProductInventoryService extends Service
|
|
|
public function productInventorySet($data, $user){
|
|
|
if(empty($data['id'])) return [false, 'ID不能为空'];
|
|
|
|
|
|
- ProductInventorySet::where('id',$data['id'])
|
|
|
+ ProductInventorySettings::where('id',$data['id'])
|
|
|
->update(['param_one' => $data['param_one']]);
|
|
|
|
|
|
return [true, ''];
|