Browse Source

新增接口

huangsanjia 1 year ago
parent
commit
d086f764c0
2 changed files with 109 additions and 0 deletions
  1. 36 0
      application/api/controller/Custom.php
  2. 73 0
      application/api/controller/Machine.php

+ 36 - 0
application/api/controller/Custom.php

@@ -36,4 +36,40 @@ class Custom extends Api
         $list = Db::name('产品_基本资料')->distinct(true)->field($field)->order('客户编号 asc')->select();
         $this->success('请求成功',$list);
     }
+    /**
+     * 客户资料管理
+     *
+     * @ApiMethod GET
+     *
+    */
+    public function getCustomInfo(){
+        if (Request::instance()->isGet() == false){
+            $this->error('非法请求');
+        }
+        $params = Request::instance()->param();
+        if (!isset($params['class'])){
+            $this->error('参数错误');
+        }
+        $class = '';
+        if ($params['class'] == 1){
+            $class = '客户';
+        }else{
+            $class = '供应商';
+        }
+        $limit = $params['limit'];
+        if (empty($limit)){
+            $limit = 15;
+        }
+        $pages = $params['page'];
+        if (empty($pages)){
+            $pages = 1;
+        }
+        $where['类型'] = $class;
+        $field = 'rtrim(编号) as 编号,rtrim(名称) as 名称,rtrim(简称) as 简称,rtrim(地址) as 地址,rtrim(联系人),rtrim(电话),业务员,rtrim(币种) as 币种,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqId';
+        $list = Db::name('erp_客户供应商')->where($where)->field($field)->limit($limit)->page($pages)->select();
+        $total = Db::name('erp_客户供应商')->where($where)->count();
+        $data['data'] = $list;
+        $data['total'] = $total;
+        $this->success('请求成功',$data);
+    }
 }

+ 73 - 0
application/api/controller/Machine.php

@@ -0,0 +1,73 @@
+<?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);
+
+    }
+}