1
0

2 Revīzijas 9d34c0f2d0 ... 53c9d5c3a6

Autors SHA1 Ziņojums Datums
  hzd 53c9d5c3a6 需求优化 4 mēneši atpakaļ
  hzd 40329e2852 需求修改 4 mēneši atpakaļ
33 mainītis faili ar 1283 papildinājumiem un 62 dzēšanām
  1. 21 0
      api.http
  2. 33 0
      application/admin/controller/MateCheck.php
  3. 43 2
      application/admin/controller/Orders.php
  4. 3 3
      application/admin/controller/WasteApply.php
  5. 3 3
      application/admin/controller/WasteApplyOption.php
  6. 247 1
      application/admin/controller/WasteRecord.php
  7. 25 1
      application/admin/controller/WasteType.php
  8. 1 1
      application/admin/view/device/add.html
  9. 5 0
      application/admin/view/mate_check/info.html
  10. 5 0
      application/admin/view/orders/batchsend.html
  11. 58 6
      application/admin/view/orders/convey.html
  12. 14 14
      application/admin/view/orders/dispatch_add3.html
  13. 14 14
      application/admin/view/orders/self_add3.html
  14. 29 0
      application/admin/view/todo/detail.html
  15. 29 0
      application/admin/view/todo/detail3.html
  16. 59 0
      application/admin/view/waste_record/add.html
  17. 3 1
      application/admin/view/waste_record/index.html
  18. 195 0
      application/admin/view/waste_record/index2.html
  19. 197 0
      application/admin/view/waste_record/index3.html
  20. 7 0
      application/admin/view/waste_type/index.html
  21. 1 1
      application/api/controller/screen/Convey.php
  22. 54 0
      application/api/controller/v1/OrderDelay.php
  23. 22 0
      application/api/controller/v1/User.php
  24. 1 1
      application/common/model/Address.php
  25. 1 1
      application/common/model/Device.php
  26. 9 2
      application/common/model/Orders.php
  27. 25 0
      application/common/model/Todo.php
  28. 7 5
      application/common/model/WasteRecord.php
  29. 4 4
      application/common/model/WasteType.php
  30. 2 2
      application/common/validate/Device.php
  31. 23 0
      application/h5/controller/Statistics.php
  32. 143 0
      application/h5/view/statistics/waste.html
  33. BIN
      public/logo.png

+ 21 - 0
api.http

@@ -0,0 +1,21 @@
+POST http://jili2.demo.com/api/v1/OrderDelay/reasons
+Content-Type: application/x-www-form-urlencoded
+
+token=1467914623510020&userId=823&orgId=3
+
+###
+
+POST http://jili2.demo.com/api/v1/OrderDelay/add
+Content-Type: application/x-www-form-urlencoded
+
+token=1467914623510020&userId=823&orgId=3&id=120513&delay_reason_id=1
+
+###
+
+
+POST http://jili2.demo.com/api/v1/OrderDelay/cancel
+Content-Type: application/x-www-form-urlencoded
+
+token=1467914623510020&userId=823&orgId=3
+
+###

+ 33 - 0
application/admin/controller/MateCheck.php

@@ -2,6 +2,7 @@
 namespace app\admin\controller;
 
 use app\common\model\MateGoodsLog;
+use app\common\util\ExcelUtil;
 use think\App;
 use think\Db;
 use think\Exception;
@@ -80,6 +81,38 @@ class MateCheck extends Auth
         return $this->fetch();
     }
 
