|
@@ -24,7 +24,7 @@ class Stock extends Backend
|
|
|
*/
|
|
*/
|
|
|
protected $model = null;
|
|
protected $model = null;
|
|
|
protected $importHeadType = 'name';//以字段名为EXCEL表格首行
|
|
protected $importHeadType = 'name';//以字段名为EXCEL表格首行
|
|
|
-
|
|
|
|
|
|
|
+ protected $noNeedLogin = ['warning'];
|
|
|
public function _initialize()
|
|
public function _initialize()
|
|
|
{
|
|
{
|
|
|
parent::_initialize();
|
|
parent::_initialize();
|
|
@@ -66,7 +66,20 @@ class Stock extends Backend
|
|
|
->where($map)
|
|
->where($map)
|
|
|
->order($sort, $order)
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
->paginate($limit);
|
|
|
- $result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
|
|
|
|
|
+ //数量低于L库存标识为1
|
|
|
|
|
+ foreach($list as &$v){
|
|
|
|
|
+ if($v['l_number']>=$v['number']){
|
|
|
|
|
+ $v['warning']=1;
|
|
|
|
|
+ }else{
|
|
|
|
|
+ $v['warning']=0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ $res = $list->items();
|
|
|
|
|
+ //低于L库存的排在顶部
|
|
|
|
|
+ $pros4 = array_column($list->items(), 'warning');
|
|
|
|
|
+ $pros5 = array_column($list->items(), 'id');
|
|
|
|
|
+ array_multisort($pros4,SORT_DESC,$pros5,SORT_DESC,$res);
|
|
|
|
|
+ $result = ['total' => $list->total(), 'rows' => $res];
|
|
|
return json($result);
|
|
return json($result);
|
|
|
}
|
|
}
|
|
|
/**
|
|
/**
|