@@ -61,15 +62,17 @@ public function getProductionList(){
...
@@ -61,15 +62,17 @@ public function getProductionList(){
$database=\Drupal::database();
$database=\Drupal::database();
//查找订单内容
//查找订单内容
$rs=$database->query("select node__field_production_name.field_production_name_value as production_name, ".
$rs=$database->query("select node__field_production.field_production_target_id as production_id,node__field_production_name.field_production_name_value as production_name, ".
"node__field_production.field_production_target_id as production_id, node__field_download_url.field_download_url_value as production_download_url, ".
"node__field_download_url.field_download_url_value as production_download_url, ".
"node__field_app_name.field_app_name_value as app_name,node__field_belong_computer.computer_code ".
"node__field_app_name.field_app_name_value as app_name,node__field_belong_computer.computer_code ".
"from {node} as node left join {node__field_production} as node__field_production on node.nid=node__field_production.entity_id ".
"from {node} as node left join {node__field_production} as node__field_production on node.nid=node__field_production.entity_id ".
"left join {node__field_production_name} as node__field_production_name on node__field_production_name.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_production_name} as node__field_production_name on node__field_production_name.entity_id=node__field_production.field_production_target_id ".
//"left join {node__field_scene_name} as node__field_scene_name on node__field_scene_name.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_scene_name} as node__field_scene_name on node__field_scene_name.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_download_url} as node__field_download_url on node__field_download_url.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_download_url} as node__field_download_url on node__field_download_url.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_app_name} as node__field_app_name on node__field_app_name.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_app_name} as node__field_app_name on node__field_app_name.entity_id=node__field_production.field_production_target_id ".
"left join {node__field_user} as node__field_user on node__field_user.entity_id=node.nid ".
"left join {node__field_user} as node__field_user on node__field_user.entity_id=node.nid ".
"left join {node_field_data} as node_field_data on node_field_data.nid=node__field_production.field_production_target_id ".
"left join ( select node__field_computer_code.field_computer_code_value as computer_code,node__field_user.field_user_target_id,node__field_production.field_production_target_id from {node__field_belong_computer} as node__field_belong_computer ".
"left join ( select node__field_computer_code.field_computer_code_value as computer_code,node__field_user.field_user_target_id,node__field_production.field_production_target_id from {node__field_belong_computer} as node__field_belong_computer ".
"left join {node__field_computer_code} as node__field_computer_code on node__field_belong_computer.field_belong_computer_target_id=node__field_computer_code.entity_id ".
"left join {node__field_computer_code} as node__field_computer_code on node__field_belong_computer.field_belong_computer_target_id=node__field_computer_code.entity_id ".
"left join {node__field_user} as node__field_user on node__field_computer_code.entity_id =node__field_user.entity_id ".
"left join {node__field_user} as node__field_user on node__field_computer_code.entity_id =node__field_user.entity_id ".
...
@@ -412,26 +415,114 @@ public function saveProduction(){
...
@@ -412,26 +415,114 @@ public function saveProduction(){
$tj="AND (node_field_data.title LIKE CONCAT('%','".$post['title_name']."','%') or user__field_call_name.field_call_name_value is null )".
"AND (node__field_production_name.field_production_name_value LIKE CONCAT('%','".$post['production_name']."','%') or node__field_production_name.field_production_name_value is null )".
"AND (user__field_enterprise_name.field_enterprise_name_value LIKE CONCAT('%','".$post['enterprise_name']."','%') or user__field_enterprise_name.field_enterprise_name_value is null )";
"user__field_enterprise_name.field_enterprise_name_value,node__field_pass_data.field_pass_data_value,IF(register_robot_code.computer_num IS NULL,0,register_robot_code.computer_num) as computer_num, ".
"TIMESTAMPDIFF(DAY,NOW(),DATE_ADD(FROM_UNIXTIME(node_field_data.created),INTERVAL node__field_pass_data.field_pass_data_value DAY)) AS diff_date, ".
"FROM_UNIXTIME(node_field_data.created) as create_date from {node} as node ".
"LEFT JOIN {node__field_production} as node__field_production ON node.nid=node__field_production.entity_id ".
"LEFT JOIN {node__field_production} as node__field_production ON node.nid=node__field_production.entity_id ".
"LEFT JOIN {node__field_production_name} as node__field_production_name ON node__field_production_name.entity_id=node__field_production.field_production_target_id ".
"LEFT JOIN {node__field_user} as node__field_user ON node.nid=node__field_user.entity_id ".
"LEFT JOIN {node__field_user} as node__field_user ON node.nid=node__field_user.entity_id ".
"LEFT JOIN {node_field_data} as node_field_data ON node.nid=node_field_data.nid ".
"LEFT JOIN {node__field_pass_data} as node__field_pass_data ON node__field_pass_data.entity_id=node.nid ".
"LEFT JOIN {user__field_enterprise_name} as user__field_enterprise_name ON user__field_enterprise_name.entity_id=node__field_user.field_user_target_id".
"LEFT JOIN (select node__field_production.field_production_target_id,count(*) as computer_num ".
"LEFT JOIN (select node__field_production.field_production_target_id,count(*) as computer_num ".
"FROM {node} as node ".
"FROM {node} as node ".
"LEFT JOIN {node__field_production} as node__field_production on node.nid=node__field_production.entity_id ".
"LEFT JOIN {node__field_production} as node__field_production on node.nid=node__field_production.entity_id ".
"LEFT JOIN {node__field_belong_computer} as node__field_belong_computer on node.nid=node__field_belong_computer.entity_id ".
"LEFT JOIN {node__field_belong_computer} as node__field_belong_computer on node.nid=node__field_belong_computer.entity_id ".
"WHERE node.type='register_robot_code' GROUP BY node__field_production.field_production_target_id ) as register_robot_code ".
"WHERE node.type='register_robot_code' GROUP BY node__field_production.field_production_target_id ) as register_robot_code ".
"WHERE node.type='production_order' AND node__field_user.field_user_target_id= :userid AND node__field_production.field_production_target_id= :productionid ",
"WHERE node.type='production_order' ".$tj." AND node__field_user.field_user_target_id= :userid ".
"LEFT JOIN {user__field_phone} as user__field_phone ON user__field_phone.entity_id=users_field_data.uid ".
"LEFT JOIN {user__field_call_name} as user__field_call_name ON user__field_call_name.entity_id=users_field_data.uid ".
"LEFT JOIN {user__field_enterprise_name} as user__field_enterprise_name ON user__field_enterprise_name.entity_id=users_field_data.uid ".
"LEFT JOIN {user__roles} as user__roles ON user__roles.entity_id=users_field_data.uid ".
"LEFT JOIN (SELECT node__field_user.field_user_target_id,count(*) as bind_computer_num FROM {node__field_user} as node__field_user WHERE node__field_user.bundle='compute_bind' GROUP BY node__field_user.field_user_target_id ) as is_bind_computer ON users_field_data.uid=is_bind_computer.field_user_target_id ".
"LEFT JOIN (SELECT node__field_user.field_user_target_id,count(*) as bind_code_num FROM {node__field_user} as node__field_user WHERE node__field_user.bundle='register_robot_code' GROUP BY node__field_user.field_user_target_id ) as is_bind_code ON users_field_data.uid=is_bind_code.field_user_target_id ".
"LEFT JOIN (SELECT SUM(node__field_bind_number.field_bind_number_value) as computer_num,node__field_user.field_user_target_id FROM {node} as node ".
"LEFT JOIN {node__field_bind_number} as node__field_bind_number ON node.nid=node__field_bind_number.entity_id ".
"LEFT JOIN {node__field_user} as node__field_user ON node.nid=node__field_user.entity_id ".
"WHERE node.type='production_order' GROUP BY node__field_user.field_user_target_id ) user_order ON user_order.field_user_target_id=users_field_data.uid ".
"AND (user__field_call_name.field_call_name_value LIKE CONCAT('%','".$post['call_name']."','%') or user__field_call_name.field_call_name_value is null) ".
"AND (users_field_data.`name` LIKE CONCAT('%','".$post['user_name']."','%') or users_field_data.`name` is null) ".
"AND (user__field_phone.field_phone_value LIKE CONCAT('%','".$post['call_phone']."','%') or user__field_phone.field_phone_value is null) ".
"AND (user__field_enterprise_name.field_enterprise_name_value LIKE CONCAT('%','".$post['enterprise_name']."','%') or user__field_enterprise_name.field_enterprise_name_value is null) ".
"node__field_computer_code.field_computer_code_value,FROM_UNIXTIME(node_field_data.created) as create_date ".
"FROM {node} AS node ".
"LEFT JOIN {node_field_data} AS node_field_data ON node.nid=node_field_data.nid ".
"LEFT JOIN {node__field_computer_name} AS node__field_computer_name ON node__field_computer_name.entity_id=node.nid ".
"LEFT JOIN {node__field_user} AS node__field_user ON node__field_user.entity_id=node.nid ".
"LEFT JOIN {user__field_enterprise_name} AS user__field_enterprise_name ON user__field_enterprise_name.entity_id=node__field_user.field_user_target_id ".
"LEFT JOIN (SELECT node.nid ,count(*) AS bind_num FROM {node} AS node ".
"LEFT JOIN {node__field_computer_code} AS node__field_computer_code ON node.nid=node__field_computer_code.entity_id ".
"WHERE node.type='compute_bind' GROUP BY node.nid ) AS is_bind_code ".
"LEFT JOIN {node__field_computer_code} AS node__field_computer_code ON node__field_computer_code.entity_id=is_bind_code.nid ".
"AND (node_field_data.title LIKE CONCAT('%','".$post['title_name']."','%') or node_field_data.title is null) ".
"AND (node__field_computer_name.field_computer_name_value LIKE CONCAT('%','".$post['computer_name']."','%') or node__field_computer_name.field_computer_name_value is null) ".
"AND (node__field_computer_code.field_computer_code_value LIKE CONCAT('%','".$post['computer_code']."','%') or node__field_computer_code.field_computer_code_value is null) ".
"AND (user__field_enterprise_name.field_enterprise_name_value LIKE CONCAT('%','".$post['enterprise_name']."','%') or user__field_enterprise_name.field_enterprise_name_value is null) ".