瀏覽代碼

班组维护

qiuenguang 1 年之前
父節點
當前提交
d7da6c3544
共有 1 個文件被更改,包括 32 次插入12 次删除
  1. 32 12
      application/api/controller/Facility.php

+ 32 - 12
application/api/controller/Facility.php

@@ -579,29 +579,23 @@ class Facility extends Api
      */
     public function MachineTeamAdd()
     {
-        if ($this->request->isGet() === false){
+        if (Request::instance()->isPost() === false ){
             $this->error('请求错误');
         }
-        $param = $this->request->param();
+        $param = Request::instance()->post();
         if (empty($param)){
             $this->error('参数错误');
         }
-        $teamDetail = \db('设备_班组资料')
-            ->where('UniqId',$param['UniqId'])
-            ->find();
-        if (empty($teamDetail)){
-            $this->error('数据错误');
-        }
         $lastId = \db('设备_班组资料')
             ->order('UniqId desc')
             ->value('UniqId');
         if ($lastId<100000){
             $lastId = 1000000;
         }
-        $teamDetail['sczl_jtbh'] = $param['machine'].'#';
-        $teamDetail['UniqId'] = $lastId + 1;
-        $teamDetail['sczl_bzdh'] = $param['team'];
-        $res = \db('设备_班组资料')->insert($teamDetail);
+        $param['sys_rq'] = date('Y-m-d H:i:s',time());
+        $param['UniqId'] = $lastId + 1;
+        $param['mod_rq'] = date('Y-m-d H:i:s',time());
+        $res = \db('设备_班组资料')->insert($param);
         if ($res !== false){
             $this->success('成功');
         }else{
@@ -1637,4 +1631,30 @@ class Facility extends Api
             ->select();
         $this->success('成功',$data);
     }
+
+    /**
+     * 员工信息获取
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function EmployeeData()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (isset($param['code']) === false){
+            $this->error('参数错误');
+        }
+        $res = \db('人事_基本资料')
+            ->where('员工编号','like',$param['code'].'%')
+            ->field('rtrim(员工编号) as 员工编号,rtrim(员工姓名) as 员工姓名')
+            ->select();
+        if (empty($res)){
+            $this->success('未找到该员工');
+        }
+        $this->success('成功',$res);
+    }
 }