m0_70156489 1 month ago
parent
commit
237bfc674c

+ 89 - 22
application/admin/controller/CollarUse.php

@@ -114,39 +114,93 @@ class CollarUse extends Backend
     }
 
     public function add(){
-        $params = input('bach');
-        if ($params == '' || empty($params) || !is_numeric($params)){
-            return array('status'=>0,'msg'=>'工单输入错误');
+        $result = $this->validateAddOrder(input('bach'));
+        if (!$result['valid']) {
+            $this->dialogError($result['msg']);
         }
-        //根据工单批次号获取对应配方、库存信息
-        $product =  Db::connect('db2')->query("select * from 工单_基本资料 where Gd_gdbh = '{$params}' limit 1");
-        if (empty($product)){
-            return array('status'=>0,'msg'=>'查不到工单数据,请联系管理员');
+        $params = $result['data']['params'];
+        $product_name = $result['data']['product_name'];
+        $colorResult = $result['data']['colorResult'];
+        $inkData = $result['data']['inkData'];
+        $jar = Db::name('jar')->order('sort')->select();
+        return $this->view->fetch('', compact('params', 'product_name', 'colorResult', 'jar', 'inkData'));
+    }
+
+    /**
+     * 领用前校验工单数据(Ajax)
+     */
+    public function checkOrder()
+    {
+        $result = $this->validateAddOrder(input('bach'));
+        if ($result['valid']) {
+            $this->success('可以领用');
+        }
+        $this->error($result['msg']);
+    }
+
+    /**
+     * 校验领用工单是否具备配方及原墨数据
+     */
+    protected function validateAddOrder($params)
+    {
+        if ($params === '' || $params === null) {
+            return ['valid' => false, 'msg' => '请输入正确的工单号'];
+        }
+
+        $product = Db::connect('db2')->query("select Gd_cpdh,Gd_cpmc from 工单_基本资料 where Gd_gdbh = ? limit 1", [$params]);
+        if (empty($product)) {
+            return ['valid' => false, 'msg' => '查不到工单【' . $params . '】,请确认工单号是否正确'];
         }
+
         $product_number = rtrim($product[0]['Gd_cpdh']);
         $product_name = trim($product[0]['Gd_cpmc']);
-        $where[] = ['exp',Db::raw("FIND_IN_SET($product_number,a.product_number)")];
-        //专墨颜色
+        if ($product_number === '') {
+            return ['valid' => false, 'msg' => '工单【' . $params . '】产品编码为空,无法领用,请联系管理员'];
+        }
+
+        $where[] = ['exp', Db::raw("FIND_IN_SET(:pn, a.product_number)")];
         $colorResult = Db::name('formula')->alias('a')
-            ->join('warehousing b','a.id=b.cid','left')
+            ->bind(['pn' => $product_number])
+            ->join('warehousing b', 'a.id=b.cid', 'left')
             ->where($where)
             ->field('a.*,b.weight')
             ->select();
-//        print_r($colorResult);die;
-        foreach ($colorResult as $key=>$value){
-            if (empty($value['weight'])){
+
+        foreach ($colorResult as $key => $value) {
+            if (empty($value['weight'])) {
                 $colorResult[$key]['weight'] = 0;
-            }else{
+            } else {
                 $colorResult[$key]['weight'] = $value['weight'] / 1000;
             }
         }
-        //原墨
-        $map[] = ['exp',Db::raw("FIND_IN_SET($product_number,product_number)")];
-        $inkData = Db::name('formula_consume')->where($map)->where('code','neq','')->field('id,ink,code')->select();
 
-        $inkData = $this->assoc_unique($inkData,'ink');
-        $jar = Db::name('jar')->order('sort')->select();
-        return $this->view->fetch('',compact('params','product_name','colorResult','jar','inkData'));
+        if (empty($colorResult)) {
+            return ['valid' => false, 'msg' => '工单【' . $params . '】产品【' . $product_name . '】未配置专色墨配方,请维护配方后再领用'];
+        }
+
+        $map[] = ['exp', Db::raw("FIND_IN_SET(:pn, product_number)")];
+        $inkData = Db::name('formula_consume')
+            ->bind(['pn' => $product_number])
+            ->where($map)
+            ->where('code', 'neq', '')
+            ->field('id,ink,code')
+            ->select();
+        $inkData = $this->assoc_unique($inkData, 'ink');
+
+        if (empty($inkData)) {
+            return ['valid' => false, 'msg' => '工单【' . $params . '】产品【' . $product_name . '】未配置原墨消耗数据,请维护配方后再领用'];
+        }
+
+        return [
+            'valid' => true,
+            'msg' => 'ok',
+            'data' => [
+                'params' => $params,
+                'product_name' => $product_name,
+                'colorResult' => $colorResult,
+                'inkData' => $inkData,
+            ],
+        ];
     }
     //退料
     public function back(){
@@ -398,13 +452,26 @@ class CollarUse extends Backend
             return array('status'=>0,'msg'=>'查不到工单数据,请联系管理员');
         }
         $product_number = rtrim($product[0]['Gd_cpdh']);
-        $where[] = ['exp',Db::raw("FIND_IN_SET($product_number,product_number)")];
+        //修改前
+        // $where[] = ['exp',Db::raw("FIND_IN_SET($product_number,product_number)")];
+        // $colorResult = Db::name('formula')
+        //     ->where($where)
+        //     ->select();
+        // $inkResult = Db::name('formula_consume')
+        //     ->where($where)
+        //     ->where('code','neq','')
+        //     ->field('id,ink,code')
+        //     ->select();
+        //修改后
+        $where[] = ['exp', Db::raw("FIND_IN_SET(:pn, product_number)")];
         $colorResult = Db::name('formula')
+            ->bind(['pn' => $product_number])
             ->where($where)
             ->select();
         $inkResult = Db::name('formula_consume')
+            ->bind(['pn' => $product_number])
             ->where($where)
-            ->where('code','neq','')
+            ->where('code', 'neq', '')
             ->field('id,ink,code')
             ->select();
         $inkResult = $this->assoc_unique($inkResult,'code');

+ 98 - 57
application/admin/controller/Order.php

@@ -17,29 +17,31 @@ class Order extends Backend{
     public function index(){
         $data = $this->request->request();
         if ($this->request->isAjax()) {
-            $params['pagesize'] = is_null($data['limit']) ? 10 : $data['limit'];//初始查询位置
-            if ($data['limit'] == 0){
-                $params['page'] = 1;
-            }else{
-                $params['page'] = $data['offset'] / 10 + 1;
+            $pagesize = is_null($data['limit']) ? 10 : (int)$data['limit'];
+            if ($pagesize == 0) {
+                $page = 1;
+            } else {
+                $page = (int)($data['offset'] / $pagesize) + 1;
             }
-            $gdbh = input('search');
+            $startpage = ($page - 1) * $pagesize;
+            $gdbh = trim((string)input('search', ''));
 
-            if (empty($gdbh)){
-                $params['gd_gdbh'] = -1;
-            } else{
-                $params['gd_gdbh'] =$gdbh;
+            $where = [];
+            if (!empty($gdbh)) {
+                $where['Gd_gdbh'] = $gdbh;
+            } else {
+                $where['gd_statu'] = ['in', ['2-生产中', '3-计划中']];
             }
-            $url = 'http://ink.7in6.com/bKdNvCxlao.php/jar/getOrder?pagesize='.$params['pagesize'].'&page='.$params['page'].'&gd_gdbh='.$params['gd_gdbh'];
-
-            $list = $this->get($url);
 
-            $list = json_decode($list,true);
+            $total = Db::connect('db2')->table('工单_基本资料')->where($where)->count();
+            $list = Db::connect('db2')->table('工单_基本资料')
+                ->field('Gd_gdbh as gd_gdbh,Gd_cpmc as gd_cpmc,gd_statu,订单数量,计量单位,接单日期')
+                ->where($where)
+                ->order('gd_gdbh desc')
+                ->limit($startpage, $pagesize)
+                ->select();
 
-            $total = $list['total'];
-            $list = collection($list['data'])->toArray();
-
-            $result = array("total" => $total, "rows" => $list);
+            $result = ['total' => $total, 'rows' => collection($list)->toArray()];
             return json($result);
         }
         //中烟名称
@@ -55,13 +57,24 @@ class Order extends Backend{
         $data = $this->get($url);
         $data = json_decode($data,true);
         $result = $data['data'];
+
         //配方
         $productNumber = trim($result['gd_cpdh']);
         if (empty($productNumber)){
             $this->error('产品编码不存在');
         }
-        $where[] = ['exp',Db::raw("FIND_IN_SET($productNumber,product_number)")];
-        $formula = Db::name('formula')->where($where)->select();
+        //修改前
+        // $where[] = ['exp',Db::raw("FIND_IN_SET($productNumber,product_number)")];
+        // $formula = Db::name('formula')->where($where)->select();
+        // echo "<pre>";
+        // print_r($formula);
+        // echo "<pre>";die;
+        //修改后
+        $where[] = ['exp', Db::raw("FIND_IN_SET(:pn, product_number)")];
+        $formula = Db::name('formula')
+            ->bind(['pn' => $productNumber])
+            ->where($where)
+            ->select();
         $formulaData = array();
         foreach ($formula as $key=>$value){
             $formulaData[$key] = $value['product_name'];
@@ -90,8 +103,15 @@ class Order extends Backend{
         if (empty($productNumber)){
             $this->error('产品编码不存在');
         }
-        $where[] = ['exp',Db::raw("FIND_IN_SET($productNumber,product_number)")];
-        $formula = Db::name('formula')->where($where)->select();
+        //修改前
+        // $where[] = ['exp',Db::raw("FIND_IN_SET($productNumber,product_number)")];
+        // $formula = Db::name('formula')->where($where)->select();
+        //修改后
+        $where[] = ['exp', Db::raw("FIND_IN_SET(:pn, product_number)")];
+        $formula = Db::name('formula')
+            ->bind(['pn' => $productNumber])
+            ->where($where)
+            ->select();
         $formulaData = array();
         foreach ($formula as $key=>$value){
             $formulaData[$key] = $value['product_name'];
@@ -674,20 +694,25 @@ class Order extends Backend{
 
     //领退料信息专墨
     public function machine_collar_show(){
-        $parm = input();//collar 专色墨名称 //order_num 工单号 //jh 几号机
-        //根据工单批次号获取对应配方、库存信息
-        $product = Db::connect('db2')->query("select * from 工单_基本资料 where Gd_gdbh = '{$parm['order_num']}' limit 1");
-        if (empty($product)) {
-            return array('status' => 0, 'msg' => '查不到工单数据,请联系管理员');
-        }
+        $parm = input();
+        $order_num = isset($parm['order_num']) ? $parm['order_num'] : '';
+        $collar = isset($parm['collar']) ? $parm['collar'] : '';
+        $jh = isset($parm['jh']) ? $parm['jh'] : '';
 
-        if($parm['datatype'] == '1'){
+        if ($parm['datatype'] == '1') {
             $collarUse = new \app\admin\model\CollarUse;
-            $product_number = rtrim($product[0]['Gd_cpdh']);
-            $id = Db::name('formula')->where("FIND_IN_SET($product_number,product_number)")->where('color', $parm['collar'])->value('id');
+            $id = $this->getCollarFormulaId($order_num, $collar, $jh);
+            if (!$id) {
+                $this->view->assign('tip', '查不到专色墨数据,请联系管理员');
+                $this->view->assign('collarUse_list', []);
+                $this->view->assign('page', '');
+                return $this->view->fetch();
+            }
+
             $collarUse_list = $collarUse->where('cid', $id)
-                ->where('machine_number',$parm['jh'])//
-                ->where('order_number', $parm['order_num'])->paginate(5, false, ['query' => $parm]);
+                ->where('machine_number', $jh)
+                ->where('order_number', $order_num)
+                ->paginate(5, false, ['query' => $parm]);
             foreach ($collarUse_list as &$v) {
                 if ($v['status'] == 1) {
                     $v['color'] = \app\admin\model\WarehousingDetail::where('bach_number', $v['warehousing'])->value('color');
@@ -697,39 +722,55 @@ class Order extends Backend{
                 $v['weight'] = $v['weight'] / 1000;
                 $v['back_weight'] = $v['back_weight'] / 1000;
             }
-//            halt($collarUse_list);
             $page = $collarUse_list->render();
             $this->view->assign('page', $page);
             $this->view->assign('collarUse_list', $collarUse_list);
-
-        }else{
-            $MatterUse = new \app\admin\model\MatterUse;//
-            $matterUse_list = Db::name('matter_use')//
-            ->where('ink_name', $parm['collar'])//
-            ->where('order_number', $parm['order_num'])//
-            ->where('machine_number',$parm['jh'])//
-            ->paginate(5, false, ['query' => $parm]);
-//            ->select();//
+        } else {
+            $matterUse_list = Db::name('matter_use')
+                ->where('ink_name', $collar)
+                ->where('order_number', $order_num)
+                ->where('machine_number', $jh)
+                ->paginate(5, false, ['query' => $parm]);
             $matter = $matterUse_list->toArray()['data'];
-//            halt($matter);
-            foreach ($matter as $key=>$v) { //
-//                if ($v['status'] == 1) {//status=1领用
-//                    $v['ink_name'] = $MatterUse->where('code', $v['code'])->value('ink_name');//
-//                } else {//2=退回
-//                    $v['ink_name'] = $MatterUse->where('code', $v['code'])->value('ink_name');//
-//                }//
-                $matter[$key]['out_weight'] = $v['out_weight'] / 1000;//
-
-                $matter[$key]['back_weight'] = $v['back_weight'] / 1000;//
-
-            }//
-//            halt($matterUse_list);
+            foreach ($matter as $key => $v) {
+                $matter[$key]['out_weight'] = $v['out_weight'] / 1000;
+                $matter[$key]['back_weight'] = $v['back_weight'] / 1000;
+            }
             $page = $matterUse_list->render();
             $this->view->assign('page', $page);
-            $this->view->assign('MatterUse_list', $matter);//
+            $this->view->assign('MatterUse_list', $matter);
         }
         return $this->view->fetch();
     }
+
+    /**
+     * 根据工单和专色墨名称获取配方ID
+     */
+    protected function getCollarFormulaId($order_num, $collar, $jh)
+    {
+        $product = Db::connect('db2')->query("select Gd_cpdh from 工单_基本资料 where Gd_gdbh = ? limit 1", [$order_num]);
+
+        if (!empty($product)) {
+            $product_number = rtrim($product[0]['Gd_cpdh']);
+            if ($product_number !== '') {
+                $id = Db::name('formula')
+                    ->bind(['pn' => $product_number])
+                    ->whereRaw('FIND_IN_SET(:pn, product_number)')
+                    ->where('color', $collar)
+                    ->value('id');
+                if ($id) {
+                    return $id;
+                }
+            }
+        }
+
+        return Db::name('collar_use')->alias('a')
+            ->join('warehousing_detail b', 'a.warehousing = b.bach_number')
+            ->where('a.order_number', $order_num)
+            ->where('a.machine_number', $jh)
+            ->where('b.color', $collar)
+            ->value('a.cid');
+    }
     //领用油墨分解成原墨统计
     public function collar_decompose(){
         $data = $this->request->request();

+ 78 - 37
application/admin/controller/Picking.php

@@ -12,7 +12,7 @@ use Think\Exception;
  */
 class Picking extends Backend
 {
-    
+
     /**
      * Picking模型对象
      * @var \app\admin\model\Picking
@@ -26,7 +26,7 @@ class Picking extends Backend
         $this->model = new \app\admin\model\Picking;
 
     }
-    
+
     /**
      * 默认生成的控制器所继承的父类中有index/add/edit/del/multi五个基础方法、destroy/restore/recyclebin三个回收站方法
      * 因此在当前控制器中可不用编写增删改查的代码,除非需要自己控制这部分逻辑
@@ -125,73 +125,114 @@ class Picking extends Backend
      * 领料单界面数据
      */
     public function picking(){
-        $data = input('temp');
-        $gdbh = array_filter(explode(',',$data));
-        if (empty($gdbh)){
-            $this->error('请求参数错误');
+        $result = $this->validatePicking(input('temp'));
+        if (!$result['valid']) {
+            $this->dialogError($result['msg']);
+        }
+        return $this->view->fetch('add', $result['data']);
+    }
+
+    /**
+     * 生成领料单前校验(Ajax)
+     */
+    public function checkPicking()
+    {
+        $result = $this->validatePicking(input('temp'));
+        if ($result['valid']) {
+            $this->success('可以生成领料单');
+        }
+        $this->error($result['msg']);
+    }
+
+    /**
+     * 校验选中工单是否具备领料配方数据
+     */
+    protected function validatePicking($data)
+    {
+        $gdbh = array_filter(explode(',', $data));
+        if (empty($gdbh)) {
+            return ['valid' => false, 'msg' => '请先选择要生成领料单的工单'];
         }
+
         $list = [];
-        foreach ($gdbh as $key=>$value){
-            $sql = "SELECT GD_gdbh AS gdbh,成品名称 as name,Gd_cpdh AS cpdh,计划投料 AS num FROM `工单_基本资料` WHERE Gd_gdbh = {$value} AND `行号`= 1";
-            $res = Db::connect('db2')->query($sql);
+        foreach ($gdbh as $key => $value) {
+            $sql = "SELECT GD_gdbh AS gdbh,成品名称 as name,Gd_cpdh AS cpdh,计划投料 AS num FROM `工单_基本资料` WHERE Gd_gdbh = ? AND `行号`= 1";
+            $res = Db::connect('db2')->query($sql, [$value]);
+            if (empty($res[0])) {
+                return ['valid' => false, 'msg' => '查不到工单【' . $value . '】,请确认工单是否存在'];
+            }
             $list[$key] = $res[0];
         }
-        $consumeList = [];//原墨数据
+
+        $consumeList = [];
         $formulaList = [];
         $total = [];
-        foreach ($list as $k=>$val){
+        foreach ($list as $k => $val) {
+            $formulaList = [];
             $box = $this->isBigOrSmall(trim($val['name']));
-            if ($box == -1){
-                $this->error('系统找不到产品对应大小盒');
+            if ($box == -1) {
+                return ['valid' => false, 'msg' => '工单【' . $val['gdbh'] . '】产品【' . trim($val['name']) . '】无法识别大小盒类型,请联系开发人员'];
             }
             $productNumber = trim($val['cpdh']);
+            if ($productNumber === '') {
+                return ['valid' => false, 'msg' => '工单【' . $val['gdbh'] . '】产品编码为空,无法生成领料单'];
+            }
+
             $where = [];
-            $where[] = ['exp',Db::raw("FIND_IN_SET($productNumber,product_number)")];
-            $consume = Db::name('formula_consume')->where($where)->where('number','neq','')->where('box',$box)->field('ink,number,code')->select();
-            $formmula= Db::name('formula_detail')->where($where)->field('color,ink,ink_number,number,total,code')->select();
-//            dump($consume);die;
-            if (empty($consume)){
+            $where[] = ['exp', Db::raw("FIND_IN_SET(:pn, product_number)")];
+            $bind = ['pn' => $productNumber];
 
-                $this->error('产品代码未更新,请联系开发人员');
+            $consume = Db::name('formula_consume')
+                ->bind($bind)
+                ->where($where)
+                ->where('number', 'neq', '')
+                ->where('box', $box)
+                ->field('ink,number,code')
+                ->select();
+
+            $formmula = Db::name('formula_detail')->bind($bind)->where($where)->field('color,ink,ink_number,number,total,code')->select();
+
+            if (empty($consume)) {
+                return ['valid' => false, 'msg' => '工单【' . $val['gdbh'] . '】产品编码【' . $productNumber . '】未配置原墨消耗配方,请联系开发人员维护后再生成领料单'];
             }
 
             $num = count($consume);
-            for ($i=0;$i<$num;$i++){
-                $weight = round(trim($consume[$i]['number']) * $val['num'] / 10000,3);
+            for ($i = 0; $i < $num; $i++) {
+                $weight = round(trim($consume[$i]['number']) * $val['num'] / 10000, 3);
                 $consume[$i]['number'] = $weight;
 
-                if (empty($consume[$i]['code'])){
-                    foreach ($formmula as $j=>$v){
-                        if ($v['color'] == $consume[$i]['ink']){
+                if (empty($consume[$i]['code'])) {
+                    foreach ($formmula as $j => $v) {
+                        if ($v['color'] == $consume[$i]['ink']) {
                             $formulaList['ink'] = $v['ink'];
-                            $formulaList['number'] = round($weight / $v['number'] * $v['total'] /1000,3); //计划用量/固定数值*总计用量
+                            $formulaList['number'] = round($weight / $v['number'] * $v['total'] / 1000, 3);
                             $formulaList['code'] = $v['code'];
-                            array_push($consume,$formulaList);
+                            array_push($consume, $formulaList);
                         }
-
                     }
                     unset($consume[$i]);
                 }
-
             }
-            //得到专墨分解成原墨的数据 、 原墨与专墨分解的原墨相加
             $consume = array_values($consume);
 
-            foreach ($consume as &$item){
-                $sql = "";
-                $total[] = $item;//做为返回总量数据数组
+            foreach ($consume as &$item) {
+                $total[] = $item;
             }
             $consumeList[$k]['gdbh'] = $val['gdbh'];
             $consumeList[$k]['cpdh'] = $val['cpdh'];
             $consumeList[$k]['name'] = trim($val['name']);
             $consumeList[$k]['num'] = $val['num'];
-            $consumeList[$k]['inkData'] = $this->sumWeight($consume,'code','number');
+            $consumeList[$k]['inkData'] = $this->sumWeight($consume, 'code', 'number');
             $consumeList[$k]['total'] = count($consumeList[$k]['inkData']);
-
         }
-        $bach = date('Ymd').rand(100,1000);
-        $totalList = $this->sumWeight($total,'code','number');
-        return $this->view->fetch('add',compact('consumeList','totalList','bach'));
+
+        $bach = date('Ymd') . rand(100, 1000);
+        $totalList = $this->sumWeight($total, 'code', 'number');
+        return [
+            'valid' => true,
+            'msg' => 'ok',
+            'data' => compact('consumeList', 'totalList', 'bach'),
+        ];
     }
     /**
      * 新增领料单数据保存

+ 10 - 0
application/admin/lang/zh-cn/picking.php

@@ -0,0 +1,10 @@
+<?php
+
+return [
+    'Picking' => '领料单编码',
+    'Order'   => '工单编号',
+    'Matter'  => '原墨名称',
+    'Code'    => '存货编码',
+    'Weight'  => '重量(kg)',
+    'Create'  => '创建时间',
+];

+ 5 - 2
application/admin/view/collar_use/back.html

@@ -119,9 +119,12 @@
     $('#basic-addon3').click(function(){
         // $("#bach").val('');
     })
+    function isOrderNumber(val) {
+        return /^\d{7}$/.test(val) || /^Y\d{7}$/i.test(val);
+    }
     $("#bach").bind('input propertychange', function() {
         var bach = $(this).val();
-        if (bach.length == 7){
+        if (isOrderNumber(bach)){
             $('#bach').attr('disabled',true);
             $('.color_bach').text('专色墨/原墨名称');
             $.ajax({
@@ -218,7 +221,7 @@
             return false;
         }
         var bach = $('#bach').val();
-        if (bach.length == 7){
+        if (isOrderNumber(bach)){
             var code = 1;
             var data = getData(code);
         }else{

+ 3 - 0
application/admin/view/order/machine_collar_show.html

@@ -1,6 +1,9 @@
 <div class="panel panel-default panel-intro">
     {:build_heading()}
     <div class="panel-body">
+        {if isset($tip) && $tip}
+        <div class="alert alert-warning text-center" style="margin: 20px;">{$tip}</div>
+        {/if}
         <div id="myTabContent" class="tab-content">
             <div class="tab-pane fade active in" id="one">
                 <div class="widget-body no-padding">

+ 88 - 23
application/admin/view/order/machine_situation.html

@@ -6,44 +6,66 @@
 </head>
 <body>
 <style>
+    * {
+        box-sizing: border-box;
+    }
+
+    html, body {
+        width: 100%;
+        margin: 0;
+        padding: 0;
+    }
+
     table {
         border-collapse: collapse;
         border-spacing: 0;
     }
 
-    td,th {
+    td, th {
         padding: 0;
     }
 
+    .whole {
+        display: flex;
+        flex-wrap: wrap;
+        align-items: flex-start;
+        gap: 16px;
+        width: 100%;
+        padding: 16px;
+    }
+
     .pure-table {
         border-collapse: collapse;
         border-spacing: 0;
         empty-cells: show;
         border: 1px solid #cbcbcb;
+        width: 100%;
+        table-layout: fixed;
+        word-break: break-all;
     }
 
     .pure-table caption {
         color: #000;
-        font: italic 85%/1 arial,sans-serif;
+        font: italic 85%/1 arial, sans-serif;
         padding: 1em 0;
         text-align: center;
     }
 
-    .pure-table td,.pure-table th {
+    .pure-table td, .pure-table th {
         border-left: 1px solid #cbcbcb;
         border-width: 0 0 0 1px;
-        font-size: inherit;
+        font-size: 14px;
         margin: 0;
-        overflow: visible;
-        padding: .5em 1em;
-        text-align: center
+        overflow: hidden;
+        padding: .5em .6em;
+        text-align: center;
     }
 
     .pure-table thead {
         background-color: #e0e0e0;
         color: #000;
-        text-align: left;
-        vertical-align: bottom;
+        text-align: center;
+        vertical-align: middle;
     }
 
     .pure-table td {
@@ -54,25 +76,68 @@
         border-bottom: 1px solid #cbcbcb;
     }
 
-    .pure-table-bordered tbody>tr:last-child>td {
+    .pure-table-bordered tbody > tr:last-child > td {
         border-bottom-width: 0;
     }
-    .machine{
-        width: 32%;
-        height:70%;/*900px*/
-        border:1px dashed black;
-        display: inline-block;
-        float: left;
+
+    .machine {
+        flex: 1 1 calc(33.333% - 16px);
+        min-width: 300px;
+        max-width: 100%;
+        border: 1px dashed #999;
+        padding: 12px;
+        height: auto;
+        max-height: calc(100vh - 100px);
+        overflow-y: auto;
+        background: #fff;
     }
-    .machine h1{
+
+    .machine h1 {
         text-align: center;
+        margin: 0 0 12px;
+        font-size: 20px;
     }
-    .machine h2{
+
+    .machine h2 {
         text-align: center;
     }
-    .machine table{
+
+    .machine .order {
+        margin-bottom: 16px;
+    }
+
+    .machine table {
         margin: 0 auto;
-        width: 450px;
+        width: 100%;
+    }
+
+    .zcolor {
+        cursor: pointer;
+        text-decoration: underline;
+    }
+
+    @media (max-width: 1400px) {
+        .machine {
+            flex: 1 1 calc(50% - 16px);
+        }
+    }
+
+    @media (max-width: 768px) {
+        .whole {
+            padding: 10px;
+            gap: 10px;
+        }
+
+        .machine {
+            flex: 1 1 100%;
+            min-width: 0;
+            max-height: none;
+        }
+
+        .pure-table td, .pure-table th {
+            font-size: 12px;
+            padding: .4em .3em;
+        }
     }
 </style>
 <script src="__CDN__/assets/js/jquery2.1.1.min.js"></script>
@@ -90,7 +155,7 @@
                 <thead>
                     <tr>
                         <th>工单号</th>
-                        <th style="width: 120px;">专色墨</th>
+                        <th>专色墨</th>
                         <th>领用(kg)</th>
                         <th>退还(kg)</th>
                     </tr>
@@ -99,7 +164,7 @@
                     <tbody>
                     <tr>
                         <td>{$val.order_number}</td>
-                        <td class="zcolor" data-type="1" style="width: 150px;cursor: pointer; text-decoration: underline">{$val.color}</td>
+                        <td class="zcolor" data-type="1">{$val.color}</td>
                         <td>{$val.weight}</td>
                         {if $val.back_weight eq ''}
                         <td ><span style="color: red">*</span></td>
@@ -113,7 +178,7 @@
                     <tbody>
                     <tr>
                         <td>{$val.order_number}</td>
-                        <td class="zcolor" data-type="2" style="width: 130px;cursor: pointer; text-decoration: underline">{$val.ink_name}</td>
+                        <td class="zcolor" data-type="2">{$val.ink_name}</td>
                         <td >{$val.out_weight}</td>
                         {if $val.back_weight eq ''}
                         <td ><span style="color: red">*</span></td>

+ 16 - 0
application/common/controller/Backend.php

@@ -524,4 +524,20 @@ class Backend extends Controller
         //刷新Token
         $this->request->token();
     }
+
+    /**
+     * 弹窗页面错误提示:父页面 Toast 提示并关闭弹窗,避免跳转错误页
+     * @param string $msg
+     */
+    protected function dialogError($msg = '')
+    {
+        if ($this->request->param('dialog')) {
+            $script = '<script>(function(){var msg=' . json_encode($msg, JSON_UNESCAPED_UNICODE) . ';'
+                . 'if(parent.Toastr){parent.Toastr.error(msg);}else if(parent.Layer){parent.Layer.msg(msg,{icon:2,time:3000});}'
+                . 'var index=parent.Layer?parent.Layer.getFrameIndex(window.name):null;'
+                . 'if(index){parent.Layer.close(index);}})();</script>';
+            throw new \think\exception\HttpResponseException(response($script, 200, ['Content-Type' => 'text/html;charset=utf-8']));
+        }
+        $this->error($msg, '', '', 0);
+    }
 }

+ 1 - 1
application/config.php

@@ -351,7 +351,7 @@ return [
         // 数据库名
         'database'        => Env::get('database.database', 'zjmn_mes'),
         // 用户名
-        'username'        => Env::get('database.username', 'zjmn_mes'),
+        'username'        => Env::get('database.username', 'zjminong'),
         // 密码
         'password'        => Env::get('database.password', '83h2)$3^kd(up^w'),
         // 端口

+ 13 - 3
application/database.php

@@ -15,14 +15,24 @@ use think\Env;
 return [
     // 数据库类型
     'type'            => Env::get('database.type', 'mysql'),
+
     // 服务器地址
-    'hostname'        => Env::get('database.hostname', 'rm-bp17w41t6c09dl10ayo.mysql.rds.aliyuncs.com'),
+    'hostname'        => Env::get('database.hostname', '127.0.0.1'),
     // 数据库名
     'database'        => Env::get('database.database', 'tool_7in6_com'),
     // 用户名
-    'username'        => Env::get('database.username', 'tool_7in6_com'),
+    'username'        => Env::get('database.username', 'root'),
     // 密码
-    'password'        => Env::get('database.password', '2K!pD9@xR4&yS7$z'),
+    'password'        => Env::get('database.password', 'root'),
+
+//    // 服务器地址
+//    'hostname'        => Env::get('database.hostname', 'rm-bp17w41t6c09dl10ayo.mysql.rds.aliyuncs.com'),
+//    // 数据库名
+//    'database'        => Env::get('database.database', 'tool_7in6_com'),
+//    // 用户名
+//    'username'        => Env::get('database.username', 'tool_7in6_com'),
+//    // 密码
+//    'password'        => Env::get('database.password', '2K!pD9@xR4&yS7$z'),
     // 端口
     'hostport'        => Env::get('database.hostport', ''),
     // 连接dsn

+ 8 - 0
application/index/controller/Index.php

@@ -16,4 +16,12 @@ class Index extends Frontend
         return $this->view->fetch();
     }
 
+    /**
+     * 油墨智能管理系统宣传页(手机端)
+     */
+    public function ink()
+    {
+        return $this->view->fetch();
+    }
+
 }

+ 550 - 0
application/index/view/index/ink.html

@@ -0,0 +1,550 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
+    <meta name="description" content="美浓云印刷油墨智能管理系统 - 专色墨领用、领料单、配方指令书、机台领退料一体化管理">
+    <title>美浓云 · 印刷油墨智能管理系统</title>
+    <style>
+        :root {
+            --bg: #05070a;
+            --bg-card: rgba(255, 255, 255, 0.04);
+            --border: rgba(255, 255, 255, 0.08);
+            --text: #f5f7ff;
+            --muted: #9aa3b2;
+            --primary: #6366f1;
+            --cyan: #06b6d4;
+            --orange: #f97316;
+            --green: #22c55e;
+            --gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
+            --radius: 18px;
+        }
+
+        * { box-sizing: border-box; margin: 0; padding: 0; }
+
+        html { scroll-behavior: smooth; }
+
+        body {
+            font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
+            background: var(--bg);
+            color: var(--text);
+            line-height: 1.6;
+            overflow-x: hidden;
+        }
+
+        body::before {
+            content: "";
+            position: fixed;
+            inset: 0;
+            background:
+                radial-gradient(circle at 20% 10%, rgba(99, 102, 241, 0.18), transparent 35%),
+                radial-gradient(circle at 80% 20%, rgba(6, 182, 212, 0.12), transparent 30%),
+                radial-gradient(circle at 50% 80%, rgba(249, 115, 22, 0.08), transparent 35%);
+            pointer-events: none;
+            z-index: 0;
+        }
+
+        .wrap { position: relative; z-index: 1; max-width: 480px; margin: 0 auto; }
+
+        .nav {
+            position: sticky;
+            top: 0;
+            z-index: 100;
+            display: flex;
+            align-items: center;
+            justify-content: space-between;
+            padding: 14px 18px;
+            background: rgba(5, 7, 10, 0.85);
+            backdrop-filter: blur(12px);
+            border-bottom: 1px solid var(--border);
+        }
+
+        .logo {
+            display: flex;
+            align-items: center;
+            gap: 10px;
+            font-weight: 700;
+            font-size: 16px;
+        }
+
+        .logo-icon {
+            width: 32px;
+            height: 32px;
+            border-radius: 10px;
+            background: var(--gradient);
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-size: 14px;
+            font-weight: 800;
+        }
+
+        .menu-btn {
+            width: 36px;
+            height: 36px;
+            border: 1px solid var(--border);
+            border-radius: 10px;
+            background: transparent;
+            color: var(--text);
+            font-size: 18px;
+        }
+
+        .nav-links {
+            display: none;
+            position: absolute;
+            top: 100%;
+            left: 0;
+            right: 0;
+            background: rgba(10, 12, 18, 0.98);
+            border-bottom: 1px solid var(--border);
+            padding: 12px 18px 18px;
+        }
+
+        .nav-links.open { display: block; }
+
+        .nav-links a {
+            display: block;
+            color: var(--muted);
+            text-decoration: none;
+            padding: 10px 0;
+            font-size: 14px;
+        }
+
+        .section { padding: 28px 18px; }
+
+        .badge {
+            display: inline-flex;
+            align-items: center;
+            gap: 6px;
+            padding: 6px 12px;
+            border-radius: 999px;
+            border: 1px solid var(--border);
+            background: rgba(255, 255, 255, 0.03);
+            color: var(--muted);
+            font-size: 12px;
+            margin-bottom: 16px;
+        }
+
+        .badge-dot {
+            width: 6px;
+            height: 6px;
+            border-radius: 50%;
+            background: var(--cyan);
+            box-shadow: 0 0 8px var(--cyan);
+        }
+
+        h1 {
+            font-size: 30px;
+            line-height: 1.25;
+            font-weight: 800;
+            margin-bottom: 14px;
+        }
+
+        .gradient-text {
+            background: var(--gradient);
+            -webkit-background-clip: text;
+            -webkit-text-fill-color: transparent;
+            background-clip: text;
+        }
+
+        .hero-desc {
+            color: var(--muted);
+            font-size: 14px;
+            margin-bottom: 18px;
+        }
+
+        .tags {
+            display: flex;
+            flex-wrap: wrap;
+            gap: 8px;
+            margin-bottom: 22px;
+        }
+
+        .tag {
+            padding: 6px 10px;
+            border-radius: 8px;
+            font-size: 12px;
+            border: 1px solid var(--border);
+            background: rgba(255, 255, 255, 0.03);
+        }
+
+        .tag.orange { color: #fdba74; border-color: rgba(249, 115, 22, 0.3); }
+        .tag.green { color: #86efac; border-color: rgba(34, 197, 94, 0.3); }
+        .tag.cyan { color: #67e8f9; border-color: rgba(6, 182, 212, 0.3); }
+
+        .btn-row { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
+
+        .btn {
+            display: block;
+            text-align: center;
+            padding: 14px 18px;
+            border-radius: 14px;
+            font-size: 15px;
+            font-weight: 600;
+            text-decoration: none;
+            border: none;
+        }
+
+        .btn-primary {
+            background: var(--gradient);
+            color: #fff;
+            box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
+        }
+
+        .btn-ghost {
+            background: transparent;
+            color: var(--text);
+            border: 1px solid var(--border);
+        }
+
+        .dashboard {
+            border: 1px solid var(--border);
+            border-radius: 20px;
+            background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
+            padding: 16px;
+            margin-top: 8px;
+        }
+
+        .dashboard-title {
+            font-size: 12px;
+            color: var(--muted);
+            margin-bottom: 12px;
+            display: flex;
+            justify-content: space-between;
+        }
+
+        .stats {
+            display: grid;
+            grid-template-columns: repeat(3, 1fr);
+            gap: 8px;
+            margin-bottom: 12px;
+        }
+
+        .stat {
+            background: rgba(0, 0, 0, 0.25);
+            border: 1px solid var(--border);
+            border-radius: 12px;
+            padding: 10px 8px;
+            text-align: center;
+        }
+
+        .stat b {
+            display: block;
+            font-size: 18px;
+            margin-bottom: 2px;
+        }
+
+        .stat span {
+            font-size: 10px;
+            color: var(--muted);
+            line-height: 1.3;
+        }
+
+        .progress-item {
+            margin-top: 10px;
+            font-size: 12px;
+        }
+
+        .progress-bar {
+            height: 6px;
+            background: rgba(255,255,255,0.08);
+            border-radius: 999px;
+            margin-top: 6px;
+            overflow: hidden;
+        }
+
+        .progress-bar i {
+            display: block;
+            height: 100%;
+            border-radius: 999px;
+            background: var(--gradient);
+        }
+
+        .section-label {
+            font-size: 12px;
+            color: var(--orange);
+            margin-bottom: 8px;
+        }
+
+        h2 {
+            font-size: 24px;
+            line-height: 1.3;
+            margin-bottom: 10px;
+            font-weight: 800;
+        }
+
+        .section-desc {
+            color: var(--muted);
+            font-size: 14px;
+            margin-bottom: 18px;
+        }
+
+        .card {
+            border: 1px solid var(--border);
+            border-radius: var(--radius);
+            background: var(--bg-card);
+            padding: 16px;
+            margin-bottom: 12px;
+        }
+
+        .card-icon {
+            width: 40px;
+            height: 40px;
+            border-radius: 12px;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            font-size: 20px;
+            margin-bottom: 10px;
+            background: rgba(99, 102, 241, 0.15);
+        }
+
+        .card h3 {
+            font-size: 16px;
+            margin-bottom: 6px;
+        }
+
+        .card p {
+            font-size: 13px;
+            color: var(--muted);
+        }
+
+        .feature-num {
+            font-size: 11px;
+            color: var(--cyan);
+            margin-bottom: 6px;
+            font-weight: 700;
+        }
+
+        .compare-table {
+            width: 100%;
+            border-collapse: collapse;
+            font-size: 12px;
+            margin-top: 8px;
+        }
+
+        .compare-table th,
+        .compare-table td {
+            border: 1px solid var(--border);
+            padding: 10px 8px;
+            text-align: left;
+            vertical-align: top;
+        }
+
+        .compare-table th {
+            background: rgba(255,255,255,0.04);
+            color: var(--muted);
+            font-weight: 600;
+        }
+
+        .ok { color: var(--green); }
+        .no { color: #f87171; }
+
+        .cta {
+            text-align: center;
+            padding: 36px 18px 48px;
+            border-top: 1px solid var(--border);
+            background: linear-gradient(180deg, transparent, rgba(99,102,241,0.08));
+        }
+
+        .cta h2 { font-size: 22px; margin-bottom: 10px; }
+
+        .footer {
+            text-align: center;
+            padding: 0 18px 30px;
+            color: var(--muted);
+            font-size: 11px;
+        }
+    </style>
+</head>
+<body>
+<div class="wrap">
+    <nav class="nav">
+        <div class="logo">
+            <div class="logo-icon">墨</div>
+            <span>美浓云油墨</span>
+        </div>
+        <button class="menu-btn" id="menuBtn" aria-label="菜单">☰</button>
+        <div class="nav-links" id="navLinks">
+            <a href="#pain">管理痛点</a>
+            <a href="#features">核心能力</a>
+            <a href="#compare">对比优势</a>
+            <a href="#cta">联系我们</a>
+        </div>
+    </nav>
+
+    <section class="section hero">
+        <div class="badge"><span class="badge-dot"></span>印刷油墨智能管理系统 · 专为烟包印刷车间打造</div>
+        <h1>工单来了,<span class="gradient-text">油墨跟得上吗?</span></h1>
+        <p class="hero-desc">从工单排产到专色墨领用、原墨出库、机台退料,车间每一克油墨都关乎交付与成本。美浓云油墨系统是您车间里的「油墨指挥官」。</p>
+        <div class="tags">
+            <span class="tag orange">领料单管理</span>
+            <span class="tag green">指令书打印</span>
+            <span class="tag cyan">机台领退料</span>
+        </div>
+        <div class="btn-row">
+            <a class="btn btn-primary" href="#cta">立即咨询</a>
+            <a class="btn btn-ghost" href="#features">探索能力 →</a>
+        </div>
+
+        <div class="dashboard">
+            <div class="dashboard-title">
+                <span>油墨智能看板 · 实时</span>
+                <span>⚡ 在线</span>
+            </div>
+            <div class="stats">
+                <div class="stat">
+                    <b>128</b>
+                    <span>今日领用批次</span>
+                </div>
+                <div class="stat">
+                    <b>7台</b>
+                    <span>机台同步监控</span>
+                </div>
+                <div class="stat">
+                    <b>99%</b>
+                    <span>配方匹配率</span>
+                </div>
+            </div>
+            <div class="progress-item">
+                <div>JY4号机 · 专色墨领用进度</div>
+                <div class="progress-bar"><i style="width:86%"></i></div>
+            </div>
+            <div class="progress-item">
+                <div>今日领料单生成 · 待生产工单</div>
+                <div class="progress-bar"><i style="width:72%"></i></div>
+            </div>
+        </div>
+    </section>
+
+    <section class="section" id="pain">
+        <div class="section-label">⚠️ 车间管理的「隐形损耗」</div>
+        <h2>订单接住了,<span class="gradient-text">油墨管住了吗?</span></h2>
+        <p class="section-desc">Excel 记台账、人工对配方、领退料靠经验——专色墨损耗高、追溯难、罚款风险大,是烟包印刷车间的普遍痛点。</p>
+
+        <div class="card">
+            <div class="card-icon">⏳</div>
+            <h3>领料靠人工,工单对不上</h3>
+            <p>待生产工单与配方脱节,领料单手工汇总,漏领、多领、错领频发,影响开机效率。</p>
+        </div>
+        <div class="card">
+            <div class="card-icon">📋</div>
+            <h3>指令书更新慢,配方对不上</h3>
+            <p>产品代码变更后配方未及时维护,按纸张/按重量两种指令书难以快速生成。</p>
+        </div>
+        <div class="card">
+            <div class="card-icon">🏷️</div>
+            <h3>机台领退料难追溯</h3>
+            <p>各机台专色墨、原墨领用与退料分散记录,退料遗漏、批次对不上,成本核算困难。</p>
+        </div>
+    </section>
+
+    <section class="section" id="features">
+        <div class="section-label">🚀 核心能力</div>
+        <h2>油墨管理的<span class="gradient-text">硬核引擎</span></h2>
+        <p class="section-desc">不是简单进销存,而是贯穿配方、领料、指令书、机台领退料的全流程油墨 MES。</p>
+
+        <div class="card">
+            <div class="feature-num">01</div>
+            <div class="card-icon">⚡</div>
+            <h3>待生产工单 · 一键领料单</h3>
+            <p>对接 MES 工单,按机台筛选待生产任务,勾选后自动生成汇总领料单,支持加急单录入。</p>
+        </div>
+        <div class="card">
+            <div class="feature-num">02</div>
+            <div class="card-icon">📄</div>
+            <h3>油墨指令书双模式</h3>
+            <p>支持按纸张数、按油墨重量两种指令书生成,配方明细与大小盒消耗自动计算。</p>
+        </div>
+        <div class="card">
+            <div class="feature-num">03</div>
+            <div class="card-icon">🎨</div>
+            <h3>专色墨领用退还</h3>
+            <p>扫码工单即可领用,专色墨与原墨分账管理,一键出库、一键退库,标签打印无缝对接。</p>
+        </div>
+        <div class="card">
+            <div class="feature-num">04</div>
+            <div class="card-icon">🏭</div>
+            <h3>各机台领退料看板</h3>
+            <p>7 台印刷机实时展示领用与退料情况,点击专色墨可下钻查看批次明细。</p>
+        </div>
+        <div class="card">
+            <div class="feature-num">05</div>
+            <div class="card-icon">📦</div>
+            <h3>库存与配方联动</h3>
+            <p>原墨、专色墨库存实时更新,配方消耗与入库明细联动,账实一致。</p>
+        </div>
+        <div class="card">
+            <div class="feature-num">06</div>
+            <div class="card-icon">📊</div>
+            <h3>报表中心多维统计</h3>
+            <p>每日油墨领用统计、机台消耗分析、领退料汇总,管理决策有据可依。</p>
+        </div>
+    </section>
+
+    <section class="section" id="compare">
+        <div class="section-label">⚖️ 对比</div>
+        <h2>传统台账 vs <span class="gradient-text">美浓云油墨系统</span></h2>
+        <p class="section-desc">同样是管油墨,智能系统能解决台账管不到的车间细节。</p>
+        <table class="compare-table">
+            <tr>
+                <th>管理维度</th>
+                <th>传统方式</th>
+                <th>美浓云系统</th>
+            </tr>
+            <tr>
+                <td>领料单生成</td>
+                <td class="no">✕ 手工汇总</td>
+                <td class="ok">✓ 工单勾选一键生成</td>
+            </tr>
+            <tr>
+                <td>配方匹配</td>
+                <td class="no">✕ 人工核对易出错</td>
+                <td class="ok">✓ 产品编码自动关联</td>
+            </tr>
+            <tr>
+                <td>机台领退料</td>
+                <td class="no">✕ 分散记录难追溯</td>
+                <td class="ok">✓ 机台看板实时可视</td>
+            </tr>
+            <tr>
+                <td>指令书打印</td>
+                <td class="no">✕ 模板固定、更新慢</td>
+                <td class="ok">✓ 双模式自动生成</td>
+            </tr>
+            <tr>
+                <td>库存账实</td>
+                <td class="no">✕ 滞后、对账难</td>
+                <td class="ok">✓ 领退料联动即时更新</td>
+            </tr>
+        </table>
+    </section>
+
+    <section class="cta" id="cta">
+        <h2>让每一克油墨<br><span class="gradient-text">都可追溯、可管控</span></h2>
+        <p class="section-desc">不再为领料差错焦虑,不再怕配方对不上工单。<br>美浓云油墨智能管理系统,助您掌控车间油墨全流程。</p>
+        <div class="btn-row" style="max-width:320px;margin:0 auto;">
+            <a class="btn btn-primary" href="tel:4000000000">📞 预约专属演示</a>
+            <a class="btn btn-ghost" href="/bKdNvCxlao.php">进入管理系统</a>
+        </div>
+        <p style="font-size:11px;color:var(--muted);margin-top:14px;">* 对接 MES 工单 · 支持扫码领退料 · 快速上线</p>
+    </section>
+
+    <div class="footer">
+        <strong>美浓云印刷油墨智能管理系统</strong><br>
+        浙江美浓世纪集团 · © 2026
+    </div>
+</div>
+
+<script>
+    document.getElementById('menuBtn').addEventListener('click', function () {
+        document.getElementById('navLinks').classList.toggle('open');
+    });
+    document.querySelectorAll('.nav-links a').forEach(function (link) {
+        link.addEventListener('click', function () {
+            document.getElementById('navLinks').classList.remove('open');
+        });
+    });
+</script>
+</body>
+</html>

+ 19 - 10
public/assets/js/backend/collar_use.js

@@ -85,24 +85,33 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 search:false,
             });
 
+            var isOrderNumber = function (bach) {
+                return /^\d{7}$/.test(bach) || /^Y\d{7}$/i.test(bach);
+            };
+            var openAddDialog = function (bach) {
+                Fast.api.ajax({
+                    url: 'collar_use/checkOrder',
+                    data: {bach: bach}
+                }, function () {
+                    var str = 'bach=' + bach;
+                    $('.btn-add').attr('data-params', str);
+                    $('.btn-add').click();
+                });
+            };
             $("div.input-group .form-control").bind('input propertychange', function() {
                 var bach = $(this).val();
-                if (bach.length == 7){
-                    $('#basic-addon2').click();
-                }else{
-                    var str = bach.substr(0,7);
-                    $(this).val(str);
-                    $('#basic-addon2').click();
+                if (isOrderNumber(bach)){
+                    openAddDialog(bach);
                 }
             })
             $('#basic-addon2').click(function(){
                 var bach = $("div.input-group .form-control").val();
 
-                if (bach.length == 7){
-                    var str = 'bach=' + bach;
-                    $('.btn-add').attr('data-params',str);
-                    $('.btn-add').click();
+                if (isOrderNumber(bach)){
+                    openAddDialog(bach);
                     return false;
+                } else {
+                    Toastr.error('请输入7位数字或Y开头的8位工单号');
                 }
 
             })

+ 8 - 0
public/assets/js/backend/order.js

@@ -11,12 +11,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             });
 
             var table = $("#table");
+            var calcTableHeight = function () {
+                return Math.max(300, $(window).height() - table.offset().top - 30);
+            };
             //当表格数据加载完成时
             table.on('load-success.bs.table', function (e, data) {
                 //这里可以获取从服务端获取的JSON数据
                 // console.log(data);
                 $("div.search .form-control").focus();
                 $(".btn-dialog").data("area", ["100%","100%"]);
+                table.bootstrapTable('resetView', {height: calcTableHeight()});
             });
             // 初始化表格
             table.bootstrapTable({
@@ -24,6 +28,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'gd_gdbh',
                 sortName: 'gd_gdbh',
+                height: calcTableHeight(),
                 columns: [
                     [
                         {field: 'operate', title: '按纸张数增加指令书', table: table,
@@ -66,6 +71,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 // searchFormVisible: false,
 
             });
+            $(window).on('resize', function () {
+                table.bootstrapTable('resetView', {height: calcTableHeight()});
+            });
 
             $(".form-control").bind('input propertychange', function() {
                 var gdbh = $(this).val();

+ 22 - 11
public/assets/js/backend/picking.js

@@ -64,11 +64,15 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
             });
 
             var table = $("#table");
+            var calcTableHeight = function () {
+                return Math.max(300, $(window).height() - table.offset().top - 30);
+            };
             // 初始化表格
             table.bootstrapTable({
                 url: $.fn.bootstrapTable.defaults.extend.index_url,
                 pk: 'id',
                 sortName: 'Gy0_sbbh',
+                height: calcTableHeight(),
                 columns: [
                     [
                         {checkbox: true,},
@@ -92,6 +96,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 pageSize: 50,
 
             });
+            $(window).on('resize', function () {
+                table.bootstrapTable('resetView', {height: calcTableHeight()});
+            });
+            table.on('load-success.bs.table', function () {
+                table.bootstrapTable('resetView', {height: calcTableHeight()});
+            });
+            var openPickingDialog = function (ids) {
+                Fast.api.ajax({
+                    url: 'picking/checkPicking',
+                    data: {temp: ids}
+                }, function () {
+                    Fast.config.openArea = ['100%', '100%'];
+                    Fast.api.open("Picking/picking?temp=" + ids, "生成领料单", {});
+                });
+            };
             $("#button").on("click",function(){
                 var temp=table.bootstrapTable('getSelections');
 
@@ -101,14 +120,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                 }
 
                 if (ids == ''){
+                    Toastr.error('请先选择要生成领料单的工单');
                     return false;
                 }
-                Fast.config.openArea = ['100%','100%'];
-                //发送给控制器
-                Fast.api.open("Picking/picking?temp="+ids, "生成领料单", {
-
-                });
-            
+                openPickingDialog(ids);
             });
             $("#urgent").on("click",function () {
                 var html = '';
@@ -131,11 +146,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
                     return false;
                 }
                 layer.close(layer.index);
-                Fast.config.openArea = ['100%','100%'];
-                //发送给控制器
-                Fast.api.open("Picking/picking?temp="+order, "生成领料单", {
-
-                });
+                openPickingDialog(order);
             })
             // 为表格绑定事件
             Table.api.bindevent(table);