Parcourir la source

超节损计算优化

qiuenguang il y a 1 an
Parent
commit
6a1475460b

+ 15 - 126
application/api/controller/OrderSuperLoss.php

@@ -205,6 +205,7 @@ class OrderSuperLoss extends Api
                 //查出成品数量及日期
                 //查出成品数量及日期
                 $cp_sql = "SELECT SUM(jjcp_sl) as cp_sl,MAX(jjcp_sj) as jjcp_sj FROM `成品入仓` WHERE jjcp_gdbh = '{$value['Gd_gdbh']}' AND jjcp_yjno = '{$value['jjcp_yjno']}' GROUP BY jjcp_gdbh,jjcp_yjno";
                 $cp_sql = "SELECT SUM(jjcp_sl) as cp_sl,MAX(jjcp_sj) as jjcp_sj FROM `成品入仓` WHERE jjcp_gdbh = '{$value['Gd_gdbh']}' AND jjcp_yjno = '{$value['jjcp_yjno']}' GROUP BY jjcp_gdbh,jjcp_yjno";
                 $cp_data = Db::query($cp_sql);
                 $cp_data = Db::query($cp_sql);
+                //入仓总数
                 $data[$key]['warehousing_num'] = $cp_data[0]['cp_sl'];
                 $data[$key]['warehousing_num'] = $cp_data[0]['cp_sl'];
                 $data[$key]['warehousing_date'] = substr($cp_data[0]['jjcp_sj'],0,10);
                 $data[$key]['warehousing_date'] = substr($cp_data[0]['jjcp_sj'],0,10);
                 //查出进入超节损的工序,有上报产量的工序就进入超节损
                 //查出进入超节损的工序,有上报产量的工序就进入超节损
@@ -238,7 +239,7 @@ class OrderSuperLoss extends Api
                         $rate = 0;
                         $rate = 0;
                     }
                     }
                     $arr[$k] = floor($rate * 10000) /10000;
                     $arr[$k] = floor($rate * 10000) /10000;
-                    $plan_loss[$k] = $v['Gy0_计划损耗'];
+                    $plan_loss[$k] = $v['Gy0_计划损耗']*$v['Gy0_ls']*$value['yj_ks'];
                 }
                 }
                 if ((int)$value['yj_ls'] > 0){
                 if ((int)$value['yj_ls'] > 0){
                     $value['实际投料'] = number_format(((int)$value['实际投料']/10000)*$value['yj_ls']*$value['yj_ks'],4);
                     $value['实际投料'] = number_format(((int)$value['实际投料']/10000)*$value['yj_ls']*$value['yj_ks'],4);
@@ -257,8 +258,8 @@ class OrderSuperLoss extends Api
                 }
                 }
 
 
                 //制程废品
                 //制程废品
