Example #1
0
 function staff($short)
 {
     // 按照员工拼音缩写查找员工
     // 如果执行查询操作的是 操作者 权限的用户
     // 只允许查询与其同一班组的员工 : team_id
     if (has_perm(8, 4)) {
         $team_id = $_SESSION['team_id'];
         $staffs = Staff::find('all', array('conditions' => " short LIKE '{$short}%' AND group_id = {$team_id} ", 'order' => 'id desc'));
     } else {
         $staffs = Staff::find('all', array('conditions' => "short like '{$short}%'", 'order' => 'id desc'));
     }
     $results = array();
     if (!empty($staffs)) {
         foreach ($staffs as $staff) {
             $results[] = array('id' => $staff->id, 'name' => $staff->name);
         }
     }
     echo json_encode($results);
 }
    /**
     * @return mixed
     * @throws \ErrorException
     */
    protected function detectPage()
    {
        // security functions
        if (!isset($_REQUEST['go'])) {
            $_REQUEST['go'] = null;
        }
        $go = $_REQUEST['go'];
        // get page-data from database
        $acp_arr = $this->db->conn()->prepare(<<<SQL
SELECT `page_id`, `page_file`, P.`group_id` AS `group_id`, `menu_id`
FROM `{$this->db->getPrefix()}admin_cp` P, `{$this->db->getPrefix()}admin_groups` G
WHERE P.`group_id` = G.`group_id` AND P.`page_id` = ? AND P.`page_int_sub_perm` != 1
SQL
);
        $acp_arr->execute(array($go));
        $acp_arr = $acp_arr->fetch(\PDO::FETCH_ASSOC);
        // if page exists
        if (!empty($acp_arr)) {
            // if page is start page
            if ($acp_arr['group_id'] == -1) {
                $acp_arr['menu_id'] = $acp_arr['page_file'];
                $acp_arr['page_file'] = $acp_arr['page_id'] . '.php';
            }
            //if popup
            if ($acp_arr['group_id'] == 'popup') {
                define('POPUP', true);
                $title = $this->text['menu']->get('page_title_' . $acp_arr['page_id']);
            } else {
                define('POPUP', false);
                $title = $this->text['menu']->get('group_' . $acp_arr['group_id']) . ' &#187; ' . $this->text['menu']->get('page_title_' . $acp_arr['page_id']);
            }
            // get the page-data
            $PAGE_DATA_ARR = createpage($title, has_perm($acp_arr['page_id']), $acp_arr['page_file'], $acp_arr['menu_id']);
        } else {
            $PAGE_DATA_ARR['created'] = false;
            define('POPUP', false);
        }
        // logout
        if ($PAGE_DATA_ARR['created'] === false && $go == 'logout') {
            setcookie('login', '', time() - 3600, '/');
            $_SESSION = array();
            $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_logout_text"), true, 'admin_logout.php', 'dash');
        } elseif ($PAGE_DATA_ARR['created'] === false && ($go == 'login' || empty($go))) {
            $go = 'login';
            $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_login_text"), true, 'admin_login.php', 'dash');
        } elseif ($PAGE_DATA_ARR['created'] === false) {
            $go = '404';
            $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_error_page_title"), true, 'admin_404.php', 'error');
        }
        // Get Special Page Lang-Text-Files
        $page_lang = new Lang($this->config->config('language_text'), 'admin/' . substr($PAGE_DATA_ARR['file'], 0, -4));
        $common_lang = $this->text['admin'];
        // initialise template system
        $PAGE_DATA_ARR['template'] = new \adminpage($PAGE_DATA_ARR['file'], $page_lang, $common_lang);
        // Define Constant
        define('ACP_GO', $go);
        return $PAGE_DATA_ARR;
    }
Example #3
0
    <!-- 增加现场工时 -->
    <div class="col-md-4">
        <div class="panel panel-default">
             
             <div class="panel-heading">分配件数</div><!-- 新增现场工时 -->
             <div class="panel-body">
                 <form class="form" action="#" method="POST" id="addWorkForm">

                    <fieldset class="needPerm" roles="2,8" groups="4">
                    <div class="row">
                        <div class="col-xs-6">
                            <label class="sr-only" for="staff_id">操作者</label>
                            <select name="staff_id" id="staff_id" class="form-control needPerm" roles="2,8" groups="4">
                                <option value="">-- 请选择 --</option>
                                <?php 
if (has_perm(2, 4)) {
    foreach ($staffs as $staff) {
        ?>
                                        <option value="<?php 
        echo $staff->id;
        ?>
"><?php 
        echo $staff->name;
        ?>
</option>

                                <?php 
    }
}
?>
                            </select>
