|
@@ -18,6 +18,7 @@ use App\Model\SalesFrom;
|
|
|
use App\Model\ScrappCount;
|
|
|
use App\Model\SystemL;
|
|
|
use App\Model\Team;
|
|
|
+use App\Service\EquipmentService;
|
|
|
use App\Service\FyySqlServerService;
|
|
|
use App\Service\ReportFormsService;
|
|
|
use Carbon\Carbon;
|
|
@@ -440,7 +441,8 @@ class ScreenController extends BaseController
|
|
|
public function product_num(Request $request){
|
|
|
//数据模型
|
|
|
$models = [];
|
|
|
- foreach (SystemL::$device as $k => $v){
|
|
|
+ $device = (new EquipmentService())->getDeviceList();
|
|
|
+ foreach ($device as $k => $v){
|
|
|
$models[$k] = [
|
|
|
"machine_day_num"=> 0,
|
|
|
"machine_month_num"=> 0,
|
|
@@ -467,7 +469,7 @@ class ScreenController extends BaseController
|
|
|
->whereIn('data_point_name',[SystemL::run,SystemL::work,SystemL::stop,SystemL::standBy])
|
|
|
->get()->toArray();
|
|
|
//组织当日数据
|
|
|
- $this->fillData($today,1,$models);
|
|
|
+ $this->fillData($today,1,$models,$device);
|
|
|
|
|
|
//上周时间
|
|
|
$previousWeekStartDate = Carbon::now()->subWeek()->startOfWeek();
|
|
@@ -487,12 +489,12 @@ class ScreenController extends BaseController
|
|
|
->whereIn('data_point_name',[SystemL::run,SystemL::work,SystemL::stop,SystemL::standBy])
|
|
|
->get()->toArray();
|
|
|
//组织上周数据
|
|
|
- $this->fillData($list_week,2,$models);
|
|
|
+ $this->fillData($list_week,2,$models,$device);
|
|
|
//缓存
|
|
|
// Cache::put($last_week_key,json_encode($list_week),86400);
|
|
|
}else{
|
|
|
//有缓存 填充数据 组织上周数据
|
|
|
- $this->fillData($return_last_week,2,$models);
|
|
|
+ $this->fillData($return_last_week,2,$models,$device);
|
|
|
}
|
|
|
|
|
|
//上月时间
|
|
@@ -513,12 +515,12 @@ class ScreenController extends BaseController
|
|
|
->whereIn('data_point_name',[SystemL::run,SystemL::work,SystemL::stop,SystemL::standBy])
|
|
|
->get()->toArray();
|
|
|
//组织上月数据
|
|
|
- $this->fillData($list_month,3,$models);
|
|
|
+ $this->fillData($list_month,3,$models,$device);
|
|
|
//缓存
|
|
|
// Cache::put($last_month_key,json_encode($list_month),86400);
|
|
|
}else{
|
|
|
//有缓存 填充数据 组织上周数据
|
|
|
- $this->fillData($return_last_month,3,$models);
|
|
|
+ $this->fillData($return_last_month,3,$models,$device);
|
|
|
}
|
|
|
|
|
|
$return = [];
|
|
@@ -603,7 +605,7 @@ class ScreenController extends BaseController
|
|
|
* @param $type
|
|
|
* @param $models
|
|
|
*/
|
|
|
- public function fillData($list,$type,&$models){
|
|
|
+ public function fillData($list,$type,&$models,$device){
|
|
|
if(empty($list)) return;
|
|
|
|
|
|
$run_time = $process_time = $fault = $start_time = [];
|
|
@@ -637,7 +639,7 @@ class ScreenController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- foreach (SystemL::$device as $key => $value){
|
|
|
+ foreach ($device as $key => $value){
|
|
|
//运行次数
|
|
|
$run_num = $run_time[$key] ?? 0;
|
|
|
//工作次数
|
|
@@ -781,8 +783,9 @@ class ScreenController extends BaseController
|
|
|
//数据模型
|
|
|
$models = [];
|
|
|
$is_all_close = 1;
|
|
|
- $e_map = Equipment::where('del_time',0)->pluck('id','code');
|
|
|
- foreach (SystemL::$device as $k => $v){
|
|
|
+ $e_map = Equipment::where('del_time',0)->pluck('id','code')->toArray();
|
|
|
+ $device = (new EquipmentService())->getDeviceList();
|
|
|
+ foreach ($device as $k => $v){
|
|
|
$is_close = 1;
|
|
|
if(isset($map[$v])){
|
|
|
$max_time = intval($map[$v]['max_time']) ?? 0;
|