-                $zzfp_data =db('设备_产量计酬')->where('sczl_gdbh',$value['Gd_gdbh'])->where('sczl_yjno',$value['jjcp_yjno'])->field('SUM(sczl_zcfp) as sczl_zcfp')->select();
-                $data[$key]['zcfp'] = $zzfp_data[0]['sczl_zcfp'] * $value['yj_ls'];//制程废品
+                $zzfp_data =db('设备_产量计酬')->where('sczl_gdbh',$value['Gd_gdbh'])->where('sczl_yjno',$value['jjcp_yjno'])->value('SUM(sczl_zcfp) as sczl_zcfp');
+                $data[$key]['zcfp'] = $zzfp_data * $value['yj_ls'];//制程废品
                 //废品合计
                 //废品合计
                 $wasteTotal = db('db_qczl')->where('qczl_gdbh',$value['Gd_gdbh'])->where('qczl_yjno',$value['jjcp_yjno'])->sum('qczl_fp');
                 $wasteTotal = db('db_qczl')->where('qczl_gdbh',$value['Gd_gdbh'])->where('qczl_yjno',$value['jjcp_yjno'])->sum('qczl_fp');
                 if (empty($wasteTotal)){
                 if (empty($wasteTotal)){
@@ -288,51 +289,25 @@ class OrderSuperLoss extends Api
                         $bhKey = "fp_bh" . $i;
                         $bhKey = "fp_bh" . $i;
                         $gxmcKey = "fp_gxmc" . $i;
                         $gxmcKey = "fp_gxmc" . $i;
                         $slKey = "fp_sl" . $i;
                         $slKey = "fp_sl" . $i;
-//                        if (!empty($entry[$labelKey])) {
-//                            if (substr($entry[$gxmcKey],0,2) == '99'){
-//                                $list[$j]= $entry[$slKey];
-//                                $j++;
-//                            }
-//                            if (substr($entry[$labelKey],0,1) == 'L' ){
-//                                $material[$n]= $entry[$slKey];
-//                                $n++;
-//                            }
-//                            if (substr($entry[$labelKey],0,3) == 'M04' ){
-//                                $change[$l]= $entry[$slKey];
-//                                $l++;
-//                            }
-//                        }
-//                        if (!empty($entry[$bhKey])) {
-//                            if ($entry[$bhKey] != '000000' && $entry[$slKey] > 0){
-//                                $quality[$m]= $entry[$slKey];
-//                                $m++;
-//                            }
-////                            if ($entry[$bhKey] != '000000' && substr($entry[$labelKey],0,3) == 'K01'){
-////                                $machine[$o]= $entry[$slKey];
-////                                $o++;
-////                            }
-//                        }
                         if (!empty($entry[$labelKey])) {
                         if (!empty($entry[$labelKey])) {
+                            //外发加工废
                             if (substr($entry[$labelKey],0,3) == 'M04'){
                             if (substr($entry[$labelKey],0,3) == 'M04'){
                                 $list[$j]= $entry[$slKey];
                                 $list[$j]= $entry[$slKey];
                                 $j++;
                                 $j++;
                             }
                             }
+                            //材料废
                             if (substr($entry[$labelKey],0,1) == 'L' ){
                             if (substr($entry[$labelKey],0,1) == 'L' ){
                                 $material[$n]= $entry[$slKey];
                                 $material[$n]= $entry[$slKey];
                                 $n++;
                                 $n++;
                             }
                             }
+                            //零头处理
                             if (substr($entry[$labelKey],0,3) == 'M01' ){
                             if (substr($entry[$labelKey],0,3) == 'M01' ){
                                 $change[$l]= $entry[$slKey];
                                 $change[$l]= $entry[$slKey];
                                 $l++;
                                 $l++;
                             }
                             }
                         }
                         }
-//                if (!empty($entry[$bhKey])) {
-//                    if ($entry[$bhKey] != '000000' && $entry[$slKey] > 0){
                         $quality[$m]= $entry[$slKey];
                         $quality[$m]= $entry[$slKey];
                         $m++;
                         $m++;
-//                    }
-//                }
-
                     }
                     }
                 }
                 }
                 $machine_waste = array_sum($machine);//机检废品
                 $machine_waste = array_sum($machine);//机检废品
@@ -347,7 +322,7 @@ class OrderSuperLoss extends Api
                  * 机检节损数 = 机检计划损耗 - 机检质检废品
                  * 机检节损数 = 机检计划损耗 - 机检质检废品
                  */
                  */
                 $machine_loss = $machine_plan_loss - $machine_waste;
                 $machine_loss = $machine_plan_loss - $machine_waste;
-                $order_loss = $data[$key]['工单计划损耗'] - ($data[$key]['废品合计'] - array_sum($list));
+                $order_loss = $data[$key]['工单计划损耗'] - ($data[$key]['废品合计'] - array_sum($list) - array_sum($material)+$data[$key]['工单无形损'] );
                 $guige = \db('物料_存货编码')
                 $guige = \db('物料_存货编码')
                     ->where('物料代码',$data[$key]['成品编码'])
                     ->where('物料代码',$data[$key]['成品编码'])
                     ->value('rtrim(规格)');
                     ->value('rtrim(规格)');
@@ -357,12 +332,6 @@ class OrderSuperLoss extends Api
                 }else{
                 }else{
                     $moneyRate = 0.09;
                     $moneyRate = 0.09;
                 }
                 }
