Browse Source

first commit

liuhairui 5 months ago
parent
commit
a5464924f5
39 changed files with 5590 additions and 2105 deletions
  1. 37 0
      application/admin/controller/Area.php
  2. 111 138
      application/admin/controller/Deliver.php
  3. 92 44
      application/admin/controller/Finishedproduct.php
  4. 0 77
      application/admin/controller/Inventorydetails.php
  5. 334 110
      application/admin/controller/QcodeAdd.php
  6. 1 0
      application/admin/controller/QcodeBach.php
  7. 276 91
      application/admin/controller/QcodeProduct.php
  8. 245 11
      application/admin/controller/user/User.php
  9. 19 0
      application/admin/lang/zh-cn/area.php
  10. 3 11
      application/admin/lang/zh-cn/finishedproduct.php
  11. 0 15
      application/admin/lang/zh-cn/inventorydetails.php
  12. 1 0
      application/admin/lang/zh-cn/qcode_bach.php
  13. 49 0
      application/admin/model/Area.php
  14. 3 36
      application/admin/model/Finishedproduct.php
  15. 0 57
      application/admin/model/Inventorydetails.php
  16. 6 0
      application/admin/model/QcodeProduct.php
  17. 1 1
      application/admin/validate/Area.php
  18. 81 0
      application/admin/view/area/add.html
  19. 81 0
      application/admin/view/area/edit.html
  20. 545 0
      application/admin/view/area/index.html
  21. 15 15
      application/admin/view/common/header.html
  22. 392 212
      application/admin/view/finishedproduct/index.html
  23. 13 0
      application/admin/view/finishedproduct/product_summary.html
  24. 0 63
      application/admin/view/inventorydetails/add.html
  25. 0 63
      application/admin/view/inventorydetails/edit.html
  26. 0 417
      application/admin/view/inventorydetails/index.html
  27. 327 252
      application/admin/view/qcode_add/index.html
  28. 5 4
      application/admin/view/qcode_product/index.html
  29. 54 0
      application/admin/view/user/user/chuku.html
  30. 537 20
      application/admin/view/user/user/index.html
  31. 54 0
      application/admin/view/user/user/ruku.html
  32. 63 0
      public/assets/js/backend/area.js
  33. 189 191
      public/assets/js/backend/deliver.js
  34. 15 32
      public/assets/js/backend/finishedproduct.js
  35. 0 62
      public/assets/js/backend/inventorydetails.js
  36. 82 125
      public/assets/js/backend/qcode_add.js
  37. 1780 12
      public/assets/js/backend/qcode_bach.js
  38. 123 27
      public/assets/js/backend/qcode_product.js
  39. 56 19
      public/assets/js/backend/user/user.js

+ 37 - 0
application/admin/controller/Area.php

@@ -0,0 +1,37 @@
+<?php
+
+namespace app\admin\controller;
+
+use app\common\controller\Backend;
+
+/**
+ * 地区管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Area extends Backend
+{
+
+    /**
+     * Area模型对象
+     * @var \app\admin\model\Area
+     */
+    protected $model = null;
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = new \app\admin\model\Area;
+        $this->view->assign("levelList", $this->model->getLevelList());
+    }
+
+
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+
+}

+ 111 - 138
application/admin/controller/Deliver.php

@@ -16,14 +16,13 @@ use PhpOffice\PhpSpreadsheet\Style\Alignment;
 use PhpOffice\PhpSpreadsheet\Exception;
 use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
 use app\admin\model\QcodeGoods;
