瀏覽代碼

GO服务,BUG修复,service重建

Zhouzhendong 5 年之前
父節點
當前提交
88d79f0209
共有 56 個文件被更改,包括 1310 次插入1841 次删除
  1. 1 5
      app/Events/WeighedEvent.php
  2. 52 263
      app/Http/Controllers/InventoryController.php
  3. 31 51
      app/Http/Controllers/LaborReportController.php
  4. 52 12
      app/Http/Controllers/OrderController.php
  5. 18 142
      app/Http/Controllers/OrderIssueController.php
  6. 62 154
      app/Http/Controllers/PackageController.php
  7. 15 91
      app/Http/Controllers/ProcessController.php
  8. 17 108
      app/Http/Controllers/ProcessStatisticController.php
  9. 1 21
      app/Http/Controllers/RejectedController.php
  10. 2 3
      app/Http/Controllers/TestController.php
  11. 1 2
      app/Http/Controllers/UserController.php
  12. 0 68
      app/Http/Controllers/WaveController.php
  13. 83 159
      app/Http/Controllers/WaybillController.php
  14. 1 1
      app/Http/Controllers/WaybillFinancialExceptedController.php
  15. 13 110
      app/Http/Controllers/WaybillFinancialSnapshotsController.php
  16. 25 84
      app/Http/Controllers/WeighExceptedController.php
  17. 3 4
      app/Http/Controllers/api/thirdPart/flux/PackageController.php
  18. 2 56
      app/Http/Controllers/api/thirdPart/flux/ProcessController.php
  19. 2 2
      app/Http/Controllers/api/thirdPart/flux/WaybillController.php
  20. 0 11
      app/OraccleBasCustomer.php
  21. 0 8
      app/OracleBasCustomer.php
  22. 14 10
      app/Package.php
  23. 2 2
      app/Process.php
  24. 6 1
      app/ProcessStatistic.php
  25. 28 1
      app/Providers/AppServiceProvider.php
  26. 62 0
      app/Services/AllInventoryService.php
  27. 3 7
      app/Services/InventoryAccountService.php
  28. 56 0
      app/Services/InventoryDailyLogService.php
  29. 67 180
      app/Services/InventoryService.php
  30. 31 23
      app/Services/LaborReportService.php
  31. 2 2
      app/Services/LogisticService.php
  32. 43 0
      app/Services/OracleActAllocationDetailService.php
  33. 104 26
      app/Services/OrderIssueService.php
  34. 17 12
      app/Services/PackageService.php
  35. 28 0
      app/Services/PackageStatisticsService.php
  36. 14 0
      app/Services/ProcessMethodService.php
  37. 48 21
      app/Services/ProcessService.php
  38. 59 0
      app/Services/ProcessStatisticService.php
  39. 29 0
      app/Services/WaybillFinancialService.php
  40. 24 20
      app/Services/WaybillService.php
  41. 36 0
      app/Services/WeighExceptedService.php
  42. 1 1
      app/Services/common/QueryService.php
  43. 6 1
      app/Traits/ModelTimeFormat.php
  44. 12 6
      app/Waybill.php
  45. 32 0
      database/migrations/2020_08_31_163910_change_labor_report_statuses_add_index_created_at.php
  46. 4 4
      public/js/app.js
  47. 8 7
      resources/views/inventory/statement/changeInventory.blade.php
  48. 8 5
      resources/views/inventory/statement/dailyLog.blade.php
  49. 12 17
      resources/views/maintenance/user/index.blade.php
  50. 64 12
      resources/views/order/index/delivering.blade.php
  51. 19 26
      resources/views/process/statistic.blade.php
  52. 8 12
      resources/views/waybill/delivering.blade.php
  53. 37 55
      resources/views/waybill/waybillFinancialSnapshot/index.blade.php
  54. 9 16
      resources/views/weight/package/statistics.blade.php
  55. 8 14
      resources/views/weight/weightExcepted/index.blade.php
  56. 28 5
      routes/web.php

+ 1 - 5
app/Events/WeighedEvent.php

@@ -17,7 +17,7 @@ class WeighedEvent implements ShouldBroadcast
 
     /**
      * Create a new event instance.
-     *
+     * @param Package $package
      * @return void
      */
     public function __construct(Package $package)
@@ -34,9 +34,5 @@ class WeighedEvent implements ShouldBroadcast
     {
         return new Channel('package');
     }
-//
-//    public function broadcastAs(){
-//        return "weight";        //频道别名
-//    }
 
 }

+ 52 - 263
app/Http/Controllers/InventoryController.php

@@ -2,298 +2,72 @@
 
 namespace App\Http\Controllers;
 
-use App\Exports\Export;
-use App\Inventory;
-use App\InventoryDailyLoggingOwner;
-use App\InventoryMission;
 use App\OracleBasCustomer;
-use App\Owner;
 use App\Services\InventoryService;
 use App\Services\OwnerService;
-use App\Services\InventoryAccountService;
 use Illuminate\Http\Request;