-//                if (strpos($data[$key]['成品名称'],'小盒')){
-//                    $moneyRate = 0.02;
-//                }else{
-//                    $moneyRate = 0.09;
-//                }
-
                 $reward = $order_loss * $moneyRate;
                 $reward = $order_loss * $moneyRate;
                 $data[$key]['reward_rate'] = '1';
                 $data[$key]['reward_rate'] = '1';
                 if ($data[$key]['质量考核'] === 0){
                 if ($data[$key]['质量考核'] === 0){
@@ -382,11 +351,7 @@ class OrderSuperLoss extends Api
                 'data'=>$data,
                 'data'=>$data,
                 'total' => $total
                 'total' => $total
             ];
             ];
-//            if ($str != false){
-//                Cache::set('OrderSuperLoss/getList'.$str,$res,3600);
-//            }
-        }else{
-//            $res = Cache::get('OrderSuperLoss/getList'.$str);
+
         }
         }
         $this->success('请求成功',$res);
         $this->success('请求成功',$res);
     }
     }
@@ -460,23 +425,14 @@ class OrderSuperLoss extends Api
             ->where(function($query) {
             ->where(function($query) {
                 $query->where('b.仓库编号', '101')
                 $query->where('b.仓库编号', '101')
                     ->whereOr('b.仓库编号', 'Y101');})
                     ->whereOr('b.仓库编号', 'Y101');})
-//            ->where('c.质量考核',0)
             ->field($field)
             ->field($field)
             ->find();
             ->find();
-//        if (empty($data)){
-//            $this->error('该工单不参与考核');
-//        }
-//        if ($data['Gd_gdbh'] == ''){
-//            $this->error('');
-//        }-
-
         if ($data['ls'] == 0){
         if ($data['ls'] == 0){
             $data['ls'] === 1;
             $data['ls'] === 1;
         }
         }
         if ($data['ks'] == 0){
         if ($data['ks'] == 0){
             $data['ks'] === 1;
             $data['ks'] === 1;
         }
         }
-//        $data['实际投料'] = number_format($data['投料']*$data['ls']*$data['ks']/10000,4);
         $data['实际投料'] = number_format($data['投料'] * $data['ls'] * $data['ks'] / 10000, 4, '.', '');
         $data['实际投料'] = number_format($data['投料'] * $data['ls'] * $data['ks'] / 10000, 4, '.', '');
         if($data['实际投料'] == 0){
         if($data['实际投料'] == 0){
             $this->error('投料数据为 0,请点击超节损页面“修正工单投料”按钮进行修正');
             $this->error('投料数据为 0,请点击超节损页面“修正工单投料”按钮进行修正');
@@ -495,11 +451,6 @@ class OrderSuperLoss extends Api
                         (SELECT sczl_gxh FROM 设备_产量计酬 WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}'
                         (SELECT sczl_gxh FROM 设备_产量计酬 WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}'
                         UNION SELECT sczl_gxh FROM db_sczl WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}' AND sczl_gxmc like '%拆片%') AS combined_result";
                         UNION SELECT sczl_gxh FROM db_sczl WHERE sczl_gdbh = '{$order}' AND sczl_yjno = '{$params['yjno']}' AND sczl_gxmc like '%拆片%') AS combined_result";
         $gxh_arr = Db::query($gxh_sql);
         $gxh_arr = Db::query($gxh_sql);