+use think\Config;
 use think\Session;
 
 class Deliver extends Backend
 {
     /**
      * 首页
-     * @return string|\think\response\Json
-     * @throws \think\Exception
      */
     public function index()
     {
@@ -31,138 +30,11 @@ class Deliver extends Backend
     }
 
     /**
-     * 大件发货列表
-     * @return string|\think\response\Json
-     * @throws \think\Exception
-     * @throws \think\db\exception\DataNotFoundException
-     * @throws \think\db\exception\ModelNotFoundException
-     * @throws \think\exception\DbException
+     * 大件发货
      */
-//    public function lager()
-//    {
-//        $company = new QcodeCompany();
-//        $product = new QcodeProduct();
-//        $large = new QcodeLarge();
-//        $bach = new QcodeBach();
-//        $small = new QcodeSmall();
-//        $this->request->filter(['strip_tags', 'trim']);
-//        if (false === $this->request->isAjax()) {
-//            return $this->view->fetch();
-//        }
-//        if ($this->request->request('keyField')) {
-//            return $this->selectpage();
-//        }
-//        // 接收参数
-//        $userInfo = Session::get('admin');
-//        $where = [
-//            'delete_time'=> '',
-//        ];
-//        $filter = input('filter');
-//        $filter = json_decode($filter,true);
-//        $whereList = [
-//            'delete_time'=>'',
-//        ];
-//        //样品编号查询
-//        if (isset($filter['matter_name'])){
-//            $whereList['matter_no'] =$filter['matter_name'];
-//        }
-//        if (isset($filter['bach'])){
-//            $whereList['bach_num'] = $filter['bach'];
-//        }
-//        if (isset($filter['manufacture_date'])){
-//            $begin = substr($filter['manufacture_date'],0,19);
-//            $end = substr($filter['manufacture_date'],22);
-//            $begin = (int)date('ymd',strtotime($begin));
-//            $end = (int)date('ymd',strtotime($end));
-//            $whereList['manufacture_date'] = ['between',[$begin,$end]];
-//        }
-//
-//        $bach_list = $bach->name($userInfo['company'].'_'.'qcode_bach')->where($whereList)->column('_id');
-//        $bach_id = [];
-//        foreach ($bach_list as $v){
-//            $id = substr(json_encode($v),9,-2);
-//            array_push($bach_id,$id);
-//        }
-//        $order = input('order');
-////        $offset = input('offset');
-////        $limit = input('limit');
-////        $limit = input('limit', 10); // 每页数量,默认10条
-//
-//        $offset = input('offset', 0);
-//        $limit = input('limit', 10);
-//        $skip = $offset;
-//
-//        $total = $large->name($userInfo['company'].'_'.'qcode_large')
-//            ->where('l_status', 0)
-//            ->where($where)
-//            ->whereIn('bach_id', $bach_id)
-//            ->count();
-//
-//        $large_list = $large->name($userInfo['company'].'_'.'qcode_large')
-//            ->order('l_flow')
-//            ->where($where)
-//            ->where('l_status', 0)
-//            ->whereIn('bach_id', $bach_id)
-//            ->skip($skip)
-//            ->limit($limit)
-//            ->select();
-//
-//        $list=[];
-//        foreach ($large_list as $k=>$v) {
-//            $bach_detail = $bach
-//                ->name($userInfo['company'].'_qcode_bach')
-//                ->where('_id', $v['bach_id'])
-//                ->find();
-//            //新增取 $bach 字段
-//            $list[$k]['num'] = $bach_detail['num'];
-//            $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
-//            $list[$k]['tray_num'] = $bach_detail['tray_num'];
-//            $list[$k]['box_num'] = $bach_detail['box_num'];
-//            $list[$k]['small_num'] = $bach_detail['small_num'];
-//            $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
-//            $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
-//            $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
-//            $list[$k]['small_num'] = $bach_detail['small_num'];
-//            $list[$k]['larger_num'] = $bach_detail['larger_num'];
-//
-//            $bach_detail = $bach->name($userInfo['company'].'_'.'qcode_bach')->where('_id',$v['bach_id'])->find();
-//            $list[$k]['id'] = substr(json_encode($v['_id']),9,-2);
-//            $list[$k]['bach'] = $bach_detail['bach_num'];
-//            $list[$k]['l_flow'] = ltrim(substr($v['code'],53,6),'0');
-//            $list[$k]['matter_name'] = $bach_detail['matter_name'];
-//            $list[$k]['manufacture_date'] = date('Y-m-d',strtotime('20'.$bach_detail['manufacture_date']));
-//            $list[$k]['code'] = $v['code'];
-//            $small_num = $small->name($userInfo['company'].'_'.'qcode_small')->where('large_id',substr(json_encode($v['_id']),9,-2))->count();
-//            $list[$k]['small_num'] = $small_num;
-//        }
-//
-////        $result = ['total'=>$total,'rows'=>$list];
-//        // 分组
-//        $grouped = [];
-//        foreach ($list as $item) {
-//            $grouped[$item['matter_name']][] = $item;
-//        }
-//
-//        // 每组排序
-//        foreach ($grouped as &$items) {
-//            usort($items, function ($a, $b) {
-//                return intval($a['l_flow']) <=> intval($b['l_flow']);
-//            });
-//        }
-//        unset($items);
-//
-//        // 合并
-//        $sortedList = array_merge(...array_values($grouped));
-//
-//        // 输出
-////        echo "<pre>";
-////        print_r($sortedList);
-////        echo "</pre>";
-//        return json(['total'=>$total,'rows'=>$sortedList]);
-//    }
-
     public function lager()
     {
+
         $company = new QcodeCompany();
         $product = new QcodeProduct();
         $large = new QcodeLarge();
@@ -183,6 +55,7 @@ class Deliver extends Backend
         $where = ['delete_time'=> ''];
         $filter = input('filter');
         $filter = json_decode($filter, true);
+
         $whereList = ['delete_time'=>''];
 
         if (isset($filter['matter_name'])){
@@ -207,10 +80,10 @@ class Deliver extends Backend
             $bach_id[] = $id;
         }
 
-        // 获取分页参数
-        $offset = input('offset', 0);
-        $limit = input('limit', 10);
-        $skip = $offset;
+//        // 获取分页参数
+        $offset = input('offset', 0);  // 当前页数
+        $limit = input('limit', 10);   // 每页多少条
+
         // 总数量
         $total = $large->name($userInfo['company'].'_qcode_large')
             ->where('l_status', 0)
@@ -220,13 +93,13 @@ class Deliver extends Backend
 
         // 当前页数据
         $large_list = $large->name($userInfo['company'].'_qcode_large')
-            ->order('l_flow')
             ->where($where)
             ->where('l_status', 0)
             ->whereIn('bach_id', $bach_id)
-//            ->skip($skip)
-//            ->limit($limit)
+            ->limit($limit)
+            ->skip($offset)
             ->select();
+
         // 数据处理
         $list = [];
         foreach ($large_list as $k => $v) {
@@ -254,9 +127,109 @@ class Deliver extends Backend
             $list[$k]['small_num'] = $small_num;
         }
 
+        // 总数与分页
+//        $list = array_slice($list, $offset, $limit);
+
         // 返回分页数据(关键!不要再做分组排序!)
         return json(['total' => $total, 'rows' => $list]);
     }
+
+//    public function lager()
+//    {
+//        $company = new QcodeCompany();
+//        $product = new QcodeProduct();
+//        $large = new QcodeLarge();
+//        $bach = new QcodeBach();
+//        $small = new QcodeSmall();
+//
+//        $this->request->filter(['strip_tags', 'trim']);
+//
+//        if (false === $this->request->isAjax()) {
+//            return $this->view->fetch();
+//        }
+//
+//        if ($this->request->request('keyField')) {
+//            return $this->selectpage();
+//        }
+//
+//        $userInfo = Session::get('admin');
+//        $where = ['delete_time'=> ''];
+//        $filter = input('filter');
+//        $filter = json_decode($filter, true);
+//        $whereList = ['delete_time'=>''];
+//
+//        if (isset($filter['matter_name'])){
+//            $whereList['matter_no'] = $filter['matter_name'];
+//        }
+//        if (isset($filter['bach'])){
+//            $whereList['bach_num'] = $filter['bach'];
+//        }
+//        if (isset($filter['manufacture_date'])){
+//            $begin = substr($filter['manufacture_date'], 0, 19);
+//            $end = substr($filter['manufacture_date'], 22);
+//            $begin = (int)date('ymd', strtotime($begin));
+//            $end = (int)date('ymd', strtotime($end));
+//            $whereList['manufacture_date'] = ['between', [$begin, $end]];
+//        }
+//
+//        // 查出相关 bach_id
+//        $bach_list = $bach->name($userInfo['company'].'_qcode_bach')->where($whereList)->column('_id');
+//        $bach_id = [];
+//        foreach ($bach_list as $v){
+//            $id = substr(json_encode($v), 9, -2);
+//            $bach_id[] = $id;
+//        }
+//
+//        // 获取分页参数
+//        $offset = input('offset', 0);
+//        $limit = input('limit', 10);
+//        $skip = $offset;
+//        // 总数量
+//        $total = $large->name($userInfo['company'].'_qcode_large')
+//            ->where('l_status', 0)
+//            ->where($where)
+//            ->whereIn('bach_id', $bach_id)
+//            ->count();
+//
+//        // 当前页数据
+//        $large_list = $large->name($userInfo['company'].'_qcode_large')
+//            ->order('l_flow')
+//            ->where($where)
+//            ->where('l_status', 0)
+//            ->whereIn('bach_id', $bach_id)
+////            ->skip($skip)
+////            ->limit($limit)
+//            ->select();
+//        // 数据处理
+//        $list = [];
+//        foreach ($large_list as $k => $v) {
+//            $bach_detail = $bach->name($userInfo['company'].'_qcode_bach')->where('_id', $v['bach_id'])->find();
+//
+//            $list[$k]['id'] = substr(json_encode($v['_id']), 9, -2);
+//            $list[$k]['l_flow'] = $bach_detail['l_flow'];
+//            $list[$k]['bach'] = $bach_detail['bach_num'];
+//            $list[$k]['num'] = $bach_detail['num'];
+//            $list[$k]['matter_name'] = $bach_detail['matter_name'];
+//            $list[$k]['total_boxes'] = $bach_detail['total_boxes'];
+//            $list[$k]['tray_num'] = $bach_detail['tray_num'];
+//            $list[$k]['box_num'] = $bach_detail['box_num'];
+//            $list[$k]['pallet_height'] = $bach_detail['pallet_height'];
+//            $list[$k]['pallet_length'] = $bach_detail['pallet_length'];
+//            $list[$k]['pallet_width'] = $bach_detail['pallet_width'];
+//            $list[$k]['larger_num'] = $bach_detail['larger_num'];
+//            $list[$k]['manufacture_date'] = date('Y-m-d', strtotime('20'.$bach_detail['manufacture_date']));
+//            $list[$k]['code'] = $v['code'];
+//            $list[$k]['l_flow'] = ltrim(substr($v['code'], 53, 6), '0');
+//
+//            $small_num = $small->name($userInfo['company'].'_qcode_small')
+//                ->where('large_id', $list[$k]['id'])
+//                ->count();
+//            $list[$k]['small_num'] = $small_num;
+//        }
+//
+//        // 返回分页数据(关键!不要再做分组排序!)
+//        return json(['total' => $total, 'rows' => $list]);
+//    }
     /**
      * 小件列表
      * @return \think\response\Json

+ 92 - 44
application/admin/controller/Finishedproduct.php

@@ -25,64 +25,57 @@ class Finishedproduct extends Backend
     {
         parent::_initialize();
         $this->model = new \app\admin\model\Finishedproduct;
-        $this->view->assign("statusList", $this->model->getStatusList());
     }
 
-
-
-    /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
-     */
-
-
     public function index()
     {
-        $search = input('get.search', '');
-        $page   = input('get.page', 1);
-        $limit  = input('get.limit', 10);
-        $db3 = \db()->connect(config('database.db3'));
+        $search = input('');
+        $page = input('get.page', 1);
+        $limit = input('get.limit', 10);
+        $mongo = \think\Db::connect('mongodb');
 
+        // 初始化查询条件
         $where = [];
-        if (!empty($search)) {
-            $where = function($query) use ($search) {
-                $query->where('jjcp_gdbh', 'like', "%{$search}%")
-                    ->whereOr('jjcp_cpdh', 'like', "%{$search}%")
-                    ->whereOr('jjcp_cpmc', 'like', "%{$search}%");
-            };
+
+        if (!empty($search['search'])) {
+            // 使用正则表达式来实现模糊匹配,'i' 表示忽略大小写
+            $where['jjcp_cpdh|成品名称|jjcp_gdbh|订单编号'] = new \MongoDB\BSON\Regex($search['search'], 'i');
         }
 
-        $data =$db3->name('成品入仓')
-            ->where($where)
-                ->field('
-                jjcp_gdbh,
-                jjcp_cpdh,
-                jjcp_cpmc,
-                jjcp_sl,
-                UniqId,
-                订单编号 AS order_ddbh,
-                jjcp_smb
-            ')
-            ->order('Sys_rq desc')
-            ->where('jjcp_smb', '=', '末 板')
-            ->whereNull('Mod_rq')
-            ->limit(($page - 1) * $limit, $limit)
-            ->select();
+        if($where){
+            $data = $mongo->name('finished_products')
+                ->limit($page, $limit)
+                ->where($where)
+                ->order('UniqId','desc')
+                ->where('jjcp_smb','末 板')
+                ->select();
+        }else{
+            $data = $mongo->name('finished_products')
+                ->limit($page, $limit)
+                ->where($where)
+                ->order('UniqId','desc')
+                ->where('jjcp_smb','末 板')
+                ->select();
+        }
 
-        // 查询总数(必须使用和分页前相同条件)
-        $total = $db3->name('成品入仓')->where($where)->count();
+        $filtered = [];
 
-        // 字段值格式化
-        foreach ($data as &$row) {
-            $row['jjcp_smb'] = ($row['jjcp_smb'] === '末 板') ? '完工入库' : '未完工入库';
+        foreach ($data as $item) {
+            if (isset($item['jjcp_cpdh'], $item['成品编码']) && $item['jjcp_cpdh'] === $item['成品编码']) {
+                $filtered[] = $item;
+            }
         }
 
-        // 返回 JSON 或渲染视图
+        $count = $mongo->name('finished_products')
+            ->where($where)
+            ->order('UniqId','desc')
+            ->where('jjcp_smb','末 板')
+            ->select();
+
         if (request()->isAjax()) {
             return json([
-                'data'  => $data,
-                'total' => $total,
+                'data'  => $filtered,
+                'total' => count($count),
                 'page'  => $page,
                 'limit' => $limit
             ]);
@@ -132,5 +125,60 @@ class Finishedproduct extends Backend
     }
 
 
+    //左侧 右侧页面
+    public function product_summary()
+    {
+        // 连接到 MongoDB 数据库
+        $mongo = \think\Db::connect('mongodb');
+
+        // 获取库存汇总表的数据
+        $list = $mongo->name('inventory_summary')->select();
+
+        // 用于存储分组后的结果
+        $grouped_data = [];
+
+        // 遍历查询到的数据并进行分组
+        foreach ($list as $item) {
+            // 获取创建时间的年份和月份
+            $year = date('Y', strtotime($item['created_at']));  // 获取年份
+            $month = date('Ym', strtotime($item['created_at'])); // 获取年月(例如 202506)
+
+            // 获取产品名称
+            $product_name = $item['cpmc'];
+
+            // 获取工单编号
+            $gdbh = $item['gdbh'];
+            $order_ddbh = $item['order_ddbh'];
+
+            // 构建多级分组结构
+            if (!isset($grouped_data[$year])) {
+                $grouped_data[$year] = [];
+            }
+
+            if (!isset($grouped_data[$year][$month])) {
+                $grouped_data[$year][$month] = [];
+            }
+
+            if (!isset($grouped_data[$year][$month][$product_name])) {
+                $grouped_data[$year][$month][$product_name] = [];
+            }
+
+            // 将工单编号添加到对应的位置,保留 'order_ddbh'
+            $grouped_data[$year][$month][$product_name][$order_ddbh] = [
+                'order_ddbh' => $item['order_ddbh'],
+            ];
+        }
+
+        // 输出结果查看结构
+//        echo "<pre>";
+//        print_r($grouped_data); // 或者可以使用 var_export($grouped_data, true)
+//        echo "</pre>";
+
+        return $this->fetch();
+    }
+
+
+
+
 
 }

+ 0 - 77
application/admin/controller/Inventorydetails.php

@@ -1,77 +0,0 @@
-<?php
-
-namespace app\admin\controller;
-
-use app\common\controller\Backend;
-use think\Db;
-use function EasyWeChat\Kernel\Support\rsa_public_encrypt;
-
-/**
- * 版本管理
- *
- * @icon fa fa-circle-o
- */
-class Inventorydetails extends Backend
-{
-
-    /**
-     * Inventorydetails模型对象
-     * @var \app\admin\model\Inventorydetails
-     */
-    protected $model = null;
-
-    public function _initialize()
-    {
-        parent::_initialize();
-        $this->model = new \app\admin\model\Inventorydetails;
-        $this->view->assign("statusList", $this->model->getStatusList());
-    }
-
-
-
-    /**
-     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
-     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
-     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
-     */
-
-
-    public function index()
-    {
-        $search = input('');
-        $page = input('get.page', 1);
-        $limit = input('get.limit', 10);
-        $mongo = \think\Db::connect('mongodb');
-
-        // 初始化查询条件
-        $where = [];
-
-        if (!empty($search['search'])) {
-            // 使用正则表达式来实现模糊匹配,'i' 表示忽略大小写
-            $where['jjcp_cpdh|jjcp_cpmc|jjcp_gdbh|order_ddbh'] = new \MongoDB\BSON\Regex($search['search'], 'i');
-        }
-
-        $data = $mongo->name('finished_products')
-            ->limit(($page - 1) * $limit, $limit)
-            ->where($where)
-            ->select();
-        usort($data, function ($a, $b) {
-            return strtotime($b['created_at']) - strtotime($a['created_at']);
-        });
-
-        if (request()->isAjax()) {
-            return json([
-                'data'  => $data,
-                'total' => count($data),
-                'page'  => $page,
-                'limit' => $limit
-            ]);
-        }
-        $this->assign('data', $data);
-        return $this->fetch();
-    }
-
-
-
-
-}

+ 334 - 110
application/admin/controller/QcodeAdd.php

@@ -22,9 +22,8 @@ class QcodeAdd extends Backend
      */
     public function index()
     {
-        $company = new QcodeCompany();
-        $product = new QcodeProduct();
 
+        //获取登录账号信息【厂商信息】
         $userinfo = Session::get('admin');
         $data = [
             'nickname' => $userinfo['company_name'],
@@ -33,7 +32,9 @@ class QcodeAdd extends Backend
             'printer_code' => $userinfo['printer_code'],
             'company_address' => $userinfo['company_address']
         ];
-        //创建公司唯一id,进行创建公司对用表名
+        $this->view->assign('row',$data);
+
+        //将对此账号创建公司唯一id,进行创建公司对应公司表名company id
         $user_company_value = Db::name('admin')->where('id', $userinfo['id'])->value('company');
         if (empty($user_company_value)) {
             $max_company = Db::name('admin')->max('company');
@@ -60,104 +61,267 @@ class QcodeAdd extends Backend
             }
         }
 
-
-//        $product_id = $company->name((int)$userinfo['company'].'_'.'qcode_company')->where('delete_time','')->column('product_id');
-//        echo "<pre>";
-//        print_r($product_id);
-//        echo "<pre>";
-//        $product_name = [];
-//        foreach ($product_id as $v){
-//            $list = $product->where('_id',$v)->where('delete_time','')->find();
-//            $product_name[$list['product_code']] =  $list['product_name'];
+//        //统计产品信息数据
+//        $mongo = \think\Db::connect('mongodb');
+//        // 获取成品入仓表数据
+//        $mongo_products = $mongo
+//            ->name('finished_products')
+//            ->field('成品名称, jjcp_cpdh, 订单编号, jjcp_gdbh, jjcp_sl')
+//            ->order('UniqId','desc')
+//            ->where('jjcp_smb','末 板')
+//            ->limit(1,50)
+//            ->select();
+//
+//        $grouped_products = [];
+//        foreach ($mongo_products as $item) {
+//            $group_key = $item['订单编号'] . '_' . $item['jjcp_gdbh'];
+//            if (!isset($grouped_products[$group_key])) {
+//                $grouped_products[$group_key] = [
+//                    'order_ddbh' => $item['订单编号'],
+//                    'gdbh' => $item['jjcp_gdbh'],
+//                    'cpmc' => $item['成品名称'],
+////                    'cpdh' => $item['jjcp_cpdh'],
+//                    'ruku_sl' => 0,            // 入库数量
+//                    'remain_stock' => 0,       // 剩余库存
+//                    'sl' => 0
+//                ];
+//            }
+//            // 累加入库数量
+//            $grouped_products[$group_key]['ruku_sl'] += (int)$item['jjcp_sl'];
 //        }
-//        $this->view->assign('product', $product_name);
-
-        // 1. 获取所有产品的 ID
-        $product_id = $company
-            ->name((int)$userinfo['company'] . '_' . 'qcode_company')
-            ->where('delete_time', '')
-            ->column('product_id');
-
-        // 2. 查找产品信息:构建 product_code => 全部信息数组
-        $product_info = [];
-        foreach ($product_id as $v) {
-            $list = $product
-                ->where('_id', $v)
-                ->where('delete_time', '')
-                ->find();
-            if ($list) {
-                // 记录完整产品信息
-                $product_info[$list['product_code']] = [
-                    'jjcp_cpmc' => $list['product_name'],
-                    'jjcp_cpdh' => $list['product_code'],
-                ];
-            }
-        }
-
-        // 3. 从 Mongo 查询 jjcp_cpmc 名称
-        $mongo = \think\Db::connect('mongodb');
-        $mongo_products = $mongo
-            ->name('finished_products')
-            ->field('jjcp_cpmc, jjcp_cpdh, order_ddbh, jjcp_gdbh, jjcp_sl')
-            ->select();
-
-        // 4. 比对名称,匹配成功的组装完整 vo 结构
-        $matched_products = [];
-        foreach ($product_info as $code => $item) {
-            foreach ($mongo_products as $mp) {
-                if (trim($item['jjcp_cpmc']) === trim($mp['jjcp_cpmc'])) {
-                    $matched_products[] = [
-                        'jjcp_cpmc' => $item['jjcp_cpmc'],
-                        'jjcp_cpdh' => $item['jjcp_cpdh'],
-                        'order_ddbh' => $mp['order_ddbh'],
-                        'jjcp_gdbh' => $mp['jjcp_gdbh'],
-                        'jjcp_sl' => $mp['jjcp_sl'],
-                        'product_code' => $code,
-                    ];
-                }
-            }
-        }
-        $this->view->assign('product', $matched_products);
-
-        $this->view->assign('row',$data);
+//        // 查询库存表并计算
+//        foreach ($grouped_products as $group_key => &$prod) {
+//            $where = [
+//                'order_ddbh' => $prod['order_ddbh'],
+//                'gdbh' => $prod['gdbh'],
+//                'cpmc' => $prod['cpmc'],
+//            ];
+//
+//            $inventory = $mongo->name('inventory_summary')->where($where)->find();
+//            $prod['remaining_quantity'] = $inventory ? (int)$inventory['remaining_quantity'] : 0;
+//            $prod['sl'] = $prod['remaining_quantity'] > 0 ? $prod['remaining_quantity'] : $prod['ruku_sl'];
+//        }
+//        unset($prod);
+//        $matched_products = array_values($grouped_products);
+//        $this->view->assign('product', $matched_products);
         return $this->view->fetch();
     }
 
+
     /**
      * 获取产品信息
+     * 查询入仓表【finished_products】
      */
-    public function product(){
-        $QcodeProduct = new QcodeProduct();
-        $ResetFlow = new ResetFlow();
-        $userinfo = Session::get('admin');
-        if ($this->request->isAjax() === false){
-            $this->error('请求错误');
+    public function product()
+    {
+        $params = input('');
+        $page = max(1, (int)$params['page']);
+        $limit = max(1, (int)$params['limit']);
+        $offset = ($page - 1) * $limit;
+
+
+
+        // 获取工单编号列表
+        $db3 = Db::connect(config('database.db3'));
+        $gdRows = $db3->query("SELECT DISTINCT `Gd_gdbh`, `Gd_客户代号`, `Gd_cpdh` FROM `工单_基本资料` WHERE `Gd_客户代号` = ?", ['J0031']);
+
+        $Gd_gdbhList = array_column($gdRows, 'Gd_gdbh');
+        $gdbhList = array_column($gdRows, 'Gd_cpdh');
+        if (empty($gdbhList)) {
+            $this->assign([
+                'data' => '',
+                'total' =>'',
+            ]);
         }
 
-        $product_code = input('product_code');
+        // Mongo 查询
+        $mongo = \think\Db::connect('mongodb');
+        $where = ['jjcp_cpdh' => ['in', $gdbhList],'jjcp_gdbh' => ['in', $Gd_gdbhList], 'jjcp_smb' => '末 板'];
 
-        if (empty($product_code)){
-            $this->error('参数错误');
+        if (!empty($params['search'])) {
+            $where['jjcp_cpdh|成品名称|jjcp_gdbh|订单编号'] = new \MongoDB\BSON\Regex($params['search'], 'i');
         }
-        $product = $QcodeProduct->where('product_code',$product_code)->find();
-        if (empty($product)){
-            $this->error('未找到该产品信息');
+
+        // 1. 查询所有符合条件的成品数据(不分页)
+        $all_products = $mongo->name('finished_products')
+            ->where($where)
+            ->order('UniqId', 'desc')
+            ->select();
+
+        // 2. 按订单编号 + 工单编号分组聚合
+        $grouped_products = [];
+        foreach ($all_products as $item) {
+            $group_key = $item['订单编号'] . '_' . $item['jjcp_gdbh'];
+            if (!isset($grouped_products[$group_key])) {
+                $grouped_products[$group_key] = [
+                    'order_ddbh' => $item['订单编号'],
+                    'gdbh' => $item['jjcp_gdbh'],
+                    'cpmc' => $item['成品名称'],
+                    'ruku_sl' => 0,
+                    'remain_stock' => 0,
+                    'sl' => 0
+                ];
+            }
+            $grouped_products[$group_key]['sl'] += (int)$item['jjcp_sl'];
         }
 
-        $flow = $ResetFlow->name($userinfo['company'].'_'."reset_flow")->where('product_id',substr(json_encode($product['_id']),9,-2))->find();
-        $row = [
-            'temple' => $product['temple'],
-            'flow' => isset($flow['l_flow'])?(int)$flow['l_flow']+1:'',
-            'bach' => isset($flow['bach_num'])?(int)$flow['bach_num']+1:'',
-        ];
-        if (!empty($flow)){
-            $row['flow'] = $flow['l_flow']+1;
-            $row['bach'] = $flow['bach_num']+1;
+        // 3. 将聚合后结果分页(稳定分页)
+        $all_grouped = array_values($grouped_products);
+        $total = count($all_grouped);
+        $paged_grouped = array_slice($all_grouped, $offset, $limit);
+
+        // 4. 获取库存数据
+        foreach ($paged_grouped as &$prod) {
+            $inventory = $mongo->name('inventory_summary')->where([
+                'order_ddbh' => $prod['order_ddbh'],
+                'gdbh' => $prod['gdbh'],
+                'cpmc' => $prod['cpmc'],
+            ])->find();
+
+//            $prod['remaining_quantity'] = $inventory ? (int)$inventory['remaining_quantity'] : 0;
+//            $prod['sl'] = $prod['remaining_quantity'] > 0 ? $prod['remaining_quantity'] : $prod['ruku_sl'];
+
         }
+        unset($prod);
 
-        return json(['code'=>1,'data'=>$row]);
+        return json([
+            'code'  => 1,
+            'data'  => $paged_grouped,
+            'total' => $total,
+            'page'  => $page,
+            'limit' => $limit
+        ]);
     }
 
+
+//    public function product()
+//    {
+//
+//        $db3 = Db::connect(config('database.db3'));
+//        $query = $db3->query("SELECT * FROM `工单_基本资料` WHERE `Gd_客户代号` = ?", ['J0031']);
+//
+//        echo "<pre>";
+//        print_r($query);
+//        echo "</pre>";
+//        die;
+//
+//        $params = input('');
+//        $page = max(1, (int)$params['page']);
+//        $limit = max(1, (int)$params['limit']);
+//        $offset = ($page - 1) * $limit;
+//
+//        $mongo = \think\Db::connect('mongodb');
+//        $where = [];
+//        if (!empty($params['search'])) {
+//            // 使用正则表达式来实现模糊匹配,'i' 表示忽略大小写
+//            $where['jjcp_cpdh|成品名称|jjcp_gdbh|订单编号'] = new \MongoDB\BSON\Regex($params['search'], 'i');
+//        }
+////        if (!empty($where)) {
+////            $mongo_products = $mongo->name('finished_products')
+////                ->where($where)
+////                ->limit($offset, $limit)
+////                ->order('UniqId','desc')
+////                ->where('jjcp_smb','末 板')
+////                ->select();
+////        } else {
+////            // 如果没有条件,仍然执行查询,避免错误
+////            $mongo_products = $mongo->name('finished_products')
+////                ->limit(1, 10)
+////                ->order('UniqId','desc')
+////                ->where('jjcp_smb','末 板')
+////                ->select();
+////        }
+//
+//
+//
+//
+//        $mongo_products = $mongo->name('finished_products')
+//            ->where($where)
+//            ->limit($offset, $limit)
+//            ->order('UniqId','desc')
+//            ->where('jjcp_smb','末 板')
+//            ->select();
+//        echo "<pre>";
+//        print_r($mongo_products);
+//        echo "<pre>";die;
+//
+//        //计算【订单编号】【jjcp_gdbh】相同的数据进行统计汇总累加入库数量【jjcp_sl】
+//        $grouped_products = [];
+//        foreach ($mongo_products as $item) {
+//            $group_key = $item['订单编号'] . '_' . $item['jjcp_gdbh'];
+//            if (!isset($grouped_products[$group_key])) {
+//                $grouped_products[$group_key] = [
+//                    'order_ddbh' => $item['订单编号'],
+//                    'gdbh' => $item['jjcp_gdbh'],
+//                    'cpmc' => $item['成品名称'],
+////                    'cpdh' => $item['jjcp_cpdh'],
+//                    'ruku_sl' => 0,            // 入库数量
+//                    'remain_stock' => 0,       // 剩余库存
+//                    'sl' => 0
+//                ];
+//            }
+//            $grouped_products[$group_key]['ruku_sl'] += (int)$item['jjcp_sl'];
+//        }
+//        // 查询库存表并计算
+//        foreach ($grouped_products as $group_key => &$prod) {
+//            $where = [
+//                'order_ddbh' => $prod['order_ddbh'],
+//                'gdbh' => $prod['gdbh'],
+//                'cpmc' => $prod['cpmc'],
+//            ];
+//            $inventory = $mongo->name('inventory_summary')->where($where)->find();
+//            $prod['remaining_quantity'] = $inventory ? (int)$inventory['remaining_quantity'] : 0;
+//            $prod['sl'] = $prod['remaining_quantity'] > 0 ? $prod['remaining_quantity'] : $prod['ruku_sl'];
+//        }
+//        unset($prod);
+//        $matched_products = array_values($grouped_products);
+//
+//        // 获取总数
+//        $total = $mongo->name('finished_products')
+//            ->where($where)
+//            ->count();
+//
+//        return json([
+//            'code'  => 1,
+//            'data'  => $matched_products,
+//            'total' => $total,
+//            'page'  => $page,
+//            'limit' => $limit
+//        ]);
+//    }
+
+
+//    public function product(){
+//        $QcodeProduct = new QcodeProduct();
+//        $ResetFlow = new ResetFlow();
+//        $userinfo = Session::get('admin');
+//        if ($this->request->isAjax() === false){
+//            $this->error('请求错误');
+//        }
+//        $product_code = input('product_code');
+//
+//        if (empty($product_code)){
+//            $this->error('参数错误');
+//        }
+//        $product = $QcodeProduct->where('product_code',$product_code)->find();
+//        if (empty($product)){
+//            $this->error('未找到该产品信息');
+//        }
+//
+//        $flow = $ResetFlow->name($userinfo['company'].'_'."reset_flow")->where('product_id',substr(json_encode($product['_id']),9,-2))->find();
+//        $row = [
+//            'temple' => $product['temple'],
+//            'flow' => isset($flow['l_flow'])?(int)$flow['l_flow']+1:'',
+//            'bach' => isset($flow['bach_num'])?(int)$flow['bach_num']+1:'',
+//        ];
+//        if (!empty($flow)){
+//            $row['flow'] = $flow['l_flow']+1;
+//            $row['bach'] = $flow['bach_num']+1;
+//        }
+//
+//        return json(['code'=>1,'data'=>$row]);
+//    }
+
     /**
      * 增加新批次
      */
@@ -170,6 +334,7 @@ class QcodeAdd extends Backend
         $liushui = new QcodeLiushui();
         $resetFlow = new ResetFlow();
         $QcodeCompany = new QcodeCompany();
+
         if ($this->request->isAjax() === false){
             $this->error('请求错误');
         }
@@ -178,12 +343,71 @@ class QcodeAdd extends Backend
             $this->error('参数错误');
         }
         $rows = json_decode($rows);
+
         $data = [];
         foreach ($rows as $value){
            foreach ($value as $k=>$v){
                $data[$k] = $v;
            }
         }
+//        echo "接口获取";
+//        echo "<pre>";
+//        print_r($data);
+//        echo "<pre>";die;
+
+
+
+        $mongo = \think\Db::connect('mongodb');
+        // 构建查询条件
+        $where = [
+            'gdbh' => $data['gdbh'],
+            'order_ddbh' => $data['order_ddbh'],
+//            'cpdh' => $data['cpdh'],
+            'cpmc' => $data['cpmc'],
+        ];
+        //插入字段
+        $insertData = [
+            'gdbh'             => $data['gdbh'],
+            'order_ddbh'             => $data['order_ddbh'],
+//            'cpdh'             => $data['cpdh'],
+            'cpmc'             => $data['cpmc'],
+            'total_ru_quantity'   => $data['sl'],//入库数量
+            'total_chu_quantity' => $data['number'],//出库数量
+            'remaining_quantity'  => $data['sl'] - $data['number'],//剩余结存数量
+            'created_at'       => date('Y-m-d H:i:s'),
+            'updated_at'       => '',
+            'mod_rq'           => '',
+            'company'          => '',
+        ];
+
+        // 查询是否已存在记录
+        $list = $mongo->name('inventory_summary')->where($where)->find();
+        if ($list) {
+            // 如果数据存在,更新库存汇总记录
+            $ru  = $list['total_ru_quantity'] + $data['sl'];//累计入库数量
+            $chu = $list['total_chu_quantity'] + $data['sl'];//累计出库数量
+            $jiecun  = $data['sl'] - $data['number'];//剩余结存数量
+            $updateResult = $mongo->name('inventory_summary')
+                ->where($where)
+                ->update([
+                    'total_ru_quantity'   => $ru,
+                    'total_chu_quantity' => $chu,
+                    'remaining_quantity'  => $jiecun,
+                    'updated_at'       => date('Y-m-d H:i:s'),
+                ]);
+        } else {
+            // 数据不存在则插入新记录
+            $mongo->name('inventory_summary')->insert($insertData);
+        }
+        //记录库存明细
+        $mongo->name('inventory_records')->insert($insertData);
+
+//        // 调试输出(可删)
+//        echo "<pre>"; print_r($list); echo "</pre>";
+//        die;
+
+
+
         if ($data['danwei'] == 1){
             $num = $data['number'];
             $tray_num = $data['tray_num'];
@@ -200,34 +424,34 @@ class QcodeAdd extends Backend
             $box_number = 1;
             $tray_num1 = 1;
         }
-        $userinfo = Session::get('admin');
-        $productList = $product->where('product_code',$data['product_code'])->find();
+
+        $userinfo = Session::get('admin');//获取用户信息
         $arr = [
-            'product_id' => $productList['_id'],
+            'batch' => $data['batch'],
             'create_time' => time(),
             'delect_time' => '',
             'sync_flag' => 0,
-            ];
+        ];
         $productres = $QcodeCompany->save($arr);
         if ($productres === 0){
             $this->error('添加失败');
         }
 
-        if (empty($productList)){
-            $this->error('未找到该产品数据');
-        }
 
         $batchList = [
-            'supplier_name' => $data['company_name'],
-            'supplier_code' => $userinfo['printer_code'],
+            'userid' => $userinfo['id'],
             'supplier_id' => $userinfo['id'],
-            'matter_name' => $productList['product_name'],
-            'matter_no' => $productList['product_code'],//生产批次号
+            'supplier_code' => $userinfo['printer_code'],
+
+            'supplier_name' => $data['company_name'],//公司名称
+            'matter_name' => $data['cpmc'],//产品名称
+            'matter_no' => $data['batch'],//生产批次号
             'order_ddbh' => $data['order_ddbh'],//销售订单号
-            'matter_id' => substr(json_encode($productList['_id']),9,-2),
-            'matter_type' => $productList['temple'],
-            'manufacture_date' => (int)date('ymd',strtotime($data['manufacture_date'])),
-            'print_date' => (int)date('ymd',strtotime($data['print_date'])),
+            'matter_id' => $data['batch'],
+//            'matter_type' => $data['temple'],
+            'matter_type' => '01',
+            'manufacture_date' => (int)date('ymd',strtotime($data['manufacture_date'])),//生产日期
+            'print_date' => (int)date('ymd',strtotime($data['print_date'])),//打码日期
 
             'danwei' => $data['danwei'],//单位
             'num' => $num,//总数量(张/个)
@@ -242,36 +466,42 @@ class QcodeAdd extends Backend
 
             'l_reservation' => '',
             'l_flow' => $data['big_liushui'],
-            'l_weight' => $data['big_weight'],
+            'l_weight' => $data['big_weight'],//大件重量
             's_flow' => $data['small_start_liushui'],
-            's_weight' => $data['small_weight'],
+            's_weight' => $data['small_weight'],//小件重量
             's_reservation' => '',
             'bach_status' => 0,
-            'userid' => $userinfo['id'],
             'bach_num' => $data['batch'],
             'large_endnum' => $data['big_liushui'] + $data['box_num'] -1,
             'create_time' => time(),//新增时间
         ];
-
         $res = $bach->save($batchList);
         if ($res === 0){
             $this->error('添加失败');
         }
+
         $flow = [
             'l_flow' => (int)$batchList['large_endnum'],
             'bach_num' => $batchList['bach_num'],
         ];
+
         if ($resetFlow->name($userinfo['company'].'_'."reset_flow")->where('product_id',$batchList['matter_id'])->find()){
             $resetFlow->name($userinfo['company'].'_'."reset_flow")->where('product_id',$batchList['matter_id'])->update($flow);
         }else{
             $flow['product_id'] = $batchList['matter_id'];
             $resetFlow->save($flow);
         }
+
         $last_id = $bach->getLastInsID();
+
         if ($last_id){
             //插入大小二维码数据
             //二维码数据不变区域
 //            echo "<pre>";
+//            print_r($batchList);
+//            echo "<pre>";
+//            die;
+//            echo "<pre>";
 //            print_r($batchList['matter_type']);
 //            echo "<pre>";
 //            echo "<pre>";
@@ -288,7 +518,7 @@ class QcodeAdd extends Backend
 //            echo "<pre>";
 //            echo "<pre>";
 //            print_r($batchList['print_date']);
-//            echo "<pre>";
+//            echo "<pre>";die;
             $fixed_code = '';
             $fixed_code.=$this->intTochar($batchList['matter_type'],2);//2位  辅料种类编码
 //            $fixed_code .= substr($this->intTochar($batchList['supplier_code'], 12), 1);//12位  供应商编码 // 去掉第一位0
@@ -298,12 +528,6 @@ class QcodeAdd extends Backend
             $fixed_code.=$batchList['manufacture_date'];//6位  生产日期
             $print_code=$batchList['print_date'];//6位  打码日期
 
-//            echo "<pre>";
-//            print_r($fixed_code);
-//            echo "<pre>";
-//            echo "<pre>";
-//            print_r($print_code);
-//            echo "<pre>";
             $small_liushui = [
                 'onlycode' => 'AB92'.$fixed_code.$print_code,
                 'last_num' => 0,

+ 1 - 0
application/admin/controller/QcodeBach.php

@@ -48,6 +48,7 @@ class QcodeBach extends Backend
         $this->relationSearch = false;
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
+        
         return $this->view->fetch();
     }
 

+ 276 - 91
application/admin/controller/QcodeProduct.php

@@ -5,10 +5,11 @@ namespace app\admin\controller;
 use app\admin\model\QcodeClassification;
 use app\admin\model\QcodeCompany;
 use app\common\controller\Backend;
+use think\Db;
 use \think\Session;
 
 /**
- * 
+ *
  *
  * @icon fa fa-circle-o
  */
@@ -40,54 +41,106 @@ class QcodeProduct extends Backend
      */
 
 
-    /**
-     * 查看
-     */
     public function index()
     {
-        //当前是否为关联查询
-        $this->relationSearch = false;
-        //设置过滤方法
+        // 设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
-        if ($this->request->isAjax()) {
-            //如果发送的来源是Selectpage,则转发到Selectpage
-            if ($this->request->request('keyField')) {
-                return $this->selectpage();
-            }
-            $where = [
-                'delete_time'=> ''
-            ];
-
-            $req = input();
-            $req['sort'] == 'id' ? $sort = '_id' : $sort = $req['sort'];
-            $order = $req['order'];
-            $offset = $req['offset'];
-            $limit = $req['limit'];
-
-            // 构造模糊查询条件
-//            $regex = new MongoDB\BSON\Regex('.*abc.*', 'i');
-//            $filter = ['field' => $regex];
 
-            $filter = json_decode($req['filter'], true);
-            foreach ($filter as $k => $v){
-                $where[$k] = new \MongoDB\BSON\Regex($v);
+        if ($this->request->isAjax()) {
+            $db3 = \think\Db::connect(config('database.db3'));
+
+            // 获取请求参数
+            $req = $this->request->param();
+            $sort = isset($req['sort']) ? $req['sort'] : 'Uniqid';
+            $order = isset($req['order']) ? $req['order'] : 'desc';
+            $offset = isset($req['offset']) ? $req['offset'] : 0;
+            $limit = isset($req['limit']) ? $req['limit'] : 10;
+            $search = isset($req['search']) ? $req['search'] : '';
+
+            // 先获取基础数据(不包含Gd_cpdh=成品代号的条件)
+            $query = $db3->name('工单_基本资料')
+                ->field('Gd_gdbh, Gd_cpdh, Gd_cpmc, 成品代号, Uniqid')
+                ->where('Gd_cpdh', '<>', '')
+                ->where('Gd_cpmc', '<>', '');
+
+            // 搜索条件
+            if ($search) {
+                $query->where(function($q) use ($search) {
+                    $q->where('Gd_gdbh', 'like', "%{$search}%")
+                        ->whereOr('Gd_cpdh', 'like', "%{$search}%")
+                        ->whereOr('Gd_cpmc', 'like', "%{$search}%");
+                });
             }
 
-            $list = $this->model->where($where)
-                ->order($sort,$order)
-                ->limit($limit)
-                ->skip($offset)
+            // 获取所有符合基础条件的数据
+            $allData = $query->order($sort, $order)
                 ->select();
-            foreach ($list as $k=>$v) {
-                $oid = $v['_id']->jsonSerialize();
-                $list[$k]['id'] = $oid['$oid'];
+
+            // 用PHP循环过滤出Gd_cpdh等于成品代号的记录
+            $filteredData = [];
+            foreach ($allData as $item) {
+                if ($item['Gd_cpdh'] == $item['成品代号']) {
+                    $filteredData[] = $item;
+                }
             }
 
-            $result = array("total" => count($list), "rows" => $list);
+            // 手动分页处理
+            $total = count($filteredData);
+            $rows = array_slice($filteredData, $offset, $limit);
 
-            return json($result);
+            return json([
+                'total' => $total,
+                'rows'  => $rows
+            ]);
         }
+
         return $this->view->fetch();
+
+        //当前是否为关联查询
+//        $this->relationSearch = false;
+        //设置过滤方法
+//        $this->request->filter(['strip_tags', 'trim']);
+//        if ($this->request->isAjax()) {
+
+//            //如果发送的来源是Selectpage,则转发到Selectpage
+//            if ($this->request->request('keyField')) {
+//                return $this->selectpage();
+//            }
+//            $where = [
+//                'delete_time'=> ''
+//            ];
+//
+//            $req = input();
+//            $req['sort'] == 'id' ? $sort = '_id' : $sort = $req['sort'];
+//            $order = $req['order'];
+//            $offset = $req['offset'];
+//            $limit = $req['limit'];
+//
+//            // 构造模糊查询条件
+////            $regex = new MongoDB\BSON\Regex('.*abc.*', 'i');
+////            $filter = ['field' => $regex];
+//
+//            $filter = json_decode($req['filter'], true);
+//            foreach ($filter as $k => $v){
+//                $where[$k] = new \MongoDB\BSON\Regex($v);
+//            }
+//
+//
+//            $list = $this->model->where($where)
+//                ->order($sort,$order)
+//                ->limit($limit)
+//                ->skip($offset)
+//                ->select();
+//            foreach ($list as $k=>$v) {
+//                $oid = $v['_id']->jsonSerialize();
+//                $list[$k]['id'] = $oid['$oid'];
+//            }
+//
+//            $result = array("total" => count($list), "rows" => $list);
+//
+//            return json($result);
+//        }
+//        return $this->view->fetch();
     }
 
     /**
@@ -95,11 +148,15 @@ class QcodeProduct extends Backend
      */
     public function products()
     {
+
         //当前是否为关联查询
         $this->relationSearch = false;
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
         if ($this->request->isAjax()) {
+
+
+
             //如果发送的来源是Selectpage,则转发到Selectpage
             if ($this->request->request('keyField')) {
                 return $this->selectpage();
@@ -147,63 +204,146 @@ class QcodeProduct extends Backend
      */
     public function product()
     {
-        //当前是否为关联查询
-        $this->relationSearch = false;
-        //设置过滤方法
+        // 设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
+
         if ($this->request->isAjax()) {
-            //如果发送的来源是Selectpage,则转发到Selectpage
-            if ($this->request->request('keyField')) {
-                return $this->selectpage();
-            }
+            // 获取用户信息和请求参数
             $userInfo = Session::get('admin');
             $company_id = (int)$userInfo['company'];
-            $where = [
-//                'company_id'=>(int)$userInfo['company'],
-                'delete_time'=> ''
-            ];
-
-            $req = input();
-            $req['sort'] == 'id' ? $sort = '_id' : $sort = $req['sort'];
-            $order = $req['order'];
-            $offset = $req['offset'];
-            $limit = $req['limit'];
-
-            // 构造模糊查询条件
-//            $regex = new MongoDB\BSON\Regex('.*abc.*', 'i');
-//            $filter = ['field' => $regex];
-
+            $req = $this->request->param();
+
+            // 处理请求参数
+            $sort = $req['sort'] ?? 'id';
+            $order = $req['order'] ?? 'desc';
+            $offset = $req['offset'] ?? 0;
+            $limit = $req['limit'] ?? 10;
+            $search = $req['search'] ?? '';
+//            $filter = json_decode($req['filter'], true);
             $filter = json_decode($req['filter'], true);
+
+            $where = [];
             foreach ($filter as $k => $v){
-                $where[$k] = new \MongoDB\BSON\Regex($v);
+                $where[$k] = $v;
             }
 
+            // 1. 从qcode_company表获取所有Uniqid
             $db = new QcodeCompany();
-            $rows = $db->name($company_id.'_'."qcode_company")
-                ->where('delete_time','')
-                ->column('product_id');
-            $rows = array_values($rows);
+            $tableName = $company_id.'_qcode_company';
+            $records = $db->name($tableName)
+                ->where(['delete_time' => ''])
+                ->select();
 
-            $total = $this->model->where($where)->where('_id','in',$rows)->count();
+            // 提取有效的Uniqid值
+            $uniqIds = [];
+            foreach ($records as $record) {
+                if (isset($record['Uniqid'])) {
+                    $uniqIds[] = $record['Uniqid'];
+                }
+            }
 
-            $list = $this->model->where($where)
-                ->where('_id','in',$rows)
-                ->order($sort,$order)
-                ->limit($limit)
-                ->skip($offset)
-                ->select();
-            foreach ($list as $k=>$v) {
-                $oid = $v['_id']->jsonSerialize();
-                $list[$k]['id'] = $oid['$oid'];
+            // 去重并过滤空值
+            $uniqIds = array_unique(array_filter($uniqIds));
+
+            // 如果没有有效的Uniqid,直接返回空结果
+            if (empty($uniqIds)) {
+                return json([
+                    'total' => 0,
+                    'rows' => []
+                ]);
             }
 
-            $result = array("total" => $total, "rows" => $list);
+            // 2. 连接工单基本资料数据库
+            $db3 = \think\Db::connect(config('database.db3'));
 
-            return json($result);
+            // 构建并执行查询(合并版本)
+            $result = $db3->name('工单_基本资料')
+                ->field('Gd_gdbh, Gd_cpdh, Gd_cpmc, 成品代号, Uniqid')
+                ->whereIn('Uniqid', $uniqIds)
+                ->where($where)
+//                ->where('Gd_gdbh', 'like', "%{$search}%")
+                ->limit($offset, $limit)
+                ->select();
+
+
+            // 获取总数(需要单独查询)
+            $total = $db3->name('工单_基本资料')
+                ->field('Gd_gdbh, Gd_cpdh, Gd_cpmc, 成品代号, Uniqid')
+                ->whereIn('Uniqid', $uniqIds)
+                ->where('Gd_gdbh', 'like', "%{$search}%")
+                ->limit($offset, $limit)
+                ->count();
+
+            return json([
+                'total' => $total,
+                'rows' => $result
+            ]);
         }
+
         return $this->view->fetch();
     }
 
+
+//    public function product()
+//    {
+//        //当前是否为关联查询
+//        $this->relationSearch = false;
+//        //设置过滤方法
+//        $this->request->filter(['strip_tags', 'trim']);
+//        if ($this->request->isAjax()) {
+//            //如果发送的来源是Selectpage,则转发到Selectpage
+//            if ($this->request->request('keyField')) {
+//                return $this->selectpage();
+//            }
+//            $userInfo = Session::get('admin');
+//            $company_id = (int)$userInfo['company'];
+//            $where = [
+////                'company_id'=>(int)$userInfo['company'],
+//                'delete_time'=> ''
+//            ];
+//
+//            $req = input();
+//            $req['sort'] == 'id' ? $sort = '_id' : $sort = $req['sort'];
+//            $order = $req['order'];
+//            $offset = $req['offset'];
+//            $limit = $req['limit'];
+//
+//            // 构造模糊查询条件
+////            $regex = new MongoDB\BSON\Regex('.*abc.*', 'i');
+////            $filter = ['field' => $regex];
+//
+//            $filter = json_decode($req['filter'], true);
+//            foreach ($filter as $k => $v){
+//                $where[$k] = new \MongoDB\BSON\Regex($v);
+//            }
+//
+//            $db = new QcodeCompany();
+//            $rows = $db->name($company_id.'_'."qcode_company")
+//                ->where('delete_time','')
+//                ->column('product_id');
+//
+//            $rows = array_values($rows);
+//
+//            $total = $this->model->where($where)->where('_id','in',$rows)->count();
+//
+//            $list = $this->model->where($where)
+//                ->where('_id','in',$rows)
+//                ->order($sort,$order)
+//                ->limit($limit)
+//                ->skip($offset)
+//                ->select();
+//            foreach ($list as $k=>$v) {
+//                $oid = $v['_id']->jsonSerialize();
+//                $list[$k]['id'] = $oid['$oid'];
+//            }
+//
+//            $result = array("total" => $total, "rows" => $list);
+//
+//            return json($result);
+//        }
+//        return $this->view->fetch();
+//    }
+
     /**
      * 新增产品
      */
@@ -356,27 +496,72 @@ class QcodeProduct extends Backend
      */
     public function bind($ids = NULL)
     {
+        // 连接数据库并查询工单基本资料
+        $db3 = \think\Db::connect(config('database.db3'));
+        $results = $db3->name('工单_基本资料')
+            ->whereIn('Uniqid', $ids)
+            ->field('Gd_gdbh, Gd_cpdh, Gd_cpmc, 成品代号, Uniqid')
+            ->select();
+
+        // 获取用户信息
         $userInfo = Session::get('admin');
         $company_id = (int)$userInfo['company'];
         $db = new QcodeCompany();
-        //查询是否已经添加
-        $row = $db->name($company_id.'_'."qcode_company")
-            ->where(['delete_time'=>'','product_id'=>$ids])
-            ->find();
-        if($row) $this->success('已添加');
+        $tableName = $company_id.'_'."qcode_company";
+
+        // 循环处理每个查询结果
+        foreach ($results as $item) {
+            // 查询是否已经添加
+            $row = $db->name($tableName)
+                ->where([
+                    'delete_time' => '',
+                    'Uniqid' => $item['Uniqid']  // 将product_id改为Uniqid
+                ])
+                ->find();
+
+            if ($row) {
+                continue; // 如果已存在则跳过
+            }
 
-        $data = [
-            'product_id'=>$ids,
-            'create_time'=>time(),
-        ];
+            // 准备插入数据
+            $data = [
+                'Uniqid' => $item['Uniqid'],      // 改为Uniqid
+                'Gd_gdbh' => $item['Gd_gdbh'],    // 添加工单编号
+                'Gd_cpdh' => $item['Gd_cpdh'],    // 添加产品代号
+                'Gd_cpmc' => $item['Gd_cpmc'],    // 添加产品名称
+                'delete_time' => '',
+                'create_time' => time(),
+            ];
 
-        //插入qcode_company数据
-        $bool = $db->save($data);
-        if($bool){
-            $this->success('添加成功');
-        }else{
-            $this->error('添加失败');
+            // 插入数据
+            $bool = $db->name($tableName)->insert($data);
+            if (!$bool) {
+                $this->error('添加失败: Uniqid='.$item['Uniqid']);
+            }
         }
+
+        $this->success('添加完成');
+//        $userInfo = Session::get('admin');
+//        $company_id = (int)$userInfo['company'];
+//        $db = new QcodeCompany();
+//        //查询是否已经添加
+//        $row = $db->name($company_id.'_'."qcode_company")
+//            ->where(['delete_time'=>'','product_id'=>$ids])
+//            ->find();
+//        if($row) $this->success('已添加');
+//
+//        $data = [
+//            'product_id'=>$ids,
+//            'create_time'=>time(),
+//        ];
+//
+//        //插入qcode_company数据
+//        $bool = $db->save($data);
+//        if($bool){
+//            $this->success('添加成功');
+//        }else{
+//            $this->error('添加失败');
+//        }
     }
 
     /**

+ 245 - 11
application/admin/controller/user/User.php

@@ -4,6 +4,7 @@ namespace app\admin\controller\user;
 
 use app\common\controller\Backend;
 use app\common\library\Auth;
+use think\Db;
 
 /**
  * 会员管理
@@ -23,8 +24,9 @@ class User extends Backend
 
     public function _initialize()
     {
+
         parent::_initialize();
-        $this->model = model('User');
+        $this->model = new \app\admin\model\User;
     }
 
     /**
@@ -32,6 +34,8 @@ class User extends Backend
      */
     public function index()
     {
+        $mongo = \think\Db::connect('mongodb');
+        $this->model = $mongo->name('inventory_summary');
         //设置过滤方法
         $this->request->filter(['strip_tags', 'trim']);
         if ($this->request->isAjax()) {
@@ -39,22 +43,252 @@ class User extends Backend
             if ($this->request->request('keyField')) {
                 return $this->selectpage();
             }
-            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
-            $list = $this->model
-                ->with('group')
-                ->where($where)
-                ->order($sort, $order)
-                ->paginate($limit);
-            foreach ($list as $k => $v) {
-                $v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
-                $v->hidden(['password', 'salt']);
+            //list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+
+            $this->model = $this->model;
+                //->where($where);
+            $yearMonth = $this->request->param("yearMonth");
+
+            if(!empty($yearMonth)){
+                // 获取月份的第一天 00:00:00
+                $startTime = $yearMonth . '-01 00:00:00';
+
+                // 获取下个月的第一天,然后减去1秒,得到本月最后一秒
+                $endTime = date('Y-m-t 23:59:59', strtotime($yearMonth . '-01'));
+                $this->model =  $this->model->whereBetween('created_at',[$startTime,$endTime] );
+            }
+            $test2 = $this->request->param("test2");
+            if(!empty($test2)){
+                $this->model =  $this->model->where('cpmc',$test2 );
+            }
+            $test3 = $this->request->param("test3");
+            if(!empty($test2)){
+                $this->model =  $this->model->where('order_ddbh',$test3 );
             }
-            $result = array("total" => $list->total(), "rows" => $list->items());
+            if(empty($yearMonth)){
+                $list = [];
+                $result = array("total" => count($list), "rows" => $list);
+
+                return json($result);
+            }
+            $list = $this->model
+                ->select();
+
+            $result = array("total" => count($list), "rows" => $list);
 
             return json($result);
         }
+        $tree = $this->getTreeDataOptimized();
+        $this->assign("tree",$tree);
         return $this->view->fetch();
     }
+    /**
+     * 方法二:分级查询(推荐)
+     */
+    public function getTreeDataOptimized()
+    {
+        $mongo = \think\Db::connect('mongodb');
+        $this->model = $mongo->name('inventory_summary');
+        // 1. 查询所有一级分类
+        $level1 = $this->model
+            ->field('created_at')
+            ->order('created_at DESC')
+            ->select();
+        $tree = [];
+        foreach ($level1 as $k =>$v){
+            $yearMonth =  substr($v['created_at'], 0, 7); // 2025-06-20 -> 2025-06
+            $level1_news[$yearMonth]=$v;
+        }
+        $level1 = $level1_news;
+        unset($level1_news);
+        foreach ($level1 as $item1) {
+            $yearMonth =  substr($item1['created_at'], 0, 7); // 2025-06-20 -> 2025-06
+            $node1 = [
+                'id' => $yearMonth,
+                'name' => $yearMonth,
+                'level' => 1,
+                'children' => []
+            ];
+            // 获取月份的第一天 00:00:00
+            $startTime = $yearMonth . '-01 00:00:00';
+
+            // 获取下个月的第一天,然后减去1秒,得到本月最后一秒
+            $endTime = date('Y-m-t 23:59:59', strtotime($yearMonth . '-01'));
+            // 2. 查询当前一级下的所有二级分类
+            $level2 = $this->model
+                ->field('cpmc')
+                ->whereBetween('created_at',[$startTime,$endTime] )
+                ->where('cpmc', '<>', '')
+                ->order('cpmc asc')
+                ->select();
+            foreach ($level2 as $k=>$v){
+                $level2_new[$v["cpmc"]] = $v;
+            }
+            $level2 = $level2_new;
+            unset($level2_new);
+            foreach ($level2 as $item2) {
+                $node2 = [
+                    'id' => $yearMonth . '_' . $item2['cpmc'],
+                    'name' => $item2['cpmc'],
+                    'level' => 2,
+                    'parent' => $yearMonth,
+                    'children' => []
+                ];
+
+                // 3. 查询当前二级下的所有三级分类
+                $level3 = $this->model
+//                    ->field('*')
+                    ->whereBetween('created_at',[$startTime,$endTime] )
+                    ->where('cpmc', $item2['cpmc'])
+                    ->where('order_ddbh', '<>', '')
+                    ->order('order_ddbh asc')
+                    ->select();
+
+                foreach ($level3 as $k=>$v){
+                    $level3_news[$v["order_ddbh"]] = $v;
+                }
+
+                $level3 = $level3_news;
+
+                unset($level3_news);
+                foreach ($level3 as $item3) {
+                    $node2['children'][] = [
+                        'id' => $yearMonth . '_' . $item2['cpmc'] . '_' . $item3['order_ddbh'],
+                        'name' => $item3['order_ddbh'],
+                        'level' => 3,
+                        'parent' => $yearMonth . '_' . $item2['cpmc']
+                    ];
+                }
+
+                $node1['children'][] = $node2;
+            }
+
+            $tree[$yearMonth] = $node1;
+        }
+
+        return $tree;
+    }
+
+
+    public function ruku()
+    {
+        $order_ddbh = $this->request->get('order_ddbh', '');
+        $gdbh = $this->request->get('gdbh', '');
+        $cpmc = $this->request->get('cpmc', '');
+
+        $limit = $this->request->get('limit', 20);
+        $offset = $this->request->get('offset', 0);
+
+        $where = [];
+        if ($order_ddbh) $where['订单编号'] = $order_ddbh;
+        if ($gdbh) $where['jjcp_gdbh'] = $gdbh;
+        if ($cpmc) $where['成品名称'] = $cpmc;
+
+        // 获取工单编号列表
+        $db3 = Db::connect(config('database.db3'));
+        $gdRows = $db3->query("SELECT DISTINCT `Gd_gdbh`, `Gd_客户代号`, `Gd_cpdh`  FROM `工单_基本资料` WHERE `Gd_客户代号` = ? AND `Gd_gdbh` = ?", ['J0031', $gdbh]);
+        $Gd_gdbhList = array_column($gdRows, 'Gd_gdbh');
+        $gdbhList = array_column($gdRows, 'Gd_cpdh');
+        if (empty($gdbhList)) {
+            $this->assign([
+                'list' => '',
+                'total' =>'',
+                'total_sl' => '',
+            ]);
+        }
+
+        // Mongo 查询
+        $mongo = \think\Db::connect('mongodb');
+        $where = ['jjcp_cpdh' => ['in', $gdbhList],'jjcp_gdbh' => ['in', $Gd_gdbhList], 'jjcp_smb' => '末 板'];
+        $total = $mongo->name('finished_products')->where($where)->count();
+
+
+        // 查询原始数据
+        $rawList = $mongo->name('finished_products')
+            ->field('订单编号, 成品名称, jjcp_gdbh, jjcp_sl, jjcp_sj')
+            ->where($where)
+            ->order('jjcp_sj','desc')
+            ->limit($offset, $limit)
+            ->select();
+
+        // 转换字段名并格式化时间
+        $list = [];
+        $total_sl = 0; // 初始化合计值
+        foreach ($rawList as $item) {
+            // 处理时间格式转换
+            $originalDate = $item['jjcp_sj'] ?? null;
+            $formattedDate = null;
+
+            if ($originalDate) {
+                try {
+                    $date = \DateTime::createFromFormat('d/m/Y H:i:s', $originalDate);
+                    if ($date) {
+                        $formattedDate = $date->format('Y-m-d H:i:s');
+                    } else {
+                        $date = new \DateTime($originalDate);
+                        $formattedDate = $date->format('Y-m-d H:i:s');
+                    }
+                } catch (Exception $e) {
+                    $formattedDate = $originalDate;
+                }
+            }
+
+            $sl = $item['jjcp_sl'] ?? 0;
+            $total_sl += (int)$sl; // 累加数量
+
+            $list[] = [
+                'order_ddbh' => $item['订单编号'] ?? null,
+                'cpmc' => $item['成品名称'] ?? null,
+                'gdbh' => $item['jjcp_gdbh'] ?? null,
+                'sl' => $sl,
+                'sj' => $formattedDate
+            ];
+        }
+        $this->assign([
+            'list' => $list,
+            'total' => $total,
+            'total_sl' => $total_sl
+        ]);
+        return $this->fetch();
+    }
+
+    public function chuku()
+    {
+        $order_ddbh = $this->request->get('order_ddbh', '');
+        $gdbh = $this->request->get('gdbh', '');
+        $cpmc = $this->request->get('cpmc', '');
+
+        $limit = $this->request->get('limit', 20);
+        $offset = $this->request->get('offset', 0);
+
+        $where = [];
+        if ($order_ddbh) $where['order_ddbh'] = $order_ddbh;
+        if ($gdbh) $where['gdbh'] = $gdbh;
+        if ($cpmc) $where['cpmc'] = $cpmc;
+
+        $mongo = \think\Db::connect('mongodb');
+
+        $total = $mongo->name('inventory_records')->where($where)->count();
+        $list = $mongo->name('inventory_records')
+            ->where($where)
+            ->limit($offset, $limit)
+            ->select();
+
+        // 计算出库数量合计
+        $total_sl = 0;
+        foreach ($list as &$item) {
+            $sl = $item['total_chu_quantity'] ?? 0;
+            $total_sl += (int)$sl;
+            $item['total_chu_quantity'] = $sl; // 确保sl字段存在
+        }
+
+        $this->assign([
+            'list' => $list,
+            'total' => $total,
+            'total_sl' => $total_sl // 传递合计值到视图
+        ]);
+        return $this->fetch();
+    }
 
     /**
      * 添加

+ 19 - 0
application/admin/lang/zh-cn/area.php

@@ -0,0 +1,19 @@
+<?php
+
+return [
+    'Id'        => 'ID',
+    'Pid'       => '父id',
+    'Shortname' => '简称',
+    'Name'      => '名称',
+    'Mergename' => '全称',
+    'Level'     => '层级',
+    'Level 1'   => '省',
+    'Level 2'   => '市',
+    'Level 3'   => '区/县',
+    'Pinyin'    => '拼音',
+    'Code'      => '长途区号',
+    'Zip'       => '邮编',
+    'First'     => '首字母',
+    'Lng'       => '经度',
+    'Lat'       => '纬度'
+];

+ 3 - 11
application/admin/lang/zh-cn/finishedproduct.php

@@ -1,15 +1,7 @@
 <?php
 
 return [
-    'Id'          => 'ID',
-    'Oldversion'  => '旧版本号',
-    'Newversion'  => '新版本号',
-    'Packagesize' => '包大小',
-    'Content'     => '升级内容',
-    'Downloadurl' => '下载地址',
-    'Enforce'     => '强制更新',
-    'Createtime'  => '创建时间',
-    'Updatetime'  => '更新时间',
-    'Weigh'       => '权重',
-    'Status'      => '状态'
+    '订单编号'     => '订单编号',
+    'jjcp_gdbh'  => 'jjcp_gdbh',
+    'jjcp_cpdh'  => 'jjcp_cpdh'
 ];

+ 0 - 15
application/admin/lang/zh-cn/inventorydetails.php

@@ -1,15 +0,0 @@
-<?php
-
-return [
-    'Id'          => 'ID',
-    'Oldversion'  => '旧版本号',
-    'Newversion'  => '新版本号',
-    'Packagesize' => '包大小',
-    'Content'     => '升级内容',
-    'Downloadurl' => '下载地址',
-    'Enforce'     => '强制更新',
-    'Createtime'  => '创建时间',
-    'Updatetime'  => '更新时间',
-    'Weigh'       => '权重',
-    'Status'      => '状态'
-];

+ 1 - 0
application/admin/lang/zh-cn/qcode_bach.php

@@ -1,6 +1,7 @@
 <?php
 
 return [
+    'Order_ddbh'         => '销售订单号',
     'Matter_no'         => '辅料编号',
     'Matter_name'       => '辅料名称',
     'Bach_num'          => '批次号',

+ 49 - 0
application/admin/model/Area.php

@@ -0,0 +1,49 @@
+<?php
+
+namespace app\admin\model;
+
+use think\Model;
+
+
+class Area extends Model
+{
+
+    
+
+    
+
+    // 表名
+    protected $name = 'area';
+    
+    // 自动写入时间戳字段
+    protected $autoWriteTimestamp = false;
+
+    // 定义时间戳字段名
+    protected $createTime = false;
+    protected $updateTime = false;
+    protected $deleteTime = false;
+
+    // 追加属性
+    protected $append = [
+        'level_text'
+    ];
+    
+
+    
+    public function getLevelList()
+    {
+        return ['1' => __('Level 1'), '2' => __('Level 2'), '3' => __('Level 3')];
+    }
+
+
+    public function getLevelTextAttr($value, $data)
+    {
+        $value = $value ? $value : (isset($data['level']) ? $data['level'] : '');
+        $list = $this->getLevelList();
+        return isset($list[$value]) ? $list[$value] : '';
+    }
+
+
+
+
+}

+ 3 - 36
application/admin/model/Finishedproduct.php

@@ -7,27 +7,9 @@ use think\Model;
 
 class Finishedproduct extends Model
 {
-
-    
-
-    
-
-    // 表名
-    protected $name = 'version';
-    
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'integer';
-
-    // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
-    protected $deleteTime = false;
-
-    // 追加属性
-    protected $append = [
-        'status_text'
-    ];
-    
+    protected $connection = 'mongodb';
+    protected $table = 'finished_products';
+//    protected $append = ['status_text'];
 
     protected static function init()
     {
@@ -37,21 +19,6 @@ class Finishedproduct extends Model
         });
     }
 
-    
-    public function getStatusList()
-    {
-        return ['30' => __('Status 30')];
-    }
-
-
-    public function getStatusTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
-        $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-
 
 
 }

+ 0 - 57
application/admin/model/Inventorydetails.php

@@ -1,57 +0,0 @@
-<?php
-
-namespace app\admin\model;
-
-use think\Model;
-
-
-class Inventorydetails extends Model
-{
-
-    
-
-    
-
-    // 表名
-    protected $name = 'version';
-    
-    // 自动写入时间戳字段
-    protected $autoWriteTimestamp = 'integer';
-
-    // 定义时间戳字段名
-    protected $createTime = 'createtime';
-    protected $updateTime = 'updatetime';
-    protected $deleteTime = false;
-
-    // 追加属性
-    protected $append = [
-        'status_text'
-    ];
-    
-
-    protected static function init()
-    {
-        self::afterInsert(function ($row) {
-            $pk = $row->getPk();
-            $row->getQuery()->where($pk, $row[$pk])->update(['weigh' => $row[$pk]]);
-        });
-    }
-
-    
-    public function getStatusList()
-    {
-        return ['30' => __('Status 30')];
-    }
-
-
-    public function getStatusTextAttr($value, $data)
-    {
-        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
-        $list = $this->getStatusList();
-        return isset($list[$value]) ? $list[$value] : '';
-    }
-
-
-
-
-}

+ 6 - 0
application/admin/model/QcodeProduct.php

@@ -12,6 +12,12 @@ class QcodeProduct extends Model
 
     use SoftDelete;
 
+    // 获取DB3连接的方法
+    public static function db3()
+    {
+        return \think\Db::connect(config('database.db3'));
+    }
+
     public function createIndex()
     {
         $this->connection->command([

+ 1 - 1
application/admin/validate/Inventorydetails.php → application/admin/validate/Area.php

@@ -4,7 +4,7 @@ namespace app\admin\validate;
 
 use think\Validate;
 
-class Inventorydetails extends Validate
+class Area extends Validate
 {
     /**
      * 验证规则

+ 81 - 0
application/admin/view/area/add.html

@@ -0,0 +1,81 @@
+<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pid" class="form-control" name="row[pid]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Shortname')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-shortname" class="form-control" name="row[shortname]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Mergename')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-mergename" class="form-control" name="row[mergename]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-level" class="form-control selectpicker" name="row[level]">
+                {foreach name="levelList" item="vo"}
+                    <option value="{$key}" {in name="key" value=""}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pinyin')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pinyin" class="form-control" name="row[pinyin]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Code')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-code" class="form-control" name="row[code]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Zip')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-zip" class="form-control" name="row[zip]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('First')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-first" class="form-control" name="row[first]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Lng')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-lng" class="form-control" name="row[lng]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Lat')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-lat" class="form-control" name="row[lat]" type="text">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 81 - 0
application/admin/view/area/edit.html

@@ -0,0 +1,81 @@
+<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pid')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pid" class="form-control" name="row[pid]" type="number" value="{$row.pid|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Shortname')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-shortname" class="form-control" name="row[shortname]" type="text" value="{$row.shortname|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" class="form-control" name="row[name]" type="text" value="{$row.name|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Mergename')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-mergename" class="form-control" name="row[mergename]" type="text" value="{$row.mergename|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Level')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-level" class="form-control selectpicker" name="row[level]">
+                {foreach name="levelList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.level"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Pinyin')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-pinyin" class="form-control" name="row[pinyin]" type="text" value="{$row.pinyin|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Code')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-code" class="form-control" name="row[code]" type="text" value="{$row.code|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Zip')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-zip" class="form-control" name="row[zip]" type="text" value="{$row.zip|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('First')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-first" class="form-control" name="row[first]" type="text" value="{$row.first|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Lng')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-lng" class="form-control" name="row[lng]" type="text" value="{$row.lng|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Lat')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-lat" class="form-control" name="row[lat]" type="text" value="{$row.lat|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group layer-footer">
+        <label class="control-label col-xs-12 col-sm-2"></label>
+        <div class="col-xs-12 col-sm-8">
+            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
+        </div>
+    </div>
+</form>

+ 545 - 0
application/admin/view/area/index.html

@@ -0,0 +1,545 @@
+<style>
+    .form-commonsearch .form-group {
+        margin-left: 0;
+        margin-right: 0;
+        padding: 0;
+    }
+
+    form.form-commonsearch .control-label {
+        padding-right: 0;
+    }
+
+    .tdtitle {
+        margin-bottom: 5px;
+        font-weight: 600;
+    }
+
+    #channeltree {
+        margin-left: -6px;
+    }
+
+    #channelbar .panel-heading {
+        height: 55px;
+        line-height: 25px;
+        font-size: 14px;
+    }
+
+    @media (max-width: 1230px) {
+        .fixed-table-toolbar .search .form-control {
+            display: none;
+        }
+    }
+
+    @media (min-width: 1200px) {
+    }
+
+    .archives-label span.label {
+        font-weight: normal;
+    }
+
+    .archives-title {
+        max-width: 400px;
+        min-width: 200px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
+
+    .setflag label {
+        font-weight: 400;
+    }
+
+    .nav > li.toggle-channel {
+        display: none;
+    }
+
+    .col-full-width .nav > li.toggle-channel {
+        display: inline-block;
+    }
+
+    #myTabContent {
+        background-color: #fff;
+    }
+
+    #channeloperate > span {
+        font-size: 14px;
+        color: #777;
+    }
+
+    #channeloperate > span:first-child {
+        margin-right: 10px;
+    }
+
+    #channeloperate > span label {
+        font-weight: 400;
+    }
+
+    .row-eq-height {
+        display: -webkit-box;
+        display: -webkit-flex;
+        display: -ms-flexbox;
+        display: flex;
+    }
+
+</style>
+
+<style data-render="darktheme">
+    body.darktheme #myTabContent {
+        background-color: #333;
+    }
+
+    body.darktheme .tagsinput {
+        background-color: #3c3e3d;
+        border-color: #444;
+        color: #ccc;
+    }
+
+    body.darktheme .sim-tree a {
+        color: #ccc;
+    }
+
+    body.darktheme .sim-tree .sim-icon-d:before {
+        border-top-color: #ccc;
+    }
+
+    body.darktheme .sim-tree .sim-icon-r:before {
+        border-left-color: #ccc;
+    }
+</style>
+<style>
+    .form-commonsearch .form-group {
+        margin-left: 0;
+        margin-right: 0;
+        padding: 0;
+    }
+
+    form.form-commonsearch .control-label {
+        padding-right: 0;
+    }
+
+    .tdtitle {
+        margin-bottom: 5px;
+        font-weight: 600;
+    }
+
+    #channeltree {
+        margin-left: -6px;
+    }
+
+    #channelbar .panel-heading {
+        height: 55px;
+        line-height: 25px;
+        font-size: 14px;
+    }
+
+    @media (max-width: 1230px) {
+        .fixed-table-toolbar .search .form-control {
+            display: none;
+        }
+    }
+
+    @media (min-width: 1200px) {
+    }
+
+    .archives-label span.label {
+        font-weight: normal;
+    }
+
+    .archives-title {
+        max-width: 400px;
+        min-width: 200px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
+
+    .setflag label {
+        font-weight: 400;
+    }
+
+    .nav > li.toggle-channel {
+        display: none;
+    }
+
+    .col-full-width .nav > li.toggle-channel {
+        display: inline-block;
+    }
+
+    #myTabContent {
+        background-color: #fff;
+    }
+
+    #channeloperate > span {
+        font-size: 14px;
+        color: #777;
+    }
+
+    #channeloperate > span:first-child {
+        margin-right: 10px;
+    }
+
+    #channeloperate > span label {
+        font-weight: 400;
+    }
+
+    .row-eq-height {
+        display: -webkit-box;
+        display: -webkit-flex;
+        display: -ms-flexbox;
+        display: flex;
+    }
+
+    /* 树形菜单样式 */
+    .channel-tree {
+        font-size: 13px;
+        line-height: 1.4;
+    }
+
+    .tree-node {
+        position: relative;
+        padding: 0;
+        margin: 0;
+    }
+
+    .tree-item {
+        display: flex;
+        align-items: center;
+        padding: 6px 8px;
+        cursor: pointer;
+        border-radius: 3px;
+        transition: background-color 0.2s;
+        margin: 1px 0;
+    }
+
+    .tree-item:hover {
+        background-color: #f5f5f5;
+    }
+
+    .tree-item.active {
+        background-color: #3c8dbc;
+        color: white;
+    }
+
+    .tree-item.active:hover {
+        background-color: #357ca5;
+    }
+
+    .tree-toggle {
+        width: 16px;
+        height: 16px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin-right: 4px;
+        cursor: pointer;
+        font-size: 10px;
+        color: #666;
+    }
+
+    .tree-toggle:before {
+        content: "▶";
+        transition: transform 0.2s;
+    }
+
+    .tree-toggle.expanded:before {
+        transform: rotate(90deg);
+    }
+
+    .tree-toggle.empty {
+        visibility: hidden;
+    }
+
+    .tree-checkbox {
+        width: 16px;
+        height: 16px;
+        margin-right: 6px;
+        cursor: pointer;
+    }
+
+    .tree-icon {
+        width: 16px;
+        height: 16px;
+        margin-right: 6px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        font-size: 12px;
+        color: #666;
+    }
+
+    .tree-label {
+        flex: 1;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+    }
+
+    .tree-children {
+        margin-left: 20px;
+        display: none;
+    }
+
+    .tree-node.expanded > .tree-children {
+        display: block;
+    }
+
+    /* 连接线样式 */
+    .tree-node:before {
+        content: "";
+        position: absolute;
+        left: 8px;
+        top: 28px;
+        bottom: 0;
+        width: 1px;
+        background-color: #ddd;
+    }
+
+    .tree-node:last-child:before {
+        height: 22px;
+    }
+
+    .tree-node > .tree-item:before {
+        content: "";
+        position: absolute;
+        left: 8px;
+        top: 50%;
+        width: 12px;
+        height: 1px;
+        background-color: #ddd;
+        margin-top: -0.5px;
+    }
+
+    .tree-node.root:before,
+    .tree-node.root > .tree-item:before {
+        display: none;
+    }
+
+    /* 暗色主题支持 */
+    body.darktheme #myTabContent {
+        background-color: #333;
+    }
+
+    body.darktheme .tree-item:hover {
+        background-color: #404040;
+    }
+
+    body.darktheme .tree-item {
+        color: #ccc;
+    }
+
+    body.darktheme .tree-node:before,
+    body.darktheme .tree-node > .tree-item:before {
+        background-color: #555;
+    }
+</style>
+<link rel="stylesheet" href="__CDN__/assets/addons/cms/css/simtree.css"/>
+
+<div class="row row-eq-height">
+    <div class="col-md-2 pr-0" id="channelbar">
+        <div class="panel panel-default panel-intro" style="height: 100%;">
+            <div class="panel-heading">
+                <div class="panel-lead">
+                    <div class="pull-left">
+                        <em>{:__('Channel list')}</em>
+                    </div>
+                    <div class="pull-right">
+                        <a href="javascript:;" class="btn btn-link btn-xs btn-channel hidden-xs hidden-sm"><i class="fa fa-bars"></i></a>
+                    </div>
+                </div>
+            </div>
+            <div class="panel-body">
+                <div id="channeltree">
+                    <!-- 树形菜单内容 -->
+                    <div class="channel-tree">
+                        <!-- 正确的结构:每个一级节点都是独立的 tree-node -->
+                        {foreach $tree as $k=>$v}
+                        <div class="tree-node root expanded">
+                            <div class="tree-item" data-id="{$v['id']}" onclick="toggleNode(this)">
+                                <span class="tree-toggle {if !empty($v['children'])}expanded{else}empty{/if}" onclick="event.stopPropagation(); toggleNode(this.parentNode)"></span>
+                                <span class="tree-label">{$v['name']}</span>
+                            </div>
+
+                            {if !empty($v['children'])}
+                            <div class="tree-children">
+                                <!-- 二级节点 -->
+                                {foreach $v["children"] as $kk=>$vv}
+                                <div class="tree-node expanded">
+                                    <div class="tree-item" data-id="{$vv['id']}" onclick="toggleNode(this)">
+                                        <span class="tree-toggle {if !empty($vv['children'])}expanded{else}empty{/if}" onclick="event.stopPropagation(); toggleNode(this.parentNode)"></span>
+                                        <span class="tree-label">{$vv['name']}</span>
+                                    </div>
+
+                                    {if !empty($vv['children'])}
+                                    <div class="tree-children">
+                                        <!-- 三级节点 -->
+                                        {foreach $vv['children'] as $kkk=>$vvv}
+                                        <div class="tree-node">
+                                            <div class="tree-item" data-id="{$vvv['id']}" onclick='refreshTableData("{$v["id"]}", "{$vv["id"]}", "{$vvv["id"]}")'>
+                                                <span class="tree-toggle empty"></span>
+                                                <span class="tree-label">{$vvv['name']}</span>
+                                            </div>
+                                        </div>
+                                        {/foreach}
+                                    </div>
+                                    {/if}
+                                </div>
+                                {/foreach}
+                            </div>
+                            {/if}
+                        </div>
+                        {/foreach}
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+        if (window.innerWidth < 768) {
+            document.getElementById('channelbar').className = document.getElementById('channelbar').className.replace("pr-0", "hidden");
+        }
+    </script>
+    <div class="col-xs-12 col-md-10" id="archivespanel">
+        <div class="panel panel-default panel-intro">
+            <div class="panel-heading">
+                {:build_heading(null,FALSE)}
+                <ul class="nav nav-tabs" data-field="status">
+                    <li class="toggle-channel"><a href="javascript:;" class="btn-channel"><i class="fa fa-bars"></i></a></li>
+
+                </ul>
+            </div>
+            <div class="panel-body">
+                <div id="myTabContent" class="tab-content">
+                    <div class="tab-pane fade active in" id="one">
+                        <div class="widget-body no-padding">
+                            <div id="toolbar" class="toolbar">
+                                {:build_toolbar('refresh,edit,del')}
+                                <div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">
+                                    <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                                    <ul class="dropdown-menu text-left" role="menu">
+                                        <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                        <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                                    </ul>
+                                </div>
+                            </div>
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                                   data-operate-edit="{:$auth->check('user/user/edit')}"
+                                   data-operate-del="{:$auth->check('user/user/del')}"
+                                   width="100%">
+                            </table>
+                        </div>
+                    </div>
+
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
+
+<script>
+    // 切换节点展开/收起
+    function toggleNode(element) {
+        const treeNode = element.closest('.tree-node');
+        const toggle = element.querySelector('.tree-toggle') || element.closest('.tree-item').querySelector('.tree-toggle');
+
+        if (treeNode) {
+            treeNode.classList.toggle('expanded');
+
+            if (toggle && !toggle.classList.contains('empty')) {
+                toggle.classList.toggle('expanded');
+            }
+        }
+    }
+
+    // 选择节点
+    function selectNode(element, nodeId) {
+        // 移除所有活动状态
+        document.querySelectorAll('.tree-item').forEach(item => {
+            item.classList.remove('active');
+        });
+
+        // 添加当前节点的活动状态
+        element.classList.add('active');
+
+        console.log('选择了频道:', nodeId);
+
+        // 这里可以触发数据加载
+        if (typeof loadChannelData === 'function') {
+            loadChannelData(nodeId);
+        }
+
+        // 如果有FastAdmin的表格刷新方法
+        // if (typeof Table !== 'undefined' && Table.api) {
+        //     Table.api.ajax.reload();
+        // }
+    }
+
+    // 复选框变化事件
+    $(document).on('change', '.tree-checkbox', function() {
+        const checked = this.checked;
+        const treeNode = $(this).closest('.tree-node');
+
+        // 选中/取消选中所有子节点
+        treeNode.find('.tree-children .tree-checkbox').prop('checked', checked);
+
+        // 向上更新父节点状态
+        updateParentCheckbox(treeNode);
+    });
+
+    // 更新父节点复选框状态
+    function updateParentCheckbox(treeNode) {
+        const parentNode = treeNode.parent().closest('.tree-node');
+        if (parentNode.length) {
+            const siblings = parentNode.find('> .tree-children > .tree-node');
+            const checkedSiblings = siblings.find('> .tree-item .tree-checkbox:checked');
+            const parentCheckbox = parentNode.find('> .tree-item .tree-checkbox');
+
+            if (checkedSiblings.length === 0) {
+                parentCheckbox.prop('checked', false).prop('indeterminate', false);
+            } else if (checkedSiblings.length === siblings.length) {
+                parentCheckbox.prop('checked', true).prop('indeterminate', false);
+            } else {
+                parentCheckbox.prop('checked', false).prop('indeterminate', true);
+            }
+
+            updateParentCheckbox(parentNode);
+        }
+    }
+
+    // 初始化
+    $(document).ready(function() {
+        // 初始化树形结构的展开状态
+        $('.tree-node.expanded').each(function() {
+            const toggle = $(this).find('> .tree-item .tree-toggle');
+            if (!toggle.hasClass('empty')) {
+                toggle.addClass('expanded');
+            }
+        });
+    });
+    function refreshTableData(level1Id, level2Id, level3Id) {
+        // 解析参数
+        var yearMonth = level1Id; // 如:2025-06
+        var test2 = level2Id.split('_')[1]; // 如:asdf
+        var test3 = level3Id.split('_')[2]; // 如:ewww
+
+        console.log('筛选条件:', {
+            yearMonth: yearMonth,
+            test2: test2,
+            test3: test3
+        });
+
+        // 直接刷新表格,传递筛选参数
+        $("#table").bootstrapTable('refresh', {
+            query: {
+                yearMonth: yearMonth,
+                test2: test2,
+                test3: test3
+            }
+        });
+
+        // 更新选中状态
+        $('.tree-item').removeClass('active');
+        $(event.target).closest('.tree-item').addClass('active');
+    }
+</script>
+

+ 15 - 15
application/admin/view/common/header.html

@@ -29,21 +29,21 @@
 <!--                </li>-->
 
                 <!-- 清除缓存 -->
-                <li class="hidden-xs">
-                    <a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">
-                        <i class="fa fa-trash"></i> {:__('Wipe cache')}
-                    </a>
-                    <ul class="dropdown-menu wipecache">
-                        <li><a href="javascript:;" data-type="all"><i class="fa fa-trash fa-fw"></i> {:__('Wipe all cache')}</a></li>
-                        <li class="divider"></li>
-                        <li><a href="javascript:;" data-type="content"><i class="fa fa-file-text fa-fw"></i> {:__('Wipe content cache')}</a></li>
-                        <li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o fa-fw"></i> {:__('Wipe template cache')}</a></li>
-                        <li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket fa-fw"></i> {:__('Wipe addons cache')}</a></li>
-                        <li><a href="javascript:;" data-type="browser"><i class="fa fa-chrome fa-fw"></i> {:__('Wipe browser cache')}
-                            <span data-toggle="tooltip" data-title="{:__('Wipe browser cache tips')}"><i class="fa fa-info-circle"></i></span>
-                        </a></li>
-                    </ul>
-                </li>
+<!--                <li class="hidden-xs">-->
+<!--                    <a href="javascript:;" data-toggle="dropdown" title="{:__('Wipe cache')}">-->
+<!--                        <i class="fa fa-trash"></i> {:__('Wipe cache')}-->
+<!--                    </a>-->
+<!--                    <ul class="dropdown-menu wipecache">-->
+<!--                        <li><a href="javascript:;" data-type="all"><i class="fa fa-trash fa-fw"></i> {:__('Wipe all cache')}</a></li>-->
+<!--                        <li class="divider"></li>-->
+<!--                        <li><a href="javascript:;" data-type="content"><i class="fa fa-file-text fa-fw"></i> {:__('Wipe content cache')}</a></li>-->
+<!--                        <li><a href="javascript:;" data-type="template"><i class="fa fa-file-image-o fa-fw"></i> {:__('Wipe template cache')}</a></li>-->
+<!--                        <li><a href="javascript:;" data-type="addons"><i class="fa fa-rocket fa-fw"></i> {:__('Wipe addons cache')}</a></li>-->
+<!--                        <li><a href="javascript:;" data-type="browser"><i class="fa fa-chrome fa-fw"></i> {:__('Wipe browser cache')}-->
+<!--                            <span data-toggle="tooltip" data-title="{:__('Wipe browser cache tips')}"><i class="fa fa-info-circle"></i></span>-->
+<!--                        </a></li>-->
+<!--                    </ul>-->
+<!--                </li>-->
 
                 <!-- 多语言列表 -->
                 {if $Think.config.lang_switch_on}

+ 392 - 212
application/admin/view/finishedproduct/index.html

@@ -2,7 +2,7 @@
 <html lang="zh-CN">
 <head>
     <meta charset="UTF-8">
-    <title>待入库工单列表</title>
+    <title>入库明细列表</title>
     <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <style>
         body {
@@ -16,29 +16,65 @@
             color: #333;
         }
 
+        .search-container {
+            display: flex;
+            gap: 10px;
+            margin-bottom: 20px;
+            align-items: center;
+            flex-wrap: wrap;
+        }
+
         #searchInput {
-            padding: 8px;
+            padding: 8px 12px;
             width: 300px;
             font-size: 14px;
-            margin-bottom: 20px;
             border: 1px solid #ccc;
             border-radius: 4px;
+            flex: 1;
+            min-width: 200px;
         }
-        #q_btn{
-            padding: 8px;
+
+        .btn {
+            padding: 8px 16px;
             font-size: 14px;
-            margin-bottom: 20px;
             border: 1px solid #ccc;
             border-radius: 4px;
+            cursor: pointer;
+            display: inline-flex;
+            align-items: center;
+            gap: 5px;
+            transition: all 0.3s;
+        }
+
+        .btn-primary {
             background-color: #18bc9c;
             color: #fff;
+            border-color: #18bc9c;
+        }
+
+        .btn-primary:hover {
+            background-color: #15a589;
+            border-color: #149078;
+        }
+
+        .btn-success {
+            background-color: #5cb85c;
+            color: #fff;
+            border-color: #4cae4c;
+        }
+
+        .btn-success:hover {
+            background-color: #4cae4c;
+            border-color: #398439;
         }
 
         .scroll-table-wrapper {
-            max-height: 600px;
+            max-height: 500px;
             overflow-y: auto;
             border: 1px solid #ddd;
             background: white;
+            margin-bottom: 15px;
+            box-shadow: 0 1px 3px rgba(0,0,0,0.1);
         }
 
         table {
@@ -51,7 +87,7 @@
             border: 1px solid #ddd;
             text-align: center;
             font-size: 14px;
-            padding: 5px;
+            padding: 8px;
             word-break: break-word;
         }
 
@@ -60,6 +96,7 @@
             position: sticky;
             top: 0;
             z-index: 2;
+            font-weight: bold;
         }
 
         tbody tr:hover {
@@ -67,7 +104,7 @@
         }
 
         tr.selected {
-            background-color: yellow !important;
+            background-color: #ddefeb !important;
         }
 
         #pagination-wrapper {
@@ -77,27 +114,33 @@
             flex-wrap: wrap;
             margin-top: 20px;
             font-size: 14px;
+            gap: 10px;
         }
 
         #pagination-controls {
             display: flex;
             align-items: center;
             flex-wrap: wrap;
+            gap: 5px;
         }
 
         #pagination-controls button {
-            padding: 6px 10px;
-            margin: 0 2px;
+            padding: 6px 12px;
             cursor: pointer;
-            border: 1px solid #ccc;
+            border: 1px solid #ddd;
             background: white;
             border-radius: 4px;
+            transition: all 0.3s;
+        }
+
+        #pagination-controls button:hover:not(:disabled) {
+            background: #f0f0f0;
         }
 
         #pagination-controls button.active {
-            background: #4CAF50;
+            background: #18bc9c;
             color: white;
-            border-color: #4CAF50;
+            border-color: #18bc9c;
         }
 
         #pagination-controls button:disabled {
@@ -108,21 +151,16 @@
 
         #pageSize {
             margin: 0 5px;
-            padding: 4px 6px;
+            padding: 5px;
+            border-radius: 4px;
+            border: 1px solid #ddd;
         }
 
         .ellipsis {
             padding: 6px 10px;
             color: #999;
         }
-        /* 按钮基础样式(可选美化) */
-        .btn-refresh {
-            font-size: 18px;
-            color: #fff;
-            cursor: pointer;
-        }
 
-        /* 旋转动画类 */
         .rotating {
             animation: spin 1s linear infinite;
         }
@@ -131,27 +169,73 @@
             0% { transform: rotate(0deg); }
             100% { transform: rotate(360deg); }
         }
+
+        .form-group {
+            margin-bottom: 15px;
+        }
+
+        .form-group label {
+            display: block;
+            margin-bottom: 5px;
+            font-weight: bold;
+        }
+
+        .form-control {
+            width: 100%;
+            padding: 8px 12px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+            box-sizing: border-box;
+        }
+
+        .no-data {
+            text-align: center;
+            padding: 20px;
+            color: #999;
+            font-style: italic;
+        }
+
+        /* 响应式调整 */
+        @media (max-width: 768px) {
+            .search-container {
+                flex-direction: column;
+                align-items: stretch;
+            }
+
+            #searchInput {
+                width: 100%;
+            }
+
+            #pagination-wrapper {
+                flex-direction: column;
+                align-items: flex-start;
+            }
+        }
     </style>
 </head>
 <body>
 
-<h2>待入库工单列表</h2>
-<a href="javascript:;" class="btn btn-primary btn-refresh" title="刷新">
-    <i class="fas fa-sync-alt"></i> <!-- 这是刷新图标 -->
-</a>
-<input type="text" id="searchInput" placeholder="搜索产品名称..." />
-<button id="q_btn">确认入库</button>
+<h2>入库明细列表</h2>
+<div class="search-container">
+    <button class="btn btn-primary btn-refresh" title="刷新">
+        <i class="fas fa-sync-alt"></i> 刷新
+    </button>
+    <input type="text" id="searchInput" placeholder="搜索产品名称、产品代号、工单编号..." />
+    <button id="addBtn" class="btn btn-success">
+        <i class="fas fa-plus"></i> 新增入库产品
+    </button>
+</div>
+
 <div class="scroll-table-wrapper">
     <table id="productTable">
         <thead>
         <tr>
-            <th style="width: 4%"><input type="checkbox" id="checkAll"></th>
-            <th style="width: 15%">工单编号</th>
-            <th style="width: 10%">销售订单号</th>
+            <th style="width: 15%">销售订单号</th>
+            <th style="width: 10%">工单编号</th>
             <th style="width: 10%">产品代号</th>
             <th style="width: 30%">产品名称</th>
             <th style="width: 10%">数量</th>
-            <th style="width: 10%">入库状态</th>
+            <th style="width: 10%">入库日期</th>
         </tr>
         </thead>
         <tbody id="tableBody">
@@ -168,217 +252,313 @@
             <option value="10">10</option>
             <option value="20" selected>20</option>
             <option value="50">50</option>
+            <option value="100">100</option>
         </select> 条
     </div>
 </div>
+
 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
 <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
+<script src="https://cdn.jsdelivr.net/npm/layer/dist/layer.js"></script>
 <script>
-    $(document).on('click', '.btn-refresh', function () {
-        currentPage = 1; // 可选:回到第一页
-        loadData(currentPage, searchKey); // 带着当前搜索关键字刷新
-    });
-    $(document).on('click', '.btn-refresh', function () {
-        var $icon = $(this).find('i');
+    $(function() {
+        // 初始化变量
+        let currentPage = 1;
+        let searchKey = '';
+        let pageSize = parseInt($('#pageSize').val());
+
+        // 加载数据函数
+        function loadData(page = 1, search = '') {
+            pageSize = parseInt($('#pageSize').val());
+
+            // 显示加载中
+            const loadingIndex = layer.load(1, {
+                shade: [0.1,'#fff']
+            });
+
+            $.ajax({
+                method: "GET",
+                url: "Finishedproduct/index",
+                data: {
+                    page: page,
+                    search: search,
+                    limit: pageSize
+                },
+                dataType: "json",
+                success: function(res) {
+                    layer.close(loadingIndex);
+
+                    console.log('API响应数据:', res); // 调试用
+
+                    // 确保res是对象且包含所需数据
+                    if (!res || typeof res !== 'object') {
+                        console.error('返回数据格式不正确:', res);
+                        showNoData();
+                        return;
+                    }
+
+                    const tbody = $('#tableBody');
+                    tbody.empty();
+                    $('#checkAll').prop('checked', false);
+
+                    // 检查数据是否存在且是数组
+                    if (Array.isArray(res.data) && res.data.length > 0) {
+                        renderTableData(res.data);
+                    } else if (Array.isArray(res) && res.length > 0) {
+                        // 如果返回的是数组本身而不是包含data属性的对象
+                        renderTableData(res);
+                        res = {
+                            data: res,
+                            total: res.length,
+                            page: page,
+                            limit: pageSize
+                        };
+                    } else {
+                        showNoData();
+                    }
+
+                    // 更新分页信息
+                    const total = res.total || res.data?.length || 0;
+                    renderPaginationInfo(total, page, pageSize);
+                    renderPagination(total, page, pageSize);
+                },
+                error: function(xhr, status, error) {
+                    layer.close(loadingIndex);
+                    console.error("加载数据失败:", error, "状态:", status);
+                    showNoData();
+                    layer.msg('加载数据失败: ' + (xhr.responseJSON?.message || error), {icon: 2});
+                }
+            });
+        }
 
-        // 添加旋转动画
-        $icon.addClass('rotating');
+        // 渲染表格数据
+        function renderTableData(data) {
+            const tbody = $('#tableBody');
+            data.forEach(row => {
+                tbody.append(`
+                    <tr>
+                        <td>${row.订单编号 || '-'}</td>
+                        <td>${row.jjcp_gdbh || '-'}</td>
+                        <td>${row.jjcp_cpdh || '-'}</td>
+                        <td>${row.jjcp_cpmc || '-'}</td>
+                        <td>${row.jjcp_sl || '0'}</td>
+                        <td>${row.Sys_rq}</td>
+                    </tr>
+                `);
+            });
+        }
 
-        // 模拟刷新数据(这里调用你的表格刷新函数)
-        loadData(); // 真实刷新
+        // 显示无数据提示
+        function showNoData() {
+            $('#tableBody').html(`
+                <tr>
+                    <td colspan="7" class="no-data">
+                        <i class="fas fa-info-circle"></i> 暂无数据
+                    </td>
+                </tr>
+            `);
+            $('#pagination-info').text('共 0 条记录,第 1 / 1 页');
+            $('#pagination-controls').find('button, .ellipsis').not('#pageSize').remove();
+        }
 
-        // 假设刷新完毕后停止旋转(用 AJAX 完成后去除)
-        setTimeout(function () {
-            $icon.removeClass('rotating');
-        }, 1000); // 假设1秒刷新完成
-    });
-    let currentPage = 1;
-    let searchKey = '';
-    let pageSize = parseInt($('#pageSize').val());
-
-    function loadData(page = 1, search = '') {
-        pageSize = parseInt($('#pageSize').val());
-
-        $.ajax({
-            method: "GET",
-            url: "Finishedproduct/index",
-            data: { page: page, search: search, limit: pageSize },
-            success: function (res) {
-                const tbody = $('#tableBody');
-                tbody.empty();
-                $('#checkAll').prop('checked', false); // 每次刷新取消“全选”
-
-                if (res.data && res.data.length > 0) {
-                    res.data.forEach(row => {
-                        tbody.append(`<tr>
-                            <td><input type="checkbox" class="row-check"></td>
-                            <td>${row.order_ddbh}</td>
-                            <td>${row.jjcp_gdbh}</td>
-                            <td>${row.jjcp_cpdh}</td>
-                            <td>${row.jjcp_cpmc}</td>
-                            <td>${row.jjcp_sl}</td>
-                            <td>${row.jjcp_smb}</td>
-                        </tr>`);
+        // 渲染分页信息
+        function renderPaginationInfo(total, page, limit) {
+            const totalPages = Math.ceil(total / limit) || 1;
+            $('#pagination-info').text(`共 ${total} 条记录,第 ${page} / ${totalPages} 页`);
+        }
+
+        // 渲染分页控件
+        function renderPagination(total, current, limit) {
+            const totalPages = Math.ceil(total / limit) || 1;
+            current = parseInt(current);
+            const container = $('#pagination-controls');
+            container.find('button, .ellipsis').not('#pageSize').remove();
+
+            // 添加分页按钮
+            const addButton = (text, pageNum, isActive = false, isDisabled = false) => {
+                const btn = $('<button>')
+                    .text(text)
+                    .prop('disabled', isDisabled)
+                    .toggleClass('active', isActive)
+                    .click(() => {
+                        if (!isDisabled && pageNum !== current) {
+                            currentPage = pageNum;
+                            loadData(currentPage, searchKey);
+                        }
                     });
+                container.append(btn);
+            };
+
+            // 添加上一页按钮
+            addButton('上一页', current - 1, false, current === 1);
+
+            // 计算分页显示逻辑
+            const pages = [];
+            if (totalPages <= 5) {
+                for (let i = 1; i <= totalPages; i++) pages.push(i);
+            } else {
+                if (current <= 3) {
+                    pages.push(1, 2, 3, 4, 5);
+                    if (totalPages > 5) pages.push('...', totalPages);
+                } else if (current >= totalPages - 2) {
+                    pages.push(1, '...');
+                    for (let i = totalPages - 4; i <= totalPages; i++) pages.push(i);
                 } else {
-                    tbody.append('<tr><td colspan="5">暂无数据</td></tr>');
+                    pages.push(1, '...', current - 1, current, current + 1, '...', totalPages);
                 }
-
-                renderPaginationInfo(res.total, res.page, res.limit);
-                renderPagination(res.total, res.page, res.limit);
-            },
-            error: function () {
-                console.log("加载数据失败!");
             }
-        });
-    }
-
-    function renderPaginationInfo(total, page, limit) {
-        const totalPages = Math.ceil(total / limit);
-        $('#pagination-info').text(`共 ${total} 条记录,第 ${page} / ${totalPages} 页`);
-    }
-
-    function renderPagination(total, current, limit) {
-        const totalPages = Math.ceil(total / limit);
-        current = parseInt(current);
-        const container = $('#pagination-controls');
-        container.find('button, .ellipsis').remove();
-
-        const addButton = (text, pageNum, isActive = false, isDisabled = false) => {
-            const btn = $('<button>')
-                .text(text)
-                .prop('disabled', isDisabled)
-                .addClass(isActive ? 'active' : '')
-                .click(() => {
-                    if (!isDisabled && pageNum !== current) {
-                        currentPage = pageNum;
-                        loadData(currentPage, searchKey);
+
+            // 渲染页码按钮
+            let prev = null;
+            pages.forEach(p => {
+                if (p === '...') {
+                    if (prev !== '...') {
+                        container.append('<span class="ellipsis">...</span>');
+                        prev = '...';
                     }
-                });
-            container.append(btn);
-        };
-
-        addButton('上一页', current - 1, false, current === 1);
-
-        const pages = [];
-        if (totalPages <= 5) {
-            for (let i = 1; i <= totalPages; i++) pages.push(i);
-        } else {
-            if (current <= 3) {
-                pages.push(1, 2, 3, 4, 5, '...', totalPages);
-            } else if (current >= totalPages - 2) {
-                pages.push(1, '...');
-                for (let i = totalPages - 4; i <= totalPages; i++) pages.push(i);
-            } else {
-                pages.push(1, '...', current - 1, current, current + 1, '...', totalPages);
-            }
+                } else {
+                    addButton(p, p, p === current);
+                    prev = p;
+                }
+            });
+
+            // 添加下一页按钮
+            addButton('下一页', current + 1, false, current === totalPages);
         }
 
-        let prev = null;
-        pages.forEach(p => {
-            if (p === '...') {
-                if (prev !== '...') {
-                    container.append('<span class="ellipsis">...</span>');
-                    prev = '...';
-                }
-            } else {
-                addButton(p, p, p === current);
-                prev = p;
+        // 行点击切换勾选 + 高亮
+        $(document).on('click', '#productTable tbody tr', function(e) {
+            if (!$(e.target).is('input, a, button')) {
+                const checkbox = $(this).find('.row-check');
+                checkbox.prop('checked', !checkbox.prop('checked'));
+                $(this).toggleClass('selected');
             }
         });
 
-        addButton('下一页', current + 1, false, current === totalPages);
-    }
-
-    // 行点击切换勾选 + 高亮
-    $(document).on('click', '#productTable tbody tr', function (e) {
-        if (!$(e.target).is('input')) {
-            const checkbox = $(this).find('.row-check');
-            checkbox.prop('checked', !checkbox.prop('checked'));
-        }
-        $(this).toggleClass('selected');
-    });
+        // 勾选框勾选联动行背景
+        $(document).on('change', '.row-check', function() {
+            $(this).closest('tr').toggleClass('selected', $(this).is(':checked'));
+        });
 
-    // 勾选框勾选联动行背景
-    $(document).on('change', '.row-check', function () {
-        const tr = $(this).closest('tr');
-        tr.toggleClass('selected', $(this).is(':checked'));
-    });
+        // 全选/取消全选
+        $('#checkAll').on('change', function() {
+            const checked = $(this).is(':checked');
+            $('.row-check').prop('checked', checked);
+            $('#productTable tbody tr').toggleClass('selected', checked);
+        });
 
-    // 全选/取消全选
-    $('#checkAll').on('change', function () {
-        const checked = $(this).is(':checked');
-        $('.row-check').prop('checked', checked);
-        $('#productTable tbody tr').each(function () {
-            $(this).toggleClass('selected', checked);
+        // 搜索功能
+        $('#searchInput').on('input', function() {
+            searchKey = $(this).val().trim();
+            currentPage = 1;
+            loadData(currentPage, searchKey);
         });
-    });
 
-    $('#searchInput').on('input', function () {
-        searchKey = $(this).val();
-        currentPage = 1;
-        loadData(currentPage, searchKey);
-    });
+        // 每页显示数量变化
+        $('#pageSize').on('change', function() {
+            currentPage = 1;
+            loadData(currentPage, searchKey);
+        });
 
-    $('#pageSize').on('change', function () {
-        currentPage = 1;
-        loadData(currentPage, searchKey);
-    });
+        // 刷新按钮
+        $(document).on('click', '.btn-refresh', function() {
+            const $icon = $(this).find('i');
+            $icon.addClass('rotating');
 
+            currentPage = 1;
+            $('#searchInput').val('');
+            searchKey = '';
+            loadData(currentPage);
 
-    // 点击“确认入库”按钮
-    $('#q_btn').on('click', function () {
-        const selectedData = [];
-
-        $('#productTable tbody tr').each(function () {
-            const checkbox = $(this).find('.row-check');
-            if (checkbox.is(':checked')) {
-                const row = $(this).find('td');
-                selectedData.push({
-                    order_ddbh: row.eq(1).text().trim(),
-                    jjcp_gdbh: row.eq(2).text().trim(),
-                    jjcp_cpdh: row.eq(3).text().trim(),
-                    jjcp_cpmc: row.eq(4).text().trim(),
-                    jjcp_sl: row.eq(5).text().trim(),
-                    jjcp_smb: row.eq(6).text().trim()
-                });
-            }
+            setTimeout(() => {
+                $icon.removeClass('rotating');
+            }, 1000);
         });
 
-        if (selectedData.length === 0) {
-            alert("请选择要入库的产品!");
-            return;
-        }
-
-        $.ajax({
-            method: "POST",
-            url: "Finishedproduct/finished",
-            contentType: "application/json",
-            data: JSON.stringify({ data: selectedData }),
-            success: function (res) {
-                Swal.fire({
-                    icon: 'success',
-                    title: '入库成功!',
-                    showConfirmButton: false,
-                    timer: 3000
-                });
-                loadData(); // 可选:刷新表格
-            },
-            error: function () {
-                Swal.fire({
-                    icon: 'error',
-                    title: '入库失败!',
-                    showConfirmButton: false,
-                    timer: 3000
-                });
-            }
-        });
-    });
+        // 新增入库产品
+        $('#addBtn').on('click', function() {
+            layer.open({
+                type: 1,
+                title: '新增入库记录',
+                area: ['600px', 'auto'],
+                shadeClose: true,
+                resize: true,
+                maxmin: true,
+                btn: ['确认入库', '取消'],
+                content: `
+                    <form id="addForm" style="padding: 20px 30px;" class="form-horizontal">
+                        <div class="form-group">
+                            <label>销售订单号</label>
+                            <input type="text" name="订单编号" class="form-control" required />
+                        </div>
+                        <div class="form-group">
+                            <label>工单编号</label>
+                            <input type="text" name="jjcp_gdbh" class="form-control" required />
+                        </div>
+                        <div class="form-group">
+                            <label>产品代号</label>
+                            <input type="text" name="jjcp_cpdh" class="form-control" required />
+                        </div>
+                        <div class="form-group">
+                            <label>产品名称</label>
+                            <input type="text" name="jjcp_cpmc" class="form-control" required />
+                        </div>
+                        <div class="form-group">
+                            <label>数量</label>
+                            <input type="number" name="jjcp_sl" class="form-control" min="1" required />
+                        </div>
+                    </form>
+                `,
+                yes: function(index) {
+                    const formData = {};
+                    let isValid = true;
+
+                    $('#addForm').find('[required]').each(function() {
+                        const $input = $(this);
+                        const val = $input.val().trim();
+
+                        if (!val) {
+                            layer.tips('此项为必填项', $input, {tips: [1, '#FF5722']});
+                            isValid = false;
+                            return false;
+                        }
+
+                        formData[$input.attr('name')] = val;
+                    });
 
+                    if (!isValid) return;
+
+                    // 添加系统日期
+                    formData.Sys_rq = new Date().toLocaleDateString();
+
+                    $.ajax({
+                        method: "POST",
+                        url: "Finishedproduct/finished",
+                        contentType: "application/json",
+                        data: JSON.stringify({ data: [formData] }),
+                        success: function(res) {
+                            if (res && res.code === 1) {
+                                layer.msg('入库成功', {icon: 1});
+                                layer.close(index);
+                                loadData();
+                            } else {
+                                layer.msg(res?.msg || '入库失败', {icon: 2});
+                            }
+                        },
+                        error: function(xhr) {
+                            const errorMsg = xhr.responseJSON?.message || xhr.statusText || '请求失败';
+                            layer.msg('入库失败: ' + errorMsg, {icon: 2});
+                        }
+                    });
+                }
+            });
+        });
 
-    $(document).ready(function () {
-        loadData();
+        // 初始加载数据 - 使用setTimeout确保所有资源加载完成
+        setTimeout(() => {
+            loadData();
+        }, 100);
     });
 </script>
 

+ 13 - 0
application/admin/view/finishedproduct/product_summary.html

@@ -0,0 +1,13 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport"
+          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <title>Document</title>
+</head>
+<body>
+123
+</body>
+</html>

+ 0 - 63
application/admin/view/inventorydetails/add.html

@@ -1,63 +0,0 @@
-<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
-
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-content" class="form-control" name="row[content]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="0">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="0">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            
-            <div class="radio">
-            {foreach name="statusList" item="vo"}
-            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="30"}checked{/in} /> {$vo}</label> 
-            {/foreach}
-            </div>
-
-        </div>
-    </div>
-    <div class="form-group layer-footer">
-        <label class="control-label col-xs-12 col-sm-2"></label>
-        <div class="col-xs-12 col-sm-8">
-            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 0 - 63
application/admin/view/inventorydetails/edit.html

@@ -1,63 +0,0 @@
-<form id="edit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
-
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Oldversion')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-oldversion" class="form-control" name="row[oldversion]" type="text" value="{$row.oldversion|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Newversion')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-newversion" class="form-control" name="row[newversion]" type="text" value="{$row.newversion|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Packagesize')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-packagesize" class="form-control" name="row[packagesize]" type="text" value="{$row.packagesize|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-content" class="form-control" name="row[content]" type="text" value="{$row.content|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Downloadurl')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-downloadurl" class="form-control" name="row[downloadurl]" type="text" value="{$row.downloadurl|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Enforce')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-enforce" data-rule="required" min="0" class="form-control" name="row[enforce]" type="number" value="{$row.enforce|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Weigh')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            <input id="c-weigh" data-rule="required" class="form-control" name="row[weigh]" type="number" value="{$row.weigh|htmlentities}">
-        </div>
-    </div>
-    <div class="form-group">
-        <label class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
-        <div class="col-xs-12 col-sm-8">
-            
-            <div class="radio">
-            {foreach name="statusList" item="vo"}
-            <label for="row[status]-{$key}"><input id="row[status]-{$key}" name="row[status]" type="radio" value="{$key}" {in name="key" value="$row.status"}checked{/in} /> {$vo}</label> 
-            {/foreach}
-            </div>
-
-        </div>
-    </div>
-    <div class="form-group layer-footer">
-        <label class="control-label col-xs-12 col-sm-2"></label>
-        <div class="col-xs-12 col-sm-8">
-            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
-        </div>
-    </div>
-</form>

+ 0 - 417
application/admin/view/inventorydetails/index.html

@@ -1,417 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh-CN">
-<head>
-    <meta charset="UTF-8">
-    <title>入库明细列表</title>
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <style>
-        body {
-            font-family: "微软雅黑", sans-serif;
-            padding: 20px;
-            background: #f9f9f9;
-        }
-
-        h2 {
-            margin-bottom: 20px;
-            color: #333;
-        }
-
-        #searchInput {
-            padding: 8px;
-            width: 300px;
-            font-size: 14px;
-            margin-bottom: 20px;
-            border: 1px solid #ccc;
-            border-radius: 4px;
-        }
-        #q_btn{
-            padding: 8px;
-            font-size: 14px;
-            margin-bottom: 20px;
-            border: 1px solid #ccc;
-            border-radius: 4px;
-            background-color: #18bc9c;
-            color: #fff;
-        }
-
-        .scroll-table-wrapper {
-            max-height: 400px;
-            overflow-y: auto;
-            border: 1px solid #ddd;
-            background: white;
-        }
-
-        table {
-            width: 100%;
-            border-collapse: collapse;
-            table-layout: fixed;
-        }
-
-        th, td {
-            border: 1px solid #ddd;
-            text-align: center;
-            font-size: 14px;
-            padding: 5px;
-            word-break: break-word;
-        }
-
-        thead th {
-            background: #f0f0f0;
-            position: sticky;
-            top: 0;
-            z-index: 2;
-        }
-
-        tbody tr:hover {
-            background: #f5f5f5;
-        }
-
-        tr.selected {
-            background-color: yellow !important;
-        }
-
-        #pagination-wrapper {
-            display: flex;
-            justify-content: space-between;
-            align-items: center;
-            flex-wrap: wrap;
-            margin-top: 20px;
-            font-size: 14px;
-        }
-
-        #pagination-controls {
-            display: flex;
-            align-items: center;
-            flex-wrap: wrap;
-        }
-
-        #pagination-controls button {
-            padding: 6px 10px;
-            margin: 0 2px;
-            cursor: pointer;
-            border: 1px solid #ccc;
-            background: white;
-            border-radius: 4px;
-        }
-
-        #pagination-controls button.active {
-            background: #4CAF50;
-            color: white;
-            border-color: #4CAF50;
-        }
-
-        #pagination-controls button:disabled {
-            background: #eee;
-            color: #aaa;
-            cursor: not-allowed;
-        }
-
-        #pageSize {
-            margin: 0 5px;
-            padding: 4px 6px;
-        }
-
-        .ellipsis {
-            padding: 6px 10px;
-            color: #999;
-        }
-        /* 按钮基础样式(可选美化) */
-        .btn-refresh {
-            font-size: 18px;
-            color: #fff;
-            cursor: pointer;
-        }
-
-        /* 旋转动画类 */
-        .rotating {
-            animation: spin 1s linear infinite;
-        }
-
-        @keyframes spin {
-            0% { transform: rotate(0deg); }
-            100% { transform: rotate(360deg); }
-        }
-        .form-group {
-            margin-bottom: 15px;
-        }
-
-        .form-group label {
-            display: block;
-            margin-bottom: 5px;
-            font-weight: bold;
-        }
-
-        .form-control {
-            width: 100%;
-            padding: 6px 10px;
-            border: 1px solid #ccc;
-            border-radius: 4px;
-        }
-    </style>
-</head>
-<body>
-
-<h2>入库明细列表</h2>
-<a href="javascript:;" class="btn btn-primary btn-refresh" title="刷新">
-    <i class="fas fa-sync-alt"></i> <!-- 这是刷新图标 -->
-</a>
-<input type="text" id="searchInput" placeholder="搜索产品名称..." />
-<button id="addBtn" class="btn btn-success" style=" height: 40px;">新增产品</button>
-<div class="scroll-table-wrapper">
-    <table id="productTable">
-        <thead>
-        <tr>
-            <th style="width: 4%"><input type="checkbox" id="checkAll"></th>
-            <th style="width: 15%">工单编号</th>
-            <th style="width: 10%">销售订单号</th>
-            <th style="width: 10%">产品代号</th>
-            <th style="width: 30%">产品名称</th>
-            <th style="width: 10%">数量</th>
-            <th style="width: 10%">入库状态</th>
-        </tr>
-        </thead>
-        <tbody id="tableBody">
-        <!-- JS 动态渲染数据 -->
-        </tbody>
-    </table>
-</div>
-
-<div id="pagination-wrapper">
-    <div id="pagination-info">共 0 条记录,第 1 / 1 页</div>
-    <div id="pagination-controls">
-        每页显示:
-        <select id="pageSize">
-            <option value="10">10</option>
-            <option value="20" selected>20</option>
-            <option value="50">50</option>
-        </select> 条
-    </div>
-</div>
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
-<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
-<!-- 引入 Layer,如果已引入可跳过 -->
-<script src="https://cdn.jsdelivr.net/npm/layer/dist/layer.js"></script>
-<script>
-    $(document).on('click', '.btn-refresh', function () {
-        currentPage = 1; // 可选:回到第一页
-        loadData(currentPage, searchKey); // 带着当前搜索关键字刷新
-    });
-    $(document).on('click', '.btn-refresh', function () {
-        var $icon = $(this).find('i');
-
-        // 添加旋转动画
-        $icon.addClass('rotating');
-
-        // 模拟刷新数据(这里调用你的表格刷新函数)
-        loadData(); // 真实刷新
-
-        // 假设刷新完毕后停止旋转(用 AJAX 完成后去除)
-        setTimeout(function () {
-            $icon.removeClass('rotating');
-        }, 1000); // 假设1秒刷新完成
-    });
-    let currentPage = 1;
-    let searchKey = '';
-    let pageSize = parseInt($('#pageSize').val());
-
-    function loadData(page = 1, search = '') {
-        pageSize = parseInt($('#pageSize').val());
-
-        $.ajax({
-            method: "GET",
-            url: "inventorydetails/index",
-            data: { page: page, search: search, limit: pageSize },
-            success: function (res) {
-                const tbody = $('#tableBody');
-                tbody.empty();
-                $('#checkAll').prop('checked', false); // 每次刷新取消“全选”
-
-                if (res.data && res.data.length > 0) {
-                    res.data.forEach(row => {
-                        tbody.append(`<tr>
-                            <td><input type="checkbox" class="row-check"></td>
-                            <td>${row.order_ddbh}</td>
-                            <td>${row.jjcp_gdbh}</td>
-                            <td>${row.jjcp_cpdh}</td>
-                            <td>${row.jjcp_cpmc}</td>
-                            <td>${row.jjcp_sl}</td>
-                            <td>${row.jjcp_smb}</td>
-                        </tr>`);
-                    });
-                } else {
-                    tbody.append('<tr><td colspan="5">暂无数据</td></tr>');
-                }
-
-                renderPaginationInfo(res.total, res.page, res.limit);
-                renderPagination(res.total, res.page, res.limit);
-            },
-            error: function () {
-                console.log("加载数据失败!");
-            }
-        });
-    }
-
-    function renderPaginationInfo(total, page, limit) {
-        const totalPages = Math.ceil(total / limit);
-        $('#pagination-info').text(`共 ${total} 条记录,第 ${page} / ${totalPages} 页`);
-    }
-
-    function renderPagination(total, current, limit) {
-        const totalPages = Math.ceil(total / limit);
-        current = parseInt(current);
-        const container = $('#pagination-controls');
-        container.find('button, .ellipsis').remove();
-
-        const addButton = (text, pageNum, isActive = false, isDisabled = false) => {
-            const btn = $('<button>')
-                .text(text)
-                .prop('disabled', isDisabled)
-                .addClass(isActive ? 'active' : '')
-                .click(() => {
-                    if (!isDisabled && pageNum !== current) {
-                        currentPage = pageNum;
-                        loadData(currentPage, searchKey);
-                    }
-                });
-            container.append(btn);
-        };
-
-        addButton('上一页', current - 1, false, current === 1);
-
-        const pages = [];
-        if (totalPages <= 5) {
-            for (let i = 1; i <= totalPages; i++) pages.push(i);
-        } else {
-            if (current <= 3) {
-                pages.push(1, 2, 3, 4, 5, '...', totalPages);
-            } else if (current >= totalPages - 2) {
-                pages.push(1, '...');
-                for (let i = totalPages - 4; i <= totalPages; i++) pages.push(i);
-            } else {
-                pages.push(1, '...', current - 1, current, current + 1, '...', totalPages);
-            }
-        }
-
-        let prev = null;
-        pages.forEach(p => {
-            if (p === '...') {
-                if (prev !== '...') {
-                    container.append('<span class="ellipsis">...</span>');
-                    prev = '...';
-                }
-            } else {
-                addButton(p, p, p === current);
-                prev = p;
-            }
-        });
-
-        addButton('下一页', current + 1, false, current === totalPages);
-    }
-
-    // 行点击切换勾选 + 高亮
-    $(document).on('click', '#productTable tbody tr', function (e) {
-        if (!$(e.target).is('input')) {
-            const checkbox = $(this).find('.row-check');
-            checkbox.prop('checked', !checkbox.prop('checked'));
-        }
-        $(this).toggleClass('selected');
-    });
-
-    // 勾选框勾选联动行背景
-    $(document).on('change', '.row-check', function () {
-        const tr = $(this).closest('tr');
-        tr.toggleClass('selected', $(this).is(':checked'));
-    });
-
-    // 全选/取消全选
-    $('#checkAll').on('change', function () {
-        const checked = $(this).is(':checked');
-        $('.row-check').prop('checked', checked);
-        $('#productTable tbody tr').each(function () {
-            $(this).toggleClass('selected', checked);
-        });
-    });
-
-    $('#searchInput').on('input', function () {
-        searchKey = $(this).val();
-        currentPage = 1;
-        loadData(currentPage, searchKey);
-    });
-
-    $('#pageSize').on('change', function () {
-        currentPage = 1;
-        loadData(currentPage, searchKey);
-    });
-
-    $(document).ready(function () {
-        loadData();
-    });
-
-    $('#addBtn').on('click', function () {
-        var contentHtml = `
-    <form id="addForm" style="padding: 20px 30px;" class="form-horizontal">
-        <div class="form-group" style="display: flex; align-items: center; margin-bottom: 15px;">
-            <label style="width: 90px;">工单编号</label>
-            <input type="text" name="order_ddbh" class="form-control" style="flex:1;" required />
-        </div>
-        <div class="form-group" style="display: flex; align-items: center; margin-bottom: 15px;">
-            <label style="width: 90px;">销售订单号</label>
-            <input type="text" name="jjcp_gdbh" class="form-control" style="flex:1;" required />
-        </div>
-        <div class="form-group" style="display: flex; align-items: center; margin-bottom: 15px;">
-            <label style="width: 90px;">产品代号</label>
-            <input type="text" name="jjcp_cpdh" class="form-control" style="flex:1;" required />
-        </div>
-        <div class="form-group" style="display: flex; align-items: center; margin-bottom: 15px;">
-            <label style="width: 90px;">产品名称</label>
-            <input type="text" name="jjcp_cpmc" class="form-control" style="flex:1;" required />
-        </div>
-        <div class="form-group" style="display: flex; align-items: center;">
-            <label style="width: 90px;">数量</label>
-            <input type="number" name="jjcp_sl" class="form-control" style="flex:1;" required />
-        </div>
-    </form>`;
-
-        layer.open({
-            type: 1,
-            title: '新增入库记录',
-            area: ['50%', '50%'],       // 初始窗口大小
-            shadeClose: true,               // 点击遮罩关闭
-            resize: true,                   // 允许拉伸
-            maxmin: true,                   // 显示最大化/最小化按钮
-            btn: ['入库', '取消'],
-            content: contentHtml,
-            yes: function (index) {
-                var formData = {};
-                $('#addForm').serializeArray().forEach(function (item) {
-                    formData[item.name] = item.value.trim();
-                });
-
-                // 简单校验
-                if (!formData.order_ddbh || !formData.jjcp_gdbh || !formData.jjcp_cpdh || !formData.jjcp_cpmc || !formData.jjcp_sl) {
-                    layer.msg('请填写所有字段');
-                    return;
-                }
-
-                $.ajax({
-                    method: "POST",
-                    url: "Finishedproduct/finished",
-                    contentType: "application/json",
-                    data: JSON.stringify({ data: [formData] }), // 注意:加了中括号 []
-                    success: function () {
-                        layer.msg('入库成功!');
-                        layer.close(index);
-                        loadData();
-                    },
-                    error: function () {
-                        layer.msg('入库失败!');
-                    }
-                });
-            }
-        });
-    });
-</script>
-
-</body>
-</html>

+ 327 - 252
application/admin/view/qcode_add/index.html

@@ -14,8 +14,11 @@
     .select2-container--default .select2-selection--single .select2-selection__clear{
         margin-top: -6px;
     }
+    .select2-container--default .select2-selection--single .select2-selection__rendered{
+        line-height: 35px;
+    }
     .select2-container--default .select2-selection--single{
-        width: 400px !important;
+        width: 470px !important;
         height: 35px !important;
         line-height: 38px;
         padding: 4px 10px;
@@ -30,6 +33,76 @@
     .selection{
         top: -13px;
     }
+    /*table部分*/
+    .selected-row {
+        /*background-color: yellow !important;*/
+        background-color: #ddefeb !important;
+    }
+    #pagination-wrapper {
+        margin-top: 20px;
+        font-family: Arial, sans-serif;
+        text-align: center;
+    }
+
+    #pagination-bar {
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        flex-wrap: nowrap;
+        gap: 16px; /* 控制 info 和按钮间距 */
+        white-space: nowrap;
+        overflow-x: auto; /* 小屏幕自动横向滚动,防止换行 */
+    }
+
+    #pagination-info {
+        color: #444;
+    }
+
+    #pagination-controls {
+        display: inline-flex;
+        gap: 8px;
+        flex-wrap: nowrap;
+    }
+
+    #pagination-controls button {
+        padding: 6px 12px;
+        border: 1px solid #ccc;
+        background-color: #f8f8f8;
+        cursor: pointer;
+        border-radius: 4px;
+        transition: all 0.2s ease;
+    }
+
+    #pagination-controls button:hover:not(:disabled) {
+        background-color: #e0e0e0;
+    }
+
+    #pagination-controls button:disabled {
+        background-color: #f0f0f0;
+        cursor: not-allowed;
+        color: #aaa;
+    }
+
+    #pagination-controls button.active {
+        background-color: #007bff;
+        color: white;
+        font-weight: bold;
+        border-color: #007bff;
+    }
+    #table-container {
+        height: 300px; /* 你可以按需调整高度 */
+        overflow-y: auto;
+        border: 1px solid #ccc;
+        margin-bottom: 10px;
+    }
+
+    /* 让表头固定,表体滚动(可选进阶) */
+    #table thead th {
+        position: sticky;
+        top: 0;
+        background-color: #f5f5f5;
+        z-index: 1;
+    }
 </style>
 <form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
     <fieldset style="width: 1200px;margin:10px 10px 0px 10px ;padding: 10px 10px 0px 10px ;border:solid thin #c0c0c0">
