liuhairui 1 year ago
parent
commit
7eabe5566a
83 changed files with 8862 additions and 206 deletions
  1. 6 4
      application/admin/controller/Index.php
  2. 148 0
      application/admin/controller/stock/Customer.php
  3. 170 0
      application/admin/controller/stock/Datadict.php
  4. 105 0
      application/admin/controller/stock/Datadictitem.php
  5. 303 0
      application/admin/controller/stock/Goods.php
  6. 254 0
      application/admin/controller/stock/Goodscategory.php
  7. 179 0
      application/admin/controller/stock/Stockcur.php
  8. 477 0
      application/admin/controller/stock/Stockin.php
  9. 601 0
      application/admin/controller/stock/Stockout.php
  10. 40 0
      application/admin/controller/stock/Supplier.php
  11. 21 0
      application/admin/lang/zh-cn/stock/customer.php
  12. 18 0
      application/admin/lang/zh-cn/stock/datadict.php
  13. 15 0
      application/admin/lang/zh-cn/stock/datadictitem.php
  14. 36 0
      application/admin/lang/zh-cn/stock/goods.php
  15. 7 0
      application/admin/lang/zh-cn/stock/goodscategory.php
  16. 9 0
      application/admin/lang/zh-cn/stock/stockcur.php
  17. 24 0
      application/admin/lang/zh-cn/stock/stockin.php
  18. 53 0
      application/admin/lang/zh-cn/stock/stockout.php
  19. 11 0
      application/admin/lang/zh-cn/stock/supplier.php
  20. 3 3
      application/admin/view/common/header.html
  21. 107 107
      application/admin/view/dashboard/index.html
  22. 9 9
      application/admin/view/index/login.html
  23. 52 0
      application/admin/view/stock/add.html
  24. 64 0
      application/admin/view/stock/customer/add.html
  25. 65 0
      application/admin/view/stock/customer/edit.html
  26. 26 0
      application/admin/view/stock/customer/index.html
  27. 63 0
      application/admin/view/stock/datadict/add.html
  28. 60 0
      application/admin/view/stock/datadict/edit.html
  29. 25 0
      application/admin/view/stock/datadict/index.html
  30. 54 0
      application/admin/view/stock/datadictitem/add.html
  31. 54 0
      application/admin/view/stock/datadictitem/edit.html
  32. 36 0
      application/admin/view/stock/datadictitem/index.html
  33. 47 0
      application/admin/view/stock/edit.html
  34. 59 0
      application/admin/view/stock/goods/add.html
  35. 18 0
      application/admin/view/stock/goods/detail.html
  36. 58 0
      application/admin/view/stock/goods/edit.html
  37. 50 0
      application/admin/view/stock/goods/index.html
  38. 29 0
      application/admin/view/stock/goodscategory/add.html
  39. 29 0
      application/admin/view/stock/goodscategory/edit.html
  40. 27 0
      application/admin/view/stock/goodscategory/index.html
  41. 44 0
      application/admin/view/stock/index.html
  42. 28 0
      application/admin/view/stock/stockcur/add.html
  43. 57 0
      application/admin/view/stock/stockcur/edit.html
  44. 38 0
      application/admin/view/stock/stockcur/index.html
  45. 118 0
      application/admin/view/stock/stockcur/mainpage.html
  46. 193 0
      application/admin/view/stock/stockin/add.html
  47. 187 0
      application/admin/view/stock/stockin/edit.html
  48. 22 0
      application/admin/view/stock/stockin/getlist.html
  49. 28 0
      application/admin/view/stock/stockin/index.html
  50. 72 0
      application/admin/view/stock/stockin/look.html
  51. 3 0
      application/admin/view/stock/stockin/printer.html
  52. 174 0
      application/admin/view/stock/stockout/add.html
  53. 182 0
      application/admin/view/stock/stockout/edit.html
  54. 22 0
      application/admin/view/stock/stockout/getlist.html
  55. 26 0
      application/admin/view/stock/stockout/index.html
  56. 72 0
      application/admin/view/stock/stockout/look.html
  57. 5 0
      application/admin/view/stock/stockout/printer.html
  58. 58 0
      application/admin/view/stock/supplier/add.html
  59. 58 0
      application/admin/view/stock/supplier/edit.html
  60. 24 0
      application/admin/view/stock/supplier/index.html
  61. 4 77
      application/api/controller/Manufacture.php
  62. 2 0
      application/api/controller/WorkOrder.php
  63. 77 6
      application/api/controller/WorkOrderSpotCheck.php
  64. 143 0
      public/assets/addons/lodop-print/Lodop.js
  65. 5 0
      public/assets/addons/pinyinUtil/dict/pinyin_dict_firstletter.js
  66. 372 0
      public/assets/addons/pinyinUtil/pinyinUtil.js
  67. 132 0
      public/assets/js/backend/stock/customer.js
  68. 67 0
      public/assets/js/backend/stock/datadict.js
  69. 92 0
      public/assets/js/backend/stock/datadictitem.js
  70. 246 0
      public/assets/js/backend/stock/goods.js
  71. 121 0
      public/assets/js/backend/stock/goodscategory.js
  72. 0 0
      public/assets/js/backend/stock/libs/element-ui.css
  73. 0 0
      public/assets/js/backend/stock/libs/element-ui.js
  74. BIN
      public/assets/js/backend/stock/libs/fonts/element-icons.ttf
  75. BIN
      public/assets/js/backend/stock/libs/fonts/element-icons.woff
  76. 5 0
      public/assets/js/backend/stock/libs/vue.js
  77. 242 0
      public/assets/js/backend/stock/stockcur.js
  78. 897 0
      public/assets/js/backend/stock/stockin.js
  79. 924 0
      public/assets/js/backend/stock/stockout.js
  80. 59 0
      public/assets/js/backend/stock/supplier.js
  81. 279 0
      public/assets/js/jQuery.print.js
  82. 372 0
      public/assets/js/pingyinUntil.js
  83. 0 0
      public/assets/js/qrcode.min.js

+ 6 - 4
application/admin/controller/Index.php

@@ -5,6 +5,7 @@ namespace app\admin\controller;
 use app\admin\model\AdminLog;
 use app\common\controller\Backend;
 use think\Config;
+use think\Db;
 use think\Hook;
 use think\Session;
 use think\Validate;
@@ -87,10 +88,10 @@ class Index extends Backend
                 'password'  => $password,
                 '__token__' => $token,
             ];
-            if (Config::get('fastadmin.login_captcha')) {
-                $rule['captcha'] = 'require|captcha';
-                $data['captcha'] = $this->request->post('captcha');
-            }
+//            if (Config::get('fastadmin.login_captcha')) {
+//                $rule['captcha'] = 'require|captcha';
+//                $data['captcha'] = $this->request->post('captcha');
+//            }
             $validate = new Validate($rule, [], ['username' => __('Username'), 'password' => __('Password'), 'captcha' => __('Captcha')]);
             $result = $validate->check($data);
             if (!$result) {
@@ -138,4 +139,5 @@ class Index extends Backend
         return $html;
     }
 
+
 }

+ 148 - 0
application/admin/controller/stock/Customer.php