-//        $gxh_arr = \db('工单_工艺资料')
-//            ->where('Gy0_gdbh',$order)
-//            ->where('Gy0_yjno',$params['yjno'])
-//            ->field('Gy0_gxh as sczl_gxh')
-//            ->select();
         $gxh_values = array_column($gxh_arr, 'sczl_gxh');
         $gxh_values = array_column($gxh_arr, 'sczl_gxh');
         foreach ($gxh_values as $k=>$v){
         foreach ($gxh_values as $k=>$v){
             if ((int)$v < 10){
             if ((int)$v < 10){
@@ -533,11 +484,11 @@ class OrderSuperLoss extends Api
         $real_rate = $cp_data[0]['cp_sl'] / ((float)$data['实际投料'] * 10000) *100;
         $real_rate = $cp_data[0]['cp_sl'] / ((float)$data['实际投料'] * 10000) *100;
         $data['real_rate'] = number_format($real_rate,2) . '%';//实际合格率
         $data['real_rate'] = number_format($real_rate,2) . '%';//实际合格率
         //制程废品
         //制程废品
-        $zzfp_data =db('设备_产量计酬')->where('sczl_gdbh',$order)->where('sczl_yjno',$params['yjno'])->field('SUM(sczl_zcfp) as sczl_zcfp')->select();
+        $zzfp_data =db('设备_产量计酬')->where('sczl_gdbh',$order)->where('sczl_yjno',$params['yjno'])->value('SUM(sczl_zcfp) as sczl_zcfp');
         //联数
         //联数
         $ls =db('工单_工艺资料')->where('Gy0_gdbh',$order)->field('Gy0_ls,Gy0_ks')->find();
         $ls =db('工单_工艺资料')->where('Gy0_gdbh',$order)->field('Gy0_ls,Gy0_ks')->find();
         //制程废品*ls
         //制程废品*ls
-        $data['zcfp'] = $zzfp_data[0]['sczl_zcfp'] * $ls['Gy0_ls'] * $ls['Gy0_ks'];
+        $data['zcfp'] = $zzfp_data * $ls['Gy0_ls'] * $ls['Gy0_ks'];
         //废品数量
         //废品数量
         $wasteTotal = db('db_qczl')->where('qczl_gdbh',$order)->where('qczl_yjno',$params['yjno'])->sum('qczl_fp');
         $wasteTotal = db('db_qczl')->where('qczl_gdbh',$order)->where('qczl_yjno',$params['yjno'])->sum('qczl_fp');
         if (empty($wasteTotal)){
         if (empty($wasteTotal)){
@@ -553,7 +504,6 @@ class OrderSuperLoss extends Api
                         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,UniqId
                         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,UniqId
                         FROM db_qczl WHERE qczl_gdbh = '{$order}' AND qczl_yjno = '{$params['yjno']}'";
                         FROM db_qczl WHERE qczl_gdbh = '{$order}' AND qczl_yjno = '{$params['yjno']}'";
         $waste_out = Db::query($out_sql);
         $waste_out = Db::query($out_sql);
-//        halt($waste_out);
         $list = []; //外发废数组
         $list = []; //外发废数组
         $quality = [];//质检废数组
         $quality = [];//质检废数组
         $material = [];//材料废数组
         $material = [];//材料废数组
@@ -569,33 +519,30 @@ class OrderSuperLoss extends Api
                 $gxmcKey = "fp_gxmc" . $i;
                 $gxmcKey = "fp_gxmc" . $i;
                 $slKey = "fp_sl" . $i;
                 $slKey = "fp_sl" . $i;
                 if (!empty($entry[$labelKey])) {
                 if (!empty($entry[$labelKey])) {
+                    //外发废
                     if (substr($entry[$labelKey],0,3) == 'M04'){
                     if (substr($entry[$labelKey],0,3) == 'M04'){
                         $list[$j]= $entry[$slKey];
                         $list[$j]= $entry[$slKey];
                         $j++;
                         $j++;
                     }
                     }
+                    //材料废
                     if (substr($entry[$labelKey],0,1) == 'L' ){
                     if (substr($entry[$labelKey],0,1) == 'L' ){
                         $material[$n]= $entry[$slKey];
                         $material[$n]= $entry[$slKey];
                         $n++;
                         $n++;
                     }
                     }
+                    //零头处理
                     if (substr($entry[$labelKey],0,3) == 'M01' ){
                     if (substr($entry[$labelKey],0,3) == 'M01' ){
                         $change[$l]= $entry[$slKey];
                         $change[$l]= $entry[$slKey];
                         $l++;
                         $l++;
                     }
                     }
                 }
                 }
-//                if (!empty($entry[$bhKey])) {
-//                    if ($entry[$bhKey] != '000000' && $entry[$slKey] > 0){
                 $quality[$m]= $entry[$slKey];
                 $quality[$m]= $entry[$slKey];
                 $m++;
                 $m++;
-//                    }
-//                }
-
             }
             }
         }
         }
         $data['材料废'] = array_sum($material); //材料废
         $data['材料废'] = array_sum($material); //材料废
         $data['零头处理'] = array_sum($change); //零头处理
         $data['零头处理'] = array_sum($change); //零头处理
         $data['外发废'] = array_sum($list);//外发废
         $data['外发废'] = array_sum($list);//外发废
         $data['工单质检废'] =  array_sum($quality);//质检废
         $data['工单质检废'] =  array_sum($quality);//质检废
-//        $data['分摊废'] = '';//分摊废
         $plan_total =db('工单_工艺资料')->where(['Gy0_gdbh' => $order,'Gy0_yjno' => $params['yjno'], 'Gy0_gxh' => ['in', $gxh_values]])->value('SUM(Gy0_计划损耗 * Gy0_ls * Gy0_ks)');
         $plan_total =db('工单_工艺资料')->where(['Gy0_gdbh' => $order,'Gy0_yjno' => $params['yjno'], 'Gy0_gxh' => ['in', $gxh_values]])->value('SUM(Gy0_计划损耗 * Gy0_ls * Gy0_ks)');
         if($plan_total == 0){
         if($plan_total == 0){
             $this->error('计划损耗数据为 0,请到工单资料管理页面修改工艺资料中选择正确的工序损耗');
             $this->error('计划损耗数据为 0,请到工单资料管理页面修改工艺资料中选择正确的工序损耗');
@@ -624,12 +571,11 @@ class OrderSuperLoss extends Api
                 }else{
                 }else{
                     $gy_data[$k]['intangible_loss'] = round(number_format($gy_data[$k]['Gy0_计划损耗']/$plan_total,4) * $data['intangible_loss']);
                     $gy_data[$k]['intangible_loss'] = round(number_format($gy_data[$k]['Gy0_计划损耗']/$plan_total,4) * $data['intangible_loss']);
                 }
                 }
-//                $gy_data[$k]['intangible_loss'] = round(number_format($gy_data[$k]['Gy0_计划损耗']/$plan_total,4) * $data['intangible_loss']);
                 foreach ($waste_out as $entry) {
                 foreach ($waste_out as $entry) {
                     for ($i = 1; $i <= 13; $i++) {
                     for ($i = 1; $i <= 13; $i++) {
                         $gxmcKey = "fp_gxmc" . $i;
                         $gxmcKey = "fp_gxmc" . $i;
                         $slKey = "fp_sl" . $i;
                         $slKey = "fp_sl" . $i;
-                        if ((int)substr($entry[$gxmcKey],0,2) == $item['Gy0_gxh']){
+                        if (substr($entry[$gxmcKey],0,2) == $item['Gy0_gxh']){
                             $gy_data[$k]['waste_quality'] += $entry[$slKey];
                             $gy_data[$k]['waste_quality'] += $entry[$slKey];
 
 
                         }
                         }
@@ -785,19 +731,6 @@ class OrderSuperLoss extends Api
                 unset($gy_data[$key]['sczl_bh']);
                 unset($gy_data[$key]['sczl_bh']);
 
 
             }
             }
-            //重新计算多班组同组长的质检废,质检废 = 班组产量 / 总产量 * 质检废
-            $totals = [];
-//            foreach ($gy_data as $item) {
-//                $sczl_bh1 = $item['sczl_bh1'];
-//                $total_cl = $item['total_cl'];
-//
-//                if (isset($totals[$sczl_bh1])) {
-//                    $totals[$sczl_bh1]['total'] += $total_cl;
-//                } else {
-//                    $totals[$sczl_bh1] = ['total' => $total_cl, 'count' => 0];
-//                }
-//                $totals[$sczl_bh1]['count']++;
-//            }
             $i = 0;
             $i = 0;
             foreach ($gy_data as &$item) {
             foreach ($gy_data as &$item) {
                 $sczl_bh1 = $item['sczl_bh1'];
                 $sczl_bh1 = $item['sczl_bh1'];
@@ -1251,12 +1184,10 @@ class OrderSuperLoss extends Api
      */
      */
     public function OneOrderSuperLoss($gdbh,$yjno)
     public function OneOrderSuperLoss($gdbh,$yjno)
     {
     {
-//        $param = $this->request->param();
         $param = [
         $param = [
             'gdbh' => $gdbh,
             'gdbh' => $gdbh,
             'yjno' => $yjno
             'yjno' => $yjno
         ];
         ];
-//        halt($param);
         //查询工单入仓数据
         //查询工单入仓数据
         $workOrderData = \db('成品入仓')
         $workOrderData = \db('成品入仓')
             ->where('jjcp_gdbh', $param['gdbh'])
             ->where('jjcp_gdbh', $param['gdbh'])
@@ -1538,8 +1469,6 @@ class OrderSuperLoss extends Api
             } else {
             } else {
                 $gy_data[$n]['节损奖'] = number_format($gy_data[$n]['节损数量'] * $item['超节损承担比例'] * $moneyRate, 4);
                 $gy_data[$n]['节损奖'] = number_format($gy_data[$n]['节损数量'] * $item['超节损承担比例'] * $moneyRate, 4);
             }
             }
-//            $gy_data[$n]['超节损承担比例'] = number_format($item['超节损承担比例'],4) * 100 .'%';
-
             $gy_data[$n]['sys_ny'] = date('Ym', strtotime($workOrderData['jjcp_sj']));
             $gy_data[$n]['sys_ny'] = date('Ym', strtotime($workOrderData['jjcp_sj']));
 
 
             $gy_data[$n]['超节损核算单价'] = $moneyRate;
             $gy_data[$n]['超节损核算单价'] = $moneyRate;
@@ -1629,47 +1558,7 @@ class OrderSuperLoss extends Api
             ];
             ];
         }
         }
         return $result;
         return $result;
-//        $sql = \db('工单_质量考核汇总')
-//            ->fetchSql(true)
-//            ->insertAll($result);
-//        \db()->query($sql);
     }
     }