@@ -61,144 +134,118 @@
     </fieldset>
 
     <fieldset style="width: 1200px;margin:10px 10px 0px 10px ;padding: 10px 10px 0px 10px ;border: solid thin #c0c0c0">
-        <legend  style="padding: 0px;margin: 0px">辅料信息</legend>
-        <div class="form-group">
-            <label for="c-product_name" class="control-label col-xs-2 col-sm-2">辅料名称(产品名称)</label>
-            <div class="col-xs-2 col-sm-4">
-                <select class="form-control select2" id="c-product_name" name="product_name">
-                    <option value="">==================>选择<===================</option>
-                    {volist name='product' id='vo'}
-                    <option value="{$vo.product_code}" data-order-ddbh="{$vo.order_ddbh}" data-jjcp-gdbh="{$vo.jjcp_gdbh}" data-jjcp-sl="{$vo.jjcp_sl}" data-cpdh="{$vo.jjcp_cpdh}">{$vo.jjcp_cpmc}</option>
-                    {/volist}
-                </select>
-            </div>
-            <label class="control-label col-xs-2 col-sm-1">辅料代码</label>
-            <div class="col-xs-2 col-sm-4">
-                <input type="text" disabled class="form-control" id="c-product_code" name="product_code">
+        <legend style="padding: 0px;margin: 0px">产品信息</legend>
+        <!-- 搜索栏 -->
+        <div style="margin-bottom: 10px;">
+            <input type="text" id="searchInput"  placeholder="请输入关键字搜索..." style="width: 300px;height: 35px; " />
+            <button id="searchBtn"  class="btn btn-primary">搜索</button>
+        </div>
+
+        <!-- 表格容器 -->
+        <div id="table-container">
+        <table id="table" border="1" cellpadding="8" cellspacing="0" style="width: 100%;border-collapse: collapse;">
+            <thead>
+            <tr>
+                <th>销售订单号</th>
+                <th>工单编号</th>
+                <th>产品名称</th>
+                <th>结存数量</th>
+            </tr>
+            </thead>
+            <tbody id="tableBody">
+
+            </tbody>
+        </table>
+        </div>
+        <!-- 分页控件 -->
+        <div id="pagination-wrapper">
+            <div id="pagination-bar">
+                <div id="pagination-info">共 0 条记录,第 1 / 1 页</div>
+                <div id="pagination-controls"></div>
             </div>
         </div>
     </fieldset>