Example #4
0
 function form($form_type)
 {
     switch ($form_type) {
         // 完工报表查询
         case 'part_done':
             render_with_layout('misc.php', 'Statistics/form_part_done.php');
             break;
             // 工时汇总
         // 工时汇总
         case 'work_done':
             render_with_layout('misc.php', 'Statistics/form_work_done.php');
             break;
             // 投入表查询
         // 投入表查询
         case 'part_mr_price':
             render_with_layout('misc.php', 'Statistics/form_part_mr_price.php');
             break;
             // 月项次计划表
         // 月项次计划表
         case 'item_month_plan':
             render_with_layout('misc.php', 'Statistics/form_item_month_plan.php');
             break;
             // 月项次进度表
         // 月项次进度表
         case 'item_month_proc':
             render_with_layout('misc.php', 'Statistics/form_item_month_proc.php');
             break;
             // 料单查询
         // 料单查询
         case 'part_mr_date':
             render_with_layout('misc.php', 'Statistics/form_part_mr_date.php');
             break;
             // 专项计划作业进度表
         // 专项计划作业进度表
         case 'item_month_plan_2':
             render_with_layout('misc.php', 'Statistics/form_item_month_proc_2.php');
             break;
             // 分类统计: 在指定期间内有多少生产指令,零件完工,未完工 / 有多少道工序制定工艺/未制定工艺
         // 分类统计: 在指定期间内有多少生产指令,零件完工,未完工 / 有多少道工序制定工艺/未制定工艺
         case 'total_count':
             render_with_layout('misc.php', 'Statistics/form_total_count.php');
             break;
             // 各工种完工/未完工统计图
         // 各工种完工/未完工统计图
         case 'proc_graph':
             render_with_layout('misc.php', 'Statistics/form_proc_graph.php');
             break;
             // 返单完工统计表(零件)
         // 返单完工统计表(零件)
         case 'part_return_date':
             render_with_layout('misc.php', 'Statistics/form_part_return_date.php');
             break;
             // 按生产指令号 查询 零件生产进度 ( 同月项次进度 )
         // 按生产指令号 查询 零件生产进度 ( 同月项次进度 )
         case 'prod_proc':
             render_with_layout('misc.php', 'Statistics/form_prod_proc.php');
             break;
             // 统计已经分配但还未交验的工时明细
         // 统计已经分配但还未交验的工时明细
         case 'unsubmitted_work':
             // 调度员
             if (has_perm(2, 4)) {
                 $staffs = Staff::all();
             }
             // 操作者
             // 只查询与操作者在同一班组的员工
             // 操作者.team_id = 员工.group_id
             if (has_perm(8, 4)) {
                 $team_id = $_SESSION['team_id'];
                 $staffs = Staff::find_all_by_group_id($team_id);
             }
             render_with_layout('misc.php', 'Statistics/form_unsubmitted_work.php', compact('staffs'));
             break;
     }
 }
Example #5
0
</strong> 天</h5>
								<h5><span class="customLabel">单件工时:</span> <strong><?php 
echo $proc->takt_time ? $proc->takt_time : 0;
?>
 分钟</strong></h5>
								<h5><span class="customLabel">准备工时:</span> <strong><?php 
echo $proc->preparation_time ? $proc->preparation_time : 0;
?>
 分钟</strong></h5>
							</p>
						</a>

						<a href="#" class="list-group-item">
							<h4 class="list-group-item-heading">工艺内容</h4>
							<?php 
if (!has_perm(99, 99)) {
    ?>
								<p class="list-group-item-text" style="min-height: 102px;"><?php 
    echo $proc->content;
    ?>
</p>
							<?php 
} else {
    ?>
								<br>
								<p class="alert alert-warning">对不起,<strong> 访客 </strong>没有权限查看工艺内容!</p>
							<?php 
}
?>
						</a>