-
-
-    //按月循环计算超节损,存入数据库
-//    public function ComputeOrderLoss()
-//    {
-//        if ($this->request->isGet() === false){
-//            $this->error('请求错误');
-//        }
-//        $param = $this->request->param();
-//        if (empty($param)){
-//            $this->error('参数错误');
-//        }
-//        $where = [
-//            'a.jjcp_sj'=>['like',$param['mouth'].'%'],
-//            'a.jjcp_smb' => ['like','末'.'%'],
-//            'b.质量考核' => 0,
-//        ];
-//        $list = \db('成品入仓')
-//            ->alias('a')
-//            ->join('工单_印件资料 b','a.jjcp_gdbh = b.Yj_Gdbh AND a.jjcp_yjno = b.yj_Yjno')
-//            ->join('物料_收发记录 c', 'a.jjcp_gdbh = c.st_gdbh AND a.jjcp_cpdh = c.cpdh')
-//            ->where($where)
-//            ->where(function ($query) {
-//                $query->where('c.仓库编号', '101')
-//                    ->whereOr('c.仓库编号', 'Y101');
-//            })
-//            ->field('a.jjcp_gdbh,a.jjcp_yjno')
-//            ->select();
-//        foreach ($list as $key=>$value){
-//            $result = $this->OneOrderSuperLoss($value['jjcp_gdbh'],$value['jjcp_yjno']);
-//            if (!empty($result)){
-//                $sql = \db('工单_质量考核汇总')->fetchSql(true)->insertAll($result);
-//                \db()->query($sql);
-//            }
-//        }
-//    }
 }
 }
 
 
 
 

+ 7 - 0
application/api/controller/WorkOrderVerification.php

@@ -419,6 +419,13 @@ class WorkOrderVerification extends Api
                 ->where($where)
                 ->where($where)
                 ->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
                 ->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
                 ->select();
                 ->select();
+        }elseif($searchArr[1] === '检验'){
+            $where['a.sczl_gxmc'] = ['like','%'.'检'.'%'];
+            $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();
         }else{
         }else{
             $search = substr($searchArr[1],0,6);
             $search = substr($searchArr[1],0,6);
             $where['a.sczl_type'] = array('like','%'.$search.'%');
             $where['a.sczl_type'] = array('like','%'.$search.'%');