+
     <fieldset style="width: 1200px;margin:10px 10px 0px 10px ;padding: 10px 10px 0px 10px ;border: solid thin #c0c0c0">
-        <legend  style="padding: 0px;margin: 0px">标记参数</legend>
-        <table style="width: 100%;border: thin #ddd dashed">
+        <legend  style="padding: 0px;margin: 0px">托盘参数</legend>
+        <table style="width: 100%;border: thin #ddd dashed;">
             <caption style="padding: 0px;margin: 0px">标签序列配置</caption>
             <tr>
                 <th style="width: 40%">字段</th>
                 <th>值</th>
             </tr>
+
+            <tr>
+                <td><span>生产批次号</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" placeholder="选择产品信息获取" id="c-batch" name="batch" style="width: 360px;"></td>
+            </tr>
             <tr>
-                <td><span>请选择单位</span></td>
+                <td><span>销售订单号</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" placeholder="选择产品信息获取" id="c-order_ddbh" name="order_ddbh" style="width: 360px;"></td>
+            </tr>
+            <tr>
+                <td><span>工单编号</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" placeholder="选择产品信息获取" id="c-gdbh" name="gdbh" style="width: 360px;"></td>
+            </tr>
+            <tr>
+                <td><span>产品名称</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" placeholder="选择产品信息获取" id="c-cpmc" name="cpmc" style="width: 360px;"></td>
+            </tr>
+            <tr>
+                <td><span>结存数量</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" placeholder="选择产品信息获取" id="c-sl" name="sl" style="width: 360px;"></td>
+            </tr>
+<!--            <tr>-->
+<!--                <td><span>产品代号</span></td>-->
+<!--                <td style="padding: 5px 0px 0px 5px"><input type="text" disabled class="form-control" id="c-cpdh" name="cpdh" style="width: 360px;"></td>-->
+<!--            </tr>-->
+            <tr class="xiang">
+                <td><span>总数量(张)</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" name="number" id="c-number" data-rule="required"></td>
+            </tr>
+            <tr>
+                <td><span>选择单位</span></td>
                 <td style="padding: 5px 0px 0px 5px">
                     <select id="danwei" name="danwei" style="width: 200px;padding: 5px;">
                         <option value="1">张</option>