@@ -0,0 +1,148 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use fast\Tree;
+
+/**
+ * 客户管理
+ *
+ * @icon fa fa-circle-o
+ */
+class Customer extends Backend {
+
+    /**
+     * StockCustomer模型对象
+     * @var \app\admin\model\StockCustomer
+     */
+    protected $model = null;
+
+    protected $noNeedLogin = ['madeEncode', 'getwdTree'];
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Customer');
+        $customerList = collection($this->model->order('weigh')->select())->toArray();
+        Tree::instance()->init($customerList);
+
+        $customer = [];
+        $this->customerList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
+        $primary = array(array('name' => '==请选择==', 'id' => '0'));
+        $result = array_merge_recursive($primary, $this->customerList);
+        foreach ($result as $k => $v) {
+            $customer[$v['id']] = $v['name'];
+        }
+        $this->view->assign('customer', $customer);
+        $this->view->assign("enabledmarkList", $this->model->getEnabledmarkList());
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index() {
+        if ($this->request->isAjax()) {
+            $list = $this->customerList;
+            $total = count($this->customerList);
+
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+                    $params[$this->dataLimitField] = $this->auth->id;
+                }
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = basename(str_replace('\\', '/', get_class($this->model)));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate;
+                        $this->model->validate($validate);
+                    }
+                    $result = $this->model->allowField(true)->save($params);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $result = $this->model->where('pid', 0)->order('encode desc')->limit(1)->select();
+        if ($result) {
+            $suffix = (int) ($result[0]['encode']);
+            $suffix ++;
+        } else {
+            $suffix = 0;
+        }
+        $encode = sprintf("%02d", $suffix);
+        $this->view->assign('encode', $encode);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 根据父级部门生成部门代码
+     */
+    public function madeEncode() {
+        if ($this->request->isPost()) {
+            $id = $this->request->post('id');
+            if ($id || $id == 0) {
+                try {
+                    $result = $this->model->where('pid', $id)->field('Encode')->order('Encode desc')->limit(1)->select();
+                    $Encode = '';
+                    if (count($result) > 0) {
+                        $EncodeArr = explode('.', $result[0]['Encode']);
+                        $EncodeArr[count($EncodeArr) - 1] = sprintf("%03d", $EncodeArr[count($EncodeArr) - 1] + 1);
+                        $Encode = implode('.', $EncodeArr);
+                    } else {
+                        $result = $this->model->where('id', $id)->field('Encode')->order('Encode desc')->limit(1)->select();
+                        if (count($result) > 0) {
+                            $Encode = $result[0]['Encode'] . '.001';
+                        } else {
+                            $Encode = '001';
+                        }
+                    }
+                    return json($Encode);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    /**
+     * 获取部门树
+     */
+    public function getwdTree() {
+        if ($this->auth->isSuperAdmin()) {
+            $categoryList = collection($this->model->select())->toArray();
+        } else {
+            $categoryList = collection($this->model->where('id', $this->auth->customerid)->select())->toArray();
+            $categoryList[0]['pid'] = 0;
+        }
+        Tree::instance()->init($categoryList);
+        $result = Tree::instance()->getwdTreeArray(0, 'name');
+        return json($result);
+    }
+
+}

+ 170 - 0
application/admin/controller/stock/Datadict.php

@@ -0,0 +1,170 @@
+<?php
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use think\Db;
+use fast\Tree;
+use think\exception\PDOException;
+use think\exception\ValidateException;
+
+/**
+ * 字典分类
+ *
+ * @icon fa fa-circle-o
+ */
+class Datadict extends Backend {
+
+    /**
+     * Datadict模型对象
+     * @var \app\admin\model\stock\Datadict
+     */
+    protected $model = null;
+    protected $dataDiclist = [];
+    protected $noNeedRight = ['getjsTree'];
+
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Datadict');
+        $this->view->assign("istreeList", $this->model->getIstreeList());
+        $this->view->assign("enabledList", $this->model->getEnabledList());
+        // 必须将结果集转换为数组
+        $dataDiclist = collection($this->model->order('weigh', 'desc')->select())->toArray();
+        Tree::instance()->init($dataDiclist);
+        $this->dataDiclist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0));
+        $dataDicdata = [0 => '无'];
+        foreach ($this->dataDiclist as $k => &$v) {
+            $dataDicdata[$v['id']] = $v['name'];
+        }
+        $this->view->assign('dataDicdata', $dataDicdata);
+    }
+
+    /**
+     * 查看
+     */
+    public function index() {
+        if ($this->request->isAjax()) {
+            $list = $this->dataDiclist;
+            $total = count($this->dataDiclist);
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+    public function getjsTree() {
+        $list = collection($this->model->order('weigh', 'desc')->select())->toArray();
+        $result = [];
+        foreach ($list as $k => $v) {
+            $n = [];
+            $n['id'] = $v['id'];
+            $n['parent'] = $v['pid'] == 0 ? "#" : $v['pid'];
+            $n['text'] = $v['name'];
+            $n['data'] = $v;
+            $n['state'] = ["opend" => true, "disabled" => false];
+            $result[] = $n;
+        }
+        return json($result);
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null) {
+        $row = $this->model->get($ids);
+        if ($row->id == 9) {
+            $this->error("系统保留分类,禁止修改!");
+        }
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                        $row->validateFailException(true)->validate($validate);
+                    }
+
+                    if ($row->id == 9) {
+                        $this->error("系统保留分类,禁止修改!");
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 删除
+     */
+    public function del($ids = "") {
+        if ($ids) {
+            $pk = $this->model->getPk();
+            $adminIds = $this->getDataLimitAdminIds();
+            if (is_array($adminIds)) {
+                $this->model->where($this->dataLimitField, 'in', $adminIds);
+            }
+            $list = $this->model->where($pk, 'in', $ids)->select();
+
+            $count = 0;
+            Db::startTrans();
+            try {
+                foreach ($list as $k => $v) {
+                    if ($v->id == 9) {
+                        $this->error("系统保留分类,禁止删除!");
+                    }
+                    $count += $v->delete();
+                }
+                Db::commit();
+            } catch (PDOException $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            } catch (Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+            if ($count) {
+                $this->success();
+            } else {
+                $this->error(__('No rows were deleted'));
+            }
+        }
+        $this->error(__('Parameter %s can not be empty', 'ids'));
+    }
+
+}

+ 105 - 0
application/admin/controller/stock/Datadictitem.php

@@ -0,0 +1,105 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use fast\Tree;
+
+/**
+ * 字典数据
+ *
+ * @icon fa fa-circle-o
+ */
+class Datadictitem extends Backend {
+
+    /**
+     * Datadictitem模型对象
+     * @var \app\admin\model\stock\Datadictitem
+     */
+    protected $model = null;
+    protected $relationSearch = true;
+    protected $searchFields = 'name,value';
+
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Datadictitem');
+        $dataDiclist = collection(model('\app\admin\model\stock\Datadict')->order('weigh', 'desc')->select())->toArray();
+        Tree::instance()->init($dataDiclist);
+        $this->dataDiclist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0));
+        foreach ($this->dataDiclist as $k => &$v) {
+            $dataDicdata[$v['id']] = $v['name'];
+        }
+        $this->view->assign('dataDicdata', $dataDicdata);
+        $this->view->assign("enabledList", $this->model->getEnabledList());
+    }
+
+    /**
+     * 查看
+     */
+    public function index() {
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $datadict_id = $this->request->request('datadict_id');
+            if ($datadict_id) {
+                $total = $this->model->where($where)->where('datadict_id', 'in', $datadict_id)->order($sort, $order)->count();
+                $list = $this->model->where($where)->where('datadict_id', 'in', $datadict_id)->order($sort, $order)->limit($offset, $limit)->select();
+            } else {
+//                $total = $this->model->where($where)->count();
+//                $list = $this->model->where($where)->order($sort, $order)->limit($offset, $limit)->select();
+                $total = [];
+                $list = [];
+            }
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+                    $params[$this->dataLimitField] = $this->auth->id;
+                }
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = basename(str_replace('\\', '/', get_class($this->model)));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate;
+                        $this->model->validate($validate);
+                    }
+                    $result = $this->model->allowField(true)->save($params);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $datadict_id = $this->request->param("datadict_id");
+        $this->view->assign("datadict_id", $datadict_id);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+}

+ 303 - 0
application/admin/controller/stock/Goods.php

@@ -0,0 +1,303 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use fast\Tree;
+use think\Db;
+
+/**
+ * 商品库
+ *
+ * @icon fa fa-circle-o
+ */
+class Goods extends Backend {
+
+    /**
+     * StockGoods模型对象
+     * @var \app\admin\model\stock\Goods
+     */
+    protected $noNeedRight = ['detail', 'madevolnum', 'getlist','getgoodsbybarcodeorid'];
+    protected $model = null;
+
+    /**
+     * 快速搜索时执行查找的字段
+     */
+    protected $relationSearch = true;
+    protected $searchFields = 'volnum,goodsname';
+
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Goods');
+        $goodscategorylist = collection(model('\app\admin\model\stock\Goodscategory')->select())->toArray();
+        Tree::instance()->init($goodscategorylist);
+        $goodscategorylist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
+        $categorylist = array('' => '==请选择==');
+        $this->categoryList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
+        foreach ($goodscategorylist as $k => $v) {
+            $categorylist[$v['id']] = $v['name'];
+        }
+        $measureunit = model('\app\admin\model\stock\Datadict')->getDatadic('JiLiangDW');
+        $this->view->assign('goodscategorylist', $categorylist);
+        $this->view->assign('measureunit', $measureunit);
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index() {
+
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            $post = $this->request->request('');
+
+//            //如果发送的来源是Selectpage,则转发到Selectpage
+//            if ($this->request->request('keyField')) {
+//                return $this->selectpage();
+//            }
+//            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+//            $categoryids = $this->request->request("categoryids");
+//            $query = [];
+//            if ($categoryids !== "") {
+//                $query["goods.goodscategoryid"] = ["in", $categoryids];
+//            }
+
+//            $total = $this->model
+//                    ->with('goodscategory')
+//                    ->where($where)
+//                    ->where($query)
+//                    ->order($sort, $order)
+//                    ->count();
+//            $list = $this->model
+//                    ->with('goodscategory')
+//                    ->where($where)
+//                    ->where($query)
+//                    ->order($sort, $order)
+//                    ->limit($offset, $limit)
+//                    ->select();
+            $where['mod_rq'] = null;
+            $total = Db::name('工单_基本资料')
+                ->where($where)
+                ->order('订单编号 desc')
+                ->limit($post['offset'], $post['limit'])
+//                ->limit($offset, $limit)
+                ->count();
+            $list = Db::name('工单_基本资料')
+                ->where($where)
+                ->order('订单编号 desc')
+                ->limit($post['offset'], $post['limit'])
+//                ->limit($offset, $limit)
+                ->select();
+
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 获取所有商品列表
+     */
+    public function getlist() {
+        //设置过滤方法
+        if ($this->request->isAjax()) {
+
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $searchvalue = $this->request->request("searchvalue");
+            $query = [];
+            if ($searchvalue) {
+                $query["volnum|goodsname|spell"] = ["LIKE", '%' . $searchvalue . '%'];
+            }
+
+            $total = $this->model
+                    ->with('goodscategory')
+                    ->where($where)
+                    ->where($query)
+                    ->order($sort, $order)
+                    ->count();
+            $list = $this->model
+                    ->with('goodscategory')
+                    ->where($where)
+                    ->where($query)
+                    ->order($sort, $order)
+                    ->limit($offset, $limit)
+                    ->select();
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+    }
+
+    /**
+     * 添加
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                    $params['volnum'] = $params['volnum'];
+                    $params['spell'] = $params['goodsname'];
+                    $params['barcode'] = $params['productmodel'];
+                    $params['createtime'] = date('Y-m-d H:i:s');
+                    $result = Db::name('stock_goods')->insert($params);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+            }
+            $this->error(__('网络异常,请重新添加', ''));
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 删除
+     */
+    public function del($ids = "") {
+        if ($ids) {
+            $pk = $this->model->getPk();
+            $adminIds = $this->getDataLimitAdminIds();
+            if (is_array($adminIds)) {
+                $count = $this->model->where($this->dataLimitField, 'in', $adminIds);
+            }
+            $list = $this->model->where($pk, 'in', $ids)->select();
+            $count = 0;
+            foreach ($list as $k => $v) {
+                $goodinfo = model('\app\admin\model\stock\Stockinlist')->where('stock_goods_id', '=', $v->id)->limit(1)->select();
+                if ($goodinfo) {
+                    $this->error('该商品存在入库信息,不能删除!');
+                } else {
+                    $count += $v->delete();
+                }
+            }
+
+            if ($count) {
+                $this->success();
+            } else {
+                $this->error(__('No rows were deleted'));
+            }
+        }
+        $this->error(__('Parameter %s can not be empty', 'ids'));
+    }
+
+    /**
+     * 出入明细
+     */
+    public function detail($ids = null) {
+        if ($this->request->isAjax()) {
+            $ids = $this->request->request('ids');
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $subQuery = \think\Db::field('\'入库\' AS leixing, `stock_goods_id`,`inboundtime` AS riqi,stockinnums,\'\' as stockoutnums,amount AS stockinamount,\'\' as stockoutamount')
+                    ->name('stock_stockin_list')
+                    ->alias('list')
+                    ->join('stock_stockin stockin','stockin.id=list.stock_stockin_id')
+                    ->union(function ($query) {
+                        $query->field('\'出库\' AS leixing,`stock_goods_id`,`outboundtime` AS riqi,\'\' as stockinnums,stockoutnums,\'\' as stockinamount,amount AS stockoutamount')
+                        ->name('stock_stockout_list')
+                        ->alias('list')
+                        ->join('stock_stockout stockout','stockout.id=list.stock_stockout_id');
+                    })
+                    ->buildSql();
+            $sum = \think\Db::table($subQuery . ' a')
+                            ->field('COUNT(*) AS total, SUM(a.stockinnums) AS totalstockinnums,SUM(a.stockinamount) AS totalstockinamount,SUM(a.stockoutnums) AS totalstockoutnums,SUM(a.stockoutamount) AS totalstockoutamount')
+                            ->where('a.stock_goods_id', $ids)->select();
+            $total = $sum[0]['total'];
+            $list = \think\Db::view([$subQuery => 'a'], '*')
+                            ->view('stock_goods goods', '*', 'a.stock_goods_id=goods.id', 'left')
+                            ->where('goods.id', $ids)->where($where)->order($sort, $order)->limit($offset, $limit)->select();
+            $list = collection($list)->toArray();
+            if (count($list) > 0) {
+                $list[0]["sum"] = $sum[0];
+            }
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        $this->view->assign("ids", $ids);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 根据商品类别生成商品代码
+     */
+    public function madevolnum() {
+        if ($this->request->isPost()) {
+            $goodscategoryid = $this->request->post('goodscategoryid');
+            if ($goodscategoryid) {
+                try {
+                    //生产商品代码
+                    $aVolnum = $this->model->where('goodscategoryid', $goodscategoryid)->field('volnum')->order('volnum desc')->limit(1)->select();
+                    $volnum = '';
+                    if (count($aVolnum) > 0) {
+                        $volnumArr = explode('.', $aVolnum[0]['volnum']);
+                        $volnumArr[count($volnumArr) - 1] = sprintf("%03d", $volnumArr[count($volnumArr) - 1] + 1);
+                        $volnum = implode('.', $volnumArr);
+                    } else {
+                        $bVolnum = model('\app\admin\model\stock\Goodscategory')->where('id', $goodscategoryid)->column('value');
+                        if (count($bVolnum) > 0) {
+                            $volnum = ($bVolnum[0] . '.001');
+                        } else {
+                            $volnum = "001";
+                        }
+                    }
+                    //查询商品类别名称
+                    $result['volnum'] = $volnum;
+                    $result['goodscategory'] = $goodscategoryid;
+                    $this->success("获取成功!", "", $result);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    //入库查询
+    public function getgoodsbybarcodeorid() {
+        if ($this->request->isPost()) {
+            $barcode = $this->request->post('barcode');
+            $id = $this->request->post('id');
+
+            if ($barcode) {
+                $goods = $this->model->where("barcode",$barcode)->find();
+                if ($goods) {
+                    // $goods["curstocknum"]=$goods->curstocknum;
+                    $this->success("查询成功!", "", $goods);
+                } else {
+                    $this->success("没有找到商品!", "", $goods);
+                }
+            }else if($id) {
+                $goods = $this->model->get($id);
+                if ($goods) {
+                    // $goods["curstocknum"]=$goods->curstocknum;
+                    $this->success("查询成功!", "", $goods);
+                } else {
+                    $this->success("没有找到商品!", "", $goods);
+                }
+            }
+            $this->error(__('参数不能为空!', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    /**
+     * 导入
+     */
+    public function import() {
+        return parent::import();
+    }
+
+}

+ 254 - 0
application/admin/controller/stock/Goodscategory.php

@@ -0,0 +1,254 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use think\Db;
+use fast\Tree;
+
+/**
+ * 商品分类
+ *
+ * @icon fa fa-circle-o
+ */
+class Goodscategory extends Backend {
+
+    /**
+     * StockGoodscategory模型对象
+     * @var \app\admin\model\stock\Goodscategory
+     */
+    protected $noNeedRight = ['madevalue', 'getjsTree', 'category'];
+    protected $model = null;
+    protected $categoryList = [];
+
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Goodscategory');
+        $goodsCategoryList = collection($this->model->select())->toArray();
+        Tree::instance()->init($goodsCategoryList);
+
+        $goodsCategory = [];
+        $this->categoryList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
+        $primary = array(array('name' => '无', 'id' => '0'));
+        $result = array_merge_recursive($primary, $this->categoryList);
+        foreach ($result as $k => $v) {
+            $goodsCategory[$v['id']] = $v['name'];
+        }
+
+        $this->view->assign("goodsCategory", $goodsCategory);
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index() {
+        if ($this->request->isAjax()) {
+            $list = $this->categoryList;
+            $total = count($this->categoryList);
+
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add() {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+                    $params[$this->dataLimitField] = $this->auth->id;
+                }
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.add' : true) : $this->modelValidate;
+                        $this->model->validate($validate);
+                    }
+                    $result = $this->model->allowField(true)->save($params);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $result = $this->model->where('pid', 0)->order('value desc')->limit(1)->select();
+        if ($result) {
+            $suffix = (int) ($result[0]['value']);
+            $suffix ++;
+        } else {
+            $suffix = 0;
+        }
+        $value = sprintf("%02d", $suffix);
+        $this->view->assign('value', $value);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 根据商品类别生成商品代码
+     */
+    public function madevalue() {
+        if ($this->request->isPost()) {
+            $id = $this->request->post('id');
+            if ($id || $id == 0) {
+                try {
+                    $result = $this->model->where('pid', $id)->field('value')->order('value desc')->limit(1)->select();
+                    $value = '';
+                    if (count($result) > 0) {
+                        $suffix = (int) (substr($result[0]['value'], -2));
+                        $suffix ++;
+                        $suffix = sprintf("%02d", $suffix); //数字自动补零
+                        $prefix = substr($result[0]['value'], 0, -2);
+                        $value = $prefix . $suffix;
+                    } else {
+                        $result = $this->model->where('id', $id)->field('value')->order('value desc')->limit(1)->select();
+                        if (count($result) > 0) {
+                            $value = $result[0]['value'] . '.01';
+                        } else {
+                            $value = '01';
+                        }
+                    }
+                    $this->success("获取成功!","", ["code" => $value]);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    /**
+     * 获取商品类别树
+     */
+    public function getjsTree() {
+        $categoryList = collection($this->model->select())->toArray();
+        $result = [];
+        foreach ($categoryList as $k => $v) {
+            $n = [];
+            $n['id'] = $v['id'];
+            $n['parent'] = $v['pid'] == 0 ? "#" : $v['pid'];
+            $n['text'] = $v['name'];
+            $n['type'] = $v['id'];
+            $n['data'] = $v;
+            $n['state'] = ["opend" => true, "disabled" => false, "selected" => true];
+            $result[] = $n;
+        }
+        return json($result);
+    }
+
+    /**
+     * 获取商品类别名称
+     */
+    public function category() {
+        $result = collection($this->model->select())->toArray();
+        return json($result);
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null) {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                $params = $this->preExcludeFields($params);
+                $result = false;
+                Db::startTrans();
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = str_replace("\\model\\", "\\validate\\", get_class($this->model));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : $name) : $this->modelValidate;
+                        $row->validateFailException(true)->validate($validate);
+                    }
+                    $result = $row->allowField(true)->save($params);
+                    Db::commit();
+                } catch (ValidateException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (PDOException $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                } catch (Exception $e) {
+                    Db::rollback();
+                    $this->error($e->getMessage());
+                }
+                if ($result !== false) {
+                    $this->success();
+                } else {
+                    $this->error(__('No rows were updated'));
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 删除
+     */
+    public function del($ids = "") {
+        if ($ids) {
+            $pk = $this->model->getPk();
+            $adminIds = $this->getDataLimitAdminIds();
+            if (is_array($adminIds)) {
+                $this->model->where($this->dataLimitField, 'in', $adminIds);
+            }
+            $list = $this->model->where($pk, 'in', $ids)->select();
+
+            $count = 0;
+            Db::startTrans();
+            try {
+                foreach ($list as $k => $v) {
+                    $goodscount = model('\app\admin\model\stock\Goods')->where("goodscategoryid", $v->id)->count();
+                    if ($goodscount > 0) {
+                        $this->error("当前分类下面包含" . $goodscount . "种商品,禁止删除!");
+                    }
+                    $count += $v->delete();
+                }
+                Db::commit();
+            } catch (PDOException $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            } catch (Exception $e) {
+                Db::rollback();
+                $this->error($e->getMessage());
+            }
+            if ($count) {
+                $this->success();
+            } else {
+                $this->error(__('No rows were deleted'));
+            }
+        }
+        $this->error(__('Parameter %s can not be empty', 'ids'));
+    }
+
+}

+ 179 - 0
application/admin/controller/stock/Stockcur.php

@@ -0,0 +1,179 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+
+/**
+ * 商品库存
+ *
+ * @icon fa fa-circle-o
+ */
+class Stockcur extends Backend {
+
+    /**
+     * StockStockcur模型对象
+     * @var \app\admin\model\stock\Stockcur
+     */
+    protected $noNeedLogin = ['getGoodsStoknum', 'countData'];
+    protected $model = null;
+
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Stockcur');
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index() {
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            //当前是否为关联查询
+            $this->relationSearch = true;
+            $this->searchFields = 'stockgoods.volnum,stockgoods.goodsname';
+            $categoryids = $this->request->request("categoryids");
+            $query = [];
+            if ($categoryids !== NULL) {
+                $query["stockgoods.goodscategoryid"] = ["in", $categoryids];
+            }
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $total = $this->model->with('stockgoods')->field("sum(curnums) as totalcurnums")->where($where)->where($query)->group("stock_goods_id")->order($sort, $order)->count();
+            $list = $this->model->with('stockgoods')->field("sum(curnums) as totalcurnums")->where($where)->where($query)->group("stock_goods_id")->order($sort, $order)->limit($offset, $limit)->select();
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 库存首页
+     */
+    public function mainpage() {
+        $stockinsum=\app\admin\model\stock\Stockinlist::with('stockin')
+        ->field('IFNULL(SUM(stockinnums),0) as totalnums,IFNULL(SUM(amount),0) as totalamount')
+        ->where('stockin.audittime','NOT NULL')
+        ->whereTime("stockin.audittime",'today')
+        ->select();
+//        echo "<pre>";
+//        print_r($stockinsum);
+//        echo "</pre>";
+//        die;
+        $stockoutsum=\app\admin\model\stock\Stockoutlist::with('stockout')
+        ->field('IFNULL(SUM(stockoutnums),0) totalnums,IFNULL(SUM(amount),0) totalamount')
+        ->where('stockout.audittime','NOT NULL')
+        ->whereTime("stockout.audittime",'today')
+        ->select();
+        $stockcursum=\app\admin\model\stock\Stockcur::with('stockinlist')
+        ->field('IFNULL(SUM(curnums),0) totalnums,IFNULL(SUM(stockinlist.inboundprice*curnums),0) totalamount')
+        ->select();
+        $stockin_toaudit=\app\admin\model\stock\Stockin::where('audittime','NULL')->count();
+        $stockout_toaudit=\app\admin\model\stock\Stockout::where('audittime','NULL')->count();
+        if ($this->request->isAjax()) {
+            $stockinsum=\app\admin\model\stock\Stockinlist::field('sum(stockinnums)  totalnums,sum(amount) totalamount')->where("createtime",'today')->select();
+            $result = array("stockinsum" => $stockinsum);
+            return json($result);
+        }
+        $this->view->assign("stockinsum", $stockinsum[0]);
+        $this->view->assign("stockoutsum", $stockoutsum[0]);
+        $this->view->assign("stockcursum", $stockcursum[0]);
+        $this->view->assign("stockin_toaudit", $stockin_toaudit);
+        $this->view->assign("stockout_toaudit", $stockout_toaudit);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null) {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        $stockinmodel = model('StockStockin');
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                try {
+                    //是否采用模型验证
+                    if ($this->modelValidate) {
+                        $name = basename(str_replace('\\', '/', get_class($this->model)));
+                        $validate = is_bool($this->modelValidate) ? ($this->modelSceneValidate ? $name . '.edit' : true) : $this->modelValidate;
+                        $row->validate($validate);
+                    }
+                    $id = $params['stock_stockin_id'];
+                    $allocation = $params['allocation'];
+                    $result = $stockinmodel->where('id', $id)->update(['allocation' => $allocation]);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($row->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 出库单,根据选定商品返回库存数
+     */
+    public function getGoodsStoknum($goodsid) {
+        if ($this->request->isPost()) {
+            $goodsid = $this->request->post('goodsid');
+            if ($goodsid) {
+                try {
+                    $curnum = $this->model->getGoodsStoknum($goodsid);
+                    return json($curnum);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+    /**
+     * 库存首页统计
+     */
+    public function countData() {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+
+        if ($this->request->isAjax()) {
+            $total = $this->model
+                    ->group('stock_goods_id')
+                    ->count();
+            $list = $this->model
+                    ->with('StockGoods,Stockinlist')
+                    ->field('sum(curnums*inboundprice) totalitemamount,count(*) totalitem,sum(curnums) totalnum')
+                    ->group('goodscategoryid')
+                    ->select();
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+    }
+}

+ 477 - 0
application/admin/controller/stock/Stockin.php

@@ -0,0 +1,477 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use DateTime;
+
+/**
+ * 商品入库
+ *
+ * @icon fa fa-circle-o
+ */
+class Stockin extends Backend
+{
+
+    /**
+     * StockStockin模型对象
+     * @var \app\admin\model\stock\Stockin
+     */
+    protected $noNeedRight = ['getlistByDocnum', 'countData','info'];
+    protected $model = null;
+    protected $listmodel = null;
+
+    /**
+     * 快速搜索时执行查找的字段
+     */
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Stockin');
+        $this->listmodel = model('\app\admin\model\stock\Stockinlist');
+        $result = collection(model('\app\admin\model\stock\Supplier')->select())->toArray();
+        $supplier = ['' => '==请选择=='];
+        foreach ($result as $k => $v) {
+            $supplier[$v['id']] = $v['name'];
+        };
+        $this->view->assign("supplier", $supplier);
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            $this->relationSearch = true;
+            $this->searchFields = 'docnum,supplier.name';
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $total = $this->model
+                ->with("supplier")
+                ->where($where)
+                ->order($sort, $order)
+                ->count();
+            $list = $this->model
+                ->with("supplier")
+                ->where($where)
+                ->order($sort, $order)
+                ->limit($offset, $limit)
+                ->select();
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 入库时序表
+     */
+    public function getlist()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            $this->relationSearch = false;
+            $this->searchFields = 'docnum,goods.goodsname,goods.productmodel';
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $total = $this->listmodel
+                ->with(['goods', 'stockin'])
+                ->where('stockin.audittime', 'NOT NULL')
+                ->where($where)
+                ->order($sort, $order)
+                ->count();
+            $list = $this->listmodel
+                ->with(['goods', 'stockin'])
+                ->where('stockin.audittime', 'NOT NULL')
+                ->where($where)
+                ->order($sort, $order)
+                ->limit($offset, $limit)
+                ->select();
+
+            foreach ($list as $k => $v) {
+                $v->stockin->supplier;
+            }
+
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 入库添加
+     */
+    public function add()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $main = \GuzzleHttp\json_decode($params["main"], true);
+            $goods = \GuzzleHttp\json_decode($params["goodslist"], true);
+            if ($main && $goods) {
+                if ($this->dataLimit && $this->dataLimitFieldAutoFill) {
+                    $params[$this->dataLimitField] = $this->auth->id;
+                }
+                try {
+                    $main["docnum"] = $this->model->createdocnum();
+                    $main['inboundtime'] = strtotime($main['inboundtime']);
+                    $num = count($goods);
+                    $stockinTotalNum = 0;
+                    $totalamount = 0.00;
+                    $result = \app\admin\model\stock\Stockin::create($main);
+                    for ($i = 0; $i < $num; $i++) {
+                        $goods[$i]['stock_stockin_id'] = $result->id;
+                        $goods[$i]['amount'] = bcmul($goods[$i]['stockinnums'], $goods[$i]['inboundprice'], 2);
+                        $totalamount = bcadd($totalamount, $goods[$i]['amount'], 2);
+                        $stockinTotalNum += $goods[$i]['stockinnums'];
+                    }
+                    $result->totalamount = $totalamount;
+                    $result->stockintotalnums = $stockinTotalNum;
+                    $result->save();
+                    $stockinlist = new \app\admin\model\stock\Stockinlist;
+                    $stockinlist->allowField(true)->saveAll($goods);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 审核
+     */
+    public function audit()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    if ($row->audittime) {
+                        $this->error(__('单据已审核,不可重复审核', ''));
+                    }
+                    $row->audittime = time();
+                    $stockcurlist = [];
+                    $stockinlist = new \app\admin\model\stock\Stockinlist;
+                    $goodslist = $stockinlist->where("stock_stockin_id", $row->id)->select();
+                    foreach ($goodslist as $value) {
+                        $stockcur = ['stock_stockin_id' => $row->id, 'stock_stockin_list_id' => $value->id, 'stock_stockin_docnum' => $row->docnum, 'curnums' => $value->stockinnums, 'stock_goods_id' => $value->stock_goods_id];
+                        $stockcurlist[] = $stockcur;
+                    }
+                    $row->save();
+                    model('\app\admin\model\stock\Stockcur')->allowField(true)->saveAll($stockcurlist);
+                    $this->success();
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+    /**
+     * 反审核
+     */
+    public function unaudit()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                try {
+                    $row = $this->model->get($params["id"]);
+                    $stockinlist = new \app\admin\model\stock\Stockinlist;
+                    $goodslist = $stockinlist->where("stock_stockin_id", $row->id)->select();
+
+                    if ($goodslist) {
+                        if (!$row->audittime) {
+                            $this->error(__('单据已反审核,不可重复反审核!', ''));
+                        };
+                        foreach ($goodslist as $k => $v) {
+                            if ($v['charged']) {
+                                $this->error(__('存在已出库商品,禁止反审核', ''));
+                            }
+                        };
+                        $row->audittime = null;  //更新审核标记位
+                        $row->save();
+                        model('\app\admin\model\stock\Stockcur')->where('stock_stockin_id', $row->id)->delete();
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 结算
+     */
+    public function settle()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    if ($row->settletime) {
+                        $this->error(__('单据已结算,不可重复结算', ''));
+                    }
+                    $row->settletime = time();
+                    $row->save();
+                    $this->success();
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 反结算
+     */
+    public function unsettle()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    if (!$row->settletime) {
+                        $this->error(__('单据尚未结算,操作失败', ''));
+                    }
+                    $row->settletime = null;
+                    $row->save();
+                    $this->success();
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $adminIds = $this->getDataLimitAdminIds();
+        if (is_array($adminIds)) {
+            if (!in_array($row[$this->dataLimitField], $adminIds)) {
+                $this->error(__('You have no permission'));
+            }
+        }
+        if ($row['audittime']) {
+            return ($this->error(__('该入库记录已审核,不能编辑!')));
+        }
+        $stockinlist = new \app\admin\model\stock\Stockinlist;
+        $list = collection($stockinlist->where('stock_stockin_id', $row->id)->select())->toArray();
+        foreach ($list as $k => $v) {
+            if ($v['charged']) {
+                return ($this->error(__('该入库记录存在已出库商品,不能编辑!')));
+            }
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $main = \GuzzleHttp\json_decode($params["main"], true);
+            $goods = \GuzzleHttp\json_decode($params["goodslist"], true);
+            $delist = \GuzzleHttp\json_decode($params["deletedgoodslist"], true);
+            if ($main && $goods) {
+                try {
+                    $main["inboundtime"] = strtotime($main["inboundtime"]);
+                    $num = count($goods);
+                    $stockintotalnums = 0;
+                    $totalamount = 0.00;
+                    for ($i = 0; $i < $num; $i++) {
+                        $goods[$i]['stock_stockin_id'] = $row->id;
+                        $goods[$i]['amount'] = bcmul($goods[$i]['stockinnums'], $goods[$i]['inboundprice'], 2);
+                        $totalamount = bcadd($totalamount, $goods[$i]['amount'], 2);
+                        $stockintotalnums += $goods[$i]['stockinnums'];
+                    }
+                    $main["totalamount"] = $totalamount;
+                    $main["stockintotalnums"] = $stockintotalnums;
+                    unset($main["supplier"]);
+                    $row->save($main);
+                    $result = $stockinlist->allowField(true)->saveAll($goods);
+                    $stockinlist->destroy($delist);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 查看
+     */
+    public function look($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        $operatetype = $this->request->get("operatetype");
+        if ($operatetype  == "audit") {
+            if ($row->settletime !== null) {
+                $this->error("该入库单已结算,请先进行反结算!");
+            }
+        } else if ($operatetype == "settle") {
+            if ($row->audittime == null) {
+                $this->error("该入库单未审核,请先进行审核!");
+            }
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+
+    /**
+     * 删除
+     */
+    public function del($ids = "")
+    {
+        if ($ids) {
+            $row = $this->model->get($ids);
+            if (!$row) {
+                $this->error(__('No Results were found'));
+            }
+            $stockinlist = new \app\admin\model\stock\Stockinlist;
+            $list = collection($stockinlist->where('stock_stockin_id', $row->id)->select())->toArray();
+            if ($row['audittime']) {
+                return ($this->error(__('该入库记录已审核,不能删除!')));
+            }
+            foreach ($list as $k => $v) {
+                if ($v['charged']) {
+                    return ($this->error(__('该入库记录存在已出库商品,不能删除!')));
+                }
+            }
+            $result = $stockinlist->where('stock_stockin_id', $row->id)->delete();
+            $result = $row->delete();
+            if ($result) {
+                $this->success();
+            } else {
+                $this->error(__('No rows were deleted'));
+            }
+        }
+        $this->error(__('Parameter %s can not be empty', 'ids'));
+    }
+
+    /**
+     * 查看页,根据单据编号返回商品信息
+     */
+    public function info($id = null)
+    {
+        if ($this->request->isPost()) {
+            if ($id) {
+                try {
+                    $row = $this->model->get($id);
+                    $row->supplier;
+                    $goodslist = \think\Db::view('stock_stockin_list', '*')
+                        ->view('stock_goods', 'id as stock_goods_id,volnum,goodsname,productmodel,measureunit', 'stock_stockin_list.stock_goods_id=stock_goods.id', 'left')
+                        ->where('stock_stockin_list.stock_stockin_id', $id)->select();
+                    return json(["row" => $row, "goodslist" => $goodslist]);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    /**
+     * 控制台出入库统计
+     */
+    public function countData()
+    {
+        //当前是否为关联查询
+        $this->relationSearch = true;
+        if ($this->request->isAjax()) {
+            $months = array();
+            for ($i = 0; $i <= 12; $i++) {
+                $months[] = date("Y-m", strtotime(date('y-m-01') . '-' . $i . ' months'));
+            }
+            $months=array_reverse($months);
+            $inlist = $this->listmodel
+                ->with('stockin')
+                ->field('FROM_UNIXTIME(stockin.createtime,"%Y-%m") month,sum(amount) amount')
+                ->where('stockin.audittime', 'not null')
+                ->group('FROM_UNIXTIME(stockin.createtime,"%Y-%m")')
+                ->select();
+            $outlistmodel = model('\app\admin\model\stock\Stockoutlist');
+            $outlist = $outlistmodel
+                ->with('stockout')
+                ->field('FROM_UNIXTIME(stockout.createtime,"%Y-%m") month,sum(amount) amount')
+                ->where('stockout.audittime', 'not null')
+                ->group('FROM_UNIXTIME(stockout.createtime,"%Y-%m")')
+                ->select();
+            $indata = [];
+            $outdata = [];
+            foreach ($months as $k => $v) {
+                $indata[$k] = 0;
+                $outdata[$k] = 0;
+                foreach ($inlist as $ink => $inv) {
+
+                    if ($inv->month == $v) {
+                        $indata[$k] = intval($inv->amount);
+                    }
+                }
+                foreach ($outlist as $outk => $outv) {
+                    if ($outv->month == $v) {
+                        $outdata[$k] = intval($outv->amount);
+                    }
+                }
+            }
+//            print_r($indata);die;
+            return json(["month"=>$months,"indata" => $indata, "outdata" => $outdata]);
+        }
+    }
+
+    /**
+     * 打印数据(LODOP)
+     */
+    public function printer()
+    {
+        return $this->view->fetch();
+    }
+}

+ 601 - 0
application/admin/controller/stock/Stockout.php

@@ -0,0 +1,601 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use fast\Tree;
+use app\admin\model;
+use think\Db;
+use think\Exception;
+
+/**
+ * 商品出库
+ *
+ * @icon fa fa-circle-o
+ */
+class Stockout extends Backend
+{
+
+    /**
+     * StockStockout模型对象
+     * @var \app\admin\modelstock\Stockout
+     */
+    protected $model = null;
+    protected $listmodel = null;
+    protected $noNeedLogin = ['countData','info'];
+
+    public function _initialize()
+    {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Stockout');
+        $this->listmodel = model('\app\admin\model\stock\Stockoutlist');
+        $customerList = collection(model('\app\admin\model\stock\Customer')->select())->toArray();
+        Tree::instance()->init($customerList);
+        $customerList = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'name');
+        $customer = ['' => '==请选择=='];
+        foreach ($customerList as $k => $v) {
+            $customer[$v['id']] = $v['name'];
+        }
+        $this->view->assign('customer', $customer);
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 查看
+     */
+    public function index(){
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            $post = $this->request->request('');
+            if ($this->request->request('search')) {
+                $where['订单编号|生产款号'] =  ['like', '%' . $post['search'] . '%'];;
+            }
+            $where['mod_rq'] = null;
+            $where['出库日期'] = ['neq', ''];
+            $total = Db::name('工单_基本资料')
+                ->where($where)
+                ->order('订单编号 desc')
+                ->limit($post['offset'], $post['limit'])
+                ->count();
+            $list = Db::name('工单_基本资料')
+                ->where($where)
+                ->order('订单编号 desc')
+                ->limit($post['offset'], $post['limit'])
+                ->select();
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 出库时序表
+     */
+    public function getlist()
+    {
+        //设置过滤方法
+        $this->request->filter(['strip_tags']);
+        if ($this->request->isAjax()) {
+            //如果发送的来源是Selectpage,则转发到Selectpage
+            if ($this->request->request('keyField')) {
+                return $this->selectpage();
+            }
+            $this->relationSearch = true;
+            $this->searchFields = 'docnum,goods.goodsname,goods.productmodel';
+            list($where, $sort, $order, $offset, $limit) = $this->buildparams();
+            $total = $this->listmodel
+                ->with(['goods','stockinlist','stockout'])
+                ->where('stockout.audittime', 'NOT NULL')
+                ->where($where)
+                ->order($sort, $order)
+                ->count();
+            $list = $this->listmodel
+                ->with(['goods','stockinlist','stockout'])
+                ->where('stockout.audittime', 'NOT NULL')
+                ->where($where)
+                ->order($sort, $order)
+                ->limit($offset, $limit)
+                ->select();
+            foreach ($list as $k => $v) {
+                $v->stockout->customer;
+            }
+            $list = collection($list)->toArray();
+            $result = array("total" => $total, "rows" => $list);
+            return json($result);
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 添加
+     */
+    public function add()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $main = json_decode($params['main'], true);
+            $goods = json_decode($params['goodslist'], true);
+            if ($main && $goods) {
+                try {
+                    $main["docnum"] = $this->model->createdocnum();
+                    $main['outboundtime'] = strtotime($main['outboundtime']);
+                    $num = count($goods);
+                    $stockoutgoods = [];
+                    $stockcurmodel = model('\app\admin\model\stock\Stockcur');
+                    $stockOutTotalNum = 0;       //单据总出库商品总数
+                    $errorgoods = [];
+                    for ($i = 0; $i < $num; $i++) {
+                        //$curtotalnum 要出库的商品当前库存总数
+                        $curtotalnum = $stockcurmodel->where('stock_goods_id', $goods[$i]['stock_goods_id'])->sum('curnums');
+                        $outtotalnum = 0;
+                        foreach ($goods as $v) {
+                            if ($v['stock_goods_id'] == $goods[$i]['stock_goods_id']) {
+                                $outtotalnum += $v['stockoutnums'];
+                            }
+                        }
+                        $stockOutTotalNum += $goods[$i]['stockoutnums'];
+                        //库存总数小于要出库数 出库失败!
+                        if ($curtotalnum < $outtotalnum) {
+                            $errorgoods[] = $goods[$i]['goodsname'] . '当前库存:' . $curtotalnum . ',出库数量' . $outtotalnum . ',出库数大于库存数,操作失败!';
+                        } else {
+                            $stockoutgoods[] = array_merge($params, $goods[$i]);
+                        }
+                    }
+                    if (count($errorgoods) > 0) {
+                        $this->error(implode('</br>', $errorgoods)); //拼接成字符串
+                    }
+                    $main['totaloutamount'] = null;
+                    $main['stockouttotalnums'] = $stockOutTotalNum;
+                    $this->model->save($main);
+                    for ($i = 0; $i < count($stockoutgoods); $i++) {
+                        $stockoutgoods[$i]['stock_stockout_id'] = $this->model->id;
+                    }
+                    $result = $this->listmodel->allowField(true)->saveAll($stockoutgoods, false);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 编辑
+     */
+    public function edit($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        if ($row['audittime']) {
+            return ($this->error(__('该记录已通过审核,不能修改!')));
+        }
+        if ($row['settletime']) {
+            return ($this->error(__('该记录已结算,不能修改!')));
+        }
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $main = json_decode($params['main'], true);
+            $goods = json_decode($params['goodslist'], true);
+            $delist = json_decode($params["deletedgoodslist"], true);
+            if ($main && $goods) {
+                try {
+                    $row->outboundtime = strtotime($main['outboundtime']);
+                    $row->stock_customer_id = $main['stock_customer_id'];
+                    $row->remark = $main['remark'];
+                    $num = count($goods);
+                    $stockoutgoods = [];
+                    $stockcurmodel = model('\app\admin\model\stock\Stockcur');
+                    $stockOutTotalNum = 0;       //单据总出库商品总数
+                    $errorgoods = [];
+                    for ($i = 0; $i < $num; $i++) {
+                        //$curtotalnum 要出库的商品当前库存总数
+                        $curtotalnum = $stockcurmodel->where('stock_goods_id', $goods[$i]['stock_goods_id'])->sum('curnums');
+                        $outtotalnum = 0;
+                        foreach ($goods as $v) {
+                            if ($v['stock_goods_id'] == $goods[$i]['stock_goods_id']) {
+                                $outtotalnum += $v['stockoutnums'];
+                            }
+                        }
+                        $stockOutTotalNum += $goods[$i]['stockoutnums'];
+                        //库存总数小于要出库数 出库失败!
+                        if ($curtotalnum < $outtotalnum) {
+                            $errorgoods[] = $goods[$i]['goodsname'] . '当前库存:' . $curtotalnum . ',出库数量' . $outtotalnum . ',出库数大于库存数,操作失败!';
+                        } else {
+                            $stockoutgoods[] = array_merge($params, $goods[$i]);
+                        }
+                    }
+                    if (count($errorgoods) > 0) {
+                        $this->error(implode('</br>', $errorgoods)); //拼接成字符串
+                    }
+                    $row->stockouttotalnums = $stockOutTotalNum;
+                    $row->save();
+                    for ($i = 0; $i < count($stockoutgoods); $i++) {
+                        $stockoutgoods[$i]['stock_stockout_id'] = $row->id;
+                    }
+                    $result = $this->listmodel->allowField(true)->saveAll($stockoutgoods);
+                    $this->listmodel->destroy($delist);
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->view->assign("row", $row);
+        return $this->view->fetch();
+    }
+    /**
+     * 审核
+     */
+    public function audit()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            if ($params) {
+                $stockcurmodel = model('\app\admin\model\stock\Stockcur');
+                $stockinlistmodel = model('\app\admin\model\stock\Stockinlist');
+                $row = $this->model->get($params["id"]);
+                if (!$row) {
+                    $this->error(__('No Results were found'));
+                }
+                $stockcurmodel->startTrans();
+                $stockinlistmodel->startTrans();
+                $this->model->startTrans();
+                $this->listmodel->startTrans();
+                try {
+                    $totalOutAmount = 0;   //单据总出库金额
+                    $stockOutTotalNum = 0;       //单据总出库商品总数
+                    $goods = $this->listmodel->with('goods')->where('stock_stockout_id', $row->id)->select();
+                    $newgoods = [];
+                    $errorgoods = [];
+                    if ($goods) {
+                        if ($row->audittime) {
+                            $this->error(__('出库单据已审核,不可重复审核', ''));
+                        }
+                        $num = count($goods);
+                        for ($i = 0; $i < $num; $i++) {
+                            //$curtotalnum 要出库的商品当前库存总数
+                            $curtotalnum = $stockcurmodel->where('stock_goods_id', $goods[$i]['stock_goods_id'])->sum('curnums');
+                            //库存总数小于此次要出库数 出库失败!
+                            if ($curtotalnum < $goods[$i]['stockoutnums']) {
+                                $errorgoods[] = $goods[$i]['goods']['goodsname'] . '当前库存:' . $curtotalnum . ',出库数量' . $goods[$i]['stockoutnums'] . ',出库数大于库存数,操作失败!';
+                            } else {
+                                //获得要出库商品的所有库存信息
+                                $stockcurgoods = $stockcurmodel->with('stockinlist')->where('stockcur.stock_goods_id', $goods[$i]['stock_goods_id'])->order('id')->select();
+                                $curstockoutgoods = $goods[$i]->toArray();
+                                unset($curstockoutgoods['id']);
+                                //出库初始数量为
+                                $stockoutnum = 0;
+                                $j = 0;
+                                while ($stockoutnum < $goods[$i]['stockoutnums']) {
+                                    $neednum = $goods[$i]['stockoutnums'] - $stockoutnum; //$neednum 还需要出库的数量
+                                    $restnum = $stockcurgoods[$j]['curnums'] - $neednum; //$restnum  该条记录出完库后剩余库存。
+                                    //小于等于0则表示不够出或刚够
+                                    if ($restnum <= 0) {
+                                        $curstockoutgoods['stock_stockout_id'] = $row->id;
+                                        $curstockoutgoods['stockoutgoodsremark'] = $goods[$i]['stockoutgoodsremark'];
+                                        $curstockoutgoods['stock_stockinlist_id'] = $stockcurgoods[$j]['stockinlist']['id'];
+                                        $curstockoutgoods['stockoutnums'] = $stockcurgoods[$j]['curnums'];
+                                        $curstockoutgoods['amount'] = bcmul($stockcurgoods[$j]['curnums'], $stockcurgoods[$j]['stockinlist']['inboundprice'], 2);
+                                        $stockoutnum += $stockcurgoods[$j]['curnums'];
+                                        $totalOutAmount += $curstockoutgoods['amount'];
+                                        $stockOutTotalNum += $stockcurgoods[$j]['curnums'];
+                                        $stockcurmodel->destroy($stockcurgoods[$j]['id']);
+                                        $stockinlist = $stockinlistmodel->get($stockcurgoods[$j]['stockinlist']['id']);
+                                        $stockinlist->charged = true;
+                                        $stockinlist->save();
+                                    } elseif (($restnum > 0)) { //大于0则表示够出
+                                        $curstockoutgoods['stock_stockout_id'] = $row->id;
+                                        $curstockoutgoods['stockoutgoodsremark'] = $goods[$i]['stockoutgoodsremark'];
+                                        $curstockoutgoods['stock_stockinlist_id'] = $stockcurgoods[$j]['stockinlist']['id'];
+                                        $curstockoutgoods['stockoutnums'] = $neednum;
+                                        $curstockoutgoods['amount'] = bcmul($neednum, $stockcurgoods[$j]['stockinlist']['inboundprice'], 2);
+                                        $stockoutnum += $neednum;
+                                        $totalOutAmount += $curstockoutgoods['amount'];
+                                        $stockOutTotalNum += $neednum;
+                                        $stockcurgoods[$j]['curnums'] = $restnum;
+                                        $updatestockcur = $stockcurmodel->get($stockcurgoods[$j]['id']);
+                                        $updatestockcur->curnums = $restnum;
+                                        $updatestockcur->save();
+                                        $stockinlist = $stockinlistmodel->get($stockcurgoods[$j]['stockinlist']['id']);
+                                        $stockinlist->charged = true;
+                                        $stockinlist->save();
+                                    }
+                                    $newgoods[] = $curstockoutgoods;
+                                    $j++;
+                                }
+                            }
+                        };
+                    }
+                    if (count($errorgoods) > 0) {
+                        throw new Exception(implode('</br>', $errorgoods));
+                    }
+                    $row->totaloutamount = $totalOutAmount;
+                    $row->stockouttotalnums = $stockOutTotalNum;
+                    $row->audittime = time();
+                    $row->save();
+                    $goods = $this->listmodel->where('stock_stockout_id', $row->id)->delete();
+                    $result = $this->listmodel->allowField(true)->saveAll($newgoods);  //更新审核标记位
+                    $this->model->commit();
+                    $this->listmodel->commit();
+                    $stockcurmodel->commit();
+                    $stockinlistmodel->commit();
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->model->rollBack();
+                    $this->listmodel->rollBack();
+                    $stockcurmodel->rollBack();
+                    $stockinlistmodel->rollBack();
+                    $this->error($e->getMessage());
+                } catch (\think\Exception $e) {
+                    $this->model->rollBack();
+                    $this->listmodel->rollBack();
+                    $stockcurmodel->rollBack();
+                    $stockinlistmodel->rollBack();
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 反审核
+     */
+    public function unaudit()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    if (!$row->audittime) {
+                        $this->error(__('出库单据已反审核,不可重复反审核', ''));
+                    };
+                    $goods = $this->listmodel->where('stock_stockout_id', $row->id)->select();
+                    if ($goods) {
+                        foreach ($goods as $k => $v) {
+                            $stockinlistmodel = model('\app\admin\model\stock\Stockinlist')->get(["id" => $v['stock_stockinlist_id']]);
+                            $stockinmodel = model('\app\admin\model\stock\Stockin')->get($stockinlistmodel->stock_stockin_id);
+                            $stockcurmodel = model('\app\admin\model\stock\Stockcur')->get(["stock_stockin_list_id" => $v['stock_stockinlist_id']]);
+                            if ($stockcurmodel) {
+                                $stockcurmodel->curnums = $stockcurmodel->curnums + $v->stockoutnums;
+                                if ($stockcurmodel->curnums == $stockinlistmodel->stockinnums) {
+                                    $stockinlistmodel->charged = false;
+                                    $stockinlistmodel->save();
+                                }
+                                $stockcurmodel->save();
+                            } else {
+                                $stockcur = [
+                                    'stock_stockin_list_id' => $stockinlistmodel['id'],
+                                    'stock_stockin_id' => $stockinlistmodel['stock_stockin_id'],
+                                    'curnums' => $v->stockoutnums,
+                                    'stock_goods_id' => $stockinlistmodel['stock_goods_id'],
+                                    'stock_stockin_docnum' => $stockinmodel->docnum,
+                                ];
+                                model('\app\admin\model\stock\Stockcur')->isUpdate(false)->data($stockcur, true)->save();
+                                if ($stockinlistmodel->stockinnums == $v->stockoutnums) {
+                                    $stockinlistmodel->charged = false;
+                                    $stockinlistmodel->save();
+                                }
+                            }
+                            $v->stock_stockinlist_id = null;
+                            $v->amount = null;
+                            $v->save();
+                        };
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                    $row->audittime = null;
+                    $row->totaloutamount = null;
+                    $result = $row->save();
+
+                    if ($result !== false) {
+                        $this->success();
+                    } else {
+                        $this->error($this->model->getError());
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 结算
+     */
+    public function settle()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    $row->settletime = time();
+                    $result = $row->save();
+                    if ($result) {
+                        $this->success('结算成功');
+                    } else {
+                        $this->error(__('结算失败'));
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 反结算
+     */
+    public function unsettle()
+    {
+        if ($this->request->isPost()) {
+            $params = $this->request->post("row/a");
+            $row = $this->model->get($params["id"]);
+            if ($row) {
+                try {
+                    $row->settletime = null;
+                    $result = $row->save();
+                    if ($result) {
+                        $this->success('反结算成功');
+                    } else {
+                        $this->error(__('反结算失败'));
+                    }
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+    }
+
+    /**
+     * 查看
+     */
+    public function look($ids = null)
+    {
+        $row = $this->model->get($ids);
+        if (!$row) {
+            $this->error(__('No Results were found'));
+        }
+        return $this->view->fetch();
+    }
+
+    /**
+     * 删除
+     */
+    public function del($ids = "")
+    {
+        if ($ids) {
+            $row = $this->model->get($ids);
+            if (!$row) {
+                $this->error(__('No Results were found'));
+            }
+            $list = collection($this->listmodel->where('stock_stockout_id', $row->id)->select())->toArray();
+            if ($row['audittime']) {
+                return ($this->error(__('该单据已审核,不能删除!')));
+            }
+            $result = $this->listmodel->where('stock_stockout_id', $row->id)->delete();
+            $result = $row->delete();
+            if ($result) {
+                $this->success();
+            } else {
+                $this->error(__('No rows were deleted'));
+            }
+        }
+        $this->error(__('Parameter %s can not be empty', 'ids'));
+    }
+
+    /**
+     * 查看页,根据单据编号返回商品信息
+     */
+    public function info($id = null)
+    {
+        if ($this->request->isPost()) {
+            if ($id) {
+                try {
+                    $id = $this->request->request("id");
+                    $goodslist = Db::name('工单_基本资料')->where('Uniqid',$id)->find();
+                    // 如果查询结果为空,返回空数组
+                    if (!$goodslist) {
+                        $goodslist = [];
+                    } else {
+                        // 将所有 null 值替换为空字符串
+                        foreach ($goodslist as $key => $value) {
+                            if (is_null($value)) {
+                                $goodslist[$key] = '';
+                            }
+                        }
+                        // 添加库位号字段
+                        $goodslist['库位号'] = $goodslist['Uniqid'] . $goodslist['订单编号'];
+                    }
+                    return json(["goodslist" => $goodslist]);
+//                    $goodslist = \think\Db::view('stock_stockout_list', '*')
+//                        ->view('stock_goods', 'id as stock_goods_id,volnum,goodsname,productmodel,measureunit', 'stock_stockout_list.stock_goods_id=stock_goods.id', 'left')
+//                        ->view('stock_stockin_list', 'id as stock_stockin_list,inboundprice', 'stock_stockin_list.id=stock_stockout_list.stock_stockinlist_id', 'left')
+//                        ->where('stock_stockout_list.stock_stockout_id', $id)->select();
+//                    return json(["row" => $row, "goodslist" => $goodslist]);
+                } catch (\think\exception\PDOException $e) {
+                    $this->error($e->getMessage());
+                }
+            }
+            $this->error(__('Parameter %s can not be empty', ''));
+        }
+        $this->error('只接受POST请求', '');
+    }
+
+    /**
+     * 控制台出库统计
+     */
+    public function countData()
+    {
+        if ($this->request->isAjax()) {
+            $dateRange = $this->request->request("dateRange");
+            $dateRange = explode(' - ', $dateRange);
+            $dateRange = count($dateRange) > 1 ? $dateRange : $dateRange[0];
+            $list1 = $this->model
+                ->with('stockgoods,customer')
+                ->field('sum(amount) totalitemamount,count(*) totalitem,sum(stockoutnums) totalnum')
+                ->where('audittime', 'not null')
+                ->whereTime('stockout.createtime', $dateRange)
+                ->group('stockout.stock_customer_id')
+                ->select();
+            $list1 = collection($list1)->toArray();
+
+            $list2 = $this->model
+                ->with('stockgoods,customer')
+                ->field('sum(amount) totalitemamount,count(*) totalitem,sum(stockoutnums) totalnum')
+                ->where('audittime', 'not null')
+                ->whereTime('stockout.createtime', $dateRange)
+                ->group('goodscategoryid')
+                ->select();
+            $list2 = collection($list2)->toArray();
+            $result = array("rows1" => $list1, "rows2" => $list2);
+            return json($result);
+        }
+    }
+
+    /**
+     * 打印数据(LODOP)
+     */
+    public function printer($id = null)
+    {
+        //        $row = $this->model->get($id);
+
+        $post = $this->request->request("");
+
+//        if (!$post['Uniqid']) {
+//            $this->error(__('No Results were found'));
+//        } else if (!$post['Uniqid']) {
+//            $this->error(__('单据尚未审核,请先审核!'));
+//        }
+        return $this->view->fetch();
+    }
+}

+ 40 - 0
application/admin/controller/stock/Supplier.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace app\admin\controller\stock;
+
+use app\common\controller\Backend;
+use think\Db;
+
+/**
+ * 供应商
+ *
+ * @icon fa fa-circle-o
+ */
+class Supplier extends Backend {
+
+    /**
+     * StockSupplier模型对象
+     * @var \app\admin\model\stock\Supplier
+     */
+    protected $model = null;
+    protected $searchFields = 'name';
+    public function _initialize() {
+        parent::_initialize();
+        $this->model = model('\app\admin\model\stock\Supplier');
+    }
+
+    /**
+     * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
+     * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
+     * 需要将application/admin/library/traits/Backend.php中对应的方法复制到当前控制器,然后进行修改
+     */
+
+    /**
+     * 客户供应商
+     */
+    public function erp_supplier(){
+        $list = Db::name('erp_客户供应商')->field('编号送 as name')->select();
+
+        return json($list);
+    }
+}

+ 21 - 0
application/admin/lang/zh-cn/stock/customer.php

@@ -0,0 +1,21 @@
+<?php
+
+return [
+    'Id'  =>  'ID',
+    'Pid'  =>  '父ID',
+    'Encode'  =>  '客户编号',
+    'Deptype'  =>  '客户类型',
+    'Name'  =>  '全名',
+    'Shortname'  =>  '名称',
+    'Innerphone'  =>  '内部电话号码',
+    'Advanceamount'  =>  '预收金额',
+    'Receivableamount'  =>  '应收金额',
+    'Level'  =>  '级别',
+    'Weigh'  =>  '排序码',
+    'Enabledmark'  =>  '有效',
+    'Enabledmark 1'  =>  '是',
+    'Enabledmark 0'  =>  '否',
+    'Remark'  =>  '备注',
+    'Createtime'  =>  '创建时间',
+    'Updatetime'  =>  '更新时间'
+];

+ 18 - 0
application/admin/lang/zh-cn/stock/datadict.php

@@ -0,0 +1,18 @@
+<?php
+
+return [
+    'Id'  =>  'ID',
+    'Pid'  =>  '父ID',
+    'Name'  =>  '名称',
+    'Code'  =>  '编码',
+    'Istree'  =>  '树形',
+    'Istree 0'  =>  '否',
+    'Istree 1'  =>  '是',
+    'Createtime'  =>  '创建时间',
+    'Updatetime'  =>  '更新时间',
+    'Weigh'  =>  '权重',
+    'Remark'  =>  '备注',
+    'Enabled'  =>  '有效',
+    'Enabled 1'  =>  '是',
+    'Enabled 0'  =>  '否'
+];

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

@@ -0,0 +1,15 @@
+<?php
+
+return [
+    'Id' => 'ID',
+    'Pid' => '父ID',
+    'Datadict_id' => '字典ID',
+    'Name' => '名称',
+    'Value' => '值',
+    'Weigh' => '权重',
+    'Remark' => '备注',
+    'Enabled' => '有效',
+    'Enabled 1' => '是',
+    'Enabled 0' => '否',
+    'Datadict Category' => "字典分类"
+];

+ 36 - 0
application/admin/lang/zh-cn/stock/goods.php

@@ -0,0 +1,36 @@
+<?php
+
+return [
+    'Id' => 'ID',
+//    'Volnum' => '商品代码',
+    'Volnum' => '类别编号',
+    'goodscategory' => '类别',
+//    'Goodsname' => '商品名称',
+    'Goodsname' => '款式',
+    'Spell' => '简拼',
+//    'Productmodel' => '规格型号',
+    'Productmodel' => '生产款号',
+    'Measureunit' => '单位',
+//    'Univalence' => '单价',
+    'Univalence' => '数量',
+    'Image' => '图片',
+    'Createtime' => '创建时间',
+    'Updatetime' => '更新时间',
+    'Enablewarn' => '库存告警',
+    'Minstock' => '最低库存',
+    'enablewarn 1' => '是',
+    'enablewarn 0' => '否',
+    'Inoutdetail' => '出入明细',
+    'Please select commodity classification first!' => '请先选择商品分类!',
+    'Only one record can be selected!' => '只能选择一条记录!',
+    'Please select a record!' => '请选择一条记录!',
+    'Summary' => '汇总',
+    'InoutType'=>'出入类型',
+    'stockInNum' => '入库数量',
+    'stockOutNum' => '出库数量',
+    'stockInAmount' => '入库总价',
+    'stockOutAmount' => '出库总价',
+    'InoutTime' => '出入时间',
+//    'Barcode' => '商品条码',
+    'Barcode' => '款式条码',
+];

+ 7 - 0
application/admin/lang/zh-cn/stock/goodscategory.php

@@ -0,0 +1,7 @@
+<?php
+
+return [
+    'Name'  =>  '商品名',
+    'Value'  =>  '商品码前缀',
+    'Toggle all'=>'展开全部'
+];

+ 9 - 0
application/admin/lang/zh-cn/stock/stockcur.php

@@ -0,0 +1,9 @@
+<?php
+
+return [
+    'Id'  =>  'ID',
+    'Stock_stockin_id'  =>  '入库ID',
+    'Curnum'  =>  '当前数量',
+    'Stock_goods_id'  =>  '商品ID',
+    'stock_goods.goodsname'  =>  '商品名称'
+];

+ 24 - 0
application/admin/lang/zh-cn/stock/stockin.php

@@ -0,0 +1,24 @@
+<?php
+
+return [
+    'Id'  =>  'ID',
+    'docnum'  =>  '入库单号',
+    'Supplierlist'  =>  '供应商',
+    'Allocation'  =>  '货位',
+    'Partno'  =>  '机件号',
+    'Inboundtime'  =>  '入库日期',
+    'Stock_goods_id'  =>  '商品ID',
+    'Noticenum'  =>  '通知数',
+    'Actualnum'  =>  '实收数',
+    'Inboundprice'  =>  '入库单价',
+    'Amount'  =>  '金额',
+    'Grade'  =>  '等级',
+    'Grade 1'  =>  '优等品',
+    'Grade 2'  =>  '一等品',
+    'Grade 3'  =>  '合格品',
+    'Grade 0'  =>  '不合格品',
+    'Remark'  =>  '备注',
+    'Createtime'  =>  '创建时间',
+    'Updatetime'  =>  '更新时间',
+    'stock_goods.goodsname'=>'商品名称'
+];

+ 53 - 0
application/admin/lang/zh-cn/stock/stockout.php

@@ -0,0 +1,53 @@
+<?php
+//
+//return [
+//    'Id'  =>  'ID',
+//    'Vouchernum'  =>  '出库凭证',
+//    'Outboundtime'  =>  '出库日期',
+//    'Docnum'  =>  '文号',
+//    'Totaloutamount'  =>  '出库数量',
+//    'Stock_stockin_id'  =>  '入库ID',
+//    'Stockin_vouchernum'  =>  '入库批次',
+//    'Stock_goods_id'  =>  '商品ID',
+//    'Outnums'  =>  '出库数',
+//    'Remark'  =>  '备注',
+//    'Createtime'  =>  '创建时间',
+//    'Updatetime'  =>  '修改时间'
+//];
+
+
+return [
+    'Id' => 'ID',
+    'Uniqid' => 'Uniqid',
+//    'Volnum' => '商品代码',
+    'Volnum' => '类别编号',
+    'goodscategory' => '类别',
+//    'Goodsname' => '商品名称',
+    'Goodsname' => '款式',
+    'Spell' => '简拼',
+//    'Productmodel' => '规格型号',
+    'Productmodel' => '生产款号',
+    'Measureunit' => '单位',
+//    'Univalence' => '单价',
+    'Univalence' => '数量',
+    'Image' => '图片',
+    'Createtime' => '创建时间',
+    'Updatetime' => '更新时间',
+    'Enablewarn' => '库存告警',
+    'Minstock' => '最低库存',
+    'enablewarn 1' => '是',
+    'enablewarn 0' => '否',
+    'Inoutdetail' => '出入明细',
+    'Please select commodity classification first!' => '请先选择商品分类!',
+    'Only one record can be selected!' => '只能选择一条记录!',
+    'Please select a record!' => '请选择一条记录!',
+    'Summary' => '汇总',
+    'InoutType' => '出入类型',
+    'stockInNum' => '入库数量',
+    'stockOutNum' => '出库数量',
+    'stockInAmount' => '入库总价',
+    'stockOutAmount' => '出库总价',
+    'InoutTime' => '出入时间',
+//    'Barcode' => '商品条码',
+    'Barcode' => '款式条码',
+];

+ 11 - 0
application/admin/lang/zh-cn/stock/supplier.php

@@ -0,0 +1,11 @@
+<?php
+
+return [
+    'Name'  =>  '名称',
+    'Shortname'  =>  '简称',
+    'Code'  =>  '代码',
+    'Shipaddress'  =>  '发货地址',
+    'Address'  =>  '联系地址',
+    'Contacts'  =>  '联系人',
+    'Telphone'  =>  '联系电话'
+];

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

@@ -24,9 +24,9 @@
         <div class="navbar-custom-menu">
             <ul class="nav navbar-nav">
 
-                <li class="hidden-xs">
-                    <a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i> {:__('Home')}</a>
-                </li>
+<!--                <li class="hidden-xs">-->
+<!--                    <a href="__PUBLIC__" target="_blank"><i class="fa fa-home" style="font-size:14px;"></i> {:__('Home')}</a>-->
+<!--                </li>-->
 
                 <!-- 清除缓存 -->
                 <li class="hidden-xs">

+ 107 - 107
application/admin/view/dashboard/index.html

@@ -164,7 +164,7 @@
         {:build_heading(null, false)}
         <ul class="nav nav-tabs">
             <li class="active"><a href="#one" data-toggle="tab">{:__('Dashboard')}</a></li>
-            <li><a href="#two" data-toggle="tab">{:__('Custom')}</a></li>
+<!--            <li><a href="#two" data-toggle="tab">{:__('Custom')}</a></li>-->
         </ul>
     </div>
     <div class="panel-body">
@@ -284,112 +284,112 @@
                     </div>
                 </div>
 
-                <div class="row" style="margin-top:15px;" id="statistics">
-
-                    <div class="col-lg-12">
-                    </div>
-                    <div class="col-xs-6 col-md-3">
-                        <div class="panel bg-blue-gradient no-border">
-                            <div class="panel-body">
-                                <div class="panel-title">
-                                    <span class="label label-primary pull-right">{:__('Real time')}</span>
-                                    <h5>{:__('Working addon count')}</h5>
-                                </div>
-                                <div class="panel-content">
-                                    <div class="row">
-                                        <div class="col-md-12">
-                                            <h1 class="no-margins">{$totalworkingaddon}</h1>
-                                            <div class="font-bold"><i class="fa fa-magic"></i>
-                                                <small>{:__('Working addon count tips')}</small>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                    <div class="col-xs-6 col-md-3">
-                        <div class="panel bg-teal-gradient no-border">
-                            <div class="panel-body">
-                                <div class="ibox-title">
-                                    <span class="label label-primary pull-right">{:__('Real time')}</span>
-                                    <h5>{:__('Database count')}</h5>
-                                </div>
-                                <div class="ibox-content">
-                                    <div class="row">
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$dbtablenums}</h1>
-                                            <div class="font-bold"><i class="fa fa-database"></i>
-                                                <small>{:__('Database table nums')}</small>
-                                            </div>
-                                        </div>
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$dbsize|format_bytes=###,'',0}</h1>
-                                            <div class="font-bold"><i class="fa fa-filter"></i>
-                                                <small>{:__('Database size')}</small>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-
-                    <div class="col-xs-6 col-md-3">
-                        <div class="panel bg-purple-gradient no-border">
-                            <div class="panel-body">
-                                <div class="ibox-title">
-                                    <span class="label label-primary pull-right">{:__('Real time')}</span>
-                                    <h5>{:__('Attachment count')}</h5>
-                                </div>
-                                <div class="ibox-content">
-
-                                    <div class="row">
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$attachmentnums}</h1>
-                                            <div class="font-bold"><i class="fa fa-files-o"></i>
-                                                <small>{:__('Attachment nums')}</small>
-                                            </div>
-                                        </div>
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$attachmentsize|format_bytes=###,'',0}</h1>
-                                            <div class="font-bold"><i class="fa fa-filter"></i>
-                                                <small>{:__('Attachment size')}</small>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                    <div class="col-xs-6 col-md-3">
-                        <div class="panel bg-green-gradient no-border">
-                            <div class="panel-body">
-                                <div class="ibox-title">
-                                    <span class="label label-primary pull-right">{:__('Real time')}</span>
-                                    <h5>{:__('Picture count')}</h5>
-                                </div>
-                                <div class="ibox-content">
-
-                                    <div class="row">
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$picturenums}</h1>
-                                            <div class="font-bold"><i class="fa fa-picture-o"></i>
-                                                <small>{:__('Picture nums')}</small>
-                                            </div>
-                                        </div>
-                                        <div class="col-md-6">
-                                            <h1 class="no-margins">{$picturesize|format_bytes=###,'',0}</h1>
-                                            <div class="font-bold"><i class="fa fa-filter"></i>
-                                                <small>{:__('Picture size')}</small>
-                                            </div>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
+<!--                <div class="row" style="margin-top:15px;" id="statistics">-->
+
+<!--                    <div class="col-lg-12">-->
+<!--                    </div>-->
+<!--                    <div class="col-xs-6 col-md-3">-->
+<!--                        <div class="panel bg-blue-gradient no-border">-->
+<!--                            <div class="panel-body">-->
+<!--                                <div class="panel-title">-->
+<!--                                    <span class="label label-primary pull-right">{:__('Real time')}</span>-->
+<!--                                    <h5>{:__('Working addon count')}</h5>-->
+<!--                                </div>-->
+<!--                                <div class="panel-content">-->
+<!--                                    <div class="row">-->
+<!--                                        <div class="col-md-12">-->
+<!--                                            <h1 class="no-margins">{$totalworkingaddon}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-magic"></i>-->
+<!--                                                <small>{:__('Working addon count tips')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </div>-->
+<!--                    </div>-->
+<!--                    <div class="col-xs-6 col-md-3">-->
+<!--                        <div class="panel bg-teal-gradient no-border">-->
+<!--                            <div class="panel-body">-->
+<!--                                <div class="ibox-title">-->
+<!--                                    <span class="label label-primary pull-right">{:__('Real time')}</span>-->
+<!--                                    <h5>{:__('Database count')}</h5>-->
+<!--                                </div>-->
+<!--                                <div class="ibox-content">-->
+<!--                                    <div class="row">-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$dbtablenums}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-database"></i>-->
+<!--                                                <small>{:__('Database table nums')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$dbsize|format_bytes=###,'',0}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-filter"></i>-->
+<!--                                                <small>{:__('Database size')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </div>-->
+<!--                    </div>-->
+
+<!--                    <div class="col-xs-6 col-md-3">-->
+<!--                        <div class="panel bg-purple-gradient no-border">-->
+<!--                            <div class="panel-body">-->
+<!--                                <div class="ibox-title">-->
+<!--                                    <span class="label label-primary pull-right">{:__('Real time')}</span>-->
+<!--                                    <h5>{:__('Attachment count')}</h5>-->
+<!--                                </div>-->
+<!--                                <div class="ibox-content">-->
+
+<!--                                    <div class="row">-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$attachmentnums}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-files-o"></i>-->
+<!--                                                <small>{:__('Attachment nums')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$attachmentsize|format_bytes=###,'',0}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-filter"></i>-->
+<!--                                                <small>{:__('Attachment size')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </div>-->
+<!--                    </div>-->
+<!--                    <div class="col-xs-6 col-md-3">-->
+<!--                        <div class="panel bg-green-gradient no-border">-->
+<!--                            <div class="panel-body">-->
+<!--                                <div class="ibox-title">-->
+<!--                                    <span class="label label-primary pull-right">{:__('Real time')}</span>-->
+<!--                                    <h5>{:__('Picture count')}</h5>-->
+<!--                                </div>-->
+<!--                                <div class="ibox-content">-->
+
+<!--                                    <div class="row">-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$picturenums}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-picture-o"></i>-->
+<!--                                                <small>{:__('Picture nums')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                        <div class="col-md-6">-->
+<!--                                            <h1 class="no-margins">{$picturesize|format_bytes=###,'',0}</h1>-->
+<!--                                            <div class="font-bold"><i class="fa fa-filter"></i>-->
+<!--                                                <small>{:__('Picture size')}</small>-->
+<!--                                            </div>-->
+<!--                                        </div>-->
+<!--                                    </div>-->
+<!--                                </div>-->
+<!--                            </div>-->
+<!--                        </div>-->
+<!--                    </div>-->
+<!--                </div>-->
             </div>
             <div class="tab-pane fade" id="two">
                 <div class="row">

+ 9 - 9
application/admin/view/index/login.html

@@ -113,15 +113,15 @@
                             <input type="password" class="form-control" id="pd-form-password" placeholder="{:__('Password')}" name="password" autocomplete="off" value="" data-rule="{:__('Password')}:required;password"/>
                         </div>
                         <!--@CaptchaBegin-->
-                        {if $Think.config.fastadmin.login_captcha}
-                        <div class="input-group">
-                            <div class="input-group-addon"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></div>
-                            <input type="text" name="captcha" class="form-control" placeholder="{:__('Captcha')}" data-rule="{:__('Captcha')}:required;length({$Think.config.captcha.length})" autocomplete="off"/>
-                            <span class="input-group-addon" style="padding:0;border:none;cursor:pointer;">
-                                    <img src="{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha" width="100" height="30" onclick="this.src = '{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha&r=' + Math.random();"/>
-                            </span>
-                        </div>
-                        {/if}
+<!--                        {if $Think.config.fastadmin.login_captcha}-->
+<!--                        <div class="input-group">-->
+<!--                            <div class="input-group-addon"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></div>-->
+<!--                            <input type="text" name="captcha" class="form-control" placeholder="{:__('Captcha')}" data-rule="{:__('Captcha')}:required;length({$Think.config.captcha.length})" autocomplete="off"/>-->
+<!--                            <span class="input-group-addon" style="padding:0;border:none;cursor:pointer;">-->
+<!--                                    <img src="{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha" width="100" height="30" onclick="this.src = '{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha&r=' + Math.random();"/>-->
+<!--                            </span>-->
+<!--                        </div>-->
+<!--                        {/if}-->
                         <!--@CaptchaEnd-->
                         {if $keeyloginhours>0}
                         <div class="form-group checkbox">

+ 52 - 0
application/admin/view/stock/add.html

@@ -0,0 +1,52 @@
+<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">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Unit')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-unit" class="form-control" name="row[unit]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Number')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-number" data-rule="required" class="form-control" name="row[number]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('L_number')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-l_number" class="form-control" name="row[l_number]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Specs')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-specs" class="form-control" name="row[specs]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Create')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-create" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Update')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-update" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update]" type="text" value="{:date('Y-m-d H:i:s')}">
+        </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>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 64 - 0
application/admin/view/stock/customer/add.html

@@ -0,0 +1,64 @@
+<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">{:__('上级')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[pid]', $customer, null, ['class'=>'form-control selectpicker', 'data-size'=>'13','id'=>'c-pid', 'data-rule'=>''])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Encode')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-encode" class="form-control" name="row[encode]" type="text" value = "{$encode}">
+        </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" data-rule="required">
+        </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">{:__('Innerphone')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-innerphone" class="form-control" name="row[innerphone]" type="text">
+        </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" class="form-control" name="row[weigh]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enabledmark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-enabledmark" class="form-control selectpicker" name="row[enabledmark]">
+                {foreach name="enabledmarkList" item="vo"}
+                    <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" 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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 65 - 0
application/admin/view/stock/customer/edit.html

@@ -0,0 +1,65 @@
+<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">{:__('父级')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[pid]', $customer, $row.pid, ['class'=>'form-control selectpicker', 'data-size'=>'13','id'=>'c-pid', 'data-rule'=>''])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Encode')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-encode" class="form-control" name="row[encode]" type="text" value="{$row.encode}">
+        </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}">
+        </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}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Innerphone')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-innerphone" class="form-control" name="row[innerphone]" type="text" value="{$row.innerphone}">
+        </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" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enabledmark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+                        
+            <select  id="c-enabledmark" class="form-control selectpicker" name="row[enabledmark]">
+                {foreach name="enabledmarkList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.enabledmark"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark}">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 26 - 0
application/admin/view/stock/customer/index.html

@@ -0,0 +1,26 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/customer/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/customer/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('stock/customer/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('展开全部')}</a>
+
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/customer/edit')}" 
+                           data-operate-del="{:$auth->check('stock/customer/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 63 - 0
application/admin/view/stock/datadict/add.html

@@ -0,0 +1,63 @@
+<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">父级:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[pid]', $dataDicdata, null, ['class'=>'form-control', 'required'=>''])}
+        </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">{:__('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">
+    </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" class="form-control" name="row[weigh]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">树:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select  id="c-istree" class="form-control selectpicker" name="row[istree]">
+                {foreach name="istreeList" 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">有效:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select  id="c-enabled" class="form-control selectpicker" name="row[enabled]">
+                {foreach name="enabledList" item="vo"}
+                    <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注:</label>
+        <div class="col-xs-12 col-sm-8">
+            
+            <input id="c-remark" class="form-control" name="row[remark]" 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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 60 - 0
application/admin/view/stock/datadict/edit.html

@@ -0,0 +1,60 @@
+<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">
+            {:build_select('row[pid]', $dataDicdata, $row['pid'], ['class'=>'form-control', 'required'=>''])}
+        </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}">
+        </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}">
+        </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" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">树:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select  id="c-istree" class="form-control selectpicker" name="row[istree]">
+                {foreach name="istreeList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.istree"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">有效:</label>
+        <div class="col-xs-12 col-sm-8">
+            <select  id="c-enabled" class="form-control selectpicker" name="row[enabled]">
+                {foreach name="enabledList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.enabled"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark}">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 25 - 0
application/admin/view/stock/datadict/index.html

@@ -0,0 +1,25 @@
+
+            <div class="panel panel-default panel-intro col-sm-12">
+    {: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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/datadictitem/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/datadictitem/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('stock/datadictitem/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/datadictitem/edit')}" 
+                           data-operate-del="{:$auth->check('stock/datadictitem/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 54 - 0
application/admin/view/stock/datadictitem/add.html

@@ -0,0 +1,54 @@
+<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">{:__('Datadict Category')}</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[datadict_id]', $dataDicdata, null, ['class'=>'form-control', 'required'=>''])}
+        </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" data-rule="required" class="form-control" name="row[name]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-value" data-rule="required" class="form-control" name="row[value]" type="text">
+        </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" class="form-control" name="row[weigh]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enabled')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <select id="c-enabled" class="form-control selectpicker" name="row[enabled]">
+                {foreach name="enabledList" item="vo"}
+                    <option value="{$key}" {in name="key" value="1"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group" style="height: 20px;">
+
+    </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 54 - 0
application/admin/view/stock/datadictitem/edit.html

@@ -0,0 +1,54 @@
+<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">{:__('Datadict Category')}</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[datadict_id]', $dataDicdata, $row.datadict_id, ['class'=>'form-control', 'required'=>''])}
+        </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" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Value')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-value" data-rule="required" class="form-control" name="row[value]" type="text" value="{$row.value}">
+        </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" class="form-control" name="row[weigh]" type="number" value="{$row.weigh}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Remark')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-remark" class="form-control" name="row[remark]" type="text" value="{$row.remark}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Enabled')}:</label>
+        <div class="col-xs-12 col-sm-8">
+
+            <select id="c-enabled" class="form-control selectpicker" name="row[enabled]">
+                {foreach name="enabledList" item="vo"}
+                    <option value="{$key}" {in name="key" value="$row.enabled"}selected{/in}>{$vo}</option>
+                {/foreach}
+            </select>
+
+        </div>
+    </div>
+    <div class="form-group" style="height: 20px;">
+
+    </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 36 - 0
application/admin/view/stock/datadictitem/index.html

@@ -0,0 +1,36 @@
+<div class="row">
+    <div style="width: 180px; float: left;margin-left: 10px">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                字典分类
+            </div>
+            <div class="panel-body">
+                <div id="treeview"></div>
+            </div>
+        </div>
+    </div>
+    <div class="table-content">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                字典数据
+            </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">
+                                <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}"><i class="fa fa-refresh"></i> </a>
+                                <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/datadictitem/add')?'':'hide'}" title="{:__('Add')}"><i class="fa fa-plus"></i> {:__('Add')}</a>
+                                <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/datadictitem/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('stock/datadictitem/del')?'':'hide'}" title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                                <a href="javascript:;" class="btn btn-info btn-dialog  {:$auth->check('stock/datadict/index')?'':'hide'}" data-url="stock/datadict/index" data-title="{:__('Datadict Category')}" title="{:__('Datadict Category')}"><i class="fa fa-pencil"></i> {:__('Datadict Category')}</a>
+                            </div>
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="{:$auth->check('stock/datadictitem/edit')}" data-operate-del="{:$auth->check('stock/datadictitem/del')}" width="100%">
+                            </table>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 47 - 0
application/admin/view/stock/edit.html

@@ -0,0 +1,47 @@
+<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">{:__('Name')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" data-rule="required" 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">{:__('Unit')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-unit" class="form-control" name="row[unit]" type="text" value="{$row.unit|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Number')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-number" data-rule="required" class="form-control" name="row[number]" type="text" value="{$row.number|htmlentities}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('L_number')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-l_number" class="form-control" name="row[l_number]" type="text" value="{$row.l_number|htmlentities}">
+        </div>
+    </div>
+
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Create')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-create" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[create]" type="text" value="{$row.create}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Update')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-update" data-rule="required" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[update]" type="text" value="{$row.update}">
+        </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>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 59 - 0
application/admin/view/stock/goods/add.html

@@ -0,0 +1,59 @@
+<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">{:__('Goodscategory')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[goodscategoryid]', $goodscategorylist, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required','id'=>'c-goodscategoryid'])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Volnum')}</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-volnum"  data-rule="required" class="form-control" name="row[volnum]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Goodsname')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-goodsname" data-rule="required" class="form-control" name="row[goodsname]" type="text">
+        </div>
+    </div>
+<!--    <div class="form-group">-->
+<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Spell')}:</label>-->
+<!--        <div class="col-xs-12 col-sm-8">-->
+<!--            <input id="c-spell" data-rule="required" class="form-control" name="row[spell]" type="text">-->
+<!--        </div>-->
+<!--    </div>-->
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Productmodel')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-productmodel" class="form-control" name="row[productmodel]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Univalence')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-univalence" class="form-control" step="0.01" name="row[univalence]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Measureunit')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[measureunit]', $measureunit, null, ['class'=>'form-control selectpicker', 'data-size'=>'8', 'data-rule'=>'required'])}
+        </div>
+    </div>
+
+<!--    <div class="form-group">-->
+<!--        <label class="control-label col-xs-12 col-sm-2">{:__('Barcode')}:</label>-->
+<!--        <div class="col-xs-12 col-sm-8">-->
+<!--            <input id="c-barcode" disabled class="form-control"  name="row[barcode]" 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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 18 - 0
application/admin/view/stock/goods/detail.html

@@ -0,0 +1,18 @@
+<div class="table-content">
+    <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">
+                            <input id="c-ids" class="form-control" name="row[ids]" type="hidden" value="{$ids}">
+                        <table id="table" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="{:$auth->check('stock/goods/edit')}"
+                            data-operate-del="{:$auth->check('stock/goods/del')}" width="100%">
+                        </table>
+                    </div>
+                </div>
+
+            </div>
+        </div>
+    </div>
+</div>

+ 58 - 0
application/admin/view/stock/goods/edit.html

@@ -0,0 +1,58 @@
+<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">{:__('Goodscategory')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[goodscategoryid]', $goodscategorylist, $row['goodscategoryid'], ['class'=>'form-control selectpicker', 'data-size'=>'10', 'id'=>'c-goodscategoryid', 'data-rule'=>'required'])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Volnum')}</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-volnum" class="form-control" name="row[volnum]" type="text" value="{$row.volnum}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Goodsname')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-goodsname" class="form-control" name="row[goodsname]" type="text" value="{$row.goodsname}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Spell')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-spell" class="form-control" name="row[spell]" type="text" value="{$row.spell}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Productmodel')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-productmodel" class="form-control" name="row[productmodel]" type="text" value="{$row.productmodel}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Measureunit')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[measureunit]', $measureunit, $row['measureunit'], ['class'=>'form-control selectpicker', 'data-size'=>'8', 'data-rule'=>'required'])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">单桶重量(kg):</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-univalence" class="form-control" step="0.01" name="row[univalence]" type="number" value="{$row.univalence}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Barcode')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-barcode" class="form-control"  name="row[barcode]" type="text" value="{$row.barcode}">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 50 - 0
application/admin/view/stock/goods/index.html

@@ -0,0 +1,50 @@
+<!--<div class="row">-->
+<!--    <div style="width: 180px; float: left;margin-left: 10px">-->
+<!--        <div class="panel panel-default">-->
+<!--            <div class="panel-heading">-->
+<!--               {:__('goodscategory')}-->
+<!--            </div>-->
+<!--            <div class="panel-body">-->
+<!--                <div id="treeview"></div>-->
+<!--            </div>-->
+<!--        </div>-->
+<!--    </div>-->
+<!--    <div class="table-content">-->
+        <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">
+                                <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">
+                                    <i class="fa fa-refresh"></i>
+                                </a>
+<!--                                <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/goods/add')?'':'hide'}" title="{:__('Add')}">-->
+<!--                                    <i class="fa fa-plus"></i> {:__('Add')}</a>-->
+<!--                                <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/goods/edit')?'':'hide'}"-->
+<!--                                    title="{:__('Edit')}">-->
+<!--                                    <i class="fa fa-pencil"></i> {:__('Edit')}</a>-->
+<!--                                <a href="javascript:;" class="btn btn-success btn-detail btn-disabled disabled {:$auth->check('stock/goods/detail')?'':'hide'}"-->
+<!--                                    title="{:__('Inoutdetail')}">-->
+<!--                                    <i class="fa fa-sliders"></i> {:__('Inoutdetail')}</a>-->
+<!--&lt;!&ndash;                                    <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('stock/goods/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>&ndash;&gt;-->
+<!--                                <a href="javascript:;" class="btn btn-danger btn-del btn-disabled disabled {:$auth->check('stock/goods/del')?'':'hide'}"-->
+<!--                                    title="{:__('Delete')}">-->
+<!--                                    <i class="fa fa-trash"></i> {:__('Delete')}</a>-->
+
+                            </div>
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                                data-query-params="queryParams"
+                                data-operate-detail="{:$auth->check('stock/goods/detail')}"
+                                data-operate-edit="{:$auth->check('stock/goods/edit')}"
+                                data-operate-del="{:$auth->check('stock/goods/del')}"
+                                width="100%">
+                            </table>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+<!--    </div>-->
+<!--</div>-->

+ 29 - 0
application/admin/view/stock/goodscategory/add.html

@@ -0,0 +1,29 @@
+<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">父级分类:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[pid]', $goodsCategory, null, ['class'=>'form-control selectpicker', 'data-size'=>'10', 'id'=>'c-goodscategory', 'data-rule'=>''])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">分类代码:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-value" class="form-control" name="row[value]" type="text" value="{$value}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">分类名称:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
+        </div>
+    </div>
+	<div style="height: 300px;"></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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 29 - 0
application/admin/view/stock/goodscategory/edit.html

@@ -0,0 +1,29 @@
+<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">父级分类:</label>
+        <div class="col-xs-12 col-sm-8">
+            {:build_select('row[pid]', $goodsCategory, $row['pid'], ['class'=>'form-control selectpicker','data-size'=>'10', 'id'=>'c-goodscategory', 'data-rule'=>''])}
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">分类代码:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-value" class="form-control" name="row[value]" type="text" value="{$row.value}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">分类名称:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="{$row.name}">
+        </div>
+    </div>
+	<div style="height: 300px;"></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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 27 - 0
application/admin/view/stock/goodscategory/index.html

@@ -0,0 +1,27 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/goodscategory/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/goodscategory/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('stock/goodscategory/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import {:$auth->check('stock/goodscategory/import')?'':'hide'}" title="{:__('Import')}" id="btn-import-file" data-url="ajax/upload" data-mimetype="csv,xls,xlsx" data-multiple="false"><i class="fa fa-upload"></i> {:__('Import')}</a>
+
+                        <a href="javascript:;" class="btn btn-danger btn-toggle-all"><i class="fa fa-plus"></i> {:__('Toggle all')}</a>
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/goodscategory/edit')}" 
+                           data-operate-del="{:$auth->check('stock/goodscategory/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 44 - 0
application/admin/view/stock/index.html

@@ -0,0 +1,44 @@
+<style>
+    .layui-layer-dialog .layui-layer-content {
+        font-size: 35px;
+        line-height: 110px;
+        color: red;
+        text-align: center;
+    }
+</style>
+<!--<meta http-equiv="refresh" content="300">&lt;!&ndash;设置页面自动刷新&ndash;&gt;-->
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/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('stock/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-danger btn-import   {:$auth->check('stock/import')?'':'hide'}" title="{:__('Import')}" ><i class="fa fa-upload"></i> {:__('Import')}</a>
+                        <a href="/uploads/仓库日库存标准导入模板.xls" class="btn btn-success " title="{:__('Import')}" ><i class="fa layui-icon-download-circle"></i>下载导入标准模板</a>
+
+                        <div class="dropdown btn-group {:$auth->check('stock/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('stock/edit')}"
+                           data-operate-del="{:$auth->check('stock/del')}"
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 28 - 0
application/admin/view/stock/stockcur/add.html

@@ -0,0 +1,28 @@
+<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">{:__('Stock_stockin_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-stock_stockin_id" data-rule="required" data-source="stock/stockin/index" class="form-control selectpage" name="row[stock_stockin_id]" type="text" value="">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Curnum')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-curnum" class="form-control" name="row[curnum]" type="number">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Stock_goods_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-stock_goods_id" data-rule="required" data-source="stock/goods/index" class="form-control selectpage" name="row[stock_goods_id]" type="text" value="">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 57 - 0
application/admin/view/stock/stockcur/edit.html

@@ -0,0 +1,57 @@
+<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">{:__('Stock_stockin_id')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-stock_stockin_id" data-rule="required" class="form-control" name="row[stock_stockin_id]" type="text" value="{$row.stock_stockin_id}" readonly="readonly">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('商品代码')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-goods_volnum" class="form-control" name="row[stockgoods.volnum]" type="number" value="{$row.stockgoods.volnum}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('商品名称')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-goods_goodsname" class="form-control" name="row[stockgoods.goodsname]" type="text" value="{$row.stockgoods.goodsname}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('型号')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-goods_productmodel" class="form-control" name="row[stockgoods.productmodel]" type="text" value="{$row.stockgoods.productmodel}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('单位')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-stock_goods_measureunit" data-rule="required" class="form-control" name="row[stockgoods.measureunit]" type="text" value="{$row.stockgoods.measureunit}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('单价')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-stock_goods_univalence" data-rule="required" class="form-control" name="row[stockgoods.univalence]" type="text" value="{$row.stockgoods.univalence}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('当前数量')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-curnum" data-rule="required" class="form-control" name="row[stockgoods.curnum]" type="text" value="{$row.curnum}" disabled>
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('货位')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-allocation" data-rule="required" class="form-control" name="row[allocation]" type="text" value="{$row.stockstockin.allocation}">
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 38 - 0
application/admin/view/stock/stockcur/index.html

@@ -0,0 +1,38 @@
+<div class="row">
+    <div style="width: 180px; float: left;margin-left: 10px">
+        <div class="panel panel-default">
+            <div class="panel-heading">
+                商品分类
+            </div>
+            <div class="panel-body">
+                <div id="treeview"></div>
+            </div>
+        </div>
+    </div>
+    <div class="table-content">
+        <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">
+                                <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}">
+                                    <i class="fa fa-refresh"></i>
+                                </a>
+                                <a href="javascript:;" class="btn btn-success btn-detail btn-disabled disabled {:$auth->check('stock/goods/detail')?'':'hide'}"
+                                    title="{:__('出入明细')}">
+                                    <i class="fa fa-sliders"></i> {:__('出入明细')}</a>
+                            </div>
+                            <table id="table" class="table table-striped table-bordered table-hover table-nowrap" data-operate-edit="{:$auth->check('stock/stockcur/edit')}"
+                                data-operate-del="{:$auth->check('stock/stockcur/del')}" width="100%">
+                            </table>
+                        </div>
+                    </div>
+
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 118 - 0
application/admin/view/stock/stockcur/mainpage.html

@@ -0,0 +1,118 @@
+<style type="text/css">
+    .content-detail {
+        display: inline;
+        line-height: 80px;
+    }
+    #stockcur_num,#stockcur_amount{
+        width: 400px;
+        height: 400px;
+    }
+</style>
+<div class="panel panel-default panel-intro">
+    <div class="panel-body">
+        <div id="myTabContent" class="tab-content">
+            <div class="tab-pane fade active in" id="one">
+                <div class="row" style="margin-top:15px;">
+                    <div class="col-xs-6 col-md-3">
+                        <div class="panel bg-blue">
+                            <div class="panel-body">
+                                <div class="panel-title">
+                                    <h3>今日入库</h3>
+                                </div>
+                                <div class="panel-content">
+                                    <div class="row">
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockinsum.totalnums}</h1>
+                                            <small>件</small>
+                                        </div>
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockinsum.totalamount}</h1>
+                                            <small>千克</small>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-xs-6 col-md-3">
+                        <div class="panel bg-aqua-gradient">
+                            <div class="panel-body">
+                                <div class="ibox-title">
+                                    <h3>今日出库</h3>
+                                </div>
+                                <div class="ibox-content">
+                                    <div class="row">
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockoutsum.totalnums}</h1>
+                                            <small>件</small>
+                                        </div>
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockoutsum.totalamount}</h1>
+                                            <small>千克</small>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="col-xs-6 col-md-3">
+                        <div class="panel bg-purple-gradient">
+                            <div class="panel-body">
+                                <div class="ibox-title">
+                                    <h3>库存商品</h3>
+                                </div>
+                                <div class="ibox-content">
+
+                                    <div class="row">
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockcursum.totalnums}</h1>
+                                            <small>件</small>
+                                        </div>
+                                        <div class="col-md-6">
+                                            <h1 class="no-margins content-detail">{$stockcursum.totalamount}</h1>
+                                            <small>千克</small>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-xs-6 col-md-3">
+                        <div class="panel bg-green-gradient">
+                            <div class="panel-body">
+                                <div class="ibox-title">
+                                    <h3>待审核单据</h3>
+                                </div>
+                                <div class="ibox-content">
+
+                                    <div class="row">
+                                        <div class="col-md-6">
+                                            <small>入库单:</small>
+                                            <h1 class="no-margins content-detail">{$stockin_toaudit}</h1>
+                                        </div>
+                                        <div class="col-md-6">
+                                            <small>出库单:</small>
+                                            <h1 class="no-margins content-detail">{$stockout_toaudit}</h1>
+                                        </div>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                <div class="row" style="margin-top:30px;">
+                    <div class="col-lg-6">
+                        <div id="linechart" class="btn-refresh" style="height:500px;width:100%;"></div>
+                    </div>
+                    <div class="col-lg-3">
+                        <div id="stockcur_amount"></div>
+                    </div>
+                    <div class="col-lg-3">
+                        <div id="stockcur_num"></div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>

+ 193 - 0
application/admin/view/stock/stockin/add.html

@@ -0,0 +1,193 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <el-container>
+        <el-aside width="600px">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">选择入库商品</h3>
+                </div>
+                <div class="panel-body">
+                    <div class="well">
+                        <el-form :model="curgood" label-width="92px" :rules="rules" ref="curgood">
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="商品条码:">
+                                        <el-input size="small" v-model="curgood.barcode"
+                                            @keyup.enter.native="barcodeinputenter" placeholder="请输入商品条码"></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品代码:">{{curgood.volnum}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品名称:">{{curgood.goodsname}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="规格型号:">{{curgood.productmodel}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+<!--                                <el-col :span="12">-->
+<!--                                    <el-form-item style="margin-bottom: 0;" label="入库单价:" prop="inboundprice">-->
+<!--                                        <el-input type="number" @change="getcurgoodamount" size="small"-->
+<!--                                            v-model="curgood.inboundprice" step="0.01" min="0" precision="2"-->
+<!--                                            placeholder="入库单价"> <template slot="append">元</template></el-input>-->
+<!--                                    </el-form-item>-->
+<!--                                </el-col>-->
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="单桶重量:" prop="inboundprice">
+                                        <el-input type="number" @change="getcurgoodamount" size="small"
+                                                  v-model="curgood.inboundprice" step="0.01" min="0" precision="2"
+                                                  placeholder="单桶重量"> <template slot="append">千克</template></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="入库数量:" prop="stockinnums">
+                                        <el-input size="small" type="number" @change="getcurgoodamount"
+                                            v-model.number="curgood.stockinnums" min="0" placeholder="入库数量">
+                                            <template slot="append">{{curgood.measureunit}}</template>
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;text-align: right;" label-width="92px"
+                                        label="备注:">
+                                        <el-input size="small" v-model="curgood.stockingoodsremark" placeholder="备注">
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" style="text-align:right">
+                                    <el-button icon="el-icon-circle-plus-outline" @click="addtolist" size="medium"
+                                        type="primary">添加</el-button>
+                                    <el-button icon="el-icon-refresh-left" @click="reset" size="medium" type="danger">重置
+                                    </el-button>
+                                </el-col>
+                            </el-row>
+                        </el-form>
+                    </div>
+                    <el-input v-model="searchvalue" @input="onSearchvalueChange" clearable prefix-icon="el-icon-search"
+                        placeholder="请输入商品名称、代码或简拼搜索"></el-input>
+                    <el-table :data="goodsdata.list" :height="goodsdata.table.height" highlight-current-row
+                        @row-click="selectonegood" stripe border style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="univalence" label="重量(kg)">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="curstocknum" label="库存">
+                        </el-table-column>
+                    </el-table>
+                    <div class="block">
+                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                            :current-page="goodsdata.pagenation.currentpage" :page-sizes="[10, 20, 30]"
+                            :page-size="goodsdata.pagenation.pagesize" layout="total, sizes, prev, pager, next, jumper"
+                            :total="goodsdata.pagenation.total">
+                        </el-pagination>
+                    </div>
+                </div>
+            </div>
+        </el-aside>
+        <el-main style="padding:0;margin-left: 10px;">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">入库基本信息</h3>
+                </div>
+                <div class="panel-body">
+                    <el-form :model="row" label-width="120px">
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="供应商:">
+                                    <el-select v-model="row.stock_supplier_id" size="small" filterable
+                                        placeholder="请选择供应商">
+                                        <el-option v-for="item in supplierlist" :key="item.id" :label="item.name"
+                                            :value="item.id">
+                                        </el-option>
+                                    </el-select>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="入库日期:">
+                                    <el-date-picker size="small" v-model="row.inboundtime" type="date"
+                                        placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+                                    </el-date-picker>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="备注:">
+                                    <el-input v-model="row.remark" size="small" placeholder="请输入备注内容"></el-input>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label-width="150px" label="入库商品总重量:"><span
+                                        style="font-size:20px;font-weight: 600;color: #ff6666">{{row.totalamount}}千克</span>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                    </el-form>
+                </div>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">入库商品详情</h3>
+                </div>
+                <div class="panel-body">
+                    <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                        style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="stockinnums" label="入库数量">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="inboundprice" label="单桶重量">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="总计重量">
+                        </el-table-column>
+                        <el-table-column prop="stockingoodsremark" label="备注">
+                        </el-table-column>
+                        <el-table-column fixed="right" label="操作" width="100">
+                            <template slot-scope="scope">
+                                <el-button type="danger" icon="el-icon-delete" @click="deleteselected(scope.row)"
+                                    size="small" circle></el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </div>
+            </div>
+        </el-main>
+    </el-container>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-main" name="row[main]"  v-model="main" class="form-control" type="hidden">
+        <input id="c-goodslist" name="row[goodslist]"  v-model="goodslist" class="form-control" type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button type="submit"  class="btn btn-success btn-embossed disabled readonly">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 187 - 0
application/admin/view/stock/stockin/edit.html

@@ -0,0 +1,187 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <el-container>
+        <el-aside width="600px">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">选择入库商品</h3>
+                </div>
+                <div class="panel-body">
+                    <div class="well">
+                        <el-form :model="curgood" label-width="92px" :rules="rules" ref="curgood">
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="商品条码:">
+                                        <el-input size="small" v-model="curgood.barcode"
+                                            @keyup.enter.native="barcodeinputenter" placeholder="请输入商品条码"></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品代码:">{{curgood.volnum}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品名称:">{{curgood.goodsname}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="规格型号:">{{curgood.productmodel}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="单桶重量:" prop="inboundprice">
+                                        <el-input type="number" @change="getcurgoodamount" size="small"
+                                            v-model="curgood.inboundprice" step="0.01" min="0" precision="2"
+                                            placeholder="单桶重量"> <template slot="append">千克</template></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="入库数量:" prop="stockinnums">
+                                        <el-input size="small" type="number" @change="getcurgoodamount"
+                                            v-model.number="curgood.stockinnums" min="0" placeholder="入库数量">
+                                            <template slot="append">{{curgood.measureunit}}</template>
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;text-align: right;" label-width="92px"
+                                        label="备注:">
+                                        <el-input size="small" v-model="curgood.stockingoodsremark" placeholder="备注">
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" style="text-align:right">
+                                    <el-button icon="el-icon-circle-plus-outline" @click="addtolist" size="medium"
+                                        type="primary">添加</el-button>
+                                    <el-button icon="el-icon-refresh-left" @click="reset" size="medium" type="danger">重置
+                                    </el-button>
+                                </el-col>
+                            </el-row>
+                        </el-form>
+                    </div>
+                    <el-input v-model="searchvalue" @input="onSearchvalueChange" clearable prefix-icon="el-icon-search"
+                        placeholder="请输入商品名称、代码或简拼搜索"></el-input>
+                    <el-table :data="goodsdata.list" :height="goodsdata.table.height" highlight-current-row
+                        @row-click="selectonegood" stripe border style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="univalence" label="重量(kg)">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="curstocknum" label="库存">
+                        </el-table-column>
+                    </el-table>
+                    <div class="block">
+                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                            :current-page="goodsdata.pagenation.currentpage" :page-sizes="[10, 20, 30]"
+                            :page-size="goodsdata.pagenation.pagesize" layout="total, sizes, prev, pager, next, jumper"
+                            :total="goodsdata.pagenation.total">
+                        </el-pagination>
+                    </div>
+                </div>
+            </div>
+        </el-aside>
+        <el-main style="padding:0;margin-left: 10px;">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">入库基本信息</h3>
+                </div>
+                <div class="panel-body">
+                    <el-form :model="row" label-width="120px">
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="供应商:">
+                                    <el-select v-model="row.stock_supplier_id" size="small" filterable
+                                        placeholder="请选择供应商">
+                                        <el-option v-for="item in supplierlist" :key="item.id" :label="item.name"
+                                            :value="item.id">
+                                        </el-option>
+                                    </el-select>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="入库日期:">
+                                    <el-date-picker size="small" v-model="row.inboundtime" type="date"
+                                        placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+                                    </el-date-picker>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="备注:">
+                                    <el-input v-model="row.remark" size="small" placeholder="请输入备注内容"></el-input>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label-width="150px" label="入库商品总重量:"><span
+                                        style="font-size:20px;font-weight: 600;color: #ff6666">{{row.totalamount}}千克</span>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                    </el-form>
+                </div>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">入库商品详情</h3>
+                </div>
+                <div class="panel-body">
+                    <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                        style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="stockinnums" label="入库数量">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="inboundprice" label="单桶重量">
+                        </el-table-column>
+                        <el-table-column prop="amount" label="总计重量">
+                        </el-table-column>
+                        <el-table-column prop="stockingoodsremark" label="备注">
+                        </el-table-column>
+                        <el-table-column fixed="right" label="操作" width="100">
+                            <template slot-scope="scope">
+                                <el-button type="danger" icon="el-icon-delete" @click="deleteselected(scope.row)"
+                                    size="small" circle></el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </div>
+            </div>
+        </el-main>
+    </el-container>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-main" name="row[main]"  v-model="main" class="form-control" type="hidden">
+        <input id="c-goodslist" name="row[goodslist]"  v-model="goodslist" class="form-control" type="hidden">
+        <input id="c-deletedgoodslist" name="row[deletedgoodslist]"  v-model="deletedgoodslist" class="form-control" type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button type="submit"  class="btn btn-success btn-embossed disabled readonly">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 22 - 0
application/admin/view/stock/stockin/getlist.html

@@ -0,0 +1,22 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                    
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                    data-operate-edit="{:$auth->check('stock/stockin/edit')}" 
+                    data-operate-del="{:$auth->check('stock/stockin/del')}" 
+                    width="100%">
+             </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 28 - 0
application/admin/view/stock/stockin/index.html

@@ -0,0 +1,28 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/stockin/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/stockin/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('stock/stockin/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                        <a href="javascript:;" class="btn btn-info btn-print btn-disabled disabled" title="打印" ><i class="fa fa-print"></i> 打印</a>
+                        <a href="javascript:;" class="btn btn-info btn-audit btn-disabled disabled" data-operatetype="audit" title="审核/反审核" ><i class="fa fa-list-alt"></i> 审核/反审核</a>
+<!--                        <a href="javascript:;" class="btn btn-info btn-settle btn-disabled disabled" data-operatetype="settle" title="结算/反结算" ><i class="fa fa-list-alt"></i> 结算/反结算</a>-->
+                        
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/stockin/edit')}" 
+                           data-operate-del="{:$auth->check('stock/stockin/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 72 - 0
application/admin/view/stock/stockin/look.html

@@ -0,0 +1,72 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">入库基本信息</h3>
+        </div>
+        <div class="panel-body">
+            <el-row :gutter="20">
+                <el-col :span="6">
+                    入库单号:{{row.docnum}}
+                </el-col>
+                <el-col :span="6">
+                    供应商:{{row.supplier.name}}
+                </el-col>
+                <el-col :span="6">
+                    入库日期:{{row.inboundtime}}
+                </el-col>
+                <el-col :span="6">
+                    入库总重量:{{row.totalamount}}
+                </el-col>
+            </el-row>
+            <el-row :gutter="20" style="margin-top:20px;">
+                <el-col :span="24">
+                    备注:{{row.remark}}
+                </el-col>
+            </el-row>
+        </div>
+    </div>
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">入库商品详情</h3>
+        </div>
+        <div class="panel-body">
+            <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                style="width: 100%;margin-top: 10px;">
+                <el-table-column prop="volnum" label="商品代码">
+                </el-table-column>
+                <el-table-column prop="goodsname" label="商品名称">
+                </el-table-column>
+                <el-table-column prop="productmodel" label="规格">
+                </el-table-column>
+                <el-table-column prop="stockinnums" label="入库数量">
+                </el-table-column>
+                <el-table-column prop="measureunit" label="单位">
+                </el-table-column>
+                <el-table-column prop="inboundprice" label="单桶重量">
+                </el-table-column>
+                <el-table-column prop="amount" label="总计重量">
+                </el-table-column>
+                <el-table-column prop="stockingoodsremark" label="备注">
+                </el-table-column>
+            </el-table>
+        </div>
+    </div>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-docnum" name="row[docnum]" v-model="row.docnum"  type="hidden">
+        <input id="c-id" name="row[id]" v-model="row.id"  type="hidden">
+        <input id="c-commiturl" v-model="commiturl"  type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button  id="audit" class="btn btn-success btn-embossed readonly">审核</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 3 - 0
application/admin/view/stock/stockin/printer.html

@@ -0,0 +1,3 @@
+<a href="javascript:;" class="btn btn-info btn-print" title="打印" ><i class="fa fa-print"></i>打印</a>
+<div id="div1" class="printContent">
+</div>

+ 174 - 0
application/admin/view/stock/stockout/add.html

@@ -0,0 +1,174 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <el-container>
+        <el-aside width="600px">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">选择出库商品</h3>
+                </div>
+                <div class="panel-body">
+                    <div class="well">
+                        <el-form :model="curgood" label-width="92px" :rules="rules" ref="curgood">
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="商品条码:">
+                                        <el-input size="small" v-model="curgood.barcode"
+                                            @keyup.enter.native="barcodeinputenter" placeholder="请输入商品条码"></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品代码:">{{curgood.volnum}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品名称:">{{curgood.goodsname}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="规格型号:">{{curgood.productmodel}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="库存数量:">{{curgood.stocknum}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="出库数量:" prop="stockoutnums">
+                                        <el-input size="small" type="number" @change="getcurgoodamount"
+                                            v-model.number="curgood.stockoutnums" min="0" placeholder="入库数量">
+                                            <template slot="append">{{curgood.measureunit}}</template>
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;text-align: right;" label-width="92px"
+                                        label="备注:">
+                                        <el-input size="small" v-model="curgood.stockoutgoodsremark" placeholder="备注">
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" style="text-align:right">
+                                    <el-button icon="el-icon-circle-plus-outline" @click="addtolist" size="medium"
+                                        type="primary">添加</el-button>
+                                    <el-button icon="el-icon-refresh-left" @click="reset" size="medium" type="danger">重置
+                                    </el-button>
+                                </el-col>
+                            </el-row>
+                        </el-form>
+                    </div>
+                    <el-input v-model="searchvalue" @input="onSearchvalueChange" clearable prefix-icon="el-icon-search"
+                        placeholder="请输入商品名称、代码或简拼搜索"></el-input>
+                    <el-table :data="goodsdata.list" :height="goodsdata.table.height" highlight-current-row
+                        @row-click="selectonegood" stripe border style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="univalence" label="单价">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="重量">
+                        </el-table-column>
+                        <el-table-column prop="curstocknum" label="库存">
+                        </el-table-column>
+                    </el-table>
+                    <div class="block">
+                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                            :current-page="goodsdata.pagenation.currentpage" :page-sizes="[10, 20, 30]"
+                            :page-size="goodsdata.pagenation.pagesize" layout="total, sizes, prev, pager, next, jumper"
+                            :total="goodsdata.pagenation.total">
+                        </el-pagination>
+                    </div>
+                </div>
+            </div>
+        </el-aside>
+        <el-main style="padding:0;margin-left: 10px;">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">出库基本信息</h3>
+                </div>
+                <div class="panel-body">
+                    <el-form :model="row" label-width="120px">
+                        <el-row :gutter="20">
+                            <el-col :span="8">
+                                <el-form-item style="margin-bottom: 0;" label="客户:">
+                                    <el-select v-model="row.stock_customer_id" size="small" filterable
+                                        placeholder="请选择客户">
+                                        <el-option v-for="item in customerlist" :key="item.id" :label="item.name"
+                                            :value="item.id">
+                                        </el-option>
+                                    </el-select>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="8">
+                                <el-form-item style="margin-bottom: 0;" label="出库日期:">
+                                    <el-date-picker size="small" v-model="row.outboundtime" type="date"
+                                        placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+                                    </el-date-picker>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="8">
+                                <el-form-item style="margin-bottom: 0;" label="备注:">
+                                    <el-input v-model="row.remark" size="small" placeholder="请输入备注内容"></el-input>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                    </el-form>
+                </div>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">出库商品详情</h3>
+                </div>
+                <div class="panel-body">
+                    <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                        style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="stocknum" label="库存数量">
+                        </el-table-column>
+                        <el-table-column prop="stockoutnums" label="出库数量">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="stockoutgoodsremark" label="备注">
+                        </el-table-column>
+                        <el-table-column fixed="right" label="操作" width="100">
+                            <template slot-scope="scope">
+                                <el-button type="danger" icon="el-icon-delete" @click="deleteselected(scope.row)"
+                                    size="small" circle></el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </div>
+            </div>
+        </el-main>
+    </el-container>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-main" name="row[main]" v-model="main" class="form-control" type="hidden">
+        <input id="c-goodslist" name="row[goodslist]" v-model="goodslist" class="form-control" type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button type="submit" class="btn btn-success btn-embossed disabled readonly">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 182 - 0
application/admin/view/stock/stockout/edit.html

@@ -0,0 +1,182 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <el-container>
+        <el-aside width="600px">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">选择出库商品</h3>
+                </div>
+                <div class="panel-body">
+                    <div class="well">
+                        <el-form :model="curgood" label-width="92px" :rules="rules" ref="curgood">
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="商品条码:">
+                                        <el-input size="small" v-model="curgood.barcode"
+                                            @keyup.enter.native="barcodeinputenter" placeholder="请输入商品条码"></el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品代码:">{{curgood.volnum}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="商品名称:">{{curgood.goodsname}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="规格型号:">{{curgood.productmodel}}
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12" class="label el-form-item__label" style="text-align:left">
+                                    <el-form-item style="margin-bottom: 0;" label="库存数量:">{{curgood.stocknum}}
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;" label="出库数量:" prop="stockoutnums">
+                                        <el-input size="small" type="number" @change="getcurgoodamount"
+                                            v-model.number="curgood.stockoutnums" min="0" placeholder="入库数量">
+                                            <template slot="append">{{curgood.measureunit}}</template>
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                            </el-row>
+                            <el-row :gutter="20">
+                                <el-col :span="12">
+                                    <el-form-item style="margin-bottom: 0;text-align: right;" label-width="92px"
+                                        label="备注:">
+                                        <el-input size="small" v-model="curgood.stockoutgoodsremark" placeholder="备注">
+                                        </el-input>
+                                    </el-form-item>
+                                </el-col>
+                                <el-col :span="12" style="text-align:right">
+                                    <el-button icon="el-icon-circle-plus-outline" @click="addtolist" size="medium"
+                                        type="primary">添加</el-button>
+                                    <el-button icon="el-icon-refresh-left" @click="reset" size="medium" type="danger">重置
+                                    </el-button>
+                                </el-col>
+                            </el-row>
+                        </el-form>
+                    </div>
+                    <el-input v-model="searchvalue" @input="onSearchvalueChange" clearable prefix-icon="el-icon-search"
+                        placeholder="请输入商品名称、代码或简拼搜索"></el-input>
+                    <el-table :data="goodsdata.list" :height="goodsdata.table.height" highlight-current-row
+                        @row-click="selectonegood" stripe border style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="univalence" label="重量">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="curstocknum" label="库存">
+                        </el-table-column>
+                    </el-table>
+                    <div class="block">
+                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
+                            :current-page="goodsdata.pagenation.currentpage" :page-sizes="[10, 20, 30]"
+                            :page-size="goodsdata.pagenation.pagesize" layout="total, sizes, prev, pager, next, jumper"
+                            :total="goodsdata.pagenation.total">
+                        </el-pagination>
+                    </div>
+                </div>
+            </div>
+        </el-aside>
+        <el-main style="padding:0;margin-left: 10px;">
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">出库基本信息</h3>
+                </div>
+                <div class="panel-body">
+                    <el-form :model="row" label-width="120px">
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="出库单号:">
+                                    {{row.docnum}}
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="供应商:">
+                                    <el-select v-model="row.stock_customer_id" size="small" filterable
+                                        placeholder="请选择供应商">
+                                        <el-option v-for="item in customerlist" :key="item.id" :label="item.name"
+                                            :value="item.id">
+                                        </el-option>
+                                    </el-select>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                        <el-row :gutter="20">
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="出库日期:">
+                                    <el-date-picker size="small" v-model="row.outboundtime" type="date"
+                                        placeholder="选择日期" format="yyyy 年 MM 月 dd 日" value-format="yyyy-MM-dd">
+                                    </el-date-picker>
+                                </el-form-item>
+                            </el-col>
+                            <el-col :span="12">
+                                <el-form-item style="margin-bottom: 0;" label="备注:">
+                                    <el-input v-model="row.remark" size="small" placeholder="请输入备注内容"></el-input>
+                                </el-form-item>
+                            </el-col>
+                        </el-row>
+                    </el-form>
+                </div>
+            </div>
+            <div class="panel panel-default">
+                <div class="panel-heading">
+                    <h3 class="panel-title">出库商品详情</h3>
+                </div>
+                <div class="panel-body">
+                    <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                        style="width: 100%;margin-top: 10px;">
+                        <el-table-column prop="volnum" label="商品代码">
+                        </el-table-column>
+                        <el-table-column prop="goodsname" label="商品名称">
+                        </el-table-column>
+                        <el-table-column prop="productmodel" label="规格">
+                        </el-table-column>
+                        <el-table-column prop="stocknum" label="库存数量">
+                        </el-table-column>
+                        <el-table-column prop="stockoutnums" label="出库数量">
+                        </el-table-column>
+                        <el-table-column prop="measureunit" label="单位">
+                        </el-table-column>
+                        <el-table-column prop="stockoutgoodsremark" label="备注">
+                        </el-table-column>
+                        <el-table-column fixed="right" label="操作" width="100">
+                            <template slot-scope="scope">
+                                <el-button type="danger" icon="el-icon-delete" @click="deleteselected(scope.row)"
+                                    size="small" circle></el-button>
+                            </template>
+                        </el-table-column>
+                    </el-table>
+                </div>
+            </div>
+        </el-main>
+    </el-container>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-main" name="row[main]" v-model="main" class="form-control" type="hidden">
+        <input id="c-goodslist" name="row[goodslist]" v-model="goodslist" class="form-control" type="hidden">
+        <input id="c-deletedgoodslist" name="row[deletedgoodslist]"  v-model="deselectedgoodslist" class="form-control" type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button type="submit" class="btn btn-success btn-embossed disabled readonly">{:__('OK')}</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 22 - 0
application/admin/view/stock/stockout/getlist.html

@@ -0,0 +1,22 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                    
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                    data-operate-edit="{:$auth->check('stock/stockin/edit')}" 
+                    data-operate-del="{:$auth->check('stock/stockin/del')}" 
+                    width="100%">
+             </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 26 - 0
application/admin/view/stock/stockout/index.html

@@ -0,0 +1,26 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}"><i class="fa fa-refresh"></i> </a>
+<!--                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/stockout/add')?'':'hide'}" title="{:__('Add')}"><i class="fa fa-plus"></i> {:__('Add')}</a>-->
+<!--                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/stockout/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('stock/stockout/del')?'':'hide'}" title="{:__('Delete')}"><i class="fa fa-trash"></i> {:__('Delete')}</a>-->
+                        <a href="javascript:;" class="btn btn-info btn-print btn-disabled disabled" title="打印" ><i class="fa fa-print"></i> 打印</a>
+<!--                        <a href="javascript:;" class="btn btn-info btn-audit btn-disabled disabled" data-operatetype="audit" title="审核/反审核" ><i class="fa fa-list-alt"></i> 审核/反审核</a>-->
+<!--                        <a href="javascript:;" class="btn btn-info btn-settle btn-disabled disabled" data-operatetype="settle" title="结算/反结算" ><i class="fa fa-list-alt"></i> 结算/反结算</a>-->
+
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/stockout/edit')}" data-operate-del="{:$auth->check('stock/stockout/del')}" width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 72 - 0
application/admin/view/stock/stockout/look.html

@@ -0,0 +1,72 @@
+<link rel="stylesheet" href="/assets/js/backend/stock/libs/element-ui.css">
+<style>
+    .el-form-item__error {
+        padding-top: 0px;
+        margin-top: -8px;
+    }
+</style>
+<div id="app">
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">出库基本信息</h3>
+        </div>
+        <div class="panel-body">
+            <el-row :gutter="20">
+                <el-col :span="8">
+                    出库单号:{{row.docnum}}
+                </el-col>
+                <el-col :span="8">
+                    客户名称:{{row.customer.name}}
+                </el-col>
+                <el-col :span="8">
+                    出库日期:{{row.outboundtime}}
+                </el-col>
+            </el-row>
+            <el-row :gutter="20" style="margin-top:20px;">
+                <el-col :span="16">
+                    备注:{{row.remark}}
+                </el-col>
+                <el-col :span="8">
+                    总重量:{{row.totaloutamount}}
+                </el-col>
+            </el-row>
+        </div>
+    </div>
+    <div class="panel panel-default">
+        <div class="panel-heading">
+            <h3 class="panel-title">出库商品详情</h3>
+        </div>
+        <div class="panel-body">
+            <el-table :data="selectedgoodsdata.list" :height="selectedgoodsdata.table.height" stripe border
+                style="width: 100%;margin-top: 10px;">
+                <el-table-column prop="volnum" label="商品代码">
+                </el-table-column>
+                <el-table-column prop="goodsname" label="商品名称">
+                </el-table-column>
+                <el-table-column prop="productmodel" label="规格">
+                </el-table-column>
+                <el-table-column prop="stockoutnums" label="出库数量">
+                </el-table-column>
+                <el-table-column prop="measureunit" label="单位">
+                </el-table-column>
+                <el-table-column prop="inboundprice" label="单桶重量">
+                </el-table-column>
+                <el-table-column prop="amount" label="总重量">
+                </el-table-column>
+                <el-table-column prop="stockoutgoodsremark" label="备注">
+                </el-table-column>
+            </el-table>
+        </div>
+    </div>
+    <form id="form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
+        <input id="c-docnum" name="row[docnum]" v-model="row.docnum"  type="hidden">
+        <input id="c-id" name="row[id]" v-model="row.id"  type="hidden">
+        <input id="c-commiturl" v-model="commiturl"  type="hidden">
+        <div class="form-group normal-footer">
+            <label class="control-label col-sm-8"></label>
+            <div class="col-sm-4">
+                <button  id="audit" class="btn btn-success btn-embossed readonly">审核</button>
+            </div>
+        </div>
+    </form>
+</div>

+ 5 - 0
application/admin/view/stock/stockout/printer.html

@@ -0,0 +1,5 @@
+<a href="javascript:;" class="btn btn-info btn-print printt" title="打印" ><i class="fa fa-print"></i>打印</a>
+<div id="div1" class="printContent">
+</div>
+
+<script type="text/javascript" src="__CDN__/assets/js/qrcode.min.js"></script>

+ 58 - 0
application/admin/view/stock/supplier/add.html

@@ -0,0 +1,58 @@
+<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">{:__('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">{:__('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">{:__('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">{:__('shipaddress')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-shipaddress" class="form-control" name="row[shipaddress]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-address" class="form-control" name="row[address]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Contacts')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-contacts" class="form-control" name="row[contacts]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Telphone')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-telphone" class="form-control" name="row[telphone]" type="text">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-remark" class="form-control" name="row[remark]" type="text"></textarea>
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 58 - 0
application/admin/view/stock/supplier/edit.html

@@ -0,0 +1,58 @@
+<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">{:__('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}">
+        </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}">
+        </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}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Shipaddress')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-shipaddress" class="form-control" name="row[shipaddress]" type="text" value="{$row.shipaddress}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Address')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-address" class="form-control" name="row[address]" type="text" value="{$row.address}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Contacts')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-contacts" class="form-control" name="row[contacts]" type="text" value="{$row.contacts}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">{:__('Telphone')}:</label>
+        <div class="col-xs-12 col-sm-8">
+            <input id="c-telphone" class="form-control" name="row[telphone]" type="text" value="{$row.telphone}">
+        </div>
+    </div>
+    <div class="form-group">
+        <label class="control-label col-xs-12 col-sm-2">备注</label>
+        <div class="col-xs-12 col-sm-8">
+            <textarea id="c-remark" class="form-control" name="row[remark]" type="text">{$row.remark}</textarea>
+        </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-success btn-embossed disabled">{:__('OK')}</button>
+            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
+        </div>
+    </div>
+</form>

+ 24 - 0
application/admin/view/stock/supplier/index.html

@@ -0,0 +1,24 @@
+<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">
+                        <a href="javascript:;" class="btn btn-primary btn-refresh" title="{:__('Refresh')}" ><i class="fa fa-refresh"></i> </a>
+                        <a href="javascript:;" class="btn btn-success btn-add {:$auth->check('stock/supplier/add')?'':'hide'}" title="{:__('Add')}" ><i class="fa fa-plus"></i> {:__('Add')}</a>
+                        <a href="javascript:;" class="btn btn-success btn-edit btn-disabled disabled {:$auth->check('stock/supplier/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('stock/supplier/del')?'':'hide'}" title="{:__('Delete')}" ><i class="fa fa-trash"></i> {:__('Delete')}</a>
+                    </div>
+                    <table id="table" class="table table-striped table-bordered table-hover table-nowrap"
+                           data-operate-edit="{:$auth->check('stock/supplier/edit')}" 
+                           data-operate-del="{:$auth->check('stock/supplier/del')}" 
+                           width="100%">
+                    </table>
+                </div>
+            </div>
+
+        </div>
+    </div>
+</div>

+ 4 - 77
application/api/controller/Manufacture.php

@@ -1165,15 +1165,12 @@ class Manufacture extends Api
         // 只查询生产中的工单
         $where['j.gd_statu'] = '2-生产中';
         $where['j.Mod_rq'] = null;
-
-        $orderList = \db('工单_基本资料')
-            ->alias('j')
+        $orderList = \db('工单_基本资料')->alias('j')
             ->join('工单_印件资料 y', 'j.订单编号 = y.订单编号')
-            ->field('y.订单编号, j.落货日期, j.生产款号, j.款式, SUM(y.sctotal) as 裁剪总数, SUM(y.zdtotal) as 制单总数')
-            ->group('y.订单编号')  // 去重订单编号
+            ->field('j.Sys_rq,y.订单编号, j.落货日期, j.生产款号, j.款式, SUM(y.sctotal) as 裁剪总数, SUM(y.zdtotal) as 制单总数')
+            ->group('y.订单编号')
             ->where($where)
             ->select();
-
         $orderIds = array_column($orderList, '订单编号');
         // 通过订单编号关联设备_产量计酬表,获取工序名称和数量,并进行分组和汇总
         $processList = \db('设备_产量计酬')
@@ -1208,76 +1205,6 @@ class Manufacture extends Api
         }
         // 返回最终结果
         $this->success('成功', $data);
-        die;
-
-//        // 判断是否是GET请求
-//        if ($this->request->isGet() === false){
-//            $this->error('请求错误');
-//        }
-//
-//        // 获取请求参数
-//        $param = $this->request->param();
-//
-//        // 处理搜索条件
-//        if (isset($param['search'])){
-//            $where['a.订单编号'] = ['like','%'.$param['search'].'%'];
-//        }
-//        if (isset($param['client'])){
-//            $where['b.客户编号'] = $param['client'];
-//        }
-//        if (isset($param['date'])) {
-//            $year = substr($param['date'], 0, 4);
-//            $month = substr($param['date'], 4, 2);
-//            $where['b.Sys_rq'] = ['like', "$year-$month%"];
-//        }
-//        // 只查询生产中的工单
-//        $where['b.gd_statu'] = '2-生产中';
-//        $where['b.Mod_rq'] = null;
-//
-//        // 查询第一个表,获取产量信息,添加a.sys_rq字段
-//        $list = \db('设备_产量计酬')->alias('a')
-//            ->join('工单_基本资料 b', 'a.订单编号 = b.订单编号')
-//            ->join('工单_印件资料 c', 'a.订单编号 = c.订单编号 AND a.子订单编号 = c.子订单编号')
-//            ->field('b.订单编号, SUM(c.zdtotal) as 制单总数, SUM(c.sctotal) as 裁剪总数, SUM(a.数量) as 产量, a.工序名称, b.落货日期,
-//                c.颜色, a.sys_rq')
-//            ->where($where)
-//            ->whereNotNull('c.sc_rq')
-//            ->group('a.子订单编号, a.工序名称, c.颜色')
-//            ->order('c.Uniqid')
-//            ->select();
-//
-//
-//        // 查询第二个表,获取订单的基本信息
-//        $orderList = \db('工单_印件资料')
-//            ->alias('a')
-//            ->join('工单_基本资料 b', 'a.订单编号 = b.订单编号')
-//            ->field('a.订单编号, b.生产款号, SUM(a.zdtotal) as 制单总数, SUM(a.sctotal) as 裁剪总数, b.落货日期,
-//                  a.颜色, a.ck_rq as 出库日期')
-//            ->where($where)
-//            ->whereNotNull('a.sc_rq')
-//            ->group('a.子订单编号, a.颜色')
-//            ->order('a.Uniqid')
-//            ->select();
-//
-//        $data = [];
-//
-//        // 合并两个查询结果
-//        foreach ($orderList as $key => $value){
-//            $data[$key] = $value; // 先将订单基本信息放入$data
-//            foreach ($list as $k => $v){
-//                if ($value['订单编号'] === $v['订单编号'] && $value['颜色'] === $v['颜色']) {
-//                    // 根据工序名称,将对应的产量数据加入到订单信息中
-//                    if (!isset($data[$key][$v['工序名称']])){
-//                        $data[$key][$v['工序名称']] = $v['产量'];
-//                    }
-//                    // 添加sys_rq到结果
-//                    $data[$key]['sys_rq'] = $v['sys_rq'];
-//                }
-//            }
-//        }
-//
-//        // 返回成功的结果,包含合并后的数据
-//        $this->success('成功', $data);
     }
 
     /**
@@ -1375,7 +1302,7 @@ class Manufacture extends Api
             ->where('c.sczl_rq', '>=', $startDate)
             ->where('c.sczl_rq', '<=', $endDate)
             ->field('
-            c.订单编号, c.款号, j.款式, j.客户编号, j.订单数量,
+            c.订单编号, c.款号 as 生产款号, j.款式, j.客户编号, j.订单数量,
             LEFT(j.落货日期, 10) as 落货日期,
             c.sczl_rq as 创建时间, j.gd_statu as 工单状态
         ')

+ 2 - 0
application/api/controller/WorkOrder.php

@@ -331,12 +331,14 @@ class WorkOrder extends Api
             ->order('j.客户编号 asc')
             ->group('j.客户编号, 年月')
             ->select();
+
         $result = [];
         foreach ($data as $item) {
             $orderlist = count(explode(',', $item['订单编号']));
             $result[$item['年月']][] = [$item['客户编号'] . '【生产中:' . $orderlist . '】',
             ];
         }
+
         $this->success('请求成功', ['data' => $result]);
     }
 

+ 77 - 6
application/api/controller/WorkOrderSpotCheck.php

@@ -395,13 +395,15 @@ class WorkOrderSpotCheck extends Api{
                     $where['c.mod_rq'] = null;
                     $existingRecords = \db('设备_产量计酬')->alias('c')
                         ->field('c.订单编号, c.子订单编号, c.款号, c.工序编号, c.工序名称, c.尺码, c.数量, c.sczl_jtbh, c.sczl_bh, c.尾包, c.sys_rq, c.serial, c.serial_num,
-                y.zdtotal, y.sctotal, j.款式, y.颜色,y.颜色备注, CAST(c.serial_num AS SIGNED) as serial_num_numeric')
+                                y.zdtotal, y.sctotal, j.款式, y.颜色,y.颜色备注, CAST(c.serial_num AS SIGNED) as serial_num_numeric')
                         ->join('工单_印件资料 y', 'c.子订单编号 = y.子订单编号', 'left')
                         ->join('工单_基本资料 j', 'c.订单编号 = j.订单编号', 'left')
                         ->where($where)
                         ->order('c.sys_rq desc')
-                        ->select();
+                        ->group('c.订单编号, c.子订单编号, c.款号, c.工序编号, c.工序名称, c.尺码, c.数量, c.sczl_jtbh, c.sczl_bh, c.尾包, c.sys_rq, c.serial, c.serial_num, j.款式')
 
+                        //                        ->group('y.子订单编号')
+                        ->select();
                     $sizeSummary = [];
                     $sizes = [];
                     foreach ($existingRecords as $record) {
@@ -651,11 +653,12 @@ class WorkOrderSpotCheck extends Api{
 //                    echo "<pre>";print_r($matchedOrder);echo "</pre>";die;
 
                     $sizeData = getSizeSummary($order);
-
                     // 查询流水号(包数)和序号
+
                     $serial = \db('设备_产量计酬')
                         ->field('子订单编号, MAX(CAST(serial AS UNSIGNED)) as serial, MAX(CAST(serial_num AS UNSIGNED)) as serial_num')
                         ->where('子订单编号', $order)
+//                        ->where('sczl_jtbh', $params['sys_sbID'])
                         ->group('子订单编号')
                         ->find();
                     $serial['serial'] = empty($serial['serial']) ? '000' : str_pad($serial['serial'], 3, '0', STR_PAD_LEFT);
@@ -664,6 +667,7 @@ class WorkOrderSpotCheck extends Api{
                     $clwhere['sczl_jtbh'] = $params['sys_sbID'];
                     $clwhere['子订单编号'] = $order;
                     $clwhere['mod_rq'] = null;
+                    $clwhere['工序名称'] = $params['code'];
                     $cljclist = \db('设备_产量计酬')
                         ->field('订单编号,子订单编号,尺码,数量,mod_rq')
                         ->where($clwhere)
@@ -682,13 +686,14 @@ class WorkOrderSpotCheck extends Api{
                         // 累加总数量
                         $totalQuantity += $item['数量'];
                     }
+                    $result['订单编号'] = $orderNumber;
                     foreach ($result as $size => $quantity) {
                         if ($size !== '订单编号' && $size !== '数量') {
                             $result[$size] = '合计(' . $quantity . ')';
                         }
                     }
-                    $result['订单编号'] = $orderNumber;
                     $result['数量'] = '合计(' . $totalQuantity . ')';
+
                     // 初始化 $sizeData['records'],以防万一它不存在
                     if (!isset($sizeData['records'])) {
                         $sizeData['records'] = [];
@@ -1886,10 +1891,73 @@ class WorkOrderSpotCheck extends Api{
     /**
      * 手工、大烫、总检、包装完工报工【通用的报工操作函数】
      */
+//    function reportWork($params) {
+//        $bglist = \db('设备_产量计酬')->field('订单编号,子订单编号,数量,ci_num,款号,sys_rq,serial,serial_num')->where('UniqId', $params['UniqId'])->fetchSql(true)->find();
+//        $list_gd = \db()->query($bglist);
+//
+//        $orderlist = \db('工单_基本资料')->where('订单编号', $list_gd[0]['订单编号'])->find();
+//        echo "<pre>";
+//        print_r($orderlist);
+//        echo "<pre>";die;
+//        $addorder['工单入仓数量'] = $params['sl'];
+//
+//        $orderlist = \db('工单_基本资料')->where('订单编号', $list_gd[0]['订单编号'])->update($addorder);
+//
+//        // 构建单条记录的函数,传递 $list_gd 作为参数
+//        function buildRecords($item, $list_gd) {
+//            return [
+//                '订单编号' => $item['order'],
+//                '子订单编号' => $item['order_id'],
+//                '款号' => $list_gd[0]['款号'],
+//                'serial' => $list_gd[0]['serial'],
+//                'serial_num' => $list_gd[0]['serial_num'],
+//                '工序编号' => $item['gx'],
+//                '工序名称' => $item['gxmc'],
+//                '尺码' => $item['cm'],
+//                '数量' => $item['sl'],
+//                'sczl_jtbh' => $item['sczl_jtbh'],
+//                'sczl_bh' => $item['sczl_bh'],
+//                '尾包' => $item['wb'],
+//                'sys_id' => $item['sys_id'],
+//                'sys_rq' => date('Y-m-d H:i:s'),
+//                'sczl_rq' => date('Y-m-d'),
+//                'ci_num' => $item['ci_num'] - $item['s_num'],
+//                's_num' => $item['s_num'],
+//            ];
+//        }
+//        // 检查是否是索引数组(多条记录)
+//        if (isset($params[0]) && is_array($params[0])) {
+//            foreach ($params as $item) {
+//                $list[] = buildRecords($item, $list_gd);
+//            }
+//        } else {
+//            //处理单条记录
+//            $list[] = buildRecords($params, $list_gd);
+//        }
+//        $result = \db('设备_产量计酬')->insertAll($list);
+//        if ($result) {
+//            $this->success('数据插入成功 : ' . date('H:i:s'));
+//        } else {
+//            $this->error('数据插入失败');
+//        }
+//    }
     function reportWork($params) {
-        $bglist = \db('设备_产量计酬')->field('订单编号,子订单编号,数量,ci_num,款号,sys_rq,serial,serial_num')->where('UniqId', $params['UniqId'])->fetchSql(true)->find();
+        // 查询设备_产量计酬表的数据
+        $bglist = \db('设备_产量计酬')->field('订单编号,子订单编号,数量,ci_num,款号,sys_rq,serial,serial_num')
+            ->where('UniqId', $params['UniqId'])->fetchSql(true)->find();
         $list_gd = \db()->query($bglist);
 
+        // 查询工单基本资料表的数据
+        $orderlist = \db('工单_基本资料')->where('订单编号', $list_gd[0]['订单编号'])->find();
+
+        // 检查code是否为 "包装"
+        if ($params['code'] == '包装') {
+            // 如果是 "包装",则增加工单基本资料表中的入仓数量
+            $addorder['工单入仓数量'] = $orderlist['工单入仓数量'] + $params['sl'];
+            $result = \db('工单_基本资料')->where('订单编号', $list_gd[0]['订单编号'])->fetchSql(true)->update($addorder);
+            $sql = \db()->query($result);
+        }
+
         // 构建单条记录的函数,传递 $list_gd 作为参数
         function buildRecords($item, $list_gd) {
             return [
@@ -1912,15 +1980,18 @@ class WorkOrderSpotCheck extends Api{
                 's_num' => $item['s_num'],
             ];
         }
+
         // 检查是否是索引数组(多条记录)
         if (isset($params[0]) && is_array($params[0])) {
             foreach ($params as $item) {
                 $list[] = buildRecords($item, $list_gd);
             }
         } else {
-            //处理单条记录
+            // 处理单条记录
             $list[] = buildRecords($params, $list_gd);
         }
+
+        // 插入数据到设备_产量计酬表
         $result = \db('设备_产量计酬')->insertAll($list);
         if ($result) {
             $this->success('数据插入成功 : ' . date('H:i:s'));

+ 143 - 0
public/assets/addons/lodop-print/Lodop.js

@@ -0,0 +1,143 @@
+var CreatedOKLodop7766 = null, CLodopIsLocal;
+
+//====判断是否需要 Web打印服务CLodop:===
+//===(不支持插件的浏览器版本需要用它)===
+function needCLodop() {
+    try {
+        var ua = navigator.userAgent;
+        if (ua.match(/Windows\sPhone/i))
+            return true;
+        if (ua.match(/iPhone|iPod|iPad/i))
+            return true;
+        if (ua.match(/Android/i))
+            return true;
+        if (ua.match(/Edge\D?\d+/i))
+            return true;
+
+        var verTrident = ua.match(/Trident\D?\d+/i);
+        var verIE = ua.match(/MSIE\D?\d+/i);
+        var verOPR = ua.match(/OPR\D?\d+/i);
+        var verFF = ua.match(/Firefox\D?\d+/i);
+        var x64 = ua.match(/x64/i);
+        if ((!verTrident) && (!verIE) && (x64))
+            return true;
+        else if (verFF) {
+            verFF = verFF[0].match(/\d+/);
+            if ((verFF[0] >= 41) || (x64))
+                return true;
+        } else if (verOPR) {
+            verOPR = verOPR[0].match(/\d+/);
+            if (verOPR[0] >= 32)
+                return true;
+        } else if ((!verTrident) && (!verIE)) {
+            var verChrome = ua.match(/Chrome\D?\d+/i);
+            if (verChrome) {
+                verChrome = verChrome[0].match(/\d+/);
+                if (verChrome[0] >= 41)
+                    return true;
+            }
+        }
+        return false;
+    } catch (err) {
+        return true;
+    }
+}
+
+//====页面引用CLodop云打印必须的JS文件,用双端口(8000和18000)避免其中某个被占用:====
+if (needCLodop()) {
+    var src1 = "http://localhost:8000/CLodopfuncs.js?priority=1";
+    var src2 = "http://localhost:18000/CLodopfuncs.js?priority=0";
+
+    var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement;
+    var oscript = document.createElement("script");
+    oscript.src = src1;
+    head.insertBefore(oscript, head.firstChild);
+    oscript = document.createElement("script");
+    oscript.src = src2;
+    head.insertBefore(oscript, head.firstChild);
+    CLodopIsLocal = !!((src1 + src2).match(/\/\/localho|\/\/127.0.0./i));
+}
+
+//====获取LODOP对象的主过程:====
+function getLodop(oOBJECT, oEMBED) {
+    
+      var strHtmInstall = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='/assets/addons/stock/lodop-print/install_lodop32.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtmUpdate = "<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='/assets/addons/stock/lodop-print/install_lodop32.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtm64_Install = "<br><font color='#FF00FF'>打印控件未安装!点击这里<a href='/assets/addons/stock/lodop-print/install_lodop64.exe' target='_self'>执行安装</a>,安装后请刷新页面或重新进入。</font>";
+    var strHtm64_Update = "<br><font color='#FF00FF'>打印控件需要升级!点击这里<a href='/assets/addons/stock/lodop-print/install_lodop64.exe' target='_self'>执行升级</a>,升级后请重新进入。</font>";
+    var strHtmFireFox = "<br><br><font color='#FF00FF'>(注意:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】->【附加组件】->【扩展】中先卸它)</font>";
+    var strHtmChrome = "<br><br><font color='#FF00FF'>(如果此前正常,仅因浏览器升级或重安装而出问题,需重新执行以上安装)</font>";
+    var strCLodopInstall_1 = "<br><font color='#FF00FF'>Web打印服务CLodop未安装启动,点击这里<a href='/assets/addons/stock/lodop-print/CLodop_Setup_for_Win32NT.exe' target='_self'>下载执行安装</a>";
+    var strCLodopInstall_2 = "<br>(若此前已安装过,可<a href='CLodop.protocol:setup' target='_self'>点这里直接再次启动</a>)";
+    var strCLodopInstall_3 = ",成功后请刷新本页面。</font>";
+    var strCLodopUpdate = "<br><font color='#FF00FF'>Web打印服务CLodop需升级!点击这里<a href='/assets/addons/stock/lodop-print/CLodop_Setup_for_Win32NT.exe' target='_self'>执行升级</a>,升级后请刷新页面。</font>";
+    var LODOP;
+    try {
+        var ua = navigator.userAgent;
+        var isIE = !!(ua.match(/MSIE/i)) || !!(ua.match(/Trident/i));
+        if (needCLodop()) {
+            try {
+                LODOP = getCLodop();
+            } catch (err) {}
+            if (!LODOP && document.readyState !== "complete") {
+                alert("网页还没下载完毕,请稍等一下再操作.");
+                return;
+            }
+            if (!LODOP) {
+                document.body.innerHTML = strCLodopInstall_1 + (CLodopIsLocal ? strCLodopInstall_2 : "") + strCLodopInstall_3 + document.body.innerHTML;                
+                return;
+            } else {
+                if (CLODOP.CVERSION < "3.0.7.5") {
+                    document.body.innerHTML = strCLodopUpdate + document.body.innerHTML;
+                }
+                if (oEMBED && oEMBED.parentNode)
+                    oEMBED.parentNode.removeChild(oEMBED);
+                if (oOBJECT && oOBJECT.parentNode)
+                    oOBJECT.parentNode.removeChild(oOBJECT);
+            }
+        } else {
+            var is64IE = isIE && !!(ua.match(/x64/i));
+            //=====如果页面有Lodop就直接使用,没有则新建:==========
+            if (oOBJECT || oEMBED) {
+                if (isIE)
+                    LODOP = oOBJECT;
+                else
+                    LODOP = oEMBED;
+            } else if (!CreatedOKLodop7766) {
+                LODOP = document.createElement("object");
+                LODOP.setAttribute("width", 0);
+                LODOP.setAttribute("height", 0);
+                LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;");
+                if (isIE)
+                    LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA");
+                else
+                    LODOP.setAttribute("type", "application/x-print-lodop");
+                document.documentElement.appendChild(LODOP);
+                CreatedOKLodop7766 = LODOP;
+            } else
+                LODOP = CreatedOKLodop7766;
+            //=====Lodop插件未安装时提示下载地址:==========
+            if ((!LODOP) || (!LODOP.VERSION)) {
+                if (ua.indexOf('Chrome') >= 0)
+                    document.body.innerHTML = strHtmChrome + document.body.innerHTML;
+                if (ua.indexOf('Firefox') >= 0)
+                    document.body.innerHTML = strHtmFireFox + document.body.innerHTML;
+                document.body.innerHTML ="请使用chrome或Firefox浏览器!";
+                return LODOP;
+            }
+        }
+        if (LODOP.VERSION < "6.2.2.6") {
+            if (!needCLodop())
+                document.body.innerHTML ="请使用chrome或Firefox浏览器!";
+            return LODOP;
+        }
+        //===如下空白位置适合调用统一功能(如注册语句、语言选择等):==
+
+
+
+        //=======================================================
+        return LODOP;
+    } catch (err) {
+        alert("getLodop出错:" + err);
+    }
+}

File diff suppressed because it is too large
+ 5 - 0
public/assets/addons/pinyinUtil/dict/pinyin_dict_firstletter.js


+ 372 - 0
public/assets/addons/pinyinUtil/pinyinUtil.js

@@ -0,0 +1,372 @@
+
+/**
+ * 汉字与拼音互转工具,根据导入的字典文件的不同支持不同
+ * 对于多音字目前只是将所有可能的组合输出,准确识别多音字需要完善的词库,而词库文件往往比字库还要大,所以不太适合web环境。
+ * @start 2016-09-26
+ * @last 2016-09-29
+ */
+(function(global, factory) {
+	if (typeof module === "object" && typeof module.exports === "object") {
+		module.exports = factory(global);
+	} else {
+		factory(global);
+	}
+})(typeof window !== "undefined" ? window : this, function(window) {
+
+	var toneMap = 
+	{
+		"ā": "a1",
+		"á": "a2",
+		"ǎ": "a3",
+		"à": "a4",
+		"ō": "o1",
+		"ó": "o2",
+		"ǒ": "o3",
+		"ò": "o4",
+		"ē": "e1",
+		"é": "e2",
+		"ě": "e3",
+		"è": "e4",
+		"ī": "i1",
+		"í": "i2",
+		"ǐ": "i3",
+		"ì": "i4",
+		"ū": "u1",
+		"ú": "u2",
+		"ǔ": "u3",
+		"ù": "u4",
+		"ü": "v0",
+		"ǖ": "v1",
+		"ǘ": "v2",
+		"ǚ": "v3",
+		"ǜ": "v4",
+		"ń": "n2",
+		"ň": "n3",
+		"": "m2"
+	};
+
+	var dict = {}; // 存储所有字典数据
+	var pinyinUtil =
+	{
+		/**
+		 * 解析各种字典文件,所需的字典文件必须在本JS之前导入
+		 */
+		parseDict: function()
+		{
+			// 如果导入了 pinyin_dict_firstletter.js
+			if(window.pinyin_dict_firstletter)
+			{
+				dict.firstletter = pinyin_dict_firstletter;
+			}
+			// 如果导入了 pinyin_dict_notone.js
+			if(window.pinyin_dict_notone)
+			{
+				dict.notone = {};
+				dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+				for(var i in pinyin_dict_notone)
+				{
+					var temp = pinyin_dict_notone[i];
+					for(var j=0, len=temp.length; j<len; j++)
+					{
+						if(!dict.notone[temp[j]]) dict.notone[temp[j]] = i; // 不考虑多音字
+					}
+				}
+			}
+			// 如果导入了 pinyin_dict_withtone.js
+			if(window.pinyin_dict_withtone)
+			{
+				dict.withtone = {}; // 汉字与拼音映射,多音字用空格分开,类似这种结构:{'大': 'da tai'}
+				var temp = pinyin_dict_withtone.split(',');
+				for(var i=0, len = temp.length; i<len; i++)
+				{
+					// 这段代码耗时28毫秒左右,对性能影响不大,所以一次性处理完毕
+					dict.withtone[String.fromCharCode(i + 19968)] = temp[i]; // 这里先不进行split(' '),因为一次性循环2万次split比较消耗性能
+				}
+
+				// 拼音 -> 汉字
+				if(window.pinyin_dict_notone)
+				{
+					// 对于拼音转汉字,我们优先使用pinyin_dict_notone字典文件
+					// 因为这个字典文件不包含生僻字,且已按照汉字使用频率排序
+					dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+				}
+				else
+				{
+					// 将字典文件解析成拼音->汉字的结构
+					// 与先分割后逐个去掉声调相比,先一次性全部去掉声调然后再分割速度至少快了3倍,前者大约需要120毫秒,后者大约只需要30毫秒(Chrome下)
+					var notone = pinyinUtil.removeTone(pinyin_dict_withtone).split(',');
+					var py2hz = {}, py, hz;
+					for(var i=0, len = notone.length; i<len; i++)
+					{
+						hz = String.fromCharCode(i + 19968); // 汉字
+						py = notone[i].split(' '); // 去掉了声调的拼音数组
+						for(var j=0; j<py.length; j++)
+						{
+							py2hz[py[j]] = (py2hz[py[j]] || '') + hz;
+						}
+					}
+					dict.py2hz = py2hz;
+				}
+			}
+		},
+		/**
+		 * 根据汉字获取拼音,如果不是汉字直接返回原字符
+		 * @param chinese 要转换的汉字
+		 * @param splitter 分隔字符,默认用空格分隔
+		 * @param withtone 返回结果是否包含声调,默认是
+		 * @param polyphone 是否支持多音字,默认否
+		 */
+		getPinyin: function(chinese, splitter, withtone, polyphone)
+		{
+			if(!chinese || /^ +$/g.test(chinese)) return '';
+			splitter = splitter == undefined ? ' ' : splitter;
+			withtone = withtone == undefined ? true : withtone;
+			polyphone = polyphone == undefined ? false : polyphone;
+			var result = [];
+			if(dict.withtone) // 优先使用带声调的字典文件
+			{
+				var noChinese = '';
+				for (var i=0, len = chinese.length; i < len; i++)
+				{
+					var pinyin = dict.withtone[chinese[i]];
+					if(pinyin)
+					{
+						// 如果不需要多音字,默认返回第一个拼音,后面的直接忽略
+						// 所以这对数据字典有一定要求,常见字的拼音必须放在最前面
+						if(!polyphone) pinyin = pinyin.replace(/ .*$/g, '');
+						if(!withtone) pinyin = this.removeTone(pinyin); // 如果不需要声调
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+						result.push( pinyin ); 
+					}
+					else if ( !chinese[i] || /^ +$/g.test(chinese[i]) ){
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+					}
+					else{
+						noChinese += chinese[i];
+					}
+				}
+				if ( noChinese ){
+					result.push( noChinese);
+					noChinese = '';
+				}
+			}
+			else if(dict.notone) // 使用没有声调的字典文件
+			{
+				if(withtone) console.warn('pinyin_dict_notone 字典文件不支持声调!');
+				if(polyphone) console.warn('pinyin_dict_notone 字典文件不支持多音字!');
+				var noChinese = '';
+				for (var i=0, len = chinese.length; i < len; i++)
+				{
+					var temp = chinese.charAt(i),
+						pinyin = dict.notone[temp];
+					if ( pinyin ){ //插入拼音
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+						result.push( pinyin );
+					}
+					else if ( !temp || /^ +$/g.test(temp) ){
+						//空格,插入之前的非中文字符
+						noChinese && ( result.push( noChinese), noChinese = '' );
+					}
+					else {
+						//非空格,关联到noChinese中
+						noChinese += temp;
+					}
+				}
+
+				if ( noChinese ){
+					result.push( noChinese );
+					noChinese = '';
+				}
+			}
+			else
+			{
+				throw '抱歉,未找到合适的拼音字典文件!';
+			}
+			if(!polyphone) return result.join(splitter);
+			else
+			{
+				if(window.pinyin_dict_polyphone) return parsePolyphone(chinese, result, splitter, withtone);
+				else return handlePolyphone(result, ' ', splitter);
+			}
+		},
+		/**
+		 * 获取汉字的拼音首字母
+		 * @param str 汉字字符串,如果遇到非汉字则原样返回
+		 * @param polyphone 是否支持多音字,默认false,如果为true,会返回所有可能的组合数组
+		 */
+		getFirstLetter: function(str, polyphone)
+		{
+			polyphone = polyphone == undefined ? false : polyphone;
+			if(!str || /^ +$/g.test(str)) return '';
+			if(dict.firstletter) // 使用首字母字典文件
+			{
+				var result = [];
+				for(var i=0; i<str.length; i++)
+				{
+					var unicode = str.charCodeAt(i);
+					var ch = str.charAt(i);
+					if(unicode >= 19968 && unicode <= 40869)
+					{
+						ch = dict.firstletter.all.charAt(unicode-19968);
+						if(polyphone) ch = dict.firstletter.polyphone[unicode] || ch;
+					}
+					result.push(ch);
+				}
+				if(!polyphone) return result.join(''); // 如果不用管多音字,直接将数组拼接成字符串
+				else return handlePolyphone(result, '', ''); // 处理多音字,此时的result类似于:['D', 'ZC', 'F']
+			}
+			else
+			{
+				var py = this.getPinyin(str, ' ', false, polyphone);
+				py = py instanceof Array ? py : [py];
+				var result = [];
+				for(var i=0; i<py.length; i++)
+				{
+					result.push(py[i].replace(/(^| )(\w)\w*/g, function(m,$1,$2){return $2.toUpperCase();}));
+				}
+				if(!polyphone) return result[0];
+				else return simpleUnique(result);
+			}
+		},
+		/**
+		 * 拼音转汉字,只支持单个汉字,返回所有匹配的汉字组合
+		 * @param pinyin 单个汉字的拼音,可以包含声调
+		 */
+		getHanzi: function(pinyin)
+		{
+			if(!dict.py2hz)
+			{
+				throw '抱歉,未找到合适的拼音字典文件!';
+			}
+			return dict.py2hz[this.removeTone(pinyin)] || '';
+		},
+		/**
+		 * 获取某个汉字的同音字,本方法暂时有问题,待完善
+		 * @param hz 单个汉字
+		 * @param sameTone 是否获取同音同声调的汉字,必须传进来的拼音带声调才支持,默认false
+		 */
+		getSameVoiceWord: function(hz, sameTone)
+		{
+			sameTone = sameTone || false
+			return this.getHanzi(this.getPinyin(hz, ' ', false))
+		},
+		/**
+		 * 去除拼音中的声调,比如将 xiǎo míng tóng xué 转换成 xiao ming tong xue
+		 * @param pinyin 需要转换的拼音
+		 */
+		removeTone: function(pinyin)
+		{
+			return pinyin.replace(/[āáǎàōóǒòēéěèīíǐìūúǔùüǖǘǚǜńň]/g, function(m){ return toneMap[m][0]; });
+		},
+		/**
+		 * 将数组拼音转换成真正的带标点的拼音
+		 * @param pinyinWithoutTone 类似 xu2e这样的带数字的拼音
+		 */
+		getTone: function(pinyinWithoutTone)
+		{
+			var newToneMap = {};
+			for(var i in toneMap) newToneMap[toneMap[i]] = i;
+			return (pinyinWithoutTone || '').replace(/[a-z]\d/g, function(m) {
+				return newToneMap[m] || m;
+			});
+		}
+	};
+
+
+	/**
+	 * 处理多音字,将类似['D', 'ZC', 'F']转换成['DZF', 'DCF']
+	 * 或者将 ['chang zhang', 'cheng'] 转换成 ['chang cheng', 'zhang cheng']
+	 */
+	function handlePolyphone(array, splitter, joinChar)
+	{
+		splitter = splitter || '';
+		var result = [''], temp = [];
+		for(var i=0; i<array.length; i++)
+		{
+			temp = [];
+			var t = array[i].split(splitter);
+			for(var j=0; j<t.length; j++)
+			{
+				for(var k=0; k<result.length; k++)
+					temp.push(result[k] + (result[k]?joinChar:'') + t[j]);
+			}
+			result = temp;
+		}
+		return simpleUnique(result);
+	}
+
+	/**
+	 * 根据词库找出多音字正确的读音
+	 * 这里只是非常简单的实现,效率和效果都有一些问题
+	 * 推荐使用第三方分词工具先对句子进行分词,然后再匹配多音字
+	 * @param chinese 需要转换的汉字
+	 * @param result 初步匹配出来的包含多个发音的拼音结果
+	 * @param splitter 返回结果拼接字符
+	 */
+	function parsePolyphone(chinese, result, splitter, withtone)
+	{
+		var poly = window.pinyin_dict_polyphone;
+		var max = 7; // 最多只考虑7个汉字的多音字词,虽然词库里面有10个字的,但是数量非常少,为了整体效率暂时忽略之
+		var temp = poly[chinese];
+		if(temp) // 如果直接找到了结果
+		{
+			temp = temp.split(' ');
+			for(var i=0; i<temp.length; i++)
+			{
+				result[i] = temp[i] || result[i];
+				if(!withtone) result[i] = pinyinUtil.removeTone(result[i]);
+			}
+			return result.join(splitter);
+		}
+		for(var i=0; i<chinese.length; i++)
+		{
+			temp = '';
+			for(var j=0; j<max && (i+j)<chinese.length; j++)
+			{
+				if(!/^[\u2E80-\u9FFF]+$/.test(chinese[i+j])) break; // 如果碰到非汉字直接停止本次查找
+				temp += chinese[i+j];
+				var res = poly[temp];
+				if(res) // 如果找到了多音字词语
+				{
+					res = res.split(' ');
+					for(var k=0; k<=j; k++)
+					{
+						if(res[k]) result[i+k] = withtone ? res[k] : pinyinUtil.removeTone(res[k]);
+					}
+					break;
+				}
+			}
+		}
+		// 最后这一步是为了防止出现词库里面也没有包含的多音字词语
+		for(var i=0; i<result.length; i++)
+		{
+			result[i] = result[i].replace(/ .*$/g, '');
+		}
+		return result.join(splitter);
+	}
+
+	// 简单数组去重
+	function simpleUnique(array)
+	{
+		var result = [];
+		var hash = {};
+		for(var i=0; i<array.length; i++)
+		{
+			var key = (typeof array[i]) + array[i];
+			if(!hash[key])
+			{
+				result.push(array[i]);
+				hash[key] = true;
+			}
+		}
+		return result;
+	}
+
+	pinyinUtil.parseDict();
+	pinyinUtil.dict = dict;
+	window.pinyinUtil = pinyinUtil;
+
+});

+ 132 - 0
public/assets/js/backend/stock/customer.js

@@ -0,0 +1,132 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/customer/index',
+                    add_url: 'stock/customer/add',
+                    edit_url: 'stock/customer/edit',
+                    del_url: 'stock/customer/del',
+                    multi_url: 'stock/customer/multi',
+                    table: 'stock_customer',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                escape: false,
+
+                columns: [
+                    [
+                        { checkbox: true },
+                        { field: 'id', title: __('Id'),width:50 },
+                        { field: 'encode', title: __('Encode'),align:'left' },
+                        { field: 'name', title: __('Name'),width:150,align:'left' },
+                        {
+                            field: 'id',
+                            title: '<a href="javascript:;" class="btn btn-success btn-xs btn-toggle"><i class="fa fa-chevron-up"></i></a>',
+                            operate: false,
+                            formatter: Controller.api.formatter.subnode
+                        },
+                        { field: 'shortname', title: __('Shortname') },
+                        { field: 'innerphone', title: __('Innerphone') },
+                        { field: 'weigh', title: __('Weigh') },
+                        { field: 'enabledmark', title: __('Enabledmark'), visible: false, searchList: { "1": __('Enabledmark 1'), "0": __('Enabledmark 0') } },
+                        { field: 'enabledmark_text', title: __('Enabledmark'), operate: false },
+                        { field: 'remark', title: __('Remark') },
+                        { field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate }
+                    ]
+                ],
+                pagination: false,
+                search: false,
+                commonSearch: false,
+            });
+            //当内容渲染完成后
+            table.on('post-body.bs.table', function (e, settings, json, xhr) {
+                //默认隐藏所有子节点
+                // $("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide();
+                // $(".btn-node-sub.disabled").closest("tr").hide();
+
+                //显示隐藏子节点
+                $(".btn-node-sub").off("click").on("click", function (e) {
+                    var status = $(this).data("shown") ? true : false;
+                    $("a.btn[data-pid='" + $(this).data("id") + "']").each(function () {
+                        $(this).closest("tr").toggle(!status);
+                    });
+                    $(this).data("shown", !status);
+                    return false;
+                });
+                $(".btn-change[data-id],.btn-delone,.btn-dragsort").data("success", function (data, ret) {
+                    Fast.api.refreshmenu();
+                });
+
+            });
+            //批量删除后的回调
+            $(".toolbar > .btn-del,.toolbar .btn-more~ul>li>a").data("success", function (e) {
+                Fast.api.refreshmenu();
+            });
+            //展开隐藏一级
+            $(document.body).on("click", ".btn-toggle", function (e) {
+                $("a.btn[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
+                var that = this;
+                var show = $("i", that).hasClass("fa-chevron-down");
+                $("i", that).toggleClass("fa-chevron-down", !show);
+                $("i", that).toggleClass("fa-chevron-up", show);
+                $("a.btn[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
+                $(".btn-node-sub[data-pid=0]").data("shown", show);
+            });
+            //展开隐藏全部
+            $(document.body).on("click", ".btn-toggle-all", function (e) {
+                var that = this;
+                var show = $("i", that).hasClass("fa-plus");
+                $("i", that).toggleClass("fa-plus", !show);
+                $("i", that).toggleClass("fa-minus", show);
+                $(".btn-node-sub.disabled").closest("tr").toggle(show);
+                $(".btn-node-sub").data("shown", show);
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            formatter: {
+                subnode: function (value, row, index) {
+                    return '<a href="javascript:;" data-toggle="tooltip" title="' + __('Toggle sub menu') + '" data-id="' + row.id + '" data-pid="' + row.pid + '" class="btn btn-xs '
+                        + (row.haschild == 1 || row.ismenu == 1 ? 'btn-success' : 'btn-default disabled') + ' btn-node-sub"><i class="fa fa-sitemap"></i></a>';
+                }
+            },
+            bindevent: function () {
+                //ajax请求根据父级客户产生客户代码
+                function madeEncode() {
+                    $.ajax({
+                        url: 'stock/customer/madeencode',
+                        type: 'POST', //GET
+                        async: true, //或false,是否异步
+                        timeout: 5000, //超时时间
+                        dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text        
+                        data: { id: $('#c-pid option:selected').val() },
+                        success: function (data) {
+                            $('#c-encode').val(data);
+                        }
+                    });
+                }
+                $('#c-pid').change(madeEncode);
+                
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 67 - 0
public/assets/js/backend/stock/datadict.js

@@ -0,0 +1,67 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/datadict/index',
+                    add_url: 'stock/datadict/add',
+                    edit_url: 'stock/datadict/edit',
+                    del_url: 'stock/datadict/del',
+                    multi_url: 'stock/datadict/multi',
+                    table: 'stock/datadict',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                escape: false,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'name', title: __('Name'), align: 'left'},
+                        {field: 'code', title: __('Code')},
+                        {field: 'istree', title: __('Istree'), visible: false, searchList: {"1": __('Istree 1'), "0": __('Istree 0')}},
+                        {field: 'istree_text', title: __('Istree'), operate: false},
+                        {field: 'weigh', title: __('Weigh')},
+                        {field: 'remark', title: __('Remark')},
+                        {field: 'enabled', title: __('Enabled'), visible: false, searchList: {"1": __('Enabled 1'), "0": __('Enabled 0')}},
+                        {field: 'enabled_text', title: __('Enabled'), operate: false},
+                        {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: {
+            formatter: {
+                istree: function (value, row, index) {
+                    if (value == 1) {
+                        return "是";
+                    } else if (value == 0) {
+                        return "否";
+                    }
+                }
+            },
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 92 - 0
public/assets/js/backend/stock/datadictitem.js

@@ -0,0 +1,92 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree'], function ($, undefined, Backend, Table, Form, jstree) {
+
+    var Controller = {
+        index: function () {
+            var datadict_id = 0;
+            var table = $("#table");
+            $(function () {
+                var autoWidth = $(window).width() - 220;
+                $('.table-content').css({'width': autoWidth, "position": "absolute", "left": "210px"});
+                $("#treeview").jstree({
+                    "themes": {"stripes": true},
+                    "core": {
+                        'multiple': false,
+                        'check_callback': true,
+                        "data": {
+                            url: "stock/datadict/getjsTree",
+                        }
+                    }
+                }).on('select_node.jstree', function (node, selected) {
+                    datadict_id = selected.node.data.id;
+                    table.bootstrapTable('refresh', {
+                        query: {
+                            datadict_id: datadict_id
+                        }
+                    });
+                }).on('ready.jstree',function(){
+                    if($("#treeview ul li:first").length>0){
+                        $('#treeview').jstree('select_node',$("#treeview ul li:first"));
+                    }
+                });
+            });
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/datadictitem/index',
+                    add_url: 'stock/datadictitem/add',
+                    edit_url: 'stock/datadictitem/edit',
+                    del_url: 'stock/datadictitem/del',
+                    multi_url: 'stock/datadictitem/multi',
+                    table: 'stock_datadictitem',
+                }
+            });
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'weigh',
+                height: $(window).height() - 137,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {field: 'id', title: __('Id')},
+                        {field: 'name', title: __('Name')},
+                        {field: 'value', title: __('Value')},
+                        {field: 'weigh', title: __('Weigh')},
+                        {field: 'remark', title: __('Remark')},
+                        {field: 'enabled', title: __('Enabled'), visible: false, searchList: {"1": __('Enabled 1'), "0": __('Enabled 0')}},
+                        {field: 'enabled_text', title: __('Enabled'), operate: false},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ],
+                queryParams: function (params) {
+                    params.datadict_id = datadict_id;
+                    return params;
+                }
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            // 刷新按钮事件
+            $('.btn-refresh').click(function (event) {
+                event.stopPropagation();
+                table.bootstrapTable('refresh', {
+                    query: {
+                        datadict_id: datadict_id
+                    }
+                });
+            });
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 246 - 0
public/assets/js/backend/stock/goods.js

@@ -0,0 +1,246 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'pingyinUntil', 'jstree'], function ($, undefined, Backend, Table, Form, pingyinUntil, jstree) {
+    var Controller = {
+        index: function () {
+            $(".btn-detail").data("area", ['90%', '90%']);
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/goods/index',
+                    add_url: 'stock/goods/add',
+                    edit_url: 'stock/goods/edit',
+                    del_url: 'stock/goods/del',
+                    import_url: 'stock/goods/import',
+                    multi_url: 'stock/goods/multi',
+                    detail_url: 'stock/goods/detail',
+                    table: 'stock_goods',
+                }
+            });
+            var table = $("#table");
+			var categoryids="";
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'goods.id',
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                    //     {checkbox: true},
+                    //     {field: 'id', title: __('Id'), },
+                    //     {field: 'goodscategory.name', title: __('goodscategory'), sortable: true},
+                    //     {field: 'volnum', title: __('volnum'), sortable: true},
+                    //     {field: 'goodsname', title: __('Goodsname'), sortable: true},
+                    //     {field: 'productmodel', title: __('Productmodel')},
+                    //     {field: 'barcode', title: __('Barcode')},
+                    //     {field: 'measureunit', title: __('Measureunit')},
+                    //     {field: 'univalence', title: '单桶重量(kg)', operate: 'BETWEEN'},
+                    //     {field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
+                    //     {field: 'updatetime', title: __('Updatetime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime},
+                    //     {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                        {checkbox: true},
+                        {field: '订单编号', title: __('订单编号'), },
+                        {field: '客户编号', title: __('客户编号'), },
+                        {field: '生产款号', title: __('生产款号'), },
+                        {field: '款式', title: __('款式'), },
+                        {field: '订单数量', title: __('订单数量'), },
+                        {field: '面料', title: __('面料'), },
+                        {field: 'Sys_rq', title: __('下单日期'), },
+                    ]
+
+                ],
+                search:false,//搜索
+                commonSearch: false,//放大镜搜索
+                showToggle: false,//切换
+                showColumns: false,//列
+                showExport: false,//导出数据
+                queryParams: function (params) {
+					params.categoryids=categoryids
+                    return params;
+                },
+                onPostBody: function () {
+                    $(".btn-detailone").data("area", ['90%', '90%']);
+                }
+
+            });
+            $(function () {
+                var autoWidth = $(window).width() - 220;
+                $('.table-content').css({'width': autoWidth, "position": "absolute", "left": "210px"});
+                $("#treeview").jstree({
+                    "themes": {"stripes": true},
+                    "checkbox": {
+                        "keep_selected_style": true,
+                        "whole_node":false,
+                        three_state:false,
+                    },
+                    "plugins": ["checkbox"],
+                    "core": {
+                        'check_callback': true,
+                        "data": {
+                            url: "stock/goodscategory/getjsTree",
+                        }
+                    }
+                }).on("select_node.jstree deselect_node.jstree", function (e, data) {
+                    var treenode=$("#treeview").jstree(true);
+					categoryids=treenode.get_checked().join(",");
+                    $("#table").bootstrapTable("refresh", {query: {categoryids: treenode.get_checked().join(",")}});
+                });
+            });
+            // 出入明细事件
+            $('.btn-detail').click(function (event) {
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                if (selectedrow.length == 1) {
+                    var url = 'stock/goods/detail';
+                    var url = Table.api.replaceurl(url, {ids: selectedrow[0]['id']}, table);
+                    Fast.api.open(url, __('Inoutdetail'), $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? 'Only one record can be selected!' : 'Please select a record!')
+                }
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        detail: function () {
+            Table.api.init({
+                extend: {
+                    detail_url: 'stock/goods/detail',
+                },
+                showFooter: true
+            });
+            var table = $("#table");
+            // 初始化表格
+            var ids = $('#c-ids').val();
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.detail_url,
+                queryParams: function (params) {
+                    params.ids = ids;
+                    return params;
+                },
+                pk: 'id',
+                sortName: 'a.riqi',
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {
+                            field: 'leixing', title: __('InoutType'), sortable: true,
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'volnum', title: __('Volnum'), sortable: true,
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'goodsname', title: __('Goodsname'), sortable: true,
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'productmodel', title: __('Productmodel'),
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'measureunit', title: __('Measureunit'),
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'univalence', title: '单桶重量(kg)', operate: 'BETWEEN',
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                        {
+                            field: 'stockinnums', title: __('stockInNum'),
+                            footerFormatter: function (data) {
+                                if (data.length > 0) {
+                                    return data[0].sum.totalstockinnums;
+                                }
+
+                            }
+                        },
+                        {
+                            field: 'stockinamount', title: '入库总重(kg)',
+                            footerFormatter: function (data) {
+                                if (data.length > 0) {
+                                    return data[0].sum.totalstockinamount;
+                                }
+
+                            }
+                        },
+                        {
+                            field: 'stockoutnums', title: __('stockOutNum'),
+                            footerFormatter: function (data) {
+                                if (data.length > 0) {
+                                    return data[0].sum.totalstockoutnums;
+                                }
+
+                            }
+                        },
+                        {
+                            field: 'stockoutamount', title: '出库总重(kg)',
+                            footerFormatter: function (data) {
+                                if (data.length > 0) {
+                                    return data[0].sum.totalstockoutamount;
+                                }
+
+                            }
+                        },
+                        {
+                            field: 'riqi', title: __('InoutTime'), operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime, datetimeFormat: "YYYY-MM-DD",
+                            footerFormatter: function () {
+                                return '';
+                            }
+                        },
+                    ]
+                ]
+            });
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+                function getPinyin() {
+                    var value = document.getElementById('c-goodsname').value;
+                    var result = '';
+                    result = pinyinUtil.getFirstLetter(value, false);
+                    document.getElementById('c-spell').value = result;
+                }
+                document.getElementById('c-goodsname').addEventListener('input', getPinyin);
+                //ajax请求根据商品类别产生商品商品代码
+                function madevolnum() {
+                    if ($('#c-goodscategoryid').val() != "") {
+                        Fast.api.ajax({
+                            url: 'stock/goods/madevolnum',
+                            type: 'POST', //GET
+                            async: true, //或false,是否异步
+                            timeout: 5000, //超时时间
+                            dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                            data: {goodscategoryid: $('#c-goodscategoryid').val()}
+                        },
+                                function (data) {
+                                    $('#c-volnum').val(data.volnum);
+                                    $('#c-goodscategoryid').val(data.goodscategory);
+                                }
+                        );
+                    }
+                }
+                $('#c-goodscategoryid').change(madevolnum);
+            }
+        }
+    };
+    return Controller;
+});

+ 121 - 0
public/assets/js/backend/stock/goodscategory.js

@@ -0,0 +1,121 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/goodscategory/index',
+                    add_url: 'stock/goodscategory/add',
+                    edit_url: 'stock/goodscategory/edit',
+                    del_url: 'stock/goodscategory/del',
+                    multi_url: 'stock/goodscategory/multi',
+                    table: 'stock_goodscategory',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                height: $(window).height() - 97,
+                pk: 'id',
+                sortName: 'id',
+                escape: false,
+                columns: [
+                    [
+                        {checkbox: true},
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                        },
+                        {field: 'name', title: __('商品分类名称'), align: 'left'},
+                        {
+                            field: 'id',
+                            title: '<a href="javascript:;" class="btn btn-success btn-xs btn-toggle"><i class="fa fa-chevron-up"></i></a>',
+                            operate: false,
+                            formatter: Controller.api.formatter.subnode
+                        },
+                        {field: 'value', title: '分类代码'},
+                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}
+                    ]
+                ],
+                pagination: false,
+                search: false,
+                commonSearch: false,
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            //当内容渲染完成后
+            table.on('post-body.bs.table', function (e, settings, json, xhr) {
+                //默认隐藏所有子节点
+                //$("a.btn[data-id][data-pid][data-pid!=0]").closest("tr").hide();
+                // $(".btn-node-sub.disabled").closest("tr").hide();
+
+                //显示隐藏子节点
+                $(".btn-node-sub").off("click").on("click", function (e) {
+                    var status = $(this).data("shown") ? true : false;
+                    $("a.btn[data-pid='" + $(this).data("id") + "']").each(function () {
+                        $(this).closest("tr").toggle(!status);
+                    });
+                    $(this).data("shown", !status);
+                    return false;
+                });
+            });
+            //展开隐藏一级
+            $(document.body).on("click", ".btn-toggle", function (e) {
+                $("a.btn[data-id][data-pid][data-pid!=0].disabled").closest("tr").hide();
+                var that = this;
+                var show = $("i", that).hasClass("fa-chevron-down");
+                $("i", that).toggleClass("fa-chevron-down", !show);
+                $("i", that).toggleClass("fa-chevron-up", show);
+                $("a.btn[data-id][data-pid][data-pid!=0]").not('.disabled').closest("tr").toggle(show);
+                $(".btn-node-sub[data-pid=0]").data("shown", show);
+            });
+            //展开隐藏全部
+            $(document.body).on("click", ".btn-toggle-all", function (e) {
+                var that = this;
+                var show = $("i", that).hasClass("fa-plus");
+                $("i", that).toggleClass("fa-plus", !show);
+                $("i", that).toggleClass("fa-minus", show);
+                $(".btn-node-sub.disabled").closest("tr").toggle(show);
+                $(".btn-node-sub").data("shown", show);
+            });
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            formatter: {
+                subnode: function (value, row, index) {
+                    return '<a href="javascript:;" data-toggle="tooltip" title="' + __('Toggle sub menu') + '" data-id="' + row.id + '" data-pid="' + row.pid + '" class="btn btn-xs '
+                            + (row.haschild == 1 || row.ismenu == 1 ? 'btn-success' : 'btn-default disabled') + ' btn-node-sub"><i class="fa fa-sitemap"></i></a>';
+                }
+            },
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+                //ajax请求根据商品类别产生商品代码
+                function getvolnum() {
+                    Fast.api.ajax({
+                        url: 'stock/goodscategory/madevalue',
+                        type: 'POST', //GET
+                        async: true, //或false,是否异步
+                        timeout: 5000, //超时时间
+                        dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text        
+                        data: {id: $('#c-goodscategory option:selected').val()}},
+                            function (data) {
+                                $('#c-value').val(data.code);
+                            }
+                    );
+                }
+                $('#c-goodscategory').change(getvolnum);
+            }
+        }
+    };
+    return Controller;
+});

File diff suppressed because it is too large
+ 0 - 0
public/assets/js/backend/stock/libs/element-ui.css


File diff suppressed because it is too large
+ 0 - 0
public/assets/js/backend/stock/libs/element-ui.js


BIN
public/assets/js/backend/stock/libs/fonts/element-icons.ttf


BIN
public/assets/js/backend/stock/libs/fonts/element-icons.woff


File diff suppressed because it is too large
+ 5 - 0
public/assets/js/backend/stock/libs/vue.js


+ 242 - 0
public/assets/js/backend/stock/stockcur.js

@@ -0,0 +1,242 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'jstree', 'echarts', 'echarts-theme'], function ($, undefined, Backend, Table, Form, jstree, Echarts, undefined) {
+
+    var Controller = {
+        index: function () {
+            $(".btn-detail").data("area", ['90%', '90%']);
+
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/stockcur/index',
+                    add_url: 'stock/stockcur/add',
+                    edit_url: 'stock/stockcur/edit',
+                    del_url: 'stock/stockcur/del',
+                    multi_url: 'stock/stockcur/multi',
+                    table: 'stock_stockcur',
+                }
+            });
+            var table = $("#table");
+            $(function () {
+                var autoWidth = $(window).width() - 220;
+                $('.table-content').css({ 'width': autoWidth, "position": "absolute", "left": "210px" });
+                $("#treeview").jstree({
+                    "themes": { "stripes": true },
+                    "checkbox": {
+                        "keep_selected_style": false,
+                    },
+                    "plugins": ["checkbox"],
+                    "core": {
+                        'check_callback': true,
+                        "data": {
+                            url: "stock/goodscategory/getjsTree",
+                        }
+                    }
+                }).on("select_node.jstree deselect_node.jstree", function (e, data) {
+                    $("#table").bootstrapTable("refresh", { query: { categoryids: data.selected.join(",") } });
+                });
+                $.fn.bootstrapTable.locales[Table.defaults.locale]['formatSearch'] = function () {
+                    return '搜索[商品代码、商品名]';
+                };
+            });
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                        { checkbox: true },
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                            width: 50,
+                            searchable: false
+                        },
+                        { field: 'stockgoods.volnum', title: __('商品代码'), sortable: true, operate: "LIKE" },
+                        { field: 'stockgoods.goodsname', title: __('stock_goods.goodsname'), sortable: true, operate: "LIKE" },
+                        { field: 'stockgoods.productmodel', title: '型号', searchable: false },
+                        { field: 'stockgoods.measureunit', title: '单位', searchable: false },
+                        { field: 'stockgoods.univalence', title: '单桶重量', searchable: false },
+                        { field: 'totalcurnums', title: __('库存数量'), searchable: false },
+                    ]
+                ]
+            });
+
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            // 出入明细事件
+            $('.btn-detail').click(function (event) {
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                if (selectedrow.length == 1) {
+                    var url = 'stock/goods/detail';
+                    var url = Table.api.replaceurl(url, { ids: selectedrow[0]['stock_goods_id'] }, table);
+                    Fast.api.open(url, __('出入明细'), $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? '只能选择一条记录' : '请选择一条记录')
+                }
+            });
+        },
+        mainpage: function () {
+            var goodscategory_list = [];
+            var linechartdata = [];
+            //商品分类
+            $.ajax({
+                url: 'stock/goodscategory/category',
+                type: 'GET', //GET
+                async: false, //或false,是否异步
+                timeout: 5000, //超时时间
+                dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                success: function (data) {
+                    goodscategory_list = [];
+                    if (data) {
+                        for (var i = 0; i < data.length; i++) {
+                            var value = data[i]['id'];
+                            goodscategory_list[value] = data[i]['name'];
+                        }
+                    }
+                }
+            });
+
+            //库存饼状图
+            $.ajax({
+                url: 'stock/stockcur/countData',
+                type: 'POST', //GET
+                async: true, //或false,是否异步
+                timeout: 5000, //超时时间
+                dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                success: function (data) {
+                    var datalist = data.rows;
+                    var legendData = [];
+                    for (var i = 0; i < datalist.length; i++) {
+                        legendData.push(goodscategory_list[datalist[i]['stock_goods']['goodscategoryid']]);
+                    }
+                    var totalItemAmount = [];
+                    var totalAmount = 0;
+                    for (var i = 0; i < datalist.length; i++) {
+                        totalItemAmount[i] = { 'value': datalist[i].totalitemamount, 'name': goodscategory_list[datalist[i]['stock_goods']['goodscategoryid']] };
+                        totalAmount += parseFloat(datalist[i].totalitemamount);
+                    }
+                    var totalNum = [];
+                    var totalNumAdd = 0;
+                    for (var i = 0; i < datalist.length; i++) {
+                        totalNum[i] = { 'value': datalist[i].totalnum, 'name': goodscategory_list[datalist[i]['stock_goods']['goodscategoryid']] };
+                        totalNumAdd += parseFloat(datalist[i].totalnum);
+                    }
+                    madePie(legendData, totalItemAmount, 'stockcur_amount', '库存重量', '库存总重量' + totalAmount.toFixed(2) + '千克');
+                    madePie(legendData, totalNum, 'stockcur_num', '库存总件数', '库存共' + totalNumAdd + '件');
+                }
+            });
+            function madePie(legendData, seriesData, elementId, titleText, titleSubText) {
+                var myChart = Echarts.init(document.getElementById(elementId), 'walden');
+                var option = {
+                    title: {
+                        text: titleText,
+                        subtext: titleSubText,
+                        x: 'center'
+                    },
+                    tooltip: {
+                        trigger: 'item',
+                        formatter: "{b} : {c} ({d}%)"
+                    },
+                    legend: {
+                        orient: 'vertical',
+                        x: 'left',
+                        data: legendData,
+                    },
+                    toolbox: {
+                        show: true,
+                        feature: {
+                            mark: { show: true },
+                            dataView: { show: true, readOnly: false },
+                            magicType: {
+                                show: true,
+                                type: ['pie', 'funnel'],
+                                option: {
+                                    funnel: {
+                                        x: '25%',
+                                        width: '50%',
+                                        funnelAlign: 'left',
+                                        max: 1548
+                                    }
+                                }
+                            },
+                            restore: { show: true },
+                            saveAsImage: { show: true }
+                        }
+                    },
+                    calculable: true,
+                    series: [{
+
+                        type: 'pie',
+                        radius: '55%',
+                        center: ['50%', '60%'],
+                        data: seriesData,
+                    }]
+                };
+
+                myChart.setOption(option);
+            };
+
+            //折线图
+            $.ajax({
+                url: 'stock/stockin/countData',
+                type: 'POST', //GET
+                async: true, //或false,是否异步
+                timeout: 5000, //超时时间
+                dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                success: function (data) {
+                    linechartdata=data;
+                    var myChart = Echarts.init(document.getElementById('linechart'), 'walden');
+                    var option = {
+                        title: {
+                            text: '出入库重量折线图',
+                            subtext: ''
+                        },
+                        legend: {
+                            data: ["入库重量", "出库重量"]
+                        },
+                        xAxis: {
+                            type: 'category',
+                            boundaryGap: false,
+                            data: linechartdata.month,
+                            axisLabel:{
+                                interval:0,
+                                rotate:45
+                            }
+                        },
+                        yAxis: {
+                            type: 'value'
+                        },
+                        series: [{
+                            name: "入库重量",
+                            type: 'line',
+                            smooth: true,
+                            data: linechartdata.indata
+                        },
+                        {
+                            name: "出库重量",
+                            type: 'line',
+                            smooth: true,
+                            data: linechartdata.outdata
+                        }]
+                    };
+                    myChart.setOption(option);
+                }
+            });
+        },
+        add: function () {
+            Controller.api.bindevent();
+        },
+        edit: function () {
+            Controller.api.bindevent();
+        },
+        api: {
+            bindevent: function () {
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+});

+ 897 - 0
public/assets/js/backend/stock/stockin.js

@@ -0,0 +1,897 @@
+requirejs.config({
+    paths: {
+        vue: 'backend/stock/libs/vue',
+        ELEMENT: 'backend/stock/libs/element-ui',
+    },
+    shim: {
+        ELEMENT: ['vue']
+    }
+})
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'vue', 'ELEMENT', 'moment'], function ($, undefined, Backend, Table, Form, Vue, ELEMENT, Moment) {
+    var Controller = {
+        index: function () {
+            $(".btn-add, .btn-edit,.btn-audit,.btn-settle,.btn-split").data("area", ['100%', '100%']);
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/stockin/index',
+                    add_url: 'stock/stockin/add',
+                    edit_url: 'stock/stockin/edit',
+                    del_url: 'stock/stockin/del',
+                    multi_url: 'stock/stockin/multi',
+                    look_url: 'stock/stockin/look',
+                    table: 'stock_stockin',
+                }
+            });
+            var table = $("#table");
+            var selfOperate = {
+                'click .btn-editone': function (e, value, row, index) {
+                    e.stopPropagation();
+                    e.preventDefault();
+                    if (!row.audittime) {
+                        var table = $(this).closest('table');
+                        var options = table.bootstrapTable('getOptions');
+                        var ids = row[options.pk];
+                        row = $.extend({}, row ? row : {}, { ids: ids });
+                        var url = options.extend.edit_url;
+                        Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
+                    } else {
+                        Toastr.error('该入库记录已审核,不能修改!')
+                    }
+                },
+                'click .btn-delone': function (e, value, row, index) {
+                    e.stopPropagation();
+                    e.preventDefault();
+                    var that = this;
+                    var top = $(that).offset().top - $(window).scrollTop();
+                    var left = $(that).offset().left - $(window).scrollLeft() - 260;
+                    if (top + 154 > $(window).height()) {
+                        top = top - 154;
+                    }
+                    if ($(window).width() < 480) {
+                        top = left = undefined;
+                    }
+                    if (!row.audittime) {
+                        Layer.confirm(
+                            __('Are you sure you want to delete this item?'), { icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true },
+                            function (index) {
+                                var table = $(that).closest('table');
+                                var options = table.bootstrapTable('getOptions');
+                                Table.api.multi("del", row[options.pk], table, that);
+                                Layer.close(index);
+                            }
+                        );
+                    } else {
+                        Toastr.error('该入库记录已审核,不能删除!')
+                    }
+                }
+            }
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                sortName: 'createtime',
+                singleSelect: true, //是否启用单选
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                        { checkbox: true },
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                            operate: false,
+                            width: 50,
+                        },
+                        { field: 'docnum', title: '单据编号', sortable: true },
+                        { field: 'supplier.name', title: '供应商', operate: 'LIKE' },
+                        { field: 'inboundtime', title: '入库时间', operate: 'RANGE', addclass: 'datetimerange', formatter: Table.api.formatter.datetime },
+                        { field: 'totalamount', title: '总重量(kg)', operate: 'BETWEEN' },
+                        { field: 'remark', title: __('Remark'), searchable: false },
+                        { field: 'charged', visible: false },
+                        { field: 'audittime', title: '审核状态', formatter: Controller.api.formatter.audit },
+                        // { field: 'settletime', title: '结算状态', formatter: Controller.api.formatter.settle },
+                        { field: 'operate', title: 'Operate', table: table, events: selfOperate, formatter: Table.api.formatter.operate }
+                    ]
+                ],
+                onPostBody: function () {
+                    $(".btn-editone").data("area", ['100%', '100%']);
+                }
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            // 批量编辑按钮事件
+            $('.btn-edit').click(function (event) {
+                event.stopPropagation();
+                var selectedrow = table.bootstrapTable('getSelections');
+                if (selectedrow.length == 1 && !selectedrow[0]['audittime']) {
+                    var that = this;
+                    var url = 'stock/stockin/edit';
+                    selectedrow[0] = $.extend({}, selectedrow[0] ? selectedrow[0] : {}, { ids: selectedrow[0]['id'] });
+                    var url = Table.api.replaceurl(url, selectedrow[0], table);
+                    Fast.api.open(url, __('Edit'), $(that).data() || {});
+                } else {
+                    if (selectedrow[0]['audittime']) {
+                        Toastr.error('该入库记录已审核,不能修改!')
+                    } else {
+                        Toastr.error(selectedrow.length > 1 ? '只能选择一条入库记录' : '请选择入库记录')
+                    }
+                }
+            });
+            // 批量删除按钮事件
+            $('.btn-del').click(function (event) {
+                event.stopPropagation();
+                var selectedrow = table.bootstrapTable('getSelections');
+                if (selectedrow.length == 1 && !selectedrow[0]['audittime']) {
+                    var that = this;
+                    Layer.confirm(
+                        __('Are you sure you want to delete the %s selected item?', selectedrow.length), { icon: 3, title: __('Warning'), offset: 0, shadeClose: true },
+                        function (index) {
+                            Table.api.multi("del", selectedrow[0]['id'], table, that);
+                            Layer.close(index);
+                        }
+                    );
+                } else {
+                    if (selectedrow[0]['audittime']) {
+                        Toastr.error('该入库记录已审核,不能删除!')
+                    } else {
+                        Toastr.error(selectedrow.length > 1 ? '只能选择一条入库记录' : '请选择入库记录')
+                    }
+                }
+            });
+            // 打印按钮事件
+            $('.toolbar').on('click', '.btn-print', function () {
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                if (selectedrow.length == 1) {
+                    Fast.api.open('stock/stockin/printer?id=' + selectedrow[0]['id'], __('打印'), $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? '只能选择一条入库记录' : '请选择入库记录')
+                }
+            });
+            // 审核/反审核按钮事件 结算/反结算按钮事件
+            $('.toolbar').on('click', '.btn-audit,.btn-settle', function () {
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                var title = "审核";
+                if (selectedrow.length == 1) {
+                    var operatetype = $(this).data("operatetype");
+                    if (operatetype == "audit") {
+                        console.log(selectedrow[0].settletime);
+                        if (selectedrow[0].settletime !== null) {
+                            Toastr.error("该入库单已结算,请先进行反结算!");
+                            return;
+                        } else {
+                            title = selectedrow[0].audittime == null ? "审核" : "反审核";
+                        }
+                    } else if (operatetype == "settle") {
+                        if (selectedrow[0].audittime == null) {
+                            Toastr.error("该入库单未审核,请先进行审核!");
+                            return;
+                        } else {
+                            title = selectedrow[0].settletime == null ? "结算" : "反结算";
+                        }
+                    }
+                    var url = 'stock/stockin/look?operatetype=' + operatetype;
+                    selectedrow[0] = $.extend({}, selectedrow[0] ? selectedrow[0] : {}, { ids: selectedrow[0]['id'] });
+                    var url = Table.api.replaceurl(url, selectedrow[0], table);
+                    Fast.api.open(url, title, $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? '只能选择一条记录' : '请选择一条记录')
+                }
+            });
+        },
+        getlist: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    list_url: 'stock/stockin/getlist',
+                }
+            });
+            var table = $("#table");
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.list_url,
+                pk: 'id',
+                sortName: 'stockinlist.id',
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                        { checkbox: true },
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                            searchable: false,
+                        },
+                        { field: 'stockin.docnum', operate: "LIKE", title: '单据编号', sortable: true },
+                        { field: 'stockin.supplier.name', operate: "LIKE", title: '供应商' },
+                        { field: 'stockin.inboundtime', title: '入库日期', operate: 'RANGE', formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD', addclass: 'datetimerange' },
+                        { field: 'goods.volnum', title: '商品代码' },
+                        { field: 'goods.goodsname', operate: "LIKE", title: '商品名称' },
+                        { field: 'goods.productmodel', title: '商品型号', searchable: false },
+                        { field: 'goods.measureunit', title: '单位', searchable: false },
+                        { field: 'inboundprice', title: '单桶重量(kg)', searchable: false },
+                        { field: 'stockinnums', title: '入库数', searchable: false },
+                        { field: 'amount', title: '总重量(kg)' },
+                    ]
+                ]
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        look: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        row: { stock_supplier_id: "", remark: "", inboundtime: "", totalamount: 0.00 },
+                        supplierlist: [],
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 355) + "px" },
+                            list: [],
+                        },
+                        commiturl: "",
+                    }
+                },
+                computed: {
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) },
+                },
+                created() {
+                    this.loadstockininfo()
+                },
+                methods: {
+                    loadstockininfo() {
+                        let operatetype = Fast.api.query("operatetype")
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/stockin/info',
+                            type: "POST",
+                            data: { id: Fast.api.query("ids") },
+                            async: false,
+                            success: function (res) {
+                                res.row.inboundtime = Moment(parseInt(res.row.inboundtime) * 1000).format("YYYY-MM-DD");
+                                if (operatetype == "audit") {
+                                    if (res.row.audittime) {
+                                        that.commiturl = 'stock/stockin/unaudit';
+                                        $('#audit').html('反审核');
+                                    } else {
+                                        that.commiturl = 'stock/stockin/audit';
+                                        $('#audit').html('审核');
+                                    }
+                                } else if (operatetype == "settle") {
+                                    if (res.row.settletime) {
+                                        that.commiturl = 'stock/stockin/unsettle';
+                                        $('#audit').html('反结算');
+                                    } else {
+                                        that.commiturl = 'stock/stockin/settle';
+                                        $('#audit').html('结算');
+                                    }
+                                }
+                                that.row = res.row;
+                                that.selectedgoodsdata.list = res.goodslist;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                }
+            })
+            // 提交事件
+            $(document).on('click', '#audit', function (e) {
+                e.preventDefault();
+                var url = $("#c-commiturl").val();
+                Layer.confirm(
+                    __('确认提交?'), { icon: 3, title: __('Warning'), offset: 200, shadeClose: true },
+                    function (index) {
+                        $('#form').attr('action', url);
+                        $('#form').submit();
+                        Layer.close(index);
+                    }
+                );
+            });
+            Form.api.bindevent($("form[role=form]"));
+        },
+        add: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        searchvalue: "",
+                        row: { stock_supplier_id: "", remark: "", inboundtime: new Date(), totalamount: 0.00 },
+                        curgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", inboundprice: "", stockinnums: 0, stockingoodsremark: "", amount: "", barcode: "" },
+                        defaultgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", inboundprice: "", stockinnums: 0, stockingoodsremark: "", amount: "" },
+                        supplierlist: [],
+                        goodsdata: {
+                            table: { height: ($(window).height() - 490) + "px" },
+                            list: [],
+                            pagenation: {
+                                currentpage: 1,
+                                pagesize: 10,
+                                total: 0
+                            }
+                        },
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 355) + "px" },
+                            list: [],
+                        },
+                        deselectedgoodslist: [],
+                        rules: {
+                            inboundprice: [
+                                { required: true, type: 'string', trigger: 'blur', message: '金额不能为空' },
+                                { pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/, message: '请输入正确额格式,可保留两位小数' }
+                            ],
+                            stockinnums: [
+                                { required: true, message: '入库数量不能为空' },
+                                { type: 'number', message: '入库数量必须为数字值' }
+                            ],
+                        }
+                    }
+                },
+                computed: {
+                    main: function () { return JSON.stringify(this.row) },
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) }
+                },
+                created() {
+                    this.loadgoodslist()
+                    this.loadsupplierlist()
+                },
+                methods: {
+                    loadsupplierlist() {
+                        console.log(22);
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/supplier/index',
+                            // url: 'stock/supplier/erp_supplier',
+                            data: {},
+                            success: function (res) {
+                                console.log(res);
+                                console.log(123);
+                                that.supplierlist = res.rows;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadgoodslist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/goods/getlist',
+                            data: { sort: 'goods.id', order: 'desc', offset: this.goodsdata.pagenation.pagesize * (this.goodsdata.pagenation.currentpage - 1), limit: this.goodsdata.pagenation.pagesize, searchvalue: this.searchvalue },
+                            success: function (res) {
+                                that.goodsdata.list = res.rows;
+                                that.goodsdata.pagenation.total = res.total;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    handleSizeChange(val) {
+                        this.goodsdata.pagenation.pagesize = val;
+                        this.loadgoodslist();
+                    },
+                    handleCurrentChange(val) {
+                        this.goodsdata.pagenation.currentpage = val;
+                        this.loadgoodslist();
+                    },
+                    debounce(fn, delay) {
+                        let timeout = null;
+                        delay = delay || 500;
+                        return function (e) {
+                            let args = arguments;
+                            let that = this;
+                            clearTimeout(timeout);
+                            timeout = setTimeout(function () {
+                                fn.apply(that, args);
+                            }, delay);
+                        };
+                    },
+                    barcodeinputenter() {
+                        let that=this;
+                        if (this.curgood.barcode == "") {
+                            Fast.api.msg("请输入商品条码并按回车键!")
+                        } else {
+                            Fast.api.ajax({
+                                url: "stock/goods/getgoodsbybarcodeorid",
+                                data: { barcode: this.curgood.barcode }
+                            }, function (data) {
+                                if (data !== null) {
+                                    that.curgood.stock_goods_id = data.id;
+                                    that.curgood.volnum = data.volnum;
+                                    that.curgood.goodsname = data.goodsname;
+                                    that.curgood.productmodel = data.productmodel;
+                                    that.curgood.measureunit = data.measureunit;
+                                    that.curgood.inboundprice = data.univalence;
+                                    that.curgood.barcode = data.barcode;
+                                    that.curgood.stockinnums = 1;
+                                    that.curgood.stockingoodsremark = "";
+                                    that.curgood.amount = data.univalence;
+                                }
+                            })
+                        }
+                    },
+                    onSearchvalueChange() {
+                        this.debounce(this.loadgoodslist, 1000)();
+                    },
+                    selectonegood(currentrow) {
+                        this.curgood.stock_goods_id = currentrow.id;
+                        this.curgood.volnum = currentrow.volnum;
+                        this.curgood.goodsname = currentrow.goodsname;
+                        this.curgood.productmodel = currentrow.productmodel;
+                        this.curgood.measureunit = currentrow.measureunit;
+                        this.curgood.inboundprice = currentrow.univalence;
+                        this.curgood.barcode = currentrow.barcode;
+                        this.curgood.stockinnums = 1;
+                        this.curgood.stockingoodsremark = "";
+                        this.curgood.amount = currentrow.univalence;
+                    },
+                    addtolist() {
+                        let that = this;
+                        let hasadded = false;
+                        if (this.curgood.stock_goods_id != "") {
+                            this.selectedgoodsdata.list.forEach(item => {
+                                if (item.stock_goods_id == that.curgood.stock_goods_id) {
+                                    Fast.api.msg("该商品已添加,请勿重复添加!")
+                                    hasadded = true;
+                                }
+                            });
+                            if (!hasadded) {
+                                let good = JSON.parse(JSON.stringify(this.curgood));
+                                this.selectedgoodsdata.list.unshift(good);
+                                this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                                this.row.totalamount = this.accAdd(this.row.totalamount, good.amount);
+                            }
+                        } else {
+                            Fast.api.msg("请选择入库商品!")
+                        }
+                    },
+                    reset() {
+                        this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                    },
+                    getcurgoodamount() {
+                        this.curgood.amount = this.accMul(this.curgood.stockinnums, this.curgood.inboundprice);
+                    },
+                    accMul(arg1, arg2) {
+                        var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
+                        try {
+                            m += s1.split(".")[1].length
+                        } catch (e) {
+                        }
+                        try {
+                            m += s2.split(".")[1].length
+                        } catch (e) {
+                        }
+                        return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
+                    },
+                    accAdd(arg1, arg2) {
+                        var r1, r2, m;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length
+                        } catch (e) {
+                            r1 = 0
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length
+                        } catch (e) {
+                            r2 = 0
+                        }
+                        m = Math.pow(10, Math.max(r1, r2))
+                        return (arg1 * m + arg2 * m) / m
+                    },
+                    accSub(arg1, arg2) {
+                        var r1, r2, m, n;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length;
+                        } catch (e) {
+                            r1 = 0;
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length;
+                        } catch (e) {
+                            r2 = 0;
+                        }
+                        m = Math.pow(10, Math.max(r1, r2));
+                        //last modify by deeka
+                        //动态控制精度长度
+                        n = (r1 >= r2) ? r1 : r2;
+                        return ((arg1 * m - arg2 * m) / m).toFixed(n);
+                    },
+                    deleteselected(row) {
+                        this.selectedgoodsdata.list = this.selectedgoodsdata.list.filter(item => {
+                            return item != row;
+                        });
+                        this.row.totalamount = this.accSub(this.row.totalamount, row.amount);
+                    }
+
+                }
+            })
+            Form.api.bindevent($("form[role=form]"), "", "", function () {
+                let main = JSON.parse($("#c-main").val());
+                let goodslist = JSON.parse($("#c-goodslist").val());
+                if (main.stock_supplier_id == "") {
+                    Toastr.error("请选择供应商");
+                    return false;
+                } else if (goodslist.length < 1) {
+                    Toastr.error("请添加入库商品");
+                    return false;
+                }
+            });
+        },
+        edit: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        searchvalue: "",
+                        row: { stock_supplier_id: "", remark: "", inboundtime: "", totalamount: 0.00 },
+                        curgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", inboundprice: "", stockinnums: 0, stockingoodsremark: "", amount: "", barcode: "" },
+                        defaultgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", inboundprice: "", stockinnums: 0, stockingoodsremark: "", amount: "" },
+                        supplierlist: [],
+                        goodsdata: {
+                            table: { height: ($(window).height() - 490) + "px" },
+                            list: [],
+                            pagenation: {
+                                currentpage: 1,
+                                pagesize: 10,
+                                total: 0
+                            }
+                        },
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 355) + "px" },
+                            list: [],
+                        },
+                        deselectedgoodslist: [],
+                        rules: {
+                            inboundprice: [
+                                { required: true, type: 'string', trigger: 'blur', message: '金额不能为空' },
+                                { pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/, message: '请输入正确额格式,可保留两位小数' }
+                            ],
+                            stockinnums: [
+                                { required: true, message: '入库数量不能为空' },
+                                { type: 'number', message: '入库数量必须为数字值' }
+                            ],
+                        }
+                    }
+                },
+                computed: {
+                    main: function () { return JSON.stringify(this.row) },
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) },
+                    deletedgoodslist: function () { return JSON.stringify(this.deselectedgoodslist) }
+                },
+                created() {
+                    this.loadgoodslist()
+                    this.loadsupplierlist()
+                    this.loadstockininfo()
+                },
+                methods: {
+                    loadstockininfo() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/stockin/info',
+                            type: "POST",
+                            data: { id: Fast.api.query("ids") },
+                            success: function (res) {
+                                res.row.inboundtime = Moment(parseInt(res.row.inboundtime) * 1000).format("YYYY-MM-DD");
+                                console.log(res.row);
+                                that.row = res.row;
+                                that.selectedgoodsdata.list = res.goodslist;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadsupplierlist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/supplier/index',
+                            data: {},
+                            success: function (res) {
+                                that.supplierlist = res.rows;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadgoodslist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/goods/getlist',
+                            data: { sort: 'goods.id', order: 'desc', offset: this.goodsdata.pagenation.pagesize * (this.goodsdata.pagenation.currentpage - 1), limit: this.goodsdata.pagenation.pagesize, searchvalue: this.searchvalue },
+                            success: function (res) {
+                                that.goodsdata.list = res.rows;
+                                that.goodsdata.pagenation.total = res.total;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    handleSizeChange(val) {
+                        this.goodsdata.pagenation.pagesize = val;
+                        this.loadgoodslist();
+                    },
+                    handleCurrentChange(val) {
+                        this.goodsdata.pagenation.currentpage = val;
+                        this.loadgoodslist();
+                    },
+                    debounce(fn, delay) {
+                        let timeout = null;
+                        delay = delay || 500;
+                        return function (e) {
+                            let args = arguments;
+                            let that = this;
+                            clearTimeout(timeout);
+                            timeout = setTimeout(function () {
+                                fn.apply(that, args);
+                            }, delay);
+                        };
+                    },
+                    barcodeinputenter() {
+                        let that=this;
+                        if (this.curgood.barcode == "") {
+                            Fast.api.msg("请输入商品条码并按回车键!")
+                        } else {
+                            Fast.api.ajax({
+                                url: "stock/goods/getgoodsbybarcodeorid",
+                                data: { barcode: this.curgood.barcode }
+                            }, function (data) {
+                                if (data !== null) {
+                                    that.curgood.stock_goods_id = data.id;
+                                    that.curgood.volnum = data.volnum;
+                                    that.curgood.goodsname = data.goodsname;
+                                    that.curgood.productmodel = data.productmodel;
+                                    that.curgood.measureunit = data.measureunit;
+                                    that.curgood.inboundprice = data.univalence;
+                                    that.curgood.barcode = data.barcode;
+                                    that.curgood.stockinnums = 1;
+                                    that.curgood.stockingoodsremark = "";
+                                    that.curgood.amount = data.univalence;
+                                }
+                            })
+                        }
+                    },
+                    onSearchvalueChange() {
+                        this.debounce(this.loadgoodslist, 1000)();
+                    },
+                    selectonegood(currentrow) {
+                        this.curgood.stock_goods_id = currentrow.id;
+                        this.curgood.volnum = currentrow.volnum;
+                        this.curgood.goodsname = currentrow.goodsname;
+                        this.curgood.productmodel = currentrow.productmodel;
+                        this.curgood.measureunit = currentrow.measureunit;
+                        this.curgood.inboundprice = currentrow.univalence;
+                        this.curgood.barcode = currentrow.barcode;
+                        this.curgood.stockinnums = 1;
+                        this.curgood.stockingoodsremark = "";
+                        this.curgood.amount = currentrow.univalence;
+                    },
+                    addtolist() {
+                        let that = this;
+                        let hasadded = false;
+                        if (this.curgood.stock_goods_id != "") {
+                            this.selectedgoodsdata.list.forEach(item => {
+                                if (item.stock_goods_id == that.curgood.stock_goods_id) {
+                                    Fast.api.msg("该商品已添加,请勿重复添加!")
+                                    hasadded = true;
+                                }
+                            });
+                            if (!hasadded) {
+                                let good = JSON.parse(JSON.stringify(this.curgood));
+                                this.selectedgoodsdata.list.unshift(good);
+                                this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                                this.row.totalamount = this.accAdd(this.row.totalamount, good.amount);
+                            }
+                        } else {
+                            Fast.api.msg("请选择入库商品!")
+                        }
+                    },
+                    reset() {
+                        this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                    },
+                    getcurgoodamount() {
+                        this.curgood.amount = this.accMul(this.curgood.stockinnums, this.curgood.inboundprice);
+                    },
+                    accMul(arg1, arg2) {
+                        var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
+                        try {
+                            m += s1.split(".")[1].length
+                        } catch (e) {
+                        }
+                        try {
+                            m += s2.split(".")[1].length
+                        } catch (e) {
+                        }
+                        return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
+                    },
+                    accAdd(arg1, arg2) {
+                        var r1, r2, m;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length
+                        } catch (e) {
+                            r1 = 0
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length
+                        } catch (e) {
+                            r2 = 0
+                        }
+                        m = Math.pow(10, Math.max(r1, r2))
+                        return (arg1 * m + arg2 * m) / m
+                    },
+                    accSub(arg1, arg2) {
+                        var r1, r2, m, n;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length;
+                        } catch (e) {
+                            r1 = 0;
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length;
+                        } catch (e) {
+                            r2 = 0;
+                        }
+                        m = Math.pow(10, Math.max(r1, r2));
+                        //last modify by deeka
+                        //动态控制精度长度
+                        n = (r1 >= r2) ? r1 : r2;
+                        return ((arg1 * m - arg2 * m) / m).toFixed(n);
+                    },
+                    deleteselected(row) {
+                        if (row.id) {
+                            this.deselectedgoodslist.unshift(row.id);
+                        }
+                        this.selectedgoodsdata.list = this.selectedgoodsdata.list.filter(item => {
+                            return item != row;
+                        });
+                        this.row.totalamount = this.accSub(this.row.totalamount, row.amount);
+                    }
+
+                }
+            })
+            Form.api.bindevent($("form[role=form]"), "", "", function () {
+                let main = JSON.parse($("#c-main").val());
+                let goodslist = JSON.parse($("#c-goodslist").val());
+                if (main.stock_supplier_id == "") {
+                    Toastr.error("请选择供应商");
+                    return false;
+                } else if (goodslist.length < 1) {
+                    Toastr.error("请添加入库商品");
+                    return false;
+                }
+            });
+        },
+        printer: function () {
+            $.ajax({
+                type: "POST",
+                url: Fast.api.fixurl('stock/stockin/info'),
+                data: { "id": Fast.api.query("id") },
+                async: true, //或false,是否异步
+                timeout: 5000, //超时时间
+                dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                success: function (data) {
+                    madehtml(data);
+                }
+            });
+            function madehtml(data) {
+                var h = "<div id=\"top\" class=\"page\" ><div style=\"text-align: center;font-size:22px;line-height:38px\" >入库单</div>" +
+                    "<table style=\"width:100%;\">" +
+                    " <tr>" +
+                    " <td  width=\"40%\"></td>" +
+                    "<td  width=\"25%\"></td>" +
+                    "<td  width=\"12%\" tdata=\"pageNO\" format=\"##\" style=\"text-align:right;\">第##页</td>" +
+                    "<td  width=\"13%\" tdata=\"pageCount\" format=\"##\" style=\"text-align:right;\">&nbsp共##页</td>" +
+                    " </tr>" +
+                    "<tr>" +
+                    "<td >供应商:" + data.row.supplier.name + "</td>" +
+                    "<td>日期:" + Moment(Number( data.row.inboundtime) * 1000).format("YYYY-MM-DD") + "</td>" +
+                    "<td colspan=\"2\" style=\"text-align:right;\">编号:" +  data.row.docnum + "</td>" +
+                    "</tr>" +
+                    "</table>" +
+                    "</div>" +
+                    "<div id=\"maintable\"><table border=\"1\" style=\"width:100%;\">" +
+                    "<thead><tr  align=\"center\">" +
+                    "<th width=\"5%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">序号</th>" +
+                    "<th width=\"10%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">商品</br>代码</th>" +
+                    "<th width=\"20%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">商品</br>名称</th>" +
+                    "<th width=\"10%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">规格</br>型号</th>" +
+                    "<th width=\"8%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">单位</th>" +
+                    "<th width=\"6%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">数量</th>" +
+                    "<th width=\"10%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">重量(kg)</th>" +
+                    "<th width=\"12%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">总重量(kg)</th>" +
+                    "<th width=\"20%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">备注</th>" +
+                    "</tr></thead>    ";
+                for (var i = 0; i < data.goodslist.length; i++) {
+                    h += maderow(data.goodslist[i], i)
+                }
+                h += "<tfoot>  <tr><td tindex=\"8\" tdata=\"SubSum\" format=\"UpperMoney\" colspan=\"5\" ><div style=\"line-height:25px;text-align: left;\">本页小计:</td>" +
+                    "<td  align=\"center\" tdata=\"SubSum\" format=\"#,##\">###</td>" +
+                    "<td></td>" +
+                    "<td align=\"center\" tdata=\"SubSum\" format=\"#,##0.00\">###</td>" +
+                    "<td></td>" +
+                    "</tr>" +
+                    "<tr><td colspan=\"5\" tindex=\"8\" tdata=\"AllSum\" format=\"UpperMoney\" ><div style=\"line-height:25px;text-align: left;\">合&nbsp;&nbsp;计: </td>" +
+                    "<td align=\"center\" tdata=\"AllSum\" format=\"#,##\">###</td>" +
+                    "<td></td>" +
+                    "<td align=\"center\" tdata=\"AllSum\" format=\"#,##0.00\">###</td>" +
+                    "<td></td>" +
+                    "</tr>" +
+                    "  </tfoot></table>" +
+                    "</div>" +
+                    "<div id=\"foot\"><table style=\"width:100%;\">" +
+                    "<tr >" +
+                    "<td  width=\"30%\"><div style=\"line-height:30px;\">负责人:</td>" +
+                    "<td width=\"30%\"><div style=\"line-height:30px;\">经办人:</td>" +
+                    "<td width=\"40%\"><div style=\"line-height:30px;\">库管员:</td>" +
+                    "</tr>" +
+                    "<tr>" +
+                    "</tr>" +
+                    "</table></div>";
+                $('.printContent').append(h);
+            }
+            function maderow(row, currow) {
+                var h = " <tr align=\"center\">\n" +
+                    "                <td >" + (currow + 1) + "</td>\n" +
+                    "                <td >" + row.volnum + "</td>\n" +
+                    "                <td >" + row.goodsname + "</td>\n" +
+                    "                <td >" + row.productmodel + "</td>\n" +
+                    "                <td >" + row.measureunit + "</td>\n" +
+                    "                <td >" + row.stockinnums + "</td>\n" +
+                    "                <td >" + row.inboundprice + "</td>\n" +
+                    "                <td >" + row.amount + "</td>\n" +
+                    "                <td >" + row.stockingoodsremark + "</td>\n" +
+                    "            </tr>"
+                return h;
+            }
+            require(['lodop'], function (lodop) {
+                $(".btn-print").click(function () {
+                    var LODOP = getLodop();
+                    if (typeof (LODOP) != "undefined") {
+                        var strStyle = "<style>table{table-layout:fixed;word-break:break-all;} table,td,th {border-width: 1px;font-family:'思源黑体 CN Medium';border-style: solid;border-color:black;border-collapse: collapse}</style>"
+                        var strStyle2 = "<style>div{font-family:'思源黑体 CN Medium'} table{font-family:'思源黑体 CN Medium','times'}</style>";
+                        LODOP.ADD_PRINT_TABLE("30mm", "5%", "90%", "70mm", strStyle + document.getElementById("maintable").innerHTML);
+                        LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
+                        LODOP.ADD_PRINT_HTM("2mm", "5%", "90%", "25mm",strStyle2+ document.getElementById("top").innerHTML);
+                        LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+                        LODOP.ADD_PRINT_HTM("120mm", "5%", "90%", "25mm", strStyle2+document.getElementById("foot").innerHTML);
+                        LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 4);
+                        LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
+                        LODOP.SET_PRINT_STYLEA(0, "FontColor", "#FF0000");
+                        LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
+                        LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+                        LODOP.SET_PRINT_STYLEA(0, "Horient", 3);
+                        LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A5")
+                        LODOP.PREVIEW();
+                    }
+                });
+            });
+        },
+        api: {
+            formatter: {
+                audit: function (value, row, index) {
+                    var colorArr = { normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info' };
+                    // 如果字段列有定义custom
+                    var newValue = value == null ? '未审核' : '已审核';
+                    var color = value == null ? 'danger' : 'primary';
+                    var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(newValue) + '</span>';
+                    return html;
+                },
+                settle: function (value, row, index) {
+                    var colorArr = { normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info' };
+                    // 如果字段列有定义custom
+                    var newValue = value == null ? '未结算' : '已结算';
+                    var color = value == null ? 'danger' : 'primary';
+                    var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(newValue) + '</span>';
+                    return html;
+                },
+            },
+            bindevent: function () {
+            }
+        }
+    };
+    return Controller;
+});

