| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- <?php
- namespace app\api\controller;
- use app\common\controller\Api;
- use think\Request;
- class GluingReport extends Api
- {
- protected $noNeedLogin = ['*'];
- protected $noNeedRight = ['*'];
- /**
- * 设备角色菜单
- * @return void
- */
- public function getGluingcoleTab()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $sist = ['印后糊盒车间','精品自动化车间','数字化车间'];
- $list = db('设备_基本资料')
- ->where('使用部门','in',$sist)
- ->whereNotNull('sys_sbID')
- ->column('CONCAT(设备编号,"->",设备名称)');
- if (empty($list)){
- $this->error('未找到设备数据');
- }else{
- $this->success('成功',$list);
- }
- }
- /**
- * 设备角色列表
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getGluingcoleList()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param)){
- $this->error('参数错误');
- }
- $list = db('设备_糊盒班组角色')
- ->where('jtbh',$param['machine'])
- ->select();
- if (empty($list)){
- $this->error('未找到数据');
- }else{
- $this->success('成功',$list);
- }
- }
- /**
- * 设备角色资料详情
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getGluingcoleDetail()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param)){
- $this->error('参数错误');
- }
- $list = db('设备_糊盒班组角色')
- ->where('id',$param['id'])
- ->find();
- if (empty($list)){
- $this->error('未找到数据详情');
- }else{
- $this->success('成功',$list);
- }
- }
- /**
- * 新增机台班组角色
- * @return void
- */
- public function saveGluingcoleDetail(){
- if ($this->request->isPost() === false){
- $this->error('请求错误');
- }
- $param = Request::instance()->post();
- if (empty($param)){
- $this->error('参数错误');
- }
- $param['sys_rq'] = date('Y-m-d H:i:s',time());
- $res = db('设备_糊盒班组角色')->insert($param);
- if (empty($res)){
- $this->error('新增失败');
- }else{
- $this->success('新增成功');
- }
- }
- /**
- * 修改设备角色资料
- * @return void
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function getGluingcoleDetaiEdit()
- {
- if ($this->request->isPost() === false){
- $this->error('请求错误');
- }
- $param = Request::instance()->post();
- if (empty($param['id'])){
- $this->error('参数错误');
- }
- $id = intval($param['id']);
- $param['mod_rq'] = date('Y-m-d H:i:s',time());
- unset($param['id']);
- $res = db('设备_糊盒班组角色')
- ->where('id',$id)
- ->update($param);
- if ($res === false){
- $this->error('修改失败');
- }else{
- $this->success('修改成功');
- }
- }
- /**
- * 设备当前班组角色
- * @return void
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function UpdateGluingcoleStatus()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param['id']) || empty($param['jtbh'])){
- $this->error('参数错误');
- }
- $updateRes = db('设备_糊盒班组角色')
- ->where('jtbh',$param['jtbh'])
- ->update(['status' => 0]);
- $res = db('设备_糊盒班组角色')
- ->where('id',$param['id'])
- ->update(['status' => 1]);
- if ($updateRes === false || $res === false){
- $this->error('更新失败');
- }else{
- $this->success('更新成功');
- }
- }
- /**
- * 设备班组资料列表
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getGluingClassLList()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param)){
- $this->error('参数错误');
- }
- $list = db('设备_糊盒班组资料')
- ->where('jtbh',$param['machine'])
- ->select();
- if (empty($list)){
- $this->error('未找到数据');
- }else{
- $this->success('成功',$list);
- }
- }
- /**
- * 获取设备角色数据
- * @return void
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\ModelNotFoundException
- * @throws \think\exception\DbException
- */
- public function getGluingcole()
- {
- if ($this->request->isGet() === false){
- $this->error('请求错误');
- }
- $param = $this->request->param();
- if (empty($param)){
- $this->error('参数错误');
- }
- $list = db('设备_糊盒班组角色')
- ->where('jtbh',$param['machine'])
- ->where('status',1)
- ->find();
- if (empty($list)){
- $this->error('未找到角色资料');
- }else{
- $this->success('成功',$list);
- }
- }
- /**
- * 新增糊盒机台班组资料
- * @return void
- */
- public function AddGluingClass()
- {
- if ($this->request->isPost() === false){
- $this->error('请求错误');
- }
- $param = Request::instance()->post();
- if (empty($param)){
- $this->error('参数错误');
- }
- $param['sys_rq'] = date('Y-m-d H:i:s',time());
- $res = db('机台_糊盒班组资料')->insert($param);
- if ($res === false){
- $this->error('新增失败');
- }else{
- $this->success('新增失败');
- }
- }
- /**
- * 修改设备糊盒班组资料
- * @return void
- * @throws \think\Exception
- * @throws \think\exception\PDOException
- */
- public function UpdateGluingClass()
- {
- if ($this->request->isPost() === false){
- $this->error('请求错误');
- }
- $param = Request::instance()->post();
- if (empty($param['id'])){
- $this->error('参数错误');
- }
- $id = intval($param['id']);
- $param['mod_rq'] = date('Y-m-d H:i:s',time());
- unset($param['id']);
- $res = db('设备_糊盒班组资料')
- ->where('id',$id)
- ->update($param);
- if ($res === false){
- $this->error('修改成功');
- }else{
- $this->success('修改失败');
- }
- }
- // public function AddGluingReportData()
- // {
- // if ($this->request->isPost() === false){
- // $this->error('请求错误');
- // }
- // $param = Request::instance()->post();
- // if (empty($param)){
- // $this->error('参数错误');
- // }
- // }
- }
|