-<!--                        <option value="2">卷</option>-->
+                        <!--<option value="2">卷</option>-->
                     </select>
                 </td>
             </tr>
-            <tr class="xiang">
-                <td><span>总数量(个或张)</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" name="number" id="c-number" data-rule="required"></td>
-            </tr>
             <tr class="xiang">
                 <td><span>一托盘多少箱(箱*层)</span></td>
                 <td style="padding: 5px 0px 0px 5px">
-                    <input type="text" id="tray_num" placeholder="" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 箱/层 ×
-                    <input type="text" id="box_number"  placeholder="" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 层/托 =
-<!--                    <input type="text" id="boxes_per_layer" placeholder="箱数" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 箱 ×-->
-<!--                    <input type="text" id="layers_per_tray" placeholder="层数" style="width: 100px;" oninput="calculateTotalBoxes()" min="1" step="1"> 层 =-->
-                    <input type="text" id="total_boxes" disabled placeholder="" style="width: 100px;" readonly> 箱/托
+                    <input type="text" id="tray_num"     oninput="calculateTotalBoxes()" style="width: 100px;" min="1" step="1" > 箱/层 ×
+                    <input type="text" id="box_number"   oninput="calculateTotalBoxes()" style="width: 100px;"  min="1" step="1" > 层/托 =
+                    <input type="text" id="total_boxes"  style="width: 100px;" disabled> 箱/托
+                    <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
-            <!--            <tr class="xiang">-->
-<!--                <td><span>一托盘多少箱(包)</span></td>-->
-<!--                <td style="padding: 5px 0px 0px 5px">-->
-<!--                    <select name="tray_num" id="tray_num" style="width: 200px;padding: 5px;">-->
-<!--                        <option value="1">========>选择<========</option>-->
-<!--                        <option value="5">========>5层<========</option>-->
-<!--                        <option value="24">========>24箱<========</option>-->
-<!--                        <option value="28">========>28箱<========</option>-->
-<!--                        <option value="32">========>32箱<========</option>-->
-<!--                        <option value="40">========>40箱<========</option>-->
-<!--                        <option value="42">========>42箱<========</option>-->
-<!--                        <option value="48">========>48箱<========</option>-->
-<!--                        <option value="60">========>60箱<========</option>-->
-<!--                        <option value="64">========>64箱<========</option>-->
-<!--                        <option value="72">========>72箱<========</option>-->
-<!--                        <option value="80">========>80箱<========</option>-->
-<!--                        <option value="96">========>96箱<========</option>-->
-<!--                        <option value="105">========>105箱<========</option>-->
-<!--                        <option value="108">========>108箱<========</option>-->
-<!--                        <option value="144">========>144箱<========</option>-->
-<!--                        <option value="180">========>180箱<========</option>-->
-<!--                        <option value="240">========>240箱<========</option>-->
-<!--                    </select>-->
-<!--                </td>-->
-<!--            </tr>-->
-<!--            <tr class="xiang">-->
-<!--                <td><span>一托盘多少箱(箱*层)</span></td>-->
-<!--                <td style="padding: 5px 0px 0px 5px">-->
-<!--                    <select name="box_number" id="box_numbers" style="width:200px;padding: 5px">-->
-<!--                        <option value="1">========选择=========</option>-->
-<!--                        <option value="25">========25========</option>-->
-<!--                        <option value="50">========50========</option>-->
-<!--                        <option value="250">========250张========</option>-->
-<!--                        <option value="500">========500张========</option>-->
-<!--                        <option value="1000">=======1000张========</option>-->
-<!--                        <option value="2000">=======2000张========</option>-->
-<!--                        <option value="2500">=======2500张========</option>-->
-<!--                        <option value="3000">=======3000张========</option>-->
-<!--                        <option value="4000">=======4000张========</option>-->
-<!--                        <option value="5000">=======5000张========</option>-->
-<!--                        <option value="8000">=======8000张========</option>-->
-<!--                        <option value="10000">=======10000张========</option>-->
-<!--                        <option value="24000">=======24000张========</option>-->
-<!--                    </select>-->
-<!--                </td>-->
-<!--            </tr>-->
-
             <tr>
                 <td><span>每箱数(个或张)</span></td>
                 <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-small_num" disabled name="small_num" data-rule="required"></td>
             </tr>
-<!--            <tr class="juan">-->
-<!--                <td><span>一托盘多少卷(3位)</span></td>-->
-<!--                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-volume_num" name="volume_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>-->
-<!--            </tr>-->
-
-
             <tr>
                 <td><span>每层箱数</span></td>
                 <td style="padding: 5px 0px 0px 5px">
                     <input type="text" id="boxes_per_layer" name="boxes_per_layer" data-rule="required" disabled>
-                    <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
-
             <tr>
                 <td><span>每托层数</span></td>
                 <td style="padding: 5px 0px 0px 5px">
                     <input type="text" id="layers_per_pallet" name="layers_per_pallet" data-rule="required" disabled>
-                    <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
-
             <tr>
                 <td><span>每托高度</span></td>
                 <td style="padding: 5px 0px 0px 5px; position: relative;">
                     <input type="text" id="pallet_height" name="pallet_height"
-                           style="width: 160px;" placeholder="可选择或输入" autocomplete="off">
-                    <ul id="height-suggestions" style="
-                                position: absolute;
-                                top: 33px;
-                                left: 5px;
-                                width: 160px;
-                                border: 1px solid #ccc;
-                                background: #fff;
-                                list-style: none;
-                                margin: 0;
-                                padding: 0;
-                                display: none;
-                                z-index: 1000;">
+                           style="width: 160px;" placeholder="" autocomplete="off">
+                    <ul id="height-suggestions" style=" position: absolute;
+                                top: 33px; left: 5px; width: 160px;
+                                border: 1px solid #ccc; background: #fff; list-style: none;
+                                margin: 0; padding: 0; display: none; z-index: 1000;">
                         <li style="padding: 5px; cursor: pointer;">0.995</li>
                         <li style="padding: 5px; cursor: pointer;">1.05</li>
                         <li style="padding: 5px; cursor: pointer;">1.35</li>
@@ -207,34 +254,23 @@
                 </td>
             </tr>
 
-<!--            <tr>-->
-<!--                <td><span>托盘规格(例如:0.9 * 1.2)</span></td>-->
-<!--                <td style="padding: 5px 0px 0px 5px">-->
-<!--                    <input type="text" id="pallet_length" name="pallet_length" style="width:80px;" data-rule="required">-->
-<!--                    &nbsp;-->
-<!--                    *-->
-<!--                    &nbsp;-->
-<!--                    <input type="text" id="pallet_width" name="pallet_width" style="width:80px;" data-rule="required">-->
-<!--                    <span style="color: red;font-size: 23px;"> *</span>-->
-<!--                </td>-->
-<!--            </tr>-->
             <tr>
                 <td><span>托盘规格(例如:0.9 * 1.2)</span></td>
                 <td style="padding: 5px 0px 0px 5px; position: relative;">
                     <div style="display: inline-block; position: relative;">
-                        <input type="text" id="pallet_length" name="pallet_length" style="width:80px;" placeholder="" autocomplete="off">
+                        <input type="text" id="pallet_length" name="pallet_length" style="width:80px;" autocomplete="off">
                         <ul id="length-suggestions" style="
-                position: absolute;
-                top: 28px;
-                left: 0;
-                width: 80px;
-                border: 1px solid #ccc;
-                background: #fff;
-                list-style: none;
-                margin: 0;
-                padding: 0;
-                display: none;
-                z-index: 1000;">
+                                position: absolute;
+                                top: 28px;
+                                left: 0;
+                                width: 80px;
+                                border: 1px solid #ccc;
+                                background: #fff;
+                                list-style: none;
+                                margin: 0;
+                                padding: 0;
+                                display: none;
+                                z-index: 1000;">
                             <li style="padding: 5px; cursor: pointer;">0.9</li>
                             <li style="padding: 5px; cursor: pointer;">1.0</li>
                             <li style="padding: 5px; cursor: pointer;">1.1</li>
@@ -244,19 +280,19 @@
                     *
                     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     <div style="display: inline-block; position: relative;">
-                        <input type="text" id="pallet_width" name="pallet_width" style="width:80px;"  placeholder="" autocomplete="off">
+                        <input type="text" id="pallet_width" name="pallet_width" style="width:80px;"   autocomplete="off">
                         <ul id="width-suggestions" style="
-                position: absolute;
-                top: 28px;
-                left: 0;
-                width: 80px;
-                border: 1px solid #ccc;
-                background: #fff;
-                list-style: none;
-                margin: 0;
-                padding: 0;
-                display: none;
-                z-index: 1000;">
+                                position: absolute;
+                                top: 28px;
+                                left: 0;
+                                width: 80px;
+                                border: 1px solid #ccc;
+                                background: #fff;
+                                list-style: none;
+                                margin: 0;
+                                padding: 0;
+                                display: none;
+                                z-index: 1000;">
                             <li style="padding: 5px; cursor: pointer;">1.1</li>
                             <li style="padding: 5px; cursor: pointer;">1.2</li>
                             <li style="padding: 5px; cursor: pointer;">1.3</li>
@@ -265,14 +301,10 @@
                     <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
-
-
             <tr>
                 <td><span>大件(总托数)</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-box_num" name="box_num" data-rule="required"><span style="color: red;font-size: 23px;"> *</span></td>
+                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-box_num" name="box_num" ><span style="color: red;font-size: 23px;"> *</span></td>
             </tr>
-
-
             <tr>
                 <td><span>生产日期</span></td>
                 <td style="padding: 5px 0px 0px 5px">
@@ -287,24 +319,16 @@
                     <span style="color: red;font-size: 23px;"> *</span>
                 </td>
             </tr>
-            <tr>
-                <td><span>产品代号</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-jjcp_cpdh" name="jjcp_cpdh" disabled data-rule="required"></td>
-            </tr>
-            <tr>
-                <td><span>销售订单号</span></td>
-                <td style="padding: 5px 0px 0px 5px"><input type="text" id="c-order_ddbh" name="order_ddbh" disabled data-rule="required"></td>
-            </tr>
-            <tr>
-                <td><span>生产批次号</span></td>
-                <td>
-                    <div style="display: flex; align-items: center;">
-                        <input type="text" name="batch" id="c-batch" data-rule="required" disabled>
-                        <button type="button" id="reset_batch" style="margin-left: 10px;">重置批次号</button>
-                        <span style="color: red; font-size: 23px; margin-left: 5px;">*</span>
-                    </div>
-                </td>
-            </tr>
+<!--            <tr>-->
+<!--                <td><span>生产批次号</span></td>-->
+<!--                <td>-->
+<!--                    <div style="display: flex; align-items: center;">-->
+<!--                        <input type="text" name="batch" id="c-batch" data-rule="required" disabled>-->
+<!--                        &lt;!&ndash;                        <button type="button" id="reset_batch" style="margin-left: 10px;">重置批次号</button>&ndash;&gt;-->
+<!--                        <span style="color: red; font-size: 23px; margin-left: 5px;">*</span>-->
+<!--                    </div>-->
+<!--                </td>-->
+<!--            </tr>-->
             <tr>
                 <td><span>大件开始流水号</span></td>
                 <td>
@@ -329,23 +353,20 @@
             </tr>
         </table>
     </fieldset>
+
     <div class="form-group layer-footer">
         <label class="control-label col-xs-12 col-sm-5"></label>
-        <div class="col-xs-12 col-sm-5">
-            <br>
-            <button type="submit" id="submit" class="btn btn-primary btn-embossed">{:__('保存')}</button>
-        </div>
+        <div class="col-xs-12 col-sm-5"><br>
+            <button type="submit" id="submit" class="btn btn-primary btn-embossed">保存</button></div>
     </div>
 </form>
 <!-- 引入 select2 样式 -->
 <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
-
 <!-- 引入 jQuery -->
 <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
-
 <!-- 引入 select2 JS -->
 <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
-
+<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
 <script>
     $(function() {
         const $input = $('#pallet_height');
@@ -368,13 +389,152 @@
         });
     });
 
+        let currentPage = 1;
+        let limit = 10;
+        let total = 0;
+        let selectedRow = null;
+
+        // 绑定全局选择函数
+        window.selectRow = function (row) {
+        if (selectedRow) {
+        $(selectedRow).removeClass('selected-row');
+    }
+        $(row).addClass('selected-row');
+        selectedRow = row;
+
+        const rowData = {
+        gdbh: $(row).data('gdbh'),
+        order_ddbh: $(row).data('order_ddbh'),
+        // cpdh: $(row).data('cpdh'),
+        cpmc: $(row).data('cpmc'),
+        sl: $(row).data('sl')
+    };
+
+        console.log('选中的行数据:', rowData);
+
+        $('#c-order_ddbh').val(rowData['order_ddbh']);
+        $('#c-gdbh').val(rowData['gdbh']);
+        // $('#c-cpdh').val(rowData['cpdh']);
+        $('#c-cpmc').val(rowData['cpmc']);
+        $('#c-sl').val(rowData['sl']);
+        $('#c-batch').val(rowData['gdbh']);
+    };
+
+        function loadData(page = 1, keyword = '') {
+        $.ajax({
+            method: "GET",
+            url: "/qcode_add/product", // 替换成你的接口路径
+            data: {
+                page: page,
+                limit: limit,
+                search: keyword
+            },
+            dataType: "json",
+            success: function (res) {
+                const data = res.data || [];
+                total = res.total || 0;
+                currentPage = res.page || 1;
+                limit = res.limit || 10;
+
+                const tbody = $('#tableBody');
+                tbody.empty();
+                selectedRow = null;
+
+                if (!Array.isArray(data) || data.length === 0) {
+                    tbody.append('<tr><td colspan="5">无数据</td></tr>');
+                    return;
+                }
+
+                data.forEach(item => {
+                    const tr = $(`
+                        <tr onclick="selectRow(this)"
+                            data-order_ddbh="${item.order_ddbh || ''}"
+                            data-gdbh="${item.gdbh || ''}"
+                            data-cpmc="${item.cpmc || ''}"
+                            data-sl="${item.sl || ''}">
+                            <td>${item.order_ddbh || ''}</td>
+                            <td>${item.gdbh || ''}</td>
+                            <td>${item.cpmc || ''}</td>
+                            <td>${item.sl || ''}</td>
+                        </tr>`);
+                    tbody.append(tr);
+                });
+
+                renderPagination();
+            }
+        });
+    }
+
+    function renderPagination() {
+        const pageCount = Math.ceil(total / limit);
+        const info = $('#pagination-info');
+        const wrapper = $('#pagination-controls');
+        const keyword = $('#searchInput').val().trim();
+
+        wrapper.empty();
+        info.text(`共 ${total} 条记录,第 ${currentPage} / ${pageCount} 页`);
+
+        // 上一页按钮
+        const prev = $('<button type="button">上一页</button>').prop('disabled', currentPage <= 1);
+        prev.on('click', (e) => {
+            e.preventDefault();
+            e.stopPropagation(); // 防止事件冒泡
+            loadData(currentPage - 1, keyword);
+        });
+        wrapper.append(prev);
+
+        // 页码按钮
+        const start = Math.max(1, currentPage - 1);
+        const end = Math.min(pageCount, currentPage + 1);
+        for (let i = start; i <= end; i++) {
+            const btn = $('<button type="button"></button>').text(i);
+            if (i === currentPage) btn.addClass('active');
+            btn.on('click', (e) => {
+                e.preventDefault();
+                e.stopPropagation();
+                loadData(i, keyword);
+            });
+            wrapper.append(btn);
+        }
+
+        // 下一页按钮
+        const next = $('<button type="button">下一页</button>').prop('disabled', currentPage >= pageCount);
+        next.on('click', (e) => {
+            e.preventDefault();
+            e.stopPropagation();
+            loadData(currentPage + 1, keyword);
+        });
+        wrapper.append(next);
+    }
+
+
+    //搜索按钮
+    $('#searchBtn').on('click', function (e) {
+        e.preventDefault();
+        const keyword = $('#searchInput').val().trim();
+        loadData(1, keyword);
+    });
+    //搜索input框
+    $('#searchInput').on('keypress', function (e) {
+        if (e.which === 13) {
+            const keyword = $('#searchInput').val().trim();
+            loadData(1, keyword);
+        }
+    });
+
+    $(function () {
+        loadData(1);
+    });
+
     function allowNumberAndDot(input) {
         input.value = input.value.replace(/[^\d.]/g, '')    // 只保留数字和小数点
-            .replace(/^\./g, '')      // 开头不能是小数点
-            .replace(/\.{2,}/g, '.')  // 不能连续两个点
-            .replace(/(\.\d*)\./g, '$1'); // 只允许一个小数点
+        .replace(/^\./g, '')      // 开头不能是小数点
+        .replace(/\.{2,}/g, '.')  // 不能连续两个点
+        .replace(/(\.\d*)\./g, '$1'); // 只允许一个小数点
     }
 
+
+    //托盘规格
     $('#pallet_length, #pallet_width').on('input', function() {
         allowNumberAndDot(this);
     });
@@ -386,7 +546,6 @@
         $('#pallet_length').val($(this).text());
         $('#length-suggestions').hide();
     });
-
     // 绑定 pallet_width 的下拉选择
     $('#pallet_width').on('focus input', function () {
         $('#width-suggestions').show();
@@ -395,7 +554,6 @@
         $('#pallet_width').val($(this).text());
         $('#width-suggestions').hide();
     });
-
     // 点击空白区域时隐藏建议框
     $(document).on('click', function (e) {
         if (!$(e.target).closest('#pallet_length, #length-suggestions').length) {
@@ -406,12 +564,11 @@
         }
     });
 
-
+    //一托盘多少箱
     function calculateTotalBoxes() {
         const boxesPerLayer = parseInt(document.getElementById("tray_num").value) || 0;
         const layersPerTray = parseInt(document.getElementById("box_number").value) || 0;
         const totalBoxes = boxesPerLayer * layersPerTray;
-        console.log("totalBoxes".totalBoxes)
         document.getElementById("total_boxes").value = totalBoxes;
 
         var trayNum1 = $('#tray_num').val();
@@ -427,86 +584,4 @@
         $('#c-small_num').val(trayNum3 ? trayNum3 : '');
     }
 
-    $('#c-product_name').on('change', function () {
-        // 获取选中的选项
-        var selectedOption = $(this).find('option:selected');
-
-        // 获取对应的数据
-        var orderDdbh = selectedOption.data('order-ddbh');
-        var jjcpGdbh = selectedOption.data('jjcp-gdbh');
-        var jjcpSl = selectedOption.data('jjcp-sl');
-        var product_code = selectedOption.val();  // 获取产品编码
-        var cpdh = selectedOption.data('cpdh');   // 获取产品代号
-        console.log(orderDdbh)
-        // 设置产品编码和产品代号到对应的输入框
-        $('#c-product_code').val(product_code);
-        $('#c-jjcp_cpdh').val(cpdh);
-
-        // 填充销售订单号输入框
-        $('#c-order_ddbh').val(orderDdbh);
-
-        // 发起 AJAX 请求获取产品信息
-        $.ajax({
-            method: "GET",
-            url: 'qcode_add/product',
-            data: { product_code: product_code },
-            success: function (data) {
-                console.log(data)
-                // 根据返回的模板值判断单位显示
-                // if (data.temple === '07') {
-                    $('#danwei').val(1);
-                    $('.juan').hide();
-                    $('.xiang').show();
-                // } else {
-                //     $('#danwei').val(2);
-                //     $('.xiang').hide();
-                //     $('.juan').show();
-                // }
-
-                // 设置流水号字段,如果为空则默认设置为 1
-                $('#c-big_liushui').val(data.data.flow || 1);
-                // 设置批次号字段,如果为空则生成当前年份的默认批次号
-                if (data.data.bach === '' || data.data.bach === undefined) {
-                    var currentYear = new Date().getFullYear();
-                    var newValue = currentYear + '000000';
-                    $('#c-batch').removeAttr('disabled').val(newValue);
-                } else {
-                    $('#c-batch').val(data.data.bach);
-                    $('#c-batch').attr('disabled', true);
-                }
-            },
-            error: function () {
-                console.log("加载数据失败!");
-            }
-        });
-    });
-
-    $('#c-product_name').select2({
-        placeholder: "请选择辅料名称",
-        allowClear: true,
-        width: 'style',
-        dropdownAutoWidth: false,
-        language: {
-            noResults: function () {
-                return "未查询到结果";
-            }
-        },
-        matcher: function(params, data) {
-            if ($.trim(params.term) === '') {
-                return data;
-            }
-
-            if (typeof data.text === 'undefined') {
-                return null;
-            }
-
-            // 模糊匹配:忽略大小写
-            if (data.text.toLowerCase().indexOf(params.term.toLowerCase()) > -1) {
-                return data;
-            }
-
-            return null;
-        }
-    });
-
 </script>

+ 5 - 4
application/admin/view/qcode_product/index.html

@@ -11,10 +11,11 @@
                     <div class="widget-body no-padding">
                         <div id="toolbar1" class="toolbar">
                             {:build_toolbar('refresh')}
-                            <a href="javascript:;" id="bind" class="btn btn-success btn-disabled disabled {:$auth->check('qcode_product/bind')?'':'hide'}" title="增加产品" ><i class="fa fa-plus"></i> 增加产品</a>
-                            <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('qcode_product/add')?'':'hide'}" data-area='["800px","500px"]' title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
-                            <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('qcode_product/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>
-                            <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('qcode_product/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                            <a href="javascript:;" id="bind" class="btn btn-success btn-operate" title="增加产品" ><i class="fa fa-plus"></i> 增加产品</a>
+<!--                            <a href="javascript:;" id="bind" class="btn btn-success btn-disabled disabled {:$auth->check('qcode_product/bind')?'':'hide'}" title="增加产品" ><i class="fa fa-plus"></i> 增加产品</a>-->
+<!--                            <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('qcode_product/add')?'':'hide'}" data-area='["800px","500px"]' title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>-->
+<!--                            <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('qcode_product/edit')?'':'hide'}" title="{:__('Edit')}" ><i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
+<!--                            <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('qcode_product/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
 
                         </div>
                         <table id="table1" class="table table-striped table-bordered table-hover" width="100%">

+ 54 - 0
application/admin/view/user/user/chuku.html

@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+    <title>出库明细</title>
+    <link rel="stylesheet" href="/assets/css/backend.css">
+    <style>
+        .table-footer {
+            font-weight: bold;
+            background-color: #f9f9f9;
+        }
+        .text-right {
+            text-align: right;
+        }
+    </style>
+</head>
+<body>
+<div class="panel panel-default">
+    <div class="panel-body">
+        <table class="table table-bordered table-striped table-hover">
+            <thead>
+            <tr>
+                <th>序号</th>
+                <th>销售订单号</th>
+                <th>工单编号</th>
+                <th>产品名称</th>
+                <th>出库数量</th>
+                <th>出库时间</th>
+            </tr>
+            </thead>
+            <tbody>
+            {volist name="list" id="row" key="k"}
+            <tr>
+                <td>{$k}</td>
+                <td>{$row.order_ddbh}</td>
+                <td>{$row.gdbh}</td>
+                <td>{$row.cpmc}</td>
+                <td>{$row.total_chu_quantity}</td>
+                <td>{$row.created_at}</td>
+            </tr>
+            {/volist}
+            </tbody>
+            <tfoot>
+            <tr class="table-footer">
+                <td colspan="4" class="text-right"><strong>本页合计:</strong></td>
+                <td><strong>{$total_sl}</strong></td>
+                <td></td>
+            </tr>
+            </tfoot>
+        </table>
+    </div>
+</div>
+</body>
+</html>

+ 537 - 20
application/admin/view/user/user/index.html

@@ -1,28 +1,545 @@
-<div class="panel panel-default panel-intro">
-    {:build_heading()}
-
-    <div class="panel-body">
-        <div id="myTabContent" class="tab-content">
-            <div class="tab-pane fade active in" id="one">
-                <div class="widget-body no-padding">
-                    <div id="toolbar" class="toolbar">
-                        {:build_toolbar('refresh,edit,del')}
-                        <div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">
-                            <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
-                            <ul class="dropdown-menu text-left" role="menu">
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
-                                <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
-                            </ul>
+<style>
+    .form-commonsearch .form-group {
+        margin-left: 0;
+        margin-right: 0;
+        padding: 0;
+    }
+
+    form.form-commonsearch .control-label {
+        padding-right: 0;
+    }
+
+    .tdtitle {
+        margin-bottom: 5px;
+        font-weight: 600;
+    }
+
+    #channeltree {
+        margin-left: -6px;
+    }
+
+    #channelbar .panel-heading {
+        height: 55px;
+        line-height: 25px;
+        font-size: 14px;
+    }
+
+    @media (max-width: 1230px) {
+        .fixed-table-toolbar .search .form-control {
+            display: none;
+        }
+    }
+
+    @media (min-width: 1200px) {
+    }
+
+    .archives-label span.label {
+        font-weight: normal;
+    }
+
+    .archives-title {
+        max-width: 400px;
+        min-width: 200px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
+
+    .setflag label {
+        font-weight: 400;
+    }
+
+    .nav > li.toggle-channel {
+        display: none;
+    }
+
+    .col-full-width .nav > li.toggle-channel {
+        display: inline-block;
+    }
+
+    #myTabContent {
+        background-color: #fff;
+    }
+
+    #channeloperate > span {
+        font-size: 14px;
+        color: #777;
+    }
+
+    #channeloperate > span:first-child {
+        margin-right: 10px;
+    }
+
+    #channeloperate > span label {
+        font-weight: 400;
+    }
+
+    .row-eq-height {
+        display: -webkit-box;
+        display: -webkit-flex;
+        display: -ms-flexbox;
+        display: flex;
+    }
+
+</style>
+
+<style data-render="darktheme">
+    body.darktheme #myTabContent {
+        background-color: #333;
+    }
+
+    body.darktheme .tagsinput {
+        background-color: #3c3e3d;
+        border-color: #444;
+        color: #ccc;
+    }
+
+    body.darktheme .sim-tree a {
+        color: #ccc;
+    }
+
+    body.darktheme .sim-tree .sim-icon-d:before {
+        border-top-color: #ccc;
+    }
+
+    body.darktheme .sim-tree .sim-icon-r:before {
+        border-left-color: #ccc;
+    }
+</style>
+<style>
+    .form-commonsearch .form-group {
+        margin-left: 0;
+        margin-right: 0;
+        padding: 0;
+    }
+
+    form.form-commonsearch .control-label {
+        padding-right: 0;
+    }
+
+    .tdtitle {
+        margin-bottom: 5px;
+        font-weight: 600;
+    }
+
+    #channeltree {
+        margin-left: -6px;
+    }
+
+    #channelbar .panel-heading {
+        height: 55px;
+        line-height: 25px;
+        font-size: 14px;
+    }
+
+    @media (max-width: 1230px) {
+        .fixed-table-toolbar .search .form-control {
+            display: none;
+        }
+    }
+
+    @media (min-width: 1200px) {
+    }
+
+    .archives-label span.label {
+        font-weight: normal;
+    }
+
+    .archives-title {
+        max-width: 400px;
+        min-width: 200px;
+        overflow: hidden;
+        text-overflow: ellipsis;
+    }
+
+    .setflag label {
+        font-weight: 400;
+    }
+
+    .nav > li.toggle-channel {
+        display: none;
+    }
+
+    .col-full-width .nav > li.toggle-channel {
+        display: inline-block;
+    }
+
+    #myTabContent {
+        background-color: #fff;
+    }
+
+    #channeloperate > span {
+        font-size: 14px;
+        color: #777;
+    }
+
+    #channeloperate > span:first-child {
+        margin-right: 10px;
+    }
+
+    #channeloperate > span label {
+        font-weight: 400;
+    }
+
+    .row-eq-height {
+        display: -webkit-box;
+        display: -webkit-flex;
+        display: -ms-flexbox;
+        display: flex;
+    }
+
+    /* 树形菜单样式 */
+    .channel-tree {
+        font-size: 13px;
+        line-height: 1.4;
+    }
+
+    .tree-node {
+        position: relative;
+        padding: 0;
+        margin: 0;
+    }
+
+    .tree-item {
+        display: flex;
+        align-items: center;
+        padding: 6px 8px;
+        cursor: pointer;
+        border-radius: 3px;
+        transition: background-color 0.2s;
+        margin: 1px 0;
+    }
+
+    .tree-item:hover {
+        background-color: #f5f5f5;
+    }
+
+    .tree-item.active {
+        background-color: #3c8dbc;
+        color: white;
+    }
+
+    .tree-item.active:hover {
+        background-color: #357ca5;
+    }
+
+    .tree-toggle {
+        width: 16px;
+        height: 16px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        margin-right: 4px;
+        cursor: pointer;
+        font-size: 10px;
+        color: #666;
+    }
+
+    .tree-toggle:before {
+        content: "▶";
+        transition: transform 0.2s;
+    }
+
+    .tree-toggle.expanded:before {
+        transform: rotate(90deg);
+    }
+
+    .tree-toggle.empty {
+        visibility: hidden;
+    }
+
+    .tree-checkbox {
+        width: 16px;
+        height: 16px;
+        margin-right: 6px;
+        cursor: pointer;
+    }
+
+    .tree-icon {
+        width: 16px;
+        height: 16px;
+        margin-right: 6px;
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        font-size: 12px;
+        color: #666;
+    }
+
+    .tree-label {
+        flex: 1;
+        overflow: hidden;
+        text-overflow: ellipsis;
+        white-space: nowrap;
+    }
+
+    .tree-children {
+        margin-left: 20px;
+        display: none;
+    }
+
+    .tree-node.expanded > .tree-children {
+        display: block;
+    }
+
+    /* 连接线样式 */
+    .tree-node:before {
+        content: "";
+        position: absolute;
+        left: 8px;
+        top: 28px;
+        bottom: 0;
+        width: 1px;
+        background-color: #ddd;
+    }
+
+    .tree-node:last-child:before {
+        height: 22px;
+    }
+
+    .tree-node > .tree-item:before {
+        content: "";
+        position: absolute;
+        left: 8px;
+        top: 50%;
+        width: 12px;
+        height: 1px;
+        background-color: #ddd;
+        margin-top: -0.5px;
+    }
+
+    .tree-node.root:before,
+    .tree-node.root > .tree-item:before {
+        display: none;
+    }
+
+    /* 暗色主题支持 */
+    body.darktheme #myTabContent {
+        background-color: #333;
+    }
+
+    body.darktheme .tree-item:hover {
+        background-color: #404040;
+    }
+
+    body.darktheme .tree-item {
+        color: #ccc;
+    }
+
+    body.darktheme .tree-node:before,
+    body.darktheme .tree-node > .tree-item:before {
+        background-color: #555;
+    }
+</style>
+<link rel="stylesheet" href="__CDN__/assets/addons/cms/css/simtree.css"/>
+
+<div class="row row-eq-height">
+    <div class="col-md-3 pr-0" id="channelbar">
+        <div class="panel panel-default panel-intro" style="height: 100%;">
+            <div class="panel-heading">
+                <div class="panel-lead">
+                    <div class="pull-left">
+                        <em>产品信息</em>
+                    </div>
+                    <div class="pull-right">
+                        <a href="javascript:;" class="btn btn-link btn-xs btn-channel hidden-xs hidden-sm"><i class="fa fa-bars"></i></a>
+                    </div>
+                </div>
+            </div>
+            <div class="panel-body">
+                <div id="channeltree">
+                    <!-- 树形菜单内容 -->
+                    <div class="channel-tree">
+                        <!-- 正确的结构:每个一级节点都是独立的 tree-node -->
+                        {foreach $tree as $k=>$v}
+                        <div class="tree-node root expanded">
+                            <div class="tree-item" data-id="{$v['id']}" onclick="toggleNode(this)">
+                                <span class="tree-toggle {if !empty($v['children'])}expanded{else}empty{/if}" onclick="event.stopPropagation(); toggleNode(this.parentNode)"></span>
+                                <span class="tree-label">{$v['name']}</span>
+                            </div>
+
+                            {if !empty($v['children'])}
+                            <div class="tree-children">
+                                <!-- 二级节点 -->
+                                {foreach $v["children"] as $kk=>$vv}
+                                <div class="tree-node expanded">
+                                    <div class="tree-item" data-id="{$vv['id']}" onclick="toggleNode(this)">
+                                        <span class="tree-toggle {if !empty($vv['children'])}expanded{else}empty{/if}" onclick="event.stopPropagation(); toggleNode(this.parentNode)"></span>
+                                        <span class="tree-label">{$vv['name']}</span>
+                                    </div>
+
+                                    {if !empty($vv['children'])}
+                                    <div class="tree-children">
+                                        <!-- 三级节点 -->
+                                        {foreach $vv['children'] as $kkk=>$vvv}
+                                        <div class="tree-node">
+                                            <div class="tree-item" data-id="{$vvv['id']}" onclick='refreshTableData("{$v["id"]}", "{$vv["id"]}", "{$vvv["id"]}")'>
+                                                <span class="tree-toggle empty"></span>
+                                                <span class="tree-label">{$vvv['name']}</span>
+                                            </div>
+                                        </div>
+                                        {/foreach}
+                                    </div>
+                                    {/if}
+                                </div>
+                                {/foreach}
+                            </div>
+                            {/if}
                         </div>