-use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
-use Maatwebsite\Excel\Facades\Excel;
+use Illuminate\Support\Facades\Http;
 
 class InventoryController extends Controller
 {
     public function __construct()
     {
-        app()->singleton('inventoryService',InventoryAccountService::class);
-    }
-    //动库表表
-    private function conditionQuery(Request $request,$page=null,$paginate=null){
-        $date_start=$request->input('date_start');
-        $range = $request->input('range');
-        if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
-        $date_end=$request->input('date_end');
-        $TOLocation=$request->input('TOLocation');
-        $LotAtt05=$request->input('LotAtt05');
-        $LotAtt02_start=$request->input('LotAtt02_start');
-        $descr_c=$request->input('descr_c');
-        $SKU=$request->input('SKU');
-        $ALTERNATE_SKU1=$request->input('ALTERNATE_SKU1');
-        $LotAtt02_end=$request->input('LotAtt02_end');
-        $sql='select * from (select result.*,rownum rn from (';
-        $sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
-        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
-        $sql.=' lot.LotAtt04 批号 ';
-        $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
-        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
-        $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
-        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
-        $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        if ($TOLocation)$sql .= " and FMLOCATION like '".$TOLocation."' ";
-        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
-        $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        if ($TOLocation)$sql .= " and FMLocation like '".$TOLocation."' ";
-        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
-        $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
-        $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
-        $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
-        if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
-        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
-        $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
-        $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.客户 ';
-        $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';
-        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM=stockLog.FMLOTNUM ';
-        $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
-        $sql.=' and storeStatus.LocationID=stockLog.库位 ';
-        $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
-        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
-        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户  ';
-        $sql.=' )result where 1=1 ';
-        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
-        if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
-        if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
-        if ($descr_c){
-            $sql .= ' and 货主 in (';
-            $descr_cs = explode(',',$descr_c);
-            foreach ($descr_cs as $index => $descr_c){
-                if ($index != 0)$sql .= ',';
-                $sql .= "'".$descr_c."'";
-            }
-            $sql .= ') ';
-        }
-        if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
-        if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
-        $sql.=' )  ';
-        if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
-        return DB::connection('oracle')->select($sql);
-    }
-    //全部库存
-    private function conditionQueryAllInventory(Request $request,$page=null,$paginate=null){
-        $date_start=$request->date_start;
-        $range = $request->range;
-        if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
-        $date_end=$request->date_end;
-        $TOLocation=$request->TOLocation;
-        $LotAtt05=$request->LotAtt05;
-        $LotAtt02_start=$request->LotAtt02_start;
-        $descr_c=$request->descr_c;
-        $SKU=$request->SKU;
-        $ALTERNATE_SKU1=$request->ALTERNATE_SKU1;
-        $LotAtt02_end=$request->LotAtt02_end;
-        $sql='select * from (select result.*,rownum rn from (';
-        $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
-        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
-        $sql.=' lot.LotAtt04 批号 ';
-        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
-        $sql.=' INV_LOT_LOC_ID storeStatus';
-        $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
-        $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
-        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
-        $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
-        $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
-        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME  ';
-        $sql.=' )result where 1=1 ';
-        if ($TOLocation)$sql .= " and 库位 like '".$TOLocation."' ";
-        if ($SKU)$sql.=" and 产品编码 like '".$SKU."' ";
-        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
-        if ($date_start)$sql.=" and 创建时间 > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
-        if ($date_end)$sql.=" and 创建时间 < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
-        if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
-        if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
-        if ($descr_c){
-            $sql .= ' and 货主 in (';
-            $descr_cs = explode(',',$descr_c);
-            foreach ($descr_cs as $index => $descr_c){
-                if ($index != 0)$sql .= ',';
-                $sql .= "'".$descr_c."'";
-            }
-            $sql .= ') ';
-        }
-        if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
-        if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
-        $sql.=' )  ';
-        if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
-        return DB::connection('oracle')->select($sql);
+        app()->singleton('inventoryService',InventoryService::class);
     }
     //动库报表
     public function changeInventory(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
-        $page=$request->input('page')??1;
-        $paginate=$request->input('paginate')??50;
-        $oracleActTransactingLogs=$this->conditionQuery($request,$page,$paginate);
+        $oracleActTransactingLogs=app('inventoryService')->paginate($request->input());
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
-        $owners=OracleBasCustomer::select('descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
         $isTotalStock=false;
+        $page = $request->page ?? 1;
         return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));
     }
     //全部库存
     public function allInventory(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
-        $page=$request->page??1;
-        $paginate=$request->input('paginate')??50;
-        $oracleActTransactingLogs=$this->conditionQueryAllInventory($request,$page,$paginate);
+        $oracleActTransactingLogs=app('allInventoryService')->paginate($request->input());
         $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
-        $owners=OracleBasCustomer::select('descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
+        $owners=OracleBasCustomer::query()->select('customerid','descr_c')->where('customer_type','OW')->where('active_flag','Y')->get();
         $isTotalStock=true;
+        $page = $request->page ?? 1;
         return view('inventory.statement.changeInventory',compact('oracleActTransactingLogs','page','owners','isTotalStock'));
     }
     public function exportData(Request $request){
         if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
-        if (!$request->checkAllSign){
-            $oracleActTransactingLogs=json_decode($request->input('data'),true);
-            return $this->export($oracleActTransactingLogs);
-        }
-        $oracleActTransactingLogs=$this->conditionQuery($request);
-        $oracleActTransactingLogs=json_encode($oracleActTransactingLogs);
-        $oracleActTransactingLogs=json_decode($oracleActTransactingLogs,true);
-        return $this->export($oracleActTransactingLogs);
-    }
-
-    public function export($oracleActTransactingLogs){
-        $row=[[
-            'customer_descr_c'=>'货主',
-            'TOLocation'=>'库位',
-            'LotAtt05'=>'属性仓',
-            'LotAtt02'=>'失效日期',
-            'SKU'=>'产品编码',
-            'ALTERNATE_SKU1'=>'产品条码',
-            'sku_Descr_C'=>'商品名称',
-            'LotAtt08'=>'质量状态',
-            'LotAtt04'=>'批号',
-            'come_sum'=>'移出数量',
-            'join_sum'=>'移入数量',
-            'QTY'=>'在库数量',
-            'QtyAllocated'=>'占用数量',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($oracleActTransactingLogs);$i++){
-            $w=[
-                'customer_descr_c'=>$oracleActTransactingLogs[$i]['货主'],
-                'TOLocation'=>$oracleActTransactingLogs[$i]['库位'],
-                'LotAtt05'=>$oracleActTransactingLogs[$i]['属性仓'],
-                'LotAtt02'=>$oracleActTransactingLogs[$i]['失效日期'],
-                'SKU'=>$oracleActTransactingLogs[$i]['产品编码'],
-                'ALTERNATE_SKU1'=>$oracleActTransactingLogs[$i]['产品条码'],
-                'sku_Descr_C'=>$oracleActTransactingLogs[$i]['商品名称'],
-                'LotAtt08'=>$oracleActTransactingLogs[$i]['质量状态'],
-                'LotAtt04'=>$oracleActTransactingLogs[$i]['批号'],
-                'come_sum'=>isset($oracleActTransactingLogs[$i]['移出数量'])?$oracleActTransactingLogs[$i]['移出数量']:'',
-                'join_sum'=>isset($oracleActTransactingLogs[$i]['移入数量'])?$oracleActTransactingLogs[$i]['移入数量']:'',
-                'QTY'=>$oracleActTransactingLogs[$i]['在库数量'],
-                'QtyAllocated'=>$oracleActTransactingLogs[$i]['占用数量'],
-            ];
-            $list[$i]=$w;
+        if ($request->checkAllSign){
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql=app('inventoryService')->getSql($request->input());
+            return response(Http::post(config('go.export.url'),['type'=>'inventory','sql'=>$sql]),200, [
+                "Content-type"=>"application/octet-stream",
+                "Content-Disposition"=>"attachment; filename=库存记录-".date('ymdHis').'.xlsx',
+            ]);
+        }else{
+            return response(Http::post(config('go.export.url'),['type'=>'inventory','data'=>$request->data]),200, [
+                "Content-type"=>"application/octet-stream",
+                "Content-Disposition"=>"attachment; filename=库存记录-".date('ymdHis').'.xlsx',
+            ]);
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-动库报表单.xlsx');
-    }
-
-    //创建盘点任务
-    public function createStockInventoryMission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $inventory=app('inventoryService')->createMission($request);
-        if (is_null($inventory)) return ['success'=>false,'data'=>'参数错误!'];
-        return ['success'=>true,'data'=>$inventory];
-    }
-
-    //盘点-任务页面
-    public function mission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $paginateParams = $request->input();
-        $inventories=app('inventoryService')->paginate($request);
-        $owners=Owner::select('id','name')->get();
-        return view('inventory.stockInventory.mission',compact('owners','inventories','paginateParams'));
     }
-    //进入盘点页面
-    public function enterStockInventory($id){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
-        $inventory=Inventory::with('owner')->find($id);
-        $inventoryMissions=InventoryMission::with(['commodity'])->where('inventory_id',$id)->get();
-        return view('inventory.stockInventory.inventoryMission',compact('inventory','inventoryMissions'));
-    }
-    //依据盘点任务id进行 --盘点
-    public function stockInventory(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $count=$request->input('count');
-        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        $inventoryMission=app('inventoryService')->stockInventory($request);
-        if (!$inventoryMission)return ['success'=>false,'data'=>'参数错误!'];
-        $inventory=app('inventoryService')->updateInventoryMissionProcessed($request);
-        return ['success'=>true,'inventoryMission'=>$inventoryMission,'inventory'=>$inventory];
-    }
-
-    //盘点任务导出
-    public function stockInventoryExport(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','3526M');
+    public function exportAllInventory(Request $request){
+        if(!Gate::allows("库存管理-库存")){ return redirect(url('/'));  }
         if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $inventories=app('inventoryService')->get($request);
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql=app('allInventoryService')->getSql($request->input());
+            return response(Http::post(config('go.export.url'),['type'=>'allInventory','sql'=>$sql]),200, [
+                "Content-type"=>"application/octet-stream",
+                "Content-Disposition"=>"attachment; filename=全部库存-".date('ymdHis').'.xlsx',
+            ]);
         }else{
-            $inventories=app('inventoryService')->some($request);
-        }
-        $row=[[
-            'id'=>'盘点编号',
-            'created_at'=>'创建时间',
-            'owner_id'=>'货主',
-            'type'=>'任务类型',
-            'start_at'=>'起始时间',
-            'end_at'=>'结束时间',
-            'total'=>'记录数',
-            'processed'=>'已盘数',
-            'surplus'=>'剩余数',
-            'difference'=>'复盘差异',
-            'returned'=>'复盘归位',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($inventories);$i++){
-            $inventory=$inventories[$i];
-            $w=[
-                'id'=>isset($inventory->id)?$inventory->id:'',
-                'created_at'=>isset($inventory->created_at)?$inventory->created_at:'',
-                'owner_id'=>isset($inventory->owner->name)?$inventory->owner->name:'',
-                'type'=>isset($inventory->type)?$inventory->type:'',
-                'start_at'=>isset($inventory->start_at)?$inventory->start_at:'',
-                'end_at'=>isset($inventory->end_at)?$inventory->end_at:'',
-                'total'=>isset($inventory->total)?$inventory->total:'',
-                'processed'=>isset($inventory->processed)?$inventory->processed:'',
-                'surplus'=>isset($inventory->surplus)?$inventory->surplus:'',
-                'difference'=>isset($inventory->difference)?$inventory->difference:'',
-                'returned'=>isset($inventory->returned)?$inventory->returned:'',
-            ];
-            $list[$i]=$w;
+            return response(Http::post(config('go.export.url'),['type'=>'allInventory','data'=>$request->data]),200, [
+                "Content-type"=>"application/octet-stream",
+                "Content-Disposition"=>"attachment; filename=全部库存-".date('ymdHis').'.xlsx',
+            ]);
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
     }
 
     /*
@@ -301,7 +75,8 @@ class InventoryController extends Controller
      */
     function dailyLog(Request $request,OwnerService $ownerService){
         if (!Gate::allows('库存管理-库存体积')){return redirect(url('/')); }
-        $inventoryDailyLogs = app('inventoryService')->getInventoryDailyLog($request->input());
+        /** @var InventoryService*/
+        $inventoryDailyLogs = app('inventoryDailyLogService')->paginate($request->input());
         $owners = $ownerService->getSelection();
         $param = $request->input();
         return view('inventory.statement.dailyLog',compact('inventoryDailyLogs','owners','param'));
@@ -309,7 +84,7 @@ class InventoryController extends Controller
 
     //获取记录监听货主
     function getLoggingOwner(){
-        $loggingOwners = app('inventoryService')->getInventoryDailyLoggingOwner('owner_id');
+        $loggingOwners = app('inventoryDailyLogService')->getInventoryDailyLoggingOwner('owner_id');
         return array_column($loggingOwners->toArray(),'owner_id');
     }
     //添加记录监听货主
@@ -317,8 +92,22 @@ class InventoryController extends Controller
         if (!Gate::allows('库存管理-库存体积-管理监听货主')){return redirect(url('/')); }
         $owner_id = $request->owner_id;
         if (!$owner_id || !is_numeric($owner_id))return ['success'=>false,'data'=>'传递参数错误!'];
-        $loggingOwner = app('inventoryService')->firstOrCreate(['owner_id'=>$owner_id]);
+        $loggingOwner = app('inventoryDailyLogService')->firstOrCreate(['owner_id'=>$owner_id]);
         if (!$loggingOwner)return ['success'=>false,'data'=>'录入失败!'];
         return ['success'=>true,'data'=>$loggingOwner->owner_id];
     }
+    //导出库存体积记录
+    public function exportDailyLog(Request $request){
+        if (!Gate::allows('库存管理-库存体积')){return redirect(url('/')); }
+        if ($request->checkAllSign){
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql=app('inventoryDailyLogService')->getSql($params);
+
+        }else $sql=app('inventoryDailyLogService')->getSql(['id'=>$request->data]);
+        return response(Http::post(config('go.export.url'),['type'=>'inventoryDailyLog','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=库存体积记录-".date('ymdHis').'.xlsx',
+        ]);
+    }
 }

+ 31 - 51
app/Http/Controllers/LaborReportController.php

@@ -13,9 +13,9 @@ use App\UserDutyCheck;
 use App\UserWorkgroup;
 use Carbon\Carbon;
 use Illuminate\Http\Request;
-use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class LaborReportController extends Controller
@@ -44,8 +44,7 @@ class LaborReportController extends Controller
         $userWorkgroupIds=$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组'));
         $permittingWorkgroups=UserWorkgroup::whereIn('id',$userWorkgroupIds)->get();
         if($permittingWorkgroups->isEmpty())$permittingWorkgroups="[]";
-        $laborReports=app('laborReportService')->paginate($request);
-//        $laborReports=$laborReports->sortBy('name');按名字排序
+        $laborReports=app('laborReportService')->paginate($request->input());
         foreach ($laborReports as $laborReport){
             if (!$laborReport->group_user_id){
                 //2小时之内组长未审核实行软删除
@@ -61,63 +60,44 @@ class LaborReportController extends Controller
                 $this->log(__METHOD__,"进场门卫未审核该条记录将在一小时后实行软删除__".__FUNCTION__,$laborReport->toJson(),Auth::user()['id']);
             }
         }
-        $userWorkGroups=UserWorkgroup::select('id','name')->get();
+        $userWorkGroups=UserWorkgroup::query()->select('id','name')->get();
         return view('personnel/laborReport/index',compact('laborReports','userWorkGroups','laravelEchoPrefix','permittingWorkgroups','paginateParams','tokenOfBroadcastEnterAndLeave'));
     }
     public function export(Request $request){
         if (!Gate::allows('人事管理-临时工报表')){return redirect(url('/')); }
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','3526M');
         if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $laborReports=app('laborReportService')->get($request);
+            $params = $request->input();
+            unset($params["checkAllSign"]);
+            $laborReports=app('laborReportService')->get($params);
         }else{
-            $laborReports=app('laborReportService')->some($request);
+            $laborReports=app('laborReportService')->get(["id"=>$request->data]);
         }
-        $row=[[
-            'id'=>'ID',
-            'enter_number'=>'进厂编号',
-            'user_workgroup_name'=>'小组',
-            'name'=>'临时工',
-            'mobile_phone'=>'电话',
-            'identity_number'=>'身份证号',
-            'labor_company'=>'劳务所',
-            'enter_at'=>'进场时间',
-            'check_in_at'=>'进组时间',
-            'check_out_at'=>'退组时间',
-            'exit_at'=>'退场时间',
-            'verify_at'=>'审核时间',
-            'group_user_id'=>'审核人',
-            'relax_time'=>'晚饭时间(分)',
-            'online_duration'=>'在线时长',
-            'working_duration'=>'本次工作时长',
-            'remark'=>'备注',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($laborReports);$i++){
-            $laborReport=$laborReports[$i];
-            $w=[
-                'id'=>isset($laborReport->id)?$laborReport->id:'',
-                'enter_number'=>isset($laborReport->enter_number)?$laborReport->enter_number:'',
-                'user_workgroup_name'=>isset($laborReport->userWorkgroup->name)?$laborReport->userWorkgroup->name:'',
-                'name'=>isset($laborReport->name)?$laborReport->name:'',
-                'mobile_phone'=>isset($laborReport->mobile_phone)?$laborReport->mobile_phone:'',
-                'identity_number'=>isset($laborReport->identity_number)?$laborReport->identity_number:'',
-                'labor_company'=>isset($laborReport->labor_company)?$laborReport->labor_company:'',
-                'enter_at'=>isset($laborReport->enter_at)?$laborReport->enter_at:'',
-                'check_in_at'=>isset($laborReport->check_in_at)?$laborReport->check_in_at:'',
-                'check_out_at'=>isset($laborReport->check_out_at)?$laborReport->check_out_at:'',
-                'exit_at'=>isset($laborReport->exit_at)?$laborReport->exit_at:'',
-                'verify_at'=>isset($laborReport->verify_at)?$laborReport->verify_at:'',
-                'group_user_id'=>isset($laborReport->user->name)?$laborReport->user->name:'',
-                'relax_time'=>isset($laborReport->relax_time)?$laborReport->relax_time:'',
-                'online_duration'=>isset($laborReport->online_duration)?$laborReport->online_duration:'',
-                'working_duration'=>isset($laborReport->working_duration)?$laborReport->working_duration:'',
-                'remark'=>isset($laborReport->remark)?$laborReport->remark:'',
+        $data = [];
+        foreach ($laborReports as $laborReport){
+            $row = [
+                "enter_number" => $laborReport->enter_number,
+                "user_workgroup_name" => $laborReport->userWorkgroup ? $laborReport->userWorkgroup->name : null,
+                "name" => $laborReport->name,
+                "mobile_phone" => $laborReport->mobile_phone,
+                "identity_number" => $laborReport->identity_number,
+                "labor_company" => $laborReport->labor_company,
+                "enter_at" => $laborReport->enter_at,
+                "check_in_at" => $laborReport->check_in_at,
+                "check_out_at" => $laborReport->check_out_at,
+                "exit_at" => $laborReport->exit_at,
+                "verify_at" => $laborReport->verify_at,
+                "group_user_id" => $laborReport->user ? $laborReport->user->name : null,
+                "relax_time" => $laborReport->relax_time,
+                "online_duration" => $laborReport->online_duration,
+                "working_duration" => $laborReport->working_duration,
+                "remark" => $laborReport->remark,
             ];
-            $list[$i]=$w;
+            array_push($data,$row);
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-临时工报表记录单.xlsx');
+        return response(Http::post(config('go.export.url'),['type'=>'laborReport','data'=>json_encode($data,JSON_UNESCAPED_UNICODE)]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=临时工报表记录-".date('ymdHis').'.xlsx',
+        ]);
     }
 
     //门卫打卡审核

+ 52 - 12
app/Http/Controllers/OrderController.php

@@ -11,11 +11,12 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class OrderController extends Controller
 {
-    private function preciseQuery($request,$sql){
+    private function preciseQuery(Request $request,$sql){
         $orderdate_start=$request->input('orderdate_start');
         $orderdate_end=$request->input('orderdate_end');
         $customerid=$request->input('customerid');
@@ -30,8 +31,36 @@ class OrderController extends Controller
         $addtime=$request->input('addtime');
         $waveno=$request->input('waveno');
         $alternate_sku1=$request->input('alternate_sku1');
+        $c_contact = $request->input('c_contact');
+        $c_tel2 = $request->input('c_tel2');
+        $c_province = $request->input('c_province');
+        $c_city = $request->input('c_city');
+        $c_district = $request->input('c_district');
+        $releasestatus = $request->input('releasestatus');
+        $ordernos = $request->input('ordernos');
         $edisendflag2=$request->edisendflag2;
         $edisendflag=$request->edisendflag;
+        if ($ordernos){
+            $sql .= " AND orderno IN ".$ordernos;
+        }
+        if ($c_contact){
+            $sql .= " AND c_contact like '".$c_contact."'";
+        }
+        if ($c_tel2){
+            $sql .= " AND c_tel2 like '".$c_tel2."'";
+        }
+        if ($c_province){
+            $sql .= " AND c_province like '".$c_province."'";
+        }
+        if ($c_city){
+            $sql .= " AND c_city like '".$c_city."'";
+        }
+        if ($c_district){
+            $sql .= " AND c_district like '".$c_district."'";
+        }
+        if ($releasestatus){
+            $sql .= " AND releasestatus = '".$releasestatus."'";
+        }
         if ($alternate_sku1){
             if ($request->checkAllSign) $detailsOrderno = $this->getOrdersNo($alternate_sku1,false);
             else $detailsOrderno = $this->getOrdersNo($alternate_sku1,true, $request->page ?? 1, $request->paginate ?? 50);
@@ -149,6 +178,12 @@ class OrderController extends Controller
         if ($request->alternate_sku1){
             $page = 1;$paginate=50;
         }
+        if ($request->checktime_start || $request->checktime_end){
+            $ordernos = app('oracleActAllocationDetailService')
+                ->getOrderno(['checktime_start'=>$request->checktime_start,'checktime_end'=>$request->checktime_end,
+                    'paginate'=>$request->paginate,'page'=>$request->page]);
+            $request->offsetSet('ordernos',$ordernos);
+        }
         $checkData=$request->input('data');
         $export=$request->input('checkAllSign');
         $sql="select ACT_ALLOCATION_DETAILS.picktotraceid,ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID
@@ -192,14 +227,14 @@ class OrderController extends Controller
                       left join BAS_Customer on BAS_Customer.customerid=DOC_ORDER_HEADER.customerid
                       left join  BAS_SKU on DOC_Order_Details.CustomerID=BAS_SKU.CustomerID and DOC_Order_Details.SKU=BAS_SKU.SKU
                       left join ACT_ALLOCATION_DETAILS on DOC_Order_Details.orderno=ACT_ALLOCATION_DETAILS.orderno and
-                      DOC_Order_Details.orderlineno=ACT_ALLOCATION_DETAILS.orderlineno";
+                      DOC_Order_Details.orderlineno=ACT_ALLOCATION_DETAILS.orderlineno WHERE 1=1";
+        //转导出
         if ($checkData || $export){
             return response(Http::post(config('go.export.url'),['type'=>'order','sql'=>$sql]),200, [
                 "Content-type"=>"application/octet-stream",
                 "Content-Disposition"=>"attachment; filename=订单记录-".date('ymdHis').'.xlsx',
             ]);
         }
-
         $orders=DB::connection('oracle')->select(DB::raw($sql));
         $commodities=[];
         $picktotraceids=[];
@@ -300,9 +335,6 @@ class OrderController extends Controller
         $checkData=$request->input('checkData')??'';
         //取消分配条件只局限于 分配完成sostatus=40 和 部分分配sostatus=30
         $sostatus=['30','40'];
-//        $orders=OracleDOCOrderHeader::select('OrderNo','SoStatus')->whereIn('orderno',$checkData)->where(function($query){
-//            $query->orWhere('SoStatus','30')->orWhere('SoStatus','40');
-//        })->toSql();
         $orders=OracleDOCOrderHeader::select('OrderNo','SoStatus')->whereIn('orderno',$checkData)->whereIn('SoStatus',$sostatus)->get();
         if(count($checkData)!=count($orders))return ['success'=>false,'fail_info'=>"勾选订单有不可取消分配订单"];
         foreach ($orders as $order){
@@ -323,10 +355,6 @@ class OrderController extends Controller
         if(!Gate::allows('订单管理-编辑')){ return redirect(url('/'));  }
         $orderno=$request->input('orderno');
         $waveno=$request->input('waveno');
-//        $order=OracleDOCOrderHeader::where('orderno',$orderno)->first();
-//        if(!($order['codename_c']==='创建订单'||$order['codename_c']==='分配完成'||$order['codename_c']==='拣货完成'||$order['codename_c']==='播种完成')){
-//            return ['success'=>false];
-//        }
         if ($waveno && $waveno!='*'){
             OracleDOCWaveDetails::where('waveno',$waveno)->where('orderno',$orderno)->delete();
             $this->log(__METHOD__,'冻结删除波次号'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
@@ -337,12 +365,24 @@ class OrderController extends Controller
     }
     public function thaw(Request $request){
         if(!Gate::allows('订单管理-编辑')){ return redirect(url('/'));  }
-        $orderno=$request->input('orderno');
-        OracleDOCOrderHeader::where('orderno',$orderno)->update(['releasestatus'=>'N']);
+        $orderno = $request->orderno;
+        if (!is_array($orderno)) {
+            $orderno = [$orderno];
+        }
+        OracleDOCOrderHeader::query()->whereIn('orderno',$orderno)->update(['releasestatus'=>'N']);
         $this->log(__METHOD__,'解冻'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
         return ['success'=>true];
     }
 
+    //重置快递获取标记
+    public function resetLogisticsGetMark(Request $request){
+        if(!Gate::allows('订单管理-编辑')){ return redirect(url('/'));  }
+        $orderno=$request->orderno;
+        OracleDOCOrderHeader::query()->whereIn('orderno',$orderno)->where('edisendflag2','W')->update(['edisendflag2'=>'N']);
+        $this->log(__METHOD__,'解冻'.__FUNCTION__,json_encode($orderno),Auth::user()['id']);
+        return ['success'=>true];
+    }
+
     function export($orders,$commodities){
         if(!Gate::allows('订单管理')){ return redirect(url('/'));  }
         ini_set('max_execution_time',3500);

+ 18 - 142
app/Http/Controllers/OrderIssueController.php

@@ -3,7 +3,6 @@
 namespace App\Http\Controllers;
 
 use App\Exports\Export;
-use App\Imports\OrderIssueExport;
 use App\Imports\OrderIssueImport;
 use App\Logistic;
 use App\OracleDOCOrderHeader;
@@ -23,6 +22,7 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Validator;
 use Maatwebsite\Excel\Facades\Excel;
 
@@ -59,7 +59,7 @@ class OrderIssueController extends Controller
         $userWorkGroup = UserWorkgroup::all();
         $logistic = Logistic::all();
         $owners = Owner::all();
-        return view('order.issue.create', compact(['types', 'meg', 'userWorkGroup', 'logistic', 'owners']));
+        return view('order.issue.create', compact('types', 'meg', 'userWorkGroup', 'logistic', 'owners'));
     }
 
     public function store(Request $request)
@@ -84,7 +84,7 @@ class OrderIssueController extends Controller
         $owners = Owner::all();
         $orderIssues = $orderIssueService->paginate($request->all());
         OrderIssueProcessLog::create(['order_issue_id' => $orderIssue['id'], 'user_id' => Auth::user()['id'], 'content' => '创建订单问题件', 'type' => '创建']);
-        return redirect('order/issue/index'); /*view('order.issue.index', compact('owners', 'orderIssues', 'msg'))*/;
+        return redirect('order/issue/index');
     }
 
     public function edit($id)
@@ -109,17 +109,7 @@ class OrderIssueController extends Controller
         $owners = Owner::all();
         $shops = Shop::all();
         $logistics = Logistic::all();
-        return view('order/issue/edit', compact(['orderIssue', 'owners', 'userWorkgroup', 'shops', 'logistics', 'orderIssueType', 'order', 'secondOrder', 'rejectedBill']));
-    }
-
-    public function update(Request $request)
-    {
-        //
-    }
-
-    public function destroy(Request $request)
-    {
-
+        return view('order/issue/edit', compact('orderIssue', 'owners', 'userWorkgroup', 'shops', 'logistics', 'orderIssueType', 'order', 'secondOrder', 'rejectedBill'));
     }
 
     public function batchImport(Request $request)
@@ -153,137 +143,23 @@ class OrderIssueController extends Controller
 
     public function exportOrderIssue(Request $request)
     {
-        $orderIssueService = app('orderIssueService');
-        $resultData = $orderIssueService->exportExcel($request);
-        $row = [[
-            'id' => 'ID', 'order_created_at' => '登记日期', 'created_at' => '创建日期', 'owner' => '客户', 'shop' => '店铺', 'client_code' => '客户订单号',
-            'logistic' => '原始承运商', 'logistic_number' => '原始运单号', 'consignee_name' => '收货人', 'consignee_phone' => '收货电话',
-            'province' => '省', 'city' => '市', 'district' => '区', 'address' => '收货人地址',
-            'commodity_code' => '商品条码', 'commodity_name' => '商品名称', 'amount' => '数量',
-            'barcode_goods' => '商品条码', 'name_goods' => '商品名称', 'goods_amount' => '数量', 'is_checked' => '是否正品', 'remark' => '备注',
-            'rejecting_status' => '退单状态',
-            'logtype' => '操作类型', 'logremark' => '说明', 'user' => '操作者',
-            'order_issue_type' => '问题类别',
-            'second_order' => '二次订单', 'second_logistic' => '二次承运商', 'second_logistic_number' => '二次运单号',
-            's_commodity_code' => '条码', 's_commodity_name' => '商品名', 's_amount' => '数量', /*'s_is_checked' => '是否正品', 's_remark' => '备注',*/
-            'final_status' => '最终状态', 'logistic_indemnity_money' => '承运商赔偿金额', 'logistic_express_remission' => '承运商快递减免',
-            'baoshi_indemnity_money' => '宝时赔偿金额', 'baoshi_express_remission' => '宝时快递减免', 'user_workgroup' => '事故责任方']];
-
-        $list = [];
-        $mergeCell = [];
-        $i = 0;
-        foreach ($resultData as $result) {
-            $count = 0;
-            $list[$i] = [
-                'id' => $result->id,
-                'created_at' => $result->created_at,    // 登记日期
-                'order_created_at' => isset($result->order) ? $result->order->created_at : '', // 订单创建日期
-                'final_status' => $result->final_status,     // 最终处理结果
-                'order_issue_type' => isset($result->type) ? $result->type->name : '',
-                'logistic_indemnity_money' => $result->logistic_indemnity_money,
-                'logistic_express_remission' => $result->logistic_express_remission,
-                'baoshi_indemnity_money' => $result->baoshi_indemnity_money,
-                'baoshi_express_remission' => $result->baoshi_express_remission,
-                'user_workgroup' => isset($result->userWorkGroup) ? $result->userWorkGroup->name : '',
-                'rejecting_status' => isset($result->rejecting_status) ? $result->rejecting_status : '',
-            ];
-            $sign = $i + 2;
-            if (isset($result->order)) {
-                $list[$i]['shop'] = $result->order->shop ? $result->order->shop->name : '';// 店铺
-                $list[$i]['owner'] = $result->order->owner ? $result->order->owner->name : '';// 货主
-                $list[$i]['logistic'] = $result->order->logistic ? $result->order->logistic->name : '';
-                $list[$i]['consignee_name'] = $result->order->consignee_name;
-                $list[$i]['consignee_phone'] = $result->order->consignee_phone;
-                $list[$i]['province'] = $result->order->province;
-                $list[$i]['city'] = $result->order->city;
-                $list[$i]['district'] = $result->order->district;
-                $list[$i]['address'] = $result->order->address;
-                $list[$i]['client_code'] = $result->order->client_code;
-                $list[$i]['logisticNumbers'] = $result->order->logistic_number;
-                $cell = $i;
-                if (isset($result->order->packages)) {
-                    $packages = $result->order->packages;
-                    foreach ($packages as $key => $value) {
-                        if (isset($value->commodities)) {
-                            $commodities = $value->commodities;
-                            foreach ($commodities as $commodity) {
-                                $list[$cell]['commodity_code'] = isset($commodity->commodity) ? $commodity->commodity->sku : '';
-                                $list[$cell]['commodity_name'] = isset($commodity->commodity) ? $commodity->commodity->name : '';
-                                $list[$cell]['amount'] = $commodity->amount;
-                                $cell++;
-                            }
-                        }
-                    }
-                    $count = $cell - $i;
-                }
-            }
-            if (isset($result->logs)) {
-                $logs = $result->logs;
-                $cell = $i;
-                foreach ($logs as $log) {
-                    $list[$cell]['logtype'] = $log->type;
-                    $list[$cell]['logremark'] = $log->content;
-                    $list[$cell]['user'] = isset($log->user) ? $log->user->name : "";
-                    $cell++;
-                }
-                $count = $cell - $i > $count ? $cell - $i : $count;
-            }
-            if (isset($result->secondOrder)) {
-                $list[$i]['second_order'] = $result->secondOrder->code;
-                $list[$i]['second_logistic'] = $result->secondOrder->logistic->name;
-                $list[$i]['second_logistic_number'] = $result->secondOrder->code;
-                $secondOrder = $result->secondOrder;
-                if (isset($secondOrder->secondOrder->packages)) {
-                    $packages = $result->order->packages;
-                    $cell = $i;
-                    foreach ($packages as $key => $value) {
-                        if (isset($value->commodities)) {
-                            $commodities = $value->commodities;
-                            foreach ($commodities as $commodity) {
-                                $list[$cell]['s_commodity_code'] = isset($commodity->commodity) ? $commodity->commodity->sku : '';
-                                $list[$cell]['s_commodity_name'] = isset($commodity->commodity) ? $commodity->commodity->name : '';
-                                $list[$cell]['s_amount'] = $commodity->amount;
-                                $cell++;
-                            }
-                        }
-                    }
-                    $count = $cell - $i > $count ? $cell - $i : $count;
-                }
-            }
-            if (isset($result->rejectedBill)) {
-                $items = $result->rejectedBill->items ?? [];
-                $cell = $i;
-                foreach ($items as $key => $value) {
-                    $list[$cell]['barcode_goods'] = $value['barcode_goods'];
-                    $list[$cell]['name_goods'] = $value['name_goods'];
-                    $list[$cell]['goods_amount'] = $value['amount'];
-                    $list[$cell]['is_checked'] = $value['is_checked'];
-                    $list[$cell]['remark'] = $value['remark'];
-                    $cell++;
-                }
-                $count = $cell - $i > $count ? $cell - $i : $count;
-            }
-            $i += $count;
-            $mergeCell[$sign] = $i + 1;
-        }
-        $columnName = [
-            "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", /* "O", "P","Q",*//* "R", "S", "T", "U", "V",*/
-            "W", /*"X", "Y",*/"Z", "AA", "AB", "AC", /*"AD", "AF", "AG",*/"AH", "AI", "AJ", "AK", "AL", "AM"];
-        if (Gate::has('客户不可见')) {
-            unset($row[0]['baoshi_indemnity_money']);
-            unset($columnName['AK']);
-        }
-        foreach ($list as $key => &$value) {
-            foreach ($row[0] as $rowKey => $rowValue) {
-                if (!isset($value[$rowKey])) {
-                    $value[$rowKey] = '';
-                }
-            }
+        if (!Gate::allows('订单管理-问题件-查询')) {
+            return redirect(url('/'));
         }
-        return Excel::download(new Export($row, $list, $mergeCell, $columnName), date('YmdHis', time()) . '-订单问题件.xlsx');
+        if ($request->checkAllSign){
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sqlList = app('orderIssueService')->getSqlList($params);
+        }else{
+            $sqlList = app('orderIssueService')->getSqlList(['id'=>$request->data]);
+        }
+        return response(Http::post(config('go.export.url'),['type'=>'orderIssue','sqlList'=>json_encode($sqlList)]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=订单问题件-".date('ymdHis').'.xlsx',
+        ]);
     }
 
-    public function excelImport(Request $request)
+    public function excelImport()
     {
         if (!Gate::allows('订单管理-订单问题件生成')) {
             return redirect(url('/'));

+ 62 - 154
app/Http/Controllers/PackageController.php

@@ -2,20 +2,18 @@
 
 namespace App\Http\Controllers;
 
-use App\Exports\Export;
-use App\Logistic;
-use App\Owner;
 use App\Package;
 use App\PaperBox;
+use App\Services\LogisticService;
 use App\Services\OwnerService;
 use App\Services\PackageService;
+use App\Services\PackageStatisticsService;
 use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Validator;
-use Maatwebsite\Excel\Facades\Excel;
 
 
 class PackageController extends Controller
@@ -72,6 +70,19 @@ class PackageController extends Controller
         $package=null;
         $successTip = '操作成功';
 
+
+        /** @var Package $package */
+        if ($order_code){
+            $package=Package::query()->where('order_code',$order_code)->first();
+        }else{
+            if($batch_number){
+                $package=Package::query()->where('batch_number',$batch_number)->first();
+
+            }elseif($logistic_number){
+                $package=Package::query()->where('logistic_number',$logistic_number)->first();
+            }
+        }
+        if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
         $accomplishToWMS=new Api\thirdPart\flux\PackageController();
         if($batch_number){
             $this->log(__METHOD__,'活动波次开始同步_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
@@ -89,17 +100,6 @@ class PackageController extends Controller
             Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].$batch_number);
             return redirect('package/create')->with('successError','录入失败!'.$result['message']);
         }
-
-        if ($order_code){
-            $package=Package::where('order_code',$order_code)->first();
-        }else{
-            if($batch_number){
-                $package=Package::where('batch_number',$batch_number)->first();
-            }elseif($logistic_number){
-                $package=Package::where('logistic_number',$logistic_number)->first();
-            }
-        }
-        if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
         if ($package){
             if(!$package->batch_number)$package->batch_number=$batch_number;
             if(!$package->order_code)$package->order_code=$order_code;
@@ -142,119 +142,32 @@ class PackageController extends Controller
     }
 
 
+    /**
+     * @param Request $request
+     * @return void
+     * @var LogisticService
+     * @var OwnerService
+     */
     public function statistics(Request $request){
-        $packages=Package::select(DB::raw('owner_id,logistic_id,COUNT(logistic_id) AS count'))->whereNotNull('owner_id');
-        if($request->input('owner_id')){
-            $owners_id=$id = explode( ',',$request->input('owner_id'));
-            $packages=$packages->whereIn('owner_id',$owners_id);
-        }
-        if($request->input('logistic_id')){
-            $logistics_id=$id = explode( ',',$request->input('logistic_id'));
-            $packages=$packages->whereIn('logistic_id',$logistics_id);
-        }
-        if($request->input('date_start')){
-            $packages=$packages->where('created_at','>=',$request->input('date_start'));
-        }
-        if($request->input('date_end')){
-            $packages=$packages->where('created_at','<=',$request->input('date_end'));
-        }
-        $packages=$packages->groupBy(['owner_id','logistic_id'])->get();
-        $owners=Owner::get();
-        $logistics=Logistic::get();
-        if ($request->input('checkSign')){
-            $logistics=$this->checkLogistic($packages);
-            if ($request->input('checkSign')=="-1"){
-                $excel=$this->statisticExport($packages,$owners,$logistics);
-                return $excel;
-            }
-            $id=$id = explode( ',',$request->input('checkSign'));
-            $packages=Package::select(DB::raw('owner_id,logistic_id,COUNT(logistic_id) AS count'))
-                ->whereIn('owner_id',$id)->groupBy(['owner_id','logistic_id'])->get();
-            $logistics=$this->checkLogistic($packages);
-            $excel=$this->statisticExport($packages,$owners,$logistics);
-            return $excel;
-
-        }
+        $packages = app('packageStatisticsService')->get($request->input());
+        $owners=app('ownerService')->getSelection();
+        $logistics=app('logisticService')->getSelection();
         return view('weight.package.statistics',["packages"=>$packages,'owners'=>$owners,'logistics'=>$logistics]);
     }
 
-    /*
-     * 根据packages统计记录删选物流公司
-     */
-    public function checkLogistic($packages){
-        $logisticIds=[];
-        foreach ($packages as $package){
-            $isLogistic=true;
-            for ($i=0;$i<count($logisticIds);$i++){
-                if ($package->logistic_id==$logisticIds[$i]){
-                    $isLogistic=false;
-                    break;
-                }
-            }
-            if ($isLogistic){
-                array_push($logisticIds,$package->logistic_id);
-            }
-        }
-        $logistics=Logistic::whereIn('id',$logisticIds)->get();
-        return $logistics;
-    }
-
     public function export(Request $request){
         if(!Gate::allows('称重管理-查询')){ return '没有权限';  }
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','3526M');
         if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $packages = app('packageService')->get($request);
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql = app('packageService')->getSql($params);
         }else{
-            $packages=app('packageService')->some($request);
-        }
-        $row=[[
-            'id'=>'ID',
-            'owner_name'=>'货主',
-            'logistic_number'=>'快递单号',
-            'delivery_number'=>'发货单号',
-            'batch_number'=>'波次号',
-            'batch_rule'=>'波次规则',
-            'created_at'=>'操作时间',
-            'recipient'=>'收件人',
-            'recipient_mobile'=>'收件人电话',
-            'logistic_name'=>'承运商',
-            'measuringMachine_name'=>'设备',
-            'weight'=>'重量(KG)',
-            'length'=>'长(CM)',
-            'width'=>'宽(CM)',
-            'height'=>'高(CM)',
-            'bulk'=>'体积(DM³)',
-            'paperBox_name'=>'纸箱',
-            'status'=>'状态',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($packages);$i++){
-            $package=$packages[$i];
-            $w=[
-                'id'=>isset($package->id)?$package->id:'',
-                'owner_name'=>isset($package->owner_name)?$package->owner_name:'',
-                'logistic_number'=>isset($package->logistic_number)?$package->logistic_number:'',
-                'delivery_number'=>isset($package->delivery_number)?$package->delivery_number:'',
-                'batch_number'=>isset($package->batch_number)?$package->batch_number:'',
-                'batch_rule'=>isset($package->batch_rule)?$package->batch_rule:'',
-                'created_at'=>isset($package->created_at)?$package->created_at:'',
-                'recipient'=>isset($package->recipient)?$package->recipient:'',
-                'recipient_mobile'=>isset($package->recipient_mobile)?$package->recipient_mobile:'',
-                'logistic_name'=>isset($package->logistic_name)?$package->logistic_name:'',
-                'measuringMachine_name'=>isset($package->measuringMachine_name)?$package->measuringMachine_name:'',
-                'weight'=>isset($package->weight)?$package->weight:'',
-                'length'=>isset($package->length)?$package->length/10:'',
-                'width'=>isset($package->width)?$package->width/10:'',
-                'height'=>isset($package->height)?$package->height/10:'',
-                'bulk'=>isset($package->bulk)?round($package->bulk/10000)/100:'',//立方毫米到立方分米带双小数
-                'paperBox_name'=>isset($package->paperBox_name)?$package->paperBox_name:'',
-                'status'=>isset($package->status)?$package->status:''
-            ];
-            $list[$i]=$w;
+            $sql=app('packageService')->getSql(['id'=>$request->data]);
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-称重记录单.xlsx');
+        return response(Http::post(config('go.export.url'),['type'=>'package','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=包裹信息-".date('ymdHis').'.xlsx',
+        ]);
     }
     protected function validator(Request $request){
         $validator=Validator::make($request->input(),[
@@ -323,45 +236,40 @@ class PackageController extends Controller
 //
 //    }
 
-    public function statisticExport($packages,$owners,$logistics){
-        if (!$packages||!$owners||!$logistics) return;
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','2726M');
-        $row=[[]];
-        $row[0]['owner']='货主';
-        $row[0]['sum']='总计';
-        foreach ($logistics as $logistic){
-            $row[0][$logistic->id]=$logistic->name;
+    public function statisticsExport(Request $request){
+        if(!Gate::allows('称重管理-查询')){ return '没有权限';  }
+        if ($request->checkAllSign){
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $data = app('packageStatisticsService')->get($params);
+        }else{
+            /**@var PackageStatisticsService */
+            $data = app('packageStatisticsService')->get(['owner_id'=>$request->data]);
         }
-        $ownerArr=[];
-        foreach ($owners as $owner){
-            foreach ($packages as $package){
-                if ($owner->id==$package->owner_id){
-                    $ownerArr[$owner->name][$package->logistic_id]=$package->count;
+        $column = ["货主","总计"];
+        $columnMap = ["货主"=>0,"总计"=>1];
+        $row = [];
+        $rowMap = [];
+        $coordinate = [];
+        foreach ($data as $value){
+            if ($value->owner_name && $value->logistic_name){
+                if (!isset($columnMap[$value->logistic_id])){
+                    array_push($column,$value->logistic_name);
+                    $columnMap[$value->logistic_id] = count($column)-1;
                 }
-            }
-        }
-        $list=[];
-        $i=0;
-        foreach ($owners as $owner){
-            if (isset($ownerArr[$owner->name])){
-                $w['owner']=$owner->name;
-                $sum=0;
-                foreach ($logistics as $logistic){
-                    if (isset($ownerArr[$owner->name][$logistic->id])){
-                        $w[$logistic->id]=$ownerArr[$owner->name][$logistic->id];
-                        $sum=$sum+$ownerArr[$owner->name][$logistic->id];
-                    }
-                    if (!isset($ownerArr[$owner->name][$logistic->id])){
-                        $w[$logistic->id]=0;
-                    }
+                if (!isset($rowMap[$value->owner_id])){
+                    array_push($row,$value->owner_name);
+                    $rowMap[$value->owner_id] = count($row)-1 ;
                 }
-                $w['sum']=$sum;
-                $list[$i]=$w;
-                $i++;
+                if (isset($coordinate[$rowMap[$value->owner_id]])){
+                    $coordinate[$rowMap[$value->owner_id]][$columnMap[$value->logistic_id]] = (string)$value->count;
+                }else $coordinate[$rowMap[$value->owner_id]] = [0 => $value->owner_name,$columnMap[$value->logistic_id] => (string)$value->count];
             }
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-称重统计记录单.xlsx');
+        return response(Http::post(config('go.export.url'),['type'=>'packageStatistic','data'=>json_encode(["row"=>$column,"list"=>$coordinate],JSON_UNESCAPED_UNICODE)]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=称重统计信息单-".date('ymdHis').'.xlsx',
+        ]);
     }
 
 

+ 15 - 91
app/Http/Controllers/ProcessController.php

@@ -14,7 +14,6 @@ use App\ProcessesContent;
 use App\ProcessMethod;
 use App\ProcessStatistic;
 use App\Services\OwnerService;
-use App\Services\ProcessService;
 use App\Sign;
 use App\Tutorial;
 use App\UserDetail;
@@ -25,17 +24,13 @@ use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Validator;
 use Maatwebsite\Excel\Facades\Excel;
 use Ramsey\Uuid\Uuid;
 
 class ProcessController extends Controller
 {
-    public function __construct()
-    {
-        app()->singleton('processService',ProcessService::class);
-    }
-
     /**
      * Display a listing of the resource.
      * @param Request $request
@@ -46,7 +41,7 @@ class ProcessController extends Controller
     {
         if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
         $paginateParams = $request->input();
-        $processes = app('processService')->paginate($request);
+        $processes = app('processService')->paginate($paginateParams);
         $owners=$ownerService->getSelection();
         return view('process.index',['processes'=>$processes,'owners'=>$owners,'paginateParams'=>$paginateParams]);
     }
@@ -210,7 +205,7 @@ class ProcessController extends Controller
         $this->log(__METHOD__,"完成二次加工单_".__FUNCTION__,json_encode($process)." || ".json_encode($processStatistic),Auth::user()['id']);
         return ['success'=>true,'data'=>'交接完成'];
     }
-    private function statistic($process){
+    private function statistic($process, $sign_end = false){
         if (count($process->processDailies)>0){
             $completed_amount=0;
             foreach ($process->processDailies as $processDaily){
@@ -226,7 +221,6 @@ class ProcessController extends Controller
         $total_cost=0;              //合计成本
         foreach ($processDailies as $processDailyOne){
             foreach ($processDailyOne->processDailyParticipants as $processDailyParticipant){
-                //$processDailyParticipant=$this->countParticipantManHour($processDailyParticipant,$processDailyOne->date);
                 $duration_man_hours += $processDailyParticipant->hour_count;
                 if ($processDailyParticipant->unit_count){
                     $total_cost += ($processDailyParticipant->unit_count)*($processDailyParticipant->unit_price);
@@ -239,13 +233,14 @@ class ProcessController extends Controller
         $gross_profit=$revenue-$total_cost; //毛利润
         if ($gross_profit!=0)$gross_profit_rate=$gross_profit/$revenue;  //毛利率;
         else $gross_profit_rate=0;
-        $processStatistic=ProcessStatistic::find($process->id);
+        $processStatistic=ProcessStatistic::query()->find($process->id);
         $processStatistic->revenue=$revenue;
         $processStatistic->duration_days=$duration_days;
         $processStatistic->duration_man_hours=$duration_man_hours;
         $processStatistic->total_cost=$total_cost;
         $processStatistic->gross_profit=$gross_profit;
         $processStatistic->gross_profit_rate=$gross_profit_rate;
+        if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
         $processStatistic->update();
         $this->log(__METHOD__,"修改二次加工单统计单_".__FUNCTION__,json_encode($processStatistic),Auth::user()['id']);
         return ['success'=>true,'data'=>$processStatistic];
@@ -465,7 +460,7 @@ class ProcessController extends Controller
                 array_push($tutorials_id,$tutorial->id);
             }
         }
-        $tutorials=Tutorial::where('owner_id',$process->owner_id)->get();
+        $tutorials=Tutorial::query()->where('owner_id',$process->owner_id)->get();
         if ($tutorials_id && $tutorials) $tutorials=$tutorials->diff(Tutorial::whereIn('id',$tutorials_id)->get());
         return ['success'=>true,'data'=>$tutorials];
     }
@@ -849,7 +844,7 @@ class ProcessController extends Controller
             $query->where('type','成品单');
         }]);
         if (count($process->processesContents) == 0)return ['success'=>false,'data'=>'没有成本单不得验收!'];
-        $result=$this->statistic($process);
+        $result=$this->statistic($process, true);
         if (!$result['success'])return $result;
         $process->update([
             'status'=>'待交接'
@@ -1047,85 +1042,14 @@ class ProcessController extends Controller
     public function export(Request $request){
         if(!Gate::allows('二次加工管理-查询')){ return '没有权限';  }
         if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $processes = app('processService')->get($request);
-        }else $processes = app('processService')->some($request);
-        $row=[[
-            'id'=>'ID',
-            'code'=>'任务号',
-            'owner_name'=>'货主',
-            'process_method_name'=>'加工类型',
-            'amount'=>'预期数量',
-            'completed_amount'=>'实际数量',
-            'status'=>'状态',
-            'remark'=>'备注',
-            'unit_price'=>'单价',
-            'created_at'=>'提交日期',
-            'bill_type'=>'单据类型',
-            'wms_code'=>'单据号',
-            'commodity_barcode'=>'商品编码',
-            'commodity_name'=>'商品名称',
-            'thisAmount'=>'本次数量',
-        ]];
-        $list=[];
-        $i=0;
-        $mergeCell=[];
-        foreach ($processes as $process){
-            if (count($process->processesContents)<1){
-                $w=[
-                    'id'=>$process->id,
-                    'code'=>$process->code ,
-                    'owner_name'=>$process->owner_name ,
-                    'bill_type'=>'' ,
-                    'wms_code'=>'' ,
-                    'process_method_name'=>$process->process_method_name,
-                    'amount'=>$process->amount,
-                    'thisAmount'=>'',
-                    'unit_price'=>$process->unit_price,
-                    'created_at'=>$process->created_at ,
-                    'commodity_name'=>'',
-                    'commodity_barcode'=>'',
-                    'completed_amount'=>$process->completed_amount,
-                    'status'=>$process->status,
-                    'remark'=>$process->remark,
-                ];
-                $list[$i]=$w;
-                $i++;
-                continue;
-            }
-            $sign=$i+2;
-            foreach($process->processesContents as $processesContent){
-                $barcodes="";
-                if ($processesContent->commodity && $processesContent->commodity->barcodes){
-                    foreach ($processesContent->commodity->barcodes as $barcode){
-                        if (!$barcodes){$barcodes=$barcode->code;  continue;}
-                        $barcodes=$barcodes.",".$barcode->code;
-                    }
-                }
-                $w=[
-                    'id'=>$process->id,
-                    'code'=>$process->code ,
-                    'owner_name'=>$process->owner_name ,
-                    'bill_type'=>$processesContent->bill_type ,
-                    'wms_code'=>$processesContent->wms_code ,
-                    'process_method_name'=>$process->process_method_name,
-                    'amount'=>$process->amount,
-                    'thisAmount'=>$processesContent->amount,
-                    'unit_price'=>$process->unit_price,
-                    'created_at'=>$process->created_at ,
-                    'commodity_barcode'=>$barcodes,
-                    'commodity_name'=>$processesContent->commodity_name ,
-                    'completed_amount'=>$process->completed_amount,
-                    'status'=>$process->status,
-                    'remark'=>$process->remark,
-                ];
-                $list[$i]=$w;
-                $i++;
-            }
-            $mergeCell[$sign] = $i+1;
-        }
-        $columnName=["A","B","C","D","E","F","G","H","I","J"];
-        return Excel::download(new Export($row,$list,$mergeCell,$columnName),date('YmdHis', time()).'-二次加工单.xlsx');
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql = app('processService')->getSql($params);
+        }else $sql = app('processService')->getSql(["id"=>$request->data]);
+        return response(Http::post(config('go.export.url'),['type'=>'process','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=二次加工记录-".date('ymdHis').'.xlsx',
+        ]);
     }
 
     public function validatorProcessContent(array $processContent){

+ 17 - 108
app/Http/Controllers/ProcessStatisticController.php

@@ -2,123 +2,32 @@
 
 namespace App\Http\Controllers;
 
-use App\Exports\Export;
-use App\Owner;
-use App\ProcessMethod;
-use App\ProcessStatistic;
-use Illuminate\Database\Eloquent\Builder;
+use App\Process;
+use App\Services\ProcessStatisticService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Gate;
-use Maatwebsite\Excel\Facades\Excel;
+use Illuminate\Support\Facades\Http;
 
 class ProcessStatisticController extends Controller
 {
-    public function conditionQuery(Request $request,$processStatistics){
-        if ($request->input('started_at')){
-            $processStatistics=$processStatistics->where('started_at','>=',$request->input('started_at'));
-        }
-        if ($request->input('owner_id')){
-            $owner_id=$request->input('owner_id');
-            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($owner_id){
-                $query->where('owner_id',$owner_id);
-            });
-        }
-        if ($request->input('ended_at')){
-            $processStatistics=$processStatistics->where('ended_at','<=',$request->input('ended_at'));
-        }
-        if ($request->input('code')){
-            $code=$request->input('code');
-            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($code){
-                $query->where('code','like',$code."%");
-            });
-        }
-        if ($request->input('status')){
-            $status=$request->input('status');
-            $processStatistics=$processStatistics->whereHas('process',function (Builder $query)use($status){
-                $query->where('status',$status);
-            });
-        }
-        $processStatistics=$processStatistics->paginate($request->input('paginate')?$request->input('paginate'):50);
-        return $processStatistics;
-    }
-
     public function index(Request $request){
-        $processStatistics=ProcessStatistic::with('process')->orderBy('process_id','DESC');
-        if ($request->input('checkSign')){
-            $excel=$this->isExport($request,$processStatistics);
-            return $excel;
-        }
-        $processStatistics=$this->conditionQuery($request,$processStatistics);
-        $owners=Owner::get();
-        $processMethods=ProcessMethod::get();
+        /** @var ProcessStatisticService $processStatistics */
+        $processStatistics=app("processStatisticService")->paginate($request->input());
+        $owners=app("ownerService")->getSelection();
+        $processMethods=app("processMethodService")->getSelection();
         return view('process.statistic',['processStatistics'=>$processStatistics,'owners'=>$owners,'processMethods'=>$processMethods]);
     }
 
-    //获取导出数据
-    public function isExport(Request $request,$processStatistics){
-        if(!Gate::allows('二次加工管理-查询')){ return redirect(url('/'));  }
-        if ($request->input('checkSign')=="-1"){
-            $processStatistics=$this->conditionQuery($request,$processStatistics);
-            $excel=$this->export($processStatistics);
-            return $excel;
-        }
-        $id = explode( ',',$request->input('checkSign'));
-        $processStatistics=$processStatistics->whereIn('process_id',$id)->get();
-        $excel=$this->export($processStatistics);
-        return $excel;
-    }
-
-    //执行
-    public function export($processStatistics){
+    public function export(Request $request){
         if(!Gate::allows('二次加工管理-查询')){ return '没有权限';  }
-        $row=[[
-            'process_id'=>'ID',
-            'code'=>'任务号',
-            'owner_name'=>'货主',
-            'started_at'=>'开始日期',
-            'ended_at'=>'完成日期',
-            'unit_price'=>'单价',
-            'amount'=>'预期数量',
-            'completed_amount'=>'完成数量',
-            'revenue'=>'收入合计',
-            'duration_days'=>'完成时间(天)',
-            'duration_man_hours'=>'总工时',
-            'process_method_name'=>'加工类型',
-            'top_capacity'=>'最高日产能',
-            'bottom_capacity'=>'最低日产能',
-            'average_capacity'=>'日均产能',
-            'total_cost'=>'合计成本',
-            'gross_profit'=>'毛利润',
-            'gross_profit_rate'=>'毛利率',
-            'status'=>'状态',
-        ]];
-        $list=[];
-        $i=0;
-        foreach ($processStatistics as $processStatistic){
-            $w=[
-                'process_id'=>$processStatistic->process_id,
-                'code'=>$processStatistic->process?$processStatistic->process->code:'',
-                'owner_name'=>$processStatistic->process?$processStatistic->process->owner_name:'',
-                'started_at'=>$processStatistic->started_at,
-                'ended_at'=>$processStatistic->ended_at,
-                'unit_price'=>$processStatistic->process?$processStatistic->process->unit_price:'',
-                'amount'=>$processStatistic->process?$processStatistic->process->amount:'',
-                'completed_amount'=>$processStatistic->process?$processStatistic->process->completed_amount:'',
-                'revenue'=>$processStatistic->revenue,
-                'duration_days'=>$processStatistic->duration_days,
-                'duration_man_hours'=>$processStatistic->duration_man_hours,
-                'process_method_name'=>$processStatistic->process?$processStatistic->process->process_method_name:'',
-                'top_capacity'=>$processStatistic->top_capacity,
-                'bottom_capacity'=>$processStatistic->bottom_capacity,
-                'average_capacity'=>$processStatistic->average_capacity,
-                'total_cost'=>$processStatistic->total_cost,
-                'gross_profit'=>$processStatistic->gross_profit,
-                'gross_profit_rate'=>round(($processStatistic->gross_profit_rate)*100,2).'%',
-                'status'=>$processStatistic->process?$processStatistic->process->status:'',
-            ];
-            $list[$i]=$w;
-            $i++;
-        }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-二次加工单.xls');
+        if ($request->checkAllSign){
+            $params = $request->input();
+            unset($params['checkAllSign']);
+            $sql = app('processStatisticService')->getSql($params);
+        }else $sql = app('processStatisticService')->getSql(["process_id"=>$request->data]);
+        return response(Http::post(config('go.export.url'),['type'=>'processStatistic','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=二次加工统计记录-".date('ymdHis').'.xlsx',
+        ]);
     }
 }

+ 1 - 21
app/Http/Controllers/RejectedController.php

@@ -2,8 +2,6 @@
 
 namespace App\Http\Controllers;
 
-use App\Exports\Export;
-use App\Exports\RejectedExport;
 use App\Imports\RejectedImport;
 use App\Logistic;
 use App\Owner;
@@ -49,7 +47,7 @@ class RejectedController extends Controller
         $rejectedBills=app('rejectedService')->paginate($request);
         $owners = $ownerService->getSelection();
         $qualityLabels = $qualityLabelService->get();
-        $logistics=$logisticService->get();
+        $logistics=$logisticService->getSelection();
         return view('rejected.search.general',compact('rejectedBills','owners','logistics',
             'paginateParams','qualityLabels'));
     }
@@ -400,24 +398,6 @@ class RejectedController extends Controller
         ]);
     }
 
-
-   /* public function export(Request $request){
-        if(!Gate::allows('退货管理-查询')){ return '没有权限';  }
-        ini_set('max_execution_time',2500);
-        ini_set('memory_limit','1526M');
-        $export=new RejectedExport();
-        if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $rejectedBills = app('rejectedService')->exportData($request);
-            $export->setRejectedBills($rejectedBills);
-        }else{
-            $ids=$request->input('data')??'';
-            $ids=explode(',',$ids);
-            $export->setIds($ids);
-        }
-        return Excel::download($export,'退货表'.Carbon::now().'.xlsx');
-    }*/
-
     /*public function exportExcel(Request $request)
     {
         if(!Gate::allows('退货管理-查询')){ return '没有权限';  }

+ 2 - 3
app/Http/Controllers/TestController.php

@@ -28,7 +28,7 @@ use App\UploadFile;
 use App\User;
 use App\UserToken;
 use App\Waybill;
-use App\OraccleBasCustomer;
+use App\OracleBasCustomer;
 use App\WMSReflectReceive;
 use Carbon\Carbon;
 use Faker\Factory;
@@ -273,8 +273,7 @@ class TestController extends Controller
     }
 
     function test(){
-        $param = ["a"=>null];
-        dd(config('go.export.url'));
+        dd(app('oracleActAllocationDetailService')->paginate([]));
     }
 
     /*1*/

+ 1 - 2
app/Http/Controllers/UserController.php

@@ -35,8 +35,7 @@ class UserController extends Controller
                  $query->where('name','like',$role);
             });
         }
-//        $users=User::with(['roles','carriers','userWorkgroups'])->orderBy('id','desc')->paginate(35);
-        $users = $query->orderBy('id','desc')->paginate(35);
+        $users = $query->orderBy('id','desc')->paginate($request->paginate ?? 50);
         $users->each(function (User $user){
             $user['isSuperAdmin']=$user->isSuperAdmin();
         });

+ 0 - 68
app/Http/Controllers/WaveController.php

@@ -23,7 +23,6 @@ class WaveController extends Controller
         if(!Gate::allows('订单管理-波次-查询')){ return redirect(url('/'));  }
         $waveService = app("WaveService");
         $waves = $waveService->queryWave($request);
-        //$waveStatus = $waveService->getWaveStatus();
         $param =  $waveService->getPageParameter($request);
         $search = $waveService->getSearchCondition($request);
         foreach ($waves as $index=>$wave){
@@ -53,30 +52,9 @@ class WaveController extends Controller
         return view("order/wave/search",compact('waves','param','search'));
     }
 
-    public function create(){
-
-    }
-    // todo
-    public function store(Request $request){
-
-    }
-
-    public function edit($id){
-
-    }
-
-    public function update(Request $request, $id){
-
-    }
-
-    public function destroy($id){
-
-    }
-
     public function cancelPrinting(Request $request){
         if(!Gate::allows('订单管理-波次-重置打印')){ return ['success'=>false,'fail_info'=>'没有权限,请联系管理员'];  }
         $waveService = app("WaveService");
-        $meg = ['success'=>false];
         $ids = $request->input("ids");
         /** @var WaveService $waveService */
         $meg = $waveService->cancelPrint($ids);
@@ -87,58 +65,12 @@ class WaveController extends Controller
         return $meg;
     }
 
-    //
     public function exportExcelOnParams(Request $request){
         $sql = app("WaveService")->getSql($request);
         return response(Http::post(config('go.export.url'),['type'=>'orderWave','sql'=>$sql]),200, [
             "Content-type"=>"application/octet-stream",
             "Content-Disposition"=>"attachment; filename=波次记录-".date('ymdHis').'.xlsx',
         ]);
-
-        $waveService = app("WaveService");
-        ini_set('max_execution_time',2500);
-        ini_set('memory_limit','1526M');
-
-        $waves  = $waveService->downloadExec($request);
-        $row = $waveService->getExcelFromHead();
-
-        $data = [];
-        foreach ($waves as $index=>$wave){
-            $arr= [
-                'waveNo' => $wave->waveno,
-                'codename_c' => $wave->codename_c,
-                'waveRule' => $wave->waverule,
-                'descr' => $wave->descr,
-                'descr_c' => $wave->descr_c,
-                'addWho' => $wave->addwho,
-                'addTime' => $wave->addtime,
-                'pickerPrint'=>'',
-                'pickerPrintTime'=>'',
-                'expressPrinting'=>'',
-                'expressPrintTime'=> ''
-            ];
-            if(!is_null($wave->userdefine1)){
-                $str = $wave->userdefine1;
-                $index = strpos($str,'-PK');
-                $arr['pickerPrint'] = substr($str,0,$index);
-                $arr['pickerPrintTime']= substr($str,$index+3);
-            }
-            if(!is_null($wave->userdefine2)){
-                $str = $wave->userdefine2;
-                if(strpos($str,'-EX')){
-                    $index = strpos($str,'-EX');
-                    $arr['expressPrinting'] =substr($str,0,$index);
-                    $arr['expressPrintTime'] = substr($str,$index+3);
-                }else if(strpos($str,'-Auto')){
-                    $index = strpos($str,'-Auto');
-                    $arr['expressPrinting'] =substr($str,0,$index);
-                    $arr['expressPrintTime'] = substr($str,$index+5);
-                }
-
-            }
-            $data[] = $arr;
-        }
-        return Excel::download(new Export($row,$data),date('YmdHis', time()).'-波次表.xlsx');
     }
 
 }

+ 83 - 159
app/Http/Controllers/WaybillController.php

@@ -15,9 +15,7 @@ use App\UploadFile;
 use App\WaybillAuditLog;
 use App\WaybillOnTop;
 use App\WaybillPriceModel;
-use App\Carrier;
 use App\City;
-use App\Exports\Export;
 use App\Owner;
 use App\Unit;
 use App\Waybill;
@@ -25,7 +23,6 @@ use App\WaybillPayoff;
 use App\WaybillFinancialExcepted;
 use App\WaybillFinancialSnapshot;
 use Carbon\Carbon;
-use http\Header;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
@@ -33,7 +30,6 @@ use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Validator;
 use Intervention\Image\Facades\Image;
-use Maatwebsite\Excel\Facades\Excel;
 use Ramsey\Uuid\Uuid;
 
 class WaybillController extends Controller
@@ -53,7 +49,7 @@ class WaybillController extends Controller
     {
         if(!Gate::allows('运输管理-查询')){ return redirect(url('/'));  }
         $paginateParams = $request->input();
-        $waybills=app('waybillService')->paginate($request);
+        $waybills=app('waybillService')->paginate($request->input());
         return view('waybill.index', [
             'waybills' => $waybills,
             'carriers' => $carrierService->getSelection(),
@@ -376,12 +372,13 @@ class WaybillController extends Controller
     public function waybillEndAudit(Request $request){
         if(!Gate::allows('运输管理-调度审核')){ return redirect(url('/'));  }
         $id=$request->input('id');
-        $waybill=Waybill::find($id);
+        $waybill=Waybill::query()->with(["owner","carrier","origination_city","destination_city","carType",'priceModel',"amountUnit",
+            "warehouse_weight_unit","carrier_weight_unit","warehouse_weight_unit_other","carrier_weight_unit_other"])->find($id);
         if (!$waybill->charge&&!$waybill->collect_fee)return ['exception'=>'收费或到付费用未填!'];
         if ($waybill->charge==0&&$waybill->collect_fee==0)return ['exception'=>'收费与到付费用都为0!'];
         if ($waybill->type=='专线'){
-            if (!$waybill->carrier_weight||$waybill->carrier_weight==0)return ['exception'=>'承运商计重未填或为0!'];
-            if (!$waybill->carrier_weight_unit_id)return ['exception'=>'承运商计重单位未选!'];
+            if (!$waybill->carrier_weight_other||$waybill->carrier_weight_other==0)return ['exception'=>'承运商计重未填或为0!'];
+            if (!$waybill->carrier_weight_unit_id_other)return ['exception'=>'承运商计重单位未选!'];
         }
         $isAudit=WaybillAuditLog::whereRaw('waybill_id = ? and audit_stage = ?',[$id,"调度阶段"])->first();
         if (empty($isAudit)){
@@ -395,36 +392,80 @@ class WaybillController extends Controller
             if ($waybill->waybill_price_model_id||$waybill->type=='直发车'){
                 $waybill->status='已完结';
                 $result=$waybill->save();
-                $waybillPayoff=WaybillPayoff::where('waybill_id','=',$id)->first();
-                $waybillPayoff->load(["waybill"]);
-                $waybillPayoff->waybill->load(["owner","carrier","origination_city","destination_city","carType","waybillAuditLogs"]);
-                $waybillPayoff->waybill->waybillAuditLogs->load(["user"]);
-                $waybillPayoffJson=json_encode($waybillPayoff,JSON_UNESCAPED_UNICODE);
-                WaybillFinancialSnapshot::create([
+                $waybillPayoff=WaybillPayoff::query()->where('waybill_id','=',$id)->first();
+                $waybillPayoffJson=json_encode($this->createReportData($waybill,$waybillPayoff),JSON_UNESCAPED_UNICODE);
+                WaybillFinancialSnapshot::query()->create([
                     'waybill_id'=>$id,
                     'json_content'=>$waybillPayoffJson,
                 ]);
             }else{
                 $waybill->status='无模型';
                 $result=$waybill->save();
-                $waybillPayoff=WaybillPayoff::where('waybill_id','=',$id)->first();
+                $waybillPayoff=WaybillPayoff::query()->where('waybill_id','=',$id)->first();
                 if ($waybillPayoff){
-                    $waybillPayoff->load(["waybill"]);
-                    $waybillPayoff->waybill->load(["owner","carrier","origination_city","destination_city","carType","waybillAuditLogs"]);
-                    $waybillPayoff->waybill->waybillAuditLogs->load(["user"]);
-                    $waybillPayoffJson=json_encode($waybillPayoff,JSON_UNESCAPED_UNICODE);
-                    WaybillFinancialExcepted::create([
+                    $waybillPayoffJson=json_encode($this->createReportData($waybill,$waybillPayoff),JSON_UNESCAPED_UNICODE);
+                    WaybillFinancialExcepted::query()->create([
                         'waybill_id'=>$id,
                         'json_content'=>$waybillPayoffJson,
                     ]);
                 }
             }
-            $this->log(__METHOD__,__FUNCTION__,$waybillPayoffJson,Auth::user()['id']);
+            $this->log(__METHOD__,__FUNCTION__,$waybillPayoffJson,Auth::id());
             return ['success'=>$result,'status'=>$waybill->status,'waybillAuditLog'=>$waybillAuditLog];
         }
         return ['exception'=>'请勿重复审核!'];
     }
 
+    //生成报表数据
+    private function createReportData($waybill,$waybillPayoff){
+        return [
+            "type"=>$waybill->type,
+            "waybill_number"=>$waybill->waybill_number,
+            "owner_name"=>$waybill->owner ? $waybill->owner->name : null,
+            "wms_bill_number"=>$waybill->wms_bill_number,
+            "source_bill"=>$waybill->source_bill,
+            "origination"=>$waybill->origination,
+            "destination"=>$waybill->destination,
+            "recipient"=>$waybill->recipient,
+            "recipient_mobile"=>$waybill->recipient_mobile,
+            "charge"=>$waybill->charge,
+            "collect_fee"=>$waybill->collect_fee,
+            "ordering_remark"=>$waybill->ordering_remark,
+            "carrier_name"=>$waybill->carrier ? $waybill->carrier->name : null,
+            "carrier_bill"=>$waybill->carrier_bill,
+            "origination_city_name"=>$waybill->origination_city ? $waybill->origination_city->name : null,
+            "destination_city_name"=>$waybill->destination_city ? $waybill->destination_city->name : null,
+            "warehouse_weight"=>$waybill->warehouse_weight.($waybill->warehouse_weight_unit ? $waybill->warehouse_weight_unit->name : ''),
+            "carrier_weight"=>$waybill->carrier_weight.($waybill->carrier_weight_unit ? $waybill->carrier_weight_unit->name : ''),
+            "warehouse_weight_other"=>$waybill->warehouse_weight_other.($waybill->warehouse_weight_unit_other ? $waybill->warehouse_weight_unit_other->name : ''),
+            "carrier_weight_other"=>$waybill->carrier_weight_other.($waybill->carrier_weight_unit_other ? $waybill->carrier_weight_unit_other->name : ''),
+            "car_type_name"=>$waybill->carType ? $waybill->carType->name : null,
+            "fee"=>$waybill->fee,
+            "pick_up_fee"=>$waybill->pick_up_fee,
+            "other_fee"=>$waybill->other_fee,
+            "dispatch_remark"=>$waybill->dispatch_remark,
+            "price_model_range_min"=>$waybill->priceModel ? $waybill->priceModel->range_min : null,
+            "price_model_range_max"=>$waybill->priceModel ? $waybill->priceModel->range_max : null,
+            "price_model_unit_price"=>$waybill->priceModel ? $waybill->priceModel->unit_price : null,
+            "price_model_base_fee"=>$waybill->priceModel ? $waybill->priceModel->base_fee : null,
+            "price_model_initial_weight"=>$waybill->priceModel ? $waybill->priceModel->initial_weight : null,
+            "car_owner_info"=>$waybill->car_owner_info,
+            "status"=>$waybill->status,
+            "mileage"=>$waybill->mileage,
+            'amount'=>$waybill->amount.($waybill->amountUnit ? $waybill->amountUnit->name : ''),
+            "inquire_tel"=>$waybill->inquire_tel,
+            "other_charge"=>$waybill->other_charge,
+            "other_charge_remark"=>$waybill->other_charge_remark,
+            "deliver_at"=>$waybill->deliver_at,
+            "created_at"=>$waybill->created_at,
+            "auditLog_user_name"=>Auth::user()['name'],
+            "total_expense"=>$waybillPayoff->total_expense,
+            "total_receivable"=>$waybillPayoff->total_receivable,
+            "gross_margin"=>$waybillPayoff->gross_margin,
+            "gross_profit_rate"=>$waybillPayoff->gross_profit_rate,
+        ];
+    }
+
     public function upload(Request $request){
         if(!Gate::allows('运输管理-图片上传')){ return '没有权限';  }
         $file=$request->file('file');
@@ -493,143 +534,36 @@ class WaybillController extends Controller
 
     public function export(Request $request){
         if(!Gate::allows('运输管理-查询')){ return '没有权限';  }
-        ini_set('max_execution_time',2500);
-        ini_set('memory_limit','1526M');
         if ($request->checkAllSign){
-            $request->offsetUnset('checkAllSign');
-            $waybills = app('waybillService')->getSql($request);
-            return response(Http::post('http://localhost:8090',['type'=>'waybill','sql'=>$waybills]),200, [
-                "Content-type"=>"application/octet-stream",
-                "Content-Disposition"=>"attachment; filename=".date('ymdHis').'-'.mt_rand(0,9999).'运单列表.xlsx',
-                ]);
-        }else{
-            $waybills = app('waybillService')->some($request);
-        }
-        $row=[[
-            'type'=>'运单类型',
-            'owner'=>'货主',
-            'source_bill'=>'上游单号',
-            'wms_bill_number'=>'wms订单号',
-            'waybill_number'=>'运单号',
-            'charge'=>'运输收费',
-            'other_charge'=>'其他收费',
-            'other_charge_remark'=>'其他收费备注',
-            'origination'=>'始发地',
-            'destination'=>'目的地',
-            'carrier'=>'承运商',
-            'carrier_bill'=>'承运商单号',
-            'warehouse_weight'=>'仓库计数(抛)',
-            'carrier_weight'=>'承运商计数(抛)',
-            'warehouse_weight_other'=>'仓库计重',
-            'carrier_weight_other'=>'承运商计重',
-            'carType'=>'车型',
-            'car_owner_info'=>'车辆信息',
-            'amount'=>'计件',
-            'mileage'=>'里程数',
-            'fee'=>'运费(元)',
-            'pick_up_fee'=>'提货费(元)',
-            'other_fee'=>'其他费用(元)',
-            'deliver_at'=>'发货时间',
-            'dispatch_remark'=>'调度备注',
-            'created_at'=>'创建时间'
-        ]];
-        $feeVisible=true;
-        if(!Gate::allows('运输管理-可见费用项')){
-            $feeVisible=false;
-            unset($row[0]['fee'],$row[0]['pick_up_fee'],$row[0]['other_fee'],$row[0]['collect_fee']);
-        }
-        $list=[];
-        for ($i=0; $i<count($waybills);$i++){
-            $waybill=$waybills[$i];
-            $w=[
-                'type'=>isset($waybill->type)?$waybill->type:'',
-                'waybill_number'=>isset($waybill->waybill_number)?$waybill->waybill_number:'',
-                'owner'=>isset($waybill->owner->name)?$waybill->owner->name:'',
-                'source_bill'=>isset($waybill->source_bill)?$waybill->source_bill:'',
-                'wms_bill_number'=>isset($waybill->wms_bill_number)?$waybill->wms_bill_number:'',
-                'charge'=>isset($waybill->charge)?$waybill->charge:'',
-                'other_charge'=>isset($waybill->other_charge)?$waybill->other_charge:'',
-                'other_charge_remark'=>isset($waybill->other_charge_remark)?$waybill->other_charge_remark:'',
-                'origination'=>isset($waybill->origination)?$waybill->origination:'',
-                'destination'=>isset($waybill->destination)?$waybill->destination:'',
-                'recipient'=>isset($waybill->recipient)?$waybill->recipient:'',
-                'recipient_mobile'=>isset($waybill->recipient_mobile)?$waybill->recipient_mobile:'',
-                //'charge'=>isset($waybill->charge)?$waybill->charge:'',
-                //'ordering_remark'=>isset($waybill->ordering_remark)?$waybill->ordering_remark:'',
-                'carrier'=>isset($waybill->carrier_name)?$waybill->carrier_name:'',
-                'carrier_bill'=>isset($waybill->carrier_bill)?$waybill->carrier_bill:'',
-                //'origination_city'=>isset($waybill->origination_city_name)?$waybill->origination_city_name:'',
-                //'destination_city'=>isset($waybill->destination_city_name)?$waybill->destination_city_name:'',
-                'warehouse_weight'=>isset($waybill->warehouse_weight)?$waybill->warehouse_weight.' '.(isset($waybill->warehouse_weight_unit_name)?$waybill->warehouse_weight_unit_name:''):'',
-                'warehouse_weight_other'=>isset($waybill->warehouse_weight_other)?$waybill->warehouse_weight_other.' '.(isset($waybill->warehouse_weight_unit_other_name)?$waybill->warehouse_weight_unit_other_name:''):'',
-                'carrier_weight'=>isset($waybill->carrier_weight)?$waybill->carrier_weight.' '.(isset($waybill->carrier_weight_unit_name)?$waybill->carrier_weight_unit_name:''):'',
-                'carrier_weight_other'=>isset($waybill->carrier_weight_other)?$waybill->carrier_weight_other.' '.(isset($waybill->carrier_weight_unit_other_name)?$waybill->carrier_weight_unit_other_name:''):'',
-                'carType'=>isset($waybill->carType->name)?$waybill->carType->name.($waybill->carType->length):'',
-                'car_owner_info'=>isset($waybill->car_owner_info)?$waybill->car_owner_info:'',
-                'amount'=>isset($waybill->amount)?$waybill->amount.' '.(isset($waybill->amount_unit_name)?$waybill->amount_unit_name:''):'',
-                'mileage'=>isset($waybill->mileage)?$waybill->mileage:'',
-                'fee'=>isset($waybill->fee)?$waybill->fee:'',
-                'pick_up_fee'=>isset($waybill->pick_up_fee)?$waybill->pick_up_fee:'',
-                'other_fee'=>isset($waybill->other_fee)?$waybill->other_fee:'',
-                //'collect_fee'=>isset($waybill->collect_fee)?$waybill->collect_fee:'',
-                'deliver_at'=>isset($waybill->deliver_at)?$waybill->deliver_at:'',
-                'dispatch_remark'=>isset($waybill->dispatch_remark)?$waybill->dispatch_remark:'',
-                //'waybillAuditor'=>isset($waybillAuditor)?$waybillAuditor:'',
-                //'dispatchAuditor'=>isset($dispatchAuditor)?$dispatchAuditor:'',
-                'created_at'=>isset($waybill->created_at)?$waybill->created_at:''
-            ];
-            if(!$feeVisible){
-                unset($w['fee'],$w['pick_up_fee'],$w['other_fee'],$w['collect_fee']);
-            }
-            $list[$i]=$w;
-        }
-        return Excel::download(new Export($row,$list), date('Y:m:d ') . '运单列表.xlsx');
+            $param = $request->input();
+            unset($param['checkAllSign']);
+            $sql = app('waybillService')->getSql($param);
+
+        }else $sql = app('waybillService')->getSql(['id'=>$request->data]);
+        return response(Http::post(config('go.export.url'),['type'=>'waybill','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=运单列表-".date('ymdHis').'.xlsx',
+        ]);
     }
 
-    public function deliveringExport($waybills){
-        ini_set('max_execution_time',2500);
-        ini_set('memory_limit','1526M');
-        $row=[[
-            'created_at'=>"日期",
-            'carrier_name'=>"承运商",
-            'waybill_number'=>"宝时运单号",
-            'origination'=>"提货仓",
-            'owner_name'=>"货主",
-            'warehouse_weight_other'=>"预估重量",
-            'warehouse_weight'=>"预估体积",
-            'status'=>"状态",
-            'carrier_bill'=>"专线运单号",
-            'inquire_tel'=>"查件电话",
-            'amount'=>"件数",
-            'carrier_weight_other'=>"重量",
-            'carrier_weight'=>"体积",
-        ]];
-        $list=[];
-        foreach ($waybills as $waybill){
-            $w=[
-                'created_at'=>$waybill->created_at,
-                'carrier_name'=>$waybill->carrier_name,
-                'waybill_number'=>$waybill->waybill_number,
-                'origination'=>$waybill->origination,
-                'owner_name'=>$waybill->owner_name,
-                'warehouse_weight_other'=>$waybill->warehouse_weight_other,
-                'warehouse_weight'=>$waybill->warehouse_weight,
-                'status'=>$waybill->status=="已完结"?"已完成":$waybill->carrier_bill?"已提交":"待提交",
-                'carrier_bill'=>$waybill->carrier_bill,
-                'inquire_tel'=>$waybill->inquire_tel,
-                'amount'=>$waybill->amount,
-                'carrier_weight_other'=>$waybill->carrier_weight_other,
-                'carrier_weight'=>$waybill->carrier_weight,
-            ];
-            array_push($list,$w);
+    public function deliveringExport(Request $request){
+        if ($request->checkAllSign){
+            $param = $request->input();
+            unset($param['checkAllSign']);
+            $sql = app('waybillService')->getDeliveringSql($param);
+        }else{
+            $sql = app('waybillService')->getDeliveringSql(['id'=>$request->data]);
         }
-        return Excel::download(new Export($row,$list), date('Y:m:d ') . '发运列表.xlsx');
+        return response(Http::post(config('go.export.url'),['type'=>'waybillDelivering','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=发运列表-".date('ymdHis').'.xlsx',
+        ]);
     }
 
     //发运
     public function delivering(Request $request){
         if (!Auth::user())return view('exception.login');
-        $waybills= app('waybillService')->paginate($request);
+        $waybills= app('waybillService')->paginate($request->input());
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('carrier_user')->where('user_id',Auth::id())->get();
             $carrierIds=array_column($carriersUsers->toArray(),'carrier_id');
@@ -660,14 +594,6 @@ class WaybillController extends Controller
         ])->errors();
         if (count($errors)>0)return ["errors"=>$errors];
         $waybill=Waybill::find($request->input('id'));
-//        //承运商体积
-//        if($request->input('carrier_weight')){
-//            $waybill->amount_unit_id=2;
-//        }
-//        //承运商重量
-//        if ($request->input('carrier_weight_other')){
-//            $waybill->amount_unit_id=1;
-//        }
         if (!$waybill)return ["error"=>"未找到该运单!"];
         $waybill->fill($request->input());
         $waybill->update();
@@ -853,12 +779,10 @@ class WaybillController extends Controller
             return  ['success'=>'false','fail_info'=>'传参错误'];
         }
         $wayontop = WaybillOnTop::withTrashed()->where('waybill_id',$id);
-        $result = '';
         if(count($wayontop->get()) == 0){
             $wayontop = WaybillOnTop::create(['waybill_id'=>$id,'remark'=>$detail]);
             $result = $wayontop->save();
         }else{
-            $wayontop = WaybillOnTop::withTrashed()->where('waybill_id',$id);
             $result = WaybillOnTop::withTrashed()->where('waybill_id',$id)->restore();
         }
         return ['success'=>$result,'status'=>$result];

+ 1 - 1
app/Http/Controllers/WaybillFinancialExceptedController.php

@@ -26,7 +26,7 @@ class WaybillFinancialExceptedController extends Controller
     public function index(Request $request)
     {
         if(!Gate::allows('财务报表-查询')){ return redirect(url('/'));  }
-        $waybillFinancialSnapshots=WaybillFinancialExcepted::orderBy('id', 'DESC');
+        $waybillFinancialSnapshots=WaybillFinancialExcepted::query()->orderBy('id', 'DESC');
         $type='';
         if ($request->type=='ZF'){
             $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('json_content','like','%直发车%');

+ 13 - 110
app/Http/Controllers/WaybillFinancialSnapshotsController.php

@@ -8,6 +8,7 @@ use Carbon\Carbon;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class WaybillFinancialSnapshotsController extends Controller
@@ -27,7 +28,7 @@ class WaybillFinancialSnapshotsController extends Controller
     public function index(Request $request)
     {
         if(!Gate::allows('财务报表-查询')){ return redirect(url('/'));  }
-        $waybillFinancialSnapshots=WaybillFinancialSnapshot::orderBy('id', 'DESC');
+        $waybillFinancialSnapshots=WaybillFinancialSnapshot::query()->orderBy('id', 'DESC');
         $type='';
         if ($request->type=='ZF'){
             $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('json_content','like','%直发车%');
@@ -40,116 +41,18 @@ class WaybillFinancialSnapshotsController extends Controller
         $waybillFinancialSnapshots=$this->conditionQuery($request,$waybillFinancialSnapshots);
         return view('waybill.waybillFinancialSnapshot.index',['waybillFinancialSnapshots'=>$waybillFinancialSnapshots,'filterData'=>$request->input(),'type'=>$type]);
     }
-    public function export($id,Request $request){
+    public function export(Request $request){
         if(!Gate::allows('财务报表-查询')){ return '没有权限';  }
-        if ($id==-1){
-            $id=[];
-            ini_set('max_execution_time',2500);
-            ini_set('memory_limit','1526M');
-            $waybillFinancialSnapshots=WaybillFinancialSnapshot::select('id');
-            if ($request->input('created_at_start')){
-                $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','>=',$request->input('created_at_start'));
-            }
-            if ($request->input('created_at_end')){
-                $waybillFinancialSnapshots=$waybillFinancialSnapshots->where('created_at','<=',$request->input('created_at_end'));
-            }
-            $waybillFinancialSnapshots=$waybillFinancialSnapshots->get();
-            foreach ($waybillFinancialSnapshots as $waybillFinancialSnapshot){
-                array_push($id,$waybillFinancialSnapshot->id);
-            }
-        }else $id = explode( ',',$id);
-        if (!$id)return ;
-        $row=[[
-            'type'=>'运单类型',
-            'waybill_number'=>'运单号',
-            'owner'=>'货主',
-            'wms_bill_number'=>'WMS单号',
-            'origination'=>'始发地',
-            'destination'=>'目的地',
-            'recipient'=>'收件人',
-            'recipient_mobile'=>'收件人电话',
-            'charge'=>'收费(元)',
-            'ordering_remark'=>'下单备注',
-            'carrier'=>'承运商',
-            'carrier_bill'=>'承运商单号',
-            'origination_city'=>'始发市',
-            'destination_city'=>'目的市',
-            'warehouse_weight'=>'仓库计数(抛)',
-            'warehouse_weight_other'=>'仓库计数二',
-            'carrier_weight'=>'承运商计数(抛)',
-            'carrier_weight_other'=>'承运商计数二',
-            'carType'=>'车型',
-            'car_owner_info'=>'车型',
-            'fee'=>'运费(元)',
-            'pick_up_fee'=>'提货费(元)',
-            'other_fee'=>'其他费用(元)',
-            'collect_fee'=>'到付金额(元)',
-            'dispatch_remark'=>'调度备注',
-            'waybillAuditor'=>'运单审核人',
-            'dispatchAuditor'=>'调度审核人',
-            'created_at'=>'运单创建时间',
-            'total_receivable'=>'应收款(元)',
-            'total_expense'=>'应付款(元)',
-            'gross_margin'=>'毛利(元)',
-            'gross_profit_rate'=>'毛利率(元)',
-            'snapshotCreated_at'=>'报表生成时间',
-        ]];
-        $list=[];
-        for ($i=0; $i<count($id);$i++){
-            $waybillFinancialSnapshot=WaybillFinancialSnapshot::where('waybill_id','=',$id[$i])->first();
-            $waybillFinancialSnapshot=json_decode($waybillFinancialSnapshot->json_content);
-            $waybillAuditor='';
-            $dispatchAuditor='';
-            foreach ($waybillFinancialSnapshot->waybill->waybill_audit_logs as $waybill_audit_logs){
-                if ($waybill_audit_logs->audit_stage=="运单阶段"){
-                    $waybillAuditor=$waybill_audit_logs->user->name;
-                }
-                if ($waybill_audit_logs->audit_stage=="调度阶段"){
-                    $dispatchAuditor=$waybill_audit_logs->user->name;
-                }
-            };
-            $w=[
-                'type'=>isset($waybillFinancialSnapshot->waybill->type)?$waybillFinancialSnapshot->waybill->type:'',
-                'waybill_number'=>isset($waybillFinancialSnapshot->waybill->waybill_number)?$waybillFinancialSnapshot->waybill->waybill_number:'',
-                'owner'=>isset($waybillFinancialSnapshot->waybill->owner->name)?$waybillFinancialSnapshot->waybill->owner->name:'',
-                'wms_bill_number'=>isset($waybillFinancialSnapshot->waybill->wms_bill_number)?$waybillFinancialSnapshot->waybill->wms_bill_number:'',
-                'origination'=>isset($waybillFinancialSnapshot->waybill->origination)?$waybillFinancialSnapshot->waybill->origination:'',
-                'destination'=>isset($waybillFinancialSnapshot->waybill->destination)?$waybillFinancialSnapshot->waybill->destination:'',
-                'recipient'=>isset($waybillFinancialSnapshot->waybill->recipient)?$waybillFinancialSnapshot->waybill->recipient:'',
-                'recipient_mobile'=>isset($waybillFinancialSnapshot->waybill->recipient_mobile)?$waybillFinancialSnapshot->waybill->recipient_mobile:'',
-                'charge'=>isset($waybillFinancialSnapshot->waybill->charge)?$waybillFinancialSnapshot->waybill->charge:'',
-                'ordering_remark'=>isset($waybillFinancialSnapshot->waybill->ordering_remark)?$waybillFinancialSnapshot->waybill->ordering_remark:'',
-                'carrier'=>isset($waybillFinancialSnapshot->waybill->carrier->name)?$waybillFinancialSnapshot->waybill->carrier->name:'',
-                'carrier_bill'=>isset($waybillFinancialSnapshot->waybill->carrier_bill)?$waybillFinancialSnapshot->waybill->carrier_bill:'',
-                'origination_city'=>isset($waybillFinancialSnapshot->waybill->origination_city->name)?$waybillFinancialSnapshot->waybill->origination_city->name:'',
-                'destination_city'=>isset($waybillFinancialSnapshot->waybill->destination_city->name)?$waybillFinancialSnapshot->waybill->destination_city->name:'',
-                'warehouse_weight'=>isset($waybillFinancialSnapshot->waybill->warehouse_weight)?
-                        $waybillFinancialSnapshot->waybill->warehouse_weight.' '.(isset($waybillFinancialSnapshot->waybill->warehouse_weight_unit_name)?$waybillFinancialSnapshot->waybill->warehouse_weight_unit_name:''):'',
-                'warehouse_weight_other'=>isset($waybillFinancialSnapshot->waybill->warehouse_weight_other)?
-                    $waybillFinancialSnapshot->waybill->warehouse_weight_other.' '.(isset($waybillFinancialSnapshot->waybill->warehouse_weight_unit_other_name)?$waybillFinancialSnapshot->waybill->warehouse_weight_unit_other_name:''):'',
-                'carrier_weight'=>isset($waybillFinancialSnapshot->waybill->carrier_weight)?
-                        $waybillFinancialSnapshot->waybill->carrier_weight.' '.(isset($waybillFinancialSnapshot->waybill->warehouse_weight_unit_name)?$waybillFinancialSnapshot->waybill->warehouse_weight_unit_name:''):'',
-                'carrier_weight_other'=>isset($waybillFinancialSnapshot->waybill->carrier_weight_other)?
-                    $waybillFinancialSnapshot->waybill->carrier_weight_other.' '.(isset($waybillFinancialSnapshot->waybill->carrier_weight_unit_other_name)?$waybillFinancialSnapshot->waybill->carrier_weight_unit_other_name:''):'',
-                'carType'=>isset($waybillFinancialSnapshot->waybill->carType->name)?$waybillFinancialSnapshot->waybill->carType->name.($waybillFinancialSnapshot->waybill->carType->length.'米'):'',
-                'car_owner_info'=>isset($waybillFinancialSnapshot->waybill->car_owner_info)?$waybillFinancialSnapshot->waybill->car_owner_info:'',
-                'fee'=>isset($waybillFinancialSnapshot->waybill->fee)?$waybillFinancialSnapshot->waybill->fee:'',
-                'pick_up_fee'=>isset($waybillFinancialSnapshot->waybill->pick_up_fee)?$waybillFinancialSnapshot->waybill->pick_up_fee:'',
-                'other_fee'=>isset($waybillFinancialSnapshot->waybill->other_fee)?$waybillFinancialSnapshot->waybill->other_fee:'',
-                'collect_fee'=>isset($waybillFinancialSnapshot->waybill->collect_fee)?$waybillFinancialSnapshot->waybill->collect_fee:'',
-                'dispatch_remark'=>isset($waybillFinancialSnapshot->waybill->dispatch_remark)?$waybillFinancialSnapshot->waybill->dispatch_remark:'',
-                'waybillAuditor'=>isset($waybillAuditor)?$waybillAuditor:'',
-                'dispatchAuditor'=>isset($dispatchAuditor)?$dispatchAuditor:'',
-                'created_at'=>isset($waybillFinancialSnapshot->waybill->created_at)?$waybillFinancialSnapshot->waybill->created_at:'',
-                'total_receivable'=>isset($waybillFinancialSnapshot->total_receivable)?$waybillFinancialSnapshot->total_receivable:'',
-                'total_expense'=>isset($waybillFinancialSnapshot->total_expense)?$waybillFinancialSnapshot->total_expense:'',
-                'gross_margin'=>isset($waybillFinancialSnapshot->gross_margin)?$waybillFinancialSnapshot->gross_margin:'',
-                'gross_profit_rate'=>isset($waybillFinancialSnapshot->gross_profit_rate)?$waybillFinancialSnapshot->gross_profit_rate:'',
-                'snapshotCreated_at'=>isset($waybillFinancialSnapshot->created_at)?$waybillFinancialSnapshot->created_at:'',
-            ];
-            $list[$i]=$w;
+        if ($request->checkAllSign){
+            $param = $request->input();
+            unset($param['checkAllSign']);
+            $sql = app('waybillFinancialService')->getSql($param);
+        }else{
+            $sql = app('waybillFinancialService')->getSql(['waybill_id'=>$request->data]);
         }
-        $this->log(__METHOD__,__FUNCTION__,json_encode($waybillFinancialSnapshot),Auth::user()['id']);
-        return Excel::download(new Export($row,$list), date('Y:m:d ') . '财务报表.xlsx');
+        return response(Http::post(config('go.export.url'),['type'=>'waybillFinancial','sql'=>$sql]),200, [
+            "Content-type"=>"application/octet-stream",
+            "Content-Disposition"=>"attachment; filename=财务报表-".date('ymdHis').'.xlsx',
+        ]);
     }
 }

+ 25 - 84
app/Http/Controllers/WeighExceptedController.php

@@ -7,20 +7,21 @@ use App\Package;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Gate;
+use Illuminate\Support\Facades\Http;
 use Maatwebsite\Excel\Facades\Excel;
 
 class WeighExceptedController extends Controller
 {
     /**
      * Display a listing of the resource.
-     *
+     * @param Request $request
      * @return \Illuminate\Http\Response
      */
     public function indexCreate(Request $request)
     {
         if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
         $paginate=$request->input('paginate');
-        $weightExcepteds=Package::select('id','status','logistic_number','logistic_id','measuring_machine_id','weighed_at','weight','length','width','height','bulk','paper_box_id')->
+        $weightExcepteds=Package::query()->select('id','status','logistic_number','logistic_id','measuring_machine_id','weighed_at','weight','length','width','height','bulk','paper_box_id')->
         where('status','上传异常')->orWhere('status','测量异常')->orderBy('created_at','DESC');
         if ($paginate){
             $weightExcepteds=$weightExcepteds->paginate($paginate);
@@ -34,7 +35,7 @@ class WeighExceptedController extends Controller
     {
         if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
         $paginate=$request->input('paginate');
-        $weightExcepteds=Package::select('id','owner_id','logistic_number','created_at','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistic_id')->
+        $weightExcepteds=Package::query()->select('id','owner_id','logistic_number','created_at','delivery_number','batch_number','batch_rule','recipient','recipient_mobile','logistic_id')->
         where('status','下发异常')->orWhere('status','记录异常')->orWhere('status','已上传异常')->orderBy('created_at','DESC');
         if ($paginate){
             $weightExcepteds=$weightExcepteds->paginate($paginate);
@@ -44,88 +45,28 @@ class WeighExceptedController extends Controller
         return view('weight.weightExcepted.index',['weightExcepteds'=>$weightExcepteds,'view'=>'indexIssued']);
     }
 
-   public function export($id){
-       if(!Gate::allows('称重信息-查看异常')){ return redirect(url('/'));  }
-       if ($id==-1){
-           $id=[];
-           ini_set('max_execution_time',2500);
-           ini_set('memory_limit','1526M');
-           $packages=Package::select('id')->get();
-           foreach ($packages as $package){
-               array_push($id,$package->id);
-           }
-       }else $id = explode( ',',$id);
-       if (!$id)return ;
-       $weighExcepted=Package::find($id[0]);
-       if (!$weighExcepted->status=="下发异常"){
-           $row=[[
-               'id'=>'ID',
-               'logistic_number'=>'快递单号',
-               'logistic_name'=>'承运商',
-               'measuringMachine_name'=>'设备',
-               'weigh_time'=>'称重时间',
-               'weight'=>'重(KG)',
-               'length'=>'长(CM)',
-               'width'=>'宽(CM)',
-               'height'=>'高(CM)',
-               'bulk'=>'体积(CM³)',
-               'paperBox_name'=>'纸箱',
-               'genre'=>'异常类型',
-               'created_at'=>'称重时间',
-               'status'=>'异常类型',
-           ]];
-           $list=[];
-           for ($i=0; $i<count($id);$i++){
-               $weighExcepted=Package::find($id[$i]);
-               $w=[
-                   'id'=>isset($weighExcepted->id)?$weighExcepted->id:'',
-                   'logistic_number'=>isset($weighExcepted->logistic_number)?$weighExcepted->logistic_number:'',
-                   'logistic_name'=>isset($weighExcepted->logistic_name)?$weighExcepted->logistic_name:'',
-                   'measuringMachine_name'=>isset($weighExcepted->measuringMachine_name)?$weighExcepted->measuringMachine_name:'',
-                   'weigh_time'=>isset($weighExcepted->weigh_time)?$weighExcepted->weigh_time:'',
-                   'weight'=>isset($weighExcepted->weight)?$weighExcepted->weight:'',
-                   'length'=>isset($weighExcepted->length)?$weighExcepted->length:'',
-                   'width'=>isset($weighExcepted->width)?$weighExcepted->width:'',
-                   'bulk'=>isset($weighExcepted->bulk)?$weighExcepted->bulk:'',
-                   'height'=>isset($weighExcepted->height)?$weighExcepted->height:'',
-                   'paperBox_name'=>isset($weighExcepted->paperBox_name)?$weighExcepted->paperBox_name:'',
-                   'genre'=>isset($weighExcepted->genre)?$weighExcepted->genre:'',
-                   'created_at'=>isset($weighExcepted->created_at)?$weighExcepted->created_at:'',
-                   'status'=>isset($weighExcepted->status)?$weighExcepted->status:''
-               ];
-               $list[$i]=$w;
-           }
+   public function export($type ,Request $request){
+       if(!Gate::allows('称重管理-查看异常')){ return redirect(url('/'));  }
+       if ($type == 'indexIssued'){
+           if ($request->checkAllSign){
+               $params = $request->input();
+               unset($params['checkAllSign']);
+               $sql = app('weighExceptedService')->getIssuedExceptionSql($params);
+           }else $sql=app('weighExceptedService')->getIssuedExceptionSql(['id'=>$request->data]);
+           return response(Http::post(config('go.export.url'),['type'=>'packageIssuedException','sql'=>$sql]),200, [
+               "Content-type"=>"application/octet-stream",
+               "Content-Disposition"=>"attachment; filename=下发异常记录-".date('ymdHis').'.xlsx',
+           ]);
        }else{
-           $row=[[
-               'id'=>'ID',
-               'logistic_number'=>'快递单号',
-               'created_at'=>'下发时间',
-               'delivery_number'=>'发货单号',
-               'batch_number'=>'波次号',
-               'batch_rule'=>'波次规则',
-               'recipient'=>'收件人',
-               'recipient_mobile'=>'收件人电话',
-               'logistic_name'=>'承运商',
-               'status'=>'异常类型',
-           ]];
-           $list=[];
-           for ($i=0; $i<count($id);$i++){
-               $weighExcepted=Package::find($id[$i]);
-               $w=[
-                   'id'=>isset($weighExcepted->id)?$weighExcepted->id:'',
-                   'logistic_number'=>isset($weighExcepted->logistic_number)?$weighExcepted->logistic_number:'',
-                   'logistic_name'=>isset($weighExcepted->logistic_name)?$weighExcepted->logistic_name:'',
-                   'created_at'=>isset($weighExcepted->created_at)?$weighExcepted->created_at:'',
-                   'delivery_number'=>isset($weighExcepted->delivery_number)?$weighExcepted->delivery_number:'',
-                   'batch_number'=>isset($weighExcepted->batch_number)?$weighExcepted->batch_number:'',
-                   'batch_rule'=>isset($weighExcepted->batch_rule)?$weighExcepted->batch_rule:'',
-                   'recipient'=>isset($weighExcepted->recipient)?$weighExcepted->recipient:'',
-                   'recipient_mobile'=>isset($weighExcepted->recipient_mobile)?$weighExcepted->recipient_mobile:'',
-                   'status'=>isset($weighExcepted->status)?$weighExcepted->status:'',
-               ];
-               $list[$i]=$w;
-           }
+           if ($request->checkAllSign){
+               $params = $request->input();
+               unset($params['checkAllSign']);
+               $sql = app('weighExceptedService')->getCreateExceptionSql($params);
+           }else $sql=app('weighExceptedService')->getCreateExceptionSql(['id'=>$request->data]);
+           return response(Http::post(config('go.export.url'),['type'=>'packageCreateException','sql'=>$sql]),200, [
+               "Content-type"=>"application/octet-stream",
+               "Content-Disposition"=>"attachment; filename=录入异常记录-".date('ymdHis').'.xlsx',
+           ]);
        }
-       return Excel::download(new Export($row,$list), date('YmdHis', time()). '称重异常单.xlsx');
    }
 }

+ 3 - 4
app/Http/Controllers/api/thirdPart/flux/PackageController.php

@@ -253,18 +253,17 @@ class PackageController extends Controller
     }
     public function markWMSOnBatch($batchNumber,$weight){
         $batchNumber = strtoupper($batchNumber);
-        $docWaveHeader=OracleDOCWaveHeader::where('waveno',$batchNumber)->first();
+        $docWaveHeader=OracleDOCWaveHeader::query()->where('waveno',$batchNumber)->first();
         if(!$docWaveHeader){
             {return ['result'=>false,'message'=>'波次不存在'];}
         }
         if(OracleDOCWaveDetails::unpackedOrders($batchNumber)->isNotEmpty())
             {return ['result'=>false,'message'=>'有未装箱或完成的订单在该波次,不能批量记录重量'];}
 
-        OracleDOCWaveHeader::where('waveno',$batchNumber)->update(['userdefine3'=>'Y']);
+        OracleDOCWaveHeader::query()->where('waveno',$batchNumber)->update(['userdefine3'=>'Y']);
         OracleIdxAsrsReceive::saveOrUpdateWeightByBatch($batchNumber,$weight);
         OracleDocOrderPackingSummary::saveOrUpdateWeightByBatch($batchNumber,$weight);
-
-        //TODO
+        
         Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'标记WMS波次:'.$batchNumber.',userdefine3="Y"',auth()->user()['id']);
         return ['result'=>true];
     }

+ 2 - 56
app/Http/Controllers/api/thirdPart/flux/ProcessController.php

@@ -22,61 +22,15 @@ class ProcessController extends Controller
         $wms_code=$request->input('wms_code');
         if (!$wms_code)return ['error'=>'提交的单据号为空'];
         try{
-            $docASNs=OracleDOCASNDetail::where("ASNNo",$wms_code)->get();   //入库单
+            $docASNs=OracleDOCASNDetail::query()->where("ASNNo",$wms_code)->get();   //入库单
         }
         catch (\Exception $e){
             return ['error'=>'数据库连接失败!'];
         }
         if (count($docASNs)>0){
-            $owner=Owner::where("code",$docASNs[0]->customerid)->first();
+            $owner=Owner::query()->where("code",$docASNs[0]->customerid)->first();
             if (!$owner)$owner=$this->storeOwner($docASNs[0]->customerid);
             if (!$owner)return ['error'=>'找到了入库单,但未查询到货主代码!'];
-            /*$basSKUs=['owner_code'=>[],'sku'=>[]];
-            $commodities=[];
-            $i=0;
-            $docAsnSKUs=array_column($docASNs->toArray(),'sku');
-            $docAsnOwnerCodes=array_column($docASNs->toArray(),'customerid');
-            $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docAsnOwnerCodes){
-                return $query->whereIn('code',$docAsnOwnerCodes);
-            }])->whereIn('sku',$docAsnSKUs)->get();
-            $commoditiesData=[];
-            foreach ($commoditiesTem as $commodityTem){
-                $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
-            }
-            foreach ($docASNs as $docASN){
-                $commodity=isset($commoditiesData[$docASN->sku."_".$docASN->customerid])?$commoditiesData[$docASN->sku."_".$docASN->customerid]:null;
-                if (!$commodity){
-                    array_push($basSKUs['owner_code'],$docASN->customerid);
-                    array_push($basSKUs['sku'],$docASN->sku);
-                    $i++;
-                    continue;
-                }
-                $commodity->amount=$docASN->expectedqty;
-                array_push($commodities,$commodity->toArray());
-                unset($docASNs[$i]);
-                $i++;
-            }
-            unset($docAsnOwnerCodes,$docAsnSKUs,$commoditiesTem,$commoditiesData);
-            if (count($basSKUs['sku'])>0 && count($basSKUs['owner_code'])>0){
-                $this->storeCommodity($basSKUs);
-                $docAsnSKUs=array_column($docASNs->toArray(),'sku');
-                $docAsnOwnerCodes=array_column($docASNs->toArray(),'customerid');
-                $commoditiesTem=Commodity::with(['barcodes','owner'=>function($query)use($docAsnOwnerCodes){
-                    return $query->whereIn('code',$docAsnOwnerCodes);
-                }])->whereIn('sku',$docAsnSKUs)->get();
-                $commoditiesData=[];
-                foreach ($commoditiesTem as $commodityTem){
-                    $commoditiesData[$commodityTem->sku."_".$commodityTem->owner_code]=$commodityTem;
-                }
-                foreach ($docASNs as $docASN){
-                    $commodity=$commoditiesData[$docASN->sku."_".$docASN->customerid];
-                    if (!$commodity){
-                        continue;
-                    }
-                    $commodity->amount=$docASN->expectedqty;
-                    array_push($commodities,$commodity->toArray());
-                }
-            }*/
             $commodities=$this->resetData($docASNs,"sku","customerid","expectedqty","asnlineno");
             $processContent=[
                 'wms_code'=>$wms_code,
@@ -114,14 +68,6 @@ class ProcessController extends Controller
             if (!$owner)$owner=$this->storeOwner($docMovementHeaders[0]->customerid);
             if (!$owner)return ['error'=>'找到了入库单,但未查询到货主代码!'];
             $commodities=$this->resetData($docMovementDetails,"sku","customerid","toqty","mdoclineno",$docMovementHeaders);
-            /*$commodities=[];
-            foreach ($docMovementDetails as $docMovementDetail){
-                $commodity=Commodity::where('sku',$docMovementDetail->sku)->first();
-                if (!$commodity)$commodity = $this->storeCommodity($owner->code,$docMovementDetail->sku);
-                if (!$commodity)continue;
-                array_push($commodities,['id'=>$commodity->id,'name'=>$commodity->name,
-                    'barcodes'=>$commodity->barcodes,'sku'=>$commodity->sku,'amount'=>$docMovementDetail->toqty]);
-            }*/
             $processContent=[
                 'wms_code'=>$wms_code,
                 'owner_name'=>$owner->name,

+ 2 - 2
app/Http/Controllers/api/thirdPart/flux/WaybillController.php

@@ -7,7 +7,7 @@ use App\Http\Controllers\Controller;
 use App\Owner;
 use App\Unit;
 use App\Waybill;
-use App\OraccleBasCustomer;
+use App\OracleBasCustomer;
 use App\WMSWaybill;
 use App\WMSWaybillOrder;
 use Illuminate\Http\Request;
@@ -61,7 +61,7 @@ class WaybillController extends Controller
             if (!$owner){$owner=new Owner(['name'=>$receiveInputting['CustomerID'],'code'=>$receiveInputting['CustomerID']]);$owner->save();}
             $city=City::where('name',$receiveInputting['C_City'])->first();
             $zfList=config('merchantsInfo.waybill.ZFList');
-            $bswasCustomer=OraccleBasCustomer::where("customerid",$receiveInputting['CustomerID'])->first();
+            $bswasCustomer=OracleBasCustomer::where("customerid",$receiveInputting['CustomerID'])->first();
             if ($bswasCustomer){
                 $origination=$bswasCustomer->address1;
                 $addresses=config("merchantsInfo.address");

+ 0 - 11
app/OraccleBasCustomer.php

@@ -1,11 +0,0 @@
-<?php
-
-namespace App;
-
-use Illuminate\Database\Eloquent\Model;
-
-class OraccleBasCustomer extends Model
-{
-    protected $connection="oracle";
-    protected $table="BAS_CUSTOMER";
-}

+ 0 - 8
app/OracleBasCustomer.php

@@ -4,16 +4,8 @@ namespace App;
 
 use Illuminate\Database\Eloquent\Model;
 
-/**
- * DB:      FLUX/WMS_USER
- * TABLE:   BAS_CUSTOMER
- * EXPLAIN: 客户
- */
 class OracleBasCustomer extends Model
 {
     protected $connection="oracle";
     protected $table="BAS_CUSTOMER";
-    /*
-     * column: Descr_C 货主
-     * */
 }

+ 14 - 10
app/Package.php

@@ -80,19 +80,23 @@ class Package extends Model
         return ($this['batch_rule'] && strstr($this['batch_rule'],'组合')  && $this['batch_number'] );
     }
     static public function createPackagesFromBatchCode($batchCode,$weight){
-        $resultOracleObjs=OracleDOCOrderHeader::select(self::$oracleOrderHeaderFields);
+        $resultOracleObjs=OracleDOCOrderHeader::query()->select(self::$oracleOrderHeaderFields);
         $resultOracleObjs->where('doc_order_header.waveno',$batchCode);
         $resultOracleObjs->leftJoin('act_allocation_details','act_allocation_details.orderno','doc_order_header.orderno');
+        $packages = [];
         foreach($resultOracleObjs as $resultOracleObj){
             $now = Carbon::now();
-            Package::create([
+            array_push($packages,[
+                'batch_number'=>$batchCode??'',
                 'logistic_number'=>$resultOracleObj['SOReference5']??'',
                 'delivery_number'=>$resultOracleObj['SOReference5']??'',
                 'weight'=>$weight,
                 'weighed_at'=> $now,
                 'status'=>"已上传",
+                "created_at"=>$now,
             ]);
         }
+        Package::query()->insert($packages);
     }
     public function unifyThisMeasureUnderSameBatch(){
         $this->fetchPaperBox();
@@ -106,7 +110,7 @@ class Package extends Model
         !empty($this['weighed_at'])?$params['weighed_at']= $this['weighed_at']:null;
         !empty($this['paper_box_id'])?$params['paper_box_id']= $this['paper_box_id']:null;
         if(empty($params)||empty($this['batch_number']))return;
-        Package::where(['batch_number'=>$this['batch_number']])->update([$params]);
+        Package::query()->where(['batch_number'=>$this['batch_number']])->update([$params]);
     }
 
     public function fetchLogisticFromOracle(){
@@ -114,9 +118,9 @@ class Package extends Model
         if(Arr::exists($this->tempFields,'temLogistic'))return $this->tempFields['temLogistic'];
         Controller::logs(__METHOD__, __FUNCTION__, "tempPackage:{$this->oracleInfo['carrierid']}||SOR:{$this->oracleInfo['SOReference5']}||sor:{$this->oracleInfo['soreference5']}||orderno:{$this['orderno']}" , null);
         if(!$this->oracleInfo['carrierid'])return null;
-        $logistic= Logistic::where('code',$this->oracleInfo['carrierid'])->first();
+        $logistic= Logistic::query()->where('code',$this->oracleInfo['carrierid'])->first();
         if(!$logistic){
-            $logistic=Logistic::create(['code'=>$this->oracleInfo['carrierid'],'name'=>$this->oracleInfo['carrierid']]);
+            $logistic=Logistic::query()->create(['code'=>$this->oracleInfo['carrierid'],'name'=>$this->oracleInfo['carrierid']]);
             Controller::logs(__METHOD__, __FUNCTION__, "富勒下发找不到快递公司,添加{$this->oracleInfo['carrierid']}" , null);
         }
         Controller::logs(__METHOD__, __FUNCTION__, "tempPackage2:{$logistic->id}" , null);
@@ -128,9 +132,9 @@ class Package extends Model
     public function fetchOwnerFromOracle(){
         if(empty($this->oracleInfo))return null;
         if(Arr::exists($this->tempFields,'temOwner'))return $this->tempFields['temOwner'];
-        $owner= Owner::where('code',$this->oracleInfo['customerid'])->first();
+        $owner= Owner::query()->where('code',$this->oracleInfo['customerid'])->first();
         if(!$owner){
-            $owner=Owner::create(['code'=>$this->oracleInfo['customerid'],'name'=>$this->oracleInfo['customerid']]);
+            $owner=Owner::query()->create(['code'=>$this->oracleInfo['customerid'],'name'=>$this->oracleInfo['customerid']]);
             Controller::logs(__METHOD__, __FUNCTION__, "富勒下发找不到货主,添加{$this->oracleInfo['customerid']}" , null);
         }
         if(!$owner)return null;
@@ -156,17 +160,17 @@ class Package extends Model
         if(isset($this->tempFields['temOracleInfo']))return $this->tempFields['temOracleInfo'];
         if(empty($this['logistic_number'])&&empty($this['order_code']))return '';
         if($this['order_code']){
-            $resultOracleObjs=OracleDOCOrderHeader::select(self::$oracleOrderHeaderFields)->where('orderno',$this['order_code']);
+            $resultOracleObjs=OracleDOCOrderHeader::query()->select(self::$oracleOrderHeaderFields)->where('orderno',$this['order_code']);
             $resultOracleObjs->leftJoin('doc_wave_header','doc_wave_header.waveno','doc_order_header.waveno');
         }else{
-            $resultOracleObjs=OracleActAllocationDetails::select(self::$oracleOrderHeaderFields);
+            $resultOracleObjs=OracleActAllocationDetails::query()->select(self::$oracleOrderHeaderFields);
             $resultOracleObjs->where('picktotraceid',$this['logistic_number']);
             $resultOracleObjs->leftJoin('DOC_Order_Header','act_allocation_details.orderno','doc_order_header.orderno');
             $resultOracleObjs->leftJoin('doc_wave_header','doc_wave_header.waveno','doc_order_header.waveno');
         }
         $this->tempFields['temOracleInfo']=$resultOracleObjs->first();
         if(empty($this->tempFields['temOracleInfo'])) {
-            $resultOracleObjs=OracleDOCOrderHeader::select(self::$oracleOrderHeaderFields)->where('soreference5',$this['logistic_number']);
+            $resultOracleObjs=OracleDOCOrderHeader::query()->select(self::$oracleOrderHeaderFields)->where('soreference5',$this['logistic_number']);
             $resultOracleObjs->leftJoin('doc_wave_header','doc_wave_header.waveno','doc_order_header.waveno');
         }
         $this->tempFields['temOracleInfo']=$resultOracleObjs->first();

+ 2 - 2
app/Process.php

@@ -21,10 +21,10 @@ class Process extends Model
     public static function filterAuthorities(){
         $user=Auth::user();
         if(!$user){
-            return (new static)->newQuery()->where('owner_id','0');
+            return (new static)->newQuery()->where('processes.owner_id','0');
         }
         $ownerIds=$user->getPermittingOwnerIdsAttribute();
-        return (new static)->newQuery()->whereIn('owner_id',$ownerIds);
+        return (new static)->newQuery()->whereIn('processes.owner_id',$ownerIds);
     }
 
     public function owner(){

+ 6 - 1
app/ProcessStatistic.php

@@ -19,6 +19,11 @@ class ProcessStatistic extends Model
     ];
 
     public function process(){
-        return $this->belongsTo('App\Process','process_id','id');
+        return $this->belongsTo('App\Process','process_id','id')->whereNull('deleted_at');
+    }
+
+    public function operatorLog(){
+        return $this->hasOne('App\OperatorLog','operator_logable_id','process_id')
+            ->where('operator_logable_type','processes');
     }
 }

+ 28 - 1
app/Providers/AppServiceProvider.php

@@ -3,6 +3,18 @@
 namespace App\Providers;
 
 use App\Http\Controllers\Controller;
+use App\OracleActAllocationDetail;
+use App\Services\AllInventoryService;
+use App\Services\InventoryDailyLogService;
+use App\Services\LogisticService;
+use App\Services\OracleActAllocationDetailService;
+use App\Services\OwnerService;
+use App\Services\PackageStatisticsService;
+use App\Services\ProcessMethodService;
+use App\Services\ProcessService;
+use App\Services\ProcessStatisticService;
+use App\Services\WaybillFinancialService;
+use App\Services\WeighExceptedService;
 use Illuminate\Queue\Events\JobFailed;
 use Illuminate\Support\Facades\Queue;
 use Illuminate\Support\Facades\Schema;
@@ -30,6 +42,7 @@ class AppServiceProvider extends ServiceProvider
      */
     public function boot()
     {
+        $this->loadingService();
         //
         Schema::defaultStringLength(191);
         Queue::failing(function (JobFailed $event) {
@@ -43,7 +56,7 @@ class AppServiceProvider extends ServiceProvider
 
         \Illuminate\Database\Query\Builder::macro('sql', function () {
             $bindings = $this->getBindings();
-            $sql = str_replace('?','%s',$this->toSql());
+            $sql = str_replace('?',"'%s'",$this->toSql());
             return vsprintf($sql, $bindings);
         });
 
@@ -51,4 +64,18 @@ class AppServiceProvider extends ServiceProvider
             return ($this->getQuery()->sql());
         });
     }
+
+    private function loadingService(){
+        app()->singleton('waybillFinancialService',WaybillFinancialService::class);
+        app()->singleton('weighExceptedService',WeighExceptedService::class);
+        app()->singleton('allInventoryService',AllInventoryService::class);
+        app()->singleton('inventoryDailyLogService',InventoryDailyLogService::class);
+        app()->singleton('processService',ProcessService::class);
+        app()->singleton('processStatisticService',ProcessStatisticService::class);
+        app()->singleton('ownerService',OwnerService::class);
+        app()->singleton('processMethodService',ProcessMethodService::class);
+        app()->singleton('logisticService',LogisticService::class);
+        app()->singleton('packageStatisticsService',PackageStatisticsService::class);
+        app()->singleton('oracleActAllocationDetailService',OracleActAllocationDetailService::class);
+    }
 }

+ 62 - 0
app/Services/AllInventoryService.php

@@ -0,0 +1,62 @@
+<?php 
+
+namespace App\Services; 
+
+use Illuminate\Support\Facades\DB;
+
+Class AllInventoryService
+{ 
+    public function getSql(array $params, $page=null, $paginate=null){
+        $date_start=$params['date_start'] ?? null;
+        $range = $params['range'] ?? null;
+        if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
+        $date_end=$params['date_end'] ?? null;
+        $TOLocation=$params['TOLocation'] ?? null;
+        $LotAtt05=$params['LotAtt05'] ?? null;
+        $LotAtt02_start=$params['LotAtt02_start'] ?? null;
+        $customerid=$params['customerid'] ?? null;
+        $SKU=$params['SKU'] ?? null;
+        $ALTERNATE_SKU1=$params['ALTERNATE_SKU1'] ?? null;
+        $LotAtt02_end=$params['LotAtt02_end'] ?? null;
+        $sql='select * from (select result.*,rownum rn from (';
+        $sql.=' select customer.descr_c as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
+        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
+        $sql.=' lot.LotAtt04 批号 ';
+        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
+        $sql.=' INV_LOT_LOC_ID storeStatus';
+        $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
+        $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
+        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
+        $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
+        $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME  ';
+        $sql.=' )result where 1=1 ';
+        if ($TOLocation)$sql .= " and 库位 like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and 产品编码 like '".$SKU."' ";
+        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
+        if ($date_start)$sql.=" and 创建时间 > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
+        if ($date_end)$sql.=" and 创建时间 < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
+        if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
+        if ($customerid){
+            $sql .= ' and customer.CustomerID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
+        if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
+        if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
+        $sql.=' )  ';
+        if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
+        return $sql;
+    }
+
+    public function paginate(array $params){
+        return DB::connection('oracle')->
+        select(DB::raw($this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50)));
+    }
+
+}

+ 3 - 7
app/Services/InventoryAccountService.php

@@ -7,16 +7,12 @@ use App\Commodity;
 use App\Http\Controllers\Controller;
 use App\InventoryAccount;
 use App\InventoryAccountMission;
-use App\OraccleBasCustomer;
-use App\OracleActTransactionLog;
+use App\OracleBasCustomer;
 use App\OracleInvLotLocId;
 use App\Owner;
 use App\Services\common\QueryService;
-use Illuminate\Http\Request;
-use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Gate;
 
 class InventoryAccountService
 {
@@ -28,7 +24,7 @@ class InventoryAccountService
             'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
             'date_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
         ];
-        $inventories = app(QueryService::class)->queryCondition($queryParam,$inventories,$columnQueryRules);
+        $inventories = app(QueryService::class)->query($queryParam,$inventories,$columnQueryRules);
         return $inventories;
     }
     public function paginate($queryParam){
@@ -125,7 +121,7 @@ class InventoryAccountService
             $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId);
         }elseif (!$date_start&&!$date_end){
             $name=Owner::where('id',$ownerId)->value('name');
-            $ownerName=OraccleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
+            $ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
             $date_start=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','ASC')->value('addtime');
             $date_end_time=OracleInvLotLocId::where('customerid',$ownerName)->orderBy('addtime','DESC')->value('addtime');
             $type='全盘';

+ 56 - 0
app/Services/InventoryDailyLogService.php

@@ -0,0 +1,56 @@
+<?php 
+
+namespace App\Services; 
+
+use App\InventoryDailyLog;
+use App\InventoryDailyLoggingOwner;
+use App\Services\common\QueryService;
+
+Class InventoryDailyLogService
+{
+    //库存体积条件
+    function conditionQuery(array $param){
+        $inventoryDailyLogs = InventoryDailyLog::query()->with(['owner','commodity'=>function($query){
+            $query->with('barcodes');
+        }])->orderByDesc('inventory_daily_logs.id');
+        $columnQueryRules=[
+            'owner_id' => ['multi' => ','],
+            'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
+            'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
+            'id' => ['multi' => ','],
+        ];
+        $inventoryDailyLogs = app(QueryService::class)->query($param,$inventoryDailyLogs,$columnQueryRules,"inventory_daily_logs");
+        return $inventoryDailyLogs;
+
+    }
+
+    public function getSql(array $params){
+        return $this->conditionQuery($params)->selectRaw("inventory_daily_logs.created_at,inventory_daily_logs.amount,inventory_daily_logs.volumn_occupied")
+            ->leftJoin('owners','inventory_daily_logs.owner_id','owners.id')
+                ->selectRaw('owners.name owner_name')
+            ->leftJoin('commodities','inventory_daily_logs.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku,commodities.length commodity_length,commodities.width commodity_width,commodities.height commodity_height,commodities.volumn commodity_volumn')
+            ->leftJoin('commodity_barcodes','commodity_barcodes.commodity_id','commodities.id')
+                ->selectRaw('commodity_barcodes.code commodity_barcode_code')
+            ->sql();
+    }
+
+    //库存体积
+    public function paginate(array $params){
+        return $this->conditionQuery($params)->paginate($params['paginate'] ?? 50);
+    }
+    //获取开启监听记录货主
+    public function getInventoryDailyLoggingOwner($column = ['id','owner_id'], $status = "启用"){
+        if (!is_array($column)) {
+            $column = [$column];
+        }
+        return InventoryDailyLoggingOwner::query()->select($column)->where('status',$status)->get();
+    }
+
+    //录入监听记录货主
+    public function firstOrCreate($param,$column = null){
+        if ($column)return InventoryDailyLoggingOwner::query()->firstOrCreate($param,$column);
+        return InventoryDailyLoggingOwner::query()->firstOrCreate($param);
+    }
+
+}

+ 67 - 180
app/Services/InventoryService.php

@@ -3,80 +3,94 @@
 
 namespace App\Services;
 
-use App\Commodity;
-use App\Http\Controllers\Controller;
-use App\Inventory;
 use App\inventoryDailyLog;
 use App\InventoryDailyLoggingOwner;
-use App\InventoryMission;
-use App\OraccleBasCustomer;
-use App\OracleActTransactionLog;
-use App\Owner;
 use App\Services\common\QueryService;
-use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Gate;
 
 class InventoryService
 {
-
-    private function conditionQuery(Request $request){
-        $inventories=Inventory::query()->with(['owner'])->orderBy('id','desc');
-        $columnQueryRules=[
-            'owner_id' => ['multi' => ','],
-            'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
-            'date_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
-        ];
-        $inventories = app(QueryService::class)->query($request->input(),$inventories,$columnQueryRules);
-        return $inventories;
-    }
-    public function paginate(Request $request){
-        $inventories = $this->conditionQuery($request);
-        return $inventories->paginate($request->paginate ?? 50);
-    }
-
-    public function get(Request $request){
-        $inventories = $this->conditionQuery($request);
-        return $inventories->get();
-    }
-
-    public function some(Request $request){
-        return Inventory::query()->with(['owner'])->orderBy('id','DESC')
-            ->whereIn('id',explode(',',$request->data))->get();
-    }
-
-    public function conditionSearch(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $date_start=$request->input('formData.date_start');
-        $date_end=$request->input('formData.date_end');
-        $ownerId=$request->input('formData.owner_id')[0];
-        $descr_c=Owner::where('id',$ownerId)->value('name');
+    public function getSql(array $params,$page=null,$paginate=null){
+        $date_start=$params['date_start'] ?? null;
+        $range = $params['range'] ?? null;
+        if ($range)$date_start=date('Y-m-d',strtotime('-'.$range." day"));
+        $date_end=$params['date_end'] ?? null;
+        $TOLocation=$params['TOLocation'] ?? null;
+        $LotAtt05=$params['LotAtt05'] ?? null;
+        $LotAtt02_start=$params['LotAtt02_start'] ?? null;
+        $customerid=$params['customerid'] ?? null;
+        $SKU=$params['SKU'] ?? null;
+        $ALTERNATE_SKU1=$params['ALTERNATE_SKU1'] ?? null;
+        $LotAtt02_end=$params['LotAtt02_end'] ?? null;
         $sql='select * from (select result.*,rownum rn from (';
         $sql.=' select customer.Descr_C as 货主,stockLog.客户 客户, 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
         $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, ';
-        $sql.=' lot.LotAtt04 批号, lot.LotAtt01 生产日期, lot.LotAtt03 入库日期';
+        $sql.=' lot.LotAtt04 批号 ';
         $sql.=' , sum(移出数量)移出数量, sum(移入数量)移入数量 ';
         $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
         $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
+        if ($customerid){
+            $sql .= ' and TOCustomerID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($TOLocation)$sql .= " and FMLOCATION like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
+        if ($customerid){
+            $sql .= ' and FMCUSTOMERID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($TOLocation)$sql .= " and FMLocation like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
+        if ($customerid){
+            $sql .= ' and FMCUSTOMERID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
+        if ($TOLocation)$sql .= " and TOLocation like '".$TOLocation."' ";
+        if ($SKU)$sql.=" and FMSKU like '".$SKU."' ";
+        if ($customerid){
+            $sql .= ' and TOCustomerID in (';
+            $arr = explode(',',$customerid);
+            foreach ($arr as $index => $data){
+                if ($index != 0)$sql .= ',';
+                $sql .= "'".$data."'";
+            }
+            $sql .= ') ';
+        }
         $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
         $sql.=' left join BAS_Customer customer on customer.CustomerID=stockLog.客户 ';
         $sql.=' left join BAS_SKU sku on sku.SKU=stockLog.FMSKU and sku.CUSTOMERID=stockLog.客户 ';
@@ -84,147 +98,20 @@ class InventoryService
         $sql.=' left join INV_LOT_LOC_ID storeStatus on storeStatus.LOTNUM=stockLog.FMLOTNUM ';;
         $sql.=' and storeStatus.LocationID=stockLog.库位 ';
         $sql.=' group by 库位,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
-        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt01,lot.LotAtt03,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
+        $sql.=' ,sku.Descr_C,FMLotNum,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
         $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,stockLog.客户  ';
         $sql.=' )result where 1=1 ';
-        if ($descr_c){
-            $sql .= ' and 货主 in (';
-            $descr_cs = explode(',',$descr_c);
-            foreach ($descr_cs as $index => $descr_c){
-                if ($index != 0)$sql .= ',';
-                $sql .= "'".$descr_c."'";
-            }
-            $sql .= ') ';
-        }
+        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
+        if ($LotAtt02_start)$sql.=" and 失效日期 >='".$LotAtt02_start." 00:00:00' ";
+        if ($LotAtt02_end)$sql.=" and 失效日期 <='".$LotAtt02_end." 23:59:59' ";
+        if ($ALTERNATE_SKU1)$sql.=" and 产品条码 like '".$ALTERNATE_SKU1."' ";
+        if ($page&&$paginate)$sql.="  and ROWNUM<='".$page*$paginate."'";
         $sql.=' )  ';
-        return DB::connection('oracle')->select($sql);
-    }
-    //创建盘点任务
-    public function createMission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $date_start=$request->input('formData.date_start');
-        $date_end=$request->input('formData.date_end');
-        $ownerIds=$request->input('formData.owner_id');
-        if (count($ownerIds)<=0) return null;
-        if ($date_start&&$date_end){
-            $type='动盘';
-        }elseif (!$date_start&&!$date_end){
-            $name=Owner::where('id',$ownerIds[0])->value('name');
-            $ownerName=OraccleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');
-            $date_start=OracleActTransactionLog::where('fmcustomerid',$ownerName)->orderBy('addtime','asc')->value('addtime');
-            $date_end=OracleActTransactionLog::where('fmcustomerid',$ownerName)->orderBy('addtime','desc')->value('addtime');
-            $type='全盘';
-        }else{
-            return null;
-        }
-        $ownerId=$ownerIds[0];
-        $inventory=new Inventory([
-            'owner_id'=>$ownerId,
-            'type'=>$type,
-            'start_at'=>$date_start,
-            'end_at'=>$date_end,
-        ]);
-        $inventory->save();
-        $this->createInventoryMissionRecord($request,$inventory['id'],$ownerId);
-        Controller::logS(__METHOD__,"创建盘点记录任务__".__FUNCTION__,json_encode($request,$inventory['id'],$ownerId),Auth::user()['id']);
-        $inventoryMissionCount=InventoryMission::where('inventory_id',$inventory['id'])->count();
-        $inventory->total=$inventoryMissionCount;
-        $inventory->update();
-        Controller::logS(__METHOD__,"创建盘点任务__".__FUNCTION__,json_encode($request),Auth::user()['id']);
-        return $inventory;
-    }
-
-    //创建盘点记录任务
-    public function createInventoryMissionRecord($request,$inventoryId,$ownerId){
-        $wmsInventories=$this->conditionSearch($request);
-        foreach ($wmsInventories as $wmsInventory){
-            $commodity=Commodity::query()->firstOrCreate([
-                'owner_id'=>$ownerId,
-                'sku'=>$wmsInventory->产品编码,
-            ]);
-            if (!$commodity->name){
-                $commodity->name=$wmsInventory->商品名称;
-                $commodity->update();
-                Controller::logS(__METHOD__,"根据wms产品编码和货主查询或创建商品信息__".__FUNCTION__,json_encode($wmsInventory));
-            }
-            $commodity->newBarcode($wmsInventory->产品条码);
-            Controller::logS(__METHOD__,"根据wms产品条码和商品id查询或创建商品条码信息__".__FUNCTION__,json_encode($wmsInventory));
-            $inventoryMission = new InventoryMission();
-            $inventoryMission->commodity_id=$commodity->id;
-            $inventoryMission->inventory_id=$inventoryId;
-            $inventoryMission->location=$wmsInventory->库位;
-            $inventoryMission->produced_at=$wmsInventory->生产日期;
-            $inventoryMission->valid_at=$wmsInventory->失效日期;
-            $inventoryMission->stored_at=$wmsInventory->入库日期;
-            $inventoryMission->batch_number=$wmsInventory->批号;
-            $inventoryMission->erp_type_position=$wmsInventory->属性仓;
-            $inventoryMission->quality=$wmsInventory->质量状态;
-            $inventoryMission->stored_amount=$wmsInventory->在库数量;
-            $inventoryMission->occupied_amount=$wmsInventory->占用数量;
-            $inventoryMission->save();
-        }
-    }
-    //盘点库存
-    public function stockInventory($request){
-        $inventoryId=$request->inventoryId;
-        $count=$request->count;
-        $location=$request->location;
-        $barcode=$request->barcode;
-        $inventoryMission=InventoryMission::with(['commodity'=>function($query)use($barcode){
-            return $query->with(['barcodes'=>function($sql)use($barcode){
-                return $sql->where('code',$barcode);
-            }]);
-        }])->where('location',$location)->where('inventory_id',$inventoryId)->first();
-        if (!$inventoryMission) return null;
-        $inventoryMission->verified_amount=$count;
-        $inventoryMission->difference_amount=abs($inventoryMission->stored_amount-$count);
-        $inventoryMission->checked='是';
-        $inventoryMission->update();
-        Controller::logS(__METHOD__,"盘点__".__FUNCTION__,json_encode($request));
-        return $inventoryMission;
-    }
-    //盘点修改盘点任务中的已盘条数
-    public function updateInventoryMissionProcessed($request){
-        $inventoryId=$request->inventoryId;
-        $inventory=Inventory::find($inventoryId);
-        $processed=InventoryMission::where('checked','是')->where('inventory_id',$inventoryId)->count();
-        $inventory->processed=$processed;
-        $inventory->update();
-        Controller::logS(__METHOD__,"盘点修改盘点任务中的已盘条数__".__FUNCTION__,json_encode($request));
-        return $inventory;
-    }
-
-    //库存体积条件
-    function conditionQueryDailyLog(array $param){
-        $inventoryDailyLogs = InventoryDailyLog::query()->with(['owner','commodity'=>function($query){
-            $query->with('barcodes');
-        }])->orderByDesc('id');
-        $columnQueryRules=[
-            'owner_id' => ['multi' => ','],
-            'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
-            'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
-        ];
-        $inventoryDailyLogs = app(QueryService::class)->query($param,$inventoryDailyLogs,$columnQueryRules);
-        return $inventoryDailyLogs;
-
-    }
-
-    //库存体积
-    public function getInventoryDailyLog(array $param){
-        return $this->conditionQueryDailyLog($param)->paginate($param['paginate'] ?? 50);
-    }
-
-    //获取开启监听记录货主
-    public function getInventoryDailyLoggingOwner($column = ['id','owner_id'], $status = "启用"){
-        if (!is_array($column)) {
-            $column = [$column];
-        }
-        return InventoryDailyLoggingOwner::query()->select($column)->where('status',$status)->get();
+        if ($page&&$paginate)$sql.="  where rn>'".($page-1)*$paginate."'";
+        return $sql;
     }
 
-    //录入监听记录货主
-    public function firstOrCreate($param,$column = null){
-        if ($column)return InventoryDailyLoggingOwner::query()->firstOrCreate($param,$column);
-        return InventoryDailyLoggingOwner::query()->firstOrCreate($param);
+    public function paginate(array $params){
+        return DB::connection('oracle')->select(DB::raw($this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50)));
     }
 }

+ 31 - 23
app/Services/LaborReportService.php

@@ -11,10 +11,12 @@ use App\LaborReportStatus;
 use App\LaborCompany;
 use App\LaborReport;
 use App\Services\common\QueryService;
+use App\User;
 use App\UserDetail;
 use App\UserDutyCheck;
 use App\UserLabor;
 use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\DB;
@@ -23,42 +25,48 @@ use Illuminate\Support\Facades\Gate;
 
 class LaborReportService
 {
-    private function conditionQuery(Request $request){
+    private function conditionQuery(array $params){
         $user=Auth::user();
-        $laborReports=LaborReport::query()->with(['user','userDutyCheck','userWorkgroup'])->orderBy('id','DESC')->whereIn('user_workgroup_id',
-            $user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[]);
-        $laborStatus=LaborReportStatus::select('labor_report_id')->where('status','已退场')->get();
-        $enterNumbers=[];
-        foreach ($laborStatus as $laborId){
-            $enterNumber=LaborReport::where('id',$laborId['labor_report_id'])->value('enter_number');
-            if($enterNumber!=null)
-            array_push($enterNumbers,$enterNumber);
-        }
-        if (!$request->is_export){
-            $laborReports->whereNotIn('enter_number',$enterNumbers);
-        }else $request->offsetUnset('is_export');
+        $laborReports=LaborReport::query()->with(['user','userDutyCheck','userWorkgroup'])->orderBy('labor_reports.id','DESC');
+        if (!($params["is_export"] ?? false)){
+            $laborReports = $laborReports->whereNotIn('labor_reports.id',function ($builder){
+                $builder->select('labor_report_id')->from('labor_report_statuses')->where('status','已退场')
+                    ->where('created_at','like',date('Y-m-d').'%');
+            });
+        }else unset($params['is_export']);
+        $laborReports->where('labor_reports.created_at','like',date('Y-m-d').'%');
         $columnQueryRules=[
             'enter_number' => ['timeLimit' => 15],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
             'identity_number' => ['timeLimit' => 15]
         ];
-        $laborReports = app(QueryService::class)->query($request->input(),$laborReports,$columnQueryRules);
-        if(Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')){
-            $laborReports->orWhereNull('user_workgroup_id');
+        $laborReports = app(QueryService::class)->query($params,$laborReports,$columnQueryRules);
+        if((Gate::allows('人事管理-临时工报表-可见全部组')||Gate::allows('人事管理-门卫审核')) && !($params["user_workgroup_id"] ?? false)){
+            $laborReports->where(function ($query)use($user){
+                $query->whereIn('labor_reports.user_workgroup_id',$user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[])
+                ->orWhereNull('labor_reports.user_workgroup_id');
+            });
+        }else{
+            $laborReports->whereIn('labor_reports.user_workgroup_id',
+                $user?$user->getPermittingWorkgroupIds(Gate::allows('人事管理-临时工报表-可见全部组')):[]);
         }
         return $laborReports;
     }
-    public function paginate(Request $request){
-        return $this->conditionQuery($request)->paginate($request->paginate ?? 50);
+    public function paginate(array $params){
+        return $this->conditionQuery($params)->paginate($request->paginate ?? 50);
     }
-    public function get(Request $request){
-        return $this->conditionQuery($request)->get();
+    public function get(array $params){
+        return $this->conditionQuery($params)->without("userDutyCheck")->get();
     }
-    public function some(Request $request){
-        return LaborReport::query()->orderBy('id','DESC')
-                        ->whereIn('id',explode(',',$request->data))->get();
+
+    public function getSql(array $params){
+        return $this->conditionQuery($params)->selectRaw("labor_reports.*")
+            ->leftJoin('user_workgroups','labor_reports.user_workgroup_id','user_workgroups.id')
+                ->selectRaw('user_workgroups.name user_workgroup_name')
+            ->sql();
     }
+
     //根据进场记录创建临时工报表
     public function makeLaborReportByUserDutyCheck($userDutyCheck){
         $dateNow=Carbon::now()->format('Y-m-d');

+ 2 - 2
app/Services/LogisticService.php

@@ -6,8 +6,8 @@ use App\Logistic;
 
 Class LogisticService
 {
-    public function get(){
-        return Logistic::get();
+    public function getSelection($column = ['id','name']){
+        return Logistic::query()->select($column)->get();
     }
 
 }

+ 43 - 0
app/Services/OracleActAllocationDetailService.php

@@ -0,0 +1,43 @@
+<?php 
+
+namespace App\Services;
+
+use Illuminate\Support\Facades\DB;
+
+/**
+ * connection : oracle
+ * table : ACT_ALLOCATION_DETAILS
+ */
+Class OracleActAllocationDetailService
+{
+    public function paginate(array $params){
+        $page = $params['page'] ?? 1;
+        $pagiante = $params['pagiante'] ?? 50;
+        if (!is_numeric($page) || !is_numeric($pagiante))return;
+        $sql = "SELECT ACT_ALLOCATION_DETAILS.* FROM(SELECT ACT_ALLOCATION_DETAILS.*,ROWNUM rn FROM
+                    (SELECT orderno FROM ACT_ALLOCATION_DETAILS WHERE 1=1 ";
+        if ($params['checktime_start'] ?? false){
+            $sql .= " AND checktime >= '".$params['checktime_start']." 00:00:00'";
+        }
+        if ($params['checktime_end'] ?? false){
+            $sql .= " AND checktime <= '".$params['checktime_end']." 23:59:59'";
+        }
+        $sql .= "GROUP BY orderno)ACT_ALLOCATION_DETAILS)ACT_ALLOCATION_DETAILS
+                WHERE ACT_ALLOCATION_DETAILS.rn <= ".$page*$pagiante." AND rn >".($page-1)*$pagiante;
+        return DB::connection('oracle')->select(DB::raw($sql));
+    }
+
+    public function getOrderno(array $params){
+        $allocations = $this->paginate($params);
+        $count = count($allocations);
+        $str = "(";
+        foreach ($allocations as $index => $allocation){
+            if ($index < $count-1){
+                $str .= "'".$allocation->orderno."',";
+            }else{
+                $str .= "'".$allocation->orderno."')";
+            }
+        }
+        return $str;
+    }
+}

+ 104 - 26
app/Services/OrderIssueService.php

@@ -12,6 +12,7 @@ use App\RejectedBillItem;
 use Illuminate\Http\Request;
 use Illuminate\Support\Arr;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Validator;
 
 class OrderIssueService
@@ -31,15 +32,9 @@ class OrderIssueService
         }
         $user = Auth::user();
         $owner_ids = $user ? $user->getPermittingOwnerIdsAttribute() : [];
-        $order_ids = [];
         if ($condition['owner_id'] ?? false) {
             $owner_ids = explode(',', $condition['owner_id']);
         }
-
-        $orders = Order::select('id')->whereIn('owner_id', $owner_ids)->get();
-        foreach ($orders as $order) {
-            array_push($order_ids, $order['id']);
-        }
         $query = OrderIssue::with(['top', 'userWorkGroup', 'issueType', 'logs' => function ($query) {
             $query->with(['user'])->orderByDesc('created_at');
         }, 'order' => function ($query) {
@@ -62,11 +57,7 @@ class OrderIssueService
             });
         });
 
-        $query->selectRaw('order_issues.* ,order_issue_on_tops.id top_id ,order_issue_on_tops.remark,order_issue_on_tops.updated_at top_update')
-            ->leftJoin('order_issue_on_tops', 'order_issue_on_tops.order_issue_id', '=', 'order_issues.id')
-            ->whereNull('order_issue_on_tops.deleted_at')
-            ->orderBy('order_issue_on_tops.updated_at', 'desc')
-            ->orderBy('order_issues.id', 'desc');
+        $query->orderBy('order_issues.id', 'desc');
         return $query;
     }
 
@@ -88,24 +79,32 @@ class OrderIssueService
                     $query->where('logistic_number', $logistic_number);
                 });
             }
+            if (($arr['good_barcode'] ?? false) || ($arr['good_name'] ?? false)) {
+                $query->whereHas('packages', function ($query) use ($arr) {
+                    $query->whereHas('commodities', function ($query) use ($arr) {
+                        $query->whereHas('commodity', function ($query) use ($arr) {
+                            if ($arr['good_barcode'] ?? false) {
+                                $query->where('sku', $arr['good_barcode']);
+                            }
+                            if ($arr['good_name'] ?? false) {
+                                $query->where('name', $arr['good_name']);
+                            }
+                        });
+                    });
+                });
+            }
         });
         return $query;
     }
 
     public function getRejectedBillQuery(array $arr, $query)
     {
-        if (($arr['id_quality_label'] ?? false) || ($arr['good_barcode'] ?? false) || ($arr['good_name'] ?? false)) {
+        if ($arr['id_quality_label'] ?? false) {
             $query->whereHas('rejectedBill', function ($query) use ($arr) {
                 $query->whereHas('items', function ($query) use ($arr) {
                     if ($arr['id_quality_label'] ?? false) {
                         $query->where('id_quality_label', $arr['id_quality_label']);
                     }
-                    if ($arr['good_barcode'] ?? false) {
-                        $query->where('barcode_goods', $arr['good_barcode']);
-                    }
-                    if ($arr['good_name'] ?? false) {
-                        $query->where('name_goods', 'like', $arr['good_name']);
-                    }
                 });
             });
         }
@@ -134,8 +133,8 @@ class OrderIssueService
             $query->where('order_issue_type_id', $condition['order_issue_type_id']);
         }
         if (!($condition['is_handle'] ?? false) && !($condition['final_status'] ?? false)) {
-            $query->where(function ($query){
-                $query->where('final_status','<>','已解决')->orWhereNull('final_status');
+            $query->where(function ($query) {
+                $query->where('final_status', '<>', '已解决')->orWhereNull('final_status');
             });
         }
         if (isset($condition['logistic_indemnity_money'])) {
@@ -155,9 +154,83 @@ class OrderIssueService
         return $query;
     }
 
+    public function getSqlList(array $params){
+        $orderPackageSql = OrderPackage::query()->selectRaw('order_packages.logistic_number order_package_logistic_number')
+            ->leftJoin('order_package_commodities','order_packages.id','order_package_commodities.order_package_id')
+                ->selectRaw('order_package_commodities.amount commodity_amount')
+            ->leftJoin('commodities','order_package_commodities.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku')
+            ->leftJoin('order_issues','order_packages.order_id','order_issues.order_id')
+                ->selectRaw('order_issues.id order_issue_id')
+            ->sql();
+        $secondOrderPackageSql = Order::query()->from('order_packages','s_o_p')->selectRaw('s_o_p.logistic_number')
+            ->leftJoin('order_package_commodities as s_o_p_c','s_o_p_c.order_package_id','s_o_p.id')
+                ->selectRaw('s_o_p_c.amount s_o_p_c_amount')
+            ->leftJoin('commodities as s_c','s_o_p_c.commodity_id','s_c.id')
+                ->selectRaw('s_c.sku s_c_sku,s_c.name s_c_name')
+            ->leftJoin('order_issues','s_o_p.order_id','order_issues.second_order_id')
+                ->selectRaw('order_issues.id order_issue_id')
+            ->sql();
+        $rejectedBillItemSql = RejectedBillItem::query()->selectRaw('rejected_bill_items.remark,rejected_bill_items.amount rejected_bill_amount,rejected_bill_items.name_goods,rejected_bill_items.barcode_goods')
+            ->leftJoin('order_issues','rejected_bill_items.id_rejected_bill','order_issues.rejected_bill_id')
+                ->selectRaw('order_issues.id order_issue_id')
+            ->sql();
+        $logSql = OrderIssueProcessLog::query()->selectRaw('order_issue_process_logs.content log_content,order_issue_process_logs.type log_type')
+            ->leftJoin('users','order_issue_process_logs.user_id','users.id')
+                ->selectRaw('users.name user_name')
+            ->leftJoin('order_issues','order_issue_process_logs.order_issue_id','order_issues.id')
+                ->selectRaw('order_issues.id order_issue_id')
+            ->sql();
+        $column = "order_issues.id,order_issues.rejected_bill_id,order_issues.rejecting_status,order_issues.created_at order_issues_created_at,order_issues.result_explain,order_issues.final_status,";
+        $column .= "order_issues.logistic_indemnity_money,order_issues.logistic_express_remission,order_issues.baoshi_indemnity_money,order_issues.baoshi_express_remission";
+        $orderIssueSql =  $this->getConditionQuery($params)->selectRaw($column)
+            ->leftJoin('order_issue_types','order_issues.order_issue_type_id','order_issue_types.id')
+                ->selectRaw('order_issue_types.`name` order_issue_type_name')
+            ->leftJoin('orders','order_issues.order_id','orders.id')
+                ->selectRaw('orders.id order_id,orders.address,orders.district,orders.city,orders.province,orders.consignee_phone,orders.consignee_name,orders.client_code,orders.created_at order_created_at')
+          /*  ->leftJoin('order_packages','order_packages.order_id','orders.id')
+                ->selectRaw('order_packages.id order_package_id,order_packages.logistic_number order_package_logistic_name')
+            ->leftJoin('order_package_commodities','order_packages.id','order_package_commodities.order_package_id')
+                ->selectRaw('order_package_commodities.id order_package_commodity_id,order_package_commodities.amount commodity_amount')
+            ->leftJoin('commodities','order_package_commodities.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku')*/
+            ->leftJoin('logistics','logistics.id','orders.logistic_id')
+                ->selectRaw('logistics.name logistic_name')
+            ->leftJoin('owners','owners.id','orders.owner_id')
+                ->selectRaw('owners.name owner_name')
+            ->leftJoin('shops','orders.shop_id','shops.id')
+                ->selectRaw('shops.name shop_name')
+/*            ->leftJoin('rejected_bills','order_issues.rejected_bill_id','rejected_bills.id')*/
+            /*->leftJoin('rejected_bill_items','rejected_bills.id','rejected_bill_items.id_rejected_bill')
+                ->selectRaw('rejected_bill_items.id rejected_bill_item_id,rejected_bill_items.remark,rejected_bill_items.amount rejected_bill_amount,rejected_bill_items.name_goods,rejected_bill_items.barcode_goods')*/
+            /*->leftJoin('order_issue_process_logs','order_issues.id','order_issue_process_logs.order_issue_id')
+                ->selectRaw('order_issue_process_logs.content log_content,order_issue_process_logs.type log_type')
+            ->leftJoin('users','order_issue_process_logs.user_id','users.id')
+                ->selectRaw('users.name user_name')*/
+            ->leftJoin('orders as s_o','s_o.id','order_issues.second_order_id')
+                ->selectRaw('s_o.id s_o_id,s_o.client_code s_o_client_code')
+            /*->leftJoin('order_packages as s_o_p','s_o_p.order_id','s_o.id')
+                ->selectRaw('s_o_p.id s_o_p_id,s_o_p.logistic_number')
+            ->leftJoin('order_package_commodities as s_o_p_c','s_o_p_c.order_package_id','s_o_p.id')
+                ->selectRaw('s_o_p_c.id s_o_p_c_id,s_o_p_c.amount s_o_p_c_amount')
+            ->leftJoin('commodities as s_c','s_o_p_c.commodity_id','s_c.id')
+                ->selectRaw('s_c.sku s_c_sku,s_c.name s_c_name')*/
+            ->leftJoin('logistics as s_logistics','s_o.logistic_id','s_logistics.id')
+                ->selectRaw('s_logistics.name s_logistics_name')
+            ->leftJoin('user_workgroups','user_workgroups.id','order_issues.user_workgroup_id')
+                ->selectRaw('user_workgroups.name user_workgroup_name')
+            ->sql();
+            return compact('orderPackageSql','secondOrderPackageSql','orderIssueSql','rejectedBillItemSql','logSql');
+    }
+
     public function paginate(array $arr)
     {
-        return $this->getConditionQuery($arr)->paginate($arr['paginate'] ?? 50);
+        $query = $this->getConditionQuery($arr);
+        return $query->selectRaw('order_issues.* ,order_issue_on_tops.id top_id ,order_issue_on_tops.remark,order_issue_on_tops.updated_at top_update')
+            ->leftJoin('order_issue_on_tops', 'order_issue_on_tops.order_issue_id', '=', 'order_issues.id')
+            ->whereNull('order_issue_on_tops.deleted_at')
+            ->orderBy('order_issue_on_tops.updated_at', 'desc')->paginate($arr['paginate'] ?? 50);
+
     }
 
     public function orderIssueTag(array $arr)
@@ -178,8 +251,6 @@ class OrderIssueService
 
     public function createOrFindByOrderNo($orderNo)
     {
-        $orderService = app('orderService');
-        $rejectedService = app('rejectedService');
         $orderHeader = OracleDOCOrderHeader::where('orderNo', $orderNo)->first();
         if (!$orderHeader) {
             return null;
@@ -205,6 +276,14 @@ class OrderIssueService
             if ($rejectedBill) {
                 $orderIssue->rejected_bill_id = $rejectedBill['id'];
                 $orderIssue->save();
+            } else {
+                if ($orderHeader['orderno']) {
+                    $rejectedBill = RejectedBill::where('order_number', $orderHeader['orderno'])->first();
+                    if ($rejectedBill) {
+                        $orderIssue->rejected_bill_id = $rejectedBill['id'];
+                        $orderIssue->save();
+                    }
+                }
             }
         }
         $this->judgeRejectingStatus($orderIssue);
@@ -265,8 +344,8 @@ class OrderIssueService
         $rejectedItems = [];
         $orderItems = [];
         if ($orderIssue->rejected_bill_id) {
-            $rejectedBill = RejectedBill::find($orderIssue->rejected_bill_id)->first();
-            $rejectedBillItems = RejectedBillItem::where('id_rejected_bill', $rejectedBill->id)->get();
+            $rejectedBill = RejectedBill::query()->find($orderIssue->rejected_bill_id)->first();
+            $rejectedBillItems = RejectedBillItem::query()->where('id_rejected_bill', $rejectedBill->id)->get();
             if ($rejectedBillItems) {
                 foreach ($rejectedBillItems as $item) {
                     if (!isset($rejectedItems[$item->barcode_goods])) {
@@ -346,7 +425,6 @@ class OrderIssueService
 
     public function createByLogisticNumber(array $arr)
     {
-        $orderService = app('orderService');
         $order = Order::create($arr);
         $orderIssue = OrderIssue::create($arr);
         $orderIssue->order_id = $order['id'];

+ 17 - 12
app/Services/PackageService.php

@@ -9,35 +9,40 @@ use Illuminate\Http\Request;
 
 Class PackageService
 {
-    private function conditionQuery(Request $request){
-        $packages = Package::query()->orderBy('id','DESC');
+    private function conditionQuery($params){
+        $packages = Package::query()->orderBy('packages.id','DESC');
         $columnQueryRules=[
             'logistic_number' => ['like' => ''],
             'batch_number' => ['like' => ''],
             'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
             'created_at_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
+            'id' => ['multi' => ','],
         ];
-        $packages = app(QueryService::class)->query($request->input(),$packages,$columnQueryRules);
+        $packages = app(QueryService::class)->query($params,$packages,$columnQueryRules,"packages");
         return $packages;
     }
 
     public function paginate(Request $request){
-        $packages = $this->conditionQuery($request);
+        $packages = $this->conditionQuery($request->input());
         return $packages->paginate($request->paginate ?? 50);
     }
 
     public function get(Request $request){
-        $packages = $this->conditionQuery($request);
+        $packages = $this->conditionQuery($request->input());
         return $packages->get();
     }
 
-    public function some(Request $request){
-        return Package::query()->orderBy('id','DESC')
-            ->whereIn('id',explode(',',$request->data))->get();
-    }
-
-    public function getSql(Request $request){
-        return $this->conditionQuery($request)->sql();
+    public function getSql($params){
+        return $this->conditionQuery($params)->selectRaw('packages.*')
+        ->LeftJoin('owners','packages.owner_id','owners.id')
+            ->selectRaw('owners.name owner_name')
+        ->LeftJoin('logistics','packages.logistic_id','logistics.id')
+            ->selectRaw('logistics.name logistic_name')
+        ->LeftJoin('paper_boxes','packages.paper_box_id','paper_boxes.id')
+            ->selectRaw('paper_boxes.model paper_box_name')
+        ->LeftJoin('measuring_machines','packages.measuring_machine_id','measuring_machines.id')
+            ->selectRaw('measuring_machines.name measuring_machine_name')
+        ->sql();
     }
 
 }

+ 28 - 0
app/Services/PackageStatisticsService.php

@@ -0,0 +1,28 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Package;
+use App\Services\common\QueryService;
+use Illuminate\Support\Facades\DB;
+
+Class PackageStatisticsService
+{
+    private function conditionQuery(array $params){
+        $query = Package::query()->with(['owner','logistic'])->select(DB::raw('owner_id,logistic_id,COUNT(logistic_id) AS count'))->whereNotNull('owner_id');
+        $columnQueryRules=[
+            'date_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
+            'date_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
+            'logistic_id' => ['multi' => ','],
+            'owner_id' => ['multi' => ','],
+        ];
+        $query = $query->groupBy(['owner_id','logistic_id']);
+        return app(QueryService::class)->query($params,$query,$columnQueryRules);
+    }
+
+
+    public function get(array $params){
+        return $this->conditionQuery($params)->get();
+    }
+
+}

+ 14 - 0
app/Services/ProcessMethodService.php

@@ -0,0 +1,14 @@
+<?php 
+
+namespace App\Services; 
+
+
+use App\ProcessMethod;
+
+Class ProcessMethodService
+{
+    public function getSelection($column = ['id','name']){
+        return ProcessMethod::query()->select($column)->get();
+    }
+
+}

+ 48 - 21
app/Services/ProcessService.php

@@ -6,18 +6,19 @@ use App\Process;
 use App\Services\common\QueryService;
 use Carbon\Carbon;
 use Illuminate\Http\Request;
+use Illuminate\Support\Facades\DB;
 
 Class ProcessService
 {
-    private function conditionQuery(Request $request){
+    private function conditionQuery(array $params){
         $processes=Process::filterAuthorities()->with(['tutorials','signs',
             'signUnitPrice','processesContents'=>function($query){
             return $query->with(['signCommodityName','signCommoditySku','signCommodityBarcode','commodity'=>function($query){
                 return $query->with('barcodes');
             }]);
         }])->orderBy('processes.id','DESC');
-        if ($request->input('commodity_barcode')){
-            $barcode=$request->input('commodity_barcode');
+        if ($params['commodity_barcode'] ?? false){
+            $barcode=$params['commodity_barcode'];
             $processes=$processes->whereHas('processesContents',function ($query)use($barcode){
                 $query->whereHas('commodity',function ($builder)use($barcode){
                     $builder->whereHas('barcodes',function ($builder)use($barcode){
@@ -25,42 +26,68 @@ Class ProcessService
                     });
                 });
             });
-            $request->offsetUnset('commodity_barcode');
+            unset($params['commodity_barcode']);
         }
-        if ($request->input('wms_code')){
-            $wms_code=$request->input('wms_code');
+        if ($params['wms_code'] ?? false){
+            $wms_code=$params['wms_code'];
             $processes=$processes->whereHas('processesContents',function ($builder)use ($wms_code){
                 $builder->where('wms_code','like',$wms_code);
             });
-            $request->offsetUnset('wms_code');
+            unset($params['wms_code']);
         }
-        if (!$request->is_accomplish){
+        if (!($params['is_accomplish'] ?? false)){
             $processes=$processes->where('status','!=','交接完成');
-        }else $request->offsetUnset('is_accomplish');
+        }else unset($params['is_accomplish']);
         $columnQueryRules=[
             'date_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
             'date_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
             'code' => ['like' => ''],
             'owner_id' => ['multi' => ','],
+            'id' => ['multi' => ','],
         ];
-        $processes = app(QueryService::class)->query($request->input(),$processes,$columnQueryRules);
+        $processes = app(QueryService::class)->query($params,$processes,$columnQueryRules,"processes");
         return $processes;
     }
 
-    public function paginate(Request $request){
-        return $this->conditionQuery($request)->paginate($request->paginate ?? 50);
+    public function paginate(array $params){
+        return $this->conditionQuery($params)->paginate($request->paginate ?? 50);
     }
 
-    public function get(Request $request){
-        return $this->conditionQuery($request)->get();
+    public function get(array $params){
+        return $this->conditionQuery($params)->get();
     }
 
-    public function some(Request $request){
-        return Process::filterAuthorities()->with(['processesContents'=>function($query){
-            return $query->with(['commodity'=>function($query){
-                return $query->with('barcodes');
-            }]);
-        }])->orderBy('processes.id','DESC')->whereIn('processes.id',explode(',',$request->data))->get();
+    public function getSql(array $params){
+        return $this->conditionQuery($params)->selectRaw('processes.code,processes.amount,processes.completed_amount,processes.status,processes.remark,processes.unit_price,processes.created_at')
+            ->leftJoin('owners','processes.owner_id','owners.id')
+                ->selectRaw('owners.name owner_name')
+            ->leftJoin('process_methods','processes.process_method_id','process_methods.id')
+                ->selectRaw('process_methods.name process_method_name')
+            ->leftJoin('processes_contents','processes.id','processes_contents.process_id')
+                ->selectRaw('processes_contents.bill_type content_bill_type,processes_contents.wms_code content_wms_code,processes_contents.amount content_amount')
+            ->leftJoin('commodities','processes_contents.commodity_id','commodities.id')
+                ->selectRaw('commodities.name commodity_name,commodities.sku commodity_sku')
+            ->leftJoin('commodity_barcodes','commodities.id','commodity_barcodes.commodity_id')
+                ->selectRaw(DB::raw("GROUP_CONCAT(commodity_barcodes.code) commodity_barcode_code"))
+                ->groupBy("processes_contents.id","processes_contents.commodity_id")
+            ->leftJoin('signs as sign_commodity_sku',function ($join){
+                $join->on('sign_commodity_sku.signable_type',DB::raw("'processes_contents'"))
+                    ->on('sign_commodity_sku.signable_id','processes_contents.id')
+                    ->on('sign_commodity_sku.field',DB::raw("'commodity_sku'"));
+            })
+                ->selectRaw('sign_commodity_sku.mark sign_commodity_sku_mark')
+            ->leftJoin('signs as sign_commodity_name',function ($join){
+                $join->on('sign_commodity_name.signable_type',DB::raw("'processes_contents'"))
+                    ->on('sign_commodity_name.signable_id','processes_contents.id')
+                    ->on('sign_commodity_name.field',DB::raw("'commodity_name'"));
+            })
+                ->selectRaw('sign_commodity_name.mark sign_commodity_name_mark')
+            ->leftJoin('signs as sign_commodity_barcode',function ($join){
+                $join->on('sign_commodity_barcode.signable_type',DB::raw("'processes_contents'"))
+                    ->on('sign_commodity_barcode.signable_id','processes_contents.id')
+                    ->on('sign_commodity_barcode.field',DB::raw("'commodity_barcode'"));
+            })
+                ->selectRaw('sign_commodity_barcode.mark sign_commodity_barcode_mark')
+            ->sql();
     }
-
 }

+ 59 - 0
app/Services/ProcessStatisticService.php

@@ -0,0 +1,59 @@
+<?php 
+
+namespace App\Services; 
+
+use App\ProcessStatistic;
+use App\Services\common\QueryService;
+use Illuminate\Database\Eloquent\Builder;
+
+Class ProcessStatisticService
+{ 
+    private function conditionQuery(array $params){
+        $query = ProcessStatistic::with(['process'])->orderBy('process_statistics.process_id','DESC')
+            ->has('process');
+        if ($params["owner_id"] ?? false){
+            $owner_id=$params["owner_id"];
+            $query=$query->whereHas('process',function (Builder $builder)use($owner_id){
+                $builder->where('owner_id',$owner_id);
+            });
+            unset($params["owner_id"]);
+        }
+        if ($params["code"] ?? false){
+            $code=$params["code"];
+            $query=$query->whereHas('process',function (Builder $builder)use($code){
+                $builder->where('code','like',$code."%");
+            });
+            unset($params["code"]);
+        }
+        if ($params["status"] ?? false){
+            $status=$params["status"];
+            $query=$query->whereHas('process',function (Builder $builder)use($status){
+                $builder->where('status',$status);
+            });
+            unset($params["status"]);
+        }
+        $columnQueryRules=[
+            'started_at' => ['startDate' => ' 00:00:00'],
+            'ended_at' => ['endDate' => ' 23:59:59'],
+            'process_id' => ['multi' => ','],
+        ];
+        $query = app(QueryService::class)->query($params,$query,$columnQueryRules,"process_statistics");
+        return $query;
+    }
+
+    public function paginate(array $params){
+        return $this->conditionQuery($params)->paginate($params["paginate"] ?? 50);
+    }
+
+    public function getSql(array $params){
+        return $this->conditionQuery($params)->selectRaw('process_statistics.*')
+            ->leftJoin('processes','process_statistics.process_id','processes.id')
+                ->selectRaw('processes.code process_code,processes.unit_price process_unit_price,processes.amount process_amount,processes.completed_amount process_completed_amount,processes.status process_status')
+            ->leftJoin('owners','processes.owner_id','owners.id')
+                ->selectRaw('owners.name owner_name')
+            ->leftJoin('process_methods','processes.process_method_id','process_methods.id')
+                ->selectRaw('process_methods.name process_method_name')
+            ->sql();
+    }
+
+}

+ 29 - 0
app/Services/WaybillFinancialService.php

@@ -0,0 +1,29 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Services\common\QueryService;
+use App\WaybillFinancialSnapshot;
+
+Class WaybillFinancialService
+{
+    public function conditionQuery(array $param){
+        $waybillFinancialSnapshots=WaybillFinancialSnapshot::query();
+        $columnQueryRules=[
+            'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
+            'created_at_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
+            'waybill_id' => ['multi' => ','],
+        ];
+        return app(QueryService::class)->query($param,$waybillFinancialSnapshots,$columnQueryRules);
+    }
+
+
+    /**
+     * @param array $param
+     * @return string
+     */
+    public function getSql(array $param){
+        return $this->conditionQuery($param)->sql();
+    }
+
+}

+ 24 - 20
app/Services/WaybillService.php

@@ -13,7 +13,7 @@ use Ramsey\Uuid\Uuid;
 
 Class WaybillService
 {
-    private function conditionQuery(Request $request){
+    private function conditionQuery(array $param){
         $waybills = Waybill::filterAuthorities()->with(['owner','wmsCommodities','waybillAuditLogs' => function ($query) {
             return $query->with('user');
         }])->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
@@ -30,24 +30,25 @@ Class WaybillService
             'destination' => ['like' => ''],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ' 00:00:00'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ' 23:59:59'],
-            'uriType' => ['alias' => 'type']
+            'uriType' => ['alias' => 'type'],
+            'id' => ['multi' => ','],
         ];
-        $waybills = app(QueryService::class)->query($request->input(),$waybills,$columnQueryRules,"waybills");
+        $waybills = app(QueryService::class)->query($param,$waybills,$columnQueryRules,"waybills");
         return $waybills;
     }
 
-    public function paginate(Request $request){
-        $waybills = $this->conditionQuery($request);
-        return $waybills->paginate($request->paginate ?? 50);
+    public function paginate(array $param){
+        $waybills = $this->conditionQuery($param);
+        return $waybills->paginate($param['paginate'] ?? 50);
     }
 
-    public function get(Request $request){
-        $waybills = $this->conditionQuery($request);
+    public function get(array $param){
+        $waybills = $this->conditionQuery($param);
         return $waybills->get();
     }
 
-    public function getSql(Request $request){
-        $waybills = $this->conditionQuery($request);
+    public function getSql(array $param){
+        $waybills = $this->conditionQuery($param);
         return $waybills->leftJoin('owners','owners.id','=','waybills.owner_id')->selectRaw('owners.name owner_name')
             ->leftJoin('units as warehouse_weight_unit','warehouse_weight_unit.id','=','waybills.warehouse_weight_unit_id')
                 ->selectRaw('warehouse_weight_unit.name warehouse_weight_unit_name')
@@ -66,16 +67,6 @@ Class WaybillService
             ->sql();
     }
 
-    public function some(Request $request){
-        return $waybills = Waybill::filterAuthorities()->with(['owner'])->selectRaw('waybills.* ,waybill_on_tops.id top_id ,waybill_on_tops.remark,waybill_on_tops.updated_at top_update')
-            ->leftJoin('waybill_on_tops','waybill_on_tops.waybill_id','=','waybills.id')
-            ->whereNull('waybill_on_tops.deleted_at')
-            ->orderBy('waybill_on_tops.updated_at','desc')
-            ->orderBy('waybills.id','desc')
-            ->whereIn('waybills.id',explode(',',$request->data))
-            ->get();
-    }
-
     public function store(Request $request){
         return DB::transaction(function ()use($request){
             $waybill=new Waybill();
@@ -132,4 +123,17 @@ Class WaybillService
         $waybill->update();
         return $waybill;
     }
+
+    public function getDeliveringSql(array $param){
+        $waybills = $this->conditionQuery($param);
+        if (!Auth::user()->isSuperAdmin()){
+            $carriersUsers=DB::table('carrier_user')->where('user_id',Auth::id())->get();
+            $carrierIds=array_column($carriersUsers->toArray(),'carrier_id');
+            $waybills=$waybills->whereIn("waybills.carrier_id",$carrierIds);
+        }
+        return $waybills->leftJoin('owners','owners.id','=','waybills.owner_id')->selectRaw('owners.name owner_name')
+            ->leftJoin('carriers','carriers.id','=','waybills.carrier_id')
+            ->selectRaw('carriers.name carrier_name')
+            ->sql();
+    }
 }

+ 36 - 0
app/Services/WeighExceptedService.php

@@ -0,0 +1,36 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Package;
+use App\Services\common\QueryService;
+
+Class WeighExceptedService
+{
+    private function conditionQuery(array $params){
+        $query = Package::query()->orderBy('packages.id','DESC')->selectRaw("packages.* ");
+        $columnQueryRules=[
+            'id' => ['multi' => ','],
+        ];
+        return app(QueryService::class)->query($params,$query,$columnQueryRules,"waybills");
+    }
+
+    public function getCreateExceptionSql(array $params){
+        return $this->conditionQuery($params)->where('packages.status',"上传异常")->orWhere('packages.status',"测量异常")
+            ->LeftJoin('logistics','packages.logistic_id','logistics.id')
+                ->selectRaw('logistics.name logistic_name')
+            ->LeftJoin('paper_boxes','packages.paper_box_id','paper_boxes.id')
+                ->selectRaw('paper_boxes.model paper_box_name')
+            ->LeftJoin('measuring_machines','packages.measuring_machine_id','measuring_machines.id')
+                ->selectRaw('measuring_machines.name measuring_machine_name')
+            ->sql();
+    }
+
+    public function getIssuedExceptionSql(array $params){
+        return $this->conditionQuery($params)->where('packages.status',"下发异常")->orWhere('packages.status',"记录异常")
+            ->orWhere('packages.status',"已上传异常")
+            ->LeftJoin('logistics','packages.logistic_id','logistics.id')
+                ->selectRaw('logistics.name logistic_name')
+            ->sql();
+    }
+}

+ 1 - 1
app/Services/common/QueryService.php

@@ -23,7 +23,7 @@ Class QueryService
         if ($tableName) $tableName .= ".";
         foreach ($params as $param => $value){
             if ($param === 'paginate' || $param === 'page')continue;
-            if (!$value || $columnQueryRules[$param] ?? false)continue;
+            if (!$value || ($columnQueryRules[$param] ?? false))continue;
             $query = $query->where($tableName.$param,$value);
         }
         //rules: alias timeLimit startDate endDate like multi

+ 6 - 1
app/Traits/ModelTimeFormat.php

@@ -4,12 +4,17 @@
 namespace App\Traits;
 
 
+use Carbon\Carbon;
 use DateTimeInterface;
 
 trait ModelTimeFormat
 {
     protected function serializeDate(DateTimeInterface $date)
     {
-        return $date->format('Y-m-d H:i:s');
+        if (version_compare(app()->version(), '7.0.0') < 0) {
+            return parent::serializeDate($date);
+        }
+
+        return $date->format(Carbon::DEFAULT_TO_STRING_FORMAT);
     }
 }

+ 12 - 6
app/Waybill.php

@@ -33,22 +33,28 @@ class Waybill extends Model
     ];
 
     public function owner(){
-        return $this->belongsTo('App\Owner','owner_id','id');
+        return $this->hasOne('App\Owner','id','owner_id');
     }
     public function carrier(){
-        return $this->belongsTo('App\Carrier','carrier_id','id');
+        return $this->hasOne('App\Carrier','id','carrier_id');
     }
 
     public function origination_city(){
-        return $this->belongsTo('App\City','origination_city_id','id');
+        return $this->hasOne('App\City','id','origination_city_id');
     }
 
     public function destination_city(){
-        return $this->belongsTo('App\City','destination_city_id','id');
+        return $this->hasOne('App\City','id','destination_city_id');
     }
     public function wmsCommodities(){
         return $this->hasMany('App\WMSWaybillOrder','OrderNo','wms_bill_number');
     }
+    public function priceModel(){
+        return $this->hasOne('App\WaybillPriceModel','id','waybill_price_model_id');
+    }
+    public function amountUnit(){
+        return $this->hasOne('App\Unit','id','amount_unit_id');
+    }
 
 
     public function warehouse_weight_unit(){
@@ -79,10 +85,10 @@ class Waybill extends Model
     }
 
     public function waybill_on_top(){
-        return $this->belongsTo('App\WaybillOnTop','waybill_id','id');
+        return $this->hasOne('App\WaybillOnTop','id','waybill_id');
     }
     public function amount_unit(){
-        return $this->belongsTo('App\Unit','amount_unit_id','id');
+        return $this->hasOne('App\Unit','id','amount_unit_id');
     }
 
     static public function setWeightByOrderCode($orderCode,$weight){

+ 32 - 0
database/migrations/2020_08_31_163910_change_labor_report_statuses_add_index_created_at.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeLaborReportStatusesAddIndexCreatedAt extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('labor_report_statuses',function (Blueprint $table){
+            $table->index('created_at','labor_report_statuses_created_at_index');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('labor_report_statuses',function (Blueprint $table){
+            $table->dropIndex('labor_report_statuses_created_at_index');
+        });
+    }
+}

+ 4 - 4
public/js/app.js

@@ -2330,7 +2330,7 @@ function fromByteArray (uint8) {
 var BlobBuilder = typeof BlobBuilder !== 'undefined' ? BlobBuilder :
   typeof WebKitBlobBuilder !== 'undefined' ? WebKitBlobBuilder :
   typeof MSBlobBuilder !== 'undefined' ? MSBlobBuilder :
-  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder :
+  typeof MozBlobBuilder !== 'undefined' ? MozBlobBuilder : 
   false;
 
 /**
@@ -61974,8 +61974,8 @@ module.exports = tempTip;
 /*! no static exports found */
 /***/ (function(module, exports, __webpack_require__) {
 
-__webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\js\app.js */"./resources/js/app.js");
-module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sass\app.scss */"./resources/sass/app.scss");
+__webpack_require__(/*! D:\Demo\bswas\resources\js\app.js */"./resources/js/app.js");
+module.exports = __webpack_require__(/*! D:\Demo\bswas\resources\sass\app.scss */"./resources/sass/app.scss");
 
 
 /***/ }),
@@ -61991,4 +61991,4 @@ module.exports = __webpack_require__(/*! D:\Reald\desktop\BsWAS\src\resources\sa
 
 /***/ })
 
-/******/ });
+/******/ });

+ 8 - 7
resources/views/inventory/statement/changeInventory.blade.php

@@ -34,10 +34,8 @@
             <td class="text-muted">@{{ oracleActTransactingLog.质量状态 }}</td>
             <td class="text-muted">@{{ oracleActTransactingLog.失效日期 }}</td>
             <td class="text-muted">@{{ oracleActTransactingLog.批号 }}</td>
-            @if(!$isTotalStock)
-            <td>@{{ oracleActTransactingLog.移出数量 }}</td>
-            <td>@{{ oracleActTransactingLog.移入数量 }}</td>
-            @endif
+            <td v-if="!isTotalStock">@{{ oracleActTransactingLog.移出数量 }}</td>
+            <td v-if="!isTotalStock">@{{ oracleActTransactingLog.移入数量 }}</td>
             <td><span v-if="oracleActTransactingLog.在库数量">@{{ oracleActTransactingLog.在库数量 }}</span><span v-else>0</span></td>
             <td><span v-if="oracleActTransactingLog.占用数量">@{{ oracleActTransactingLog.占用数量 }}</span><span v-else>0</span></td>
         </tr>
@@ -66,7 +64,7 @@
                 page:Number('{{$page}}'),
                 owners:[
                     @foreach($owners as $owner)
-                    {name:'{{$owner->descr_c}}',value:'{{$owner->descr_c}}'},
+                    {name:'{{$owner->customerid}}',value:'{{$owner->descr_c}}'},
                     @endforeach
                 ],
                 checkData:[],
@@ -74,6 +72,7 @@
                 sum:0,
                 isPage:true,
                 date:[{name:'1',value:'近一天'},{name:'3',value:'近三天'},{name:'7',value:'近一周'},{name:'30',value:'近一月'},],
+                isTotalStock : "{{ $isTotalStock }}",
             },
             mounted:function () {
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -89,7 +88,7 @@
                         {name:'TOLocation',type:'input',tip:'库位:糊模查找需要在左边打上%符号',placeholder: '库位'},
                         {name:'LotAtt05',type:'input',tip:'属性仓:糊模查找需要在左边打上%符号',placeholder: '属性仓'},
                         {name:'LotAtt02_start',type:'dateTime',tip:'选择显示失效日期的起始时间'},
-                        {name:'descr_c',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
+                        {name:'customerid',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                             placeholder:['货主','定位或多选货主'],data:this.owners},
                     ],
                     [
@@ -213,7 +212,9 @@
                     }
                 },
                 processExport(checkAllSign){
-                    let url = '{{url('inventory/statement/changeInventory/export')}}';
+                    let url = '{{url('inventory/statement/allInventory/export')}}';
+                    if (!this.isTotalStock)
+                         url = '{{url('inventory/statement/changeInventory/export')}}';
                     let token='{{ csrf_token() }}';
                     let data= JSON.stringify( this.checkData );
                     excelExport(checkAllSign,data,url,this.sum,token);

+ 8 - 5
resources/views/inventory/statement/dailyLog.blade.php

@@ -27,7 +27,7 @@
             <div id="form"></div>
         </div>
         <div class="w-100 ml-4 mt-0 mb-0">
-            <span class="dropdown d-none">
+            <span class="dropdown">
                 <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget" :class="[checkData.length>0?'btn-dark text-light':'']"
                         data-toggle="dropdown" title="导出所有页将会以搜索条件得到的过滤结果,将其全部记录(每一页)导出">
                     导出Excel
@@ -112,6 +112,7 @@
                 name : "",
                 loggingOwners : [],
                 seekOwners : [],
+                sum:{!! $inventoryDailyLogs->total() !!},
             },
             watch:{
                 checkData:{
@@ -189,9 +190,6 @@
                     } else {
                         this.checkData = [];
                     }
-                },
-                dailyLogExport(type){
-
                 },
                 openModal(){
                     let url = "{{url('inventory/statement/dailyLog/getLoggingOwner')}}";
@@ -241,7 +239,12 @@
                         tempTip.show('网络连接错误:'+err);
                         tempTip.setIndex(99);
                     });
-                }
+                },
+                dailyLogExport(checkAllSign){
+                    let url = '{{url('inventory/statement/dailyLog/export')}}';
+                    let token='{{ csrf_token() }}';
+                    excelExport(checkAllSign,this.checkData,url,this.sum,token);
+                },
             },
         });
     </script>

+ 12 - 17
resources/views/maintenance/user/index.blade.php

@@ -16,12 +16,6 @@
                 <div id="list">
                     <table class="table table-bordered table-sm d-none" id="headerRoll"></table>
                     <table class="table table-striped table-sm" id="headerParent">
-                        <tr>
-                            <th data_field="id">id</th>
-                            <th data_field="name">name</th>
-                            <th>xx</th>
-                            <th>xxz</th>
-                        </tr>
                         <tr id="header"></tr>
                         <tr v-for="user in users">
                             <td class="text-muted">@{{user.id}}</td>
@@ -80,21 +74,22 @@
                 this.form = new query({
                     el: '#form_div',
                     condition: data,
-                })
+                });
                 this.form.init();
-                // let column = [
-                //     {name:'id',value: 'ID'},
-                //     {name:'name',value: '用户名'},
-                //     {name:'role_name',value: '角色', neglect: true},
-                //     {name:'workgroup_name',value: '工作组', neglect: true},
-                //     {name:'carrier_name',value: '配置承运商', neglect: true},
-                //     {name:'email',value: '邮件地址'},
-                //     {name:'created_at',value: '创建时间'},
-                //     {name:'operation',value: '操作', neglect: true},
-                // ];
+                let column = [
+                    {name:'id',value: 'ID'},
+                    {name:'name',value: '用户名'},
+                    {name:'role_name',value: '角色', neglect: true},
+                    {name:'workgroup_name',value: '工作组', neglect: true},
+                    {name:'carrier_name',value: '配置承运商', neglect: true},
+                    {name:'email',value: '邮件地址'},
+                    {name:'created_at',value: '创建时间'},
+                    {name:'operation',value: '操作', neglect: true},
+                ];
                 let header = new Header({
                     column: column,
                     data: this.users,
+                    fixedTop: ($('#form_div').height())+2,
                     restorationColumn: 'id',
                     is_restorationColumn_asc:true,
                 });

+ 64 - 12
resources/views/order/index/delivering.blade.php

@@ -22,10 +22,12 @@
                     @can('订单管理-编辑')
                         <span class="btn btn-sm tooltipTarget ml-2" @click="freezeAll" style="cursor: pointer" title="订单的冻结条件要只局限在“创建订单”,“分配完成”,“拣货完成”,“播种完成”"
                               :class="[checkData.length>0?'btn-dark':'btn-outline-dark']">冻结</span>
+                        <button type="button" @click="thaw(checkData,true)" class="btn btn-sm btn-outline-danger tooltipTarget" title="解除已冻结订单">解冻</button>
                         <span class="btn btn-sm tooltipTarget ml-2" @click="deAllocationAll" style="cursor: pointer"  title="订单的取消分配条件要只局限在“分配完成”或“部分分配”"
                               :class="[checkData.length>0?'btn-dark':'btn-outline-dark']">取消分配</span>
+                        <button type="button" @click="resetLogisticsGetMark()" class="btn btn-sm btn-outline-secondary">重置快递获取标记</button>
                     @endcan
-                    @can('订单管理-订单问题件生成')<button type="button"  @click="orderIssueTag()" type="button" class="btn btn-sm ml-2 btn-outline-primary ">标记问题件</button>@endcan
+                    @can('订单管理-订单问题件生成')<button  @click="orderIssueTag()" type="button" class="btn btn-sm ml-2 btn-outline-primary ">标记问题件</button>@endcan
 
                 </div>
                 <div class="modal fade " style="top: 20%" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
@@ -111,7 +113,7 @@
                             @can('订单管理-编辑')
                                 <button v-if="order.releasestatus!=='H'" @click="freeze(order.orderno,order.waveno)" class="btn btn-sm btn-outline-dark text-nowrap"
                                         :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">冻结</button>
-                                <button v-else @click="thaw(order.orderno,order.waveno)" class="btn btn-sm btn-outline-danger text-nowrap"
+                                <button v-else @click="thaw(order.orderno,false,order)" class="btn btn-sm btn-outline-danger text-nowrap"
                                         :disabled="!(order.ordercodename==='创建订单'||order.ordercodename==='分配完成'||order.ordercodename==='拣货完成'||order.ordercodename==='播种完成')">解冻</button>
                             @else
                                 @{{ order.releasestatus }}
@@ -147,6 +149,7 @@
             el:"#list",
             data:{
                 page:Number('{{$page}}'),
+                paginate:Number('{{$request['paginate'] ?? 50}}'),
                 maxPage:1,
                 sum:0,
                 checkData:[],
@@ -172,7 +175,7 @@
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
                 $("#list").removeClass('d-none');
                 if (this.orders.length>0){
-                    this.maxPage=Math.ceil(this.orders[0].counted/50);
+                    this.maxPage=Math.ceil(this.orders[0].counted/this.paginate);
                     this.sum=this.orders[0].counted;
                 }
                 if (this.getQueryVariable('alternate_sku1')){
@@ -187,7 +190,7 @@
                             rules:{date_relevance:{date:['orderdate_start','orderdate_end'],relevance:'addtime',killing:'relevance',default:[31,92,183,366]}}},
                         {name:'orderno',type:'input',tip:'编号,糊模查找需要在左边打上%符号',placeholder: '编号'},
                         {name:'carriername',type:'input',tip:'',placeholder:'承运人'},
-                        {name:['notes','addtime'],type:'input_select',tip:['右侧选择查询范围,默认为一内','查询范围,范围越短搜索越快'],placeholder: ['备注',''],
+                        {name:['notes','addtime'],type:'input_select',tip:['右侧选择查询范围,默认为一内','查询范围,范围越短搜索越快'],placeholder: ['备注',''],
                             data:[{name:'31',value:'近一月'},{name:'92',value:'近三月'},{name:'183',value:'近半年'},{name:'366',value:'近一年'},{name:'0',value:'不限'},],
                             rules:[{son:{addtime:{default:'31',required_without_all_if:['orderdate_start','orderdate_end']}}},
                                 {date_relevance:{date:['orderdate_start','orderdate_end'],relevance:'addtime',killing:'relevance',default:[31,92,183,366]}}]},
@@ -205,6 +208,16 @@
                         {name:'soreference1',type:'input',tip:'客户订单号,糊模查找需要在左边打上%符号',placeholder: '客户订单号'},
                         {name:'waveno',type:'input',tip:'波次编号,模糊查找需要在左边打上%的符号',placeholder: '波次编号'},
                         {name:'alternate_sku1',type:'input',tip:'产品条码,模糊查找需要在左边打上%的符号',placeholder: '产品条码'},
+                        {name:'c_contact',type:'input',tip:'收货人名称:15天以内模糊搜索,15天以外精确搜索',placeholder:'收货人名称'},
+                    ],
+                    [
+                        {name:'c_tel2',type:'input',tip:'收货人电话:15天以内模糊搜索,15天以外精确搜索',placeholder:'收货人电话'},
+                        {name:'c_province',type:'input',tip:'省:15天以内模糊搜索,15天以外精确搜索',placeholder:'省'},
+                        {name:'c_city',type:'input',tip:'市:15天以内模糊搜索,15天以外精确搜索',placeholder:'市'},
+                        {name:'c_district',type:'input',tip:'区:15天以内模糊搜索,15天以外精确搜索',placeholder:'区'},
+                        {name:'releasestatus',type:'select',tip:'是否冻结冻结',placeholder:'是否冻结',data:[{name:'H',value:'是'},{name:'',value:'否'}]},
+                        {name:'checktime_start',type:'dateTime',tip:'选择显示复核时间的起始日期'},
+                        {name:'checktime_end',type:'dateTime',tip:'选择显示复核时间的结束日期'},
                     ],
                 ];
                 this.form = new query({
@@ -460,18 +473,24 @@
                         tempTip.show('网络异常:'+err);
                     });
                 },
-                thaw(orderno,waveno){
+                thaw(orderno, is_batch = false, order = null){
                     if(!confirm('确定要解冻“'+orderno+'”吗?'))return;
                     let _this=this;
-                    axios.post('{{url('order/thaw')}}',{orderno:orderno,waveno:waveno})
+                    axios.post('{{url('order/thaw')}}',{orderno:orderno})
                         .then(function (response) {
                             if (response.data.success){
-                                _this.orders.some(function (order) {
-                                    if (order.orderno===orderno){
-                                        order.releasestatus='N';
-                                        return true;
-                                    }
-                                });
+                                if (is_batch){
+                                    orderno.forEach(order_no =>{
+                                        _this.orders.some(function (order) {
+                                            if (order.orderno===order_no){
+                                                order.releasestatus='N';
+                                                return true;
+                                            }
+                                        });
+                                    });
+                                }else{
+                                    order.releasestatus = 'N';
+                                }
                                 tempTip.setDuration(3000);
                                 tempTip.showSuccess('订单已成功解冻!');
                             }
@@ -537,6 +556,39 @@
                         tempTip.show('网络链接异常'+err);
                     })
                 },
+                //重置快递获取标记
+                resetLogisticsGetMark(){
+                   if (this.checkData.length < 1){
+                       tempTip.setDuration(3000);
+                       tempTip.showSuccess('未选择任何单号');
+                       return
+                   }
+                   if (!confirm('确定要重置这些单的快递获取标记吗?'))return;
+                   let url = '{{url('order/resetLogisticsGetMark')}}';
+                   let _this = this;
+                   axios.post(url,{orderno : this.checkData})
+                       .then(function (response) {
+                           if (response.data.success){
+                               _this.checkData.forEach(orderno => {
+                                   _this.orders.some(order => {
+                                       if (order.orderno === orderno && order.edisendflag2 === 'W'){
+                                           order.edisendflag2 = "N";
+                                           return true;
+                                       }
+                                   });
+                               });
+                               tempTip.setDuration(2000);
+                               tempTip.showSuccess('重置快递获取标记成功!');
+                           } else{
+                               tempTip.setDuration(3000);
+                               tempTip.show(response.data.data);
+                           }
+
+                        }).catch(function (err) {
+                            tempTip.setDuration(3000);
+                            tempTip.show("网络错误:"+err)
+                        })
+                }
             },
         });
     </script>

+ 19 - 26
resources/views/process/statistic.blade.php

@@ -79,8 +79,8 @@
                                         导出Excel
                                     </button>
                                     <div class="dropdown-menu">
-                                        <a class="dropdown-item" @click="processStatisticExport(1)"  href="javascript:">导出勾选内容</a>
-                                        <a class="dropdown-item" @click="processStatisticExport(2)"  href="javascript:">导出所有页</a>
+                                        <a class="dropdown-item" @click="processStatisticExport(false)"  href="javascript:">导出勾选内容</a>
+                                        <a class="dropdown-item" @click="processStatisticExport(true)"  href="javascript:">导出所有页</a>
                                     </div>
                                 </span>
                             </td>
@@ -102,6 +102,7 @@
                         <th>单价</th>
                         <th>预期数量</th>
                         <th>完成数量</th>
+                        <th>完成时间</th>
                         <th>收入合计</th>
                         <th>完成时间(天)</th>
                         <th>总工时</th>
@@ -117,30 +118,31 @@
                     <tr v-for="(processStatistic,i) in processStatistics" :class="processStatistic.gross_profit_rate?'text-success':''">
                         <td><input class="checkItem" type="checkbox" :value="processStatistic.process_id" v-model="checkData"></td>
                         <td>@{{ i+1 }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.code }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.owner_name }}</td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.code }}</span></td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.owner_name }}</span></td>
                         <td>@{{ processStatistic.started_at }}</td>
                         <td>@{{ processStatistic.ended_at }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.unit_price }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.amount }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.completed_amount }}</td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.unit_price }}</span></td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.amount }}</span></td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.completed_amount }}</span></td>
                         <td>@{{ processStatistic.revenue }}</td>
                         <td>@{{ processStatistic.duration_days }}</td>
-                        <td>@{{ processStatistic.duration_man_hours }}</td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.process_method_name }}</td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.duration_man_hours }}</span></td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.process_method_name }}</span></td>
                         <td>@{{ processStatistic.top_capacity }}</td>
                         <td>@{{ processStatistic.bottom_capacity }}</td>
                         <td>@{{ processStatistic.average_capacity }}</td>
                         <td>@{{ processStatistic.total_cost }}</td>
                         <td>@{{ processStatistic.gross_profit }}</td>
                         <td><b v-if="processStatistic.gross_profit_rate">@{{ (processStatistic.gross_profit_rate)*100 | money}}%</b></td>
-                        <td v-if="processStatistic.process">@{{ processStatistic.process.status }}</td>
+                        <td><span v-if="processStatistic.process">@{{ processStatistic.process.status }}</span></td>
                     </tr>
                 </table>
     </div>
 @endsection
 
 @section('lastScript')
+    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
     <script>
         new Vue({
             el:"#statistics",
@@ -161,6 +163,7 @@
                     @endforeach
                 ],
                 checkData:[],
+                sum:{!! $processStatistics->total() !!},
                 filterData:{paginate:'50',started_at:'',ended_at:'',owner_id:'',code:'',status:''},
             },
             computed:{
@@ -236,22 +239,12 @@
                             }
                         });
                 },
-                //导出excel,因同步问题不使用formData
-                processStatisticExport(e){
-                    let val=e;
-                    let data=this.filterData;
-                    if (val==1){
-                        if (this.checkData&&this.checkData.length<=0){
-                            tempTip.setDuration(4000);
-                            tempTip.showSuccess('没有勾选任何记录');
-                        }else{
-                            location.href="{{url('process/statistic?checkSign=')}}"+this.checkData;
-                        }
-                    } else {
-                        location.href="{{url('process/statistic?checkSign=-1&started_at=')}}"+
-                            data.started_at+"&ended_at="+data.ended_at+"&owner_id="+
-                            data.owner_id+"&code="+data.code+"&status="+data.status;
-                    }
+                //导出excel
+                processStatisticExport(checkAllSign){
+                    let url = '{{url('process/statistic/export')}}';
+                    let token='{{ csrf_token() }}';
+                    //excelExport 定义在 js/queryForm/export200818a.js
+                    excelExport(checkAllSign,this.checkData,url,this.sum,token);
                 },
             },
             filters:{

+ 8 - 12
resources/views/waybill/delivering.blade.php

@@ -36,8 +36,8 @@
                             导出Excel
                         </button>
                         <div class="dropdown-menu">
-                            <a class="dropdown-item" @click="waybillExport(1)" href="javascript:">导出勾选内容</a>
-                            <a class="dropdown-item" @click="waybillExport(2)" href="javascript:">导出所有页</a>
+                            <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
+                            <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
                         </div>
                     </span>
                 </div>
@@ -187,6 +187,7 @@
     .color1{background-color: #FFA07A}
     .color2{background-color: cornflowerblue}
 </style>
+<script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
 <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
 <script>
     new Vue({
@@ -207,6 +208,7 @@
             },
             checkData:[],
             errors:{},
+            sum:{!! $waybills->total() !!},
         },
         watch:{
             checkData:{
@@ -290,16 +292,10 @@
                     this.checkData = [];
                 }
             },
-            waybillExport(value){
-                if (value==1&&this.checkData.length<1){
-                    tempTip.setDuration(2000);
-                    tempTip.showSuccess('没有勾选任何记录');
-                    return;
-                }
-                window.location.href="{{url('waybill/delivering?created_at_start=')}}"
-                    +this.filterData.created_at_start+"&&created_at_end="+this.filterData.created_at_end
-                    +"&&waybill_number="+this.filterData.waybill_number+"&&carrier_bill="+this.filterData.carrier_bill
-                    +"&&exportType="+value+"&&checkData="+this.checkData;
+            waybillExport(checkAllSign){
+                let url = '{{url('waybill/deliveringExport')}}';
+                let token='{{ csrf_token() }}';
+                excelExport(checkAllSign,this.checkData,url,this.sum,token);
             },
             enlarge(e){
                 e.target.style.width="150px";

+ 37 - 55
resources/views/waybill/waybillFinancialSnapshot/index.blade.php

@@ -49,8 +49,8 @@
                 导出Excel
             </button>
             <div class="dropdown-menu">
-                <a class="dropdown-item" @click="waybillExport(1)" href="javascript:">导出勾选内容</a>
-                <a class="dropdown-item" @click="waybillExport(2)" href="javascript:">导出所有页</a>
+                <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
+                <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
             </div>
         </span>
     </div>
@@ -67,49 +67,40 @@
         </thead>
         <tbody>
 
-        <tr v-for="(json_content,i) in json_contents" :style="{background:json_content.waybill.type=='直发车'?'#F8F8F8':''}">
+        <tr v-for="(json_content,i) in json_contents" :style="{background:json_content.type=='直发车'?'#F8F8F8':''}">
             @if(!isset($excepted))
             <td>
                 <input class="checkItem" type="checkbox" :value="json_content.waybill_id" v-model="checkData">
             </td>
             @endif
             <td>@{{ i+1 }}</td>
-            <td>@{{json_content.waybill.type}}</td>
-            <td>@{{json_content.waybill.waybill_number}}</td>
-            <td><p v-if="json_content.waybill.owner">@{{json_content.waybill.owner.name}}</p></td>
-            <td>@{{json_content.waybill.wms_bill_number}}</td>
-            <td>@{{json_content.waybill.origination}}</td>
-            <td>@{{json_content.waybill.destination}}</td>
-            <td>@{{json_content.waybill.recipient}}</td>
-            <td>@{{json_content.waybill.recipient_mobile}}</td>
-            <td>@{{json_content.waybill.charge}}</td>
-            <td>@{{json_content.waybill.ordering_remark}}</td>
-            <td><p v-if="json_content.waybill.carrier">@{{json_content.waybill.carrier.name}}</p></td>
-            <td>@{{json_content.waybill.carrier_bill}}</td>
-            <td><p v-if="json_content.waybill.origination_city&&json_content.waybill.origination_city.name">@{{json_content.waybill.origination_city.name}}</p> </td>
-            <td><p v-if="json_content.waybill.destination_city&&json_content.waybill.destination_city.name">@{{json_content.waybill.destination_city.name}}</p> </td>
-            <td>@{{json_content.waybill.warehouse_weight}}&nbsp;<b>@{{json_content.waybill.warehouse_weight_unit_name}}</b></td>
-            <td>@{{json_content.waybill.warehouse_weight_other}}&nbsp;<b>@{{json_content.waybill.warehouse_weight_unit_other_name}}</b></td>
-            <td>@{{json_content.waybill.carrier_weight}}&nbsp;<b>@{{json_content.waybill.carrier_weight_unit_name}}</b></td>
-            <td>@{{json_content.waybill.carrier_weight_other}}&nbsp;<b>@{{json_content.waybill.carrier_weight_unit_other_name}}</b></td>
-            <td><p v-if="json_content.waybill.car_type">@{{json_content.waybill.car_type.name}}</p></td>
-            <td>@{{json_content.waybill.car_owner_info}}</td>
-            <td>@{{json_content.waybill.fee}}</td>
-            <td>@{{json_content.waybill.pick_up_fee}}</td>
-            <td>@{{json_content.waybill.other_fee}}</td>
-            <td>@{{json_content.waybill.collect_fee}}</td>
-            <td>@{{json_content.waybill.dispatch_remark}}</td>
-            <td>@{{json_content.waybill.created_at}}</td>
-            <td>
-                <ul style="list-style: none">
-                    <li  v-for="waybillAuditLog in json_content.waybill.waybill_audit_logs" v-if=waybillAuditLog.audit_stage==="运单阶段">@{{waybillAuditLog.user.name}}</li>
-                </ul>
-            </td>
-            <td>
-                <ul  style="list-style: none">
-                    <li v-for="waybillAuditLog in json_content.waybill.waybill_audit_logs" v-if=waybillAuditLog.audit_stage==="调度阶段">@{{waybillAuditLog.user.name}}</li>
-                </ul>
-            </td>
+            <td>@{{json_content.type}}</td>
+            <td>@{{json_content.waybill_number}}</td>
+            <td>@{{json_content.owner_name}}</td>
+            <td>@{{json_content.wms_bill_number}}</td>
+            <td>@{{json_content.origination}}</td>
+            <td>@{{json_content.destination}}</td>
+            <td>@{{json_content.recipient}}</td>
+            <td>@{{json_content.recipient_mobile}}</td>
+            <td>@{{json_content.charge}}</td>
+            <td>@{{json_content.ordering_remark}}</td>
+            <td>@{{json_content.carrier_name}}</td>
+            <td>@{{json_content.carrier_bill}}</td>
+            <td>@{{json_content.origination_city_name}}</td>
+            <td>@{{json_content.destination_city_name}}</td>
+            <td>@{{json_content.warehouse_weight}}</td>
+            <td>@{{json_content.warehouse_weight_other}}</td>
+            <td>@{{json_content.carrier_weight_other}}</td>
+            <td>@{{json_content.carrier_weight_other}}</td>
+            <td>@{{json_content.car_type_name}}</td>
+            <td>@{{json_content.car_owner_info}}</td>
+            <td>@{{json_content.fee}}</td>
+            <td>@{{json_content.pick_up_fee}}</td>
+            <td>@{{json_content.other_fee}}</td>
+            <td>@{{json_content.collect_fee}}</td>
+            <td>@{{json_content.dispatch_remark}}</td>
+            <td>@{{json_content.created_at}}</td>
+            <td>@{{json_content.auditLog_user_name }}</td>
             <td>@{{json_content.total_receivable}}</td>
             <td>@{{json_content.total_expense}}</td>
             <td>@{{json_content.gross_margin}}</td>
@@ -134,6 +125,7 @@
 
 @section('lastScript')
 <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
+<script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
 <script>
     let vue = new Vue({
         el:'#editingPanel',
@@ -149,6 +141,7 @@
             filterData:{
                 created_at_start:'',created_at_end:'',type:'{{$type}}',
             },
+            sum:{!! $waybillFinancialSnapshots->total() !!},
         },
         watch:{
             checkData:{
@@ -198,8 +191,7 @@
                 {name:'collect_fee',value: '到付金额(元)', neglect: true},
                 {name:'dispatch_remark',value: '调度备注', neglect: true},
                 {name:'created_at',value: '创建时间', neglect: true},
-                {name:'user_name',value: '运单审核人', neglect: true},
-                {name:'user_name_update',value: '调度审核人', neglect: true},
+                {name:'user_name',value: '终审人员', neglect: true},
                 {name:'total_receivable',value: '应收款', neglect: true},
                 {name:'total_expense',value: '应付款', neglect: true},
                 {name:'gross_margin',value: '毛利', neglect: true},
@@ -243,20 +235,10 @@
                     this.checkData = [];
                 }
             },
-            waybillExport(e){
-                let val=e;
-                let data=this.filterData;
-                if (val==1) {
-                    if (this.checkData.length <= 0) {
-                        tempTip.setDuration(4000);
-                        tempTip.showSuccess('没有勾选任何记录');
-                    } else {
-                        location.href = "{{url('waybillFinancialSnapshot/export')}}/" + this.checkData;
-                    }
-                }else {
-                    location.href = "{{url('waybillFinancialSnapshot/export/-1?created_at_start=')}}"+
-                        data.created_at_start+"&created_at_end="+data.created_at_end;
-                }
+            waybillExport(checkAllSign){
+                let url='{{url('waybillFinancialSnapshot/export')}}';
+                let token='{{ csrf_token() }}';
+                excelExport(checkAllSign,this.checkData,url,this.sum,token);
             },
         }
     })

+ 9 - 16
resources/views/weight/package/statistics.blade.php

@@ -105,8 +105,8 @@
                                             导出Excel
                                         </button>
                                         <div class="dropdown-menu">
-                                            <a class="dropdown-item"  @click="statisticExport(1)" href="javascript:">导出勾选内容</a>
-                                            <a class="dropdown-item"  @click="statisticExport(2)" href="javascript:">导出所有页</a>
+                                            <a class="dropdown-item"  @click="statisticExport(false)" href="javascript:">导出勾选内容</a>
+                                            <a class="dropdown-item"  @click="statisticExport(true)" href="javascript:">导出所有页</a>
                                         </div>
                                     </span>
                                 </td>
@@ -142,6 +142,7 @@
 @endsection
 
 @section('lastScript')
+    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
     <script>
         new Vue({
             el:"#statistics",
@@ -444,7 +445,7 @@
                 },
                 checkAll(e){
                     if (e.target.checked){
-                        this.ownersModel.forEach((el,i)=>{
+                        this.ownersModel.forEach((el)=>{
                             if (this.checkData.indexOf(el.id) == '-1'){
                                 this.checkData.push(el.id);
                             }
@@ -453,19 +454,11 @@
                         this.checkData = [];
                     }
                 },
-                statisticExport:function (e) {
-                    if (e==1){
-                        if (this.checkData&&this.checkData.length<=0){
-                            tempTip.setDuration(4000);
-                            tempTip.showSuccess('没有勾选任何记录');
-                            return;
-                        }
-                        location.href="{{url('package/statistics?checkSign=')}}"+this.checkData;
-                    }else{
-                        location.href="{{url('package/statistics?owner_id=')}}"+this.selectedOwners+
-                            "&logistic_id="+this.selectedLogistics+"&date_start="+this.filterData.date_start
-                            +"&date_end="+this.filterData.date_end+"&checkSign=-1";
-                    }
+                statisticExport:function (checkAllSign) {
+                    let url = '{{url('package/statistics/export')}}';
+                    let token='{{ csrf_token() }}';
+                    //excelExport 定义在 js/queryForm/export200818a.js
+                    excelExport(checkAllSign,this.checkData,url,this.sum,token);
                 },
                 hourFilter:function(e){
                     datetimeRelating.verifyTime(e);

+ 8 - 14
resources/views/weight/weightExcepted/index.blade.php

@@ -32,8 +32,8 @@
                                             导出Excel
                                         </button>
                                         <div class="dropdown-menu">
-                                            <a class="dropdown-item" @click="weightExport(1)" href="javascript:">导出勾选内容</a>
-                                            <a class="dropdown-item" @click="weightExport(2)" href="javascript:">导出所有页</a>
+                                            <a class="dropdown-item" @click="weightExport(false)" href="javascript:">导出勾选内容</a>
+                                            <a class="dropdown-item" @click="weightExport(true)" href="javascript:">导出所有页</a>
                                         </div>
                                     </span>
                                     <input hidden type="submit">
@@ -87,6 +87,7 @@
 
 @section('lastScript')
     <script type="text/javascript" src="{{asset('js/queryForm/header200826b.js')}}"></script>
+    <script type="text/javascript" src="{{asset('js/queryForm/export200818a.js')}}"></script>
     <script>
         let vue = new Vue({
             el:"#list",
@@ -109,6 +110,7 @@
                 filterData:{paginate:50},
                 checkData:[],
                 color:'color: red',
+                sum:{!! $weightExcepteds->total() !!},
             },
            mounted:function(){
                this.initInputs();
@@ -194,18 +196,10 @@
                         this.checkData = [];
                     }
                 },
-                weightExport(e){
-                    let val=e;
-                    if (val==1) {
-                        if (this.checkData.length <= 0) {
-                            tempTip.setDuration(4000);
-                            tempTip.showSuccess('没有勾选任何记录');
-                        } else {
-                            location.href = "{{url('package/weightExcepted/export').'/'}}" + this.checkData;
-                        }
-                    }else {
-                        location.href="{{url('package/weightExcepted/export/-1')}}";
-                    }
+                weightExport(checkAllSign){
+                    let url = '{{url('package/weightExcepted/export/'.$view)}}';
+                    let token='{{ csrf_token() }}';
+                    excelExport(checkAllSign,this.checkData,url,this.sum,token);
                 }
             }
         });

+ 28 - 5
routes/web.php

@@ -85,6 +85,7 @@ Route::post('waybill/refreshWaveHouseWeight','WaybillController@refreshWaveHouse
 
 Route::get('waybill/index','WaybillController@index');
 Route::get('waybill/delivering','WaybillController@delivering');
+Route::any('waybill/deliveringExport','WaybillController@deliveringExport');
 Route::post('waybill/storeCarrierBill','WaybillController@storeCarrierBill');
 Route::post('waybill/is/waybillPriceModel','WaybillController@isWaybillPriceModel');
 Route::post('waybill/addCounty','WaybillController@addCounty');
@@ -97,7 +98,7 @@ Route::any('waybill/waybillUpdate/{id}','WaybillController@waybillUpdate');
 Route::resource('waybill','WaybillController');
 
 
-Route::any('waybillFinancialSnapshot/export/{id}','WaybillFinancialSnapshotsController@export');
+Route::any('waybillFinancialSnapshot/export','WaybillFinancialSnapshotsController@export');
 Route::post('waybillPriceModel/excel/import','WaybillPriceModelsController@import');
 
 
@@ -127,11 +128,15 @@ Route::post('package/measureMonitor/data','MeasureMonitorController@data');
 Route::resource('package/measureMonitor','MeasureMonitorController');
 Route::any('package/export','PackageController@export');
 Route::get('package/statistics','PackageController@statistics');
-Route::get('package/statisticExport','PackageController@statisticExport');
+Route::group(['prefix'=>'package'],function(){
+    Route::group(['prefix'=>'statistics'],function(){
+        Route::any('export','PackageController@statisticsExport');
+    });
+});
 Route::get('package/relating', function () {return view('weight.menuWeight');});
 Route::get('package/weightExcepted/indexCreate','WeighExceptedController@indexCreate');
 Route::get('package/weightExcepted/indexIssued','WeighExceptedController@indexIssued');
-Route::get('package/weightExcepted/export/{id}','WeighExceptedController@export');
+Route::any('package/weightExcepted/export/{type}','WeighExceptedController@export');
 Route::resource('package','PackageController');
 
 Route::get('store','StoreController@index');
@@ -174,11 +179,22 @@ Route::group(['prefix'=>'personnel/checking-in/userDutyCheck'],function(){
     //提交修改劳务所
     Route::post('storeUpdateUserLaborCompanies','UserDutyCheckController@storeUpdateUserLaborCompanies');
 });
+
+/**
+ *  二次加工
+ */
 Route::group(['prefix'=>'process'],function(){
     //相关设置
     Route::get('relating',function (){return view('process.menuProcess');});
-    //统计页面
-    Route::get('statistic','ProcessStatisticController@index');
+    /*
+     * 统计
+     * */
+    Route::group(['prefix'=>'statistic'],function (){
+        //首页
+        Route::get("",'ProcessStatisticController@index');
+        //导出
+        Route::any("export",'ProcessStatisticController@export');
+    });
     //获取每日参与人
     Route::post('getDailyParticipant','ProcessController@getDailyParticipant');
     //驳回
@@ -299,6 +315,7 @@ Route::group(['prefix'=>'inventory'],function (){
     Route::post('statement/changeInventory/deleteExcel','InventoryController@deleteExcel');
     //全部库存
     Route::get('statement/allInventory','InventoryController@allInventory');
+    Route::any('statement/allInventory/export','InventoryController@exportAllInventory');
 
     //库存盘点
     Route::get('stockInventory/mission','InventoryAccountController@mission');
@@ -313,8 +330,12 @@ Route::group(['prefix'=>'inventory'],function (){
     Route::any('stockInventory','InventoryController@stockInventory');
     //库存体积
     Route::get('statement/dailyLog','InventoryController@dailyLog');
+    //库存体积导出
+    Route::any('statement/dailyLog/export','InventoryController@exportDailyLog');
     //获取记录监听货主
     Route::post('statement/dailyLog/getLoggingOwner','InventoryController@getLoggingOwner');
+    //添加记录监听货主
+    Route::post('statement/dailyLog/addLoggingOwner','InventoryController@addLoggingOwner');
     //复盘查询盘点记录
     Route::post('searchStockInventoryRecord','InventoryAccountController@searchStockInventoryRecord');
 
@@ -339,6 +360,8 @@ Route::group(['prefix'=>'order'],function(){
     Route::post('deAllocation','OrderController@deAllocation');
     //批量取消分配
     Route::post('deAllocationAll','OrderController@deAllocationAll');
+    //重置快递获取标记
+    Route::post('resetLogisticsGetMark','OrderController@resetLogisticsGetMark');
 });
 
 /**