| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?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 POST
- *@params string department
- */
- public function getMachineInfo(){
- if (Request::instance()->isPost() == 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::name('设备_基本资料')->where($where)->field($field)->limit($limit)->page($pages)->order('设备编号 asc')->select();
- $this->success('请求成功',$list);
- }
- /**
- * 获取车间部门列表
- *
- * @ApiMethod GET
- */
- public function getDepartment(){
- if (Request::instance()->isGet() == false){
- $this->error('非法请求');
- }
- $list = [
- 0 => '胶印车间',
- 1 => '凹印车间',
- 2 => '丝印车间',
- 3 => '烫模车间',
- 4 => '检验车间',
- 5 => '研发中心',
- ];
- $this->success('请求成功',$list);
- }
- }
|