+                        {/foreach}
                     </div>
-                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
-                           data-operate-edit="{:$auth->check('user/user/edit')}"
-                           data-operate-del="{:$auth->check('user/user/del')}"
-                           width="100%">
-                    </table>
                 </div>
             </div>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+        if (window.innerWidth < 768) {
+            document.getElementById('channelbar').className = document.getElementById('channelbar').className.replace("pr-0", "hidden");
+        }
+    </script>
+    <div class="col-xs-12 col-md-10" id="archivespanel">
+        <div class="panel panel-default panel-intro">
+            <div class="panel-heading">
+                {:build_heading(null,FALSE)}
+                <ul class="nav nav-tabs" data-field="status">
+                    <li class="toggle-channel"><a href="javascript:;" class="btn-channel"><i class="fa fa-bars"></i></a></li>
+
+                </ul>
+            </div>
+            <div class="panel-body">
+                <div id="myTabContent" class="tab-content">
+                    <div class="tab-pane fade active in" id="one">
+                        <div class="widget-body no-padding">
+                            <div id="toolbar" class="toolbar">
+                                {:build_toolbar('refresh,edit,del')}
+                                <div class="dropdown btn-group {:$auth->check('user/user/multi')?'':'hide'}">
+                                    <a class="btn btn-primary btn-more dropdown-toggle btn-disabled disabled" data-toggle="dropdown"><i class="fa fa-cog"></i> {:__('More')}</a>
+                                    <ul class="dropdown-menu text-left" role="menu">
+                                        <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=normal"><i class="fa fa-eye"></i> {:__('Set to normal')}</a></li>
+                                        <li><a class="btn btn-link btn-multi btn-disabled disabled" href="javascript:;" data-params="status=hidden"><i class="fa fa-eye-slash"></i> {:__('Set to hidden')}</a></li>
+                                    </ul>
+                                </div>
+                            </div>
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                                   data-operate-edit="{:$auth->check('user/user/edit')}"
+                                   data-operate-del="{:$auth->check('user/user/del')}"
+                                   width="100%">
+                            </table>
+                        </div>
+                    </div>
 
+                </div>
+            </div>
         </div>
     </div>
 </div>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
+
+<script>
+    // 切换节点展开/收起
+    function toggleNode(element) {
+        const treeNode = element.closest('.tree-node');
+        const toggle = element.querySelector('.tree-toggle') || element.closest('.tree-item').querySelector('.tree-toggle');
+
+        if (treeNode) {
+            treeNode.classList.toggle('expanded');
+
+            if (toggle && !toggle.classList.contains('empty')) {
+                toggle.classList.toggle('expanded');
+            }
+        }
+    }
+
+    // 选择节点
+    function selectNode(element, nodeId) {
+        // 移除所有活动状态
+        document.querySelectorAll('.tree-item').forEach(item => {
+            item.classList.remove('active');
+        });
+
+        // 添加当前节点的活动状态
+        element.classList.add('active');
+
+        console.log('选择了频道:', nodeId);
+
+        // 这里可以触发数据加载
+        if (typeof loadChannelData === 'function') {
+            loadChannelData(nodeId);
+        }
+
+        // 如果有FastAdmin的表格刷新方法
+        // if (typeof Table !== 'undefined' && Table.api) {
+        //     Table.api.ajax.reload();
+        // }
+    }
+
+    // 复选框变化事件
+    $(document).on('change', '.tree-checkbox', function() {
+        const checked = this.checked;
+        const treeNode = $(this).closest('.tree-node');
+
+        // 选中/取消选中所有子节点
+        treeNode.find('.tree-children .tree-checkbox').prop('checked', checked);
+
+        // 向上更新父节点状态
+        updateParentCheckbox(treeNode);
+    });
+
+    // 更新父节点复选框状态
+    function updateParentCheckbox(treeNode) {
+        const parentNode = treeNode.parent().closest('.tree-node');
+        if (parentNode.length) {
+            const siblings = parentNode.find('> .tree-children > .tree-node');
+            const checkedSiblings = siblings.find('> .tree-item .tree-checkbox:checked');
+            const parentCheckbox = parentNode.find('> .tree-item .tree-checkbox');
+
+            if (checkedSiblings.length === 0) {
+                parentCheckbox.prop('checked', false).prop('indeterminate', false);
+            } else if (checkedSiblings.length === siblings.length) {
+                parentCheckbox.prop('checked', true).prop('indeterminate', false);
+            } else {
+                parentCheckbox.prop('checked', false).prop('indeterminate', true);
+            }
+
+            updateParentCheckbox(parentNode);
+        }
+    }
+
+    // 初始化
+    $(document).ready(function() {
+        // 初始化树形结构的展开状态
+        $('.tree-node.expanded').each(function() {
+            const toggle = $(this).find('> .tree-item .tree-toggle');
+            if (!toggle.hasClass('empty')) {
+                toggle.addClass('expanded');
+            }
+        });
+    });
+    function refreshTableData(level1Id, level2Id, level3Id) {
+        // 解析参数
+        var yearMonth = level1Id; // 如:2025-06
+        var test2 = level2Id.split('_')[1]; // 如:asdf
+        var test3 = level3Id.split('_')[2]; // 如:ewww
+
+        console.log('筛选条件:', {
+            yearMonth: yearMonth,
+            test2: test2,
+            test3: test3
+        });
+
+        // 直接刷新表格,传递筛选参数
+        $("#table").bootstrapTable('refresh', {
+            query: {
+                yearMonth: yearMonth,
+                test2: test2,
+                test3: test3
+            }
+        });
+
+        // 更新选中状态
+        $('.tree-item').removeClass('active');
+        $(event.target).closest('.tree-item').addClass('active');
+    }
+</script>
+

+ 54 - 0
application/admin/view/user/user/ruku.html

@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="UTF-8">
+    <title>入库明细</title>
+    <link rel="stylesheet" href="/assets/css/backend.css">
+    <style>
+        .table-footer {
+            font-weight: bold;
+            background-color: #f9f9f9;
+        }
+        .text-right {
+            text-align: right;
+        }
+    </style>
+</head>
+<body>
+<div class="panel panel-default">
+    <div class="panel-body">
+        <table class="table table-bordered table-striped table-hover">
+            <thead>
+            <tr>
+                <th>序号</th>
+                <th>销售订单号</th>
+                <th>工单编号</th>
+                <th>产品名称</th>
+                <th>入库数量</th>
+                <th>入库时间</th>
+            </tr>
+            </thead>
+            <tbody>
+            {volist name="list" id="row" key="k"}
+            <tr>
+                <td>{$k}</td>
+                <td>{$row.order_ddbh}</td>
+                <td>{$row.gdbh}</td>
+                <td>{$row.cpmc}</td>
+                <td>{$row.sl}</td>
+                <td>{$row.sj}</td>
+            </tr>
+            {/volist}
+            </tbody>
+            <tfoot>
+            <tr class="table-footer">
+                <td colspan="4" class="text-right"><strong>本页合计:</strong></td>
+                <td><strong>{$total_sl}</strong></td>
+                <td></td>
+            </tr>
+            </tfoot>
+        </table>
+    </div>
+</div>
+</body>
+</html>

+ 63 - 0
public/assets/js/backend/area.js

@@ -0,0 +1,63 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'area/index' + location.search,
+                    add_url: 'area/add',
+                    edit_url: 'area/edit',
+                    del_url: 'area/del',
+                    multi_url: 'area/multi',
+                    import_url: 'area/import',
+                    table: 'area',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'pid', title: __('Pid')},
+                        {field: 'shortname', title: __('Shortname'), operate: 'LIKE'},
+                        {field: 'name', title: __('Name'), operate: 'LIKE'},
+                        {field: 'mergename', title: __('Mergename'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
+                        {field: 'level', title: __('Level'), searchList: {"1":__('Level 1'),"2":__('Level 2'),"3":__('Level 3')}, formatter: Table.api.formatter.normal},
+                        {field: 'pinyin', title: __('Pinyin'), operate: 'LIKE'},
+                        {field: 'code', title: __('Code'), operate: 'LIKE'},
+                        {field: 'zip', title: __('Zip'), operate: 'LIKE'},
+                        {field: 'first', title: __('First'), operate: 'LIKE'},
+                        {field: 'lng', title: __('Lng'), operate: 'LIKE'},
+                        {field: 'lat', title: __('Lat'), operate: 'LIKE'},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 189 - 191
public/assets/js/backend/deliver.js

@@ -7,6 +7,57 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             });
             Controller.api.bindevent();
         },
+        // lager: function () {
+        //     // 初始化表格参数配置
+        //     Table.api.init({
+        //         extend: {
+        //             index_url: 'deliver/lager', // 替换为你的后端接口地址
+        //         }
+        //     });
+        //
+        //     var table = $("#table");
+        //
+        //     // 初始化表格
+        //     table.bootstrapTable({
+        //         url: $.fn.bootstrapTable.defaults.extend.index_url,
+        //         toolbar: '#toolbar', // 工具栏选择器(如果有)
+        //         pk: 'id', // 主键字段
+        //         sortName: 'id', // 默认排序字段
+        //
+        //         pagination: true, // 启用分页
+        //         sidePagination: 'server', // 服务器端分页
+        //         pageSize: 10, // 每页数量
+        //         pageList: [10, 25, 50, 100], // 可选页数
+        //         search: false, // 是否启用搜索
+        //         commonSearch: true, // 是否启用 FastAdmin 搜索栏
+        //         queryParams: function (params) {
+        //             return {
+        //                 offset: params.offset,
+        //                 limit: params.limit,
+        //                 filter: JSON.stringify(params.filter), // 搜索条件
+        //                 op: JSON.stringify(params.op) // 搜索操作符
+        //             };
+        //         },
+        //
+        //         columns: [
+        //             {field: 'bach', title: '工单号'},
+        //             {field: 'tray_num', title: '托盘号'},
+        //             {field: 'matter_name', title: '物料名称'},
+        //             {field: 'bach', title: '批次号'},
+        //             {field: 'total_boxes', title: '每托箱数'},
+        //             {field: 'tray_num', title: '每层箱数'},
+        //             {field: 'box_num', title: '每托层数'},
+        //             {field: 'pallet_height', title: '每托高度'},
+        //             {field: 'larger_num', title: '总箱数'},
+        //             {field: 'manufacture_date', title: '生产日期'},
+        //             {field: 'code', title: '大件编码'},
+        //             // 添加更多字段...
+        //         ]
+        //     });
+        //
+        //     // 绑定事件
+        //     Table.api.bindevent(table);
+        // },
         lager: function () {
             // 初始化表格参数配置
             Table.api.init();
@@ -19,22 +70,24 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
               var table = $("#table");
               // 初始化表格
               table.bootstrapTable({
-                  url: 'deliver/lager',
-                  pk: 'id',
-                  height:600,
-                  sortName: 'id',
-                  pagination: false,  // 关闭分页功能
-                  toolbar:'#toolbar',
-                  searchFormVisible:true,
+                  url: 'deliver/lager',  // 请求的 URL
+                  pk: 'id',  // 主键字段
+                  height: 700,  // 表格的高度
+                  sortName: 'id',  // 默认排序字段
+                  sortOrder: 'desc',  // 默认排序顺序
+                  pageSize: 50,  // 每页显示 10 条数据
+                  pageList: [10, 25, 50, 100,'ALL'],  // 分页条数选择器
+                  searchFormVisible: true,  // 是否显示搜索框
                   onClickRow:function(row, $element, field)
                   {
+                      // 点击行事件
                       $("#myTabContent1 .form-commonsearch input[name='large_id']").val(row.id);
                       $("#myTabContent1 .btn-refresh").trigger("click");
                   },
-                  search:false,
-                  showToggle:false,
-                  showColumns:false,
-                  showExport:false,
+                  search: false,  // 禁用默认搜索框
+                  showToggle: false,  // 隐藏切换按钮
+                  showColumns: false,  // 隐藏列选择按钮
+                  showExport: false,  // 隐藏导出按钮
                   columns: [
                       [
                           {checkbox: true},
@@ -342,192 +395,137 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                                             const paperCards = totalTray * totalBox;
 
                                             let html = `
-        <div style="width: 1100px; height: 100px; position: relative;">
-            <div style="float: left">
-                <div style="width: 1000px; font-size: 28px; font-weight: bold; text-align: center; line-height: 50px;">${res.data.supplier_name}</div>
-                <div style="width: 1000px; font-size: 24px; text-align: center; line-height: 50px;">送货单</div>
-            </div>
-            <div id="qrcode" style="position: absolute; right: 100px; top: -5px; width: 105px; height: 105px;">
-                <img src="${res.data.qrcode_add}" style="width: 105px; height: 105px;" id="qrcode_image"/>
-            </div>
-        </div>
-
-        <table style="margin-bottom: 10px; width: 1186px; font-weight: 500; border-collapse: collapse;">
-            <tr>
-                <td colspan="6" style="border: none;">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>
-                <td colspan="4" style="border: none;">送货单号:<span id="shdh">${res.data.shdh}</span></td>
-            </tr>
-            <tr>
-                <td colspan="6" style="border: none;">送货地址:河南省郑州市经开区第三大街9号</td>
-                <td colspan="4" style="border: none;">送货日期:<span id="shrq_date">${res.data.shrq_date}</span></td>
-            </tr>
-        </table>
-
-        <div style="width: 1070px; font-size: 20px; text-align: center; border: 1px solid black; border-bottom: none;">
-            ${res.data.order_ddbh || ''}${res.data.note || ''}
-        </div>
-
-        <table style="width: 1070px; border-collapse: collapse; table-layout: fixed; font-size: 16px; text-align: center; margin-top: 0;">
-            <tr style="font-weight: bold;">
-                <th style="border: 1px solid black;text-align: center;">托盘序号</th>
-                <th style="border: 1px solid black;text-align: center; width: 360px;">产品名称</th>
-                <th style="border: 1px solid black;text-align: center;">每托箱数</th>
-                <th style="border: 1px solid black;text-align: center;">每层箱数</th>
-                <th style="border: 1px solid black;text-align: center;">每托层数</th>
-                <th style="border: 1px solid black;text-align: center;">每托高度</th>
-                <th style="border: 1px solid black;text-align: center;">托盘规格</th>
-                <th style="border: 1px solid black;text-align: center;">托盘数</th>
-                <th style="border: 1px solid black;text-align: center;">总箱数</th>
-            </tr>
-        `;
-
-                                            for (let i = 0; i < arr.length; i++) {
-                                                html += `
-            <tr>
-                <td style="border: 1px solid black;">第${arr[i].large_ber}托</td>
-                <td style="border: 1px solid black;">${arr[i].matter_name}</td>
-                <td style="border: 1px solid black;">${arr[i].total_boxes}</td>
-                <td style="border: 1px solid black;">${arr[i].tray_num}</td>
-                <td style="border: 1px solid black;">${arr[i].box_num}</td>
-                <td style="border: 1px solid black;">${arr[i].pallet_height}</td>
-                <td style="border: 1px solid black;">${arr[i].pallet_length} * ${arr[i].pallet_width}</td>
-                <td style="border: 1px solid black;">${arr[i].large_num}</td>
-                <td style="border: 1px solid black;">${arr[i].larger_num}</td>
-            </tr>
-            `;
-                                            }
-
-                                            const fillCount = 15 - arr.length;
-                                            for (let i = 0; i < fillCount; i++) {
-                                                html += `
-            <tr>
-                <td style="border: 1px solid black;">&nbsp;</td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-                <td style="border: 1px solid black;"></td>
-            </tr>
-            `;
-                                            }
-
-                                            html += `
-        <tr style="font-weight: bold;">
-            <td style="border: 1px solid black;">合计:</td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;"></td>
-            <td style="border: 1px solid black;">${totalTray}</td>
-            <td style="border: 1px solid black;">${totalBox}</td>
-        </tr>
-        </table>
-
-        <table style="margin-top: 20px; width: 1070px; border-collapse: collapse; font-size: 18px;">
-            <tr>
-                <td colspan="${productNames.length + 2}" style="border: 1px solid black; text-align: left;">
-                    总共出货:${totalBox} 箱 = ${totalTray} 托(手工盒子:${manualBoxes} 套,纸质卡片:${paperCards} 张)
-                </td>
-            </tr>
-            <tr>
-                <td style="border: 1px solid black; text-align: center;">产品名称</td>
-                ${productNames.map(name => `<td style="border: 1px solid black; text-align: center;">${name}</td>`).join('')}
-                <td style="border: 1px solid black; text-align: center;">合计</td>
-            </tr>
-            <tr>
-                <td style="border: 1px solid black; text-align: center;">出货数量</td>
-                ${productQuantities.map(qty => `<td style="border: 1px solid black; text-align: center;">${qty}</td>`).join('')}
-                <td style="border: 1px solid black; text-align: center;">${manualBoxes}</td>
-            </tr>
-        </table>
-
-        <div style="margin-top: 20px; font-size: 14px; font-weight: bold; border: 1px solid black; padding: 10px; text-align: left; width: 1070px;">
-            共 ${totalTray} 托
-            <br/>
-            备注:
-            <br/>(1) 用唛头笔写上托盘序号,托盘唛头打印贴在每托盘上面,打托的时候混托注意摆放和高度,另外不要漏掉了。
-            <br/>(2) 每托烟盒中间放瓦楞,最上面盖个木板,缠绕膜缠结实,护角护好,打打包带,井子形打包
-            <br/>(3) 配托后,请提供具体托盘高度及托盘重量。
-        </div>
+                                            <div style="width: 1100px; height: 100px; position: relative;">
+                                                <div style="float: left">
+                                                    <div style="width: 1000px; font-size: 28px; font-weight: bold; text-align: center; line-height: 50px;">${res.data.supplier_name}</div>
+                                                    <div style="width: 1000px; font-size: 24px; text-align: center; line-height: 50px;">送货单</div>
+                                                </div>
+                                                <div id="qrcode" style="position: absolute; right: 100px; top: -5px; width: 105px; height: 105px;">
+                                                    <img src="${res.data.qrcode_add}" style="width: 105px; height: 105px;" id="qrcode_image"/>
+                                                </div>
+                                            </div>
+                                    
+                                            <table style="margin-bottom: 10px; width: 1186px; font-weight: 500; border-collapse: collapse;">
+                                                <tr>
+                                                    <td colspan="6" style="border: none;">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td>
+                                                    <td colspan="4" style="border: none;">送货单号:<span id="shdh">${res.data.shdh}</span></td>
+                                                </tr>
+                                                <tr>
+                                                    <td colspan="6" style="border: none;">送货地址:河南省郑州市经开区第三大街9号</td>
+                                                    <td colspan="4" style="border: none;">送货日期:<span id="shrq_date">${res.data.shrq_date}</span></td>
+                                                </tr>
+                                            </table>
+                                    
+                                            <div style="width: 1070px; font-size: 20px; text-align: center; border: 1px solid black; border-bottom: none;">
+                                                ${res.data.order_ddbh || ''}${res.data.note || ''}
+                                            </div>
+                                    
+                                            <table style="width: 1070px; border-collapse: collapse; table-layout: fixed; font-size: 16px; text-align: center; margin-top: 0;">
+                                                <tr style="font-weight: bold;">
+                                                    <th style="border: 1px solid black;text-align: center;">托盘序号</th>
+                                                    <th style="border: 1px solid black;text-align: center; width: 360px;">产品名称</th>
+                                                    <th style="border: 1px solid black;text-align: center;">每托箱数</th>
+                                                    <th style="border: 1px solid black;text-align: center;">每层箱数</th>
+                                                    <th style="border: 1px solid black;text-align: center;">每托层数</th>
+                                                    <th style="border: 1px solid black;text-align: center;">每托高度</th>
+                                                    <th style="border: 1px solid black;text-align: center;">托盘规格</th>
+                                                    <th style="border: 1px solid black;text-align: center;">托盘数</th>
+                                                    <th style="border: 1px solid black;text-align: center;">总箱数</th>
+                                                </tr>
+                                            `;
+
+                                                                                for (let i = 0; i < arr.length; i++) {
+                                                                                    html += `
+                                                <tr>
+                                                    <td style="border: 1px solid black;">第${arr[i].large_ber}托</td>
+                                                    <td style="border: 1px solid black;">${arr[i].matter_name}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].total_boxes}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].tray_num}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].box_num}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].pallet_height}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].pallet_length} * ${arr[i].pallet_width}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].large_num}</td>
+                                                    <td style="border: 1px solid black;">${arr[i].larger_num}</td>
+                                                </tr>
+                                                `;
+                                                                                }
+
+                                                                                const fillCount = 15 - arr.length;
+                                                                                for (let i = 0; i < fillCount; i++) {
+                                                                                    html += `
+                                                <tr>
+                                                    <td style="border: 1px solid black;">&nbsp;</td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                    <td style="border: 1px solid black;"></td>
+                                                </tr>
+                                                `;
+                                                                                }
+
+                                                                                html += `
+                                            <tr style="font-weight: bold;">
+                                                <td style="border: 1px solid black;">合计:</td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;"></td>
+                                                <td style="border: 1px solid black;">${totalTray}</td>
+                                                <td style="border: 1px solid black;">${totalBox}</td>
+                                            </tr>
+                                            </table>
+                                    
+                                            <table style="margin-top: 20px; width: 1070px; border-collapse: collapse; font-size: 18px;">
+                                                <tr>
+                                                    <td colspan="${productNames.length + 2}" style="border: 1px solid black; text-align: left;">
+                                                        总共出货:${totalBox} 箱 = ${totalTray} 托(手工盒子:${manualBoxes} 套,纸质卡片:${paperCards} 张)
+                                                    </td>
+                                                </tr>
+                                                <tr>
+                                                    <td style="border: 1px solid black; text-align: center;">产品名称</td>
+                                                    ${productNames.map(name => `<td style="border: 1px solid black; text-align: center;">${name}</td>`).join('')}
+                                                    <td style="border: 1px solid black; text-align: center;">合计</td>
+                                                </tr>
+                                                <tr>
+                                                    <td style="border: 1px solid black; text-align: center;">出货数量</td>
+                                                    ${productQuantities.map(qty => `<td style="border: 1px solid black; text-align: center;">${qty}</td>`).join('')}
+                                                    <td style="border: 1px solid black; text-align: center;">${manualBoxes}</td>
+                                                </tr>
+                                            </table>
+                                    
+                                            <div style="margin-top: 20px; font-size: 14px; font-weight: bold; border: 1px solid black; padding: 10px; text-align: left; width: 1070px;">
+                                                共 ${totalTray} 托
+                                                <br/>
+                                                备注:
+                                                <br/>(1) 用唛头笔写上托盘序号,托盘唛头打印贴在每托盘上面,打托的时候混托注意摆放和高度,另外不要漏掉了。
+                                                <br/>(2) 每托烟盒中间放瓦楞,最上面盖个木板,缠绕膜缠结实,护角护好,打打包带,井子形打包
+                                                <br/>(3) 配托后,请提供具体托盘高度及托盘重量。
+                                            </div>
         `;
 
                                             $("#printcode").html(html);
-                                            const printHTML = document.querySelector('#printcode').innerHTML;
-                                            document.body.innerHTML = printHTML;
-                                            window.print();
-                                            window.location.reload();
+                                            var ee = $('#qrcode_image').attr('src',res.data.qrcode_add);
+                                            // 将打印的区域赋值,进行打印
+                                            ee.on('load',function () {
+                                                var printHTML = document.querySelector('#printcode').innerHTML;
+                                                window.document.body.innerHTML = printHTML;
+                                                window.print();
+                                                window.location.reload(); // 打印完成后重新加载页面
+                                            })
+
+                                            // const printHTML = document.querySelector('#printcode').innerHTML;
+                                            // document.body.innerHTML = printHTML;
+                                            // window.print();
+                                            // window.location.reload();
                                         }
                                         return false;
                                     },
-                                    // success: function (data, res) {
-                                    //     console.log(data);
-                                    //     console.log(res);
-                                    //     if (res.code === 1) {
-                                    //         var arr = res.data.data;
-                                    //         let html = `
-                                    //                 <div style="width: 1100px;height: 100px;position: relative;">
-                                    //                     <div style="float: left">
-                                    //                         <div style="width: 1000px;font-weight: 400;font-size: 28px;text-align: center;line-height: 50px;" class="company">${res.data.supplier_name}</div>
-                                    //                         <div style="width: 1000px;font-weight: 400;font-size: 24px;text-align: center;line-height: 50px;">送货单</div>
-                                    //                         <div style="width: 1000px;font-weight: 400;font-size: 28px;text-align: center;line-height: 50px;" class="company"></div>
-                                    //                         <div style="width: 1000px;font-weight: 400;font-size: 24px;text-align: center;line-height: 50px;"></div>
-                                    //                     </div>
-                                    //                     <div id="qrcode" style="display:inline-block;width: 105px;height: 105px;position: absolute;right: 100px;top: -5px;">
-                                    //                         <img src="${res.data.qrcode_add}" style="width: 105px;height: 105px;" id="qrcode_image"/>
-                                    //                     </div>
-                                    //                 </div>
-                                    //
-                                    //                 <table class="tg1" style="margin-top: 3px;border-collapse:collapse;width:1186px;font-weight:500;">
-                                    //                     <tr><td colspan="6" style="border:none">客户名称:河南中烟工业有限责任公司黄金叶生产制造中心</td><td colspan="4" style="border:none">送货单号:<span id="shdh">${res.data.shdh}</span></td></tr>
-                                    //                     <tr><td colspan="6" style="border:none">送货地址:河南省郑州市经开区第三大街9号</td><td colspan="4" style="border:none">送货日期:<span id="shrq_date">${res.data.shrq_date}</span></td></tr>
-                                    //                 </table>
-                                    //
-                                    //                 <table class="tg1" style="table-layout:fixed;width: 1070px;border-collapse:collapse;border-spacing:0;font-weight:500; position: relative;" >
-                                    //                     <tr>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">托盘序号</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;width: 360px">产品名称</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">每托箱数</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">每层箱数</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">每托层数</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">每托高度</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">托盘规格</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">托盘数</th>
-                                    //                         <th style="font-family:Arial, sans-serif;font-size:20px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">总箱数</th>
-                                    //                     </tr>
-                                    //                 `;
-                                    //         for (let i = 0; i < arr.length; i++) {
-                                    //             html += `
-                                    //                     <tr>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">第${arr[i].large_ber}托</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].matter_name}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].total_boxes}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].tray_num}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].box_num}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].pallet_height}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].pallet_length} * ${arr[i].pallet_width}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].large_num}</td>
-                                    //                         <td style="font-family:Arial, sans-serif;font-size:16px;text-align:center;border-style:solid;border-width:1px;overflow:hidden;word-break:break-all;border-color:black;">${arr[i].larger_num}</td>
-                                    //                     </tr>
-                                    //                     `;
-                                    //         }
-                                    //         $("#printcode").html(html);
-                                    //
-                                    //         // 正确绑定 load 事件并打印
-                                    //         // let image = document.getElementById('qrcode_image');
-                                    //         // image.onload = function () {
-                                    //             const printHTML = document.querySelector('#printcode').innerHTML;
-                                    //             document.body.innerHTML = printHTML;
-                                    //             window.print();
-                                    //             window.location.reload(); // 可选:打印完重新加载页面
-                                    //         // };
-                                    //     }
-                                    //     return false;
-                                    // },
                                     error: function (data, ret) {
 
                                         return false;

+ 15 - 32
public/assets/js/backend/finishedproduct.js

@@ -2,49 +2,37 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
     var Controller = {
         index: function () {
-            // 初始化表格参数配置
             Table.api.init({
                 extend: {
                     index_url: 'finishedproduct/index' + location.search,
-                    add_url: 'finishedproduct/add',
-                    edit_url: 'finishedproduct/edit',
-                    del_url: 'finishedproduct/del',
-                    multi_url: 'finishedproduct/multi',
-                    import_url: 'finishedproduct/import',
-                    table: 'version',
+                    table: 'finished_products',
                 }
             });
 
             var table = $("#table");
 
-            // 初始化表格
             table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'weigh',
-                fixedColumns: true,
-                fixedRightNumber: 1,
+                url: "finishedproduct/index",
+                pk: '_id', // MongoDB默认主键字段
+                sortName: '',
+                // fixedColumns: true,
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'oldversion', title: __('Oldversion'), operate: 'LIKE'},
-                        {field: 'oldversion', title: __('Oldversion'), operate: 'LIKE'},
-                        {field: 'newversion', title: __('Newversion'), operate: 'LIKE'},
-                        {field: 'packagesize', title: __('Packagesize'), operate: 'LIKE'},
-                        {field: 'content', title: __('Content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'downloadurl', title: __('Downloadurl'), operate: 'LIKE', formatter: Table.api.formatter.url},
-                        {field: 'enforce', title: __('Enforce')},
-                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'weigh', title: __('Weigh'), operate: false},
-                        {field: 'status', title: __('Status'), searchList: {"30":__('Status 30')}, formatter: Table.api.formatter.status},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: '订单编号', title: __('订单编号'), operate: 'LIKE'},
+                        {field: 'jjcp_gdbh', title: __('jjcp_gdbh'), operate: 'LIKE'},
+                        {field: 'jjcp_cpdh', title: __('jjcp_cpdh'), operate: 'LIKE'},
+                        {
+                            field: 'operate',
+                            title: __('Operate'),
+                            table: table,
+                            events: Table.api.events.operate,
+                            formatter: Table.api.formatter.operate
+                        }
                     ]
                 ]
             });
 
-            // 为表格绑定事件
             Table.api.bindevent(table);
         },
         add: function () {
@@ -52,11 +40,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         },
         edit: function () {
             Controller.api.bindevent();
-        },
-        api: {
-            bindevent: function () {
-                Form.api.bindevent($("form[role=form]"));
-            }
         }
     };
     return Controller;

+ 0 - 62
public/assets/js/backend/inventorydetails.js

@@ -1,62 +0,0 @@
-define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
-
-    var Controller = {
-        index: function () {
-            // 初始化表格参数配置
-            Table.api.init({
-                extend: {
-                    index_url: 'inventorydetails/index' + location.search,
-                    add_url: 'inventorydetails/add',
-                    edit_url: 'inventorydetails/edit',
-                    del_url: 'inventorydetails/del',
-                    multi_url: 'inventorydetails/multi',
-                    import_url: 'inventorydetails/import',
-                    table: 'version',
-                }
-            });
-
-            var table = $("#table");
-
-            // 初始化表格
-            table.bootstrapTable({
-                url: $.fn.bootstrapTable.defaults.extend.index_url,
-                pk: 'id',
-                sortName: 'weigh',
-                fixedColumns: true,
-                fixedRightNumber: 1,
-                columns: [
-                    [
-                        {checkbox: true},
-                        {field: 'id', title: __('Id')},
-                        {field: 'oldversion', title: __('Oldversion'), operate: 'LIKE'},
-                        {field: 'newversion', title: __('Newversion'), operate: 'LIKE'},
-                        {field: 'packagesize', title: __('Packagesize'), operate: 'LIKE'},
-                        {field: 'content', title: __('Content'), operate: 'LIKE', table: table, class: 'autocontent', formatter: Table.api.formatter.content},
-                        {field: 'downloadurl', title: __('Downloadurl'), operate: 'LIKE', formatter: Table.api.formatter.url},
-                        {field: 'enforce', title: __('Enforce')},
-                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
-                        {field: 'weigh', title: __('Weigh'), operate: false},
-                        {field: 'status', title: __('Status'), searchList: {"30":__('Status 30')}, formatter: Table.api.formatter.status},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
-                    ]
-                ]
-            });
-
-            // 为表格绑定事件
-            Table.api.bindevent(table);
-        },
-        add: function () {
-            Controller.api.bindevent();
-        },
-        edit: function () {
-            Controller.api.bindevent();
-        },
-        api: {
-            bindevent: function () {
-                Form.api.bindevent($("form[role=form]"));
-            }
-        }
-    };
-    return Controller;
-});

+ 82 - 125
public/assets/js/backend/qcode_add.js

@@ -3,43 +3,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
 
     var Controller = {
         index: function () {
-            //选择产品获取产品编码、单位
-            // $('#c-product_name').change(function () {
-            //    var product_code = $('#c-product_name').val();
-            //    $('#c-product_code').val(product_code);
-            //    Fast.api.ajax({
-            //        url:'qcode_add/product',
-            //        data:{product_code:product_code},
-            //    },function (data) {
-            //        if (data.temple === '07'){
-            //            $('#danwei').val(1);
-            //            $('.juan').hide();
-            //            $('.xiang').show();
-            //        }else {
-            //            $('#danwei').val(2);
-            //            $('.xiang').hide();
-            //            $('.juan').show();
-            //        }
-            //        if (data.flow === ''){
-            //            $('#c-big_liushui').val(1)
-            //        }else {
-            //            $('#c-big_liushui').val(data.flow);
-            //        }
-            //        if (data.bach === ''){
-            //            console.log("bach")
-            //            // $('#c-batch').val(201800000);
-            //            var currentYear = new Date().getFullYear();
-            //            var newValue = currentYear + '000000';
-            //            $('#c-batch').removeAttr('disabled');
-            //            $('#c-batch').val(newValue);
-            //        }else {
-            //            $('#c-batch').val(data.bach);
-            //        }
-            //        return false;
-            //    },function () {
-            //        return false;
-            //    });
-            // });
             //进入页面根据单位判断显示字段
             $(document).ready(function () {
                 var status = $('#danwei').val();
@@ -94,34 +57,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     juancal();
                 }
             });
-
-            // //单位为箱时计算大小件数量
-            // function xiangcal() {
-            //     var number = $('#c-number').val();
-            //     var box_number = $('#box_number').val();
-            //     var tray_num = $('#tray_num').val();
-            //     var small_num  = 0;
-            //     var box_num = 0;
-            //     if (box_number !== 0 && tray_num !== 0){
-            //         small_num = Math.ceil(number / box_number) ;
-            //         $('#c-small_num').val(small_num);
-            //         box_num = Math.ceil(small_num / tray_num);
-            //         $('#c-box_num').val(box_num);
-            //     }
-            // }
-            // //单位为卷时计算大小件数量
-            // function juancal() {
-            //     var small_num = $('#c-small_num').val();
-            //     var volume_num = $('#c-volume_num').val();
-            //     console.log(small_num);
-            //     var box_num = 0;
-            //     if (small_num !== 0 && volume_num !== 0){
-            //         box_num = Math.ceil(small_num / volume_num);
-            //         if(box_num != 'Infinity'){
-            //             $('#c-box_num').val(box_num);
-            //         }
-            //     }
-            // }
             // 单位为箱时计算大小件数量
             function xiangcal() {
                 var number = parseFloat($('#c-number').val()) || 0;
@@ -162,26 +97,22 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 }
             }
             //重置批次号按钮