+ 924 - 0
public/assets/js/backend/stock/stockout.js

@@ -0,0 +1,924 @@
+requirejs.config({
+    paths: {
+        vue: 'backend/stock/libs/vue',
+        ELEMENT: 'backend/stock/libs/element-ui',
+    },
+    shim: {
+        ELEMENT: ['vue']
+    }
+})
+define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'vue', 'ELEMENT', 'moment'], function ($, undefined, Backend, Table, Form, Vue, ELEMENT, Moment) {
+
+    var Controller = {
+        index: function () {
+            $('.btn-add,.btn-edit,.btn-audit,.btn-settle,.btn-split').data("area", ['100%', '100%']);
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/stockout/index',
+                    add_url: 'stock/stockout/add',
+                    edit_url: 'stock/stockout/edit',
+                    del_url: 'stock/stockout/del',
+                    multi_url: 'stock/stockout/multi',
+                    table: 'stock_stockout',
+                }
+            });
+            var table = $("#table");
+            $.fn.bootstrapTable.locales[Table.defaults.locale]['formatSearch'] = function () {
+                return '搜索[单据编号、客户名称]';
+            };
+            var selfOperate = {
+                'click .btn-editone': function (e, value, row, index) {
+                    e.stopPropagation();
+                    e.preventDefault();
+                    if (!row.audittime) {
+                        var table = $(this).closest('table');
+                        var options = table.bootstrapTable('getOptions');
+                        var ids = row[options.pk];
+                        row = $.extend({}, row ? row : {}, { ids: ids });
+                        var url = options.extend.edit_url;
+                        Fast.api.open(Table.api.replaceurl(url, row, table), __('Edit'), $(this).data() || {});
+                    } else {
+                        Toastr.error('该出库记录已通过审核,不能修改!')
+                    }
+                    ;
+                },
+                'click .btn-delone': function (e, value, row, index) {
+                    e.stopPropagation();
+                    e.preventDefault();
+                    var that = this;
+                    var top = $(that).offset().top - $(window).scrollTop();
+                    var left = $(that).offset().left - $(window).scrollLeft() - 260;
+                    if (top + 154 > $(window).height()) {
+                        top = top - 154;
+                    }
+                    if ($(window).width() < 480) {
+                        top = left = undefined;
+                    }
+                    if (!row.auditTime) {
+                        Layer.confirm(
+                            __('Are you sure you want to delete this item?'), { icon: 3, title: __('Warning'), offset: [top, left], shadeClose: true },
+                            function (index) {
+                                var table = $(that).closest('table');
+                                var options = table.bootstrapTable('getOptions');
+                                Table.api.multi("del", row[options.pk], table, that);
+                                Layer.close(index);
+                            }
+                        );
+                    } else {
+                        Toastr.error('该出库记录已通过审核,不能删除!')
+                    }
+                    ;
+                }
+            }
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                sortName: 'createtime',
+                singleSelect: true, //是否启用单选
+                columns: [
+                    [
+                        { checkbox: true },
+                        {field: 'Uniqid', title: __('出库编号'), },
+                        {field: '生产款号', title: __('生产款号'),operate: 'LIKE' },
+                        {field: '订单编号', title: __('订单编号'),operate: 'LIKE', sortable: true },
+                        {field: '客户编号', title: __('客户编号'), },
+                        {field: '款式', title: __('款式'), },
+                        {field: '订单数量', title: __('订单数量'), },
+                        {field: '面料', title: __('面料'), },
+                        {field: '出库日期', title: __('出库日期'), },
+                        {field: 'Sys_rq', title: __('下单日期'), },
+                        // { field: 'operate', title: __('Operate'), table: table, events: selfOperate, formatter: Table.api.formatter.operate }
+                    ]
+                ],
+                onPostBody: function () {
+                    $(".btn-editone ").data("area", ['100%', '100%']);
+                },
+                onCheck: function(row, $elment, filed) {
+                    $('.btn-print').removeClass('disabled');
+                    $('.btn-print').removeClass('btn-disabled');
+                },
+                onUncheck: function() {
+                    $('.btn-print').addClass('disabled');
+                    $('.btn-print').addClass('btn-disabled');
+                }
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+            // 打印按钮事件
+            $('.toolbar').on('click', '.btn-print', function () {
+                console.log('打印')
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                console.log(selectedrow)
+                if (selectedrow.length == 1) {
+                    Fast.api.open('stock/stockout/printer?id=' + selectedrow[0]['Uniqid'], __('打印'), $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? '只能选择一条入库记录' : '请选择入库记录')
+                }
+            });
+            // 批量编辑按钮事件
+            $('.btn-edit').click(function (event) {
+                event.stopPropagation();
+                var selectedrow = table.bootstrapTable('getSelections');
+                console.log(selectedrow);
+                if (selectedrow.length == 1 && !selectedrow[0]['audittime']) {
+                    var that = this;
+                    var url = 'stock/stockout/edit';
+                    selectedrow[0] = $.extend({}, selectedrow[0] ? selectedrow[0] : {}, { ids: selectedrow[0]['id'] });
+                    var url = Table.api.replaceurl(url, selectedrow[0], table);
+                    Fast.api.open(url, __('Edit'), $(that).data() || {});
+                } else {
+                    if (selectedrow[0]['audittime']) {
+                        Toastr.error('该记录已审核,不能修改!')
+                    } else {
+                        Toastr.error(selectedrow.length > 1 ? '只能选择一条记录' : '请选择一条记录')
+                    }
+                }
+            });
+            // 审核/反审核按钮事件 结算/反结算按钮事件
+            $('.toolbar').on('click', '.btn-audit,.btn-settle', function () {
+                var that = this;
+                var selectedrow = table.bootstrapTable('getSelections');
+                var title = "审核";
+                if (selectedrow.length == 1) {
+                    var operatetype = $(this).data("operatetype");
+                    if (operatetype == "audit") {
+                        console.log(selectedrow[0].settletime);
+                        if (selectedrow[0].settletime !== null) {
+                            Toastr.error("该出库单已结算,请先进行反结算!");
+                            return;
+                        } else {
+                            title = selectedrow[0].audittime == null ? "审核" : "反审核";
+                        }
+                    } else if (operatetype == "settle") {
+                        if (selectedrow[0].audittime == null) {
+                            Toastr.error("该出库单未审核,请先进行审核!");
+                            return;
+                        } else {
+                            title = selectedrow[0].settletime == null ? "结算" : "反结算";
+                        }
+                    }
+                    var url = 'stock/stockout/look?operatetype=' + operatetype;
+                    selectedrow[0] = $.extend({}, selectedrow[0] ? selectedrow[0] : {}, { ids: selectedrow[0]['id'] });
+                    var url = Table.api.replaceurl(url, selectedrow[0], table);
+                    Fast.api.open(url, title, $(that).data() || {});
+                } else {
+                    Toastr.error(selectedrow.length > 1 ? '只能选择一条记录' : '请选择一条记录')
+                }
+            });
+        },
+        getlist: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    list_url: 'stock/stockout/getlist',
+                }
+            });
+            var table = $("#table");
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.list_url,
+                pk: 'id',
+                sortName: 'stockoutlist.id',
+                height: $(window).height() - 97,
+                columns: [
+                    [
+                        { checkbox: true },
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                        },
+                        { field: 'stockout.docnum', operate: "LIKE", title: __('单据编号') },
+                        { field: 'stockout.customer.name', operate: "LIKE", title: __('客户名称'), sortable: true },
+                        { field: 'goods.volnum', title: '商品代码' },
+                        { field: 'goods.goodsname', title: '商品名称' },
+                        { field: 'goods.productmodel', title: '规格型号' },
+                        { field: 'goods.measureunit', title: '单位' },
+                        { field: 'stockoutnums', type: "Number", title: '出库数量' },
+                        { field: 'stockin.inboundprice', title: '单价', operate: 'BETWEEN' },
+                        { field: 'amount', title: '重量(kg)', operate: 'BETWEEN' },
+                        { field: 'stockout.outboundtime', title: '出库日期', operate: 'RANGE', formatter: Table.api.formatter.datetime, datetimeFormat: 'YYYY-MM-DD', addclass: 'datetimerange', sortable: true },
+                        { field: 'remark', title: __('Remark') },
+                    ]
+                ]
+            });
+            // 为表格绑定事件
+            Table.api.bindevent(table);
+        },
+        look: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        row: { stock_customer_id: "", remark: "", outboundtime: "", docnum:"" },
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 355) + "px" },
+                            list: [],
+                        },
+                        commiturl: "",
+                    }
+                },
+                computed: {
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) },
+                },
+                created() {
+                    this.loadstockoutinfo()
+                },
+                methods: {
+                    loadstockoutinfo() {
+                        let operatetype = Fast.api.query("operatetype")
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/stockout/info',
+                            type: "POST",
+                            data: { id: Fast.api.query("ids") },
+                            async: false,
+                            success: function (res) {
+                                res.row.outboundtime = Moment(parseInt(res.row.outboundtime) * 1000).format("YYYY-MM-DD");
+                                if (operatetype == "audit") {
+                                    if (res.row.audittime) {
+                                        that.commiturl = 'stock/stockout/unaudit';
+                                        $('#audit').html('反审核');
+                                    } else {
+                                        that.commiturl = 'stock/stockout/audit';
+                                        $('#audit').html('审核');
+                                    }
+                                } else if (operatetype == "settle") {
+                                    if (res.row.settletime) {
+                                        that.commiturl = 'stock/stockout/unsettle';
+                                        $('#audit').html('反结算');
+                                    } else {
+                                        that.commiturl = 'stock/stockout/settle';
+                                        $('#audit').html('结算');
+                                    }
+                                }
+                                that.row = res.row;
+                                that.selectedgoodsdata.list = res.goodslist;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    }
+                }
+            })
+            // 提交事件
+            $(document).on('click', '#audit', function (e) {
+                e.preventDefault();
+                var url = $("#c-commiturl").val();
+                Layer.confirm(
+                    __('确认提交?'), { icon: 3, title: __('Warning'), offset: 200, shadeClose: true },
+                    function (index) {
+                        $('#form').attr('action', url);
+                        $('#form').submit();
+                        Layer.close(index);
+                    }
+                );
+            });
+            Form.api.bindevent($("form[role=form]"));
+        },
+        add: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        searchvalue: "",
+                        row: { stock_customer_id: "", remark: "", outboundtime: new Date() },
+                        curgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", stocknum: "", stockoutnums: 0, stockoutgoodsremark: "", barcode: "" },
+                        defaultgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", stocknum: "", stockoutnums: 0, stockoutgoodsremark: "", barcode: "" },
+                        customerlist: [],
+                        goodsdata: {
+                            table: { height: ($(window).height() - 490) + "px" },
+                            list: [],
+                            pagenation: {
+                                currentpage: 1,
+                                pagesize: 10,
+                                total: 0
+                            }
+                        },
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 310) + "px" },
+                            list: [],
+                        },
+                        rules: {
+                            stockinnums: [
+                                { required: true, message: '出库数量不能为空' },
+                                { type: 'number', message: '出库数量必须为数字值' }
+                            ],
+                        }
+                    }
+                },
+                computed: {
+                    main: function () { return JSON.stringify(this.row) },
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) }
+                },
+                created() {
+                    this.loadgoodslist()
+                    this.loadcustomerlist()
+                },
+                methods: {
+                    loadcustomerlist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/customer/index',
+                            data: {},
+                            success: function (res) {
+                                that.customerlist = res.rows;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadgoodslist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/goods/getlist',
+                            data: { sort: 'goods.id', order: 'desc', offset: this.goodsdata.pagenation.pagesize * (this.goodsdata.pagenation.currentpage - 1), limit: this.goodsdata.pagenation.pagesize, searchvalue: this.searchvalue },
+                            success: function (res) {
+                                that.goodsdata.list = res.rows;
+                                that.goodsdata.pagenation.total = res.total;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    handleSizeChange(val) {
+                        this.goodsdata.pagenation.pagesize = val;
+                        this.loadgoodslist();
+                    },
+                    handleCurrentChange(val) {
+                        this.goodsdata.pagenation.currentpage = val;
+                        this.loadgoodslist();
+                    },
+                    debounce(fn, delay) {
+                        let timeout = null;
+                        delay = delay || 500;
+                        return function (e) {
+                            let args = arguments;
+                            let that = this;
+                            clearTimeout(timeout);
+                            timeout = setTimeout(function () {
+                                fn.apply(that, args);
+                            }, delay);
+                        };
+                    },
+                    barcodeinputenter() {
+                        let that = this;
+                        if (this.curgood.barcode == "") {
+                            Fast.api.msg("请输入商品条码并按回车键!")
+                        } else {
+                            Fast.api.ajax({
+                                url: "stock/goods/getgoodsbybarcodeorid",
+                                data: { barcode: this.curgood.barcode }
+                            }, function (data) {
+                                if (data !== null) {
+                                    that.curgood.stock_goods_id = data.id;
+                                    that.curgood.volnum = data.volnum;
+                                    that.curgood.goodsname = data.goodsname;
+                                    that.curgood.productmodel = data.productmodel;
+                                    that.curgood.measureunit = data.measureunit;
+                                    that.curgood.stockoutnums = data.curstocknum >= 1 ? 1 : 0;
+                                    that.curgood.stocknum = data.curstocknum;
+                                    that.curgood.stockoutgoodsremark = "";
+                                }
+                            })
+                        }
+                    },
+                    onSearchvalueChange() {
+                        this.debounce(this.loadgoodslist, 1000)();
+                    },
+                    selectonegood(currentrow) {
+                        let that = this;
+                        Fast.api.ajax({
+                            url: "stock/goods/getgoodsbybarcodeorid",
+                            data: { id: currentrow.id }
+                        }, function (data) {
+                            if (data !== null) {
+                                that.curgood.stock_goods_id = data.id;
+                                that.curgood.volnum = data.volnum;
+                                that.curgood.goodsname = data.goodsname;
+                                that.curgood.productmodel = data.productmodel;
+                                that.curgood.measureunit = data.measureunit;
+                                that.curgood.barcode = data.barcode;
+                                that.curgood.stockoutnums = data.curstocknum >= 1 ? 1 : 0;
+                                that.curgood.stocknum = data.curstocknum;
+                                that.curgood.stockoutgoodsremark = "";
+                            }
+                        })
+                    },
+                    addtolist() {
+                        let that = this;
+                        let hasadded = false;
+                        if (this.curgood.stock_goods_id != "") {
+                            if (this.curgood.stockoutnums == 0) {
+                                Fast.api.msg("出库数量不能为0!");
+                                return;
+                            }
+                            if (this.curgood.stockoutnums > this.curgood.stocknum) {
+                                Fast.api.msg("出库数量不能大于库存数量,请修改!");
+                                return;
+                            }
+                            this.selectedgoodsdata.list.forEach(item => {
+                                if (item.stock_goods_id == that.curgood.stock_goods_id) {
+                                    Fast.api.msg("该商品已添加,请勿重复添加!")
+                                    hasadded = true;
+                                }
+                            });
+                            if (!hasadded) {
+                                let good = JSON.parse(JSON.stringify(this.curgood));
+                                this.selectedgoodsdata.list.unshift(good);
+                                this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                            }
+                        } else {
+                            Fast.api.msg("请选择出库商品!")
+                        }
+                    },
+                    reset() {
+                        this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                    },
+                    getcurgoodamount() {
+                        this.curgood.amount = this.accMul(this.curgood.stockinnums, this.curgood.inboundprice);
+                    },
+                    accMul(arg1, arg2) {
+                        var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
+                        try {
+                            m += s1.split(".")[1].length
+                        } catch (e) {
+                        }
+                        try {
+                            m += s2.split(".")[1].length
+                        } catch (e) {
+                        }
+                        return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
+                    },
+                    accAdd(arg1, arg2) {
+                        var r1, r2, m;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length
+                        } catch (e) {
+                            r1 = 0
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length
+                        } catch (e) {
+                            r2 = 0
+                        }
+                        m = Math.pow(10, Math.max(r1, r2))
+                        return (arg1 * m + arg2 * m) / m
+                    },
+                    accSub(arg1, arg2) {
+                        var r1, r2, m, n;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length;
+                        } catch (e) {
+                            r1 = 0;
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length;
+                        } catch (e) {
+                            r2 = 0;
+                        }
+                        m = Math.pow(10, Math.max(r1, r2));
+                        //last modify by deeka
+                        //动态控制精度长度
+                        n = (r1 >= r2) ? r1 : r2;
+                        return ((arg1 * m - arg2 * m) / m).toFixed(n);
+                    },
+                    deleteselected(row) {
+                        this.selectedgoodsdata.list = this.selectedgoodsdata.list.filter(item => {
+                            return item != row;
+                        });
+                        this.row.totalamount = this.accSub(this.row.totalamount, row.amount);
+                    }
+
+                }
+            })
+            Form.api.bindevent($("form[role=form]"), "", "", function () {
+                let main = JSON.parse($("#c-main").val());
+                let goodslist = JSON.parse($("#c-goodslist").val());
+                if (main.stock_customer_id == "") {
+                    Toastr.error("请选择客户");
+                    return false;
+                } else if (goodslist.length < 1) {
+                    Toastr.error("请添加出库商品");
+                    return false;
+                }
+            });
+        },
+        edit: function () {
+            Vue.use(ELEMENT);
+            var vm = new Vue({
+                el: "#app",
+                data: function () {
+                    return {
+                        searchvalue: "",
+                        row: { stock_customer_id: "", remark: "", outboundtime: new Date() },
+                        curgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", stocknum: "", stockoutnums: 0, stockoutgoodsremark: "", barcode: "" },
+                        defaultgood: { stock_goods_id: "", volnum: "", goodsname: "", productmodel: "", measureunit: "件", stocknum: "", stockoutnums: 0, stockoutgoodsremark: "", barcode: "" },
+                        customerlist: [],
+                        goodsdata: {
+                            table: { height: ($(window).height() - 490) + "px" },
+                            list: [],
+                            pagenation: {
+                                currentpage: 1,
+                                pagesize: 10,
+                                total: 0
+                            }
+                        },
+                        selectedgoodsdata: {
+                            table: { height: ($(window).height() - 350) + "px" },
+                            list: [],
+                        },
+                        deselectedgoodslist: [],
+                        rules: {
+                            stockinnums: [
+                                { required: true, message: '出库数量不能为空' },
+                                { type: 'number', message: '出库数量必须为数字值' }
+                            ],
+                        }
+                    }
+                },
+                computed: {
+                    main: function () { return JSON.stringify(this.row) },
+                    goodslist: function () { return JSON.stringify(this.selectedgoodsdata.list) }
+                },
+                created() {
+                    this.loadstockoutinfo()
+                    this.loadgoodslist()
+                    this.loadcustomerlist()
+                },
+                methods: {
+                    loadstockoutinfo() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/stockout/info',
+                            type: "POST",
+                            data: { id: Fast.api.query("ids") },
+                            success: function (res) {
+                                res.row.outboundtime = Moment(parseInt(res.row.outboundtime) * 1000).format("YYYY-MM-DD");
+                                console.log(res.row);
+                                that.row = res.row;
+                                that.selectedgoodsdata.list = res.goodslist;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadcustomerlist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/customer/index',
+                            data: {},
+                            success: function (res) {
+                                that.customerlist = res.rows;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    loadgoodslist() {
+                        let that = this;
+                        $.ajax({
+                            url: 'stock/goods/getlist',
+                            data: { sort: 'goods.id', order: 'desc', offset: this.goodsdata.pagenation.pagesize * (this.goodsdata.pagenation.currentpage - 1), limit: this.goodsdata.pagenation.pagesize, searchvalue: this.searchvalue },
+                            success: function (res) {
+                                that.goodsdata.list = res.rows;
+                                that.goodsdata.pagenation.total = res.total;
+                            },
+                            error: function (res) {
+                                Toastr.error("加载失败!")
+                            }
+                        })
+                    },
+                    handleSizeChange(val) {
+                        this.goodsdata.pagenation.pagesize = val;
+                        this.loadgoodslist();
+                    },
+                    handleCurrentChange(val) {
+                        this.goodsdata.pagenation.currentpage = val;
+                        this.loadgoodslist();
+                    },
+                    debounce(fn, delay) {
+                        let timeout = null;
+                        delay = delay || 500;
+                        return function (e) {
+                            let args = arguments;
+                            let that = this;
+                            clearTimeout(timeout);
+                            timeout = setTimeout(function () {
+                                fn.apply(that, args);
+                            }, delay);
+                        };
+                    },
+                    barcodeinputenter() {
+                        let that = this;
+                        if (this.curgood.barcode == "") {
+                            Fast.api.msg("请输入商品条码并按回车键!")
+                        } else {
+                            Fast.api.ajax({
+                                url: "stock/goods/getgoodsbybarcodeorid",
+                                data: { barcode: this.curgood.barcode }
+                            }, function (data) {
+                                if (data !== null) {
+                                    that.curgood.stock_goods_id = data.id;
+                                    that.curgood.volnum = data.volnum;
+                                    that.curgood.goodsname = data.goodsname;
+                                    that.curgood.productmodel = data.productmodel;
+                                    that.curgood.measureunit = data.measureunit;
+                                    that.curgood.stockoutnums = data.curstocknum >= 1 ? 1 : 0;
+                                    that.curgood.stocknum = data.curstocknum;
+                                    that.curgood.stockoutgoodsremark = "";
+                                }
+                            })
+                        }
+                    },
+                    onSearchvalueChange() {
+                        this.debounce(this.loadgoodslist, 1000)();
+                    },
+                    selectonegood(currentrow) {
+                        let that = this;
+                        Fast.api.ajax({
+                            url: "stock/goods/getgoodsbybarcodeorid",
+                            data: { id: currentrow.id }
+                        }, function (data) {
+                            if (data !== null) {
+                                that.curgood.stock_goods_id = data.id;
+                                that.curgood.volnum = data.volnum;
+                                that.curgood.goodsname = data.goodsname;
+                                that.curgood.productmodel = data.productmodel;
+                                that.curgood.measureunit = data.measureunit;
+                                that.curgood.barcode = data.barcode;
+                                that.curgood.stockoutnums = data.curstocknum >= 1 ? 1 : 0;
+                                that.curgood.stocknum = data.curstocknum;
+                                that.curgood.stockoutgoodsremark = "";
+                            }
+                        })
+                    },
+                    addtolist() {
+                        let that = this;
+                        let hasadded = false;
+                        if (this.curgood.stock_goods_id != "") {
+                            if (this.curgood.stockoutnums == 0) {
+                                Fast.api.msg("出库数量不能为0!");
+                                return;
+                            }
+                            if (this.curgood.stockoutnums > this.curgood.stocknum) {
+                                Fast.api.msg("出库数量不能大于库存数量,请修改!");
+                                return;
+                            }
+                            this.selectedgoodsdata.list.forEach(item => {
+                                if (item.stock_goods_id == that.curgood.stock_goods_id) {
+                                    Fast.api.msg("该商品已添加,请勿重复添加!")
+                                    hasadded = true;
+                                }
+                            });
+                            if (!hasadded) {
+                                let good = JSON.parse(JSON.stringify(this.curgood));
+                                this.selectedgoodsdata.list.unshift(good);
+                                this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                            }
+                        } else {
+                            Fast.api.msg("请选择出库商品!")
+                        }
+                    },
+                    reset() {
+                        this.curgood = JSON.parse(JSON.stringify(this.defaultgood));
+                    },
+                    getcurgoodamount() {
+                        this.curgood.amount = this.accMul(this.curgood.stockinnums, this.curgood.inboundprice);
+                    },
+                    accMul(arg1, arg2) {
+                        var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
+                        try {
+                            m += s1.split(".")[1].length
+                        } catch (e) {
+                        }
+                        try {
+                            m += s2.split(".")[1].length
+                        } catch (e) {
+                        }
+                        return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
+                    },
+                    accAdd(arg1, arg2) {
+                        var r1, r2, m;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length
+                        } catch (e) {
+                            r1 = 0
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length
+                        } catch (e) {
+                            r2 = 0
+                        }
+                        m = Math.pow(10, Math.max(r1, r2))
+                        return (arg1 * m + arg2 * m) / m
+                    },
+                    accSub(arg1, arg2) {
+                        var r1, r2, m, n;
+                        try {
+                            r1 = arg1.toString().split(".")[1].length;
+                        } catch (e) {
+                            r1 = 0;
+                        }
+                        try {
+                            r2 = arg2.toString().split(".")[1].length;
+                        } catch (e) {
+                            r2 = 0;
+                        }
+                        m = Math.pow(10, Math.max(r1, r2));
+                        //last modify by deeka
+                        //动态控制精度长度
+                        n = (r1 >= r2) ? r1 : r2;
+                        return ((arg1 * m - arg2 * m) / m).toFixed(n);
+                    },
+                    deleteselected(row) {
+                        if (row.id) {
+                            this.deselectedgoodslist.unshift(row.id);
+                        }
+                        this.selectedgoodsdata.list = this.selectedgoodsdata.list.filter(item => {
+                            return item != row;
+                        });
+                        this.row.totalamount = this.accSub(this.row.totalamount, row.amount);
+                    }
+
+                }
+            })
+            Form.api.bindevent($("form[role=form]"), "", "", function () {
+                let main = JSON.parse($("#c-main").val());
+                let goodslist = JSON.parse($("#c-goodslist").val());
+                if (main.stock_customer_id == "") {
+                    Toastr.error("请选择客户");
+                    return false;
+                } else if (goodslist.length < 1) {
+                    Toastr.error("请添加出库商品");
+                    return false;
+                }
+            });
+        },
+
+
+
+
+
+
+
+
+
+        printer: function () {
+            $.ajax({
+                type: "POST",
+                url: Fast.api.fixurl('stock/stockout/info'),
+                data: { "id": Fast.api.query("id") },
+                async: true, //或false,是否异步
+                timeout: 5000, //超时时间
+                dataType: 'json', //返回的数据格式:json/xml/html/script/jsonp/text
+                success: function (data) {
+                    console.log(data)
+
+                    madehtml(data);
+                }
+            });
+            function madehtml(data) {
+                var h = "<div id=\"top\" class=\"page\"><div style=\"text-align: center;font-size:22px;line-height:38px; padding-bottom: 55px; position: relative; \" >出库单</div>" +
+                    "<div id=\"qrcode\" style=\"width:80px; height:80px; position: absolute; right: 32px; top: 30px;\"></div>" + // 添加二维码容器
+                    "<table style=\"width:100%;\" class=\"row2\">" +
+                    " <tr>" +
+                    " <td  width=\"40%\"></td>" +
+                    "<td  width=\"25%\"></td>" +
+                    // "<td  width=\"12%\" tdata=\"pageNO\" format=\"##\" style=\"text-align:right;\">第页</td>" +
+                    // "<td  width=\"13%\" tdata=\"pageCount\" format=\"##\" style=\"text-align:right;\">&nbsp共页</td>" +
+                    " </tr>" +
+                    "<tr>" +
+                    "<td >客户号:" + data.goodslist.客户编号+ "</td>" +
+                    "<td>日期:" + Moment().format("YYYY-MM-DD") + "</td>"+
+                    "<td colspan=\"2\" style=\"text-align:right;\">单据号:CK202411061753001</td>" +
+                    "</tr>" +
+                    "</table>" +
+                    "</div>" +
+                    "<div id=\"maintable\"><table border=\"1\" style=\"width:100%;\">" +
+                    "<thead ><tr >" +
+                    // "<th width=\"5%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">序号</th>" +
+                    "<th width=\"12%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">库位号</th>" +
+                    "<th width=\"32%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">面料</th>" +
+                    "<th width=\"8%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">单位</th>" +
+                    "<th width=\"8%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">数量</th>" +
+                    "<th width=\"10%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">制单总数</th>" +
+                    "<th width=\"30%\"  style=\"text-align:center;\"><div style=\"line-height:20px;\">备注</th>" +
+
+                 " <tr align=\"center\">\n" +
+                    // "                <td >" + (1) + "</td>\n" +
+                    "                <td >" + data.goodslist.Uniqid + "</td>\n" +
+                    "                <td >" + data.goodslist.面料 + "</td>\n" +
+                    "                <td >" + data.goodslist.单位 + "</td>\n" +
+                    "                <td >" + data.goodslist.订单数量 + "</td>\n" +
+                    "                <td >" + data.goodslist.订单数量 + "</td>\n" +
+                    "                <td >" + data.goodslist.要求 + "</td>\n" +
+                    "            </tr>"
+                h += "<tfoot>  " +
+                    // "<tr><td tindex=\"8\" tdata=\"SubSum\" format=\"UpperMoney\" colspan=\"5\" ><div style=\"line-height:25px;text-align: left;\">本页小计:</td>" +
+                    // "<td  align=\"center\" tdata=\"SubSum\" format=\"#,##\"></td>" +
+                    // "<td></td>" +
+                    // "<td align=\"center\" tdata=\"SubSum\" format=\"#,##0.00\"></td>" +
+                    // "<td></td>" +
+                    // "</tr>" +
+                    "<tr><td colspan=\"5\" tindex=\"8\" tdata=\"AllSum\" format=\"UpperMoney\" ><div style=\"line-height:25px;text-align: left;\">合&nbsp;&nbsp;计: </td>" +
+                    "<td align=\"center\" tdata=\"AllSum\" format=\"#,##\"></td>" +
+                    // "<td></td>" +
+                    "<td align=\"center\" tdata=\"AllSum\" format=\"#,##0.00\"></td>" +
+                    // "<td></td>" +
+                    "</tr>" +
+                    "  </tfoot></table>" +
+                    "</div>" +
+                    "<div id=\"foot\"><table style=\"width:100%;\">" +
+                    "<tr >" +
+                    "<td  width=\"30%\"><div style=\"line-height:30px;\">负责人:</td>" +
+                    "<td width=\"30%\"><div style=\"line-height:30px;\">经办人:</td>" +
+                    "<td width=\"30%\"><div style=\"line-height:30px;\">库管员:</td>" +
+                    "</tr>" +
+                    "<tr>" +
+                    "</tr>" +
+                    "</table></div>";
+                $('.printContent').append(h);
+
+                // 生成二维码
+                new QRCode(document.getElementById("qrcode"), {
+                    text: data.goodslist.订单编号,  // 二维码内容为订单编号
+                    width: 80,
+                    height: 80
+                });
+            }
+                // require(['lodop'], function (locop) {
+                $(".printt").click(function () {
+                    console.log(123)
+                    const div1 = document.getElementById('div1');
+                    const newWindow = window.open('', '_blank'); // 打开一个新的窗口
+                    newWindow.document.write('<html><head><title>打印</title>');
+                    newWindow.document.write('<style>.row2 { padding-top: 40px}</style></head><body>');
+                    newWindow.document.write(div1.innerHTML); // 将 div1 的内容写入新窗口
+                    newWindow.document.write('</body></html>');
+                    newWindow.document.close();
+                    newWindow.print(); // 调用打印
+                    newWindow.close(); // 打印后关闭窗口
+                    // var LODOP = getLodop();
+                    // if (typeof (LODOP) != "undefined") {
+                    //     var strStyle = "<style>table{table-layout:fixed;word-break:break-all;} table,td,th {border-width: 1px;border-style: solid;border-color:black;border-collapse: collapse}</style>"
+                    //     LODOP.ADD_PRINT_TABLE("30mm", "5%", "90%", "70mm", strStyle + document.getElementById("maintable").innerHTML);
+                    //     LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
+                    //     LODOP.ADD_PRINT_HTM("2mm", "5%", "90%", "25mm", document.getElementById("top").innerHTML);
+                    //     LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+                    //     LODOP.ADD_PRINT_HTM("120mm", "5%", "90%", "25mm", document.getElementById("foot").innerHTML);
+                    //     LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 4);
+                    //     LODOP.SET_PRINT_STYLEA(0, "FontSize", 12);
+                    //     LODOP.SET_PRINT_STYLEA(0, "FontColor", "#FF0000");
+                    //     LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
+                    //     LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
+                    //     LODOP.SET_PRINT_STYLEA(0, "Horient", 3);
+                    //     LODOP.SET_PRINT_PAGESIZE(2, 0, 0, "A5")
+                    //     LODOP.PREVIEW();
+                    // }
+                });
+            // });
+        },
+        api: {
+            formatter: {
+                audit: function (value, row, index) {
+                    //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
+                    var colorArr = { normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info' };
+                    // 如果字段列有定义custom
+                    var newValue = value == null ? '未审核' : '已审核';
+                    var color = value == null ? 'danger' : 'primary';
+                    var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(newValue) + '</span>';
+                    return html;
+                },
+                settle: function (value, row, index) {
+                    //颜色状态数组,可使用red/yellow/aqua/blue/navy/teal/olive/lime/fuchsia/purple/maroon
+                    var colorArr = { normal: 'success', hidden: 'grey', deleted: 'danger', locked: 'info' };
+                    // 如果字段列有定义custom
+                    var newValue = value == null ? '未结算' : '已结算';
+                    var color = value == null ? 'danger' : 'primary';
+                    var html = '<span class="text-' + color + '"><i class="fa fa-circle"></i> ' + __(newValue) + '</span>';
+                    return html;
+                },
+            },
+            bindevent: function () {
+                $('form[role=form]').data('validator-options', { msgClass: "n-bottom" });
+                //重置
+                $('#btnreset').click(function () {
+                    $('#paneladdgoods :text').val('');
+                    $('#paneladdgoods [type=number]').val('');
+                });
+                Form.api.bindevent($("form[role=form]"));
+            }
+        }
+    };
+    return Controller;
+}
+);

