|
@@ -13,6 +13,11 @@ use App\Model\DeliveryNote;
|
|
use App\Model\Depart;
|
|
use App\Model\Depart;
|
|
use App\Model\Employee;
|
|
use App\Model\Employee;
|
|
use App\Model\EmployeeDepartPermission;
|
|
use App\Model\EmployeeDepartPermission;
|
|
|
|
+use App\Model\Oa;
|
|
|
|
+use App\Model\OaSub;
|
|
|
|
+use App\Model\OaSubEmployee;
|
|
|
|
+use App\Model\OaSubReportEmployee;
|
|
|
|
+use App\Model\OaSubRule;
|
|
use App\Model\Product;
|
|
use App\Model\Product;
|
|
use App\Model\SalesOrder;
|
|
use App\Model\SalesOrder;
|
|
use App\Model\SalesOrderInfo;
|
|
use App\Model\SalesOrderInfo;
|
|
@@ -1001,7 +1006,11 @@ class ConstructionService extends Service
|
|
$value['unit'] = $unit_map[$tmp['unit']] ?? "";
|
|
$value['unit'] = $unit_map[$tmp['unit']] ?? "";
|
|
$product[] = $value;
|
|
$product[] = $value;
|
|
}
|
|
}
|
|
- $order_message = ['order' => $construction, 'product' => $product];
|
|
|
|
|
|
+
|
|
|
|
+ //工单进展
|
|
|
|
+ $detail = $this->getOaJz($data,$user);
|
|
|
|
+
|
|
|
|
+ $order_message = ['order' => $construction, 'product' => $product,'detail'=> $detail];
|
|
|
|
|
|
$pdf = app('dompdf.wrapper')->loadView('pdf.construction', $order_message);
|
|
$pdf = app('dompdf.wrapper')->loadView('pdf.construction', $order_message);
|
|
$file_name = time().rand(1000,9999);
|
|
$file_name = time().rand(1000,9999);
|
|
@@ -1010,4 +1019,75 @@ class ConstructionService extends Service
|
|
|
|
|
|
return [true, ['file' => $filename]];
|
|
return [true, ['file' => $filename]];
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function getOaJz($data,$user)
|
|
|
|
+ {
|
|
|
|
+ $oa = Oa::where('menu_id', 34)
|
|
|
|
+ ->where('del_time',0)
|
|
|
|
+ ->where('channel',$user['depart_top'][0]['depart_id'])
|
|
|
|
+ ->first();
|
|
|
|
+ if(empty($oa)) return [];
|
|
|
|
+ $oa = $oa->toArray();
|
|
|
|
+ $list = OaSub::where('oa_id', $oa['id'])->where('del_time', 0)->get()->toArray();
|
|
|
|
+ $oa_sub_ids = [];
|
|
|
|
+ foreach ($list as $v) {
|
|
|
|
+ $oa_sub_ids[] = $v['id'];
|
|
|
|
+ }
|
|
|
|
+ $oaEmployee = OaSubEmployee::wherein('oa_sub_id', $oa_sub_ids)->get()->toArray();
|
|
|
|
+
|
|
|
|
+ $emp_list = Employee::whereIn('id',array_column($oaEmployee,'employee_id'))
|
|
|
|
+ ->select('emp_name','id','mobile')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ $emp_map = [];
|
|
|
|
+ foreach ($emp_list as $value){
|
|
|
|
+ $emp_map[$value['id']] = [
|
|
|
|
+ 'name' => $value['emp_name'],
|
|
|
|
+ 'mobile' => $value['mobile'],
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $emp_message = EmployeeDepartPermission::from('employee_depart_permission as a')
|
|
|
|
+ ->leftJoin('depart as b', 'b.id', 'a.depart_id')
|
|
|
|
+ ->whereIn('a.employee_id',array_column($emp_list,'id'))
|
|
|
|
+ ->select('a.employee_id', 'b.title')
|
|
|
|
+ ->get()->toArray();
|
|
|
|
+ $emp_message_map = [];
|
|
|
|
+ foreach ($emp_message as $value){
|
|
|
|
+ if(isset($emp_message_map[$value['employee_id']])){
|
|
|
|
+ $emp_message_map[$value['employee_id']] .= ',' . $value['title'];
|
|
|
|
+ }else{
|
|
|
|
+ $emp_message_map[$value['employee_id']] = $value['title'];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $oaEmployeeKey = [];
|
|
|
|
+ foreach ($oaEmployee as $v) {
|
|
|
|
+ $str = "";
|
|
|
|
+ $tmp = $emp_map[$v['employee_id']] ?? [];
|
|
|
|
+ $tmp2 = $emp_message_map[$v['employee_id']] ?? "";
|
|
|
|
+ $str = $tmp['name'] . " " . $tmp2 . " " . $tmp['mobile'];dump($str);
|
|
|
|
+ $oaEmployeeKey[$v['oa_sub_id']][] = [
|
|
|
|
+ 'id' => $v['employee_id'],
|
|
|
|
+ 'emp_name' => $str,
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ $return = [];
|
|
|
|
+ foreach ($list as $v) {
|
|
|
|
+ $return[$v['sort']][] = [
|
|
|
|
+ 'emp_id' => $oaEmployeeKey[$v['id']],
|
|
|
|
+ 'index' => $v['h5_key'],
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+ $detail = [];
|
|
|
|
+ foreach ($return as $v) {
|
|
|
|
+ $children = "";
|
|
|
|
+ foreach ($v as $vv) {
|
|
|
|
+ $children .= implode('|',array_column($vv['emp_id'],'emp_name')) . ',';
|
|
|
|
+ }
|
|
|
|
+ $detail[] = rtrim($children,',');
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $detail;
|
|
|
|
+ }
|
|
}
|
|
}
|