Browse Source

修改Db->db

huangsanjia 1 năm trước cách đây
mục cha
commit
cdfd842c37

+ 4 - 4
application/api/controller/Custom.php

@@ -33,7 +33,7 @@ class Custom extends Api
             $this->error('非法请求');
         }
         $field = 'rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称';
-        $list = Db::name('产品_基本资料')->distinct(true)->field($field)->order('客户编号 asc')->select();
+        $list = db('产品_基本资料')->distinct(true)->field($field)->order('客户编号 asc')->select();
         $this->success('请求成功',$list);
     }
     /**
@@ -70,8 +70,8 @@ class Custom extends Api
             $where['编号|名称|地址|联系人|业务员'] = array('like','%'.$search.'%');
         }
         $field = 'rtrim(编号) as 编号,rtrim(名称) as 名称,rtrim(简称) as 简称,rtrim(地址) as 地址,rtrim(联系人) as 联系人,rtrim(电话) as 电话,业务员,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();
+        $list = db('erp_客户供应商')->where($where)->field($field)->limit($limit)->page($pages)->select();
+        $total = db('erp_客户供应商')->where($where)->count();
         $data['data'] = $list;
         $data['total'] = $total;
         $this->success('请求成功',$data);
@@ -118,7 +118,7 @@ class Custom extends Api
         if (!empty($params['currency'])){
             $data['币种'] = $params['currency'];
         }
-        $sql = Db::name('erp_客户供应商')->where('UniqId',$params['UniqId'])->fetchSql(true)->update($data);
+        $sql = db('erp_客户供应商')->where('UniqId',$params['UniqId'])->fetchSql(true)->update($data);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');

+ 3 - 3
application/api/controller/Dictionary.php

@@ -30,7 +30,7 @@ class Dictionary extends Api
         if (Request::instance()->isGet() == false){
             $this->error('非法请求');
         }
-        $list = Db::name('erp_常用字典')->order('编号 asc')->column('trim(名称) as name');
+        $list = db('erp_常用字典')->order('编号 asc')->column('trim(名称) as name');
 
         // 分割字符串并合并相同项
         $resultArray = [];
@@ -77,7 +77,7 @@ class Dictionary extends Api
         if (!empty($params['search'])){
             $where['名称'] = array('like','%'.$params['search'].'%');
         }
-        $list = Db::name('erp_常用字典')->where($where)->order('次序 desc,UniqId asc')->select();
+        $list = db('erp_常用字典')->where($where)->order('次序 desc,UniqId asc')->select();
         $this->success('请求成功',$list);
 
     }
@@ -112,7 +112,7 @@ class Dictionary extends Api
             if (!empty($value['次序'])){
                 $data['次序'] = $value['次序'];
             }
-            $sql = Db::name('erp_常用字典')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
+            $sql = db('erp_常用字典')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
 
             $res = Db::query($sql);
             if ($res !== false){

+ 2 - 2
application/api/controller/Machine.php

@@ -47,8 +47,8 @@ class Machine extends Api
         }
         $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();
-        $count = Db::name('设备_基本资料')->where($where)->field($field)->count();
+        $list = db('设备_基本资料')->where($where)->field($field)->limit($limit)->page($pages)->order('设备编号 asc')->select();
+        $count = db('设备_基本资料')->where($where)->field($field)->count();
         $data['data'] = $list;
         $data['total'] = $count;
         $this->success('请求成功',$data);

+ 8 - 8
application/api/controller/PieceWork.php

@@ -41,7 +41,7 @@ class PieceWork extends Api
                     日定额 as daily_quota,千件工价 as thousand_piece ,补产标准 as production_standard,机长比例 as fir_proportion,副机比例 as sec_proportion,
                     调墨比例 as ink_proportion,二手比例 as second_hand_proportion,飞达比例 as feeder_proportion,辅助比例 as auxiliary_proportion,放卷比例 as unwinder_proportion,
                     分切1比例 as cutting_one_proportion,分切2比例 as cutting_two_proportion,检验比例 as inspect_proportion';
-        $data = Db::name('dic_lzde')->where($where)->field($field)->select();
+        $data = db('dic_lzde')->where($where)->field($field)->select();
         $this->success('请求成功',$data);
 
     }
@@ -56,7 +56,7 @@ class PieceWork extends Api
             $this->error('非法请求');
         }
         $field = 'Key_,Parent,rtrim(sys_bh) as sys_bh, rtrim(sys_mc) as sys_mc,rtrim(适用工序) as gx,rtrim(适用机型) as jx';
-        $list = Db::name('dic_lzde')->field($field)->order('sys_bh')->select();
+        $list = db('dic_lzde')->field($field)->order('sys_bh')->select();
         $data = [];
         $machineData = [];
         $handData = [];
@@ -72,12 +72,12 @@ class PieceWork extends Api
         //对机器作业计件定额的数组进行处理
         $machineData = array_values($machineData);
         foreach ($machineData as $k=>$v){
-            $child = Db::name('dic_lzde')->where('Parent',$v['Key_'])->field($field)->select();
+            $child = db('dic_lzde')->where('Parent',$v['Key_'])->field($field)->select();
             if (!empty($child)){
                 $machineData[$k]['child'] = $child;
                 foreach ($child as $i=>$j){
                     if ($v['sys_mc'] == '检验车间'){ //找出检验车间机器下面的数据
-                        $children = Db::name('dic_lzde')->where('Parent',$j['Key_'])->field($field)->select();
+                        $children = db('dic_lzde')->where('Parent',$j['Key_'])->field($field)->select();
                         $machineData[$k]['child'][$i]['children'] = $children;
                     } else{
                         $machineData[$k]['child'][$i]['children'] = [];
@@ -89,11 +89,11 @@ class PieceWork extends Api
         //对手工作业计件定额的数组进行处理
         $handData = array_values($handData);
         foreach ($handData as $k=>$v){
-            $child = Db::name('dic_lzde')->where('Parent',$v['Key_'])->field($field)->select();
+            $child = db('dic_lzde')->where('Parent',$v['Key_'])->field($field)->select();
             if (!empty($child)){
                 $handData[$k]['child'] = $child;
                 foreach ($child as $i=>$j){
-                    $children = Db::name('dic_lzde')->where('Parent',$j['Key_'])->field($field)->select();
+                    $children = db('dic_lzde')->where('Parent',$j['Key_'])->field($field)->select();
                     if (!empty($children)){
                         $handData[$k]['child'][$i]['children'] = $children;
                     } else{
@@ -125,7 +125,7 @@ class PieceWork extends Api
         $where['sys_bh'] = array('like','%'.$req['code'].'%');
         $field = 'rtrim(sys_bh) as sys_bh,rtrim(sys_mc) as sys_mc,rtrim(适用工序) as use_gx,rtrim(适用机型) as use_machine,日定额 as daily_quota,千件工价 as thousand_piece,
         补产标准 as production_standard,UniqId';
-        $list = Db::name('dic_lzde')->where($where)->field($field)->select();
+        $list = db('dic_lzde')->where($where)->field($field)->select();
         $this->success('请求成功',$list);
     }
     /**
@@ -154,7 +154,7 @@ class PieceWork extends Api
                 $data['补产标准'] = $value['production_standard'];
             }
 
-            $sql = Db::name('dic_lzde')->where('UniqId',$value['UniqId'])->fetchSql(true)->update($data);
+            $sql = db('dic_lzde')->where('UniqId',$value['UniqId'])->fetchSql(true)->update($data);
             $res = Db::query($sql);
             if ($res !== false){
                 $i++;

+ 14 - 14
application/api/controller/Process.php

@@ -38,7 +38,7 @@ class Process extends Api
         }
         $where['sys_bh'] = $code;
         $field = 'rtrim(sys_bh) as sys_bh,rtrim(sys_mc) as sys_mc,sys_rate0,sys_rate1,rtrim(适用机型) as remark';
-        $data = Db::name('dic_lzsh')->where($where)->field($field)->select();
+        $data = db('dic_lzsh')->where($where)->field($field)->select();
         $this->success('请求成功',$data);
     }
     /**
@@ -50,26 +50,26 @@ class Process extends Api
             $this->error('非法请求');
         }
         $field = 'Key_,Parent,rtrim(sys_bh) as sys_bh,rtrim(sys_mc) as sys_mc';
-        $list = Db::name('dic_lzsh')->field($field)->select();
+        $list = db('dic_lzsh')->field($field)->select();
         $data = [];
         $i = 0;
         foreach ($list as $value){
             if ($value['Parent'] == '0_'){
                 $data[$i] = $value;
                 //一级菜单
-                $data[$i]['child'] = Db::name('dic_lzsh')->where('Parent',$value['Key_'])->field($field)->select();
+                $data[$i]['child'] = db('dic_lzsh')->where('Parent',$value['Key_'])->field($field)->select();
                 foreach ($data[$i]['child'] as $k=>$v){
-                    $children = Db::name('dic_lzsh')->where('Parent',$v['Key_'])->field($field)->select();
+                    $children = db('dic_lzsh')->where('Parent',$v['Key_'])->field($field)->select();
                     //二级菜单
                     $data[$i]['child'][$k]['children'] =  $children;
                     if (!empty($children)){
                         foreach ($children as $key=>$item){
-                            $childrens = Db::name('dic_lzsh')->where('Parent',$item['Key_'])->field($field)->select();
+                            $childrens = db('dic_lzsh')->where('Parent',$item['Key_'])->field($field)->select();
                             //三级菜单
                             $data[$i]['child'][$k]['children'][$key]['childrens'] =  $childrens;
                             if (!empty($childrens)){
                                 foreach ($childrens as $k1=>$v1){
-                                    $fiveChild = Db::name('dic_lzsh')->where('Parent',$v1['Key_'])->field($field)->select();
+                                    $fiveChild = db('dic_lzsh')->where('Parent',$v1['Key_'])->field($field)->select();
                                     $data[$i]['child'][$k]['children'][$key]['childrens'][$k1]['fiveChild'] =  $fiveChild;
                                 }
                             }else{
@@ -102,7 +102,7 @@ class Process extends Api
         }
         $code = $params['code'];
         if (empty($code)){//科目编码为空,表示需要增加一级科目
-           $res = Db::name('dic_lzsh')->where('Parent','0_')->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
+           $res = db('dic_lzsh')->where('Parent','0_')->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
            $num = (int)$res['sys_bh'] + 1;
            $new_code = $num > 10 ? '0'.$num : '00'.$num;
            $this->success('请求成功',$new_code);
@@ -110,15 +110,15 @@ class Process extends Api
             if (($params['same_item'] == 0 && $params['child_item'] == 0) || ($params['same_item'] == 1 && $params['child_item'] == 1) ){
                 $this->error('参数错误');
             }
-            $res = Db::name('dic_lzsh')->where('sys_bh',$code)->find();
+            $res = db('dic_lzsh')->where('sys_bh',$code)->find();
             if ($params['same_item'] == 1){ //表示增加同级科目
-                $list = Db::name('dic_lzsh')->where('Parent',$res['Parent'])->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
+                $list = db('dic_lzsh')->where('Parent',$res['Parent'])->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
                 $num = (int)$list['sys_bh'] + 1;
                 $num = substr($num,-3);
                 $str = substr($code,0,-3);
                 $new_code = $str . $num;
             }else{
-                $list = Db::name('dic_lzsh')->where('Parent',$res['Key_'])->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
+                $list = db('dic_lzsh')->where('Parent',$res['Key_'])->field('rtrim(sys_bh) as sys_bh')->order('UniqId desc')->find();
                 if (!empty($list)){
                     $num = (int)$list['sys_bh'] + 1;
                     $num = substr($num,-3);
@@ -152,7 +152,7 @@ class Process extends Api
         if (empty($parentCode)){
             $parentCode = $params['code'];
         }
-        $list = Db::name('dic_lzsh')->where('sys_bh',$parentCode)->field('Key_')->find();
+        $list = db('dic_lzsh')->where('sys_bh',$parentCode)->field('Key_')->find();
         $data = [];
         $data['sys_bh'] = $params['code'];
         $data['Parent'] = empty($list)? '0_':$list['Key_'];
@@ -162,7 +162,7 @@ class Process extends Api
         if (!empty($params['remark'])){
             $data['适用机型'] = $params['remark'];
         }
-        $sql = Db::name('dic_lzsh')->fetchSql(true)->insert($data);
+        $sql = db('dic_lzsh')->fetchSql(true)->insert($data);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('新增成功');
@@ -194,7 +194,7 @@ class Process extends Api
         if (!empty($params['remark'])){
             $data['适用机型'] = $params['remark'];
         }
-        $sql = Db::name('dic_lzsh')->where('sys_bh',$params['code'])->fetchSql(true)->update($data);
+        $sql = db('dic_lzsh')->where('sys_bh',$params['code'])->fetchSql(true)->update($data);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');
@@ -215,7 +215,7 @@ class Process extends Api
         if (empty($params) || !isset($params['code'])){
             $this->error('参数不能为空');
         }
-        $res = Db::name('dic_lzsh')->where('sys_bh',$params['code'])->delete();
+        $res = db('dic_lzsh')->where('sys_bh',$params['code'])->delete();
         if ($res !== false){
             $this->success('删除成功');
         }else{

+ 4 - 4
application/api/controller/ProcessDocument.php

@@ -40,7 +40,7 @@ class ProcessDocument extends Api
         $map['a.Gd_gdbh'] = $order;
         $map['a.行号'] = 1;
         //胶印车间计量单位为”张“,凹印车间计量单位一般为”吨“
-        $info = Db::name('工单_基本资料')->alias('a')
+        $info = db('工单_基本资料')->alias('a')
             ->join('工单_bom资料 b ',' a.Gd_gdbh=b.BOM_工单编号','left')
             ->field('a.成品代号,a.产品版本号,b.BOM_计划用量,b.BOM_物料名称')
             ->where($map)
@@ -88,7 +88,7 @@ class ProcessDocument extends Api
         $where = array();
         $where['Gd_gdbh'] = $order;
         $where['行号'] = 1;
-        $product = Db::name('工单_基本资料')
+        $product = db('工单_基本资料')
             ->where($where)
             ->field('成品代号')
             ->find();
@@ -147,7 +147,7 @@ class ProcessDocument extends Api
         $where = array();
         $where['Gd_gdbh'] = $params['order'];
         $where['行号'] = 1;
-        $product = DB::name('工单_基本资料')
+        $product = db('工单_基本资料')
             ->where($where)
             ->field('成品代号')
             ->find();
@@ -192,7 +192,7 @@ class ProcessDocument extends Api
         ];
         $field  = 'Gd_gdbh,rtrim(销售订单号) as 销售订单号,rtrim(Gd_cpmc) as Gd_cpmc,rtrim(成品名称) as 成品名称,计划投料,实际投料,rtrim(产品版本号) as 产品版本号,rtrim(警语版面) as 警语版面,
         rtrim(Gd_desc) as Gd_desc';
-        $gdinfo =  Db::name('工单_基本资料')
+        $gdinfo =  db('工单_基本资料')
             ->where($where)
             ->field($field)
             ->select();

+ 24 - 24
application/api/controller/Product.php

@@ -50,7 +50,7 @@ class Product extends Api
                     rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
                     FROM `产品_基本资料` WHERE `客户编号` = '{$customCode}' ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END, 
                     `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
-            $total = Db::name('产品_基本资料')->where('客户编号',$customCode)->count();
+            $total = db('产品_基本资料')->where('客户编号',$customCode)->count();
         }else{
             if (isset($params['search']) && !empty($params['search'])){
                 $search = $params['search'];
@@ -58,13 +58,13 @@ class Product extends Api
                     rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
                     FROM `产品_基本资料` WHERE `产品名称` LIKE '%{$search}%' OR `产品编号` LIKE '%{$search}%' ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END, 
                     `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
-                $total = Db::name('产品_基本资料')->where('产品名称','like','%'.$search.'%')->count();
+                $total = db('产品_基本资料')->where('产品名称','like','%'.$search.'%')->count();
             }else{
                 $sql = "SELECT rtrim(客户编号) as 客户编号,rtrim(客户名称) as 客户名称,客户料号,rtrim(产品编号) as 产品编号,rtrim(产品名称) as 产品名称,版本号,成品规格,
                     rtrim(计量单位) as 计量单位,rtrim(产品类别) as 产品类别,生产类别,产品备注,投产日期,状态,U8UID,rtrim(Sys_id) as Sys_id,Sys_rq,Mod_rq,UniqID
                     FROM `产品_基本资料` ORDER BY CASE WHEN `状态` IS NULL THEN 0 ELSE 1 END, 
                     `客户编号`ASC,`状态` ASC,`产品编号` DESC LIMIT {$limit} OFFSET {$pages}";
-                $total = Db::name('产品_基本资料')->count();
+                $total = db('产品_基本资料')->count();
             }
         }
         $list = Db::query($sql);
@@ -113,18 +113,18 @@ class Product extends Api
         $gy_field = 'rtrim(a.Gy0_方案) as 方案,a.Gy0_yjno,a.Gy0_gxh,rtrim(a.gy0_gxmc) as gy0_gxmc,rtrim(a.Add_gxmc) as add_gxmc,a.Gy0_Ks,a.Gy0_ls,rtrim(a.工序备注) as 备注,
         a.工价系数,a.损耗系数,a.Gy0_Ms,a.人工检_正品板,a.人工检_次品板,a.人工检_废检,a.机检_正品板,a.机检_次品板,a.机检_废检,rtrim(a.Gy0_sbmc) as Gy0_sbmc,rtrim(a.Sys_id) as Sys_id,
         a.Sys_rq,a.Mod_rq,b.sys_rate0 as 基础损耗,b.sys_rate1 as 损耗率';
-        $gyRes = Db::name('产品_工艺资料')->alias('a')
+        $gyRes = db('产品_工艺资料')->alias('a')
             ->join('dic_lzsh b','a.Gy0_shdh = b.sys_bh','left')
             ->where($option)->field($gy_field)->order('a.Gy0_yjno asc,a.Gy0_gxh asc')->select();
         //印件资料
         $where['yj_cpdh'] = $code;
         $field = 'yj_yjno,rtrim(yj_yjdh) as yj_yjdh,yj_yjmc,rtrim(yj_zzdh) as yj_zzdh,rtrim(yj_zzmc) as yj_zzmc,rtrim(yj_tlgg) as yj_tlgg,
         rtrim(yj_klgg) as yj_klgg,yj_ks,yj_ls,rtrim(yj_desc) as yj_desc,rtrim(sys_id) as sys_id,sys_rq,mod_rq';
-        $yjRes = Db::name('产品_印件资料')->where($where)->field($field)->select();
+        $yjRes = db('产品_印件资料')->where($where)->field($field)->select();
         //印版资料
         $filter['a.YB_Cpdh'] = $code;
         $yb_field = 'rtrim(a.YB_方案) as YB_方案,a.YB_Yjno,rtrim(a.存货编码) as 存货编码,a.考核印数,rtrim(a.Sys_id) as Sys_id,a.Mod_rq,rtrim(b.物料名称) as 印版名称';
-        $ybRes = Db::name('产品_印版资料')->alias('a')
+        $ybRes = db('产品_印版资料')->alias('a')
             ->join('物料_存货编码 b','a.存货编码 = b.物料代码')
             ->where($filter)->field($yb_field)->select();
         $list = [];
@@ -157,7 +157,7 @@ class Product extends Api
         a.工价系数 as difficulty_coe,a.损耗系数 as loss_coe,a.Gy0_Ms as ms_coe,a.Gy0_Ks,a.Gy0_ls,rtrim(a.Gy0_site) as Gy0_site,rtrim(a.Add_gxmc) as Add_gxmc,a.UniqID,a.Gy0_辅助工时,
         rtrim(a.工序备注) as remark,a.人工检_正品板 as artificial_zp,a.人工检_次品板 as artificial_cp,a.人工检_废检 as artificial_fj,a.机检_正品板 as machine_zp,a.机检_次品板 as machine_cp,
         a.机检_废检 as machine_fj,rtrim(b.客户名称) as custom_name,rtrim(b.产品名称) as product_name';
-        $gyRes = Db::name('产品_工艺资料')->alias('a')
+        $gyRes = db('产品_工艺资料')->alias('a')
             ->join('产品_基本资料 b','a.Gy0_cpdh = b.产品编号','left')
             ->where($option)->field($gy_field)->order('a.Gy0_yjno asc,a.Gy0_gxh asc')->select();
         $this->success('请求成功',$gyRes);
@@ -200,7 +200,7 @@ class Product extends Api
             if (!empty($value['ms_coe'])){
                 $data['Gy0_Ms'] = $value['ms_coe'];
             }
-            $sql = Db::name('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
+            $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
             $res = Db::query($sql);
             if ($res !== false){
                 $i++;
@@ -232,7 +232,7 @@ class Product extends Api
         }
         $code = $params['印品代号'];
         unset($params['印品代号']);
-        $sql = Db::name('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->update($params);
+        $sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->update($params);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');
@@ -260,7 +260,7 @@ class Product extends Api
         if ($params['status'] == 2){
             $status = '停产';
         }
-        $sql = Db::name('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->setField('状态',$status);
+        $sql = db('产品_基本资料')->where('产品编号',$code)->fetchSql(true)->setField('状态',$status);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');
@@ -283,9 +283,9 @@ class Product extends Api
         if (!isset($code)){
             $this->error('参数不能为空');
         }
-        $res = Db::name('产品_工艺资料')->where('Gy0_cpdh',$code)->distinct(true)->column('rtrim(Gy0_方案) as gy_plan');
+        $res = db('产品_工艺资料')->where('Gy0_cpdh',$code)->distinct(true)->column('rtrim(Gy0_方案) as gy_plan');
         $data['gy'] = $res;
-        $product = Db::name('产品_基本资料')->where('产品编号',$code)->find();
+        $product = db('产品_基本资料')->where('产品编号',$code)->find();
         $data['name'] = rtrim($product['产品名称']);
         $this->success('请求成功',$data);
     }
@@ -314,11 +314,11 @@ class Product extends Api
             //查出参考的工艺数据
             $where['Gy0_cpdh'] = $params['from_code'];
             $where['Gy0_方案'] = $params['from_pro'];
-            $gyList = Db::name('产品_工艺资料')->where($where)->select();
+            $gyList = db('产品_工艺资料')->where($where)->select();
             if (empty($gyList)){
                 $this->error('参考产品无工艺资料数据');
             }
-            $UniqID = Db::name('产品_工艺资料')->order('UniqID desc')->value('UniqID');
+            $UniqID = db('产品_工艺资料')->order('UniqID desc')->value('UniqID');
             foreach ($gyList as $key=>$value){
                 unset($gyList[$key]['UniqID']);
                 $UniqID ++;
@@ -328,9 +328,9 @@ class Product extends Api
             }
         }
         if ($params['is_copy_yb'] == 1){
-            $UniqId = Db::name('产品_印版资料')->order('UniqID desc')->value('UniqID');
+            $UniqId = db('产品_印版资料')->order('UniqID desc')->value('UniqID');
             $option['YB_Cpdh'] = $params['from_code'];
-            $ybList = Db::name('产品_印版资料')->where($option)->select();
+            $ybList = db('产品_印版资料')->where($option)->select();
             if (empty($ybList)){
                 $this->error('参考产品无印版资料数据');
             }
@@ -342,21 +342,21 @@ class Product extends Api
             }
         }
         if ($params['is_copy_gy'] == 1 && $params['is_copy_yb'] == 1){
-            $gyResult = Db::name('产品_工艺资料')->insertAll($gyList);
+            $gyResult = db('产品_工艺资料')->insertAll($gyList);
             if (!$gyResult){
                 $this->error('复制产品工艺资料数据失败');
             }
-            $ybResult = Db::name('产品_印版资料')->insertAll($ybList);
+            $ybResult = db('产品_印版资料')->insertAll($ybList);
             if (!$ybResult){
                 $this->error('复制产品印版资料数据失败');
             }
         }elseif ($params['is_copy_gy'] == 1 && $params['is_copy_yb'] == 0){
-            $gyResult = Db::name('产品_工艺资料')->insertAll($gyList);
+            $gyResult = db('产品_工艺资料')->insertAll($gyList);
             if (!$gyResult){
                 $this->error('复制产品工艺资料数据失败');
             }
         }else{
-            $ybResult = Db::name('产品_印版资料')->insertAll($ybList);
+            $ybResult = db('产品_印版资料')->insertAll($ybList);
             if (!$ybResult){
                 $this->error('复制产品印版资料数据失败');
             }
@@ -380,7 +380,7 @@ class Product extends Api
         }
         $where['Gy0_cpdh'] = $params['code'];
         $where['Gy0_方案'] = $params['old_name'];
-        $sql = Db::name('产品_工艺资料')->where($where)->fetchSql(true)->setField('Gy0_方案',$params['new_name']);
+        $sql = db('产品_工艺资料')->where($where)->fetchSql(true)->setField('Gy0_方案',$params['new_name']);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');
@@ -417,7 +417,7 @@ class Product extends Api
             if (!empty($value['Gy0_ls'])){
                 $data['Gy0_ls'] = $value['Gy0_ls'];
             }
-            $sql = Db::name('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
+            $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
             $res = Db::query($sql);
             if ($res !== false){
                 $i++;
@@ -458,7 +458,7 @@ class Product extends Api
             $data['Add_gxmc'] = $value['Add_gxmc'];
             $data['工序备注'] = $value['remark'];
 
-            $sql = Db::name('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
+            $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
             $res = Db::query($sql);
             if ($res !== false){
                 $i++;
@@ -505,7 +505,7 @@ class Product extends Api
             if (!empty($value['machine_fj'])){
                 $data['机检_废检'] = $value['machine_fj'];
             }
-            $sql = Db::name('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
+            $sql = db('产品_工艺资料')->where('UniqID',$value['UniqID'])->fetchSql(true)->update($data);
             $res = Db::query($sql);
             if ($res !== false){
                 $i++;

+ 29 - 23
application/api/controller/ReportingWork.php

@@ -36,7 +36,8 @@ class ReportingWork extends Api
         }
         $machine = $params['machine'].'#';
         $data = [];
-        $lastData = Db::name('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
+//        $lastData = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
+        $lastData = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
         if ($lastData['UniqId'] < 160000000){
             $id = 160000000;
         }else{
@@ -62,7 +63,8 @@ class ReportingWork extends Api
             for ($i=1;$i<=count($class);$i++){
                 $where['sczl_bh'.$i] = $class[$i-1];
             }
-            $classData = Db::name('设备_班组资料')->where($where)->field('sczl_bzdh,UniqId')->find();
+//            $classData = \db('设备_班组资料')->where($where)->field('sczl_bzdh,UniqId')->find();
+            $classData = \db('设备_班组资料')->where($where)->field('sczl_bzdh,UniqId')->find();
             $data['班组编号'] = $classData['sczl_bzdh'];
             $data['班组ID'] = $classData['UniqId'];
             // 获取当前时间
@@ -84,10 +86,11 @@ class ReportingWork extends Api
             $option['Gy0_gdbh'] = $params['order'];
             $option['Gy0_yjno'] = $params['yjno'];
             $option['Gy0_gxh'] = $data['工序号'];
-            $data['任务ID'] = Db::name('工单_工艺资料')->where($option)->value('UniqId');
+            $data['任务ID'] = \db('工单_工艺资料')->where($option)->value('UniqId');
         }
         $data['UniqId'] = $id;
-        $sql = Db::name('设备_产量采集')->fetchSql(true)->insert($data);
+//        $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
+        $sql = \db('设备_产量采集')->fetchSql(true)->insert($data);
         $res = Db::query($sql);
         if ($res === false){
             $this->success('设置成功');
@@ -120,7 +123,7 @@ class ReportingWork extends Api
         $where['Gy0_yjno'] = $params['yjno'];
         $where['Gy0_gxh'] = $params['gxh'];
         $date = date('Y-m-d H:i:s');
-        $res = Db::name('工单_工艺资料')->where($where)->setField('PD_WG',$date);
+        $res = \db('工单_工艺资料')->where($where)->setField('PD_WG',$date);
         if ($res === false){
             $this->success('设置成功');
         }else{
@@ -141,16 +144,16 @@ class ReportingWork extends Api
             $this->error('参数错误');
         }
         $machine = $params['machine'].'#';
-        $data = Db::name('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
+        $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
         $list = [];
         $list['order'] = $data['工单编号'];
         $list['yjno'] = $data['印件号'];
-        $name = Db::name('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
+        $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
         $list['product_name'] = rtrim($name);
         $where['Gy0_gdbh'] = $data['工单编号'];
         $where['Gy0_yjno'] = $data['印件号'];
         $where['Gy0_gxh'] = $data['工序号'];
-        $gxmc = Db::name('工单_工艺资料')->where($where)->value('Gy0_gxmc');
+        $gxmc = \db('工单_工艺资料')->where($where)->value('Gy0_gxmc');
         $list['gxmc'] = rtrim($gxmc);
         $this->success('请求成功',$list);
     }
@@ -182,7 +185,7 @@ class ReportingWork extends Api
                 $code = 'ZM'.$params['code'];
             }
         }
-        $data = Db::name('人事_基本资料')->where('员工编号',$code)->value('员工姓名');
+        $data = \db('人事_基本资料')->where('员工编号',$code)->value('员工姓名');
         $this->success('请求成功',rtrim($data));
     }
     /**
@@ -214,19 +217,22 @@ class ReportingWork extends Api
         $data['检验备注'] = $params['remark'];
         $data['提交时间'] = date('Y-m-d H:i:s');
         $data['sys_rq'] = date('Y-m-d H:i:s');
-        $produce = Db::name('设备_产量采集')->where('设备编号',$params['machine'].'#')->where('工单编号',$params['order'])->order('UniqId desc')->find();
+        $produce = \db('设备_产量采集')->where('设备编号',$params['machine'].'#')->where('工单编号',$params['order'])->order('UniqId desc')->find();
+//        $produce = \db('设备_产量采集')->where('设备编号',$params['machine'].'#')->where('工单编号',$params['order'])->order('UniqId desc')->find();
         if (!empty($produce)){
             $data['工序名称'] = $produce['工序名称'];
             $data['班组编号'] = rtrim($produce['班组编号']);
             $data['开工时间'] = $produce['开工时间'];
         }
-        $res = Db::name('制程检验_记录')->field('UniqId')->order('UniqId desc')->find();
+//        $res = \db('制程检验_记录')->field('UniqId')->order('UniqId desc')->find();
+        $res = \db('制程检验_记录')->field('UniqId')->order('UniqId desc')->find();
         if ($res['UniqId'] < 100000000){
             $data['UniqId'] = 100000000;
         }else{
             $data['UniqId'] = $res['UniqId'] + 1;
         }
-        $sql = Db::name('制程检验_记录')->fetchSql(true)->insert($data);
+//        $sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
+        $sql = \db('制程检验_记录')->fetchSql(true)->insert($data);
         $result = Db::query($sql);
         if ($result === false){
             $this->error('提交失败');
@@ -249,12 +255,12 @@ class ReportingWork extends Api
         }
         $machine = $params['machine'].'#';
         $data = [];
-        $produce = Db::name('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
+        $produce = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
         $data['order_info']['order'] = $produce['工单编号'];
         $data['order_info']['yjno'] = $produce['印件号'];
         $data['order_info']['gxh'] = $produce['工序号'];
         $data['order_info']['gxmc'] = $produce['工序名称'];
-        $product = Db::name('工单_基本资料')->alias('a')
+        $product = \db('工单_基本资料')->alias('a')
             ->join('工单_工艺资料 b','a.Gd_Gdbh = b.Gy0_gdbh','left')
             ->join('工单_印件资料 c','a.Gd_Gdbh = c.Yj_gdbh','left')
             ->field('a.成品名称,b.Gy0_gxmc,c.yj_yjmc')
@@ -271,11 +277,11 @@ class ReportingWork extends Api
             $data['order_info']['yj_name'] = rtrim($product[0]['yj_yjmc']);
             $data['order_info']['gy_name'] = rtrim($product[0]['Gy0_gxmc']);
         }
-        $class = Db::name('设备_班组资料')->where('UniqId',$produce['班组ID'])->find();
+        $class = \db('设备_班组资料')->where('UniqId',$produce['班组ID'])->find();
         for ($i=1;$i<11;$i++){
             $name = '';
             if (!empty($class['sczl_bh'.$i])){
-                $name = Db::name('人事_基本资料')->where('员工编号',$class['sczl_bh'.$i])->value('员工姓名');
+                $name = \db('人事_基本资料')->where('员工编号',$class['sczl_bh'.$i])->value('员工姓名');
             }
             $class['sczl_name'.$i] = rtrim($name);
         }
@@ -335,11 +341,11 @@ class ReportingWork extends Api
         unset($data['main_meter']);
         unset($data['auxiliary_meter']);
         unset($data['bom']);
-        $start_time = Db::name('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
+        $start_time = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
         $data['开工时间'] = $start_time['开工时间'];
-        $sys_id = Db::name('设备_基本资料')->where('设备编号',$machine)->value('sys_sbID');
+        $sys_id = \db('设备_基本资料')->where('设备编号',$machine)->value('sys_sbID');
         $data['sys_id'] = '['.$sys_id.'/'.$machine.']';
-        $UniqId = Db::name('设备_产量计酬')->order('UniqId desc')->value('UniqId');
+        $UniqId = \db('设备_产量计酬')->order('UniqId desc')->value('UniqId');
         if ($UniqId < 10000000){
             $data['UniqId'] = 10000000;
         }else{
@@ -365,7 +371,7 @@ class ReportingWork extends Api
 
         $batchData = explode(',',$batch);
         $newData = [];
-        $batchUniqId = Db::name('物料_批次跟踪')->order('UniqId desc')->value('UniqId');
+        $batchUniqId = \db('物料_批次跟踪')->order('UniqId desc')->value('UniqId');
         if ($batchUniqId < 10000000){
             $batchUniqId = 10000000;
         }
@@ -387,9 +393,9 @@ class ReportingWork extends Api
         $batch_res = true;
         Db::startTrans();
         try {
-            $sql = Db::name('设备_产量计酬')->fetchSql(true)->insert($data);
+            $sql = \db('设备_产量计酬')->fetchSql(true)->insert($data);
             $res = Db::query($sql);
-            $batch_sql = Db::name('物料_批次跟踪')->fetchSql(true)->insertAll($newData);
+            $batch_sql = \db('物料_批次跟踪')->fetchSql(true)->insertAll($newData);
             $batch_res = Db::query($batch_sql);
             Db::commit();
         }catch (\Exception $e){
@@ -412,7 +418,7 @@ class ReportingWork extends Api
             $this->error('非法请求');
         }
         $params = Request::instance()->get();
-        $data = Db::name('设备_基本资料')->where('sys_sbID',$params['addr'])->field('设备编号')->find();
+        $data = \db('设备_基本资料')->where('sys_sbID',$params['addr'])->field('设备编号')->find();
         $this->success('请求成功',$data);
     }
 }

+ 10 - 10
application/api/controller/Staff.php

@@ -59,14 +59,14 @@ class Staff extends Api
         $field = '员工编号,rtrim(员工姓名) as 员工姓名,性别,聘用日期,转正日期,rtrim(所在部门) as 所在部门,rtrim(部门编码) as 部门编码,rtrim(职称职务) as 职称职务,rtrim(身份证号) as 身份证号,出生日期,
         rtrim(人员性质) as 人员性质,rtrim(人员类别) as 人员类别,班次类型,工资表类别,薪酬核算分组,rtrim(在职状态) as 在职状态,rtrim(U8在职) as U8在职,U8离职日期,rtrim(sys_id) as sys_id,sys_rq,mod_rq';
         if (strlen($params['department_code']) > 1){
-            $list = Db::name('人事_基本资料')->where($where)->where('部门编码',$params['department_code'])->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
-            $total = Db::name('人事_基本资料')->where($where)->where('部门编码',$params['department_code'])->count();
+            $list = db('人事_基本资料')->where($where)->where('部门编码',$params['department_code'])->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
+            $total = db('人事_基本资料')->where($where)->where('部门编码',$params['department_code'])->count();
         }else if (strlen($params['department_code']) == 1){
-            $list = Db::name('人事_基本资料')->where($where)->where('LEFT(部门编码,1)='.$params['department_code'])->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
-            $total = Db::name('人事_基本资料')->where($where)->where('LEFT(部门编码,1)='.$params['department_code'])->count();
+            $list = db('人事_基本资料')->where($where)->where('LEFT(部门编码,1)='.$params['department_code'])->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
+            $total = db('人事_基本资料')->where($where)->where('LEFT(部门编码,1)='.$params['department_code'])->count();
         }else{
-            $list = Db::name('人事_基本资料')->where($where)->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
-            $total = Db::name('人事_基本资料')->where($where)->count();
+            $list = db('人事_基本资料')->where($where)->field($field)->page($pages)->limit($limit)->order('UniqID asc')->select();
+            $total = db('人事_基本资料')->where($where)->count();
         }
         $data['list'] = $list;
         $data['total'] = $total;
@@ -100,11 +100,11 @@ class Staff extends Api
                 $list[$key] = $value;
             }
         }
-        $six = Db::name('人事_基本资料')->where('在职状态','在职')->where('U8在职','离职')->count();
+        $six = db('人事_基本资料')->where('在职状态','在职')->where('U8在职','离职')->count();
         $sixArr['编号'] = '';
         $sixArr['名称'] = '离职工资结算中';
         $sixArr['total'] = $six;
-        $sev = Db::name('人事_基本资料')->where('在职状态','离职')->where('U8在职','离职')->count();
+        $sev = db('人事_基本资料')->where('在职状态','离职')->where('U8在职','离职')->count();
         $sevArr['编号'] = '';
         $sevArr['名称'] = '离职清单';
         $sevArr['total'] = $sev;
@@ -141,7 +141,7 @@ class Staff extends Api
         }
         $field = '员工编号,rtrim(员工姓名) as 员工姓名,性别,聘用日期,转正日期,rtrim(所在部门) as 所在部门,rtrim(部门编码) as 部门编码,rtrim(职称职务) as 职称职务,rtrim(身份证号) as 身份证号,出生日期,
         rtrim(人员性质) as 人员性质,rtrim(人员类别) as 人员类别,班次类型,工资表类别,薪酬核算分组,rtrim(在职状态) as 在职状态,rtrim(U8在职) as U8在职,U8离职日期,rtrim(sys_id) as sys_id,sys_rq,mod_rq';
-        $data = Db::name('人事_基本资料')->where($where)->field($field)->find();
+        $data = db('人事_基本资料')->where($where)->field($field)->find();
         $this->success('请求成功',$data);
     }
     /**
@@ -160,7 +160,7 @@ class Staff extends Api
         }
         $staffCode = $params['员工编号'];
         unset($params['员工编号']);
-        $sql = Db::name('人事_基本资料')->where('员工编号',$staffCode)->fetchSql(true)->update($params);
+        $sql = db('人事_基本资料')->where('员工编号',$staffCode)->fetchSql(true)->update($params);
         $res = Db::query($sql);
         if ($res !== false){
             $this->success('更新成功');

+ 39 - 39
application/api/controller/WorkOrderVerification.php

@@ -166,60 +166,60 @@ class WorkOrderVerification extends Api
         fp_bz1,fp_bz2,fp_bz3,fp_bz4,fp_bz5,fp_bz6,fp_bz7,fp_bz8,fp_bz9,fp_bz10,fp_bz11,fp_bz12,fp_bz13,
         fp_gxmc1,fp_gxmc2,fp_gxmc3,fp_gxmc4,fp_gxmc5,fp_gxmc6,fp_gxmc7,fp_gxmc8,fp_gxmc9,fp_gxmc10,fp_gxmc11,fp_gxmc12,fp_gxmc13,
         sys_id,rtrim(sys_rq) as sys_rq,UniqId';
-        $list = Db::name('db_qczl')->where('UniqId',$params['UniqId'])->field($field)->find();
+        $list = db('db_qczl')->where('UniqId',$params['UniqId'])->field($field)->find();
         $list['fp_name1'] = '';
         if (!empty($list['fp_bh1'])){
-            $list['fp_name1'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh1'])->value('rtrim(员工姓名)');
+            $list['fp_name1'] = db('人事_基本资料')->where('员工编号',$list['fp_bh1'])->value('rtrim(员工姓名)');
         }
         $list['fp_name2'] = '';
         if (!empty($list['fp_bh2'])){
-            $list['fp_name2'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh2'])->value('rtrim(员工姓名)');
+            $list['fp_name2'] = db('人事_基本资料')->where('员工编号',$list['fp_bh2'])->value('rtrim(员工姓名)');
         }
         $list['fp_name3'] = '';
         if (!empty($list['fp_bh3'])){
-            $list['fp_name3'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh3'])->value('rtrim(员工姓名)');
+            $list['fp_name3'] = db('人事_基本资料')->where('员工编号',$list['fp_bh3'])->value('rtrim(员工姓名)');
         }
         $list['fp_name4'] = '';
         if (!empty($list['fp_bh4'])){
-            $list['fp_name4'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh4'])->value('rtrim(员工姓名)');
+            $list['fp_name4'] = db('人事_基本资料')->where('员工编号',$list['fp_bh4'])->value('rtrim(员工姓名)');
         }
         $list['fp_name5'] = '';
         if (!empty($list['fp_bh5'])){
-            $list['fp_name5'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh5'])->value('rtrim(员工姓名)');
+            $list['fp_name5'] = db('人事_基本资料')->where('员工编号',$list['fp_bh5'])->value('rtrim(员工姓名)');
         }
         $list['fp_name6'] = '';
         if (!empty($list['fp_bh6'])){
-            $list['fp_name6'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh6'])->value('rtrim(员工姓名)');
+            $list['fp_name6'] = db('人事_基本资料')->where('员工编号',$list['fp_bh6'])->value('rtrim(员工姓名)');
         }
         $list['fp_name7'] = '';
         if (!empty($list['fp_bh7'])){
-            $list['fp_name7'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh7'])->value('rtrim(员工姓名)');
+            $list['fp_name7'] = db('人事_基本资料')->where('员工编号',$list['fp_bh7'])->value('rtrim(员工姓名)');
         }
         $list['fp_name8'] = '';
         if (!empty($list['fp_bh8'])){
-            $list['fp_name8'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh8'])->value('rtrim(员工姓名)');
+            $list['fp_name8'] = db('人事_基本资料')->where('员工编号',$list['fp_bh8'])->value('rtrim(员工姓名)');
         }
         $list['fp_name9'] = '';
         if (!empty($list['fp_bh9'])){
-            $list['fp_name9'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh9'])->value('rtrim(员工姓名)');
+            $list['fp_name9'] = db('人事_基本资料')->where('员工编号',$list['fp_bh9'])->value('rtrim(员工姓名)');
         }
         $list['fp_name10'] = '';
         if (!empty($list['fp_bh10'])){
-            $list['fp_name10'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh10'])->value('rtrim(员工姓名)');
+            $list['fp_name10'] = db('人事_基本资料')->where('员工编号',$list['fp_bh10'])->value('rtrim(员工姓名)');
         }
         $list['fp_name11'] = '';
         if (!empty($list['fp_bh11'])){
-            $list['fp_name11'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh11'])->value('rtrim(员工姓名)');
+            $list['fp_name11'] = db('人事_基本资料')->where('员工编号',$list['fp_bh11'])->value('rtrim(员工姓名)');
         }
         $list['fp_name12'] = '';
         if (!empty($list['fp_bh12'])){
-            $list['fp_name12'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh12'])->value('rtrim(员工姓名)');
+            $list['fp_name12'] = db('人事_基本资料')->where('员工编号',$list['fp_bh12'])->value('rtrim(员工姓名)');
         }
         $list['fp_name13'] = '';
         if (!empty($list['fp_bh13'])){
-            $list['fp_name13'] = Db::name('人事_基本资料')->where('员工编号',$list['fp_bh13'])->value('rtrim(员工姓名)');
+            $list['fp_name13'] = db('人事_基本资料')->where('员工编号',$list['fp_bh13'])->value('rtrim(员工姓名)');
         }
-        $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$list['qczl_gdbh'])->field('MAX(sczl_num) as sczl_num')->find();
+        $max = db('设备_产量计酬')->where('sczl_gdbh',$list['qczl_gdbh'])->field('MAX(sczl_num) as sczl_num')->find();
         $list['total_liucheng'] = $max['sczl_num'];
         $this->success('请求成功',$list);
     }
@@ -236,7 +236,7 @@ class WorkOrderVerification extends Api
         if (!isset($params['order']) || empty($params['order'])){
             $this->error('参数错误');
         }
-        $list = Db::name('工单_基本资料')->alias('a')
+        $list = db('工单_基本资料')->alias('a')
             ->join('工单_印件资料 b','a.Gd_gdbh = b.Yj_Gdbh','left')
             ->where('a.Gd_gdbh',$params['order'])
             ->where('a.行号',1)
@@ -263,13 +263,13 @@ class WorkOrderVerification extends Api
         }
         $where['Yj_Gdbh'] = $params['order'];
         $where['yj_Yjno'] = $params['yj_no'];
-        $list = Db::name('工单_印件资料')->where($where)->field('yj_yjmc')->find();
+        $list = db('工单_印件资料')->where($where)->field('yj_yjmc')->find();
         $option['Gy0_gdbh'] = $params['order'];
         $option['Gy0_yjno'] = $params['yj_no'];
         $option['Gy0_site'] = '检验车间';
         $option['Gy0_gxmc'] = array('not in',['包装','外发加工','废挑正','成品防护']);
-        $gxList = Db::name('工单_工艺资料')->where($option)->field('Gy0_gxh,rtrim(Gy0_gxmc) as Gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')->select();
-        $max = Db::name('设备_产量计酬')->where('sczl_gdbh',$params['order'])->where('sczl_yjno',$params['yj_no'])->field('MAX(sczl_num) as sczl_num')->value('sczl_num');
+        $gxList = db('工单_工艺资料')->where($option)->field('Gy0_gxh,rtrim(Gy0_gxmc) as Gy0_gxmc,rtrim(Add_gxmc) as Add_gxmc')->select();
+        $max = db('设备_产量计酬')->where('sczl_gdbh',$params['order'])->where('sczl_yjno',$params['yj_no'])->field('MAX(sczl_num) as sczl_num')->value('sczl_num');
         $list['gx_data'] = $gxList;
         $list['max_num'] = $max;
         $this->success('请求成功',$list);
@@ -290,7 +290,7 @@ class WorkOrderVerification extends Api
         }
         $where['分类'] = '废品分类';
         $where['名称'] = array('like','%'.$params['search'].'%');
-        $data = Db::name('erp_常用字典')->where($where)->column('名称');
+        $data = db('erp_常用字典')->where($where)->column('名称');
         // 分割字符串并合并相同项
         $resultArray = [];
         foreach ($data as $item) {
@@ -335,7 +335,7 @@ class WorkOrderVerification extends Api
             $this->error('参数错误');
         }
         $type = trim($params['type']);
-        $waste = Db::name('erp_常用字典')->where('名称','like','%'.$type.'%')->find();
+        $waste = db('erp_常用字典')->where('名称','like','%'.$type.'%')->find();
         if (empty($waste)){
             $this->error('未查询到废品分类');
         }
@@ -344,7 +344,7 @@ class WorkOrderVerification extends Api
         $search = substr($searchArr[1],0,6);
         $where['a.sczl_gdbh'] = $params['order'];
         $where['a.sczl_type'] = array('like','%'.$search.'%');
-        $list = Db::name('设备_产量计酬')->alias('a')
+        $list = db('设备_产量计酬')->alias('a')
             ->join('人事_基本资料 b','a.sczl_bh1 = b.员工编号','left')
             ->where($where)->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
             ->select();
@@ -371,7 +371,7 @@ class WorkOrderVerification extends Api
         }
         $id = $params['UniqId'];
         unset($params['UniqId']);
-        $sql = Db::name('db_qczl')->where('UniqId',$id)->fetchSql(true)->update($params);
+        $sql = db('db_qczl')->where('UniqId',$id)->fetchSql(true)->update($params);
         $res = Db::query($sql);
         if ($res !== 0){
             $this->success('更新成功');
@@ -397,7 +397,7 @@ class WorkOrderVerification extends Api
         rtrim(fp_lb8) as fp_lb8,rtrim(fp_lb9) as fp_lb9,rtrim(fp_lb10) as fp_lb10,rtrim(fp_lb11) as fp_lb11,rtrim(fp_lb12) as fp_lb12,rtrim(fp_lb13) as fp_lb13,
         fp_sl1,fp_sl2,fp_sl3,fp_sl4,fp_sl5,fp_sl6,fp_sl7,fp_sl8,fp_sl9,fp_sl10,fp_sl11,fp_sl12,fp_sl13
         ';
-        $data = Db::name('db_qczl')->name('db_qczl')->where('qczl_gdbh',$params['order'])->field($field)->select();
+        $data = db('db_qczl')->name('db_qczl')->where('qczl_gdbh',$params['order'])->field($field)->select();
         if (empty($data)){
             $this->error('暂无废品数据');
         }
@@ -421,19 +421,19 @@ class WorkOrderVerification extends Api
             }
         }
         ksort($categories);
-        $wasteTotal = Db::name('db_qczl')->where('qczl_gdbh',$params['order'])->sum('qczl_fp');
+        $wasteTotal = db('db_qczl')->where('qczl_gdbh',$params['order'])->sum('qczl_fp');
         if (empty($wasteTotal)){
             $wasteTotal = 0;
         }
         $where['a.Gd_gdbh'] = $params['order'];
         $where['a.行号'] = 1;
-        $gdInfo = Db::name('工单_基本资料')->alias('a')
+        $gdInfo = db('工单_基本资料')->alias('a')
             ->join('工单_印件资料 b','a.Gd_gdbh = b.Yj_Gdbh','left')
             ->where($where)->field('a.Gd_gdbh,a.实际投料,b.yj_Yjno,b.yj_yjmc')->find();
         $gdInfo['yj_Yjno'] = $gdInfo['yj_Yjno'] > 10 ? $gdInfo['yj_Yjno']:'0'.$gdInfo['yj_Yjno'];
         $gdInfo['实际投料'] = (int)($gdInfo['实际投料'] * 10000);
         $gdInfo['wasteTotal'] = $wasteTotal;
-        $finishNum = Db::name('成品入仓')->where('jjcp_gdbh',$params['order'])->sum('jjcp_sl');
+        $finishNum = db('成品入仓')->where('jjcp_gdbh',$params['order'])->sum('jjcp_sl');
         $gdInfo['passRate'] = '';
         if (!empty($finishNum)){
             $gdInfo['passRate'] = number_format((int)$finishNum/$gdInfo['实际投料']*100,2).'%';
@@ -470,7 +470,7 @@ class WorkOrderVerification extends Api
         $i = 0;
         $name = array();
         foreach ($newArray as $key=>$value){
-            $item = Db::name('erp_常用字典')->where('名称','like','%'.$key.'%')->value('名称');
+            $item = db('erp_常用字典')->where('名称','like','%'.$key.'%')->value('名称');
             $item = explode('_',substr($item,0,-1));
             $rightData[$i]['type'] = $item[1];
             $rightData[$i]['rate'] = number_format($value/$wasteTotal*100,0).'%';
@@ -499,8 +499,8 @@ class WorkOrderVerification extends Api
         }
         $where['a.Gy0_gdbh'] = $params['order'];
         $where['a.Gy0_sbbh'] = array('neq',' ');
-        $productNum = Db::name('工单_基本资料')->where('Gd_gdbh',$params['order'])->value('计划投料');
-        $gyData = Db::name('工单_工艺资料')->alias('a')
+        $productNum = db('工单_基本资料')->where('Gd_gdbh',$params['order'])->value('计划投料');
+        $gyData = db('工单_工艺资料')->alias('a')
             ->join('设备_产量计酬 b','a.Gy0_gdbh = b.sczl_gdbh and a.Gy0_gxh = b.sczl_gxh','left')
             ->where($where)
             ->field('a.Gy0_yjno,a.Gy0_gxh,rtrim(a.Gy0_gxmc) as Gy0_gxmc,a.Gy0_sbbh,a.Gy0_Rate0,a.Gy0_Rate1,a.损耗系数 as Gy0_Rate3,a.Gy0_Ms,a.Gy0_SITE,a.Gy0_计划接货数,a.PD_WG,
@@ -570,7 +570,7 @@ class WorkOrderVerification extends Api
         if (empty($params['date'])){
             $params['date'] = '1900-01-01 00:00:00';
         }
-        $res = Db::name('工单_工艺资料')->where('UniqId',$params['UniqId'])->setField('PD_WG',$params['date']);
+        $res = db('工单_工艺资料')->where('UniqId',$params['UniqId'])->setField('PD_WG',$params['date']);
         if ($res != false){
             $this->success('更新成功');
         }else{
@@ -593,10 +593,10 @@ class WorkOrderVerification extends Api
         $where['Gd_gdbh'] = $params['order'];
         $where['行号'] = 1;
         //工单基本资料
-        $info = Db::name('工单_基本资料')->where($where)->field('rtrim(成品代号)  as code,rtrim(成品名称) as name')->find();
+        $info = db('工单_基本资料')->where($where)->field('rtrim(成品代号)  as code,rtrim(成品名称) as name')->find();
         //工艺资料
         $option['Gy0_gdbh'] = $params['order'];
-        $gyInfo = Db::name('工单_工艺资料')
+        $gyInfo = db('工单_工艺资料')
             ->where($option)
             ->where(function ($query) {
                 $query->where('Gy0_sbbh', '<>', '')
@@ -630,10 +630,10 @@ class WorkOrderVerification extends Api
         if (!isset($params['gxNo']) || empty($params['gxNo'])){
             $this->error('参数错误');
         }
-        $total = Db::name('设备_产量计酬')->where('sczl_gdbh',$params['order'])->order('sczl_num')->column('distinct(sczl_num)');
+        $total = db('设备_产量计酬')->where('sczl_gdbh',$params['order'])->order('sczl_num')->column('distinct(sczl_num)');
         $where['sczl_gxh'] = (int)$params['gxNo'];
         $where['sczl_gdbh'] = $params['order'];
-        $process = Db::name('设备_产量计酬')->where($where)->order('sczl_num')->column('distinct(sczl_num)');
+        $process = db('设备_产量计酬')->where($where)->order('sczl_num')->column('distinct(sczl_num)');
         $res['total_process'] = $total;
         $res['process'] = $process;
         $this->success('请求成功',$res);
@@ -667,7 +667,7 @@ class WorkOrderVerification extends Api
         qczl_rq
         ';
 
-        $data = Db::name('db_qczl')
+        $data = db('db_qczl')
             ->where($where)
             ->where(function ($query) {
                 for ($i = 1; $i <= 13; $i++) {
@@ -688,7 +688,7 @@ class WorkOrderVerification extends Api
                         $list[$j]['fp_lb'] = $entry[$labelKey];
                         $list[$j]['fp_sl'] = $entry[$slKey];
                         $list[$j]['fp_bh'] = $entry[$bhKey];
-                        $name = Db::name('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
+                        $name = db('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
                         $list[$j]['fp_name'] = empty($name) ? '计时工' : $name;
                         $list[$j]['fp_bz'] = $entry[$bzKey];
                         $list[$j]['qczl_rq'] = $entry['qczl_rq'];
@@ -771,7 +771,7 @@ class WorkOrderVerification extends Api
         ';
         $where['a.qczl_gdbh'] = $params['order'];
         $where['b.行号'] = 1;
-        $data = Db::name('db_qczl')->alias('a')
+        $data = db('db_qczl')->alias('a')
             ->join('工单_基本资料 b','a.qczl_gdbh = b.Gd_gdbh','left')
             ->join('工单_印件资料 c','a.qczl_gdbh = c.Yj_Gdbh','left')
             ->join('成品入仓 d','a.qczl_gdbh = d.jjcp_gdbh','left')
@@ -789,7 +789,7 @@ class WorkOrderVerification extends Api
                     $list[$j]['fp_lb'] = $entry[$labelKey];
                     $list[$j]['fp_sl'] = $entry[$slKey];
                     $list[$j]['fp_bh'] = $entry[$bhKey];
-                    $name = Db::name('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
+                    $name = db('人事_基本资料')->where('员工编号',$entry[$bhKey])->value('rtrim(员工姓名)');
                     $list[$j]['fp_name'] =  $name;
                     $list[$j]['fp_gxh'] = empty(substr($entry[$gxhKey],0,2)) ? "0" : substr($entry[$gxhKey],0,2);
                     $list[$j]['qczl_num'] = $entry['qczl_num'];