Example #6
0
can delete pages, and rename pages, with the option of replacing the renamed page with a reference to the new one
made for The Arrow Project site.
Several parts of this are Arrow Specific. 
I've commented them with ARROW in the line so people can adapt it to use outside arrow.
In the spirit of ErfurtWiki this page is Public Domain.
Menno Lodder
menno_lodder at hotmail dot com
www.arrowproject.net
*/
//////////////////////////////////////////////
//ARROW some protection to ensure libraries aren't called directly
define('IN_ARROW', true);
//ARROW includes libraries and shows the admin section headers, also opens html tags upto <body>
require_once 'header.php';
//ARROW if statement checks if the persion has permission
if (!has_perm("WIKI_ADMIN")) {
    echo "No permission";
    include 'footer.php';
    exit;
}
//**************************************
//ARROW to use this outside of arrow, comment out the above and the footer.php include at the bottom
//      then uncomment the following 2 methods, and set the settings variables.
//**************************************
$wikitable = "wiki";
//the table name of the table containing the wiki info (ewiki by default)
$wikiurl = "../wiki.php";
//the relative URL of the wiki pages to the admin page, this is used to allow linking to the wiki pages
/*
These functions are untested
Example #7
0
 function auto_cal_proc_planned_completion_date($start_date, $end_date)
 {
     if (!has_perm(2, 4)) {
         exit;
     }
     $procs = Process::find('all', array('conditions' => array(" is_done = ? AND ( planned_completion_date is NULL OR planned_completion_date = 0 ) AND takt_time > 0 AND production_date >= ? AND production_date <= ?", 0, $start_date, $end_date)));
     foreach ($procs as $proc) {
         $cycle = cal_proc_production_cycle($proc);
         $proc->cycle = $cycle;
         $proc->planned_completion_date = cal_proc_planned_completion_date($proc->production_date, $cycle);
         $proc->save();
     }
     render_with_layout('misc.php', 'Misc/auto_cal_proc_planned_completion_date.php', array('count' => count($procs)));
 }
Example #8
0
 function import()
 {
     // 施工员/调度员 四车间
     if (!has_perm(1, 4) && !has_perm(2, 4)) {
         exit;
     }
     $name = $_FILES['files']['name'][0];
     $size = $_FILES['files']['size'][0];
     $tmp_name = $_FILES['files']['tmp_name'][0];
     if (get_file_ext($name) != 'xls') {
         $results['error'] = '对不起,系统只允许上传扩展名为 <strong>xls</strong> 的电子表格文件!';
         $results['is_success'] = false;
     } else {
         if ($size > 2000000) {
             $results['error'] = '对不起,系统只允许上传小于 <strong>2M</strong> 的电子表格文件!';
             $results['is_success'] = false;
         } else {
             if (!empty($tmp_name)) {
                 $data = new \Spreadsheet_Excel_Reader();
                 $data->setOutputEncoding('UTF-8');
                 $cols = 6;
                 /* 每一行有6个单元格 */
                 $rows = array();
                 $data->read($tmp_name);
                 error_reporting(E_ALL ^ E_NOTICE);
                 // 对电子表格的每一行进行循环
                 // 检测到某个单元格不存在时,设定其为空值
                 foreach ($data->sheets[0]['cells'] as $row) {
                     for ($i = 1; $i <= $cols; $i++) {
                         if (!isset($row[$i])) {
                             $row[$i] = '';
                         }
                         // 计划完成时间
                         if ($i == 6 && !empty($row[$i])) {
                             $row[$i] = change_date_style($row[$i]);
                         }
                     }
                     $rows[] = $row;
                 }
                 //debug( $rows );
                 // 导入数据库
                 foreach ($rows as $row) {
                     $prod_num = $row[1];
                     $prod = Production::find_by_num($prod_num);
                     // 当这条零件记录所对应的生产指令 prod 存在时
                     if (!empty($prod)) {
                         $part = new \Model\Part();
                         $part->production_id = $prod->id;
                         $part->num = $row[2];
                         $part->name = $row[3];
                         $part->graphic_num = $row[4];
                         $part->count = $row[5];
                         $part->planned_completion_date = $row[6];
                         $part->user_id = $_SESSION['user_id'];
                         if ($part->is_valid()) {
                             $part->save();
                         } else {
                             // 如果某条导入失败
                             // 记录该条目的零件指令号,零件名称
                             // 以及具体的错误原因
                             $errors = array();
                             foreach ($part->errors as $error) {
                                 $errors[] = $error;
                             }
                             $results['failed_items'][] = array('num' => $part->num, 'name' => $part->name, 'errors' => $errors);
                         }
                     }
                 }
                 //debug( $results['failed_items'] );
                 $results['is_success'] = true;
             }
         }
     }
     echo json_encode($results);
 }
Example #9
0
 function get_all_staffs_unsubmitted_works()
 {
     $results = array();
     $works = Work::find('all', array('conditions' => array(' `is_done` = 0 AND `check_date` IS NULL '), 'order' => 'id desc'));
     // 根据用户角色筛选
     // 如果是 操作者
     if (has_perm(8, 4)) {
         $team_id = $_SESSION['team_id'];
         foreach ($works as $key => $work) {
             // 过滤掉不是一个班组的员工
             if ($work->staff->group_id != $team_id) {
                 unset($works[$key]);
             }
         }
     }
     return \Model\Work::get_works_detail($works, 'unsubmitted');
 }
Example #10
0
"><span class="glyphicon glyphicon-home"></span> 工艺管理</a></li>

										<?php 
    if (has_perm(3, 4)) {
        // 综合文员 四车间
        ?>
											<li><a href="<?php 
        echo_path('/staffs');
        ?>
" target="_blank"><span class="glyphicon glyphicon-user"></span> 员工管理</a></li>
										<?php 
    }
    ?>

										<?php 
    if (has_perm(4, 3)) {
        // 系统管理员 信息中心
        ?>
											<li><a href="<?php 
        echo_path('/users');
        ?>
" target="_blank"><span class="glyphicon glyphicon-lock"></span> 用户管理</a></li>
										<?php 
    }
    ?>

										<li><a href="<?php 
    echo_path('/profile');
    ?>