-            // $('#reset_batch').on('click',function () {
-            //    $('#c-batch').removeAttr('disabled');
-            //    $('#c-batch').val(201800000);
+            // $('#reset_batch').on('click', function () {
+            //     var currentYear = new Date().getFullYear();
+            //     var newValue = currentYear + '000000';
+            //     $('#c-batch').removeAttr('disabled');
+            //     $('#c-batch').val(newValue);
             // });
-            $('#reset_batch').on('click', function () {
-                var currentYear = new Date().getFullYear();
-                var newValue = currentYear + '000000';
-                $('#c-batch').removeAttr('disabled');
-                $('#c-batch').val(newValue);
-            });
             //重置流水号按钮
             $('#reset_liushui').on('click',function () {
                $('#c-big_liushui').removeAttr('disabled');
                $('#c-big_liushui').val(1);
             });
-            //点击保存按钮,上传表单信息
+
+            //点击保存按钮
             $('#submit').click(function () {
-                //表单验证
-                //生产厂商
                 var rows = $.makeArray();
+                //生产厂商
                 var company_name = $('#c-company_name').val();
                 if (company_name == null || company_name === ''){
                     layer.confirm('生产厂商不能为空');
@@ -204,25 +135,80 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 if (company_address == null || company_address === ''){
                     layer.confirm('公司地址不能为空');
                 }
-                rows.push({'company_address':company_address});
-                //辅料名称
-                var product_name = $('#c-product_name').val();
-                if (product_name == null || product_name === ''){
-                    layer.confirm('辅料名称不能为空');
+                //厂商编码
+                var printer_code = $('#c-printer_code').val();
+                if (printer_code == null || printer_code === '' || printer_code === undefined){
+                    layer.confirm('厂商编码不能为空');
+                }
+                rows.push({'printer_code':printer_code});
+
+                //工单编号
+                var gdbh = $('#c-gdbh').val();
+                if (gdbh == null || gdbh === ''){
+                    layer.confirm('工单编号不能为空');
                 }
-                rows.push({'product_name':product_name});
-                //辅料代码
-                var product_code = $('#c-product_code').val();
-                if (product_code == null || product_code === ''){
-                    layer.confirm('辅料代码不能为空');
+                rows.push({'gdbh':gdbh});
+                //订单编号
+                var order_ddbh = $('#c-order_ddbh').val();
+                if (order_ddbh == null || order_ddbh === ''){
+                    layer.confirm('订单编号不能为空');
                 }
-                rows.push({'product_code':product_code});
+                rows.push({'order_ddbh':order_ddbh});
+                //产品名称
+                var cpmc = $('#c-cpmc').val();
+                if (cpmc == null || cpmc === ''){
+                    layer.confirm('产品名称不能为空');
+                }
+                rows.push({'cpmc':cpmc});
+                //结存数量
+                var sl = $('#c-sl').val();
+                if (sl == null || sl === ''){
+                    layer.confirm('结存数量为空');
+                }
+                rows.push({'sl':sl});
+                //产品代号
+                // var cpdh = $('#c-cpdh').val();
+                // if (cpdh == null || cpdh === ''){
+                //     layer.confirm('产品代号不能为空');
+                // }
+                // rows.push({'cpdh':cpdh});
+
                 //单位
                 var danwei = $('#danwei').val();
                 if (danwei == null || danwei === ''){
                     layer.confirm('单位不能为空');
                 }
                 rows.push({'danwei':danwei});
+                //判断选择单位【1=张、2=】
+                if (danwei === '1'){
+                    //总张数
+                    var number = $('#c-number').val();
+                    if (number == null || number === ''){
+                        layer.confirm('总张数不能为空');
+                    }
+                    rows.push({'number':number});
+                    //一托盘多少箱
+                    var tray_num =  $('#tray_num').val();
+                    if (tray_num == null || tray_num === ''){
+                        layer.confirm('一托盘多少箱不能为空');
+                    }
+                    rows.push({'tray_num':tray_num});
+                    //一箱多少张
+                    var box_number = $('#box_number').val();
+                    if (box_number == null || box_number === ''){
+                        layer.confirm('一箱多少张不能为空');
+                    }
+                    rows.push({'box_number':box_number});
+                }else {
+                    //一托盘多少卷
+                    var volume_num = $('#c-volume_num').val();
+                    if (volume_num == null || volume_num === ''){
+                        layer.confirm('一坨多少卷不能为空');
+                    }
+                    rows.push({'volume_num':volume_num});
+                }
+
+
                 //每托盘箱数
                 var small_num = $('#c-small_num').val();
                 if (small_num == null || small_num === ''){
@@ -277,33 +263,6 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     layer.confirm('小件重量不能为空');
                 }
                 rows.push({'small_weight':small_weight});
-                if (danwei === '1'){
-                    //总张数
-                    var number = $('#c-number').val();
-                    if (number == null || number === ''){
-                        layer.confirm('总张数不能为空');
-                    }
-                    rows.push({'number':number});
-                    //一托盘多少箱
-                    var tray_num =  $('#tray_num').val();
-                    if (tray_num == null || tray_num === ''){
-                        layer.confirm('一托盘多少箱不能为空');
-                    }
-                    rows.push({'tray_num':tray_num});
-                    //一箱多少张
-                    var box_number = $('#box_number').val();
-                    if (box_number == null || box_number === ''){
-                        layer.confirm('一箱多少张不能为空');
-                    }
-                    rows.push({'box_number':box_number});
-                }else {
-                    //一托盘多少卷
-                    var volume_num = $('#c-volume_num').val();
-                    if (volume_num == null || volume_num === ''){
-                        layer.confirm('一坨多少卷不能为空');
-                    }
-                    rows.push({'volume_num':volume_num});
-                }
 
                 //每层箱数
                 var boxes_per_layer = $('#boxes_per_layer').val();
@@ -325,30 +284,28 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 rows.push({'total_boxes':total_boxes});
                 //每托高度
                 var pallet_height = $('#pallet_height').val();
-                if (pallet_height == null || pallet_height === ''){
+                if (pallet_height == null || pallet_height === '' || pallet_height === undefined){
                     layer.confirm('每托高度不能为空');
                 }
                 rows.push({'pallet_height':pallet_height});
                 //托盘规格
                 var pallet_length = $('#pallet_length').val();
-                if (pallet_length == null || pallet_length === ''){
+                if (pallet_length == null || pallet_length === '' || pallet_length === undefined){
                     layer.confirm('托盘规格不能为空');
                 }
                 rows.push({'pallet_length':pallet_length});
+                //托盘规格
                 var pallet_width = $('#pallet_width').val();
-                if (pallet_width == null || pallet_width === ''){
+                if (pallet_width == null || pallet_width === '' || pallet_width === undefined){
                     layer.confirm('托盘规格不能为空');
                 }
                 rows.push({'pallet_width':pallet_width});
 
-                var order_ddbh = $('#c-order_ddbh').val();
-                if (order_ddbh == null || order_ddbh === ''){
-                    layer.confirm('托盘规格不能为空');
-                }
-                rows.push({'order_ddbh':order_ddbh});
+                //打印调试查询
+                // console.log("js判断");
+                // console.log(rows);
+                // return;
 
-                console.log(rows);
-                console.log(JSON.stringify({rows}));
                 Fast.api.ajax({
                     url:'qcode_add/add',
                     type:'POST',

+ 1780 - 12
public/assets/js/backend/qcode_bach.js

@@ -1697,24 +1697,1792 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'LodopFuncs'], functi
                             '<table class="tg" width="340px">\n' +
                             '<caption style="width: 300px;">'+res.data.company_name+'</caption>\n' +
                             '<tr>\n' +
-                                '<td style="width: 70px;">规格:</td>\n' +
-                                '<td colspan="5" style="word-break:break-all;border-color:black;">'+res.data.product_name+'</td>\n' +
+                            '<td style="width: 70px;">规格:</td>\n' +
+                            '<td colspan="5" style="word-break:break-all;border-color:black;">'+res.data.product_name+'</td>\n' +
                             '</tr>\n' +
                             '<tr>\n' +
-                                '<td>配盘数:</td>\n' +
-                                '<td colspan="2">'+res.data.sqrcd+'</td>\n' +
-                                '<td>辅单位:</td>\n' +
-                                '<td colspan="2">'+res.data.sec_unit+'</td>\n' +
+                            '<td>配盘数:</td>\n' +
+                            '<td colspan="2">'+res.data.sqrcd+'</td>\n' +
+                            '<td>辅单位:</td>\n' +
+                            '<td colspan="2">'+res.data.sec_unit+'</td>\n' +
                             '</tr>\n' +
                             '<tr>\n' +
-                                '<td>数量:</td>\n' +
-                                '<td colspan="2">'+res.data.num+'</td>\n' +
-                                '<td>主单位:</td>\n' +
-                                '<td colspan="2">'+res.data.main_unit+'</td>\n' +
+                            '<td>数量:</td>\n' +
+                            '<td colspan="2">'+res.data.num+'</td>\n' +
+                            '<td>主单位:</td>\n' +
+                            '<td colspan="2">'+res.data.main_unit+'</td>\n' +
                             '</tr>\n' +
                             '<tr>\n' +
-                                '<td>生产日期:</td>\n' +
-                                '<td colspan="5">'+res.data.date+'</td>\n' +
+                            '<td>生产日期:</td>\n' +
+                            '<td colspan="5">'+res.data.date+'</td>\n' +
+                            '</tr>\n' +
+                            '<tr>\n' +
+                            '<td>生产批号:</td>\n' +
+                            '<td colspan="5">'+res.data.batch+'</td>\n' +
+                            '</tr>\n' +
+                            '<tr>\n' +
+                            '<td colspan="6" style="word-break:break-all; border-color:black; font-size: 13px;">'+res.data.qrcode+'</td>\n' +
+                            '</tr>\n' +
+                            '</table>\n' +
+                            '<div style="position:absolute;top: 300px;left: 47px">\n' +
+                            '<img src="'+res.data.pCode+'" > </td>\n' +
+                            '</div>\n' +
+                            '<div style="position:absolute;top: 400px;left: 300px;width: 50px;text-align: center;"><span style="font-weight: 500;word-break:normal;font-size: 16px">大件号'+res.data.l_flow+'</span></div>\n' +
+                            '</div>';
+                        var printPdf = (html,qrcode) => {
+                            let LODOP=getLodop();
+                            LODOP.SET_LICENSES("","152A06E8F6CBD6AC1F213ABFCB0D8604","C94CEE276DB2187AE6B65D56B3FC2848","");
+
+                            LODOP.PRINT_INIT("河南中烟大件二维码打码");
+                            LODOP.SET_PRINT_STYLE("FontSize",16);
+                            LODOP.SET_PRINT_STYLE("Bold",1);
+
+                            LODOP.SET_PRINT_PAGESIZE(1, 1000, 1500, "CreateCustomPage");
+
+                            LODOP.ADD_PRINT_HTM(15,20,350,545,html);
+
+                            // LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",14);
+                            // LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                            // LODOP.ADD_PRINT_BARCODE(18,715,'27mm','27mm',"QRCode",qrcode);
+                            // LODOP.PRINT() // 直接打印
+                            // LODOP.PRINT_DESIGN() // 设计模式
+                            LODOP.PREVIEW()	//打印预览
+                        }
+                        printPdf(html)
+
+                    }else{
+                        Toastr.error(res.msg);
+                    }
+                })
+            })
+
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'LodopFuncs'], function ($, undefined, Backend, Table, Form, LodopFuncs) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init();
+            this.table.first();
+            this.table.second();
+
+            //大件码打印
+            function print_l(data,qrcode){
+                //打印二维码
+                var html = '<style type="text/css">' +
+                    '.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}' +
+                    '.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}' +
+                    '.tg .tg-s6z2{text-align:center;}</style>' +
+                    '<div width="340px"><table class="tg" width="340px">' +
+                    '<caption style="width: 300px;">'+data.company_name+'</caption>' +
+                    '<tr><td style="width: 70px;">规格:</td><td colspan="5" style="word-break:break-all;border-color:black;">'+data.product_name+'</td>' +
+                    '<tr><td>配盘数:</td><td colspan="2">'+data.sqrcd+'</td><td>辅单位:</td><td colspan="2">'+data.sec_unit+'</td></tr>' +
+                    '<tr><td>数量:</td><td colspan="2">'+data.num+'</td><td>主单位:</td><td colspan="2">'+data.main_unit+'</td></tr>' +
+                    '<tr><td>生产日期:</td><td colspan="5">'+data.date+'</td></tr>' +
+                    '<tr><td>生产批号:</td><td colspan="5">'+data.batch+'</td></tr>' +
+                    '<tr><td colspan="6" style="word-break:break-all; border-color:black; font-size: 13px;">'+data.qrcode+'</td></table>' +
+                    '<div style="position:absolute;top: 287px;left: 30px"><img src="'+data.pCode+'" > </td></div>' +
+                    '<div style="position:absolute;top: 370px;left: 300px;width: 50px;text-align: center;"><span style="font-weight: 500;word-break:normal;font-size: 16px">大件号'+data.l_flow+'</span></div>\n' +
+                    '</div>';
+                var printPdf = (html,qrcode) => {
+                    var LODOP=getLodop();
+                    LODOP.SET_LICENSES("","152A06E8F6CBD6AC1F213ABFCB0D8604","C94CEE276DB2187AE6B65D56B3FC2848","");
+
+                    LODOP.PRINT_INIT("河南中烟大件二维码打码");
+                    LODOP.SET_PRINT_STYLE("FontSize",16);
+                    LODOP.SET_PRINT_STYLE("Bold",1);
+
+                    LODOP.SET_PRINT_PAGESIZE(1, 1000, 1500, "CreateCustomPage");
+                    // LODOP.ADD_PRINT_HTM(15,20,350,545,html);
+                    LODOP.ADD_PRINT_HTM(10,20,350,590,html);
+
+                    // LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",14);
+                    // LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                    // LODOP.ADD_PRINT_BARCODE(18,715,'27mm','27mm',"QRCode",qrcode);
+                    // LODOP.PRINT() // 直接打印
+                    // LODOP.PRINT_DESIGN() // 设计模式
+                    if (qrcode){
+                        LODOP.PREVIEW()	//打印预览
+                    }else{
+                        LODOP.PRINT() // 直接打印
+                    }
+
+                }
+                printPdf(html,qrcode)
+            }
+
+            //小件码打印(10mmx2.5mm)
+            function print1(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体,楷体;font-size:10px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 250, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(15, 10, 270, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(70,200,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(4,280,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx1.8mm)
+            function print2(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}.tg td{font-family:宋体,楷体;font-size:9px;overflow:hidden;word-break:break-all;border-color:black;}</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 180, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(3, 5, 300, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(50,200,100,18,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLE("QRCodeVersion",10);
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(5,310,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx4mm)
+            function print3(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx4mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 400, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(9, 5, 230, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(130,110,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",14);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(9,240,'45mm','45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx5mm)
+            function print4(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 500, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(20, 10, 230, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(160, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 235, '45mm', '45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx6mm)
+            function print5(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体, 楷体;font-size:14px;padding:2px 2px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx6mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 600, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(25, 10, 180, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(180, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 190, '55mm', '55mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //跳转
+            $('#exp').click(function (e) {
+
+                $.get('qcode_bach/exp', {}, function (data) {
+                    if(data.code==1){
+                        top.window.$('[addtabs="'+data.data.id+'"]').trigger("click");
+                    }else{
+                        Toastr.error(data.msg)
+                    }
+                }, 'json');
+            })
+
+            //自动打码(大件)
+            $('#print_l').click(function (e) {
+                var rows = $('#table2').bootstrapTable('getSelections');
+                var ids = rows.map(function(item) {
+                    return item.id;
+                });
+
+                var html = '<div style="margin-top: 20px">' +
+                    '<label class="col-xs-5 col-sm-3" style="text-align: right;">标签类型:</label>' +
+                    '<select class="selectpicker" style="height: 30px;width: 270px" name="row[type]" id="type">' +
+                    '<option value="v010" >(10cmx15cm)</option>' +
+                    '</select>' +
+                    '</div>' +
+                    '<div>' +
+                    '<label class="col-xs-5 col-sm-3" style="text-align: right;top: 8px;">打印数量:</label>' +
+                    '<input id="numn" style="width: 270px;margin-top: 8px;" name="row[numn]" type="text" value="1">' +
+                    '</div>' +
+                    '<div class="form-group layer-footer" style="margin-top: 10px">' +
+                    '<div style="text-align: center">' +
+                    '<button type="submit" id="btn" class="btn btn-primary btn-embossed">确认</button>' +
+                    '<button type="reset" id="reset" class="btn btn-defaults btn-embossed">取消</button>' +
+                    '</div>' +
+                    '</div>';
+
+                var layero_l = layer.open({
+                    type: 1,
+                    title: '自动打码(大件)',
+                    area: ['400px','200px'],
+                    content: html,
+                    success: function(layero) {
+                        // 在弹窗中绑定事件处理程序
+                        $(layero).find('#btn').click(function(e) {
+                            e.preventDefault();
+                            var type = $('#type').val();
+                            var numn = $('#numn').val();
+                            if(numn=='' || numn==0){
+                                Toastr.error('请填写打印数量');
+                                return false;
+                            }
+                            $.post('qcode_bach/print_l', {'ids':ids, 'type':type, 'numn':numn}, function (res) {
+                                if(res.code==1){
+                                    var p = 0;
+                                    var flage = 0;
+                                    for(i in res.data.rows) {
+                                        if (!flage) {
+                                            //判断预览情况
+                                            if (res.data.type == 'v010'){
+                                                print_l(res.data.rows[i], 1)
+                                            }
+                                            LODOP.On_Return = function (TaskID, Value) {
+                                                if (Value == 1) {
+                                                    p = 1;
+                                                }
+                                            }
+                                            flage++;
+                                        }else{
+                                            break;
+                                        }
+                                    }
+                                    var cint = setInterval(function () {
+                                        if (p == 1) {
+                                            clearInterval(cint);
+                                            flage = 0;
+                                            //修改打印数量
+                                            $.post('qcode_bach/set_num', {'status':1,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                            for(i in res.data.rows) {
+                                                for(j=0;j<res.data.numn;j++){
+                                                    if (!flage){
+                                                        flage++;
+                                                    }else{
+                                                        if (res.data.type == 'v010'){
+                                                            print_l(res.data.rows[i]);//打印
+                                                        }
+                                                        flage++;
+                                                    }
+                                                }
+
+                                            }
+                                        }
+                                    },2000)
+
+                                    return false
+
+                                }else{
+                                    Toastr.error(res.msg);
+                                }
+                            })
+                        });
+
+                        $(layero).find('#reset').click(function(e) {
+                            e.preventDefault();
+                            layer.close(layero_l);
+                        });
+                    }
+                });
+
+            })
+            //自动打码(小件)
+            $('#print_s').click(function (e) {
+                var rows = $('#table2').bootstrapTable('getSelections');
+                var ids = rows.map(function(item) {
+                    return item.id;
+                });
+                var html = '<div style="margin-top: 20px">' +
+                    '<label class="col-xs-5 col-sm-3" style="text-align: right;">标签类型:</label>' +
+                    '<select class="selectpicker" style="height: 30px;" name="row[type]" id="type">' +
+                    '<option value="v001" datatype="">小件通用型卷烟纸(10cmX2.5cm)</option>' +
+                    '<option value="v002" datatype="">小件细支型卷烟纸(10cmX1.8cm)</option>' +
+                    '<option value="v003" datatype="">小件接装纸(10cmX4cm)</option>' +
+                    '<option value="v003" datatype="">小件内衬纸(10cmX4cm)</option>' +
+                    '<option value="v003" datatype="">小件盒包装膜(10cmX4cm)</option>' +
+                    '<option value="v003" datatype="">小件框架纸(10cmX4cm)</option>' +
+                    '<option value="v003" datatype="">小件拉线(10cmX4cm)</option>' +
+                    '<option value="v004" datatype="">小件条包装膜(10cmX5cm)</option>' +
+                    '<option value="v005" datatype="">小件盒包装纸(10cmX6cm)</option>' +
+                    '<option value="v005" datatype="">小件条包装纸(10cmX6cm)</option>' +
+                    '</select>' +
+                    '</div>' +
+                    '<div>' +
+                    '<label class="col-xs-5 col-sm-3" style="text-align: right;">打印数量:</label>' +
+                    '<input id="numn" style="width: 200px;margin-bottom: 2px;" name="row[numn]" type="text" value="1">' +
+                    '</div>' +
+                    '<div class="form-group layer-footer" style="margin-top: 10px">' +
+                    '<div style="text-align: center">' +
+                    '<button type="submit" id="btn" class="btn btn-primary btn-embossed">确认</button>' +
+                    '<button type="reset" id="reset" class="btn btn-defaults btn-embossed">取消</button>' +
+                    '</div>' +
+                    '</div>';
+
+                var layero_s = layer.open({
+                    type: 1,
+                    title: '自动打码(小件)',
+                    area: ['400px','200px'],
+                    content: html,
+                    success: function(layero) {
+                        // 在弹窗中绑定事件处理程序
+                        $(layero).find('#btn').click(function(e) {
+                            e.preventDefault();
+                            var type = $('#type').val();
+                            var numn = $('#numn').val();
+
+                            if(numn=='' || numn==0){
+                                Toastr.error('请填写打印数量');
+                                return false;
+                            }
+                            $.post('qcode_bach/print_s', {'ids':ids, 'type':type, 'numn':numn}, function (res) {
+                                if(res.code==1){
+                                    var p = 0;
+                                    var flage = 0;
+                                    for(i in res.data.rows) {
+                                        if (!flage) {
+                                            //判断预览情况
+                                            if (res.data.type == 'v001'){
+                                                print1(res.data.rows[i], 1)
+                                            }else if(res.data.type == 'v002'){
+                                                print2(res.data.rows[i], 1)
+                                            }else if(res.data.type == 'v003'){
+                                                print3(res.data.rows[i], 1)
+                                            }else if(res.data.type == 'v004'){
+                                                print4(res.data.rows[i], 1)
+                                            }else if(res.data.type == 'v005'){
+                                                print5(res.data.rows[i], 1)
+                                            }
+                                            LODOP.On_Return = function (TaskID, Value) {
+                                                if (Value == 1) {
+                                                    p = 1;
+                                                }
+                                            }
+                                            flage++;
+                                        }else{
+                                            break;
+                                        }
+                                    }
+                                    var cint = setInterval(function () {
+                                        if (p == 1) {
+                                            clearInterval(cint);
+                                            flage = 0;
+                                            //修改打印数量
+                                            $.post('qcode_bach/set_num', {'status':2,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                            for(i in res.data.rows) {
+                                                for(j=0;j<res.data.numn;j++){
+                                                    if (!flage){
+                                                        flage++;
+                                                    }else{
+                                                        if (res.data.type == 'v001'){
+                                                            print1(res.data.rows[i])
+                                                        }else if(res.data.type == 'v002'){
+                                                            print2(res.data.rows[i])
+                                                        }else if(res.data.type == 'v003'){
+                                                            print3(res.data.rows[i])
+                                                        }else if(res.data.type == 'v004'){
+                                                            print4(res.data.rows[i])
+                                                        }else if(res.data.type == 'v005'){
+                                                            print5(res.data.rows[i])
+                                                        }
+                                                        flage++;
+                                                    }
+                                                }
+
+                                            }
+                                        }
+                                    },2000)
+
+                                    return false
+
+                                }else{
+                                    Toastr.error(res.msg);
+                                }
+                            })
+                        });
+                        $(layero).find('#reset').click(function(e) {
+                            e.preventDefault();
+                            layer.close(layero_s);
+                        });
+                    }
+                });
+
+                // Fast.api.open("qcode_bach/print_s?ids="+ids, "自动打码(小件)", {
+                //     shadeClose: true,
+                //     shade: [0.5,'#393D49'],
+                //     area: ['400px','400px'],
+                //     callback:function(value){
+                //         return false;
+                //         // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
+                //     }
+                // });
+
+            })
+
+            //修改
+            $('#edit').click(function (e) {
+                var rows = $('#table2').bootstrapTable('getSelections');
+                var ids = rows.map(function(item) {
+                    return item.id;
+                });
+                Fast.api.open("qcode_bach/edit?ids="+ids, "修改", {
+                    shadeClose: true,
+                    shade: [0.5,'#393D49'],
+                    area: ['400px','200px'],
+                    callback:function(value){
+                        return false;
+                        // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
+                    }
+                });
+
+            })
+
+        },
+        table: {
+            first: function () {
+                // 表格1
+                var table1 = $("#table1");
+                table1.bootstrapTable({
+                    url: 'qcode_bach/bach',
+                    extend: {
+                        index_url: 'qcode_bach/bach' + location.search,
+                        add_url: 'qcode_bach/add',
+                        edit_url: 'qcode_bach/edit',
+                        del_url: 'qcode_bach/del',
+                        table: 'qcode_bach',
+                    },
+                    onClickRow:function(row, $element, field)
+                    {
+                        $("#myTabContent2 .form-commonsearch input[name='bach_id']").val(row.id);
+                        $("#myTabContent2 .btn-refresh").trigger("click");
+                    },
+                    toolbar: '#toolbar1',
+                    pk: 'id',
+                    sortName: 'id',
+                    pageSize: 8,
+                    pageList: [8, 20, 50, 'All'],
+                    search: false,
+                    showExport: false,
+                    singleSelect: true,
+                    columns: [
+                        [
+                            {checkbox: true},
+                            {field: 'matter_name', title: "产1品名称", operate: false, width: 250},
+                            {field: 'matter_no', title: "产品编码", operate: false, width: 100},
+                            {field: 'num', title: "总数量", operate: false, width: 80},
+                            {field: 'total_boxes', title: "每托箱数", operate: false, width: 80},
+                            {field: 'tray_num', title: "每层箱数", operate: false, width: 80},
+                            {field: 'box_num', title: "每托层数", operate: false, width: 80},
+                            {field: 'small_num', title: "每托箱盘数", operate: false, width: 100},
+                            {field: 'pallet_height', title: "每托高度", operate: false, width: 100},
+                            {
+                                field: 'pallet_size',
+                                title: '托盘规格',
+                                operate: false,
+                                width: 120,
+                                formatter: function (value, row, index) {
+                                    return row.pallet_length + ' * ' + row.pallet_width;
+                                }
+                            },
+                            {field: 'larger_num', title: "总箱数", operate: false, width: 80},
+                            {field: 'l_flow', title: '开始流水号', operate: false, width: 120},
+                            {field: 'large_endnum', title:"结束流水号", operate: false, width: 120},
+                            {field: 'bach_num', title: "批次号", operate: false, width: 100},
+                            {field: 'print_date', title: __('Print_date'), operate: false, width: 80},
+                            {field: 'supplier_name', title: __('Company_name'), operate: false, width: 150},
+                            // {field: 'notes', title: __('Notes')},
+                            // {field: 'operate', title: __('Operate'), table: table1, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        ]
+                    ]
+                });
+
+
+                // $(document).ready(function() {
+                //     // 自动触发搜索按钮的点击事件
+                //     $('.btn-default').click();
+                // });
+                $(document).ready(function() {
+                    // 自动触发搜索按钮的点击事件
+                    $('.btn-default').click();
+
+                    // 隐藏文字中包含"提交"的按钮
+                    $('button').filter(function() {
+                        return $(this).text().indexOf('提交') !== -1; // 判断按钮文字是否包含"提交"
+                    }).eq(0).hide();
+
+                    // 隐藏文字中包含"重置"的按钮
+                    $('button').filter(function() {
+                        return $(this).text().indexOf('重置') !== -1; // 判断按钮文字是否包含"重置"
+                    }).eq(0).hide();
+                });
+
+
+                // 为表格1绑定事件
+                Table.api.bindevent(table1);
+            },
+
+            second: function () {
+                // 表格2
+                var table2 = $("#table2");
+                table2.bootstrapTable({
+                    url: 'qcode_bach/large',
+                    extend: {
+                        index_url: '',
+                        add_url: '',
+                        edit_url: '',
+                        del_url: '',
+                        multi_url: '',
+                        table: '',
+                    },
+                    onClickRow:function(row, $element, field)
+                    {
+                        Fast.api.open("qcode_bach/small?large_id="+row.id+'&l_flow='+row.l_flow, "小件列表", {
+                            shadeClose: true,
+                            shade: [0.5,'#393D49'],
+                            area: ['80%','80%'],
+                            callback:function(value){
+                                return false;
+                                // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
+                            }
+                        });
+                    },
+                    sortOrder: 'asc',
+                    toolbar: '#toolbar2',
+                    pk: 'id',
+                    sortName: 'id',
+                    pagination: false,
+                    search: false,
+                    showExport: false,
+
+
+                    // pageSize: 8,
+                    // pageList: [8, 20, 50, 'All'],
+                    // singleSelect: true,
+
+                    columns: [
+                        [
+                            {checkbox: true},
+                            {field: 'l_flow', title: __('当前托盘'), operate: false},
+                            // {field: 'l_weight', title: "每托箱数", operate: false},
+                            {field: 'l_num', title: "每托箱数", operate: false},
+                            {field: 'small_num', title:"每层箱数", operate: false},
+                            {field: 'print_date', title:__('Print_date'), operate: false},
+                            {field: 'p_nums', title:"打印次数", operate: false},
+                            {field: 'l_print', title: __('L_print'), operate: false, formatter:function (value, row, index) {
+                                    if(value==1){
+                                        return '<span style="color: green">已打印</span>';
+                                    }else{
+                                        return '<span>未打印</span>';
+                                    }
+                                }},
+                            {field: 'l_status', title: __('L_status'), operate: false, formatter:function (value, row, index) {
+                                    if(value==1){
+                                        return '<span style="color: green">已导出</span>';
+                                    }else{
+                                        return '<span style="color: red">未导出</span>';
+                                    }
+                                }},
+                            {field: 'bach_id', title: __('bach_id'), visible:false, operate: 'LIKE'},
+                            {field: 'code', title: "标签代码", operate: "LIKE"},
+
+                            // {field: 'notes', title: __('Notes')},
+                            // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        ]
+                    ],
+                    onLoadSuccess:function(data){
+                        if (data.rows[0]!=undefined){
+                            if(data.rows[0].l_num == null || data.rows[0].l_num == 0){
+                                $("#table2").bootstrapTable("hideColumn", "l_num"); // 设置隐藏列
+                                $("#table2").bootstrapTable("showColumn", "l_weight"); // 设置显示列
+                            }else{
+                                $("#table2").bootstrapTable("hideColumn", "l_weight"); // 设置隐藏列
+                                $("#table2").bootstrapTable("showColumn", "l_num"); // 设置显示列
+                            }
+                        }
+
+                    },
+                });
+
+                // 为表格2绑定事件
+                Table.api.bindevent(table2);
+            }
+        },
+
+        small: function () {
+            // 初始化表格参数配置
+            Table.api.init();
+
+            //小件码打印(10mmx2.5mm)
+            function print1(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体,楷体;font-size:10px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 250, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(15, 10, 270, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(70,200,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(4,280,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx1.8mm)
+            function print2(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}.tg td{font-family:宋体,楷体;font-size:9px;overflow:hidden;word-break:break-all;border-color:black;}</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 180, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(3, 5, 300, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(50,200,100,18,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLE("QRCodeVersion",10);
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(5,310,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx4mm)
+            function print3(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx4mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 400, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(9, 5, 230, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(130,110,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",14);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(9,240,'45mm','45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx5mm)
+            function print4(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 500, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(20, 10, 230, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(160, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 235, '45mm', '45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx6mm)
+            function print5(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体, 楷体;font-size:14px;padding:2px 2px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx6mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 600, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(25, 10, 180, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(180, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 190, '55mm', '55mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            var table = $("#table");
+            table.bootstrapTable({
+                url: 'qcode_bach/small' + location.search,
+                sortOrder: 'asc',
+                toolbar: '#toolbar',
+                pk: 'id',
+                sortName: 'id',
+                search: false,
+                showExport: false,
+                singleSelect: true,
+                columns: [
+                    [
+                        // {checkbox: true},
+                        {field: 'code', title: __('Code'), cellStyle: function () {return {css: {"max-width": "200px","overflow":"hidden",}}}, operate: 'LIKE'},
+                        {field: 'l_flow', title: __('Flow'), width:80, operate: false},
+                        {field: 'p_nums', title: __('P_nums'), width:80, operate: false},
+                        {field: 'status', title: __('Status'), width:80, formatter:function (value, row, index) {
+                                if(value==1){
+                                    return '<span style="color: red">已删除</span>';
+                                }else{
+                                    return '<span style="color: green">正常</span>';
+                                }
+                            }, operate: false},
+                        {field: 'buttons', width: "120px", title: __('按钮组'), table: table, operate: false, events: Table.api.events.operate,
+                            buttons: [
+                                {
+                                    name: 'click',
+                                    text: __('切换'),
+                                    title: __('切换'),
+                                    classname: 'btn btn-xs btn-success btn-click',
+                                    icon: 'fa',
+                                    click: function (data,row,index) {
+                                        $.get('qcode_bach/small_status',{'ids':row.id},function (res){
+                                            if (res.code==1){
+                                                //修改成功
+                                                //1. 提示
+                                                Toastr.success(res.msg)
+                                                //2. 刷新页面
+                                                table.bootstrapTable('refresh');
+                                            }
+                                        })
+                                    }
+                                }
+                            ],
+                            formatter: Table.api.formatter.buttons
+                        },
+                        // {field: 'notes', title: __('Notes')},
+                        {field: 'operate', title: __('Operate'), table: table, operate: false, events: Table.api.events.operate, formatter: Table.api.formatter.operate,
+                            buttons: [
+                                {
+                                    name: 'click',
+                                    text: __('打印'),
+                                    title: __('打印'),
+                                    classname: 'btn btn-xs btn-success btn-click',
+                                    icon: 'fa fa-print',
+                                    click: function (data,row,index) {
+                                        //自动打码(小件)
+                                        var ids = row.id;
+                                        var html = '<div style="margin-top: 20px">' +
+                                            '<label class="col-xs-5 col-sm-3" style="text-align: right;">标签类型:</label>' +
+                                            '<select class="selectpicker" style="height: 30px;" name="row[type]" id="type">' +
+                                            '<option value="v001" datatype="">小件通用型卷烟纸(10cmX2.5cm)</option>' +
+                                            '<option value="v002" datatype="">小件细支型卷烟纸(10cmX1.8cm)</option>' +
+                                            '<option value="v003" datatype="">小件接装纸(10cmX4cm)</option>' +
+                                            '<option value="v003" datatype="">小件内衬纸(10cmX4cm)</option>' +
+                                            '<option value="v003" datatype="">小件盒包装膜(10cmX4cm)</option>' +
+                                            '<option value="v003" datatype="">小件框架纸(10cmX4cm)</option>' +
+                                            '<option value="v003" datatype="">小件拉线(10cmX4cm)</option>' +
+                                            '<option value="v004" datatype="">小件条包装膜(10cmX5cm)</option>' +
+                                            '<option value="v005" datatype="">小件盒包装纸(10cmX6cm)</option>' +
+                                            '<option value="v005" datatype="">小件条包装纸(10cmX6cm)</option>' +
+                                            '</select>' +
+                                            '</div>' +
+                                            '<div>' +
+                                            '<label class="col-xs-5 col-sm-3" style="text-align: right;">打印数量:</label>' +
+                                            '<input id="numn" style="width: 200px;margin-bottom: 2px;" name="row[numn]" type="text" value="1">' +
+                                            '</div>' +
+                                            '<div class="form-group" style="margin-top: 10px">' +
+                                            '<div style="text-align: center">' +
+                                            '<button type="submit" id="btn" class="btn btn-primary btn-embossed">确认</button>' +
+                                            '<button type="reset" id="reset" class="btn btn-defaults btn-embossed">取消</button>' +
+                                            '</div>' +
+                                            '</div>';
+
+                                        var layero_ls = layer.open({
+                                            type: 1,
+                                            title: '打码(小件)',
+                                            area: ['400px','200px'],
+                                            content: html,
+                                            success: function(layero) {
+                                                // 在弹窗中绑定事件处理程序
+                                                $(layero).find('#btn').click(function(e) {
+                                                    e.preventDefault();
+                                                    var type = $('#type').val();
+                                                    var numn = $('#numn').val();
+
+                                                    if(numn=='' || numn==0){
+                                                        Toastr.error('请填写打印数量');
+                                                        return false;
+                                                    }
+                                                    $.post('qcode_bach/print_ls', {'ids':ids, 'type':type, 'numn':numn}, function (res) {
+                                                        if(res.code==1){
+                                                            var p = 0;
+                                                            var flage = 0;
+                                                            for(i in res.data.rows) {
+                                                                if (!flage) {
+                                                                    //判断预览情况
+                                                                    if (res.data.type == 'v001'){
+                                                                        print1(res.data.rows[i], 1)
+                                                                    }else if(res.data.type == 'v002'){
+                                                                        print2(res.data.rows[i], 1)
+                                                                    }else if(res.data.type == 'v003'){
+                                                                        print3(res.data.rows[i], 1)
+                                                                    }else if(res.data.type == 'v004'){
+                                                                        print4(res.data.rows[i], 1)
+                                                                    }else if(res.data.type == 'v005'){
+                                                                        print5(res.data.rows[i], 1)
+                                                                    }
+                                                                    LODOP.On_Return = function (TaskID, Value) {
+                                                                        if (Value == 1) {
+                                                                            p = 1;
+                                                                        }
+                                                                    }
+                                                                    flage++;
+                                                                }else{
+                                                                    break;
+                                                                }
+                                                            }
+                                                            var cint = setInterval(function () {
+                                                                if (p == 1) {
+                                                                    clearInterval(cint);
+                                                                    flage = 0;
+                                                                    //修改打印数量
+                                                                    $.post('qcode_bach/set_num', {'status':3,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                                                    for(i in res.data.rows) {
+                                                                        for(j=0;j<res.data.numn;j++){
+                                                                            if (!flage){
+                                                                                flage++;
+                                                                            }else{
+                                                                                if (res.data.type == 'v001'){
+                                                                                    print1(res.data.rows[i])
+                                                                                }else if(res.data.type == 'v002'){
+                                                                                    print2(res.data.rows[i])
+                                                                                }else if(res.data.type == 'v003'){
+                                                                                    print3(res.data.rows[i])
+                                                                                }else if(res.data.type == 'v004'){
+                                                                                    print4(res.data.rows[i])
+                                                                                }else if(res.data.type == 'v005'){
+                                                                                    print5(res.data.rows[i])
+                                                                                }
+                                                                                flage++;
+                                                                            }
+                                                                        }
+
+                                                                    }
+                                                                }
+                                                            },2000)
+
+                                                            return false
+
+                                                        }else{
+                                                            Toastr.error(res.msg);
+                                                        }
+                                                    })
+                                                });
+                                                $(layero).find('#reset').click(function(e) {
+                                                    e.preventDefault();
+                                                    layer.close(layero_ls);
+                                                });
+                                            }
+                                        });
+
+                                        // Fast.api.open("qcode_bach/print_ls?ids="+row.id, "打码(小件)", {
+                                        //     shadeClose: true,
+                                        //     shade: [0.5,'#393D49'],
+                                        //     area: ['400px','400px'],
+                                        //     callback:function(value){
+                                        //         return false;
+                                        //         // 在这里可以接收弹出层中使用`Fast.api.close(data)`进行回传数据
+                                        //     }
+                                        // });
+
+                                    }
+                                }
+                            ],formatter: Table.api.formatter.buttons}
+                    ]
+                ]
+            });
+
+
+            $(document).ready(function() {
+                // 自动触发搜索按钮的点击事件
+                $('.btn-default').click();
+                // 隐藏第一个文字中包含"重置"的按钮
+                // $('button').filter(function() {
+                //     return $(this).text().indexOf('提交') !== -1;
+                // }).eq(0).hide(); // 只隐藏第一个匹配的按钮
+                // // 隐藏第一个文字中包含"重置"的按钮
+                // $('button').filter(function() {
+                //     return $(this).text().indexOf('重置') !== -1;
+                // }).eq(0).hide(); // 只隐藏第一个匹配的按钮
+
+            });
+
+            // 为表格1绑定事件
+            Table.api.bindevent(table);
+
+            Controller.api.bindevent();
+        },
+
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            $('.content').css('min-height','100px');
+
+            $("#type").change(function (e){
+                if(this.value==0){
+                    $("#msg").text('')
+                    $("#numn").prop('disabled',true)
+                }
+                if(this.value==1){
+                    $("#msg").text('重量必填(不能大于4位数)')
+                    $("#numn").prop('disabled',false)
+                }
+                if(this.value==2){
+                    $("#msg").text('总张数必填不能有小数点,且不大于10位')
+                    $("#numn").prop('disabled',false)
+                }
+            })
+
+            $("#btn").click(function (e) {
+                e.preventDefault();
+
+                var data = $("form").serialize();
+                $.post('qcode_bach/edit', {data}, function (res) {
+                    if(res.code==1){
+                        Toastr.success(res.msg)
+                        Fast.api.close(1);
+                        parent.$("#toolbar2 .btn-refresh").trigger("click"); // 触发窗体的父页面刷新
+                    }else{
+                        Toastr.error(res.msg);
+                    }
+                })
+            })
+
+
+            Controller.api.bindevent();
+        },
+        print_l: function () {
+            //大件码打印
+            function print(data,qrcode){
+                //打印二维码
+                var html = '<style type="text/css">' +
+                    '.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}' +
+                    '.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}' +
+                    '.tg .tg-s6z2{text-align:center;}</style>' +
+                    '<div width="340px"><table class="tg" width="340px">' +
+                    '<caption style="width: 300px;">'+data.company_name+'</caption>' +
+                    '<tr><td style="width: 70px;">规格:</td><td colspan="5" style="word-break:break-all;border-color:black;">'+data.product_name+'</td>' +
+                    '<tr><td>配盘数:</td><td colspan="2">'+data.sqrcd+'</td><td>辅单位:</td><td colspan="2">'+data.sec_unit+'</td></tr>' +
+                    '<tr><td>数量:</td><td colspan="2">'+data.num+'</td><td>主单位:</td><td colspan="2">'+data.main_unit+'</td></tr>' +
+                    '<tr><td>生产日期:</td><td colspan="5">'+data.date+'</td></tr>' +
+                    '<tr><td>生产批号:</td><td colspan="5">'+data.batch+'</td></tr>' +
+                    '<tr><td colspan="6" style="word-break:break-all; border-color:black; font-size: 13px;">'+data.qrcode+'</td></table>' +
+                    '<div style="position:absolute;top: 300px;left: 47px"><img src="'+data.pCode+'" > </td></div>' +
+                    '<div style="position:absolute;top: 400px;left: 300px;width: 50px;text-align: center;"><span style="font-weight: 500;word-break:normal;font-size: 16px">大件号'+data.l_flow+'</span></div>\n' +
+                    '</div>';
+                var printPdf = (html,qrcode) => {
+                    var LODOP=getLodop();
+                    LODOP.SET_LICENSES("","152A06E8F6CBD6AC1F213ABFCB0D8604","C94CEE276DB2187AE6B65D56B3FC2848","");
+
+                    LODOP.PRINT_INIT("河南中烟大件二维码打码");
+                    LODOP.SET_PRINT_STYLE("FontSize",16);
+                    LODOP.SET_PRINT_STYLE("Bold",1);
+
+                    LODOP.SET_PRINT_PAGESIZE(1, 100, 150, "CreateCustomPage");
+
+                    LODOP.ADD_PRINT_HTM(15,20,350,545,html);
+
+                    // LODOP.SET_PRINT_STYLEA(0,"QRCodeVersion",14);
+                    // LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                    // LODOP.ADD_PRINT_BARCODE(18,715,'27mm','27mm',"QRCode",qrcode);
+                    // LODOP.PRINT() // 直接打印
+                    // LODOP.PRINT_DESIGN() // 设计模式
+                    if (qrcode){
+                        LODOP.PREVIEW()	//打印预览
+                    }else{
+                        LODOP.PRINT() // 直接打印
+                    }
+
+                }
+                printPdf(html,qrcode)
+            }
+
+            $('.content').css('min-height','100px');
+
+            $("#btn").click(function (e) {
+                e.preventDefault();
+                var data = $("form").serialize();
+
+                $.post('qcode_bach/print_l', {data}, function (res) {
+                    if(res.code==1){
+                        var p = 0;
+                        var flage = 0;
+                        for(i in res.data.rows) {
+                            if (!flage) {
+                                //判断预览情况
+                                if (res.data.type == 'v010'){
+                                    print(res.data.rows[i], 1)
+                                }
+                                LODOP.On_Return = function (TaskID, Value) {
+                                    if (Value == 1) {
+                                        p = 1;
+                                    }
+                                }
+                                flage++;
+                            }else{
+                                break;
+                            }
+                        }
+                        var cint = setInterval(function () {
+                            if (p == 1) {
+                                clearInterval(cint);
+                                flage = 0;
+                                //修改打印数量
+                                $.post('qcode_bach/set_num', {'status':1,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                for(i in res.data.rows) {
+                                    for(j=0;j<res.data.numn;j++){
+                                        if (!flage){
+                                            flage++;
+                                        }else{
+                                            if (res.data.type == 'v010'){
+                                                print(res.data.rows[i]);//打印
+                                            }
+                                            flage++;
+                                        }
+                                    }
+
+                                }
+                            }
+                        },2000)
+
+                        return false
+
+                    }else{
+                        Toastr.error(res.msg);
+                    }
+                })
+            })
+
+            Controller.api.bindevent();
+        },
+        print_s: function () {
+
+
+            //小件码打印(10mmx2.5mm)
+            function print1(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体,楷体;font-size:10px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 250, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(15, 10, 270, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(70,200,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(4,280,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx1.8mm)
+            function print2(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}.tg td{font-family:宋体,楷体;font-size:9px;overflow:hidden;word-break:break-all;border-color:black;}</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 180, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(3, 5, 300, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(50,200,100,18,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLE("QRCodeVersion",10);
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(5,310,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx4mm)
+            function print3(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx4mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 400, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(9, 5, 230, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(130,110,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",14);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(9,240,'45mm','45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx5mm)
+            function print4(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 500, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(20, 10, 230, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(160, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 235, '45mm', '45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx6mm)
+            function print5(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体, 楷体;font-size:14px;padding:2px 2px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx6mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 600, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(25, 10, 180, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(180, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 190, '55mm', '55mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            $('.content').css('min-height','100px');
+
+            $("#btn").click(function (e) {
+                e.preventDefault();
+                var data = $("form").serialize();
+
+                $.post('qcode_bach/print_s', {data}, function (res) {
+                    if(res.code==1){
+                        var p = 0;
+                        var flage = 0;
+                        for(i in res.data.rows) {
+                            if (!flage) {
+                                //判断预览情况
+                                if (res.data.type == 'v001'){
+                                    print1(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v002'){
+                                    print2(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v003'){
+                                    print3(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v004'){
+                                    print4(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v005'){
+                                    print5(res.data.rows[i], 1)
+                                }
+                                LODOP.On_Return = function (TaskID, Value) {
+                                    if (Value == 1) {
+                                        p = 1;
+                                    }
+                                }
+                                flage++;
+                            }else{
+                                break;
+                            }
+                        }
+                        var cint = setInterval(function () {
+                            if (p == 1) {
+                                clearInterval(cint);
+                                flage = 0;
+                                //修改打印数量
+                                $.post('qcode_bach/set_num', {'status':2,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                for(i in res.data.rows) {
+                                    for(j=0;j<res.data.numn;j++){
+                                        if (!flage){
+                                            flage++;
+                                        }else{
+                                            if (res.data.type == 'v001'){
+                                                print1(res.data.rows[i])
+                                            }else if(res.data.type == 'v002'){
+                                                print2(res.data.rows[i])
+                                            }else if(res.data.type == 'v003'){
+                                                print3(res.data.rows[i])
+                                            }else if(res.data.type == 'v004'){
+                                                print4(res.data.rows[i])
+                                            }else if(res.data.type == 'v005'){
+                                                print5(res.data.rows[i])
+                                            }
+                                            flage++;
+                                        }
+                                    }
+
+                                }
+                            }
+                        },2000)
+
+                        return false
+
+                    }else{
+                        Toastr.error(res.msg);
+                    }
+                })
+            })
+
+            Controller.api.bindevent();
+        },
+        print_ls: function () {
+
+
+            //小件码打印(10mmx2.5mm)
+            function print1(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体,楷体;font-size:10px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 250, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(15, 10, 270, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(70,200,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(4,280,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx1.8mm)
+            function print2(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}.tg td{font-family:宋体,楷体;font-size:9px;overflow:hidden;word-break:break-all;border-color:black;}</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx2.5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 180, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(3, 5, 300, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(50,200,100,18,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",10);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLE("QRCodeVersion",10);
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(5,310,'25mm','25mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx4mm)
+            function print3(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx4mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 400, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(9, 5, 230, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(130,110,100,20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",14);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(9,240,'45mm','45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx5mm)
+            function print4(data,qrcode){
+                //打印二维码
+                var html = "<style>" +
+                    ".tg  {font-weight:500;}" +
+                    ".tg td{font-family:宋体, 楷体;font-size:14px;overflow:hidden;word-break:break-all;border-color:black;}" +
+                    "</style>" +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx5mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 500, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(20, 10, 230, 160,html);
+
+                LODOP.ADD_PRINT_TEXT(160, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 235, '45mm', '45mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            //小件码打印(10mmx6mm)
+            function print5(data,qrcode){
+                //打印二维码
+                var html = "<style>.tg  {font-weight:500;}.tg td{font-family:宋体, 楷体;font-size:14px;padding:2px 2px;overflow:hidden;word-break:break-all;border-color:black;}</style> " +
+                    "<table class=\"tg\"> <tr> <td>" + data.company_name + "</td> </tr> " +
+                    "<tr> <td >规格:" + data.product_name + "</td> </tr> " +
+                    "<tr> <td>生产批号:" + data.batch + "</td> </tr> " +
+                    "<tr> <td>日期:" + data.date + "</td> </tr></table>";
+
+                var LODOP=getLodop();
+                LODOP.PRINT_INIT("小件(10mmx6mm)");
+                LODOP.SET_LICENSES("", "152A06E8F6CBD6AC1F213ABFCB0D8604", "C94CEE276DB2187AE6B65D56B3FC2848", "");
+                LODOP.SET_PRINT_PAGESIZE(1, 1000, 600, "CreateCustomPage");
+
+                LODOP.ADD_PRINT_HTM(25, 10, 180, 160, html);
+
+                LODOP.ADD_PRINT_TEXT(180, 100, 100, 20,data.l_flow);
+                LODOP.SET_PRINT_STYLEA(0,"FontName","宋体");
+                LODOP.SET_PRINT_STYLEA(0,"FontSize",16);
+                LODOP.SET_PRINT_STYLEA(0,"FontColor","#000000");
+                LODOP.SET_PRINT_STYLEA(0,"Bold",1);
+
+                LODOP.SET_PRINT_STYLEA(0,"QRCodeErrorLevel","M");
+                LODOP.ADD_PRINT_BARCODE(25, 190, '55mm', '55mm',"QRCode",data.qrcode);
+                if (qrcode){
+                    LODOP.PREVIEW()	//打印预览
+                }else{
+                    LODOP.PRINT() // 直接打印
+                }
+
+            }
+
+            $('.content').css('min-height','100px');
+
+            $("#btn").click(function (e) {
+                e.preventDefault();
+                var data = $("form").serialize();
+
+                $.post('qcode_bach/print_ls', {data}, function (res) {
+                    if(res.code==1){
+                        var p = 0;
+                        var flage = 0;
+                        for(i in res.data.rows) {
+                            if (!flage) {
+                                //判断预览情况
+                                if (res.data.type == 'v001'){
+                                    print1(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v002'){
+                                    print2(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v003'){
+                                    print3(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v004'){
+                                    print4(res.data.rows[i], 1)
+                                }else if(res.data.type == 'v005'){
+                                    print5(res.data.rows[i], 1)
+                                }
+                                LODOP.On_Return = function (TaskID, Value) {
+                                    if (Value == 1) {
+                                        p = 1;
+                                    }
+                                }
+                                flage++;
+                            }else{
+                                break;
+                            }
+                        }
+                        var cint = setInterval(function () {
+                            if (p == 1) {
+                                clearInterval(cint);
+                                flage = 0;
+                                //修改打印数量
+                                $.post('qcode_bach/set_num', {'status':3,'num':res.data.numn, 'ids':res.data.ids}, function (response) {})
+
+                                for(i in res.data.rows) {
+                                    for(j=0;j<res.data.numn;j++){
+                                        if (!flage){
+                                            flage++;
+                                        }else{
+                                            if (res.data.type == 'v001'){
+                                                print1(res.data.rows[i])
+                                            }else if(res.data.type == 'v002'){
+                                                print2(res.data.rows[i])
+                                            }else if(res.data.type == 'v003'){
+                                                print3(res.data.rows[i])
+                                            }else if(res.data.type == 'v004'){
+                                                print4(res.data.rows[i])
+                                            }else if(res.data.type == 'v005'){
+                                                print5(res.data.rows[i])
+                                            }
+                                            flage++;
+                                        }
+                                    }
+
+                                }
+                            }
+                        },2000)
+
+                        return false
+
+                    }else{
+                        Toastr.error(res.msg);
+                    }
+                })
+            })
+
+            Controller.api.bindevent();
+        },
+        reprint: function () {
+            $("#sel-n").data("params", function (obj) {
+                //obj为SelectPage对象
+                return {custom: {name: $("#sel-n").val()}};
+            });
+            $("#sel-p").data("params", function (obj) {
+                //obj为SelectPage对象
+                return {custom: {name: $("#sel-p").val()}};
+            });
+            $("#sel-c").data("params", function (obj) {
+                //obj为SelectPage对象
+                return {custom: {name: $("#sel-c").val()}};
+            });
+
+            $("#btn").click(function (e) {
+                e.preventDefault();
+                var data = $("form").serialize();
+
+                $.post('qcode_bach/reprint',{data},function (res) {
+                    if (res.code==1){
+                        //打印二维码
+                        var html = '<style type="text/css">\n' +
+                            '.tg  {border-collapse:collapse;border-spacing:0;font-weight:500;}\n' +
+                            '.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;border-color:black;}\n' +
+                            '.tg .tg-s6z2{text-align:center;}\n' +
+                            '</style>\n' +
+                            '<div width="340px">\n' +
+                            '<table class="tg" width="340px">\n' +
+                            '<caption style="width: 300px;">'+res.data.company_name+'</caption>\n' +
+                            '<tr>\n' +
+                            '<td style="width: 70px;">规格:</td>\n' +
+                            '<td colspan="5" style="word-break:break-all;border-color:black;">'+res.data.product_name+'</td>\n' +
+                            '</tr>\n' +
+                            '<tr>\n' +
+                            '<td>配盘数:</td>\n' +
+                            '<td colspan="2">'+res.data.sqrcd+'</td>\n' +
+                            '<td>辅单位:</td>\n' +
+                            '<td colspan="2">'+res.data.sec_unit+'</td>\n' +
+                            '</tr>\n' +
+                            '<tr>\n' +
+                            '<td>数量:</td>\n' +
+                            '<td colspan="2">'+res.data.num+'</td>\n' +
+                            '<td>主单位:</td>\n' +
+                            '<td colspan="2">'+res.data.main_unit+'</td>\n' +
+                            '</tr>\n' +
+                            '<tr>\n' +
+                            '<td>生产日期:</td>\n' +
+                            '<td colspan="5">'+res.data.date+'</td>\n' +
                             '</tr>\n' +
                             '<tr>\n' +
                             '<td>生产批号:</td>\n' +

+ 123 - 27
public/assets/js/backend/qcode_product.js

@@ -51,45 +51,58 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 // 表格1
                 var table1 = $("#table1");
                 table1.bootstrapTable({
-                    url: 'qcode_product/products',
+                    url: 'qcode_product/index',
                     extend: {
-                        index_url: 'qcode_product/products' + location.search,
+                        index_url: 'qcode_product/index' + location.search,
+                        table: '工单_基本资料',
                         add_url: 'qcode_product/add',
-                        edit_url: 'qcode_product/edit',
-                        del_url: 'qcode_product/del',
-                        table: 'qcode_product',
                     },
                     toolbar: '#toolbar1',
-                    pk: 'id',
-                    sortName: 'id',
-                    sortOrder: 'asc',
+                    pk: 'Uniqid',
+                    sortName: 'Uniqid',
+                    sortOrder: 'desc',
                     pageSize: 8,
                     pageList: [8, 20, 50, 'All'],
-                    search: false,
+                    search: true,
                     showToggle: false,
                     showColumns: false,
                     showExport: false,
-                    singleSelect: true,
-                    searchFormVisible: true,
-                    searchFormTemplate: 'customformtpl',
+                    singleSelect: false,
                     columns: [
                         [
                             {checkbox: true},
-                            {field: 'product_code', title: __('Product_code'), operate: 'LIKE'},
-                            {field: 'product_name', title: __('Product_name'), operate: 'LIKE'},
-                            {field: 'temple', title: __('Temple')},
-                            {field: 'main_unit', title: __('Main_unit')},
-                            {field: 'sec_unit', title: __('Sec_unit')},
-                            {field: 'proportion', title: __('Proportion')},
-                            {field: 'code', title: __('存货分类编码'), visible:false},
-                            // {field: 'notes', title: __('Notes')},
-                            // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                            {field: 'Gd_gdbh', title: '工单编号', operate: 'LIKE'},
+                            {field: 'Gd_cpdh', title: __('产品代号'), operate: 'LIKE'},
+                            {field: 'Gd_cpmc', title: '产品名称', operate: 'LIKE'}
                         ]
                     ]
                 });
 
                 // 为表格1绑定事件
                 Table.api.bindevent(table1);
+
+                // 绑定自定义按钮点击事件
+                $(".btn-operate").click(function() {
+                    var ids = Table.api.selectedids(table1);
+                    if (ids.length == 0) {
+                        Toastr.error("请至少选择一条记录");
+                        return false;
+                    }
+                    console.log(ids);
+
+                    $.ajax({
+                        url: 'qcode_product/bind',
+                        type: 'GET',
+                        dataType: 'json',
+                        data: {
+                            ids: ids
+                        },
+                        success: function(response) {
+
+                        },
+
+                    });
+                });
             },
             second: function () {
                 // 表格2
@@ -118,12 +131,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     columns: [
                         [
                             {checkbox: true},
-                            {field: 'product_code', title: __('Product_code'), operate: 'LIKE'},
-                            {field: 'product_name', title: __('Product_name'), operate: 'LIKE'},
-                            {field: 'temple', title: __('Temple'), operate: false},
-                            {field: 'main_unit', title: __('Main_unit'), operate: false},
-                            {field: 'sec_unit', title: __('Sec_unit'), operate: false},
-                            {field: 'proportion', title: __('Proportion'), operate: false},
+                            {field: 'Gd_gdbh', title: '工单编号', operate: 'LIKE'},
+                            {field: 'Gd_cpdh', title: __('产品代号'), operate: 'LIKE'},
+                            {field: 'Gd_cpmc', title: '产品名称', operate: 'LIKE'}
                             // {field: 'notes', title: __('Notes')},
                             // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
                         ]
@@ -133,6 +143,92 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 // 为表格2绑定事件
                 Table.api.bindevent(table2);
             }
+            // first: function () {
+            //     // 表格1
+            //     var table1 = $("#table1");
+            //     table1.bootstrapTable({
+            //         url: 'qcode_product/products',
+            //         extend: {
+            //             index_url: 'qcode_product/products' + location.search,
+            //             add_url: 'qcode_product/add',
+            //             edit_url: 'qcode_product/edit',
+            //             del_url: 'qcode_product/del',
+            //             table: 'qcode_product',
+            //         },
+            //         toolbar: '#toolbar1',
+            //         pk: 'id',
+            //         sortName: 'id',
+            //         sortOrder: 'asc',
+            //         pageSize: 8,
+            //         pageList: [8, 20, 50, 'All'],
+            //         search: false,
+            //         showToggle: false,
+            //         showColumns: false,
+            //         showExport: false,
+            //         singleSelect: true,
+            //         searchFormVisible: true,
+            //         searchFormTemplate: 'customformtpl',
+            //         columns: [
+            //             [
+            //                 {checkbox: true},
+            //                 {field: 'Gd_gdbh', title: '工单编号', operate: 'LIKE'},
+            //                 // {field: 'product_name', title: __('Product_name'), operate: 'LIKE'},
+            //                 // {field: 'temple', title: __('Temple')},
+            //                 // {field: 'main_unit', title: __('Main_unit')},
+            //                 // {field: 'sec_unit', title: __('Sec_unit')},
+            //                 // {field: 'proportion', title: __('Proportion')},
+            //                 // {field: 'code', title: __('存货分类编码'), visible:false},
+            //                 // {field: 'notes', title: __('Notes')},
+            //                 // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+            //             ]
+            //         ]
+            //     });
+            //
+            //     // 为表格1绑定事件
+            //     Table.api.bindevent(table1);
+            // },
+            // second: function () {
+            //     // 表格2
+            //     var table2 = $("#table2");
+            //     table2.bootstrapTable({
+            //         url: 'qcode_product/product',
+            //         extend: {
+            //             index_url: '',
+            //             add_url: '',
+            //             edit_url: '',
+            //             del_url: '',
+            //             multi_url: '',
+            //             table: '',
+            //         },
+            //         toolbar: '#toolbar2',
+            //         pk: 'id',
+            //         sortName: 'id',
+            //         sortOrder: 'asc',
+            //         pageSize: 8,
+            //         pageList: [8, 20, 50, 'All'],
+            //         search: false,
+            //         showToggle: false,
+            //         showColumns: false,
+            //         showExport: false,
+            //         singleSelect: true,
+            //         columns: [
+            //             [
+            //                 {checkbox: true},
+            //                 {field: 'product_code', title: __('Product_code'), operate: 'LIKE'},
+            //                 {field: 'product_name', title: __('Product_name'), operate: 'LIKE'},
+            //                 {field: 'temple', title: __('Temple'), operate: false},
+            //                 {field: 'main_unit', title: __('Main_unit'), operate: false},
+            //                 {field: 'sec_unit', title: __('Sec_unit'), operate: false},
+            //                 {field: 'proportion', title: __('Proportion'), operate: false},
+            //                 // {field: 'notes', title: __('Notes')},
+            //                 // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+            //             ]
+            //         ]
+            //     });
+            //
+            //     // 为表格2绑定事件
+            //     Table.api.bindevent(table2);
+            // }
         },
 
         add: function () {

+ 56 - 19
public/assets/js/backend/user/user.js

@@ -21,33 +21,70 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
                 sortName: 'user.id',
+                fixedColumns: true,
+                fixedRightNumber: 1,
+
                 columns: [
                     [
                         {checkbox: true},
-                        {field: 'id', title: __('Id'), sortable: true},
-                        {field: 'group.name', title: __('Group')},
-                        {field: 'username', title: __('Username'), operate: 'LIKE'},
-                        {field: 'nickname', title: __('Nickname'), operate: 'LIKE'},
-                        {field: 'email', title: __('Email'), operate: 'LIKE'},
-                        {field: 'mobile', title: __('Mobile'), operate: 'LIKE'},
-                        {field: 'avatar', title: __('Avatar'), events: Table.api.events.image, formatter: Table.api.formatter.image, operate: false},
-                        {field: 'level', title: __('Level'), operate: 'BETWEEN', sortable: true},
-                        {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
-                        {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
-                        {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
-                        {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
-                        {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
-                        {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
-                        {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
-                        {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
-                        {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
-                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: '_id.$oid', title: __('Id'), sortable: true},
+                        {field: 'order_ddbh', title: __('销售订单号')},
+                        {field: 'gdbh', title: __('工单编号'), operate: 'LIKE'},
+                        {field: 'cpmc', title: __('产品名称'), operate: 'LIKE'},
+                        {field: 'total_ru_quantity', title: __('入库数量'), operate:false},
+                        {field: 'total_chu_quantity', title: __('出库数量'),   operate: false},
+                        {field: 'remaining_quantity', title: __('剩余数量'), operate: false},
+                        // {field: 'email', title: __('Email'), operate: 'LIKE'},
+                        // {field: 'gender', title: __('Gender'), visible: false, searchList: {1: __('Male'), 0: __('Female')}},
+                        // {field: 'score', title: __('Score'), operate: 'BETWEEN', sortable: true},
+                        // {field: 'successions', title: __('Successions'), visible: false, operate: 'BETWEEN', sortable: true},
+                        // {field: 'maxsuccessions', title: __('Maxsuccessions'), visible: false, operate: 'BETWEEN', sortable: true},
+                        // {field: 'logintime', title: __('Logintime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        // {field: 'loginip', title: __('Loginip'), formatter: Table.api.formatter.search},
+                        // {field: 'jointime', title: __('Jointime'), formatter: Table.api.formatter.datetime, operate: 'RANGE', addclass: 'datetimerange', sortable: true},
+                        // {field: 'joinip', title: __('Joinip'), formatter: Table.api.formatter.search},
+                        // {field: 'status', title: __('Status'), formatter: Table.api.formatter.status, searchList: {normal: __('Normal'), hidden: __('Hidden')}},
+                        // {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {field: 'operate',
+                            title: __('Operate'),
+                            table: table,
+                            events: {
+                                'click .btn-detail-out': function (e, value, row, index) {
+                                    let url = 'user/user/chuku?order_ddbh=' + encodeURIComponent(row.order_ddbh)
+                                        + '&gdbh=' + encodeURIComponent(row.gdbh)
+                                        + '&cpmc=' + encodeURIComponent(row.cpmc);
+                                    Fast.api.open(url, '出库明细', {
+                                        area: ['80%', '80%']  // 设置弹窗大小
+                                    });
+                                },
+                                'click .btn-detail-in': function (e, value, row, index) {
+                                    let url = 'user/user/ruku?order_ddbh=' + encodeURIComponent(row.order_ddbh)
+                                        + '&gdbh=' + encodeURIComponent(row.gdbh)
+                                        + '&cpmc=' + encodeURIComponent(row.cpmc);
+                                    Fast.api.open(url, '入库明细', {
+                                        area: ['80%', '80%']
+                                    });
+                                },
+                            },
+                            formatter: function (value, row, index) {
+                                var buttons = [];
+                                buttons.push('<a href="javascript:;" class="btn btn-xs btn-info btn-detail-in"><i class="fa fa-sign-in"></i> 入库明细</a>');
+                                buttons.push('<a href="javascript:;" class="btn btn-xs btn-info btn-detail-out"><i class="fa fa-sign-out"></i> 出库明细</a>');
+                                return buttons.join(' ');
+                            }
+                        }
                     ]
                 ]
             });
 
             // 为表格绑定事件
             Table.api.bindevent(table);
+            //切换栏目显示隐藏
+            $(document).on("click", "a.btn-channel", function () {
+                $("#archivespanel").toggleClass("col-md-10", $("#channelbar").hasClass("hidden"));
+                $("#archivespanel").toggleClass("col-full-width", !$("#channelbar").hasClass("hidden"));
+                $("#channelbar").toggleClass("hidden");
+            });
         },
         add: function () {
             Controller.api.bindevent();
@@ -62,4 +99,4 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
         }
     };
     return Controller;
-});
+});