+    //excel导出
+    public function export($id=0) {
+        set_time_limit(0);
+        ini_set("memory_limit","1024M");
+
+        $info = $this->model->getInfo($id);
+
+        $lists = $info['goods']?$info['goods']:[];
+        foreach ($lists as $k=>$v){
+            $lists[$k]['check_nums'] = "";
+            $lists[$k]['cy_nums'] = "";
+            $lists[$k]['check_time'] = "";
+            $lists[$k]['remark'] = "";
+        }
+
+        $header = [
+            ['title' => '名称', 'name' => 'title','width'=>'20'],
+            ['title' => '规格', 'name' => 'spec','width'=>'20'],
+            ['title' => '品牌', 'name' => 'brand','width'=>'20'],
+            ['title' => '单价', 'name' => 'price','width'=>'20'],
+            ['title' => '应盘数量', 'name' => 'nums','width'=>'20'],
+            ['title' => '实盘数量', 'name' => 'check_nums','width'=>'20'],
+            ['title' => '数量差异', 'name' => 'cy_nums','width'=>'20'],
+            ['title' => '盘点时间', 'name' => 'check_time','width'=>'20'],
+            ['title' => '盘点说明', 'name' => 'remark','width'=>'20'],
+        ];
+
+        $filename = '盘库';
+        ExcelUtil::export($filename,$header,$lists);
+
+    }
+
     public function check($id=0){
         if(request()->isPost()){
             $res = $this->model->checkGoods($this->userId);

+ 43 - 2
application/admin/controller/Orders.php

@@ -2,6 +2,7 @@
 
 namespace app\admin\controller;
 use app\common\model\Config;
+use app\common\util\AppMsg;
 use Overtrue\Pinyin\Pinyin;
 use think\App;
 use think\Db;
@@ -1080,6 +1081,17 @@ class Orders extends Auth {
                     ->where('todo_mode', 'in', [1, 2, 3])
                     ->count();
                 $newUser[$key]['nums'] = $nums;
+
+                $newUser[$key]['cur_status'] = 0; // 空闲
+                $nums2 = Db::name('todo')
+                    ->where(['to_user_id' => $value['id'], 'work_type_mode' => 3])
+                    ->where('todo_mode', 'in', [1, 2])
+                    ->count();
+                if($nums2 > 0){
+                    $newUser[$key]['cur_status'] = 1; // 任务中
+                }
+
+
                 $addr = Db::name('order_convey')
                     ->alias('cpr')
                     ->join('todo os', 'cpr.order_id = os.order_id')
@@ -1108,6 +1120,8 @@ class Orders extends Auth {
                 $newUser[$key]['sex_name'] = isset($mm->sex[$u])?$mm->sex[$u]:"";
 
             }
+
+            $newUser = list_sort_by($newUser,"addr_time", 'asc');
             if($this->orgId==3){
 //                echo "<pre/>";
 //                print_r($newUser);
@@ -1283,6 +1297,9 @@ class Orders extends Auth {
                 $x2 = date('Ymd', strtotime($xqtimes[1]));
                 $map[] = ['oc.xq_time', '>=', $x1];
                 $map[] = ['oc.xq_time', '<=', $x2];
+            }else{ // 默认只显示当天的订单
+               // $map[] = ['oc.xq_time', '>=', date("Y-m-d")." 00:00:00"];
+                $map[] = ['oc.xq_time', '<=', date("Y-m-d")." 23:59:59"];
             }
             if ($ywctime) {
                 $ywctimes = explode(' - ', $ywctime);
@@ -1324,7 +1341,7 @@ class Orders extends Auth {
                 ->where($map)
                 ->order(['o.order_mode' => 'asc', 'oc.xq_time' => 'desc'])
                 ->select();
-            halt($lists);
+//            halt($lists);
             $newret = [];
             $newret1 = [];
             $newret2 = [];
@@ -1361,6 +1378,7 @@ class Orders extends Auth {
                         }
                     }
                 }
+                $v['is_todo'] = $todo?1:0;
                 $v['real_names'] = implode(',', $users);
                 $v['confirm_time'] = $confirmtime;
                 $last = strtotime($v['ywc_time']) - time();
@@ -1578,6 +1596,18 @@ class Orders extends Auth {
             return $this->fetch();
         }
     }
+
+    public function reminder(){
+        $id = input('id/d',0);
+        $touserids = Db::name('todo')->where('order_id',$id)->where('todo_mode','in',[1,2])->where('del',0)->column('to_user_id');
+        if($touserids){
+            $touserids = array_unique($touserids);
+            send_jpush($touserids,AppMsg::PUSH_WORKER_ORDER_SEND,'您有订单需要处理');
+        }
+
+        $this->success('催单成功');
+    }
+
     //运送员状态
     public function conveystatus($id='') {
         if (request()->isAjax()) {
@@ -2065,7 +2095,8 @@ class Orders extends Auth {
                     ->setCellValue('E1', '报修类型')
                     ->setCellValue('F1', '状态')
                     ->setCellValue('G1', '紧急程度')
-                    ->setCellValue('H1', '来源');
+                    ->setCellValue('H1', '来源')
+                    ->setCellValue('I1', '物料');
             }
             else {
                 if ($mode == 3) {
@@ -2169,6 +2200,16 @@ class Orders extends Auth {
                     $objPHPExcel->getActiveSheet()->setCellValue('F' . ($i + 2), $lists[$i]['order_mode_text']);
                     $objPHPExcel->getActiveSheet()->setCellValue('G' . ($i + 2), $lists[$i]['repair_priority']);
                     $objPHPExcel->getActiveSheet()->setCellValue('H' . ($i + 2), $lists[$i]['source_type_text']);
+
+                    if(empty($lists[$i]['cons'])){
+                        $objPHPExcel->getActiveSheet()->setCellValue('I' . ($i + 2), "");
+                    }else{
+                        $consstr = [];
+                        foreach ($lists[$i]['cons'] as $kk=>$vv){
+                            $consstr[] = $vv['title'].'_'.$vv['total'].'_'.$vv['money']."_".$vv['total_money']."_".$vv['realName'];
+                        }
+                        $objPHPExcel->getActiveSheet()->setCellValue('I' . ($i + 2), implode(";",$consstr));
+                    }
                 }
             }
             else {

+ 3 - 3
application/admin/controller/WasteApply.php

@@ -90,7 +90,7 @@ class WasteApply extends Auth {
             return json($result);
         }
         else {
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $addr = model('Address')->getListByType(7,$this->orgId);
             $this->assign('addr', $addr);
             $this->assign('m_name', '修改申请');
@@ -125,7 +125,7 @@ class WasteApply extends Auth {
                 ->field('id,real_name as title')
                 ->select();
         }
-        $type = (new \app\common\model\WasteType())->getList();
+        $type = (new \app\common\model\WasteType())->getList($this->orgId);
         $addr = model('Address')->getListByType(7,$this->orgId);
         $this->assign('addr', $addr);
         $this->assign('type', $type);
@@ -184,7 +184,7 @@ class WasteApply extends Auth {
                     ->field('id,real_name as title')
                     ->select();
             }
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $addr = model('Address')->getListByType(7,$this->orgId);
             $this->assign('addr', $addr);
             $this->assign('type', $type);

+ 3 - 3
application/admin/controller/WasteApplyOption.php

@@ -97,7 +97,7 @@ class WasteApplyOption extends Auth {
             return json($result);
         }
         else {
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $addr = model('Address')->getListByType(7,$this->orgId);
             $this->assign('addr', $addr);
             $this->assign('m_name', '修改申请审核');
@@ -153,7 +153,7 @@ class WasteApplyOption extends Auth {
                     ->field('id,real_name as title')
                     ->select();
             }
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $addr = model('Address')->getListByType(7,$this->orgId);
             $this->assign('addr', $addr);
             $this->assign('type', $type);
@@ -262,7 +262,7 @@ class WasteApplyOption extends Auth {
                     ->field('id,real_name as title')
                     ->select();
             }
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $addr = model('Address')->getListByType(7,$this->orgId);
             $this->assign('addr', $addr);
             $this->assign('type', $type);

+ 247 - 1
application/admin/controller/WasteRecord.php

@@ -1,6 +1,8 @@
 <?php
 
 namespace app\admin\controller;
+use app\common\model\User;
+use app\hander\HelpHander;
 use think\App;
 use think\Db;
 use think\Exception;
@@ -88,13 +90,257 @@ class WasteRecord extends Auth {
             return json($result);
         }
         else {
-            $type = (new \app\common\model\WasteType())->getList();
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
             $this->assign('m_name', '医废类型');
             $this->assign('type', $type);
             $this->assign('status', $this->model->status);
             return $this->fetch();
         }
     }
+
+    // 科室医废
+    public function index2() {
+        if (request()->isAjax()) {
+            $depId = Db::name('user_dep')->where("user_id",$this->userId)->value('dep_id');
+            $addrs = [];
+            $alists = model("Address")->getListByType(7,$this->orgId);
+            foreach ($alists as $k=>$v){
+                if($v['dep_id'] == $depId){
+                    $addrs[] = $v['id'];
+                }
+            }
+
+            //分页参数
+            $length = input('rows', 10, 'intval');   //每页条数
+            $page = input('page', 1, 'intval');      //第几页
+            $start = ($page - 1) * $length;     //分页开始位置
+            //排序
+            $sortRow = input('sidx', 'id', 'trim');      //排序列
+            $sort = input('sord', 'desc', 'trim');        //排序方式
+            $order = $sortRow . ' ' . $sort;
+            $cateid = input('cateid', '', 'trim');
+            if ($cateid) {
+                $map[] = ['cateid', 'like', '%' . $cateid . '%'];
+            }
+            $start_time = input('start', '', 'trim');
+            $end_time = input('end', '', 'trim');
+            if ($start_time !== '' && $end_time !== '') {
+                if ($start_time <= $end_time) {
+                    $start_time = date('Ymd', strtotime($start_time));
+                    $end_time = date('Ymd', strtotime($end_time));
+                    $map[] = ['create_yyyymmdd', 'between', [$start_time, $end_time]];
+                }
+            }
+            if ($start_time !== '' && $end_time == '') {
+                $start_time = date('Ymd', strtotime($start_time));
+                $map[] = ['create_yyyymmdd', '>=', $start_time];
+            }
+            if ($start_time == '' && $end_time !== '') {
+                $end_time = date('Ymd', strtotime($end_time));
+                $map[] = ['create_yyyymmdd', '<=', $end_time];
+            }
+            $status = input('status', '', 'trim');
+            if ($status != '') {
+                if ($status == 4) {
+                    $map[] = ['status', 'in', [0, 1]];
+                }
+                else {
+                    if (in_array($status, array(0, 1, 2, 3))) {
+                        $map[] = ['status', '=', $status];
+                    }
+                }
+            }
+            $post = request()->post();
+            if (!isset($post['status'])) {
+                $map[] = ['status', 'in', [0, 1]];
+            }
+            $map[] = ['waste_device_id', 'in', $addrs];
+            $map[] = ['del', '=', 0];
+            $map[] = ['org_id', '=', $this->orgId];
+            $map = empty($map) ? true : $map;
+            //数据查询
+            $lists = db($this->table)->where($map)
+                ->limit($start, $length)
+                ->order($order)->select();
+            foreach ($lists as $k => $v) {
+                $lists[$k]['waste_device'] = db('address')
+                    ->where('id', $v['waste_device_id'])
+                    ->value('title');
+                $lists[$k]['real_name'] = db('user')
+                    ->where('id', $v['user_id'])
+                    ->value('real_name');
+                $lists[$k]['cate'] = db('waste_type')
+                    ->where('id', $v['cateid'])
+                    ->value('title');
+                $lists[$k]['weight'] = round($v['weight'] / 1000, 2);
+                $lists[$k]['serial_number_path'] = url('Qrcode/qrcode') . '?code=' . $v['serial_number'];
+                $lists[$k]['status'] = $this->model->status[$v['status']];
+            }
+            //数据返回
+            $totalCount = db($this->table)->where($map)->count();
+
+            $totalPage = ceil($totalCount / $length);
+            $result['page'] = $page;
+            $result['total'] = $totalPage;
+            $result['records'] = $totalCount;
+            $result['rows'] = $lists;
+            $types = (new \app\common\model\WasteType())->getList($this->orgId);
+            foreach ($types as $k=>$v){
+                $weight = db($this->table)->where($map)->where('cateid',$v['id'])->sum('weight');
+                $types[$k]['weight'] = round($weight/1000,2);
+            }
+            $result['types'] = $types;
+            return json($result);
+        }
+        else {
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
+            $this->assign('m_name', '医废类型');
+            $this->assign('type', $type);
+            $this->assign('status', $this->model->status);
+            return $this->fetch();
+        }
+    }
+
+    // 所有科室医废
+    public function index3() {
+        if (request()->isAjax()) {
+            //分页参数
+            $length = input('rows', 10, 'intval');   //每页条数
+            $page = input('page', 1, 'intval');      //第几页
+            $start = ($page - 1) * $length;     //分页开始位置
+            //排序
+            $sortRow = input('sidx', 'id', 'trim');      //排序列
+            $sort = input('sord', 'desc', 'trim');        //排序方式
+            $order = $sortRow . ' ' . $sort;
+            $cateid = input('cateid', '', 'trim');
+            if ($cateid) {
+                $map[] = ['cateid', 'like', '%' . $cateid . '%'];
+            }
+            $start_time = input('start', '', 'trim');
+            $end_time = input('end', '', 'trim');
+            if ($start_time !== '' && $end_time !== '') {
+                if ($start_time <= $end_time) {
+                    $start_time = date('Ymd', strtotime($start_time));
+                    $end_time = date('Ymd', strtotime($end_time));
+                    $map[] = ['create_yyyymmdd', 'between', [$start_time, $end_time]];
+                }
+            }
+            if ($start_time !== '' && $end_time == '') {
+                $start_time = date('Ymd', strtotime($start_time));
+                $map[] = ['create_yyyymmdd', '>=', $start_time];
+            }
+            if ($start_time == '' && $end_time !== '') {
+                $end_time = date('Ymd', strtotime($end_time));
+                $map[] = ['create_yyyymmdd', '<=', $end_time];
+            }
+            $status = input('status', '', 'trim');
+            if ($status != '') {
+                if ($status == 4) {
+                    $map[] = ['status', 'in', [0, 1]];
+                }
+                else {
+                    if (in_array($status, array(0, 1, 2, 3))) {
+                        $map[] = ['status', '=', $status];
+                    }
+                }
+            }
+            $post = request()->post();
+            if (!isset($post['status'])) {
+                $map[] = ['status', 'in', [0, 1]];
+            }
+            $map[] = ['del', '=', 0];
+            $map[] = ['org_id', '=', $this->orgId];
+            $map = empty($map) ? true : $map;
+            //数据查询
+            $lists = db($this->table)->where($map)
+                ->limit($start, $length)
+                ->order($order)->select();
+            foreach ($lists as $k => $v) {
+                $lists[$k]['waste_device'] = db('address')
+                    ->where('id', $v['waste_device_id'])
+                    ->value('title');
+                $lists[$k]['real_name'] = db('user')
+                    ->where('id', $v['user_id'])
+                    ->value('real_name');
+                $lists[$k]['cate'] = db('waste_type')
+                    ->where('id', $v['cateid'])
+                    ->value('title');
+                $lists[$k]['weight'] = round($v['weight'] / 1000, 2);
+                $lists[$k]['serial_number_path'] = url('Qrcode/qrcode') . '?code=' . $v['serial_number'];
+                $lists[$k]['status'] = $this->model->status[$v['status']];
+            }
+            //数据返回
+            $totalCount = db($this->table)->where($map)->count();
+            $totalPage = ceil($totalCount / $length);
+            $result['page'] = $page;
+            $result['total'] = $totalPage;
+            $result['records'] = $totalCount;
+            $result['rows'] = $lists;
+//            $weight = db($this->table)->where($map)->sum('weight');
+//            $result['weight'] = round($weight/1000,2);
+
+
+            $types = (new \app\common\model\WasteType())->getList($this->orgId);
+            foreach ($types as $k=>$v){
+                $weight = db($this->table)->where($map)->where('cateid',$v['id'])->sum('weight');
+                $types[$k]['weight'] = round($weight/1000,2);
+            }
+            $result['types'] = $types;
+
+            return json($result);
+        }
+        else {
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
+            $this->assign('m_name', '医废类型');
+            $this->assign('type', $type);
+            $this->assign('status', $this->model->status);
+            return $this->fetch();
+        }
+    }
+
+    public function add($id=0){
+        if(request()->isPost()){
+
+            $data = [
+                'org_id' => $this->orgId,
+                'user_id' => input('user_id/d',0),
+                'waste_device_id' => input('waste_device_id/d',0),
+                'cateid' =>input('cateid/d',0),
+                'weight' => input('weight'),
+                'create_time' => input('create_time'),
+                'status' => 0,
+                'is_print' => 0
+            ];
+            if(!$data['waste_device_id']){
+                $this->error('未选择收取科室');
+            }
+            if(!$data['cateid']){
+                $this->error('类型不能为空');
+            }
+
+            if($data['weight'] <= 0){
+                $this->error('称重必须大于0');
+            }
+            if(!$data['create_time']){
+                $this->error('未选择收取时间');
+            }
+
+            $waste_record_id = $this->model->saverecord($data);
+            if(!$waste_record_id){
+                HelpHander::error($this->model->getError());
+            }
+
+            $this->success('操作成功',url('index'));
+        }else{
+            $addrs = model("Address")->getListByType(7,$this->orgId);
+            $this->assign('addrs', $addrs);
+            $type = (new \app\common\model\WasteType())->getList($this->orgId);
+            $this->assign('type', $type);
+            $this->assign('user',(new User())->getWasteWorker());
+            return $this->fetch();
+        }
+    }
+
     /**
      * 详情
      *

+ 25 - 1
application/admin/controller/WasteType.php

@@ -33,7 +33,7 @@ class WasteType extends Auth
             }
 
             $map[] = ['del','=',0];
-            $map[] = ['org_id','=',$this->orgId];
+            $map[] = ['org_id','in',[0,$this->orgId]];
             $map= empty($map) ? true: $map;
             //数据查询
             $lists = db($this->table)->where($map)->limit($start,$length)->order($order)->select();
@@ -56,6 +56,15 @@ class WasteType extends Auth
      */
     public function add($id=0){
         if(request()->isPost()){
+            if($id > 0){
+                $info = db($this->table)->where('id',$id)->find();
+                if(!$info){
+                    $this->error('参数错误');
+                }
+                if($info['org_id'] <= 0){
+                    $this->error('共有类型无法修改');
+                }
+            }
             $res = $this->model->updates();
             if($res){
                 $this->success('操作成功',url('index'));
@@ -79,6 +88,13 @@ class WasteType extends Auth
         if(!$id){
             $this->error('参数错误');
         }
+        $info = db($this->table)->where('id',$id)->find();
+        if(!$info){
+            $this->error('参数错误');
+        }
+        if($info['org_id'] <= 0){
+            $this->error('共有类型无法删除');
+        }
         if(db('waste_record')->where('cateid',$id)->find()){
             $this->error('有医废记录绑定该类型,暂不能删除');
         }
@@ -100,6 +116,14 @@ class WasteType extends Auth
         if(!$fn||!$id){
             $this->error('参数错误');
         }
+        $info = db($this->table)->where('id',$id)->find();
+        if(!$info){
+            $this->error('参数错误');
+        }
+        if($info['org_id'] <= 0){
+            $this->error('共有类型无法修改');
+        }
+
         $res = db($this->table)->where('id',$id)->setField($fn,$fv);
         if($res){
             $this->success('操作成功');

+ 1 - 1
application/admin/view/device/add.html

@@ -46,7 +46,7 @@
                         </div>
                     </div>
                     <div class="form-group">
-                        <label class="col-sm-2 control-label">设备图片<span class="text-danger">*</span></label>
+                        <label class="col-sm-2 control-label">设备图片</label>
                         <div class="col-sm-6">
                             {:widget_view('common/upimg',['name'=>'imgs','multi'=>1,'val'=>isset($info)?$info['imgs']:''])}
                         </div>

+ 5 - 0
application/admin/view/mate_check/info.html

@@ -18,6 +18,11 @@
                     应盘数量:{$info['tnums']} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     实盘数量:{$info['tchecknums']} &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                     数量差异:{$info['tchecknums'] - $info['tnums']}
+
+                    {eq name="info['status']" value="0"}
+                    <a href="{:url('export',['id'=>$info['id']])}" class="btn btn-primary btn-sm pull-right">导出</a>
+                    {/eq}
+
                 </p>
                 {if !empty($info['goods'])}
                 <table class="table table-bordered table-striped">

+ 5 - 0
application/admin/view/orders/batchsend.html

@@ -32,6 +32,7 @@
                                     <th>今日送达次数</th>
                                     <th>上次位置</th>
                                     <th>上次修改时间</th>
+                                    <th>状态</th>
                                 </tr>
                                 </thead>
                                 <tbody class="layer-photos" id="layer-photos">
@@ -43,6 +44,10 @@
                                     <td>{$value['nums']}</td>
                                     <td>{$value['title']}</td>
                                     <td>{$value['addr_time']}</td>
+                                    <td>
+                                        {if $value['cur_status'] == 1}任务中{/if}
+                                        {if $value['cur_status'] == 0}空闲{/if}
+                                    </td>
                                 </tr>
                                 {/foreach}
                                 </tbody>

+ 58 - 6
application/admin/view/orders/convey.html

@@ -120,10 +120,10 @@
     <div class="ibox-content">
 
 
-        <a href="javascript:;" url="{:url('dispatchAdd',[],'')}/mode/3" data-title="创建运送订单" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">新增</a>
-        <a href="javascript:;" url="{:url('batchsend',[],'')}/mode/3" data-title="派工"  class="btn btn-sm btn-primary paiGong">派工</a>
-        <a href="javascript:;" class="btn btn-sm btn-primary finish">完成</a>
-        <a href="javascript:;" class="btn btn-sm btn-primary quxiao">取消</a>
+        <a href="javascript:;" url="{:url('dispatchAdd',[],'')}/mode/3" data-title="创建运送订单" onclick="layer_open(this,1)" id="orderadd" class="btn btn-sm btn-primary">新增(shift+A)</a>
+        <a href="javascript:;" url="{:url('batchsend',[],'')}/mode/3" data-title="派工"  class="btn btn-sm btn-primary paiGong">派工(shift+S)</a>
+        <a href="javascript:;" class="btn btn-sm btn-primary finish">完成(shift+Z)</a>
+        <a href="javascript:;" class="btn btn-sm btn-primary quxiao">取消(shift+X)</a>
         <a href="javascript:;" class="btn btn-sm btn-primary yanchi">延迟</a>
         <a href="javascript:;" class="btn btn-sm btn-primary quxiaoyanchi">取消延迟</a>
         <a href="javascript:;" class="btn btn-sm btn-primary ysystatus">运送员状态</a>
@@ -162,7 +162,52 @@
 <script src="/static/layDate-v5.0.9/laydate.js"></script>
 
 <script>
-    $ppp= {$sxJg};
+    let $ppp= {$sxJg};
+    console.log("11111");
+
+    document.addEventListener('keydown', function(event) {
+        var key = event.key;
+        var code = event.code;
+
+        if(event.shiftKey && event.key.toUpperCase() == "A"){
+            console.log("shift+A");
+            $('#orderadd').click();
+        }
+        if(event.shiftKey && event.key.toUpperCase() == "S"){
+            $('.paiGong').click();
+        }
+        if(event.shiftKey && event.key.toUpperCase() == "Z"){
+            $(".finish").click();
+        }
+        if(event.shiftKey && event.key.toUpperCase() == "X"){
+            $(".quxiao").click();
+        }
+        // 使用 key 或 code
+        // console.log(event);
+        // console.log("key:"+key);
+        // console.log("code:"+code);
+    });
+
+    // document.onkeyup = function(event) {
+    //     // 兼容FF和IE和Opera
+    //     var e = event || window.event;
+    //     var key = e.which || e.keyCode || e.charCode;
+    //     if (e.shiftKey && e.key === 'a') { // shift + a
+    //         /*Do something. 调用一些方法*/
+    //         console.log(key);
+    //         // $('#orderadd').click();
+    //     }else if(e.shiftKey && e.key === 's'){ // shift + s
+    //         /*Do something. 调用一些方法*/
+    //         console.log(key);
+    //         $('.paiGong').click();
+    //     }else if(e.shiftKey && e.key === 'd'){ // shift + d
+    //         /*Do something. 调用一些方法*/
+    //         console.log(key);
+    //     }else if(e.shiftKey && e.key === 'f'){ // shift + f
+    //         /*Do something. 调用一些方法*/
+    //         console.log(key);
+    //     }
+    // };
 
     $(function () {
         laydate.render({
@@ -244,6 +289,10 @@
 
                        // var btn = '<a  href="'+detail_url+'" ><span class="label label-primary" title="详情">详情</span></a>&nbsp;';
                         btn += '<a url="'+print+'" href="javascript:;" onclick="layer_open(this,1)" ><span class="label label-success" data-title="打印">打印</span></a>';
+                        if(c.is_todo == 1){
+                            var reminder = "{:url('reminder',[],'')}/id/"+c.id;
+                            btn += '<a href="'+reminder+'" class="ajax-get" ><span class="label label-info" data-title="催单">催单</span></a>';
+                        }
 
                         return btn;
                 }},
@@ -536,6 +585,9 @@
     });
     window.alert=function(){
         return '';
-    }
+    };
+
+
+
 </script>
 {/block}

+ 14 - 14
application/admin/view/orders/dispatch_add3.html

@@ -231,20 +231,20 @@
                             </div>
                         </div>
                     </div>
-<!--                    <div class="col-sm-12">-->
-<!--                        <div class="form-group">-->
-<!--                            <label class="control-label">运送设备</label></br>-->
-<!--                            <input type="hidden" name="device_id" id="device">-->
-<!--                            <el-select v-model="device" size="small" style="width: 100%" clearable filterable placeholder="请选择">-->
-<!--                                <el-option-->
-<!--                                        v-for="item in devices"-->
-<!--                                        :key="item.id"-->
-<!--                                        :label="item.title"-->
-<!--                                        :value="item.id">-->
-<!--                                </el-option>-->
-<!--                            </el-select>-->
-<!--                        </div>-->
-<!--                    </div>-->
+                    <div class="col-sm-12">
+                        <div class="form-group">
+                            <label class="control-label">运送设备</label></br>
+                            <input type="hidden" name="device_id" id="device">
+                            <el-select v-model="device" size="small" style="width: 100%" clearable filterable placeholder="请选择">
+                                <el-option
+                                        v-for="item in devices"
+                                        :key="item.id"
+                                        :label="item.title"
+                                        :value="item.id">
+                                </el-option>
+                            </el-select>
+                        </div>
+                    </div>
                     <div id="yy" style="display:none;">
                         <div class="col-sm-6">
                             <div class="form-group">

+ 14 - 14
application/admin/view/orders/self_add3.html

@@ -145,20 +145,20 @@
                         </div>
                     </div>
 
-<!--                    <div class="col-sm-12">-->
-<!--                        <div class="form-group">-->
-<!--                            <label class="control-label">运送设备</label></br>-->
-<!--                            <input type="hidden" name="device_id" id="device">-->
-<!--                            <el-select v-model="device" size="small" style="width: 100%" clearable filterable placeholder="请选择">-->
-<!--                                <el-option-->
-<!--                                        v-for="item in devices"-->
-<!--                                        :key="item.id"-->
-<!--                                        :label="item.title"-->
-<!--                                        :value="item.id">-->
-<!--                                </el-option>-->
-<!--                            </el-select>-->
-<!--                        </div>-->
-<!--                    </div>-->
+                    <div class="col-sm-12">
+                        <div class="form-group">
+                            <label class="control-label">运送设备</label></br>
+                            <input type="hidden" name="device_id" id="device">
+                            <el-select v-model="device" size="small" style="width: 100%" clearable filterable placeholder="请选择">
+                                <el-option
+                                        v-for="item in devices"
+                                        :key="item.id"
+                                        :label="item.title"
+                                        :value="item.id">
+                                </el-option>
+                            </el-select>
+                        </div>
+                    </div>
                     <div id="yy" style="display:none;">
                         <div class="col-sm-6">
                             <div class="form-group">

+ 29 - 0
application/admin/view/todo/detail.html

@@ -319,6 +319,35 @@
                         </td>
                     </tr>
                     {/if}
+                    {if !empty($info['cons'])}
+                    <tr>
+                        <th>物料</th>
+                        <td>
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>名称</th>
+                                    <th>数量</th>
+                                    <th>单价</th>
+                                    <th>总价</th>
+                                    <th>使用人员</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                {volist name="info['cons']" id="v"}
+                                <tr>
+                                    <td>{$v.title}</td>
+                                    <td>{$v.total}</td>
+                                    <td>{$v.money}</td>
+                                    <td>{$v.total_money}</td>
+                                    <td>{$v.realName}</td>
+                                </tr>
+                                {/volist}
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    {/if}
                     {if in_array($info['todo_mode'],[1,2,4])}
                     <tr>
                         <th>操作</th><td>

+ 29 - 0
application/admin/view/todo/detail3.html

@@ -154,6 +154,35 @@
                         </td>
                     </tr>
                     {/if}
+                    {if !empty($info['cons'])}
+                    <tr>
+                        <th>物料</th>
+                        <td>
+                            <table class="table table-bordered">
+                                <thead>
+                                <tr>
+                                    <th>名称</th>
+                                    <th>数量</th>
+                                    <th>单价</th>
+                                    <th>总价</th>
+                                    <th>使用人员</th>
+                                </tr>
+                                </thead>
+                                <tbody>
+                                {volist name="info['cons']" id="v"}
+                                <tr>
+                                    <td>{$v.title}</td>
+                                    <td>{$v.total}</td>
+                                    <td>{$v.money}</td>
+                                    <td>{$v.total_money}</td>
+                                    <td>{$v.realName}</td>
+                                </tr>
+                                {/volist}
+                                </tbody>
+                            </table>
+                        </td>
+                    </tr>
+                    {/if}
                     {if in_array($info['todo_mode'],[1,2,4])}
                     <tr>
                         <th>操作</th><td>

+ 59 - 0
application/admin/view/waste_record/add.html

@@ -0,0 +1,59 @@
+{extend name="common/common2" /}
+{block name="main"}
+<div class="row">
+    <div class="col-sm-12">
+        <div class="ibox float-e-margins">
+            <div class="ibox-content">
+                <form method="post" action="{:url('add')}" class="form-horizontal">
+                    <input type="hidden" name="id" value="{$info['id']|default='0'}">
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">收取人<span class="text-danger">*</span></label>
+                        <div class="col-sm-6">
+                            {:widget('common/select',['name'=>'user_id','lists'=>$user,'value'=>isset($info['user_id'])?$info['user_id']:''])}
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">收取地点<span class="text-danger">*</span></label>
+                        <div class="col-sm-6">
+                            {:widget('common/select',['name'=>'waste_device_id','lists'=>$addrs,'value'=>isset($info['waste_device_id'])?$info['waste_device_id']:''])}
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">类型<span class="text-danger">*</span></label>
+                        <div class="col-sm-6">
+                            {:widget('common/select',['name'=>'cateid','lists'=>$type,'value'=>isset($info['cateid'])?$info['cateid']:''])}
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">重量(单位:克)<span class="text-danger">*</span></label>
+                        <div class="col-sm-6">
+                            <input type="text" class="form-control" name="weight" value="{$info.weight|default=''}">
+                        </div>
+                    </div>
+                    <div class="form-group">
+                        <label class="col-sm-2 control-label">收取时间<span class="text-danger">*</span></label>
+                        <div class="col-sm-6">
+                            {:widget_view('common/laydate',['name'=>'create_time', 'val' => '','type'=>'datetime','format'=>'yyyy-MM-dd HH:mm:ss'])}
+                        </div>
+                    </div>
+                    <div class="hr-line-dashed"></div>
+                    <div class="form-group">
+                        <div class="col-sm-6 col-sm-offset-2">
+                            <button class="btn btn-primary ajax-post" data-layer="1" target-form="form-horizontal" type="submit">确 定</button>
+                            <button  class="btn cancel-btn btn-default" type="button">取 消</button>
+                        </div>
+                    </div>
+                </form>
+            </div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script>
+    $(document).ready(function(){
+        formSetValue("enable", {$info.enable|default=1});
+    });
+
+</script>
+{/block}

+ 3 - 1
application/admin/view/waste_record/index.html

@@ -27,6 +27,8 @@
 
                 <a href="javascript:;" class="btn btn-sm batch-apply btn-primary">修改申请</a>
 
+                <a href="javascript:;" url="{:url('add')}" data-title="补录" onclick="layer_open(this,1)" class="btn btn-sm btn-primary">补录</a>
+
             </div>
             <div class="col-xs-8" style="text-align: right;">
             <form class="form-inline" id="form-search" action="{:url('index')}">
@@ -121,7 +123,7 @@
                         if(a == 0){
                             return '否';
                         }else if (a==1){
-                            return '是';
+                            return '是 <img src="'+c.sign_path+'" style="width:50px;height: 50px">';
                         }
                     }},
                 {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false},

+ 195 - 0
application/admin/view/waste_record/index2.html

@@ -0,0 +1,195 @@
+{extend name="common/common2" /}
+{block name="main"}
+<style>
+    #allZy{
+        background-color: var(--themeColor) !important;
+        border-color: var(--themeColor) !important;
+        border-radius: 3px;
+        padding: 6px 10px;
+        font-size: 12px;
+        line-height: 1.5;
+        margin-top: 2px;
+        display: inline-block;
+    }
+</style>
+
+<div class="ibox">
+    <div class="ibox-content">
+        <div class="row">
+            <div class="col-xs-12" style="text-align: right;">
+            <form class="form-inline" id="form-search" action="{:url('index2')}">
+                <div class="input-group">
+                    <input type="text" id="start" readonly class="form-control" name="start" placeholder="开始日期">
+                </div>
+                <div class="input-group">
+                    <input type="text" id="end" readonly class="form-control" name="end" placeholder="结束日期">
+                </div>
+                <div class="input-group">
+                    <select name="cateid" class="form-control">
+                        <option value="">请选择类型</option>
+                        {foreach $type as $k=>$v}
+                        <option  value="{$v.id}">{$v.title}</option>
+                        {/foreach}
+                    </select>
+                </div>
+                <div class="input-group">
+                    <select name="status" class="form-control">
+                        <option value="">全部</option>
+                        {foreach $status as $k=>$v}
+                        <option {if $k==4} selected {/if} value="{$k}">{$v}</option>
+                        {/foreach}
+                    </select>
+                </div>
+                <div class="input-group">
+                    <span class="input-group-btn">
+                        <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
+                    </span> &nbsp;
+                    <span class="input-group-btn">
+                        <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
+                    </span>
+                    &nbsp;
+<!--                    <span class="input-group-btn">-->
+<!--                        <button data-url="{:url('export')}" title="导出" class="btn-sm btn-primary"  onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>-->
+<!--                    </span>-->
+
+                </div>
+            </form>
+        </div>
+        </div>
+    </div>
+    <div class="ibox-content">
+        <div class="jqGrid_wrapper">
+            <div id="wastetj" style="color: red;font-size: 20px;"></div>
+            <table id="table" style="border-collapse: collapse"></table>
+            <div id="pager"></div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
+<script>
+    //导出
+    function excel_download(_self){
+        var url = $(_self).attr('data-url');
+        var param = $('#form-search').serialize();
+        window.location.href = url+'?'+param;
+    }
+    $(function () {
+        laydate.render({
+            elem: '#start',
+            trigger: 'click' ,
+            theme:'#148d8f'
+        });
+        laydate.render({
+            elem: '#end',
+            trigger: 'click' ,
+            theme:'#148d8f'
+        });
+        $(window).bind("resize",function(){
+            var width=$(".jqGrid_wrapper").width();
+            $("#table").setGridWidth(width);
+        });
+
+        $.jgrid.defaults.styleUI="Bootstrap";
+        $("#table").jqGrid({
+            url:"{:url('index2')}",
+            datatype: "json",
+            colModel:[
+                {label:'ID',name:'id',index:'id', width:30,sortable: false},
+                {label:'收取地点',name:'waste_device',index:'waste_device',width:80,editable: false,sortable: false},
+                {label:'收取人',name:'real_name',index:'real_name',width:40,sortable: true},
+                {label:'称重序列号',name:'serial_number',index:'serial_number',width:80,sortable: true},
+                {label:'类别',name:'cate',index:'cate',width:40,sortable: true},
+                {label:'重量(kg)',name:'weight',index:'weight',width:40,sortable: true},
+                {label:'收取时间',name:'create_time',index:'create_time',width:80,sortable: true},
+                {label:'二维码',name:'serial_number_path',index:'serial_number_path',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
+                        return '<img src="'+a+'" width="60" onclick="open_img(this)"></img>';
+                    }},
+                {label:'是否签字',name:'sign',index:'sign',width:40,editable: false,sortable: false,formatter:function (a,b,c){
+                        if(a == 0){
+                            return '否';
+                        }else if (a==1){
+                            return '是 <img src="'+c.sign_path+'" style="width:50px;height: 50px">';
+                        }
+                    }},
+                {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false},
+                // {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
+                //     var info = "{:url('info',[],'')}/id/"+c.id;
+                //     var finish = "{:url('finish',[],'')}/id/"+c.id;
+                //     var delurl = "{:url('del',[],'')}/id/"+c.id;
+                //     var btn = '<a url="'+info+'" href="javascript:;" data-title="{$m_name}详情" onclick="layer_open(this,1)"><span class="label label-info" title="详情">详情</span></a>&nbsp;';
+                //         if(c.status==1){
+                //             btn += '<a href="'+finish+'" class="confirm ajax-get" data-confirm="确定要转运此记录吗?" data-table="1"><span class="label label-primary" title="转运">转运</span></a>&nbsp;';
+                //         }
+                //         btn += '<a {if !btnAuth(session("user_auth.id"),"WasteRecord/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
+                //         return btn;
+                // }},
+            ],
+            rowNum:10,
+            rowList:[10,20,30,50,100],
+            pager: '#pager',
+            sortname: 'id',
+            viewrecords: true,
+            autowidth:true,
+            mtype: 'post',
+            height: 'auto',
+            emptyrecords: "暂无数据",
+            sortorder: "desc",
+            caption:"",
+            multiselect: false,//可多选
+            loadComplete: function (xhr) {
+                if(xhr.code==0){
+                    layer.msg(xhr.msg);
+                    return false;
+                }
+                var types = xhr.types;
+                var str = "";
+                for (let o in types){
+                    str += types[o].title+":"+types[o].weight+"kg; ";
+                }
+                $('#wastetj').html(str);
+            },
+        });
+        $('.batch-finish').click(function () {
+            var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID
+            $.post('/admin/waste_record/batchFinish.html',{ids:rowIds},function (res) {
+                if(res.code==0){
+                    layer.msg(res.msg);
+                    return;
+                }else {
+                    layer.msg(res.msg,{time:2000},function () {
+                        $('#top-alert').find('button').click();
+                        $("#table").trigger("reloadGrid");
+                    })
+                }
+
+            })
+        })
+        $('.batch-apply').click(function () {
+            var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID
+
+            if(rowIds.length==0){
+                layer.msg('选择记录');
+                return false;
+            }
+            if(rowIds.length >1){
+                layer.msg('只能单个修改申请');
+                return false;
+            }
+            layer.open({
+                type: 2,
+                title: '修改申请',
+                shadeClose: true,
+                shade: 0.3,
+                maxmin: true,
+                area: ['70%', '70%'],
+                content: '/admin/waste_record/apply.html?id='+rowIds[0],
+
+            });
+
+        })
+    });
+
+</script>
+{/block}

+ 197 - 0
application/admin/view/waste_record/index3.html

@@ -0,0 +1,197 @@
+{extend name="common/common2" /}
+{block name="main"}
+<style>
+    #allZy{
+        background-color: var(--themeColor) !important;
+        border-color: var(--themeColor) !important;
+        border-radius: 3px;
+        padding: 6px 10px;
+        font-size: 12px;
+        line-height: 1.5;
+        margin-top: 2px;
+        display: inline-block;
+    }
+</style>
+
+<div class="ibox">
+    <div class="ibox-content">
+        <div class="row">
+            <div class="col-xs-12" style="text-align: right;">
+            <form class="form-inline" id="form-search" action="{:url('index3')}">
+                <div class="input-group">
+                    <input type="text" id="start" readonly class="form-control" name="start" placeholder="开始日期">
+                </div>
+                <div class="input-group">
+                    <input type="text" id="end" readonly class="form-control" name="end" placeholder="结束日期">
+                </div>
+                <div class="input-group">
+                    <select name="cateid" class="form-control">
+                        <option value="">请选择类型</option>
+                        {foreach $type as $k=>$v}
+                        <option  value="{$v.id}">{$v.title}</option>
+                        {/foreach}
+                    </select>
+                </div>
+                <div class="input-group">
+                    <select name="status" class="form-control">
+                        <option value="">全部</option>
+                        {foreach $status as $k=>$v}
+                        <option {if $k==4} selected {/if} value="{$k}">{$v}</option>
+                        {/foreach}
+                    </select>
+                </div>
+                <div class="input-group">
+                    <span class="input-group-btn">
+                        <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
+                    </span> &nbsp;
+                    <span class="input-group-btn">
+                        <button class="btn-sm btn-warning" type="button" id="search-clear"><i class="fa fa-undo"></i></button>
+                    </span>
+                    &nbsp;
+<!--                    <span class="input-group-btn">-->
+<!--                        <button data-url="{:url('export')}" title="导出" class="btn-sm btn-primary"  onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>-->
+<!--                    </span>-->
+
+                </div>
+            </form>
+        </div>
+        </div>
+    </div>
+    <div class="ibox-content">
+        <div class="jqGrid_wrapper">
+            <div id="wastetj" style="color: red;font-size: 20px;"></div>
+            <table id="table" style="border-collapse: collapse"></table>
+            <div id="pager"></div>
+        </div>
+    </div>
+</div>
+{/block}
+{block name="script"}
+<script type="text/javascript" src="/static/layDate-v5.0.9/laydate.js"></script>
+<script>
+    //导出
+    function excel_download(_self){
+        var url = $(_self).attr('data-url');
+        var param = $('#form-search').serialize();
+        window.location.href = url+'?'+param;
+    }
+    $(function () {
+        laydate.render({
+            elem: '#start',
+            trigger: 'click' ,
+            theme:'#148d8f'
+        });
+        laydate.render({
+            elem: '#end',
+            trigger: 'click' ,
+            theme:'#148d8f'
+        });
+        $(window).bind("resize",function(){
+            var width=$(".jqGrid_wrapper").width();
+            $("#table").setGridWidth(width);
+        });
+
+        $.jgrid.defaults.styleUI="Bootstrap";
+        $("#table").jqGrid({
+            url:"{:url('index3')}",
+            datatype: "json",
+            colModel:[
+                {label:'ID',name:'id',index:'id', width:30,sortable: false},
+                {label:'收取地点',name:'waste_device',index:'waste_device',width:80,editable: false,sortable: false},
+                {label:'收取人',name:'real_name',index:'real_name',width:40,sortable: true},
+                {label:'称重序列号',name:'serial_number',index:'serial_number',width:80,sortable: true},
+                {label:'类别',name:'cate',index:'cate',width:40,sortable: true},
+                {label:'重量(kg)',name:'weight',index:'weight',width:40,sortable: true},
+                {label:'收取时间',name:'create_time',index:'create_time',width:80,sortable: true},
+                {label:'二维码',name:'serial_number_path',index:'serial_number_path',width:80,editable: false,sortable: false,formatter: function (a, b, c) {
+                        return '<img src="'+a+'" width="60" onclick="open_img(this)"></img>';
+                    }},
+                {label:'是否签字',name:'sign',index:'sign',width:40,editable: false,sortable: false,formatter:function (a,b,c){
+                        if(a == 0){
+                            return '否';
+                        }else if (a==1){
+                            return '是 <img src="'+c.sign_path+'" style="width:50px;height: 50px">';
+                        }
+                    }},
+                {label:'状态',name:'status',index:'status',width:40,editable: false,sortable: false},
+                // {label:'操作',width:80,sortable: false,formatter: function (a, b, c) {
+                //     var info = "{:url('info',[],'')}/id/"+c.id;
+                //     var finish = "{:url('finish',[],'')}/id/"+c.id;
+                //     var delurl = "{:url('del',[],'')}/id/"+c.id;
+                //     var btn = '<a url="'+info+'" href="javascript:;" data-title="{$m_name}详情" onclick="layer_open(this,1)"><span class="label label-info" title="详情">详情</span></a>&nbsp;';
+                //         if(c.status==1){
+                //             btn += '<a href="'+finish+'" class="confirm ajax-get" data-confirm="确定要转运此记录吗?" data-table="1"><span class="label label-primary" title="转运">转运</span></a>&nbsp;';
+                //         }
+                //         btn += '<a {if !btnAuth(session("user_auth.id"),"WasteRecord/del")} style="display:none"{/if} href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>';
+                //         return btn;
+                // }},
+            ],
+            rowNum:10,
+            rowList:[10,20,30,50,100],
+            pager: '#pager',
+            sortname: 'id',
+            viewrecords: true,
+            autowidth:true,
+            mtype: 'post',
+            height: 'auto',
+            emptyrecords: "暂无数据",
+            sortorder: "desc",
+            caption:"",
+            multiselect: false,//可多选
+            loadComplete: function (xhr) {
+                if(xhr.code==0){
+                    layer.msg(xhr.msg);
+                    return false;
+                }
+
+                var types = xhr.types;
+                var str = "";
+                for (let o in types){
+                    str += types[o].title+":"+types[o].weight+"kg; ";
+                }
+                $('#wastetj').html(str);
+
+            },
+        });
+        $('.batch-finish').click(function () {
+            var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID
+            $.post('/admin/waste_record/batchFinish.html',{ids:rowIds},function (res) {
+                if(res.code==0){
+                    layer.msg(res.msg);
+                    return;
+                }else {
+                    layer.msg(res.msg,{time:2000},function () {
+                        $('#top-alert').find('button').click();
+                        $("#table").trigger("reloadGrid");
+                    })
+                }
+
+            })
+        })
+        $('.batch-apply').click(function () {
+            var rowIds = jQuery("#table").jqGrid('getGridParam', 'selarrrow');    //获取勾选记录的ID
+
+            if(rowIds.length==0){
+                layer.msg('选择记录');
+                return false;
+            }
+            if(rowIds.length >1){
+                layer.msg('只能单个修改申请');
+                return false;
+            }
+            layer.open({
+                type: 2,
+                title: '修改申请',
+                shadeClose: true,
+                shade: 0.3,
+                maxmin: true,
+                area: ['70%', '70%'],
+                content: '/admin/waste_record/apply.html?id='+rowIds[0],
+
+            });
+
+        })
+    });
+
+</script>
+{/block}

+ 7 - 0
application/admin/view/waste_type/index.html

@@ -66,6 +66,13 @@
                         return '<a href="'+url+'" class="ajax-get" data-table="1"><span class="label label-primary" title="正常">正常</span></a>';
                     }
                 }},
+                {label:'类型',name:'enable',index:'enable',width:40,editable: false,sortable: false,formatter:function (a,b,c){
+                        if(c.org_id > 0){
+                            return '私有';
+                        } else{
+                            return '共有';
+                        }
+                    }},
                 {label:'操作',width:50,sortable: false,formatter: function (a, b, c) {
                     var editurl = "{:url('add',[],'')}/id/"+c.id;
                     var delurl = "{:url('del',[],'')}/id/"+c.id;

+ 1 - 1
application/api/controller/screen/Convey.php

@@ -928,7 +928,7 @@ class Convey extends Index
             ->whereIn('t.todo_mode',[1,2])
             ->where('t.del',0)
             ->where('t.work_type_mode',3)
-            ->where('t.create_yyyymmdd',$curday)
+//            ->where('t.create_yyyymmdd',$curday)  //去掉时间限制
             ->where('u.work',1)
             ->where('u.enable',1)
             ->where('u.del',0)

+ 54 - 0
application/api/controller/v1/OrderDelay.php

@@ -0,0 +1,54 @@
+<?php
+namespace app\api\controller\v1;
+use app\api\controller\Base;
+use app\hander\HelpHander;
+use think\App;
+use think\Db;
+use think\exception\Handle;
+
+class OrderDelay extends Base
+{
+
+    //延迟原因
+    public function reasons(){
+        $delay_reasons = Db::name('delay_reason')
+            ->where('org_id', $this->orgId)
+            ->where('enable', 1)
+            ->where('del', 0)
+            ->select();
+
+        HelpHander::success($delay_reasons?$delay_reasons:[]);
+    }
+
+
+    //申请延迟
+    public function add(){
+        $id = input('id/d',0);
+        if($id <= 0){
+            HelpHander::error('参数错误');
+        }
+        $delay_reason_id = input('delay_reason_id/d',0);
+        if (empty($delay_reason_id)) {
+            HelpHander::error('请选择延迟原因');
+        }
+        $res = model("Orders")->delay_reason($id, $delay_reason_id,1);
+        if (!$res) {
+            HelpHander::error(model("Orders")->getError());
+        }
+        HelpHander::success('操作成功');
+    }
+
+    // 取消延时
+    public function cancel(){
+        $id = input('id/d',0);
+        if($id <= 0){
+            HelpHander::error('参数错误');
+        }
+        $res = model("Orders")->batchcanceldelay($id);
+        if (!$res) {
+            HelpHander::error(model("Orders")->getError());
+        }
+        HelpHander::success('操作成功');
+    }
+
+}

+ 22 - 0
application/api/controller/v1/User.php

@@ -131,4 +131,26 @@ class User extends Base
         HelpHander::success($params,'修改成功,请重置登录信息');
 
     }
+
+    //上下班
+    public function worker(){
+        $worker = input('work/d',0);
+        $info = Db::name('user')->where('id',$this->userId)->where('del',0)->find();
+        if(!$info){
+            HelpHander::error('用户不存在');
+        }
+
+        if($worker == $info['work']){
+            HelpHander::success([],'操作成功');
+        }else{
+            $res  = Db::name('user')
+                ->where('id',$this->userId)
+                ->update([
+                    'work'=>$worker,
+                    'update_time'=>getTime(),
+                ]);
+        }
+
+        $res?HelpHander::success([],'操作成功'):HelpHander::error('操作失败');
+    }
 }

+ 1 - 1
application/common/model/Address.php

@@ -78,7 +78,7 @@ class Address extends Base
         $lists = Db::name('address')
             ->where($map)
             ->order('id desc')
-            ->field('id,title,remark,sn,x,y')
+            ->field('id,title,remark,sn,x,y,dep_id')
             ->select();
         return $lists?$lists:[];
     }

+ 1 - 1
application/common/model/Device.php

@@ -18,7 +18,7 @@ class Device extends Base {
             $this->error = '维修人员不能为空';
             return false;
         }
-        $data['imgs']=implode(',',$data['imgs']);
+        $data['imgs']=empty($data['imgs'])?"":implode(',',$data['imgs']);
         //修改操作
         if($data['id'] > 0){
             Db::startTrans();

+ 9 - 2
application/common/model/Orders.php

@@ -743,6 +743,7 @@ class Orders extends Base {
     //api格式化订单详情
     public function apiFormatOrder($v, $is_list = 0,$todo_id=0) {
 
+        $v['delayStatus'] = 0;
         $v['delayReason'] = '';
         $v['videos'] = $v['videos']?$v['videos']:'';
         $v['voices'] = $v['voices']?$v['voices']:'';
@@ -893,6 +894,8 @@ class Orders extends Base {
             }
 
         }
+
+        $v['delayStatus'] = 0;
         $order_delay = Db::name('order_delay')
             ->alias('a')
             ->join('delay_reason b','a.delay_reason_id=b.id')
@@ -901,6 +904,7 @@ class Orders extends Base {
             ->find();
         if($order_delay && $order_delay['status']==0){
             $v['delayReason'] = $order_delay['title'];
+            $v['delayStatus'] = 1;
         }
 
         if($v['name']){
@@ -2240,6 +2244,8 @@ class Orders extends Base {
                 $payinfo['id'] = $pay['id'];
             }
             $info['pay'] = $payinfo;
+
+
         }
 
         return $info;
@@ -2534,7 +2540,7 @@ class Orders extends Base {
         return $data;
     }
     //延迟任务
-    public function delay_reason($id,$delayReasonId){
+    public function delay_reason($id,$delayReasonId,$type=0){
         $ids = explode(',',$id);
 
         $this->startTrans();
@@ -2561,7 +2567,8 @@ class Orders extends Base {
                     'order_id' => $id,
                     'delay_reason_id' => $delayReasonId,
                     'start_time' => $curTime,
-                    'status' => 0
+                    'status' => 0,
+                    'type' => $type
                 ]);
                if(!$res){
                    \exception('添加失败');

+ 25 - 0
application/common/model/Todo.php

@@ -108,6 +108,31 @@ class Todo extends Base
             }
         }
         $v['pauseList'] = $pauseList;
+
+        $todo_mate = Db::name('todo_mate')
+            ->where('todo_id',$v['id'])
+            ->select();
+
+        if(!empty($todo_mate)){
+            $cons = Db::name('todo_mate_item')
+                ->alias('a')
+                ->join('mate_goods b','b.id = a.items_id')
+                ->where('a.todo_mate_id','in',array_column($todo_mate,'id'))
+                ->field('a.*,b.title')
+                ->select();
+            foreach ($cons as $k1=>$v1){
+                $v['cons'][] = [
+                    'title' =>$v1['title'],
+                    'total' =>$v1['total'],
+                    'money' =>$v1['money'],
+                    'total_money' =>$v1['total_money'],
+                    'realName' =>$this->getTableField('user',['id'=>$v1['user_id']],'real_name'),
+                ];
+
+            }
+        }
+
+
         return $v;
     }
 

+ 7 - 5
application/common/model/WasteRecord.php

@@ -213,10 +213,12 @@ class WasteRecord extends Base {
     public function saveRecord($data){
         $curtime = getTime();
         $data['serial_number'] = get_unique_id();
-        $data['create_time'] = $curtime;
-        $data['create_yyyy'] = date('Y');
-        $data['create_yyyymm'] = date('Ym');
-        $data['create_yyyymmdd'] = date('Ymd');
+        if(!$data['create_time']){
+            $data['create_time'] = $curtime;
+        }
+        $data['create_yyyy'] = date('Y',strtotime($data['create_time']));
+        $data['create_yyyymm'] = date('Ym',strtotime($data['create_time']));
+        $data['create_yyyymmdd'] = date('Ymd',strtotime($data['create_time']));
 
         $this->startTrans();
         try{
@@ -226,7 +228,7 @@ class WasteRecord extends Base {
             }
             $sdata = [
                 'status' => 0,
-                'create_time' => $curtime,
+                'create_time' => $data['create_time'],
                 'user_id' => $data['user_id'],
                 'waste_record_id' => $waste_record_id,
             ];

+ 4 - 4
application/common/model/WasteType.php

@@ -33,9 +33,9 @@ class WasteType extends Base
         return true;
     }
 
-    public function getList(){
+    public function getList($orgId){
         $list =$this
-            //->where('org_id',cur_org_id())
+            ->where('org_id','in',[0,$orgId])
             ->where('del',0)
             ->where('enable',1)
             ->select()
@@ -44,7 +44,7 @@ class WasteType extends Base
     }
     public function list($orgId=0){
         $list =$this
-           // ->where('org_id',$orgId)
+            ->where('org_id','in',[0,$orgId])
             ->where('del',0)
             ->where('enable',1)
             ->select()
@@ -53,7 +53,7 @@ class WasteType extends Base
     }
     public function list1($orgId){
         $list =$this
-           // ->where('org_id',$orgId)
+            ->where('org_id','in',[0,$orgId])
             ->field('id as waste_id,title')
             ->where('del',0)
             ->where('enable',1)

+ 2 - 2
application/common/validate/Device.php

@@ -15,8 +15,8 @@ class Device extends Validate
      * @var array
      */
     protected $rule = [
-        'title|设备名称'  =>  'require|length:1,20|checkUnique',
-        'imgs|设备图片'  =>  'require',
+        'title|设备名称'  =>  'require|length:1,20',
+//        'imgs|设备图片'  =>  'require',
         'enable|状态'  =>  'require',
         'cate_id|分类'  =>  'require|gt:0',
         'device_form|检查项'  =>  'require',

+ 23 - 0
application/h5/controller/Statistics.php

@@ -1247,6 +1247,29 @@ class Statistics extends Controller
         return $this->fetch();
     }
 
+
+    public function waste() {
+        $type = input('type/d',0);
+        $map[] = ['org_id','=',$this->orgId];
+
+        if($type == 0){ //日统计
+            $map[] = ['create_yyyymmdd','=',date('Ymd')];
+        } else if($type == 1){ //月统计
+            $map[] = ['create_yyyymm','=',date('Ym')];
+        }
+
+        $wasteTypes = model("WasteType")->list1($this->orgId);
+        foreach ($wasteTypes as $k=>$v){
+            $count = Db::name('waste_record')->where($map)->where('cateid',$v['waste_id'])->count();
+            $wasteTypes[$k]['count'] = $count;
+        }
+
+        $this->assign('wasteTypes',$wasteTypes);
+        $this->assign('orgId',$this->orgId);
+        $this->assign('type',$type);
+
+        return $this->fetch();
+    }
 }
 
 

+ 143 - 0
application/h5/view/statistics/waste.html

@@ -0,0 +1,143 @@
+<!doctype html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
+    <meta http-equiv="X-UA-Compatible" content="ie=edge">
+    <script type="text/javascript" src="/static/jquery-2.2.4.min.js"></script>
+    <link rel="stylesheet" href="/static/h5/css/common.css">
+    <title>医废统计</title>
+    <style>
+        html,body,ul {
+            margin: 0;
+            padding: 0;
+        }
+        html,body {
+            overflow-y: scroll;
+            -webkit-overflow-scrolling: touch;
+            background-color: #F1F1F1;
+        }
+        .select-tab {
+            margin: 10px 10px 0;
+            border-radius: 10px;
+            background: #fff;
+        }
+        .nav {
+            display: flex;
+            display: -webkit-flex;
+            justify-content: center;
+            -webkit-justify-content: center;
+            align-items: center;
+            border:1px solid var(--themeColor);
+            border-radius:5px;
+            list-style: none;
+        }
+        .nav>li {
+            width: 100%;
+            flex: 1;
+            text-align: center;
+            display: block;
+        }
+        .nav-tabs>li.active>a {
+            line-height: 2;
+            font-size: 16px;
+            color: #fff;
+            font-weight: 500;
+            cursor: default;
+            background-color: var(--themeColor);
+        }
+        .nav-tabs>li>a {
+            line-height: 2;
+            font-size: 16px;
+            color: #999999;
+            font-weight: 500;
+        }
+        a {
+            display: block;
+            text-decoration: none;
+        }
+        .daily-record {
+            margin: 10px;
+            border-radius: 10px;
+            background: #fff;
+        }
+        .chart-wrapper {
+            margin: 10px;
+            border-radius: 10px;
+            background: #fff;
+        }
+        .record-data {
+            display: flex;
+            display: -webkit-flex;
+            justify-content: space-between;
+            -webkit-justify-content: space-between;
+            align-items: center;
+            -webkit-box-align: center;
+            height: 7vh;
+        }
+        .line {
+            margin: 0 15px;
+            height: 1px;
+            background-color: #CCCCCC;
+        }
+        .daily-title, .daily-nums {
+            display: inline;
+            font-size: 17px;
+            font-weight: 500;
+        }
+        .daily-title {
+            margin-left: 15px;
+        }
+        .daily-nums {
+            margin-right: 15px;
+            color:rgba(153,153,153,1);
+        }
+    </style>
+</head>
+<body>
+<div class="select-tab">
+    <ul id="myTab" class="nav nav-tabs">
+        <li {eq name="type" value="0"}class="active"{/eq}>
+        <a href="{:url('waste',['type'=>0,'orgId'=>$orgId])}">日统计</a>
+        </li>
+        <li {eq name="type" value="1"}class="active"{/eq}>
+        <a href="{:url('waste',['type'=>1,'orgId'=>$orgId])}">月统计</a>
+        </li>
+        <li {eq name="type" value="2"}class="active"{/eq}>
+        <a href="{:url('waste',['type'=>2,'orgId'=>$orgId])}">总统计</a>
+        </li>
+    </ul>
+</div>
+<div class="daily-record">
+    {volist name="wasteTypes" id="v"}
+    <div class="record-data">
+        <span class="daily-title">{$v.title}</span>
+        <span class="daily-nums">{$v.count}</span>
+    </div>
+    {/volist}
+<!--    <div class="line"></div>-->
+<!--    <div class="record-data" onclick="deviceRecord(this)" data-day="{$type}" data-orgId="{$orgId}">-->
+<!--        <span class="daily-title">维护次数</span>-->
+<!--        <span class="daily-nums">{$allcount}</span>-->
+<!--    </div>-->
+</div>
+</body>
+</html>
+
+<script>
+
+    // function device(obj) {
+    //     var  orgId = $(obj).attr('data-orgId');
+    //     var  day = $(obj).attr('data-day');
+    //     var  url = "{:url('Statistics/deviceList')}?orgId="+orgId+'&day='+day;
+    //     window.location.href=url;
+    // }
+    //
+    // function deviceRecord(obj) {
+    //     var  orgId = $(obj).attr('data-orgId');
+    //     var  day = $(obj).attr('data-day');
+    //     var  url = "{:url('Statistics/deviceRecordList')}?orgId="+orgId+'&day='+day;
+    //     window.location.href=url;
+    // }
+
+</script>

BIN
public/logo.png