" target="_blank"><span class="glyphicon glyphicon-wrench"></span> 密码修改</a></li>
										<li><a href="#" onclick="popAboutBox();return false;"><span class="glyphicon glyphicon-info-sign"></span> 关于</a></li>
Example #11
0
 function import()
 {
     // 工装管理员 生产安全部
     if (!has_perm(6, 1)) {
         exit;
     }
     $name = $_FILES['files']['name'][0];
     $size = $_FILES['files']['size'][0];
     $tmp_name = $_FILES['files']['tmp_name'][0];
     if (get_file_ext($name) != 'xls') {
         $results['error'] = '对不起,系统只允许上传扩展名为 <strong>xls</strong> 的电子表格文件!';
         $results['is_success'] = false;
     } else {
         if ($size > 2000000) {
             $results['error'] = '对不起,系统只允许上传小于 <strong>2M</strong> 的电子表格文件!';
             $results['is_success'] = false;
         } else {
             if (!empty($tmp_name)) {
                 $data = new \Spreadsheet_Excel_Reader();
                 $data->setOutputEncoding('UTF-8');
                 $cols = 12;
                 /* 每一行有12个单元格 */
                 $data->read($tmp_name);
                 error_reporting(E_ALL ^ E_NOTICE);
                 // 对电子表格的每一行进行循环
                 // 检测到某个单元格不存在时,设定其为空值
                 $rows = array();
                 //debug( $data->sheets[0]['cells'] );
                 foreach ($data->sheets[0]['cells'] as $row) {
                     for ($i = 1; $i <= $cols; $i++) {
                         if (!isset($row[$i])) {
                             $row[$i] = '';
                         }
                         // 转换部门名称为部门id值
                         if ($i == 6 && !empty($row[$i])) {
                             $row[$i] = get_group_id($row[$i]);
                         }
                         //  转换产品类型为id值
                         if ($i == 10) {
                             $row[$i] = get_type_id($row[$i]);
                         }
                         // 生产数量如果为空,则置0
                         if ($i == 4 && empty($row[$i])) {
                             $row[$i] = 0;
                         }
                         // 计划完成时间
                         if ($i == 5 && !empty($row[$i])) {
                             $row[$i] = change_date_style($row[$i]);
                         }
                     }
                     $rows[] = $row;
                 }
                 // 导入数据库
                 foreach ($rows as $row) {
                     //debug( $row );
                     $prod = new \Model\Production();
                     $prod->num = $row[1];
                     $prod->name = $row[2];
                     $prod->graphic_num = $row[3];
                     $prod->count = $row[4];
                     $prod->planned_completion_date = $row[5];
                     $prod->graphic_src = $row[6];
                     $prod->use_dep = 18;
                     $prod->completion_contact_person = $row[7];
                     $prod->completion_contact_phone = $row[8];
                     $prod->graphic_count = $row[9];
                     $prod->type = $row[10];
                     $prod->project_src = $row[11];
                     $prod->remark = $row[12];
                     $prod->user_id = $_SESSION['user_id'];
                     if ($prod->is_valid()) {
                         $prod->save();
                     } else {
                         //debug( $prod->errors );
                         // 如果某条导入失败
                         // 记录该条目的生产指令号,产品名称
                         // 以及具体的错误原因
                         $errors = array();
                         foreach ($prod->errors as $error) {
                             $errors[] = $error;
                         }
                         $results['failed_items'][] = array('num' => $prod->num, 'name' => $prod->name, 'errors' => $errors);
                     }
                 }
                 //debug( $rows );*/
                 //debug( $rows );
                 //debug( $rows );
                 $results['is_success'] = true;
             }
         }
     }
     echo json_encode($results);
 }
Example #12
0
 function unlock($work_id)
 {
     if (!has_perm(2, 4)) {
         exit;
     }
     $work = Work::find_by_id($work_id);
     if ($work) {
         $work->is_locked = false;
         $work->save();
         echo 'success';
     }
 }
Example #13
0
function is_temporary_user()
{
    return has_perm("temp");
}
Example #14
0
 function reset_done($proc_id)
 {
     if (!has_perm(2, 4)) {
         exit;
     }
     $proc = Process::find_by_id($proc_id);
     if ($proc) {
         $proc->count_done = 0;
         $proc->is_done = false;
         $proc->completion_date = '';
         $proc->save();
         // 更新上一级节点
         Part::update_count($proc->part);
         Production::update_count($proc->part->production);
         //
         echo 'success';
     }
 }