| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use \think\Request;
- use \think\Db;
- /**
- * 工种定额及比例管理接口
- */
- class Machine extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- /**
- * 首页-已核查成品编号
- *
- */
- public function index()
- {
- $this->success('请求成功');
- }
- /**
- *工种定额及比例管理接口
- *
- * @ApiMethod GET
- *@params string department
- */
- public function getMachineInfo(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $params = Request::instance()->param();
- $department = $params['department'];
- if (!isset($department)){
- $this->error('参数不能为空');
- }
- $limit = $params['limit'];
- if (empty($limit)){
- $limit = 15;
- }
- $pages = $params['page'];
- if (empty($pages)){
- $pages = 1;
- }
- $where['使用部门'] = $department;
- $field = '设备编号,rtrim(设备名称) as 设备名称,rtrim(生产工序) as 生产工序,日定额,千件工价,机长,副机,调墨,二手,飞达,辅助,放卷,分切1,分切2,检验,rtrim(使用部门) as 使用部门,sys_id,sys_rq,mod_rq,UniqId';
- $list = db('设备_基本资料')->where($where)->field($field)->limit($limit)->page($pages)->order('设备编号 asc')->select();
- $count = db('设备_基本资料')->where($where)->field($field)->count();
- $data['data'] = $list;
- $data['total'] = $count;
- $this->success('请求成功',$data);
- }
- /**
- * 获取车间部门列表
- *
- * @ApiMethod GET
- */
- public function getDepartment(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $list = [
- 0 => '印刷车间',
- 1 => '印后车间'
- ];
- $this->success('请求成功',$list);
- }
- }
|