+ 59 - 0
public/assets/js/backend/stock/supplier.js

@@ -0,0 +1,59 @@
+define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
+
+    var Controller = {
+        index: function () {
+            // 初始化表格参数配置
+            Table.api.init({
+                extend: {
+                    index_url: 'stock/supplier/index',
+                    add_url: 'stock/supplier/add',
+                    edit_url: 'stock/supplier/edit',
+                    del_url: 'stock/supplier/del',
+                    multi_url: 'stock/supplier/multi',
+                    table: 'stock_supplier',
+                }
+            });
+
+            var table = $("#table");
+
+            // 初始化表格
+            table.bootstrapTable({
+                url: $.fn.bootstrapTable.defaults.extend.index_url,
+                pk: 'id',
+                sortName: 'id',
+                columns: [
+                    [
+                        {checkbox: true},
+                        {
+                            field: 'id',
+                            title: __('Id'),
+                        },
+                        {field: 'name', title: __('Name')},
+                        {field: 'shortname', title: __('Shortname')},
+                        {field: 'code', title: __('Code')},
+                        {field: 'shipaddress', title: __('Shipaddress')},
+                        {field: 'address', title: __('Address')},
+                        {field: 'contacts', title: __('Contacts')},
+                        {field: 'telphone', title: __('Telphone')},
+                        {field: 'remark', title: '备注'},
+                        {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;
+});

+ 279 - 0
public/assets/js/jQuery.print.js

@@ -0,0 +1,279 @@
+/* @license 
+ * jQuery.print, version 1.6.0
+ *  (c) Sathvik Ponangi, Doers' Guild
+ * Licence: CC-By (http://creativecommons.org/licenses/by/3.0/)
+ *--------------------------------------------------------------------------*/
+(function ($) {
+    "use strict";
+    // A nice closure for our definitions
+
+    function jQueryCloneWithSelectAndTextAreaValues(elmToClone, withDataAndEvents, deepWithDataAndEvents) {
+        // Replacement jQuery clone that also clones the values in selects and textareas as jQuery doesn't for performance reasons - https://stackoverflow.com/questions/742810/clone-isnt-cloning-select-values
+        // Based on https://github.com/spencertipping/jquery.fix.clone
+        var $elmToClone = $(elmToClone),
+            $result           = $elmToClone.clone(withDataAndEvents, deepWithDataAndEvents),
+            $myTextareas     = $elmToClone.find('textarea').add($elmToClone.filter('textarea')),
+            $resultTextareas = $result.find('textarea').add($result.filter('textarea')),
+            $mySelects       = $elmToClone.find('select').add($elmToClone.filter('select')),
+            $resultSelects   = $result.find('select').add($result.filter('select')),
+            i, l, j, m;
+
+        for (i = 0, l = $myTextareas.length; i < l; ++i) {
+            $($resultTextareas[i]).val($($myTextareas[i]).val());
+        }
+        for (i = 0, l = $mySelects.length;   i < l; ++i) {
+            for (j = 0, m = $mySelects[i].options.length; j < m; ++j) {
+                if ($mySelects[i].options[j].selected === true) {
+                    $resultSelects[i].options[j].selected = true;
+                }
+            }
+        }
+        return $result;
+    }
+
+    function getjQueryObject(string) {
+        // Make string a vaild jQuery thing
+        var jqObj = $("");
+        try {
+            jqObj = jQueryCloneWithSelectAndTextAreaValues(string);
+        } catch (e) {
+            jqObj = $("<span />")
+                .html(string);
+        }
+        return jqObj;
+    }
+
+    function printFrame(frameWindow, content, options) {
+        // Print the selected window/iframe
+        var def = $.Deferred();
+        try {
+            frameWindow = frameWindow.contentWindow || frameWindow.contentDocument || frameWindow;
+            var wdoc = frameWindow.document || frameWindow.contentDocument || frameWindow;
+            if(options.doctype) {
+                wdoc.write(options.doctype);
+            }
+            wdoc.write(content);
+            wdoc.close();
+            var printed = false,
+                callPrint = function () {
+                    if(printed) {
+                        return;
+                    }
+                    // Fix for IE : Allow it to render the iframe
+                    frameWindow.focus();
+                    try {
+                        // Fix for IE11 - printng the whole page instead of the iframe content
+                        if (!frameWindow.document.execCommand('print', false, null)) {
+                            // document.execCommand returns false if it failed -http://stackoverflow.com/a/21336448/937891
+                            frameWindow.print();
+                        }
+                        // focus body as it is losing focus in iPad and content not getting printed
+                        $('body').focus();
+                    } catch (e) {
+                        frameWindow.print();
+                    }
+                    frameWindow.close();
+                    printed = true;
+                    def.resolve();
+                };
+            // Print once the frame window loads - seems to work for the new-window option but unreliable for the iframe
+            $(frameWindow).on("load", callPrint);
+            // Fallback to printing directly if the frame doesn't fire the load event for whatever reason
+            setTimeout(callPrint, options.timeout);
+        } catch (err) {
+            def.reject(err);
+        }
+        return def;
+    }
+
+    function printContentInIFrame(content, options) {
+        var $iframe = $(options.iframe + "");
+        var iframeCount = $iframe.length;
+        if (iframeCount === 0) {
+            // Create a new iFrame if none is given
+            $iframe = $('<iframe height="0" width="0" border="0" wmode="Opaque"/>')
+                .prependTo('body')
+                .css({
+                    "position": "absolute",
+                    "top": -999,
+                    "left": -999
+                });
+        }
+        var frameWindow = $iframe.get(0);
+        return printFrame(frameWindow, content, options)
+            .done(function () {
+                // Success
+                setTimeout(function () {
+                    // Wait for IE
+                    if (iframeCount === 0) {
+                        // Destroy the iframe if created here
+                        $iframe.remove();
+                    }
+                }, 1000);
+            })
+            .fail(function (err) {
+                // Use the pop-up method if iframe fails for some reason
+                console.error("Failed to print from iframe", err);
+                printContentInNewWindow(content, options);
+            })
+            .always(function () {
+                try {
+                    options.deferred.resolve();
+                } catch (err) {
+                    console.warn('Error notifying deferred', err);
+                }
+            });
+    }
+
+    function printContentInNewWindow(content, options) {
+        // Open a new window and print selected content
+        var frameWindow = window.open();
+        return printFrame(frameWindow, content, options)
+            .always(function () {
+                try {
+                    options.deferred.resolve();
+                } catch (err) {
+                    console.warn('Error notifying deferred', err);
+                }
+            });
+    }
+
+    function isNode(o) {
+        /* http://stackoverflow.com/a/384380/937891 */
+        return !!(typeof Node === "object" ? o instanceof Node : o && typeof o === "object" && typeof o.nodeType === "number" && typeof o.nodeName === "string");
+    }
+    $.print = $.fn.print = function () {
+        // Print a given set of elements
+        var options, $this, self = this;
+        // console.log("Printing", this, arguments);
+        if (self instanceof $) {
+            // Get the node if it is a jQuery object
+            self = self.get(0);
+        }
+        if (isNode(self)) {
+            // If `this` is a HTML element, i.e. for
+            // $(selector).print()
+            $this = $(self);
+            if (arguments.length > 0) {
+                options = arguments[0];
+            }
+        } else {
+            if (arguments.length > 0) {
+                // $.print(selector,options)
+                $this = $(arguments[0]);
+                if (isNode($this[0])) {
+                    if (arguments.length > 1) {
+                        options = arguments[1];
+                    }
+                } else {
+                    // $.print(options)
+                    options = arguments[0];
+                    $this = $("html");
+                }
+            } else {
+                // $.print()
+                $this = $("html");
+            }
+        }
+        // Default options
+        var defaults = {
+            globalStyles: true,
+            mediaPrint: false,
+            stylesheet: null,
+            noPrintSelector: ".no-print",
+            iframe: true,
+            append: null,
+            prepend: null,
+            manuallyCopyFormValues: true,
+            deferred: $.Deferred(),
+            timeout: 750,
+            title: null,
+            doctype: '<!doctype html>'
+        };
+        // Merge with user-options
+        options = $.extend({}, defaults, (options || {}));
+        var $styles = $("");
+        if (options.globalStyles) {
+            // Apply the stlyes from the current sheet to the printed page
+            $styles = $("style, link, meta, base, title");
+        } else if (options.mediaPrint) {
+            // Apply the media-print stylesheet
+            $styles = $("link[media=print]");
+        }
+        if (options.stylesheet) {
+            // Add a custom stylesheet if given
+            $styles = $.merge($styles, $('<link rel="stylesheet" href="' + options.stylesheet + '">'));
+        }
+        // Create a copy of the element to print
+        var copy = jQueryCloneWithSelectAndTextAreaValues($this);
+        // Wrap it in a span to get the HTML markup string
+        copy = $("<span/>")
+            .append(copy);
+        // Remove unwanted elements
+        copy.find(options.noPrintSelector)
+            .remove();
+        // Add in the styles
+        copy.append(jQueryCloneWithSelectAndTextAreaValues($styles));
+        // Update title
+        if (options.title) {
+            var title = $("title", copy);
+            if (title.length === 0) {
+                title = $("<title />");
+                copy.append(title);                
+            }
+            title.text(options.title);            
+        }
+        // Appedned content
+        copy.append(getjQueryObject(options.append));
+        // Prepended content
+        copy.prepend(getjQueryObject(options.prepend));
+        if (options.manuallyCopyFormValues) {
+            // Manually copy form values into the HTML for printing user-modified input fields
+            // http://stackoverflow.com/a/26707753
+            copy.find("input")
+                .each(function () {
+                    var $field = $(this);
+                    if ($field.is("[type='radio']") || $field.is("[type='checkbox']")) {
+                        if ($field.prop("checked")) {
+                            $field.attr("checked", "checked");
+                        }
+                    } else {
+                        $field.attr("value", $field.val());
+                    }
+                });
+            copy.find("select").each(function () {
+                var $field = $(this);
+                $field.find(":selected").attr("selected", "selected");
+            });
+            copy.find("textarea").each(function () {
+                // Fix for https://github.com/DoersGuild/jQuery.print/issues/18#issuecomment-96451589
+                var $field = $(this);
+                $field.text($field.val());
+            });
+        }
+        // Get the HTML markup string
+        var content = copy.html();
+        // Notify with generated markup & cloned elements - useful for logging, etc
+        try {
+            options.deferred.notify('generated_markup', content, copy);
+        } catch (err) {
+            console.warn('Error notifying deferred', err);
+        }
+        // Destroy the copy
+        copy.remove();
+        if (options.iframe) {
+            // Use an iframe for printing
+            try {
+                printContentInIFrame(content, options);
+            } catch (e) {
+                // Use the pop-up method if iframe fails for some reason
+                console.error("Failed to print from iframe", e.stack, e.message);
+                printContentInNewWindow(content, options);
+            }
+        } else {
+            // Use a new window for printing
+            printContentInNewWindow(content, options);
+        }
+        return this;
+    };
+})(jQuery);

+ 372 - 0
public/assets/js/pingyinUntil.js

@@ -0,0 +1,372 @@
+
+/**
+ * 汉字与拼音互转工具,根据导入的字典文件的不同支持不同
+ * 对于多音字目前只是将所有可能的组合输出,准确识别多音字需要完善的词库,而词库文件往往比字库还要大,所以不太适合web环境。
+ * @start 2016-09-26
+ * @last 2016-09-29
+ */
+(function(global, factory) {
+	if (typeof module === "object" && typeof module.exports === "object") {
+		module.exports = factory(global);
+	} else {
+		factory(global);
+	}
+})(typeof window !== "undefined" ? window : this, function(window) {
+
+	var toneMap = 
+	{
+		"ā": "a1",
+		"á": "a2",
+		"ǎ": "a3",
+		"à": "a4",
+		"ō": "o1",
+		"ó": "o2",
+		"ǒ": "o3",
+		"ò": "o4",
+		"ē": "e1",
+		"é": "e2",
+		"ě": "e3",
+		"è": "e4",
+		"ī": "i1",
+		"í": "i2",
+		"ǐ": "i3",
+		"ì": "i4",
+		"ū": "u1",
+		"ú": "u2",
+		"ǔ": "u3",
+		"ù": "u4",
+		"ü": "v0",
+		"ǖ": "v1",
+		"ǘ": "v2",
+		"ǚ": "v3",
+		"ǜ": "v4",
+		"ń": "n2",
+		"ň": "n3",
+		"": "m2"
+	};
+
+	var dict = {}; // 存储所有字典数据
+	var pinyinUtil =
+	{
+		/**
+		 * 解析各种字典文件,所需的字典文件必须在本JS之前导入
+		 */
+		parseDict: function()
+		{
+			// 如果导入了 pinyin_dict_firstletter.js
+			if(window.pinyin_dict_firstletter)
+			{
+				dict.firstletter = pinyin_dict_firstletter;
+			}
+			// 如果导入了 pinyin_dict_notone.js
+			if(window.pinyin_dict_notone)
+			{
+				dict.notone = {};
+				dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+				for(var i in pinyin_dict_notone)
+				{
+					var temp = pinyin_dict_notone[i];
+					for(var j=0, len=temp.length; j<len; j++)
+					{
+						if(!dict.notone[temp[j]]) dict.notone[temp[j]] = i; // 不考虑多音字
+					}
+				}
+			}
+			// 如果导入了 pinyin_dict_withtone.js
+			if(window.pinyin_dict_withtone)
+			{
+				dict.withtone = {}; // 汉字与拼音映射,多音字用空格分开,类似这种结构:{'大': 'da tai'}
+				var temp = pinyin_dict_withtone.split(',');
+				for(var i=0, len = temp.length; i<len; i++)
+				{
+					// 这段代码耗时28毫秒左右,对性能影响不大,所以一次性处理完毕
+					dict.withtone[String.fromCharCode(i + 19968)] = temp[i]; // 这里先不进行split(' '),因为一次性循环2万次split比较消耗性能
+				}
+
+				// 拼音 -> 汉字
+				if(window.pinyin_dict_notone)
+				{
+					// 对于拼音转汉字,我们优先使用pinyin_dict_notone字典文件
+					// 因为这个字典文件不包含生僻字,且已按照汉字使用频率排序
+					dict.py2hz = pinyin_dict_notone; // 拼音转汉字
+				}
+				else
+				{
+					// 将字典文件解析成拼音->汉字的结构
+					// 与先分割后逐个去掉声调相比,先一次性全部去掉声调然后再分割速度至少快了3倍,前者大约需要120毫秒,后者大约只需要30毫秒(Chrome下)
+					var notone = pinyinUtil.removeTone(pinyin_dict_withtone).split(',');
+					var py2hz = {}, py, hz;
+					for(var i=0, len = notone.length; i<len; i++)
+					{
+						hz = String.fromCharCode(i + 19968); // 汉字
+						py = notone[i].split(' '); // 去掉了声调的拼音数组
+						for(var j=0; j<py.length; j++)
+						{
+							py2hz[py[j]] = (py2hz[py[j]] || '') + hz;
+						}
+					}
+					dict.py2hz = py2hz;
+				}
+			}
+		},
+		/**
+		 * 根据汉字获取拼音,如果不是汉字直接返回原字符
+		 * @param chinese 要转换的汉字
+		 * @param splitter 分隔字符,默认用空格分隔
+		 * @param withtone 返回结果是否包含声调,默认是
+		 * @param polyphone 是否支持多音字,默认否
+		 */
+		getPinyin: function(chinese, splitter, withtone, polyphone)
+		{
+			if(!chinese || /^ +$/g.test(chinese)) return '';
+			splitter = splitter == undefined ? ' ' : splitter;
+			withtone = withtone == undefined ? true : withtone;
+			polyphone = polyphone == undefined ? false : polyphone;
+			var result = [];
+			if(dict.withtone) // 优先使用带声调的字典文件
+			{
+				var noChinese = '';
+				for (var i=0, len = chinese.length; i < len; i++)
+				{
+					var pinyin = dict.withtone[chinese[i]];
+					if(pinyin)
+					{
+						// 如果不需要多音字,默认返回第一个拼音,后面的直接忽略
+						// 所以这对数据字典有一定要求,常见字的拼音必须放在最前面
+						if(!polyphone) pinyin = pinyin.replace(/ .*$/g, '');
+						if(!withtone) pinyin = this.removeTone(pinyin); // 如果不需要声调
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+						result.push( pinyin ); 
+					}
+					else if ( !chinese[i] || /^ +$/g.test(chinese[i]) ){
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+					}
+					else{
+						noChinese += chinese[i];
+					}
+				}
+				if ( noChinese ){
+					result.push( noChinese);
+					noChinese = '';
+				}
+			}
+			else if(dict.notone) // 使用没有声调的字典文件
+			{
+				if(withtone) console.warn('pinyin_dict_notone 字典文件不支持声调!');
+				if(polyphone) console.warn('pinyin_dict_notone 字典文件不支持多音字!');
+				var noChinese = '';
+				for (var i=0, len = chinese.length; i < len; i++)
+				{
+					var temp = chinese.charAt(i),
+						pinyin = dict.notone[temp];
+					if ( pinyin ){ //插入拼音
+						//空格,把noChinese作为一个词插入
+						noChinese && ( result.push( noChinese), noChinese = '' );
+						result.push( pinyin );
+					}
+					else if ( !temp || /^ +$/g.test(temp) ){
+						//空格,插入之前的非中文字符
+						noChinese && ( result.push( noChinese), noChinese = '' );
+					}
+					else {
+						//非空格,关联到noChinese中
+						noChinese += temp;
+					}
+				}
+
+				if ( noChinese ){
+					result.push( noChinese );
+					noChinese = '';
+				}
+			}
+			else
+			{
+				throw '抱歉,未找到合适的拼音字典文件!';
+			}
+			if(!polyphone) return result.join(splitter);
+			else
+			{
+				if(window.pinyin_dict_polyphone) return parsePolyphone(chinese, result, splitter, withtone);
+				else return handlePolyphone(result, ' ', splitter);
+			}
+		},
+		/**
+		 * 获取汉字的拼音首字母
+		 * @param str 汉字字符串,如果遇到非汉字则原样返回
+		 * @param polyphone 是否支持多音字,默认false,如果为true,会返回所有可能的组合数组
+		 */
+		getFirstLetter: function(str, polyphone)
+		{
+			polyphone = polyphone == undefined ? false : polyphone;
+			if(!str || /^ +$/g.test(str)) return '';
+			if(dict.firstletter) // 使用首字母字典文件
+			{
+				var result = [];
+				for(var i=0; i<str.length; i++)
+				{
+					var unicode = str.charCodeAt(i);
+					var ch = str.charAt(i);
+					if(unicode >= 19968 && unicode <= 40869)
+					{
+						ch = dict.firstletter.all.charAt(unicode-19968);
+						if(polyphone) ch = dict.firstletter.polyphone[unicode] || ch;
+					}
+					result.push(ch);
+				}
+				if(!polyphone) return result.join(''); // 如果不用管多音字,直接将数组拼接成字符串
+				else return handlePolyphone(result, '', ''); // 处理多音字,此时的result类似于:['D', 'ZC', 'F']
+			}
+			else
+			{
+				var py = this.getPinyin(str, ' ', false, polyphone);
+				py = py instanceof Array ? py : [py];
+				var result = [];
+				for(var i=0; i<py.length; i++)
+				{
+					result.push(py[i].replace(/(^| )(\w)\w*/g, function(m,$1,$2){return $2.toUpperCase();}));
+				}
+				if(!polyphone) return result[0];
+				else return simpleUnique(result);
+			}
+		},
+		/**
+		 * 拼音转汉字,只支持单个汉字,返回所有匹配的汉字组合
+		 * @param pinyin 单个汉字的拼音,可以包含声调
+		 */
+		getHanzi: function(pinyin)
+		{
+			if(!dict.py2hz)
+			{
+				throw '抱歉,未找到合适的拼音字典文件!';
+			}
+			return dict.py2hz[this.removeTone(pinyin)] || '';
+		},
+		/**
+		 * 获取某个汉字的同音字,本方法暂时有问题,待完善
+		 * @param hz 单个汉字
+		 * @param sameTone 是否获取同音同声调的汉字,必须传进来的拼音带声调才支持,默认false
+		 */
+		getSameVoiceWord: function(hz, sameTone)
+		{
+			sameTone = sameTone || false
+			return this.getHanzi(this.getPinyin(hz, ' ', false))
+		},
+		/**
+		 * 去除拼音中的声调,比如将 xiǎo míng tóng xué 转换成 xiao ming tong xue
+		 * @param pinyin 需要转换的拼音
+		 */
+		removeTone: function(pinyin)
+		{
+			return pinyin.replace(/[āáǎàōóǒòēéěèīíǐìūúǔùüǖǘǚǜńň]/g, function(m){ return toneMap[m][0]; });
+		},
+		/**
+		 * 将数组拼音转换成真正的带标点的拼音
+		 * @param pinyinWithoutTone 类似 xu2e这样的带数字的拼音
+		 */
+		getTone: function(pinyinWithoutTone)
+		{
+			var newToneMap = {};
+			for(var i in toneMap) newToneMap[toneMap[i]] = i;
+			return (pinyinWithoutTone || '').replace(/[a-z]\d/g, function(m) {
+				return newToneMap[m] || m;
+			});
+		}
+	};
+
+
+	/**
+	 * 处理多音字,将类似['D', 'ZC', 'F']转换成['DZF', 'DCF']
+	 * 或者将 ['chang zhang', 'cheng'] 转换成 ['chang cheng', 'zhang cheng']
+	 */
+	function handlePolyphone(array, splitter, joinChar)
+	{
+		splitter = splitter || '';
+		var result = [''], temp = [];
+		for(var i=0; i<array.length; i++)
+		{
+			temp = [];
+			var t = array[i].split(splitter);
+			for(var j=0; j<t.length; j++)
+			{
+				for(var k=0; k<result.length; k++)
+					temp.push(result[k] + (result[k]?joinChar:'') + t[j]);
+			}
+			result = temp;
+		}
+		return simpleUnique(result);
+	}
+
+	/**
+	 * 根据词库找出多音字正确的读音
+	 * 这里只是非常简单的实现,效率和效果都有一些问题
+	 * 推荐使用第三方分词工具先对句子进行分词,然后再匹配多音字
+	 * @param chinese 需要转换的汉字
+	 * @param result 初步匹配出来的包含多个发音的拼音结果
+	 * @param splitter 返回结果拼接字符
+	 */
+	function parsePolyphone(chinese, result, splitter, withtone)
+	{
+		var poly = window.pinyin_dict_polyphone;
+		var max = 7; // 最多只考虑7个汉字的多音字词,虽然词库里面有10个字的,但是数量非常少,为了整体效率暂时忽略之
+		var temp = poly[chinese];
+		if(temp) // 如果直接找到了结果
+		{
+			temp = temp.split(' ');
+			for(var i=0; i<temp.length; i++)
+			{
+				result[i] = temp[i] || result[i];
+				if(!withtone) result[i] = pinyinUtil.removeTone(result[i]);
+			}
+			return result.join(splitter);
+		}
+		for(var i=0; i<chinese.length; i++)
+		{
+			temp = '';
+			for(var j=0; j<max && (i+j)<chinese.length; j++)
+			{
+				if(!/^[\u2E80-\u9FFF]+$/.test(chinese[i+j])) break; // 如果碰到非汉字直接停止本次查找
+				temp += chinese[i+j];
+				var res = poly[temp];
+				if(res) // 如果找到了多音字词语
+				{
+					res = res.split(' ');
+					for(var k=0; k<=j; k++)
+					{
+						if(res[k]) result[i+k] = withtone ? res[k] : pinyinUtil.removeTone(res[k]);
+					}
+					break;
+				}
+			}
+		}
+		// 最后这一步是为了防止出现词库里面也没有包含的多音字词语
+		for(var i=0; i<result.length; i++)
+		{
+			result[i] = result[i].replace(/ .*$/g, '');
+		}
+		return result.join(splitter);
+	}
+
+	// 简单数组去重
+	function simpleUnique(array)
+	{
+		var result = [];
+		var hash = {};
+		for(var i=0; i<array.length; i++)
+		{
+			var key = (typeof array[i]) + array[i];
+			if(!hash[key])
+			{
+				result.push(array[i]);
+				hash[key] = true;
+			}
+		}
+		return result;
+	}
+
+	pinyinUtil.parseDict();
+	pinyinUtil.dict = dict;
+	window.pinyinUtil = pinyinUtil;
+
+});

File diff suppressed because it is too large
+ 0 - 0
public/assets/js/qrcode.min.js


Some files were not shown because too many files changed in this diff