|
|
@@ -1 +1,282 @@
|
|
|
<?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('参数错误');
|
|
|
+// }
|
|
|
+// }
|
|
|
+}
|