Browse Source

无地址销售订单统计

wufeng 2 years ago
parent
commit
6f0a5a5b2f
2 changed files with 87 additions and 2 deletions
  1. 85 2
      app/admin/controller/SaleReport.php
  2. 2 0
      app/admin/route/app.php

+ 85 - 2
app/admin/controller/SaleReport.php

@@ -1516,7 +1516,7 @@ class SaleReport extends Base
         }
 
         if (empty($list)) $list[] = '没有相关可导出的数据';
-        excelSave('无地址待发货订单' . date('YmdHis'), array_keys($list[0]), $list);
+        excelSave('延时发货申请单' . date('YmdHis'), array_keys($list[0]), $list);
 
     }
 
@@ -1627,7 +1627,90 @@ class SaleReport extends Base
         }
 
         if (empty($list)) $list[] = '没有相关可导出的数据';
-        excelSave('有地址待发货单列表' . date('YmdHis'), array_keys($list[0]), $list);
+        excelSave('直接发货申请单统计' . date('YmdHis'), array_keys($list[0]), $list);
+
+    }
+
+    //【十、无地址销售订单】
+    public function saleNotAddr()
+    {
+
+        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'status' => '', 'apply_company' => '', 'page' => 1, 'size' => 15, 'order_type' => ''], 'post', 'trim');
+
+        $where = [['a.send_type', '=', 2], ['a.is_del', '=', 0]];//send_type==2 延迟发货
+        if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['a.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
+        if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['apply_company'] != '') $where[] = ['ci.name', 'like', '%' . $param['apply_company'] . '%'];
+        if ($param['order_type'] != '') $where[] = ['a.order_type', '=', $param['order_type']];
+
+        $count = $data = Db::name('sale')
+            ->alias('a')
+            ->leftJoin("order_out b", "b.orderCode=a.orderCode AND b.is_del=0")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
+            ->where($where)
+            ->whereNull('b.id')
+            ->count('a.id');
+
+        $data = Db::name('sale')
+            ->alias('a')
+            ->field('a.id,a.orderCode,a.order_type,a.good_code,a.skuCode,good_name,a.good_num,a.send_num,a.wsend_num,a.status,u.nickname,ci.name')
+            ->leftJoin("order_out b", "b.orderCode=a.orderCode AND b.is_del=0")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
+            ->where($where)
+            ->whereNull('b.id')
+            ->page($param['page'], $param['size'])
+            ->order("a.addtime desc")
+            ->cursor();
+
+        $list = [];
+        foreach ($data as $value) {
+
+            $value['order_type'] = isset($this->all_order_type[$value['order_type']]) ? $this->all_order_type[$value['order_type']] : '';
+
+            $list[] = $value;
+        }
+
+        return app_show(0, '请求成功', ['list' => $list, 'count' => $count]);
+
+    }
+
+    //【十、无地址销售订单-导出】
+    public function saleNotAddrExport()
+    {
+
+        $param = $this->request->only(['token', 'start_date' => '', 'end_date' => '', 'status' => '', 'apply_company' => '', 'order_type' => ''], 'post', 'trim');
+
+        $where = [['a.send_type', '=', 2], ['a.is_del', '=', 0]];//send_type==2 延迟发货
+        if ($param['start_date'] != '' && $param['end_date'] != '') $where[] = ['a.addtime', 'between', [$param['start_date'] . ' 00:00:00', $param['end_date'] . ' 23:59:59']];
+        if ($param['status'] != '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['apply_company'] != '') $where[] = ['ci.name', 'like', '%' . $param['apply_company'] . '%'];
+        if ($param['order_type'] != '') $where[] = ['a.order_type', '=', $param['order_type']];
+
+        $data = Db::name('sale')
+            ->alias('a')
+            ->field('a.orderCode 订单编号,a.order_type 订单类型,a.good_code 商品成本编码,a.skuCode 商品上线编码,good_name 商品名称,a.good_num 购买数量,a.send_num 已发货数量,a.wsend_num 未发货数量,a.status 订单状态,u.nickname 申请人名称,ci.name 申请人所属部门')
+            ->leftJoin("order_out b", "b.orderCode=a.orderCode AND b.is_del=0")
+            ->leftJoin("depart_user u", "u.uid=a.apply_id AND u.is_del=0")
+            ->leftJoin("company_item ci", "ci.id=u.itemid")
+            ->where($where)
+            ->whereNull('b.id')
+            ->order("a.addtime desc")
+            ->cursor();
+
+        $list = [];
+        foreach ($data as $value) {
+
+            $value['订单类型'] = isset($this->all_order_type[$value['订单类型']]) ? $this->all_order_type[$value['订单类型']] : '';
+            $value['订单状态'] = isset($this->all_sale_status[$value['订单状态']]) ? $this->all_sale_status[$value['订单状态']] : '';
+
+            $list[] = $value;
+        }
+
+
+        if (empty($list)) $list[] = '没有相关可导出的数据';
+        excelSave('无地址销售订单列表' . date('YmdHis'), array_keys($list[0]), $list);
 
     }
 

+ 2 - 0
app/admin/route/app.php

@@ -594,6 +594,8 @@ Route::rule('seoona', 'admin/SaleReport/orderOutNotAddr');//延时发货申请
 Route::rule('seoonae', 'admin/SaleReport/orderOutNotAddrExport');//延时发货申请单统计 -导出
 Route::rule('seooa', 'admin/SaleReport/orderOutAddr');//直接发货申请单统计
 Route::rule('seooae', 'admin/SaleReport/orderOutAddrExport');//直接发货申请单统计 -导出
+Route::rule('sna', 'admin/SaleReport/saleNotAddr');//无地址销售订单统计
+Route::rule('snae', 'admin/SaleReport/saleNotAddrExport');//无地址销售订单统计
 
 Route::rule("catplatadd", "admin/CatPlat/add");
 Route::rule("catplatedit", "admin/CatPlat/edit");