unknown 3 mesiacov pred
rodič
commit
2f16263332

+ 9 - 1088
application/api/controller/GluFinishedProductWarehousing.php

@@ -3,9 +3,6 @@
 namespace app\api\controller;
 
 use app\common\controller\Api;
-use think\db\exception\DataNotFoundException;
-use think\db\exception\ModelNotFoundException;
-use think\exception\DbException;
 use think\Db;
 
 /**
@@ -16,15 +13,6 @@ class GluFinishedProductWarehousing extends Api
     protected $noNeedLogin = ['*'];
     protected $noNeedRight = ['*'];
 
-    /**
-     * 首页
-     *糊盒成品入仓测试
-     */
-    public function index()
-    {
-        $this->success('请求成功');
-    }
-
     /**
      * 侧边栏
      * @ApiMethod (GET)
@@ -66,47 +54,6 @@ class GluFinishedProductWarehousing extends Api
         $this->success('成功',$rows);
     }
 
-    /**
-     * 侧边栏
-     * @ApiMethod (GET)
-     */
-    public function getTabByGdbh()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-
-        $num = db('糊盒成品入仓')->count();
-        $rows = db('糊盒成品入仓')
-            ->field('jjcp_gdbh, rtrim(jjcp_cpdh) as jjcp_cpdh, LEFT(Sys_rq, 10) as Sys_rq')
-            ->order('Sys_rq desc')
-            ->limit($num)
-            ->select();
-
-        $num = db('工单_基本资料')->count();
-        $arr = db('工单_基本资料')
-            ->limit($num)
-            ->column('CONCAT(Gd_gdbh, "-", rtrim(Gd_cpdh)) AS gdcp, CONCAT(rtrim(Gd_khdh), " 【", rtrim(Gd_khmc)) AS kh');
-
-        $data = [];
-        foreach ($rows as $value) {
-            $key = $value['jjcp_gdbh'].'-'.$value['jjcp_cpdh'];
-            if (isset($arr[$key]) && !isset($data[$arr[$key]])) {
-                $data[$arr[$key]] = $value['Sys_rq'];
-            }
-        }
-        // 对键进行升序排序
-        uksort($data, function($a, $b) use ($data) {
-            if ($data[$a] == $data[$b]) {
-                return ($a > $b) ? 1 : -1; // 在值相同的情况下,根据键进行升序排列
-            }
-            return ($data[$a] < $data[$b]) ? 1 : -1;
-        });
-
-        $this->success('成功',$data);
-    }
-
     /**
      * 列表
      * @ApiMethod (GET)
@@ -150,13 +97,13 @@ class GluFinishedProductWarehousing extends Api
         $rows = db('糊盒成品入仓')->alias('c')
             ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
         rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh, 
-        c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj, 
+        c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj, 
         rtrim(c.jjcp_smb) as jjcp_smb, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
         rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称, 
         rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,'.config('product_code_digit').') as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称, 
         rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
             ->where($where)
-            ->join('工单_基本资料 g', 'g.Gd_gdbh=c.jjcp_gdbh AND g.行号 = c.jjcp_yjno AND g.Gd_cpdh=c.jjcp_cpdh')
+            ->join('工单_基本资料 g', 'g.Gd_gdbh=c.jjcp_gdbh AND g.Gd_cpdh=c.jjcp_cpdh')
             ->order('c.UniqId desc')
             ->limit(($page - 1) * $limit, $limit)
             ->select();
@@ -193,105 +140,6 @@ class GluFinishedProductWarehousing extends Api
         $this->success('成功', $data);
     }
 
-    /**
-     * 定位
-     * @ApiMethod (GET)
-     * @param string $gdbh 工单编号
-     * @param string $cpmc 产品名称
-     * @param string $page 页码
-     * @param string $limit 数量
-     */
-    public function locate()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        $page = 1;
-        $limit = 15;
-        if (isset($req['page']) && !empty($req['page'])) $page = $req['page'];
-        if (isset($req['limit']) && !empty($req['limit'])) $limit = $req['limit'];
-
-        if (isset($req['gdbh']) && !empty($req['gdbh'])){
-            $where = ['c.jjcp_gdbh'=>[ 'like', '%' . $req['gdbh'] . '%']];
-            $option = ['jjcp_gdbh'=>[ 'like', '%' . $req['gdbh'] . '%']];
-            //客户编号
-            $rows = db('糊盒成品入仓')->alias('c')
-                ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
-            rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh, 
-            c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj, 
-            rtrim(c.jjcp_smb) as jjcp_smb, rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc, 
-            rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
-            rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,'.config('product_code_digit').') as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称, 
-            rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
-                ->where($where)
-                ->where('y.yj_Yjno=c.jjcp_yjno')
-                ->where('g.Gd_cpdh=c.jjcp_cpdh')
-                ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-                ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
-                ->order('c.UniqId desc')
-                ->page($page,$limit)
-                ->select();
-            $total = db('糊盒成品入仓')->where($option)->count();
-        }else{
-            if (isset($req['cpmc']) && !empty($req['cpmc'])){
-                //查询工单表
-                $gd = db('工单_基本资料')
-                    ->where('Gd_cpmc', 'LIKE', '%'.$req['cpmc'].'%')
-                    ->column('Gd_gdbh');
-                $where = ['c.jjcp_gdbh'=>['in', $gd]];
-                $option = ['jjcp_gdbh'=>['in', $gd]];
-                //客户编号
-                $rows = db('糊盒成品入仓')->alias('c')
-                    ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
-            rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh, 
-            c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj, 
-            rtrim(c.jjcp_smb) as jjcp_smb, rtrim(y.yj_Yjdh) as yj_Yjdh, rtrim(y.yj_yjmc) as yj_yjmc, 
-            rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
-            rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,'.config('product_code_digit').') as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称, 
-            rtrim(c.机型备注) as 机型备注, rtrim(c.Sys_id) as Sys_id, c.Sys_rq, c.Mod_rq, c.UniqId')
-                    ->where($where)
-                    ->where('y.yj_Yjno=c.jjcp_yjno')
-                    ->where('g.Gd_cpdh=c.jjcp_cpdh')
-                    ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-                    ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
-                    ->order('c.UniqId desc')
-                    ->page($page,$limit)
-                    ->select();
-                $total = db('糊盒成品入仓')->where($option)->count();
-            }else{
-                $this->error('参数错误');
-            }
-        }
-        foreach ($rows as $key=>$value) {
-            $row = db('糊盒成品入仓')
-                ->field('LEFT(Sys_rq, 10) as Sys_rq,jjcp_sl')
-                ->where(['jjcp_gdbh'=>$value['jjcp_gdbh'], 'jjcp_cpdh'=>$value['jjcp_cpdh']])
-                ->order('Sys_rq desc')
-                ->select();
-            $rows[$key]['jjcp_sls'] = 0;
-            foreach ($row as $k=>$v) {
-                $rows[$key]['jjcp_sls'] += $v['jjcp_sl'];
-            }
-            if ($value['订单数量']!=0){
-                $rows[$key]['完成率'] = number_format($rows[$key]['jjcp_sls']/$value['订单数量']/100,2);
-            }else{
-                $rows[$key]['完成率'] = '';
-            }
-            $rows[$key]['订单数量'] = floatval($value['订单数量']*10000);
-            $rows[$key]['最近入仓日期'] = $row[0]['Sys_rq'];
-
-            $rows[$key]['Mod_rq'] = $value['Mod_rq']=='1900-01-01 00:00:00' ? '' :$value['Mod_rq'];
-        }
-        $data = [
-            'total'    => $total,
-            'rows'          => $rows,
-        ];
-        $this->success('成功',$data);
-    }
-
     /**
      * 获取信息
      * @ApiMethod (GET)
@@ -313,7 +161,7 @@ class GluFinishedProductWarehousing extends Api
         $rows = db('糊盒成品入仓')->alias('c')
             ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
             rtrim(c.jjcp_num) as jjcp_num, 
-            c.jjcp_gdbh, c.jjcp_yjno, rtrim(c.订单编号) as 订单编号, 
+            c.jjcp_gdbh, rtrim(c.订单编号) as 订单编号, 
             rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
             rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称, 
             rtrim(c.客户料号) as 客户料号, 
@@ -333,119 +181,6 @@ class GluFinishedProductWarehousing extends Api
         $this->success('成功',$rows);
     }
 
-    /**
-     * 获取仓库信息
-     * @ApiMethod (GET)
-     * @param string keyword 关键词
-     */
-    public function getCk()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-        $key_word = '';
-        if (isset($req['key_word']) && !empty($req['key_word'])){
-            $key_word = $req['key_word'];
-        }
-        $rs = db('物料_仓库信息')
-            ->field('rtrim(编号) as 编号, rtrim(名称) as 名称')
-            ->where('编号|名称','like','%'.$key_word.'%')
-            ->where('名称','in',['面材仓库','主要产成品'])
-            ->select();
-
-        $this->success('成功',$rs);
-    }
-
-    /**
-     * 查询印件工序及产品名称
-     * @ApiMethod (GET)
-     * @param string $gdbh 工单编号
-     */
-    public function getGd()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-        if (isset($req['gdbh']) && !empty($req['gdbh'])){
-            $gdbh = $req['gdbh'];
-        }else{
-            $this->error('参数错误');
-        }
-
-        $rows = db('工单_基本资料')->alias('g')
-            ->field('g.Gd_gdbh, j.yj_yjno, rtrim(g.销售订单号) as 销售订单号, rtrim(j.yj_Yjdh) as yj_Yjdh, rtrim(j.yj_yjmc) as yj_yjmc, rtrim(g.成品代号) as 成品代号, rtrim(g.成品名称) as 成品名称, rtrim(g.客户料号) as 客户料号')
-            ->where(['g.Gd_gdbh'=>$gdbh])
-            ->join(['工单_印件资料'=>'j'],'g.Gd_cpdh=j.yj_yjdh and g.Gd_gdbh=j.Yj_Gdbh')
-            ->group('j.yj_yjno')
-            ->order('j.yj_yjno asc')
-            ->select();
-
-        // $rows = db()->table('工单_印件资料')->alias('j')
-        //     ->field('g.Gd_gdbh, j.yj_Yjno as yj_yjno, rtrim(g.销售订单号) as 销售订单号, rtrim(j.yj_Yjdh) as yj_Yjdh,
-        //     rtrim(j.yj_yjmc) as yj_yjmc, rtrim(g.成品代号) as 成品代号, rtrim(g.成品名称) as 成品名称, rtrim(g.客户料号) as 客户料号')
-        //     ->where(['g.Gd_gdbh'=>$gdbh])
-        //     ->join(['工单_基本资料'=>'g'],'g.Gd_gdbh=j.Yj_Gdbh')
-        //     ->select();
-
-        foreach ($rows as $key=>$value){
-            $rows[$key]['gdyj'] =  $value['Gd_gdbh'].' -'.sprintf("%02d", $value['yj_yjno']).'-'.$value['yj_yjmc'];
-        }
-
-        $this->success('成功',$rows);
-    }
-
-    /**
-     * 查询工单数量
-     * @ApiMethod (GET)
-     * @param string $gdbh 工单编号
-     * @param string $cpdh 产品代号
-     * @param string $rcsl 入仓数量
-     */
-    public function getGdsl()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-        if (isset($req['gdbh']) && !empty($req['gdbh'])){
-            $gdbh = $req['gdbh'];
-        }else{
-            $this->error('参数错误');
-        }
-        if (isset($req['cpdh']) && !empty($req['cpdh'])){
-            $cpdh = $req['cpdh'];
-        }else{
-            $this->error('参数错误');
-        }
-//        if (isset($req['rcsl'])){
-//            $rcsl = $req['rcsl'];
-//        }else{
-//            $this->error('参数错误');
-//        }
-
-        $rows = db('工单_基本资料')->alias('g')
-            ->field('订单数量*10000 as 订单数量, gd_statu')
-            ->where(['Gd_gdbh'=>$gdbh, 'Gd_cpdh'=>$cpdh])
-            ->find();
-
-        if (!$rows) $this->error('未查询到记录');
-
-        $rows['jjcp_sls'] = db('糊盒成品入仓')
-            ->where(['jjcp_gdbh'=>$gdbh, 'jjcp_cpdh'=>$cpdh])
-            ->sum('jjcp_sl');
-
-//        if ($rows['订单数量']<($rows['jjcp_sls']+$rcsl) || mb_substr($rows['gd_statu'],-3,3)=='已完工'){
-//            $this->error('已完工或入仓数量超过订单数量',$rows);
-//        }
-
-        $this->success('成功',$rows);
-    }
-
     /**
      * 新增
      * @ApiMethod (POST)
@@ -456,14 +191,12 @@ class GluFinishedProductWarehousing extends Api
         if(!$this->request->isPost()){
             $this->error('请求方式错误');
         }
-        //连接mongodb
-        $mongodb = Db::connect(config('database.mongodb'));
         $req = $this->request->param();
         $arr = [
             'Sys_id',
             '入仓类型', '仓库编号', '仓库名称',
             'jjcp_num',
-            'jjcp_gdbh', 'jjcp_yjno', '订单编号',
+            'jjcp_gdbh', '订单编号',
             'jjcp_cpdh', 'jjcp_cpmc',
             '成品编码', '成品名称',
             '客户料号',
@@ -474,7 +207,6 @@ class GluFinishedProductWarehousing extends Api
         ];
         $name = \db('工单_印件资料')
             ->where('Yj_Gdbh',$req['jjcp_gdbh'])
-            ->where('yj_Yjno',$req['jjcp_yjno'])
             ->value('yj_yjmc');
         if ($name !== $req['jjcp_cpmc']){
             $this->error('产品名称错误');
@@ -487,15 +219,14 @@ class GluFinishedProductWarehousing extends Api
             $data[$value] = $req[$value];
         }
         $data['Sys_rq'] = date('Y-m-d H:i:s');
-        
+
         //判断当前工单是否存在已提交模版
         $existingRecord = db('糊盒成品入仓')
             ->where('jjcp_gdbh', $data['jjcp_gdbh'])
-            ->where('jjcp_yjno', $data['jjcp_yjno'])
             ->where('jjcp_smb', '<>', '') // 判断 jjcp_smb 不为空
             ->find();
         if ($existingRecord) {
-            $this->error($existingRecord['jjcp_gdbh'].'工单 -- 印件'.$existingRecord['jjcp_yjno'].'已经进入末版,无法继续操作');
+            $this->error($existingRecord['jjcp_gdbh'].'工单已经进入末版,无法继续操作');
         }
 
         //开启事务
@@ -503,8 +234,6 @@ class GluFinishedProductWarehousing extends Api
         try{
             $sql = db('糊盒成品入仓')->fetchSql(true)->insert($data);
             $bool = db()->query($sql);
-            //新增进MongoDB
-            $res = $mongodb->name('finished_products')->insert($data);
             // 提交事务
             db()->commit();
         } catch (\Exception $e) {
@@ -526,13 +255,11 @@ class GluFinishedProductWarehousing extends Api
         if(!$this->request->isPost()){
             $this->error('请求方式错误');
         }
-        //连接mongodb
-        $mongodb = Db::connect(config('database.mongodb'));
         $req = $this->request->param();
         $arr = [
             '入仓类型', '仓库编号', '仓库名称',
             'jjcp_num',
-            'jjcp_gdbh', 'jjcp_yjno', '订单编号',
+            'jjcp_gdbh','订单编号',
             'jjcp_cpdh', 'jjcp_cpmc',
             '成品编码', '成品名称',
             '客户料号',
@@ -560,11 +287,10 @@ class GluFinishedProductWarehousing extends Api
         if ($data['jjcp_smb'] === '末 板'){
             $existingRecord = db('糊盒成品入仓')
                 ->where('jjcp_gdbh', $data['jjcp_gdbh'])
-                ->where('jjcp_yjno', $data['jjcp_yjno'])
                 ->where('jjcp_smb', '<>', '') // 判断 jjcp_smb 不为空
                 ->find();
             if ($existingRecord && $existingRecord['UniqId'] !== (int)$req['UniqId']) {
-                $this->error($existingRecord['jjcp_gdbh'].'工单 -- 印件'.$existingRecord['jjcp_yjno'].'已经进入末版,无法继续操作');
+                $this->error($existingRecord['jjcp_gdbh'].'工单已经进入末版,无法继续操作');
             }
         };
         //开启事务
@@ -572,10 +298,6 @@ class GluFinishedProductWarehousing extends Api
         try{
             $sql = db('糊盒成品入仓')->where('UniqId',$req['UniqId'])->fetchSql(true)->update($data);
             $bool = db()->query($sql);
-            //同步更新monodb数据
-            $res = $mongodb->name('finished_products')
-                ->where('UniqId', (int)$req['UniqId']) // 使用实际的UniqId值
-                ->update($data);
             // 提交事务
             db()->commit();
         } catch (\Exception $e) {
@@ -589,7 +311,7 @@ class GluFinishedProductWarehousing extends Api
     }
 
     /**
-     * 修改
+     * 删除
      * @ApiMethod (POST)
      * @param string 'UniqId'
      */
