| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704 | <?phpnamespace App\Service;use App\Model\BasicType;use App\Model\Construction;use App\Model\ConstructionProductInfo;use App\Model\Employee;use App\Model\Product;use App\Model\ProductActivity;use App\Model\ProductActivityPrice;use App\Model\RoleMenuButton;use App\Model\Schedule;use App\Model\ScheduleDetail;use App\Model\ScheduleInfo;use App\Model\SeeRange;use Illuminate\Support\Facades\DB;class ScheduleService extends Service{    public function edit($data,$user){        list($status,$msg) = $this->scheduleRule($data, $user, false);        if(!$status) return [$status,$msg];        try {            DB::beginTransaction();            $model = Schedule::where('id',$data['id'])->first();            $model->start_time = $data['start_time'] ?? 0;            $model->end_time = $data['end_time'] ?? 0;            $model->mark = $data['mark'] ?? '';            $model->save();            $time = time();            ScheduleDetail::where('schedule_id',$data['id'])                ->where('del_time',0)                ->update(['del_time' => $time]);            ScheduleInfo::where('schedule_id',$data['id'])                ->where('del_time',0)                ->update(['del_time' => $time]);            if(! empty($data['day_time'])){                $insert_detail = $insert = [];                foreach ($data['day_time'] as $value){                    $insert_detail[] = [                        'schedule_id' => $model->id,                        'crt_time' => $time,                        'start_time' => $value['start_time'] ?? "",                        'end_time' => $value['end_time'] ?? "",                        'num' => $value['num'] ?? 0,                    ];                    for ($i=0;$i<$value['num'];$i++){                        foreach ($data['time_range'] as $range){                            $date = date('Y-m-d',$range);                            $start_time = strtotime($date . " " .$value['start_time']);                            $end_time = strtotime($date . " " .$value['end_time']);                            $insert[] = [                                'schedule_id' => $model->id,                                'crt_time' => $time,                                'day' => $range ?? 0, //0点的时间戳                                'start_time' => $start_time ?? 0, //加上开始时间段                                'end_time' => $end_time ?? 0,//加上结束时间段                            ];                        }                    }                }                ScheduleDetail::insert($insert_detail);                ScheduleInfo::insert($insert);            }            DB::commit();        }catch (\Exception $exception){            DB::rollBack();            return [false,$exception->getMessage()];        }        return [true,''];    }    public function add($data,$user){        list($status,$msg) = $this->scheduleRule($data, $user);        if(!$status) return [$status,$msg];        try {            DB::beginTransaction();            $model = new Schedule();            $model->start_time = $data['start_time'] ?? 0;            $model->end_time = $data['end_time'] ?? 0;            $model->mark = $data['mark'] ?? '';            $model->crt_id = $user['id'];            $model->depart_id = $data['depart_id'] ?? 0;            $model->top_depart_id = $data['top_depart_id'] ?? 0;            $model->save();            $time = time();            if(! empty($data['day_time'])){                $insert_detail = $insert = [];                foreach ($data['day_time'] as $value){                    $insert_detail[] = [                        'schedule_id' => $model->id,                        'crt_time' => $time,                        'start_time' => $value['start_time'] ?? "",                        'end_time' => $value['end_time'] ?? "",                        'num' => $value['num'] ?? 0,                    ];                    for ($i=0;$i<$value['num'];$i++){                        foreach ($data['time_range'] as $range){                            $date = date('Y-m-d',$range);                            $start_time = strtotime($date . " " .$value['start_time']);                            $end_time = strtotime($date . " " .$value['end_time']);                            $insert[] = [                                'schedule_id' => $model->id,                                'crt_time' => $time,                                'day' => $range ?? 0, //0点的时间戳                                'start_time' => $start_time ?? 0, //加上开始时间段                                'end_time' => $end_time ?? 0,//加上结束时间段                            ];                        }                    }                }                ScheduleDetail::insert($insert_detail);                ScheduleInfo::insert($insert);            }            DB::commit();        }catch (\Exception $exception){            DB::rollBack();            return [false,$exception->getMessage()];        }        return [true,''];    }    public function del($data){        if($this->isEmpty($data,'id')) return [false,'请选择数据!'];        $boolean = Construction::where('del_time',0)            ->where('schedule_id',$data['id'])            ->exists();        if($boolean) return [false,'施工单已使用排期,操作失败!'];        try {            DB::beginTransaction();            $time = time();            Schedule::where('id',$data['id'])->update(['del_time' => $time]);            ScheduleDetail::where('schedule_id',$data['id'])                ->where('del_time',0)                ->update(['del_time' => $time]);            ScheduleInfo::where('schedule_id',$data['id'])                ->where('del_time',0)                ->update(['del_time' => $time]);            DB::commit();        }catch (\Exception $exception){            DB::rollBack();            return [false,$exception->getMessage()];        }        return [true,''];    }    public function detail($data,$user){        if($this->isEmpty($data,'id')) return [false,'请选择数据!'];        $schedule = Schedule::where('del_time',0)            ->where('id',$data['id'])            ->first();        if(empty($schedule)) return [false,'排班设置不存在或已被删除'];        $schedule = $schedule->toArray();        $schedule['choose'] = 1;        $info = ScheduleDetail::where('del_time',0)            ->where('schedule_id',$data['id'])            ->select('start_time','end_time','num')            ->get()->toArray();        $schedule['detail'] = array_values($info);        $schedule['crt_name'] = Employee::where('id',$schedule['crt_id'])->value('emp_name');        $schedule['crt_time'] = $schedule['crt_time'] ? date("Y-m-d H:i:s",$schedule['crt_time']): '';        return [true, $schedule];    }    //暂时不用    public function detail2($data,$user){        if($this->isEmpty($data,'id')) return [false,'请选择数据!'];        $schedule = Schedule::where('del_time',0)            ->where('id',$data['id'])            ->first();        if(empty($schedule)) return [false,'排班设置不存在或已被删除'];        $schedule = $schedule->toArray();        $date1 = date("Y-m-d", $schedule['start_time']);        $date2 = date("Y-m-d", $schedule['end_time']);        $datetime1 = new \DateTime($date1);        $datetime2 = new \DateTime($date2);        $interval = $datetime1->diff($datetime2);        $day = $interval->days + 1;        $info = ScheduleInfo::where('del_time',0)            ->where('schedule_id',$data['id'])            ->select('start_time','end_time','num')            ->get()->toArray();        $infos = [];        foreach ($info as $value){            $start_time = date("H:i",$value['start_time']);            $end_time = date("H:i",$value['end_time']);            if(isset($infos[$start_time . $end_time])){                $infos[$start_time . $end_time]['num'] += 1;            }else{                $infos[$start_time . $end_time] = [                    'start_time' => $start_time,                    'end_time' => $end_time,                    'num' => 1,                    'choose' => 1,                ];            }        }        foreach ($infos as $key => $value){            $infos[$key]['num'] = $value['num'] / $day;        }        ksort($infos);        $schedule['detail'] = array_values($infos);        $schedule['crt_name'] = Employee::where('id',$schedule['crt_id'])->value('emp_name');        $schedule['crt_time'] = $schedule['crt_time'] ? date("Y-m-d H:i:s",$schedule['crt_time']): '';        return [true, $schedule];    }    public function getList($data,$user){        $model = Schedule::TopClear($user,$data);        $model = $model->where('del_time',0)            ->select('id','crt_id','mark','start_time','end_time','crt_time')            ->orderby('id', 'desc');        if(! empty($data['mark'])) $model->where('mark', 'LIKE', '%'.$data['mark'].'%');        if(! empty($data['crt_time'][0]) && ! empty($data['crt_time'][1])) {            $return = $this->changeDateToTimeStampAboutRange($data['crt_time']);            $model->where('crt_time','>=',$return[0]);            $model->where('crt_time','<=',$return[1]);        }        if(! empty($data['schedule'][0]) && ! empty($data['schedule'][1])) {            $return = $this->changeDateToTimeStampAboutRange($data['schedule']);            $model->where('start_time','>=',$return[0]);            $model->where('end_time','<=',$return[1]);        }        $list = $this->limit($model,'',$data);        $list = $this->fillData($list,$user);        return [true, $list];    }    public function scheduleRule(&$data, $user, $is_add = true){        if(empty($data['schedule'][0]) || empty($data['schedule'][1])) return [false,'排班日期不能为空'];        $data['start_time'] = $this->changeDateToDate($data['schedule'][0]);        $data['end_time'] = $this->changeDateToDate($data['schedule'][1]);        $data['time_range'] = $this->getTimestampRange($data['start_time'],$data['end_time']);        if(empty($data['day_time'])) return [false,'排班时间段不能为空'];        foreach ($data['day_time'] as $value){            if(empty($value['start_time'])) return [false,'排班时间段开始时间不能为空'];            if(empty($value['end_time'])) return [false,'排班时间段结束时间不能为空'];            if(empty($value['num'])) return [false,'排班车间数量不能为空'];        }        if($is_add){            $model = Schedule::TopClear($user,$data);            $bool = $model->where('del_time',0)                ->where('start_time', '<=', $data['end_time'])                ->where('end_time', '>=', $data['start_time'])                ->exists();        }else{            if(empty($data['id'])) return [false,'ID不能为空'];            $model = Schedule::TopClear($user,$data);            $bool = $model->where('del_time',0)                ->where('id','<>',$data['id'])                ->where('start_time', '<=', $data['end_time'])                ->where('end_time', '>=', $data['start_time'])                ->exists();            $boolean = Construction::where('del_time',0)                ->where('schedule_id',$data['id'])                ->exists();            if($boolean) return [false,'施工单已使用排期,编辑失败!'];        }        if($bool) return [false,'排班日期已经设置,请不要重复设置!'];        //所属部门 以及 顶级部门        if(empty($data['depart_id'])) $data['depart_id'] = $this->getDepart($user);        $data['top_depart_id'] = $user['depart_map'][$data['depart_id']] ?? 0;        return [true, $data];    }    public function fillData($data, $user){        if(empty($data['data'])) return $data;        $emp = Employee::whereIn('id',array_unique(array_column($data['data'],'crt_id')))            ->pluck('emp_name','id')            ->toArray();        foreach ($data['data'] as $key => $value){            $start_time = $value['start_time'] ? date("Y-m-d",$value['start_time']) : '';            $end_time = $value['end_time'] ? date("Y-m-d",$value['end_time']) : '';            $data['data'][$key]['schedule'] = $start_time . '——' . $end_time;            $data['data'][$key]['crt_time'] = $value['crt_time'] ? date('Y-m-d H:i:s',$value['crt_time']) : '';            $data['data'][$key]['crt_name'] = $emp[$value['crt_id']] ?? '';        }        return $data;    }    public function scheduleGetForConstruction($data,$user){        if(empty($data['schedule'])) return [false,'请选择日期!'];        $schedule = $this->changeDateToDate($data['schedule']);        $model = Schedule::TopClear($user,$data);        $schedule_id = $model->where('del_time',0)            ->where('start_time', '<=', $schedule)            ->where('end_time', '>=', $schedule)            ->select('id')->get()->toArray();        $schedule_id = array_column($schedule_id,'id');        if(empty($schedule_id)) return [false,'该时间排班设置不存在或已被删除!'];        $schedule_detail_list = ScheduleInfo::where('del_time',0)            ->whereIn('schedule_id',$schedule_id)            ->where('day',$schedule)            ->where('is_use',ScheduleInfo::not_use)            ->select('schedule_id','day','start_time','end_time')            ->get()->toArray();        if(empty($schedule_detail_list)) return [false,'该时间排班已满、不存在或已被删除!'];        $return = [];        foreach ($schedule_detail_list as $value){            if(isset($return[$value['start_time'] . $value['end_time']])){                $return[$value['start_time'] . $value['end_time']]['num'] += 1;            }else{                $tmp['schedule_id'] = $value['schedule_id'];                $tmp['num'] = 1;                $tmp['day_stamp'] = $value['day'];                $tmp['day_start_stamp'] = $value['start_time'];                $tmp['day_end_stamp'] = $value['end_time'];                $tmp['day'] = date('Y-m-d',$value['day']);                $tmp['start_time'] = date('H:i',$value['start_time']);                $tmp['end_time'] = date('H:i',$value['end_time']);                $return[$value['start_time'] . $value['end_time']] = $tmp;            }        }        ksort($return);        return [true, array_values($return)];    }    public function getTimestampRange($startTimestamp, $endTimestamp){        // 将时间戳转换为日期格式        $startDate = date('Y-m-d', $startTimestamp);        $endDate = date('Y-m-d', $endTimestamp);        // 创建日期范围        $dateRange = [];        $currentDate = strtotime($startDate);        while ($currentDate <= strtotime($endDate)) {            $dateRange[] = $currentDate;            $currentDate = strtotime('+1 day', $currentDate);        }        // 将每个日期设置为当天的 0 点 0 分 0 秒并转换为时间戳        $zeroTimestamps = [];        foreach ($dateRange as $date) {            $zeroTimestamps[] = strtotime(date('Y-m-d 00:00:00', $date));        }        return $zeroTimestamps;    }    public function getScheduleSetting($data,$user){        $result['time'] = [];        $result['time_detail'] = [];        if(empty($data['schedule'])) return [true,$result];        // 获取指定年月的开始日期时间戳        $startTimestamp = strtotime($data['schedule'] . "-01");        // 获取下个月的开始日期时间戳,然后减去一秒得到本月的结束日期时间戳        $endTimestamp = strtotime("+1 month", $startTimestamp) - 1;        $model = Schedule::TopClear($user,$data);        $schedule = $model->where('del_time',0)            ->where('start_time', '>=', $startTimestamp)            ->where('end_time', '<=', $endTimestamp)            ->select('id','mark','start_time','end_time')            ->get()->toArray();        if(empty($schedule)) return [true,$result];        $schedule_array = $schedule_map = [];        foreach ($schedule as $value){            for ($i = $value['start_time']; $i <= $value['end_time']; $i += 86400) { // 每天86400秒                $schedule_array[] = date("Y-m-d", $i);                $schedule_map[$value['id']][] = date("Y-m-d", $i);            }        }        $schedule_id = array_column($schedule,'id');        $schedule_detail_info_list = ScheduleInfo::where('del_time',0)            ->whereIn('schedule_id',$schedule_id)            ->select('schedule_id','day','start_time','end_time')            ->where('is_use',ScheduleInfo::not_use)            ->get()->toArray();        $schedule_detail_info_list_map = [];        $count = [];        if(! empty($schedule_detail_info_list)) {            foreach ($schedule_detail_info_list as $value){                $keys = $value['schedule_id'] . $value['start_time'] . $value['end_time'];                if(isset($count[$keys])) continue;                $count[$keys] = 1;                $schedule_detail_info_list_map[$value['schedule_id']][] = [                    "schedule_id" => $value['schedule_id'],                    "day" => date('Y-m-d',$value['day']),                    "start_time" => date("H:i",$value['start_time']),                    "end_time" => date("H:i",$value['end_time']),                    "day_stamp" => $value['day'],                    "day_start_stamp" => $value['start_time'],                    "day_end_stamp" => $value['end_time'],                ];            }        }        //每个设置时间的数据        $return = [];        foreach ($schedule_map as $key => $value){            if(isset($schedule_detail_info_list_map[$key])){                foreach ($value as $v){                    $tmp = [];                    foreach ($schedule_detail_info_list_map[$key] as $vv){                        if($v == $vv['day']){                            $tmp[] = [                                "start_time" => $vv['start_time'],                                "end_time" => $vv['end_time'],                                "schedule_id" => $vv['schedule_id'],                                "day_stamp" => $vv['day_stamp'],                                "day_start_stamp" => $vv['day_start_stamp'],                                "day_end_stamp" => $vv['day_end_stamp'],                            ];                        }                    }                    if(! empty($tmp)){                        $return[$v] = [                            'time' => $v,                            'detail' => $tmp                        ];                    }                }            }        }        //已满日期        $full = [];        foreach ($schedule_array as $value){            if(! isset($return[$value])) $full[] = $value;        }        $result['time'] = $full;        $result['time_detail'] = array_values($return);        return [true, $result];    }    public function getSettingTotal($data,$user){        if(empty($data['schedule'])) return [true,""];        // 获取指定年月的开始日期时间戳        $startTimestamp = strtotime($data['schedule'] . "-01");        // 获取下个月的开始日期时间戳,然后减去一秒得到本月的结束日期时间戳        $endTimestamp = strtotime("+1 month", $startTimestamp) - 1;        $return = [];        for ($i = $startTimestamp; $i <= $endTimestamp; $i += 86400) { // 每天86400秒            $time = date("Y-m-d", $i);            $return[$i] = [                'time' => $time,                'num' => 0,                'order' => "",            ];        }        $model = Schedule::TopClear($user,$data);        $schedule = $model->where('del_time',0)            ->where('start_time', '>=', $startTimestamp)            ->where('end_time', '<=', $endTimestamp)            ->select('id')            ->get()->toArray();        if(empty($schedule)) return [true, array_values($return)];        $construction = Construction::where('del_time',0)            ->whereIn('schedule_id',array_column($schedule,'id'))            ->select('day_stamp','id')            ->get()->toArray();        foreach ($construction as $value){            if(isset($return[$value['day_stamp']])){                $return[$value['day_stamp']]['num'] += 1;                $return[$value['day_stamp']]['order'] .= $value['id'] . ',';            }        }        return [true, array_values($return)];    }    public function getSettingGetDetail($data, $user){        if(empty($data['order'])) return [true, ""];        $order_id = array_filter(explode(',', $data['order']));        if(empty($order_id)) return [true, ""];        $construction = Construction::where('del_time',0)            ->whereIn('id',$order_id)            ->select('id','order_number','crt_id','day_start_stamp','day_end_stamp')            ->get()->toArray();        if(empty($construction)) return [true, ""];        $emp = Employee::whereIn('id',array_unique(array_column($construction,'crt_id')))            ->pluck('emp_name','id')            ->toArray();        $product_title = [];        $product = ConstructionProductInfo::whereIn('construction_id',array_unique(array_column($construction,'id')))            ->select('product_id','construction_id')            ->get()->toArray();        $product_map = Product::whereIn('id',array_unique(array_column($product,'product_id')))            ->pluck('title','id')            ->toArray();        foreach ($product as $value){            if(! isset($product_title[$value['construction_id']])){                $product_title[$value['construction_id']] = $product_map[$value['product_id']];            }else{                $product_title[$value['construction_id']] .= "," . $product_map[$value['product_id']];            }        }        $return = [];        //可见范围        $employee = (new RangeService())->RangeConstructionEmpDetail($order_id);        foreach ($construction as $value){            $str = "";            if(! empty($value['day_start_stamp']) && ! empty($value['day_end_stamp'])) $str = date('Y-m-d H:i',$value['day_start_stamp']) . '-' . date("H:i",$value['day_end_stamp']);            $emp_tmp = $employee[$value['id']] ?? [];            $tmp = [                'id' => $value['id'],                'employee' => $emp_tmp,                'order_number' => $value['order_number'],                'crt_name' => $emp[$value['crt_id']] ?? "",                'product' => $product_title[$value['id']],                'crt_time' => $str,            ];            $return[] = $tmp;        }        return [true, $return];    }    public function getSettingTotal2($data,$user){        if(empty($data['schedule'])) return [true,""];        // 获取指定年月的开始日期时间戳        $startTimestamp = strtotime($data['schedule'] . "-01");        // 获取下个月的开始日期时间戳,然后减去一秒得到本月的结束日期时间戳        $endTimestamp = strtotime("+1 month", $startTimestamp) - 1;        $return = [];        for ($i = $startTimestamp; $i <= $endTimestamp; $i += 86400) { // 每天86400秒            $time = date("Y-m-d", $i);            $return[$i] = [                'time' => $time,                'num' => 0,                'order' => "",            ];        }        $data['get_my_top_depart_data'] = 1;        $model = Construction::Clear($user,$data);        $construction = $model->where('del_time',0)            ->where('start_time','<=',$endTimestamp)            ->where('end_time','>=',$startTimestamp)            ->where('state','>=',Construction::STATE_TWO)            ->select('id','start_time','end_time')            ->get()->toArray();        foreach ($construction as $value){            $start_t = date('Y-m-d', $value['start_time']);            $startOfDayTimestamp = strtotime($start_t);            $end_t = date('Y-m-d', $value['end_time']);            $endOfDayTimestamp = strtotime($end_t);            for ($i = $startOfDayTimestamp; $i <= $endOfDayTimestamp; $i += 86400) {                if(isset($return[$i])){                    $return[$i]['num'] += 1;                    $return[$i]['order'] .= $value['id'] . ',';                }            }        }        return [true, array_values($return)];    }    public function getSettingGetDetail2($data, $user){        if(empty($data['order'])) return [true, []];        $order_id = array_filter(explode(',', $data['order']));        if(empty($order_id)) return [true, []];        $construction = Construction::where('del_time',0)            ->where('state','>=',Construction::STATE_TWO)            ->whereIn('id',$order_id)            ->select('id','order_number','crt_id','start_time','end_time','state','product_introduction','vin_no')            ->get()->toArray();        if(empty($construction)) return [true, []];        $emp = Employee::whereIn('id',array_unique(array_column($construction,'crt_id')))            ->pluck('emp_name','id')            ->toArray();        $product_title = [];        $product = ConstructionProductInfo::where('del_time',0)            ->whereIn('construction_id',array_unique(array_column($construction,'id')))            ->select('product_id','construction_id')            ->get()->toArray();        $product_map = Product::whereIn('id',array_unique(array_column($product,'product_id')))            ->pluck('title','id')            ->toArray();        foreach ($product as $value){            if(! isset($product_title[$value['construction_id']])){                $product_title[$value['construction_id']] = $product_map[$value['product_id']];            }else{                $product_title[$value['construction_id']] .= "," . $product_map[$value['product_id']];            }        }        $return = [];//        $construction_oa = (new OaService())->getConstructionOaOrderState(array_column($construction,'order_number'),$user,$data['menu_id']);        //特殊功能按钮        $special_button = $user['special_button'] ?? [];        $special_button_list = config('specialButton');        $special_button_map = array_column($special_button_list,null,'id');        //可见范围        $employee = (new RangeService())->RangeConstructionEmpDetail($order_id);        foreach ($construction as $value){            $str = "";            if(! empty($value['start_time']) && ! empty($value['end_time'])) $str = date('Y-m-d H:i',$value['start_time']) . '-' . date("Y-m-d H:i",$value['end_time']);            $emp_tmp = $employee[$value['id']] ?? [];            $button = [];            if($value['state'] == Construction::STATE_TWO){                //分配/调配                if(in_array(RoleMenuButton::special_three,$special_button)){                    $button_tmp = $special_button_map[RoleMenuButton::special_three] ?? [];                    if(empty($emp_tmp)){                        $button_tmp['title'] = '分配';                        $button_tmp['type'] = 1;                    }else{                        $button_tmp['title'] = '调配';                        $button_tmp['type'] = 2;                    }                    $button[] = $button_tmp;                }                if(in_array(RoleMenuButton::special_four,$special_button)){                    //完结                    $button_tmp = $special_button_map[RoleMenuButton::special_four] ?? [];                    $button_tmp['is_button'] = 1;                    $button[] = $button_tmp;                }            }elseif($value['state'] == Construction::STATE_THREE){                //待确认                $button_tmp = $special_button_map[RoleMenuButton::special_five] ?? [];                if(in_array(RoleMenuButton::special_five,$special_button)){                    $button_tmp['is_button'] = 1;                }else{                    $button_tmp['is_button'] = 0;                }                $button[] = $button_tmp;            }            $button = array_filter($button);            $tmp = [                'id' => $value['id'],                'employee' => $emp_tmp,                'order_number' => $value['order_number'],                'crt_name' => $emp[$value['crt_id']] ?? "",                'product_introduction' => $value['product_introduction'],                'vin_no' => $value['vin_no'],                'product' => $product_title[$value['id']],                'crt_time' => $str,                'state' => $value['state'],                'state_title' => Construction::$name[$value['state']] ?? "",                'button' => $button            ];//            $tmp = $tmp + ($construction_oa[$value['order_number']] ?? []);            $return[] = $tmp;        }        return [true, $return];    }}
 |