hzd hace 4 meses
padre
commit
40329e2852

+ 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);

+ 31 - 1
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", 'desc');
             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_CUSTOM,'您有订单需要处理');
+        }
+
+        $this->success('催单成功');
+    }
+
     //运送员状态
     public function conveystatus($id='') {
         if (request()->isAjax()) {

+ 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>

+ 4 - 0
application/admin/view/orders/convey.html

@@ -244,6 +244,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;
                 }},

+ 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">

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

@@ -121,7 +121,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},

+ 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('操作成功');
+    }
+
+}

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

@@ -131,4 +131,49 @@ 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('用户不存在');
+        }
+
+        // 查询是否是分享用户
+        $uoinfo = Db::name('user_org')->where('user_id',$this->userId)->where('org_id',$this->orgId)->find();
+        if(!$uoinfo){
+            HelpHander::error('用户不存在');
+        }
+        if($uoinfo['share'] == 0){
+            if($worker == $info['work']){
+                HelpHander::success([],'操作成功');
+            }else{
+                $res  = Db::name('user')
+                    ->where('id',$this->userId)
+                    ->update([
+                        'work'=>$worker,
+                        'update_time'=>getTime(),
+                    ]);
+            }
+        }else{
+            if($worker == $uoinfo['work']){
+                HelpHander::success([],'操作成功');
+            }else{
+                $res  = Db::name('user_org')
+                    ->where('user_id',$this->userId)
+                    ->update(['work'=>$worker]);
+            }
+        }
+
+        if($worker == 1){
+            $msg = '上班';
+        }else{
+            $msg = '下班';
+        }
+
+        //model('ActionLog')->addlog($this->userId,50,$msg,['work' => $worker],$this->orgId);
+
+        $res?HelpHander::success([],'操作成功'):HelpHander::error('操作失败');
+    }
 }

+ 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('添加失败');