@@ -598,8 +320,6 @@ class GluFinishedProductWarehousing extends Api
         if(!$this->request->isPost()){
             $this->error('请求方式错误');
         }
-        //连接mongodb
-        $mongodb = Db::connect(config('database.mongodb'));
         $req = $this->request->param();
 
         if (!(isset($req['UniqId']) && trim($req['UniqId'])!='')){
@@ -610,11 +330,6 @@ class GluFinishedProductWarehousing extends Api
         db()->startTrans();
         try{
             $bool = db('糊盒成品入仓')->where('UniqId',$req['UniqId'])->delete();
-            //同时删除mongdb数据
-            //同步更新monodb数据
-            $res = $mongodb->name('finished_products')
-                ->where('UniqId', (int)$req['UniqId']) // 使用实际的UniqId值
-                ->delete();
             // 提交事务
             db()->commit();
         } catch (\Exception $e) {
@@ -628,798 +343,4 @@ class GluFinishedProductWarehousing extends Api
         $this->success('成功');
 
     }
-
-    /**
-     * excel导出
-     * @ApiMethod (POST)
-     * @param string date
-     * @param string sys_id
-     * @param array fields
-     */
-    public function export(){
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        if (!isset($req['date'])) $this->error('参数缺失');
-
-        if (!(isset($req['fields']) && count($req['fields'])!=0)){
-            $this->error('参数错误','fields',100);
-        }
-
-        if(strpos($req['date'],'-')){
-            $where = ['c.Sys_rq'=>['like',$req['date'].'%']];
-        }else if(empty($req['date'])){
-            $where = [];
-        }else{
-            $where = ['c.jjcp_gdbh'=>$req['date']];
-        }
-        if (isset($req['sys_id']) && !empty($req['sys_id'])){
-            $where['c.Sys_id'] = ['LIKE',$req['sys_id'].'%'];
-        }
-
-        $arr = [
-            '入仓类型'      =>['入仓类型'],
-            '仓库编号'      =>['仓库编号'],
-            '仓库名称'      =>['仓库名称'],
-            'jjcp_num'     =>['入仓单号'],
-            'jjcp_gdbh'    =>['工单编号'],
-            'jjcp_yjno'    =>['印件号'],
-            'jjcp_sl'      =>['入仓数量'],
-            'jjcp_sls'     =>['累计入仓数量'],
-            '订单数量'      =>['订单数量'],
-            '完成率'        =>['完成率'],
-            'jjcp_dw'      =>['单位'],
-            'jjcp_sj'      =>['入仓时间'],
-            'jjcp_smb'     =>['首末板'],
-            'jjcp_cpdh'    =>['印件代号'],
-            'jjcp_cpmc'    =>['印件名称'],
-            '成品编码'      =>['产品编号'],
-            '成品名称'      =>['产品名称'],
-            '客户料号'      =>['客户料号'],
-            'jjcp_desc'    =>['备注'],
-            '客户编号'      =>['客户编号'],
-            'Gd_客户名称'   =>['客户名称'],
-            '最近入仓日期'  =>['最近入仓日期'],
-            '机型备注'      =>['机型备注'],
-        ];
-        $data[0] = [];
-        foreach ($req['fields'] as $k=>$v){
-            if(array_key_exists($v,$arr)){
-                array_push($data[0],$arr[$v][0]);
-            }
-        }
-
-        $num = db('糊盒成品入仓')->alias('c')
-            ->where($where)
-            ->where('g.Gd_cpdh=c.jjcp_cpdh')
-            ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-            ->count();
-
-        $rows = [];
-        for($i=1;$i<=ceil($num/10000);$i++){
-            $p = $i == ceil($num/10000) ? $num%10000 : 10000;
-            $r = db('糊盒成品入仓')->alias('c')
-                ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
-            rtrim(c.jjcp_num) as jjcp_num, c.jjcp_gdbh, 
-            c.jjcp_yjno, c.jjcp_sl, g.订单数量, rtrim(c.jjcp_dw) as jjcp_dw, LEFT(c.jjcp_sj, 10) as jjcp_sj, 
-            rtrim(c.jjcp_smb) as jjcp_smb, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
-            rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称, 
-            rtrim(c.客户料号) as 客户料号, rtrim(c.jjcp_desc) as jjcp_desc, LEFT(c.成品编码,'.config('product_code_digit').') as 客户编号, rtrim(g.Gd_客户名称) as Gd_客户名称, 
-            rtrim(c.机型备注) as 机型备注')
-                ->where($where)
-                ->where('g.Gd_cpdh=c.jjcp_cpdh')
-                ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-                ->order('c.UniqId desc')
-                ->limit($i,$p)
-                ->select();
-            $rows = array_merge($rows,$r);
-        }
-
-        foreach ($rows as $key=>$value) {
-            $row = db('糊盒成品入仓')
-                ->field('LEFT(Sys_rq, 10) as Sys_rq,jjcp_sl')
-                ->where(['jjcp_gdbh'=>$value['jjcp_gdbh'], 'jjcp_cpdh'=>$value['jjcp_cpdh']])
-                ->order('Sys_rq desc')
-                ->select();
-
-            $subArray = [];
-            foreach ($arr as $k=>$v){
-                if($k=='jjcp_sls'){
-                    $subArray[$k] = 0;
-                    foreach ($row as $n) {
-                        $subArray[$k] += $n['jjcp_sl'];
-                    }
-                }else if($k=='完成率'){
-                    if ($value['订单数量']!=0){
-                        $subArray[$k] = 0;
-                        foreach ($row as $n) {
-                            $subArray[$k] += $n['jjcp_sl'];
-                        }
-                        $subArray[$k] = number_format($subArray[$k]/$value['订单数量']/100,2);
-                    }else{
-                        $subArray[$k] = '';
-                    }
-                }else if($k=='最近入仓日期'){
-                    $subArray[$k] = $row[0]['Sys_rq'];
-                }else{
-                    $subArray[$k] = $rows[$key][$k];
-                }
-            }
-            array_push($data,$subArray);
-        }
-
-        $this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
-    }
-
-
-    /**
-     * 月度A
-     * @ApiMethod (POST)
-     * @param string start_time
-     * @param string end_time
-     * @param string file_name
-     * @param array fields
-     */
-    public function monthExportA(){
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-        $arr = [
-            'start_time', 'end_time', 'file_name'
-        ];
-        foreach ($arr as $key => $value){
-            if (!isset($req[$value])){
-                $this->error('参数错误',$value,$key+1);
-            }
-        }
-        if (!(isset($req['fields']) && count($req['fields'])!=0)){
-            $this->error('参数错误','fields',100);
-        }
-
-        $arr = [
-            '入仓类型'      =>['入仓类型'],
-            '仓库编号'      =>['仓库编号'],
-            '仓库名称'      =>['仓库名称'],
-            'jjcp_gdbh'    =>['工单编号'],
-            'jjcp_cpdh'    =>['入仓存货编号'],
-            'jjcp_cpmc'    =>['入仓存货名称'],
-            'jjcp_sl'      =>['入仓数量'],
-            'jjcp_dw'      =>['单位'],
-            'jjcp_sj'      =>['入仓时间'],
-            'jjcp_smb'     =>['首末板'],
-            'jjcp_num'     =>['单据编号'],
-            '订单编号'      =>['订单编号'],
-        ];
-        $data[0] = [];
-        foreach ($req['fields'] as $k=>$v){
-            if(array_key_exists($v,$arr)){
-                array_push($data[0],$arr[$v][0]);
-            }
-        }
-
-        //客户编号
-        $rows = db('糊盒成品入仓')->alias('c')
-            ->field('rtrim(c.入仓类型) as 入仓类型, rtrim(c.仓库编号) as 仓库编号, rtrim(c.仓库名称) as 仓库名称, 
-            c.jjcp_gdbh, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
-            c.jjcp_sl, rtrim(c.jjcp_dw) as jjcp_dw, c.jjcp_sj, 
-            rtrim(c.jjcp_smb) as jjcp_smb, 
-            rtrim(c.jjcp_num) as jjcp_num, rtrim(c.订单编号) as 订单编号
-            ')
-            ->where('c.jjcp_sj','between time',[$req['start_time'], $req['end_time']])
-            ->order('c.jjcp_sj asc')
-            ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-            ->where('g.Gd_cpdh=c.jjcp_cpdh')
-            ->select();
-
-        foreach ($rows as $key=>$value) {
-            $subArray = [];
-            foreach ($arr as $k=>$v){
-                $subArray[$k] = $rows[$key][$k];
-            }
-            array_push($data,$subArray);
-        }
-
-        $this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
-    }
-
-
-    /**
-     * 月度B
-     * @ApiMethod (POST)
-     * @param string start_time
-     * @param string end_time
-     * @param string file_name
-     * @param array fields
-     */
-    public function monthExportB(){
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-        $arr = [
-            'start_time', 'end_time', 'file_name'
-        ];
-        foreach ($arr as $key => $value){
-            if (!isset($req[$value])){
-                $this->error('参数错误',$value,$key+1);
-            }
-        }
-        if (!(isset($req['fields']) && count($req['fields'])!=0)){
-            $this->error('参数错误','fields',100);
-        }
-
-        $arr = [
-            '入仓类型'      =>['入仓类型'],
-            '客户编号'      =>['客户编号'],
-            '客户名称'      =>['客户名称'],
-            '产品类别'      =>['产品类别'],
-            'jjcp_gdbh'    =>['工单编号'],
-            '成品编码'      =>['成品编码'],
-            '成品名称'      =>['成品名称'],
-            'jjcp_sls'     =>['入仓数量'],
-            '大箱产量'      =>['大箱产量'],
-            '产品单价'      =>['万张单价'],
-            '产值万元'      =>['产值万元'],
-        ];
-        $data[0] = [];
-        foreach ($req['fields'] as $k=>$v){
-            if(array_key_exists($v,$arr)){
-                array_push($data[0],$arr[$v][0]);
-            }
-        }
-
-        $rows1 = db('糊盒成品入仓')->alias('c')
-            ->field('rtrim(c.入仓类型) as 入仓类型, LEFT(c.成品编码,'.config('product_code_digit').') as 客户编号, rtrim(b.客户名称) as 客户名称,
-            rtrim(b.产品类别) as 产品类别, c.jjcp_gdbh,
-            rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称
-            ')
-            ->where('c.jjcp_sj','between time',[$req['start_time'], $req['end_time']])
-            ->order('客户编号 asc,b.产品类别 desc,c.成品编码 asc,c.jjcp_gdbh asc')
-            ->join('产品_基本资料 b','b.产品编号=c.jjcp_cpdh')
-            ->group('c.jjcp_gdbh')
-            ->select();
-
-        $rows2 = db('糊盒成品入仓')
-            ->field('rtrim(入仓类型) as 入仓类型, rtrim(成品编码) as 客户编号, 
-            rtrim(成品编码) as 客户名称, rtrim(成品编码) as 产品类别,
-            jjcp_gdbh,rtrim(成品编码) as 成品编码, rtrim(成品名称) as 成品名称
-            ')
-            ->where('jjcp_sj','between time',[$req['start_time'], $req['end_time']])
-            ->where('成品编码','')
-            ->order('jjcp_gdbh asc')
-            ->group('jjcp_gdbh')
-            ->select();
-        $rows = array_merge($rows2,$rows1);
-
-        $num = db('工单_基本资料')->count();
-        $arr1 = db('工单_基本资料')->limit($num)
-            ->column('CONCAT(Gd_gdbh, "-", rtrim(Gd_cpdh)) AS gdcp, 产品单价 as 万张单价');
-
-        $brr = array_column($rows,'jjcp_gdbh');
-        $brr = db('糊盒成品入仓')
-            ->where('jjcp_gdbh', 'in', $brr)
-            ->group('jjcp_gdbh')
-            ->column('jjcp_gdbh, sum(jjcp_sl)');
-
-        foreach ($rows as $key=>$value) {
-            $subArray = [];
-            foreach ($arr as $k=>$v){
-                if($k=='jjcp_sls'){
-                    $subArray[$k] = $brr[$value['jjcp_gdbh']];
-                }else if ($k=='大箱产量'){
-                    if($value['产品类别']=='条盒'){
-                        $subArray[$k] = $brr[$value['jjcp_gdbh']]/250;
-                    }else if($value['产品类别']=='小盒'){
-                        $subArray[$k] = $brr[$value['jjcp_gdbh']]/2500;
-                    }else{
-                        $subArray[$k] = 0;
-                    }
-                }else if ($k=='产品单价'){
-                    if($value['产品类别']!=''){
-                        if (array_key_exists($value['jjcp_gdbh'].'-'.$value['成品编码'],$arr1)){
-                            $subArray[$k] = floatval(number_format($arr1[$value['jjcp_gdbh'].'-'.$value['成品编码']],4));
-                        }
-                    }else{
-                        $subArray[$k] = 0;
-                    }
-                }else if ($k=='产值万元'){
-                    if($value['产品类别']!=''){
-                        if (array_key_exists($value['jjcp_gdbh'].'-'.$value['成品编码'],$arr1)){
-                            $subArray[$k] = floatval(number_format($arr1[$value['jjcp_gdbh'].'-'.$value['成品编码']]*$brr[$value['jjcp_gdbh']]/100000000,2));
-                        }
-                    }else{
-                        $subArray[$k] = 0;
-                    }
-                }else{
-                    $subArray[$k] = $rows[$key][$k];
-                }
-            }
-            array_push($data,$subArray);
-        }
-
-        $this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
-    }
-
-
-    /**
-     * 各日统计列表
-     * @ApiMethod (GET)
-     * @param string $date 时间
-     * @param string $sys_id 用户
-     */
-    public function getDayList()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        $page = 1;
-        $limit = 15;
-        if (isset($req['page']) && !empty($req['page'])) $page = $req['page'];
-        if (isset($req['limit']) && !empty($req['limit'])) $limit = $req['limit'];
-
-        $where = [
-            'c.jjcp_smb'=>['<>',''],
-        ];
-        if (isset($req['key_word']) && !empty($req['key_word'])){
-            $where['c.jjcp_sj | c.jjcp_gdbh | c.jjcp_cpmc | c.jjcp_cpdh | g.实际投料'] = ['like','%'.$req['key_word'].'%'];
-        }
-
-        //客户编号
-        $rows = db('糊盒成品入仓')->alias('c')
-            ->field('LEFT(c.jjcp_sj, 10) as jjcp_sj, c.jjcp_gdbh, rtrim(c.jjcp_cpmc) as jjcp_cpmc, 
-            rtrim(c.jjcp_cpdh) as jjcp_cpdh, g.实际投料')
-            ->where($where)
-            ->where('g.Gd_cpdh=c.jjcp_cpdh')
-            ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-            ->order('c.jjcp_sj desc')
-            ->group('c.jjcp_gdbh, c.jjcp_cpdh')
-            ->page($page,$limit)
-            ->select();
-
-        $total = db('糊盒成品入仓')->alias('c')
-            ->where($where)
-            ->where('g.Gd_cpdh=c.jjcp_cpdh')
-            ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-            ->group('c.jjcp_gdbh, c.jjcp_cpdh')
-            ->count();
-
-        $brr = db('糊盒成品入仓')
-            ->group('jjcp_gdbh,jjcp_cpdh')
-            ->column('CONCAT(jjcp_gdbh, "-", rtrim(jjcp_cpdh)), sum(jjcp_sl)');
-
-        foreach ($rows as $key=>$value) {
-            $rows[$key]['实际投料'] = (string)floatval($value['实际投料']*10000);
-            if(array_key_exists($value['jjcp_gdbh'].'-'.$value['jjcp_cpdh'],$brr)){
-                $rows[$key]['入仓数量'] = $brr[$value['jjcp_gdbh'].'-'.$value['jjcp_cpdh']];
-                if($rows[$key]['实际投料']!=0){
-                    $rows[$key]['投入产出率'] = number_format($rows[$key]['入仓数量']/$rows[$key]['实际投料']*100,2);
-                }else{
-                    $rows[$key]['投入产出率'] = '';
-                }
-            }else{
-                $rows[$key]['入仓数量'] = '';
-                $rows[$key]['投入产出率'] = '';
-            }
-        }
-
-        $data = [
-            'total'          => $total,
-            'rows'          => $rows,
-        ];
-        $this->success('成功',$data);
-    }
-
-
-    /**
-     * 各日统计列表excel导出
-     * @ApiMethod (POST)
-     * @param string file_name
-     * @param array fields
-     */
-    public function dayExport()
-    {
-        //get请求
-        if(!$this->request->isPost()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        if (!isset($req['file_name'])){
-            $this->error('参数错误','file_name');
-        }
-
-        if (!(isset($req['fields']) && count($req['fields'])!=0)){
-            $this->error('参数错误','fields',100);
-        }
-        if (isset($req['key_word']) && !empty($req['key_word'])){
-            $where['c.jjcp_sj | c.jjcp_gdbh | c.jjcp_cpmc | c.jjcp_cpdh | g.实际投料'] = ['like','%'.$req['key_word'].'%'];
-        }
-        $arr = [
-            'jjcp_gdbh'    =>['jjcp_gdbh'],
-            'jjcp_yjno'    =>['jjcp_yjno'],
-            'jjcp_cpmc'    =>['印件名称'],
-            '成品编码'      =>['成品编码'],
-            '成品名称'      =>['成品名称'],
-            '实际投料'      =>['实际投料'],
-            'jjcp_sls'     =>['入仓数量'],
-            'jjcp_sj'      =>['完工日期'],
-        ];
-        $data[0] = [];
-        foreach ($req['fields'] as $k=>$v){
-            if(array_key_exists($v,$arr)){
-                array_push($data[0],$arr[$v][0]);
-            }
-        }
-
-        $where = [
-            'c.jjcp_smb'=>['<>','']
-        ];
-
-        //客户编号
-        $rows = db('糊盒成品入仓')->alias('c')
-            ->field('c.jjcp_gdbh, c.jjcp_yjno, rtrim(c.jjcp_cpmc) as jjcp_cpmc, rtrim(c.jjcp_cpdh) as jjcp_cpdh, 
-            rtrim(c.成品编码) as 成品编码, rtrim(c.成品名称) as 成品名称, sum(jjcp_sl) as jjcp_sls, 
-            g.实际投料, LEFT(c.jjcp_sj, 10) as jjcp_sj
-            ')
-            ->where($where)
-            ->where('g.Gd_cpdh=c.jjcp_cpdh')
-            ->join('工单_基本资料 g','g.Gd_gdbh=c.jjcp_gdbh')
-            ->order('c.jjcp_sj desc')
-            ->group('c.jjcp_gdbh, c.jjcp_cpdh')
-            ->select();
-
-        foreach ($rows as $key=>$value) {
-            $subArray = [];
-            foreach ($arr as $k=>$v){
-                if($k=='实际投料'){
-                    $subArray[$k] = (string)floatval($value['实际投料']*10000);
-                }else{
-                    $subArray[$k] = $rows[$key][$k];
-                }
-            }
-            array_push($data,$subArray);
-        }
-
-        $this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
-    }
-
-    /**
-     * 入仓末板数据统计列表
-     * @ApiMethod (GET)
-     * @param string $date 时间
-     * @param string $sys_id 用户
-     */
-    public function mbList()
-    {
-        //get请求
-        if(!$this->request->isGet()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        // $page = 1;
-        // $limit = 15;
-        // if (isset($req['page']) && !empty($req['page'])) $page = $req['page'];
-        // if (isset($req['limit']) && !empty($req['limit'])) $limit = $req['limit'];
-
-        $date = date('Y-m-d',strtotime('-3 month'));
-        $arr1 = db('db_包装产量预报')
-            ->field('sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6, 
-            cast(substr(sczl_yjGx1,1,2) as signed) as sczl_yjGx1, cast(substr(sczl_yjGx2,1,2) as signed) as sczl_yjGx2, 
-            cast(substr(sczl_yjGx3,1,2) as signed) as sczl_yjGx3, cast(substr(sczl_yjGx4,1,2) as signed) as sczl_yjGx4, 
-            cast(substr(sczl_yjGx5,1,2) as signed) as sczl_yjGx5, cast(substr(sczl_yjGx6,1,2) as signed) as sczl_yjGx6, 
-            (sczl_cl1*sczl_PgCl1+sczl_clAdd1) as sczl_cls1, 
-            (sczl_cl2*sczl_PgCl2+sczl_clAdd2) as sczl_cls2, 
-            (sczl_cl3*sczl_PgCl3+sczl_clAdd3) as sczl_cls3, 
-            (sczl_cl4*sczl_PgCl4+sczl_clAdd4) as sczl_cls4, 
-            (sczl_cl5*sczl_PgCl5+sczl_clAdd5) as sczl_cls5, 
-            (sczl_cl6*sczl_PgCl6+sczl_clAdd6) as sczl_cls6
-            ')
-            ->where('sczl_rq','>=',$date)
-            ->select();
-
-        $data1 = [];
-        foreach ($arr1 as $k=>$v){
-            for ($i=1;$i<=6;$i++){
-                if (!empty($v['sczl_gdbh'.$i])){
-                    $v['sczl_gdbh'.$i] = strtoupper($v['sczl_gdbh'.$i]);
-                    if(array_key_exists($v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i],$data1)){
-                        $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] += $v['sczl_cls'.$i];
-                    }else{
-                        $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] = $v['sczl_cls'.$i];
-                    }
-                }
-            }
-        }
-        krsort($data1);
-        //糊盒成品入仓中jjcp_smb不为空的工单
-//        $rows1 = db('糊盒成品入仓')
-//            ->where('jjcp_smb','<>','')
-//            ->order('jjcp_gdbh desc')
-//            ->column("CONCAT(jjcp_gdbh, '-', jjcp_yjno) AS gdyj, UniqId");
-
-        $rows2 = db('糊盒成品入仓')
-            ->where('jjcp_sj','>=',$date)
-            ->group('jjcp_gdbh, jjcp_cpdh')
-            ->column("CONCAT( jjcp_gdbh, '-',  jjcp_yjno) AS gdyj, max(jjcp_smb) as jjcp_smb,
-            sum(jjcp_sl) as jjcp_sls, left(max(jjcp_sj),10) as jjcp_sj,UniqId");
-//        $rows3 = db('工单_印件资料')->cache(true,86400)
-//            ->group('Yj_Gdbh, yj_Yjno')
-//            ->column("CONCAT( Yj_Gdbh, '-',  yj_Yjno) AS gdyj,
-//            Yj_Gdbh, yj_Yjno, yj_yjmc, yj_成品数量, yj_实际投料");
-        $data = [];
-        foreach($data1 as $key=>$value){
-//            if(!array_key_exists($key,$rows1)){
-            $subArray = [];
-            $gdbh = strtoupper(explode('-',$key)[0]);
-            $yjno = explode('-',$key)[1];
-            $res = db('工单_印件资料')
-                ->where('Yj_Gdbh',$gdbh)
-                ->where('yj_Yjno',$yjno)
-                ->field('Yj_Gdbh, yj_Yjno, yj_yjmc, yj_成品数量, (yj_平张投料 * yj_ks * yj_ls) as 投料')
-                ->find();
-            if(!empty($res)){
-                $subArray['Yj_Gdbh'] = $res['Yj_Gdbh'];
-                $subArray['yj_Yjno'] = $res['yj_Yjno'];
-                $subArray['yj_yjmc'] = trim($res['yj_yjmc']);
-                $subArray['yj_成品数量'] = (string)floatval($res['yj_成品数量']*10000);
-                $subArray['yj_实际投料'] = (string)floatval($res['投料']);
-            }else{
-                $subArray['Yj_Gdbh'] = '';
-                $subArray['yj_Yjno'] = '';
-                $subArray['yj_yjmc'] = '';
-                $subArray['yj_成品数量'] = '';
-                $subArray['yj_实际投料'] = '';
-            }
-
-            if(array_key_exists($key,$rows2)){
-                $subArray['jjcp_smb'] = $rows2[$key]['jjcp_smb'];
-                $subArray['jjcp_sls'] = $rows2[$key]['jjcp_sls'];
-                $subArray['jjcp_sj'] = $rows2[$key]['jjcp_sj'];
-            }else{
-                $subArray['jjcp_smb'] = '';
-                $subArray['jjcp_sls'] = '';
-                $subArray['jjcp_sj'] = '';
-            }
-            $subArray['sczl_cls'] = (string)floatval($value);
-            array_push($data,$subArray);
-        }
-//        }
-
-
-        // $rows = db('db_包装产量预报')
-        //     ->field('sczl_rq,sczl_gdbh1,sczl_gdbh2,sczl_gdbh3,sczl_gdbh4,sczl_gdbh5,sczl_gdbh6,Sys_rq,mod_rq,UniqId')
-        //     ->where('Sys_rq','>=','2023-10-25')
-        //     ->select();
-        // $uniqueValues = [];
-        // foreach ($rows as $row) {
-        //     $gdbhArray = array($row['sczl_gdbh1'], $row['sczl_gdbh2'], $row['sczl_gdbh3'], $row['sczl_gdbh4'], $row['sczl_gdbh5'], $row['sczl_gdbh6']);
-        //     $uniqueValues = array_merge($uniqueValues, array_unique($gdbhArray));
-        // }
-
-        // $uniqueValues = array_values(array_unique($uniqueValues));
-        // halt($uniqueValues);
-        // $rows = db('糊盒成品入仓')->alias('c')
-        //     ->field('c.jjcp_gdbh, c.jjcp_yjno, rtrim(c.jjcp_cpmc) as jjcp_cpmc,
-        //     y.yj_成品数量, y.yj_实际投料, rtrim(c.jjcp_cpdh) as jjcp_cpdh, rtrim(c.jjcp_smb) as jjcp_smb,
-        //     sum(c.jjcp_sl) as jjcp_sls, left(max(c.Sys_rq),10) as Sys_rq')
-        //     ->where($where)
-        //     ->where('y.yj_Yjdh=c.jjcp_cpdh')
-        //     ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
-        //     ->order('c.jjcp_gdbh desc, c.jjcp_yjno asc')
-        //     ->group('c.jjcp_gdbh, c.jjcp_cpdh')
-        //     ->page($page,$limit)
-        //     ->select();
-
-        // $total = db('糊盒成品入仓')->alias('c')
-        //     ->where($where)
-        //     ->where('y.yj_Yjdh=c.jjcp_cpdh')
-        //     ->join('工单_印件资料 y','y.Yj_Gdbh=c.jjcp_gdbh')
-        //     ->group('c.jjcp_gdbh, c.jjcp_cpdh')
-        //     ->count();
-        // $brr = db('糊盒成品入仓')
-        //     ->group('jjcp_gdbh,jjcp_cpdh')
-        //     ->column('CONCAT(jjcp_gdbh, "-", rtrim(jjcp_cpdh)), sum(jjcp_sl)');
-
-        // $num = db('db_包装产量预报')->count();
-        // $arr1 = db('db_包装产量预报')
-        //     ->field('sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6,
-        //     substr(sczl_yjGx1,2,1) as sczl_yjGx1, substr(sczl_yjGx2,2,1) as sczl_yjGx2,
-        //     substr(sczl_yjGx3,2,1) as sczl_yjGx3, substr(sczl_yjGx4,2,1) as sczl_yjGx4,
-        //     substr(sczl_yjGx5,2,1) as sczl_yjGx5, substr(sczl_yjGx6,2,1) as sczl_yjGx6,
-        //     (sczl_cl1*sczl_PgCl1+sczl_clAdd1) as sczl_cls1,
-        //     (sczl_cl2*sczl_PgCl2+sczl_clAdd2) as sczl_cls2,
-        //     (sczl_cl3*sczl_PgCl3+sczl_clAdd3) as sczl_cls3,
-        //     (sczl_cl4*sczl_PgCl4+sczl_clAdd4) as sczl_cls4,
-        //     (sczl_cl5*sczl_PgCl5+sczl_clAdd5) as sczl_cls5,
-        //     (sczl_cl6*sczl_PgCl6+sczl_clAdd6) as sczl_cls6
-        //     ')
-        //     ->limit($num)
-        //     ->select();
-
-        // $data1 = [];
-        // foreach ($arr1 as $k=>$v){
-        //     for ($i=1;$i<=6;$i++){
-        //         if(array_key_exists($v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i],$data1)){
-        //             $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] += $v['sczl_cls'.$i];
-        //         }else{
-        //             $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] = $v['sczl_cls'.$i];
-        //         }
-        //     }
-        // }
-
-        // foreach ($rows as $key=>$value) {
-        //     $rows[$key]['yj_成品数量'] = (string)floatval($value['yj_成品数量']*10000);
-        //     $rows[$key]['yj_实际投料'] = (string)floatval($value['yj_实际投料']*10000);
-        //     if(array_key_exists($value['jjcp_gdbh'].'-'.$value['jjcp_yjno'],$data1)){
-        //         $rows[$key]['包装产量'] = $data1[$value['jjcp_gdbh'].'-'.$value['jjcp_yjno']];
-        //     }else{
-        //         $rows[$key]['包装产量'] = '';
-        //     }
-        //     if(array_key_exists($value['jjcp_gdbh'].'-'.$value['jjcp_cpdh'],$brr)){
-        //         $rows[$key]['入仓数量'] = $brr[$value['jjcp_gdbh'].'-'.$value['jjcp_cpdh']];
-        //     }else{
-        //         $rows[$key]['入仓数量'] = '';
-        //     }
-        //     if($value['jjcp_smb'] !=''){
-        //         $rows[$key]['状态'] = '完工';
-        //         $rows[$key]['缺数'] = (int)$rows[$key]['yj_成品数量']-(int)$rows[$key]['包装产量'];
-        //     }else{
-        //         $rows[$key]['状态'] = '';
-        //         $rows[$key]['缺数'] = '';
-        //     }
-        // }
-
-        $data = [
-            'total'         => count($data),
-            'rows'          => $data,
-        ];
-        $this->success('成功',$data);
-    }
-
-    /**
-     * 入仓末板数据统计列表excel导出
-     * @ApiMethod (POST)
-     * @param string file_name
-     * @param array fields
-     */
-    public function mbExport()
-    {
-        //get请求
-        if(!$this->request->isPost()){
-            $this->error('请求方式错误');
-        }
-        $req = $this->request->param();
-
-        if (!isset($req['file_name'])){
-            $this->error('参数错误','file_name');
-        }
-
-        if (!(isset($req['fields']) && count($req['fields'])!=0)){
-            $this->error('参数错误','fields',100);
-        }
-
-        $arr = [
-            'Yj_Gdbh'       =>['工单编号'],
-            'yj_Yjno'       =>['印件号'],
-            'yj_yjmc'       =>['印件名称'],
-            'yj_成品数量'    =>['计划交货数量'],
-            'yj_实际投料'    =>['印件投料'],
-            'sczl_cls'      =>['包装产量'],
-            'jjcp_sj'       =>['最近入仓时间'],
-            'jjcp_sls'      =>['入仓产量'],
-            'status'        =>['完工'],
-            '缺数'          =>['缺数'],
-        ];
-        $data[0] = [];
-        foreach ($req['fields'] as $k=>$v){
-            if(array_key_exists($v,$arr)){
-                array_push($data[0],$arr[$v][0]);
-            }
-        }
-        $date = date('Y-m-d',strtotime('-3 month'));
-        $arr1 = db('db_包装产量预报')
-            ->field('sczl_gdbh1, sczl_gdbh2, sczl_gdbh3, sczl_gdbh4, sczl_gdbh5, sczl_gdbh6, 
-            cast(substr(sczl_yjGx1,1,2) as signed) as sczl_yjGx1, cast(substr(sczl_yjGx2,1,2) as signed) as sczl_yjGx2, 
-            cast(substr(sczl_yjGx3,1,2) as signed) as sczl_yjGx3, cast(substr(sczl_yjGx4,1,2) as signed) as sczl_yjGx4, 
-            cast(substr(sczl_yjGx5,1,2) as signed) as sczl_yjGx5, cast(substr(sczl_yjGx6,1,2) as signed) as sczl_yjGx6, 
-            (sczl_cl1*sczl_PgCl1+sczl_clAdd1) as sczl_cls1, 
-            (sczl_cl2*sczl_PgCl2+sczl_clAdd2) as sczl_cls2, 
-            (sczl_cl3*sczl_PgCl3+sczl_clAdd3) as sczl_cls3, 
-            (sczl_cl4*sczl_PgCl4+sczl_clAdd4) as sczl_cls4, 
-            (sczl_cl5*sczl_PgCl5+sczl_clAdd5) as sczl_cls5, 
-            (sczl_cl6*sczl_PgCl6+sczl_clAdd6) as sczl_cls6
-            ')
-            ->where('sczl_rq','>=',$date)
-            ->select();
-
-        $data1 = [];
-        foreach ($arr1 as $k=>$v){
-            for ($i=1;$i<=6;$i++){
-                if(array_key_exists($v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i],$data1)){
-                    $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] += $v['sczl_cls'.$i];
-                }else{
-                    $data1[$v['sczl_gdbh'.$i].'-'.$v['sczl_yjGx'.$i]] = $v['sczl_cls'.$i];
-                }
-            }
-        }
-        krsort($data1);
-
-        //糊盒成品入仓中jjcp_smb不为空的工单
-        $rows1 = db('糊盒成品入仓')
-            ->where('jjcp_smb','<>','')
-            ->order('jjcp_gdbh desc')
-            ->column("CONCAT(jjcp_gdbh, '-', jjcp_yjno) AS gdyj, UniqId");
-
-        $rows2 = db('糊盒成品入仓')
-            ->where('jjcp_sj','>=',$date)
-            ->group('jjcp_gdbh, jjcp_cpdh')
-            ->column("CONCAT( jjcp_gdbh, '-',  jjcp_yjno) AS gdyj, jjcp_smb,
-            sum(jjcp_sl) as jjcp_sls, left(max(jjcp_sj),10) as jjcp_sj");
-
-        $rows3 = db('工单_印件资料')->cache(true,86400)
-            ->group('Yj_Gdbh, yj_Yjno')
-            ->column("CONCAT( Yj_Gdbh, '-',  yj_Yjno) AS gdyj, 
-            Yj_Gdbh, yj_Yjno, yj_yjmc, yj_成品数量, yj_实际投料");
-
-        foreach($data1 as $key=>$value){
-            if(!array_key_exists($key,$rows1)){
-                $subArray = [];
-                foreach ($arr as $k=>$v){
-                    if($k=='yj_成品数量' || $k=='yj_实际投料'){
-                        if(array_key_exists($key,$rows3)){
-                            $subArray[$k] = (string)floatval($rows3[$key][$k]*10000);
-                        }else{
-                            $subArray[$k] = '';
-                        }
-                    }else if($k=='Yj_Gdbh' || $k=='yj_Yjno'){
-                        if(array_key_exists($key,$rows3)){
-                            $subArray[$k] = $rows3[$key][$k];
-                        }else{
-                            $subArray[$k] = '';
-                        }
-                    }else if($k=='yj_yjmc'){
-                        if(array_key_exists($key,$rows3)){
-                            $subArray[$k] = trim($rows3[$key][$k]);
-                        }else{
-                            $subArray[$k] = '';
-                        }
-                    }else if($k=='sczl_cls'){
-                        $subArray[$k] = (string)floatval($value);
-                    }else if($k=='status'){
-                        if(array_key_exists($key,$rows2) && $rows2[$key]['jjcp_smb'] !=''){
-                            $subArray[$k] = '完工';
-                        }else{
-                            $subArray[$k] = '';
-                        }
-                    }else if($k=='缺数'){
-                        if(array_key_exists($key,$rows2) && $rows2[$key]['jjcp_smb'] !=''){
-                            $subArray[$k]['缺数'] = (int)$rows3[$key]['yj_成品数量']-(int)$value;
-                        }else{
-                            $subArray[$k] = '';
-                        }
-                    }else{
-                        if(array_key_exists($key,$rows2)){
-                            $subArray[$k] = $rows2[$key][$k];
-                            $subArray[$k] = $rows2[$key][$k];
-                            $subArray[$k] = $rows2[$key][$k];
-                        }else{
-                            $subArray[$k] = '';
-                            $subArray[$k] = '';
-                            $subArray[$k] = '';
-                        }
-                    }
-                }
-                array_push($data,$subArray);
-            }
-        }
-
-        $this->success('成功',['file_name'=>$req['file_name'],'data'=>$data]);
-    }
 }