Ver Fonte

Merge branch 'master' into turnaround

haozi há 4 anos atrás
pai
commit
a4190bc93e
89 ficheiros alterados com 1782 adições e 1071 exclusões
  1. 1 1
      app/Exceptions/Handler.php
  2. 47 6
      app/Filters/OrderPackageFilters.php
  3. 1 0
      app/Http/Controllers/Auth/LoginController.php
  4. 19 4
      app/Http/Controllers/ControlPanelController.php
  5. 3 5
      app/Http/Controllers/OrderController.php
  6. 20 11
      app/Http/Controllers/OrderPackageController.php
  7. 9 2
      app/Http/Controllers/PackageLogisticController.php
  8. 1 0
      app/Http/Controllers/SettlementBillExpressFeeDetailController.php
  9. 2 1
      app/Http/Controllers/SettlementIndemnityFeeController.php
  10. 2 0
      app/Http/Controllers/StorageController.php
  11. 44 13
      app/Http/Controllers/TestController.php
  12. 43 8
      app/Http/Controllers/WaybillController.php
  13. 19 0
      app/Http/Controllers/api/thirdPart/haiq/StorageController.php
  14. 135 0
      app/Http/Requests/GateRequest.php
  15. 31 0
      app/Http/Requests/OrderDelivering.php
  16. 0 14
      app/Http/Requests/Request.php
  17. 4 0
      app/Jobs/LogisticAliJiSuSync.php
  18. 3 0
      app/Jobs/LogisticSFSync.php
  19. 4 0
      app/Jobs/LogisticYDSync.php
  20. 4 0
      app/Jobs/LogisticYTOSync.php
  21. 3 0
      app/Jobs/LogisticZopSync.php
  22. 0 52
      app/Jobs/SettlementBillCountingTask.php
  23. 1 1
      app/Jobs/SettlementBillReportTask.php
  24. 12 5
      app/Jobs/WeightUpdateInstantBill.php
  25. 29 3
      app/OrderPackage.php
  26. 33 0
      app/OrderPackageRemark.php
  27. 24 3
      app/OwnerFeeExpress.php
  28. 26 0
      app/OwnerFeeLogistic.php
  29. 13 1
      app/OwnerFeeOperation.php
  30. 7 1
      app/OwnerLogisticFeeReport.php
  31. 7 0
      app/OwnerStoreFeeReport.php
  32. 7 0
      app/OwnerStoreOutFeeReport.php
  33. 4 2
      app/Providers/AppServiceProvider.php
  34. 39 17
      app/Services/AuthorityService.php
  35. 5 5
      app/Services/DbOpenService.php
  36. 1 2
      app/Services/InventoryService.php
  37. 19 104
      app/Services/LaborReportsCountingRecordService.php
  38. 34 7
      app/Services/MenuService.php
  39. 13 0
      app/Services/OrderPackageRemarkService.php
  40. 2 1
      app/Services/OrderService.php
  41. 58 22
      app/Services/OwnerFeeTotalService.php
  42. 9 39
      app/Services/OwnerLogisticFeeDetailService.php
  43. 27 28
      app/Services/OwnerLogisticFeeReportService.php
  44. 4 2
      app/Services/OwnerProcessSettlementBillService.php
  45. 10 7
      app/Services/OwnerStoreFeeDetailService.php
  46. 23 18
      app/Services/OwnerStoreFeeReportService.php
  47. 11 7
      app/Services/OwnerStoreOutFeeDetailService.php
  48. 40 36
      app/Services/OwnerStoreOutFeeReportService.php
  49. 27 24
      app/Services/OwnerWaybillSettlementBillService.php
  50. 4 1
      app/Services/RoleService.php
  51. 5 1
      app/Services/StationTaskBatchService.php
  52. 1 0
      app/Services/UserService.php
  53. 3 2
      config/api_logistic.php
  54. 12 0
      database/factories/OrderPackageRemarkFactory.php
  55. 26 0
      database/factories/OwnerFeeExpressFactory.php
  56. 36 0
      database/factories/OwnerFeeLogisticFactory.php
  57. 32 0
      database/migrations/2021_08_16_102229_change_province_to_province_id_to_owner_logistic_fee_reports_table.php
  58. 34 0
      database/migrations/2021_08_17_112816_add_column_model_id_to_owner_store_fee_reports_table.php
  59. 34 0
      database/migrations/2021_08_17_112924_add_column_model_id_to_owner_store_out_fee_reports_table.php
  60. 50 0
      database/migrations/2021_08_18_111331_add_column_sync_routes_flag_to_order_packages_table.php
  61. 35 0
      database/migrations/2021_08_18_141408_create_order_package_remarks_table.php
  62. 16 0
      database/seeds/OrderPackageRemarkSeeder.php
  63. 21 0
      database/seeds/OwnerFeeExpressSeeder.php
  64. 21 0
      database/seeds/OwnerFeeLogisticSeeder.php
  65. 1 2
      database/seeds/SettlementBillSeeder.php
  66. 2 2
      resources/js/lodop/myPrintKit.js
  67. 29 21
      resources/js/queryForm/queryForm.js
  68. 211 128
      resources/views/control/panel.blade.php
  69. 5 5
      resources/views/finance/settlementBills/expressFee/detail/index.blade.php
  70. 1 1
      resources/views/finance/settlementBills/expressFee/report/index.blade.php
  71. 9 0
      resources/views/finance/settlementBills/indemnityFee/index.blade.php
  72. 18 18
      resources/views/finance/settlementBills/logisticFee/index.blade.php
  73. 9 0
      resources/views/finance/settlementBills/packingMaterialFee/index.blade.php
  74. 21 9
      resources/views/finance/settlementBills/storeFee/detail/index.blade.php
  75. 3 3
      resources/views/finance/settlementBills/storeFee/report/index.blade.php
  76. 21 9
      resources/views/finance/settlementBills/storeOutFee/detail/index.blade.php
  77. 1 1
      resources/views/finance/settlementBills/storeOutFee/report/index.blade.php
  78. 5 19
      resources/views/finance/settlementBills/totalFee/index.blade.php
  79. 30 0
      resources/views/order/index/delivering.blade.php
  80. 1 1
      resources/views/order/issue/index.blade.php
  81. 144 28
      resources/views/package/logistic/index.blade.php
  82. 8 0
      resources/views/station/monitor/show.blade.php
  83. 0 335
      resources/views/store/inStorage/halfChestStorage.blade.temp
  84. 26 17
      resources/views/transport/waybill/edit.blade.php
  85. 23 14
      resources/views/transport/waybill/index.blade.php
  86. 1 1
      resources/views/transport/waybill/recycle.blade.php
  87. 1 0
      routes/api/thirdPart/haiq.php
  88. 1 0
      routes/apiLocal.php
  89. 1 1
      tests/Feature/LogisticZopSyncTest.php

+ 1 - 1
app/Exceptions/Handler.php

@@ -5,7 +5,6 @@ namespace App\Exceptions;
 use App\Services\LogService;
 use Exception;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
-use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Validation\ValidationException;
 use Throwable;
@@ -90,6 +89,7 @@ class Handler extends ExceptionHandler
                 return response()->json($exception->errors(),200,[],JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
             }
             if(strpos($exception->getMessage(),'This action is unauthorized')!==false){
+                dd(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS));
                 return response()->view('exception.unauthorized');
             }
             if (method_exists($exception,'getStatusCode')) {

+ 47 - 6
app/Filters/OrderPackageFilters.php

@@ -4,7 +4,9 @@
 namespace App\Filters;
 
 use App\Order;
+use App\OrderIssue;
 use App\Services\UserService;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 use Illuminate\Support\Carbon;
 use Illuminate\Support\Str;
@@ -15,7 +17,12 @@ class OrderPackageFilters
     protected $request;
     protected $queryBuilder;
     protected $filters = ['logistic_number', 'status', 'received_at_start',
-        'received_at_end', 'is_weighed', 'logistic', 'owner', 'sent_at_start', 'sent_at_end', 'is_exception', 'exception_type', 'default_date','has_transfer_status'];
+        'default_logistics',
+        'is_issue',
+        'sync_routes_flag',
+        'received_at_end', 'is_weighed', 'logistic', 'owner', 'sent_at_start', 'sent_at_end', 'is_exception', 'exception_type', 'default_date', 'has_transfer_status'];
+
+    protected $orderIssueQuery;
 
     public function __construct(Request $request)
     {
@@ -34,26 +41,37 @@ class OrderPackageFilters
         return $this->queryBuilder;
     }
 
+    public function getOrderIssueQuery(): Builder
+    {
+        if (!$this->orderIssueQuery) {
+            $this->orderIssueQuery = OrderIssue::query()->select('order_id');
+        }
+        return $this->orderIssueQuery;
+    }
+
 
     private function logistic_number($logistic_number)
     {
         if (strpos($logistic_number, ',') || strpos($logistic_number, ',') || strpos($logistic_number, ' ')) {
             $arr = array_filter(preg_split('/[,, ]+/is', $logistic_number));
-            $this->queryBuilder->whereIn('logistic_number',$arr);
+            $this->queryBuilder->whereIn('logistic_number', $arr);
         } else {
-            $this->queryBuilder->where('logistic_number','like',$logistic_number."%");
+            $this->queryBuilder->where('logistic_number', 'like', $logistic_number . "%");
         }
     }
 
     private function exception_type($exception_type)
     {
-        $this->queryBuilder->where('exception_type', $exception_type);
+        $exception_types = array_filter(preg_split('/[,, ]+/is', $exception_type));
+
+        $this->queryBuilder->whereIn('exception_type', $exception_types);
     }
+
     private function has_transfer_status($has_transfer_status)
     {
-        if ($has_transfer_status=='是') {
+        if ($has_transfer_status == '是') {
             $this->queryBuilder->whereNotNull('transfer_status');
-        } elseif ($has_transfer_status=='否') {
+        } elseif ($has_transfer_status == '否') {
             $this->queryBuilder->whereNull('transfer_status');
         }
     }
@@ -115,4 +133,27 @@ class OrderPackageFilters
     {
         $this->queryBuilder->where('sent_at', '>=', now()->startOfDay()->subDays(15))->where('sent_at', '<', now()->startOfDay()->addDay());
     }
+
+    public function default_logistics()
+    {
+        $this->queryBuilder->whereIn('order_id', function ($query) {
+            $query->from('orders')
+                ->select('id')
+                ->whereNotIn('logistic_id', [13, 24, 25, 26, 27, 30, 31, 32, 33, 34, 60, 63, 65, 66, 68, 70, 102, 105, 107, 116,]);
+        });
+    }
+
+    public function is_issue($is_issue)
+    {
+        $this->queryBuilder->whereIn('order_id', function ($query) {
+            $query->from('orders')->select('id')->whereIn('id', function ($query) {
+                $query->from('order_issues')->select('order_id');
+            });
+        });
+    }
+
+    public function sync_routes_flag($sync_routes_flag)
+    {
+        $this->queryBuilder->where('sync_routes_flag', $sync_routes_flag === 'true');
+    }
 }

+ 1 - 0
app/Http/Controllers/Auth/LoginController.php

@@ -9,6 +9,7 @@ use Illuminate\Http\RedirectResponse;
 use Illuminate\Http\Request;
 use Illuminate\Http\Response;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Session;
 use Illuminate\Support\Facades\Validator;
 use Illuminate\Validation\ValidationException;

+ 19 - 4
app/Http/Controllers/ControlPanelController.php

@@ -15,6 +15,7 @@ use App\Services\NewOrderCountingRecordService;
 use App\Services\RealtimePendingOrdersService;
 use App\Services\UserService;
 use App\User;
+use App\UserWorkgroup;
 use Carbon\Carbon;
 use Carbon\CarbonPeriod;
 use Illuminate\Http\Request;
@@ -39,7 +40,8 @@ class ControlPanelController extends Controller
         $menus = app(CheckActiveMenuService::class)->activeMenus();
         $owners = Owner::query()->whereIn('id', $ownerIds)->get();
         $warehousesOrders = app(RealtimePendingOrdersService::class)->warehousesOrders();
-        return view('control.panel', compact('owners', 'menus', 'warehousesOrders'));
+        $userWorkgroups = UserWorkgroup::all();
+        return view('control.panel', compact('owners', 'menus', 'warehousesOrders','userWorkgroups'));
     }
 
     public function orderCountingRecordsApi(Request $request)
@@ -85,16 +87,24 @@ class ControlPanelController extends Controller
 
     public function laborReportsCountingRecordApi(Request $request)
     {
+        /** @var LaborReportsCountingRecordService  $laborReportsCountingRecordService */
         $laborReportsCountingRecordService = app(LaborReportsCountingRecordService::class);
         $start = Carbon::parse($request->start)->gt(Carbon::now()) ? Carbon::now()->toDateString() : $request->start;
         $end = Carbon::parse($request->end)->gt(Carbon::now()) ? Carbon::now()->toDateString() : $request->end;
         $unit = $request->unit;
-        $laborReportsCountingRecords = $laborReportsCountingRecordService->get($start, $end, $unit);
+        $userWorkgroupIds = $request->user_workgroup_ids;
+        $laborReportsCountingRecords = $laborReportsCountingRecordService->get([
+            'start' => $start,
+            'end' => $end,
+            'unit' => $unit,
+            'userWorkgroupIds' => $userWorkgroupIds,
+        ]);
         return compact('laborReportsCountingRecords');
     }
 
     public function laborReportsUserGroupsCountApi(Request $request)
     {
+        /** @var LaborReportsCountingRecordService $laborReportsCountingRecordService */
         $laborReportsCountingRecordService = app(LaborReportsCountingRecordService::class);
         $start = Carbon::parse($request->start)->gt(Carbon::now()) ? Carbon::now()->toDateString() : $request->start;
         $end = Carbon::parse($request->end)->gt(Carbon::now()) ? Carbon::now()->toDateString() : $request->end;
@@ -145,8 +155,13 @@ class ControlPanelController extends Controller
             foreach (CarbonPeriod::create($start,$end) as $date){
                 /** @var $date Carbon */
                 $str = $date->format("Y-m-d");
-                $data[] = $this->getTargetData($str, $owner);
-                $title[] = $str;
+                if (strtotime($str) <= strtotime(now())){
+                    $arr = $this->getTargetData($str, $owner);
+                    if ($arr) {
+                        $data[] = $arr;
+                        $title[] = $str;
+                    }
+                }
             }
             $start = date('Y-m-d', strtotime($start));
         }

+ 3 - 5
app/Http/Controllers/OrderController.php

@@ -2,7 +2,7 @@
 
 namespace App\Http\Controllers;
 
-use App\OracleBasCustomer;
+use App\Http\Requests\OrderDelivering;
 use App\OracleDOCOrderHeader;
 use App\OracleDOCWaveDetails;
 use App\OrderIssueType;
@@ -11,19 +11,17 @@ use App\Services\LogService;
 use App\Services\OrderService;
 use App\Services\RejectedBillItemService;
 use App\Services\RejectedBillService;
-use Exception;
 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 Oursdreams\Export\Export;
 use PhpParser\Node\Stmt\DeclareDeclare;
 
 class OrderController extends Controller
 {
-    public function delivering(Request $request){
-        if(!Gate::allows('订单管理-查询')){ return view('order/index');  }
+    public function delivering(OrderDelivering $request){
+        //if(!Gate::allows('订单管理-查询')){ return view('order/index');  }
         /** @var OrderService $orderService */
         $orderService = app('OrderService');
         $request = $request->input();

+ 20 - 11
app/Http/Controllers/OrderPackageController.php

@@ -9,21 +9,30 @@ class OrderPackageController extends Controller
 {
     public function update(Request $request)
     {
-        $remarkItem = $request->input('remark');
+        $remark = $request->input('remark');
         /**
          * @var $orderPackage OrderPackage
          */
         $orderPackage = OrderPackage::query()->find($request->input('orderPackageId'));
-        if (is_null($orderPackage->remark)) {
-            $orderPackage->remark = [$remarkItem];
-        } else {
-            $remark = $orderPackage->remark;
-            $remark[] = $remarkItem;
-            $remark = array_reverse($remark);
-            $orderPackage->remark = $remark;
-        }
-        $orderPackage->save();
-        return ['success' => true, 'data' => $orderPackage->refresh()->remark];
+
+        $orderPackage->orderPackageRemarks()
+            ->create([
+                'user_id' => auth()->id(),
+                'content' => $remark,
+            ]);
+        return ['success' => true, 'data' => $orderPackage->orderPackageRemarks()->with('user')->orderByDesc('created_at')->get()];
+    }
+
+    public function destroy(Request $request)
+    {
+        /**
+         * @var $orderPackage OrderPackage
+         */
+        $orderPackage = OrderPackage::query()->find($request->input('orderPackageId'));
+
+
+        $orderPackage->orderPackageRemarks()->where('id',$request->remarkId)->delete();
+        return ['success' => true, 'data' => $orderPackage->orderPackageRemarks()->with('user')->orderByDesc('created_at')->get()];
     }
 
 }

+ 9 - 2
app/Http/Controllers/PackageLogisticController.php

@@ -30,11 +30,18 @@ class PackageLogisticController extends Controller
         $paginateParams = $request->input();
         $orderPackages = OrderPackage::query()
             ->filter($filters)
-            ->whereIn('owner_id', $owner_ids)->with(['order.logistic', 'order.owner', 'order.issue' => function ($query) {
+            ->with(['order.logistic',
+                'orderPackageRemarks'=>function ($query){
+                    $query->with('user')->orderByDesc('created_at');
+                },
+                'order.owner',
+                'order.issue' => function ($query) {
                 $query->with(['issueType', 'logs' => function ($query) {
                     $query->with('user')->orderBy('created_at', 'DESC');
                 }]);
-            }])->orderByDesc('id')->paginate($request->paginate ?? 50);
+            }])
+            ->orderByDesc('id')
+            ->paginate($request->paginate ?? 50);
         $logistics = Logistic::all();
         $owners = Owner::find($owner_ids);
         return view('package.logistic.index', compact('orderPackages', 'logistics', 'owners', 'paginateParams'));

+ 1 - 0
app/Http/Controllers/SettlementBillExpressFeeDetailController.php

@@ -42,6 +42,7 @@ class SettlementBillExpressFeeDetailController extends Controller implements Set
             'counting_month' => $counting_month,
             'paginateParams' => $paginateParams,
         ]);
+//        dd($details);
         $owners = Owner::query()->selectRaw("id,name")->whereIn('id', $permittingOwnerIds)->get();
         $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
         $this->archiveService = app('OwnerBillReportArchiveService');

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

@@ -42,7 +42,8 @@ class SettlementIndemnityFeeController extends Controller implements \App\Interf
         $owner = Owner::query()->selectRaw("name,id")->find($owner_id);
         $isArchived = $this->archiveService->isArchived($counting_month, $owner_id, $this->service::TYPE);
         $request = $this->buildRequest($request, $counting_month,$owner_id);
-        return view('finance.settlementBills.indemnityFee.index', compact('details', 'paginateParams', 'owners', 'owner', 'request', 'isArchived'));
+        $totalFee = $details->sum('baoshi_indemnity_money');
+        return view('finance.settlementBills.indemnityFee.index', compact('details', 'paginateParams', 'owners', 'owner', 'request', 'isArchived','totalFee'));
     }
 
     public function export(Request $request)

+ 2 - 0
app/Http/Controllers/StorageController.php

@@ -153,6 +153,7 @@ sql;
      */
     public function resetCacheShelf()
     {
+        $this->error("缓存架临时关闭,停止使用");
         $this->gate("入库管理-入库-缓存架入库");
         $boxes = request("boxes");
         //清理任务
@@ -192,6 +193,7 @@ sql;
      */
     public function acquireBox()
     {
+        $this->error("缓存架临时关闭,停止使用");
         $this->gate("入库管理-入库-半箱补货入库");
         $param = request()->only(["track","barCode","lotNum","amount","call"]);
         $track = $param["track"] ?? null;

+ 44 - 13
app/Http/Controllers/TestController.php

@@ -9,11 +9,12 @@ use App\Components\AsyncResponse;
 use App\Components\ErrorPush;
 use App\ErrorTemp;
 use App\Feature;
+use App\Http\Requests\OrderDelivering;
 use App\Jobs\CacheShelfTaskJob;
 use App\Jobs\OrderCreateInstantBill;
 use App\Jobs\OrderCreateWaybill;
 use App\Jobs\StoreCreateInstantBill;
-use App\Logistic;
+use App\Jobs\WeightUpdateInstantBill;
 use App\MaterialBox;
 use App\MaterialBoxModel;
 use App\Order;
@@ -29,9 +30,14 @@ use App\OwnerFeeStorage;
 use App\OwnerPriceOperation;
 use App\OrderPackageCountingRecord;
 use App\RejectedBill;
+use App\Services\CacheShelfService;
 use App\Services\ForeignHaiRoboticsService;
 use App\Services\OrderService;
+use App\Services\OwnerFeeTotalService;
+use App\Services\OwnerLogisticFeeReportService;
 use App\Services\OwnerPriceOperationService;
+use App\Services\OwnerStoreFeeReportService;
+use App\Services\OwnerStoreOutFeeReportService;
 use App\Services\StationService;
 use App\Services\StorageService;
 use App\Station;
@@ -44,18 +50,19 @@ use App\Waybill;
 use Carbon\Carbon;
 use Carbon\CarbonPeriod;
 use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Foundation\Http\FormRequest;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Http;
+use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
 
 class TestController extends Controller
 {
     use AsyncResponse,ErrorPush;
     const ASNREFERENCE_2 = 'ASNREFERENCE2';
-    private $data = [];
 
     public function __construct()
     {
@@ -123,19 +130,43 @@ class TestController extends Controller
 
     public function test3()
     {
+        dispatch(new WeightUpdateInstantBill(OrderPackage::query()->find(17000457)));
+        dispatch(new WeightUpdateInstantBill(OrderPackage::query()->find(17000456)));
+    }
+    public function OwnerStoreFeeReportService_recordReport()
+    {
+        /** @var OwnerStoreFeeReportService $service */
+        $service = app('OwnerStoreFeeReportService');
+        $service->recordReport('2021-08-01');
+    }
 
-        StationTaskMaterialBox::query()->find(76266)->update(["status" => "取消"]);
-        StationTaskMaterialBox::query()->find(76241)->update(["status" => "取消"]);
-        ErrorTemp::query()->truncate();
+    public function OwnerStoreOutFeeReportService_recordReport()
+    {
+        /** @var OwnerStoreOutFeeReportService $service */
+        $service = app('OwnerStoreOutFeeReportService');
+        $service->recordReport('2021-08-01');
     }
-    public function testZC()
+
+    public function OwnerFeeTotalService_record()
     {
-//        $batch=Batch::query()
-//            ->with('orders.orderCommodities.commodity.barcodes')
-//            ->where('code','W210814000158')
-//            ->first();
-//        dd($batch);
-//        app(ForeignZhenCangService::class)->broadcastBatch($batch);
-//        dd('上传成功');
+        /** @var OwnerFeeTotalService $service */
+        $service = app('OwnerFeeTotalService');
+        $service->record('2021-08-01');
     }
+
+//快递
+    public function OwnerLogisticFeeReportService_record()
+    {
+        ini_set('max_execution_time',-1);
+
+        /** @var OwnerLogisticFeeReportService $service */
+        $service = app('OwnerLogisticFeeReportService');
+        $service->recordReport('2021-08-01');
+    }
+
+    public function order_packages_sync_routes_flag_init()
+    {
+        OrderPackage::query()->whereNotNull('transfer_status')->update(['sync_routes_flag'=>true]);
+    }
+
 }

+ 43 - 8
app/Http/Controllers/WaybillController.php

@@ -660,21 +660,37 @@ class WaybillController extends Controller
     }
 
     public function export(){
+        ini_set('max_execution_time',2500);
+        ini_set('memory_limit','1526M');
+        $append = \request("append")=='true';
+        request()->offsetUnset("append");
         $this->gate('运输管理-运单-查询');
+        /** @var Collection $waybills */
         if (request("checkAllSign")){
             request()->offsetUnset("checkAllSign");
             $waybills = app('waybillService')->get(request()->input());
         }else $waybills = app('waybillService')->get(["id"=>request("data")]);
-        /** @var Collection $waybills */
+        if ($waybills->count()==0)return "无数据";
         $row = [
             "运单类型", "货主", "上游单号", "wms订单号", "运单号", "运输收费",
             "其他收费", "其他收费备注", "始发地", "目的地","下单备注", "承运商", "承运商单号",
             "仓库计抛", "承运商计抛", "仓库计重", "承运商计重", "车型", "车辆信息",
             "计件", "里程数", "运费(元)", "提货费(元)", "其他费用(元)", "发货时间",
-            "调度备注", "创建时间"
+            "调度备注", "创建时间", "省", "市", "区", "FLUX地址", "FLUX重量", "FLUX数量"
         ];
         $list = [];
-        $waybills->each(function ($waybill)use(&$list){
+        $codes = [];
+        $code = '';
+        $map = [];
+        $waybills->each(function ($waybill,$index)use(&$list,&$codes,&$code,&$map){
+            foreach (explode(",",$waybill->wms_bill_number) as $bill){
+                $code .= "'".$bill."',";
+                $map[$bill] = $index;
+            }
+            if ($index%800==0){
+                $codes[] = rtrim($code,",");
+                $code = '';
+            }
             $list[] = [
                 $waybill->type,
                 $waybill->owner->name ?? ($waybill->order->owner->name ?? ""),
@@ -702,10 +718,29 @@ class WaybillController extends Controller
                 $waybill->other_fee,
                 $waybill->deliver_at,
                 $waybill->dispatch_remark,
-                $waybill->created_at,
+                $waybill->created_at->toDateTimeString(),
+                "", "", "","",0,0
             ];
         });
-        return Export::make($row,$list,"运输记录单");
+        if ($code)$codes[] = rtrim($code,",");
+        if ($codes && $append){
+            foreach ($codes as $code){
+                $sql = <<<SQL
+SELECT H.ORDERNO,SUM(S.GROSSWEIGHT) WEIGHT,SUM(S.QTY) AMOUNT,H.C_ADDRESS1,H.C_DISTRICT,H.C_PROVINCE,H.C_CITY FROM DOC_ORDER_PACKING_SUMMARY S
+LEFT JOIN DOC_ORDER_HEADER H ON S.ORDERNO = H.ORDERNO
+WHERE H.ORDERNO IN ({$code}) GROUP BY H.ORDERNO,H.C_ADDRESS1,H.C_DISTRICT,H.C_PROVINCE,H.C_CITY
+SQL;
+                foreach (DB::connection("oracle")->select(DB::raw($sql)) as $summary){
+                    $list[$map[$summary->orderno]][27] = $summary->c_province;
+                    $list[$map[$summary->orderno]][28] = $summary->c_city;
+                    $list[$map[$summary->orderno]][29] = $summary->c_district;
+                    $list[$map[$summary->orderno]][30] = $summary->c_address1;
+                    $list[$map[$summary->orderno]][31] += $summary->weight;
+                    $list[$map[$summary->orderno]][32] += $summary->amount;
+                }
+            }
+        }
+        return Export::make($row,$list,"运输记录单-".date("YmdH"));
     }
 
     public function deliveringExport(Request $request){
@@ -774,7 +809,7 @@ class WaybillController extends Controller
 
     protected function validatorWaybill(Request $request,$id){
         if ($id){$wms_bill_number=$id;};
-        $validator=Validator::make($request->input(),[
+        return Validator::make($request->input(),[
             'owner_id'=>'required_without:order_id',
             'wms_bill_number'=>['nullable','max:50',isset($wms_bill_number)?"unique:waybills,wms_bill_number,$wms_bill_number":'unique:waybills,wms_bill_number'],
             'origination'=>'required|max:255',
@@ -803,13 +838,13 @@ class WaybillController extends Controller
             'charge'=>'收费',
             'collect_fee'=>'到付金额',
         ]);
-        return $validator;
     }
     protected function validatorWaybillDispatch(Request $request,$id){
         $rule=[
             'logistic_id'=>'required_without:order_id|integer',
             'carrier_bill'=>"sometimes|required|max:50|unique:waybills,carrier_bill,$id",
             'fee'=>'sometimes|nullable|min:0|numeric|max:999999',
+            'carType_id'=>'sometimes|required|integer',
             'other_fee'=>'sometimes|nullable|min:0|numeric|max:999999',
             'charge'=>'sometimes|nullable|min:0|numeric|max:999999',
             'mileage'=>'nullable|numeric|min:0',
@@ -1107,13 +1142,13 @@ class WaybillController extends Controller
                 $waybill->merge_owner = null;
                 $waybill->source_bill = implode(",",$bills);
                 $waybill->wms_bill_number = implode(",",$codes);
+                $waybill->ordering_remark = implode(",",$remark);
                 $waybill->update();
                 WaybillAuditLog::query()->create([
                     'waybill_id'=>$waybill->id,
                     'audit_stage'=>'拆单返回',
                     'user_id'=>Auth::id(),
                 ]);
-
             }
             DB::commit();
         }catch (\Exception $e){

+ 19 - 0
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -4,6 +4,7 @@
 namespace App\Http\Controllers\api\thirdPart\haiq;
 
 
+use App\Components\AsyncResponse;
 use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
 use App\MaterialBox;
 use App\Services\ForeignHaiRoboticsService;
@@ -14,6 +15,7 @@ use Ramsey\Uuid\Uuid;
 
 class StorageController
 {
+    use AsyncResponse;
     protected $post;
 
     /** @var ForeignHaiRoboticsService $service */
@@ -345,4 +347,21 @@ class StorageController
         $result['result']=$responseBody;
         return $result;
     }
+
+    /**
+     * 填充空箱
+     */
+    public function paddingEmptyBox()
+    {
+        $amount = \request("amount") ?: 1;
+        $blacklist = [];
+        $boxes = "";
+        for ($i=0;$i<$amount;$i++){
+            $box = app("MaterialBoxService")->getAnEmptyBoxSortedByOwner(null,$blacklist);
+            if (!$box)break;
+            $boxes .= $box->code.",";
+            $blacklist[] = $box->id;
+        }
+        $this->success(rtrim($boxes,","));
+    }
 }

+ 135 - 0
app/Http/Requests/GateRequest.php

@@ -0,0 +1,135 @@
+<?php
+
+namespace App\Http\Requests;
+
+use App\Services\MenuService;
+use Illuminate\Foundation\Http\FormRequest;
+
+class GateRequest extends FormRequest
+{
+    /**
+     * @var string
+     */
+    protected $currentRoute;
+
+    /**
+     * @var array
+     */
+    protected $tracks;
+
+    /**
+     * 通用鉴权
+     *
+     * @return bool
+     */
+    public function authorize():bool
+    {
+        if (!$this->ajax() && !$this->authorizeGate())$this->sameOriginMatching();
+        return true;
+    }
+
+    public function rules():array
+    {
+        return [];
+    }
+
+    /**
+     * 授权门鉴定
+     *
+     * @return bool
+     */
+    public function authorizeGate():bool
+    {
+        $this->currentRoute = ltrim($this->getPathInfo(),"/");
+        /** @var MenuService $service */
+        $service = app("MenuService");
+        if (!$this->matchingRoute($service->getVisibleMenuListAll()))return false;//全量匹配失败直接授权失败 此时正确做法应该是404
+        $correctStack = $this->tracks; //全量匹配下的 正确栈节点
+        $this->tracks = [];//栈节点制空 存储目标节点
+        if (!$this->matchingRoute($service->getVisibleFunctionList()))return false;//部分匹配下的授权失败
+        return count($correctStack)==count($this->tracks); //正确栈与目标栈 对比
+    }
+
+    /**
+     * 递归匹配路由
+     *
+     * 每次递归 各自记录自己的栈路径
+     * 每次匹配成功都将当前栈路径替换全局栈路径
+     * 替换后如果存在节点继续匹配 直至节点为空得出最终的栈终点
+     */
+    private function matchingRoute(array $routes,array $tagStack = [],bool $successMark = false):bool
+    {
+        foreach ($routes as $route){
+            $currentStack = $tagStack;$currentStack[] = $route["name"];
+            $match = $this->matching($route["route"] ?? "");
+            if ($match){$this->tracks = $currentStack;$successMark = true;}
+            if ($route["child"] ?? false){
+                if ($this->matchingRoute($route["child"],$currentStack,$successMark))return true;
+            }
+        }
+        return $successMark;
+    }
+
+    private function matching($tag):bool
+    {
+        if (!$tag)return false;
+        $tag = explode("?",$tag)[0];//去除参数
+        if ($this->currentRoute == $tag)return true; //相等
+        if (strpos($tag,"*")===false)return false;//无泛匹配符
+        $cr = explode("/",$this->currentRoute);
+        $tr = explode("/",$tag);
+        $crLen = count($cr);
+        $trLen = count($tr);
+        if ($crLen<$trLen)return false;
+        if ($crLen>$trLen && $tr[$trLen-1]=='*'){
+            $cr = array_slice($cr,0,$trLen);
+            $crLen = $trLen;
+        }
+        if ($crLen!=$trLen)return false;
+        foreach ($tr as $index=>$item){
+            if ($item=='*')$tr[$index] = $cr[$index];
+        }
+        return implode("/",$cr) == implode("/",$tr);
+    }
+
+    /**
+     * 递归一个同源节点 返回可用URL 深度取决于$this->tracks的长度
+     *
+     * @param array $routes
+     * @param int $depth
+     *
+     * @return string|null
+     */
+    private function searchOrigin(array $routes,int $depth = 0):?string
+    {
+        $url = null;//预设返回URL
+        foreach ($routes as $route){
+            //如果目标栈长度大于当前深度 且 当前节点与目标节点name相同 且 当前节点有子节点存在,递归进入子节点,深度加1
+            if (count($this->tracks)>$depth &&
+                $this->tracks[$depth]==$route["name"] &&
+                ($route["child"] ?? false))
+            {
+                $currentChildUrl = $this->searchOrigin($route["child"],$depth+1);
+                if ($currentChildUrl)return $currentChildUrl;
+            }
+            if (!$url && ($route["route"] ?? ""))$url = $route["route"]; //取最近的同源的URL
+        }
+        return $url;
+    }
+
+    /**
+     * 同源匹配 此时已经拿到同源节点 $this->tracks 需要在此节点上寻找一个允许的权限
+     */
+    public function sameOriginMatching()
+    {
+        //目标节点存在
+        if ($this->tracks){
+            $url = $this->searchOrigin(app("MenuService")->getVisibleFunctionList());
+            header('Location: /'.$url);
+            die();
+        }
+        //目标节点为空的话说明一级节点都无权访问
+        // 此时返回一级同源节点就无意义 会产生误导性,所以前往无权页面
+        //正常情况下这个预设不会被正常用户触发
+    }
+}

+ 31 - 0
app/Http/Requests/OrderDelivering.php

@@ -0,0 +1,31 @@
+<?php
+
+namespace App\Http\Requests;
+
+class OrderDelivering extends GateRequest
+{
+    public function __construct()
+    {
+        $this->paramHandle();
+        parent::__construct();
+    }
+
+    public function paramHandle()
+    {
+        $exist = request("orderdate_start") || request("orderdate_end");
+        if ($exist && !request("restrict_time"))return;
+        if ($exist && request("restrict_time")){
+            request()->offsetUnset("orderdate_start");
+            request()->offsetUnset("orderdate_end");
+        }
+        $isParam = request("c_contact") || request("c_tel2") || request("c_province") || request("c_city") || request("c_district");
+        if (!request("restrict_time") && $isParam)request()->offsetSet("restrict_time",30);
+
+        if (request("restrict_time")){
+            request()->offsetSet("orderdate_end",date("Y-m-d H:i"));
+            $increment = request()->offsetGet("restrict_time");
+            $date = date('Y-m-d',strtotime("-{$increment} day"));
+            request()->offsetSet("orderdate_start",$date." 00:00");
+        }
+    }
+}

+ 0 - 14
app/Http/Requests/Request.php

@@ -1,14 +0,0 @@
-<?php
-
-namespace App\Http\Requests;
-
-use Illuminate\Foundation\Http\FormRequest;
-
-class Request extends FormRequest
-{
-    public function authorize()
-    {
-    	// Using policy for Authorization
-        return true;
-    }
-}

+ 4 - 0
app/Jobs/LogisticAliJiSuSync.php

@@ -2,6 +2,7 @@
 
 namespace App\Jobs;
 
+use App\OrderPackage;
 use App\Services\LogisticAliJiSuApiService;
 use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
@@ -46,6 +47,9 @@ class LogisticAliJiSuSync implements ShouldQueue
     public function handle()
     {
         LogService::log(LogisticAliJiSuSync::class, "{$this->logistic_number}-JOB-AliJiSu", '');
+        //标记上有同步的操作
+        OrderPackage::query()->where('logistic_number', $this->logistic_number)->update(['sync_routes_flag'=> true]);
+
         $this->logisticAliJiSuApiService = app('LogisticAliJiSuApiService');
         $response = $this->logisticAliJiSuApiService->query($this->logistic_number);
         $format = $this->logisticAliJiSuApiService->format($response,$this->logistic_number);

+ 3 - 0
app/Jobs/LogisticSFSync.php

@@ -2,6 +2,7 @@
 
 namespace App\Jobs;
 
+use App\OrderPackage;
 use App\Services\LogisticSFService;
 use App\Services\LogService;
 use Illuminate\Bus\Queueable;
@@ -45,6 +46,8 @@ class LogisticSFSync implements ShouldQueue
     public function handle()
     {
         LogService::log(LogisticSFSync::class, "JOB-SF", $this->logistic_number);
+        //标记上有同步的操作
+        OrderPackage::query()->where('logistic_number', $this->logistic_number)->update(['sync_routes_flag'=> true]);
         $this->logisticSFService = app('LogisticSFService');
         $formedData = $this->logisticSFService->get([$this->logistic_number]);
         $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');

+ 4 - 0
app/Jobs/LogisticYDSync.php

@@ -2,6 +2,7 @@
 
 namespace App\Jobs;
 
+use App\OrderPackage;
 use App\Services\LogisticYDService;
 use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
@@ -44,6 +45,9 @@ class LogisticYDSync implements ShouldQueue
     public function handle()
     {
         LogService::log(LogisticYDSync::class, "JOB-YD", $this->logistic_number);
+        //标记上有同步的操作
+        OrderPackage::query()->where('logistic_number', $this->logistic_number)->update(['sync_routes_flag'=> true]);
+
         $this->logisticYDService = app('LogisticYDService');
         //先订阅订单
         $this->logisticYDService->registerApi([$this->logistic_number]);

+ 4 - 0
app/Jobs/LogisticYTOSync.php

@@ -2,6 +2,7 @@
 
 namespace App\Jobs;
 
+use App\OrderPackage;
 use App\Services\LogisticYTOService;
 use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
@@ -46,6 +47,9 @@ class LogisticYTOSync implements ShouldQueue
     public function handle()
     {
         LogService::log(LogisticYTOSync::class, "JOB-YTO", $this->logistic_number);
+        //标记上有同步的操作
+        OrderPackage::query()->where('logistic_number', $this->logistic_number)->update(['sync_routes_flag'=> true]);
+
         $this->logisticYTOService = app('LogisticYTOService');
         $this->orderPackageReceivedSyncService = app('OrderPackageReceivedSyncService');
         $nativeResponse = $this->logisticYTOService->query($this->logistic_number);

+ 3 - 0
app/Jobs/LogisticZopSync.php

@@ -3,6 +3,7 @@
 namespace App\Jobs;
 
 
+use App\OrderPackage;
 use App\Services\LogisticZopService;
 use App\Services\LogService;
 use App\Services\OrderPackageReceivedSyncService;
@@ -50,6 +51,8 @@ class LogisticZopSync implements ShouldQueue
     public function handle()
     {
         LogService::log(LogisticZopSync::class, "JOB-ZOP", $this->logistic_number);
+        //标记上有同步的操作
+        OrderPackage::query()->where('logistic_number', $this->logistic_number)->update(['sync_routes_flag'=> true]);
         $nativeResponse = $this->logistic_zop_service->query($this->logistic_number);
         $logisticResponseFormatted = $this->logistic_zop_service->format($nativeResponse,$this->logistic_number);
         $this->order_package_received_sync_service->update([$logisticResponseFormatted]);

+ 0 - 52
app/Jobs/SettlementBillCountingTask.php

@@ -1,52 +0,0 @@
-<?php
-
-namespace App\Jobs;
-
-use Illuminate\Bus\Queueable;
-use Illuminate\Contracts\Queue\ShouldQueue;
-use Illuminate\Foundation\Bus\Dispatchable;
-use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Queue\SerializesModels;
-
-/**
- * 生成结算账单统计数据
- * 每月初始执行
- * 统计上月的账单数据
- * Class SettlementBillCountingTask
- * @package App\Jobs
- */
-class SettlementBillCountingTask implements ShouldQueue
-{
-    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
-
-    //货主
-    private $owner_id;
-    //统计月份
-    private $counting_month;
-
-    /**
-     * SettlementBillCountingTask constructor.
-     * @param $owner_id
-     * @param $counting_month
-     */
-    public function __construct($owner_id, $counting_month)
-    {
-        $this->owner_id = $owner_id;
-        $this->counting_month = $counting_month;
-    }
-
-
-    /**
-     * Execute the job.
-     *
-     * @return void
-     */
-    public function handle()
-    {
-        if (is_null($this->owner_id)&&is_null($this->counting_month)) {//未指定统计的参数
-        } else {
-            //清除历史统计记录
-
-        }
-    }
-}

+ 1 - 1
app/Jobs/SettlementBillReportTask.php

@@ -21,7 +21,7 @@ class SettlementBillReportTask implements ShouldQueue
 {
     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
 
-    public $timeout = 120;
+    public $timeout = 3600;
 
     public $maxExceptions = 3;
 

+ 12 - 5
app/Jobs/WeightUpdateInstantBill.php

@@ -2,28 +2,28 @@
 
 namespace App\Jobs;
 
+use App\Components\ErrorPush;
 use App\OrderPackage;
 use App\Services\OrderService;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Foundation\Bus\Dispatchable;
 use Illuminate\Queue\InteractsWithQueue;
-use Illuminate\Queue\SerializesModels;
 
 class WeightUpdateInstantBill implements ShouldQueue
 {
-    use SerializesModels;
+    use Dispatchable, InteractsWithQueue, Queueable, ErrorPush;
 
     /** @var \stdClass  */
     protected $package;
     /**
      * Create a new job instance.
      *
-     * @param OrderPackage $package
+     * @param OrderPackage|null $package
      *
      * @return void
      */
-    public function __construct(OrderPackage $package)
+    public function __construct(?OrderPackage $package)
     {
         $this->package = $package;
     }
@@ -34,12 +34,19 @@ class WeightUpdateInstantBill implements ShouldQueue
      * @param OrderService $service
      *
      * @return void
+     * @throws
      */
     public function handle(OrderService $service)
     {
+        if (!$this->package)return;
         if (!$this->package->weight)return;
         $this->package->loadMissing("order");
         if (!$this->package->order)return;
-        $service->reviseLogisticFee($this->package->order);
+        try {
+            $service->reviseLogisticFee($this->package->order);
+        }catch (\Exception $e){
+            $this->push(__METHOD__."->".__LINE__,"称重重置订单计费",$e->getMessage()." | ".$this->package->toJson());
+            throw $e;
+        }
     }
 }

+ 29 - 3
app/OrderPackage.php

@@ -24,8 +24,29 @@ class OrderPackage extends Model
 
     use ModelTimeFormat;
 
-    protected $fillable = ['order_id','logistic_number','batch_number',
-        'batch_rule','bulk','weight','length','width','height','paper_box_id','measuring_machine_id','weighed_at','status','sent_at','received_at','exception','transfer_status','remark','owner_id','uploaded_to_wms','exception_type'];
+    protected $fillable = [
+        'order_id',
+        'logistic_number',
+        'batch_number',
+        'batch_rule',
+        'bulk',
+        'weight',
+        'length',
+        'width',
+        'height',
+        'paper_box_id',
+        'measuring_machine_id',
+        'weighed_at',
+        'status',
+        'sent_at',
+        'received_at',
+        'exception',
+        'transfer_status',
+        'owner_id',
+        'uploaded_to_wms',
+        'exception_type',
+        'sync_routes_flag',
+    ];
 
     public function order(){
         return $this->belongsTo('App\Order','order_id','id');
@@ -33,7 +54,7 @@ class OrderPackage extends Model
 
     protected $casts = [
         'transfer_status' => 'array',
-        'remark' => 'array',
+        'sync_routes_flag' => 'boolean',
     ];
 
     public function commodities(): HasMany
@@ -294,4 +315,9 @@ class OrderPackage extends Model
     {
         return $this->belongsTo(Owner::class);
     }
+
+    public function orderPackageRemarks(): HasMany
+    {
+        return $this->hasMany(OrderPackageRemark::class);
+    }
 }

+ 33 - 0
app/OrderPackageRemark.php

@@ -0,0 +1,33 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\SoftDeletes;
+
+class OrderPackageRemark extends Model
+{
+    use ModelLogChanging;
+    use SoftDeletes;
+    use ModelTimeFormat;
+
+    public $fillable = [
+        'order_package_id',
+        'user_id',
+        'content',
+    ];
+
+    public function orderPackage(): BelongsTo
+    {
+        return $this->belongsTo(OrderPackage::class);
+    }
+
+    public function user(): BelongsTo
+    {
+        return $this->belongsTo(User::class);
+    }
+}

+ 24 - 3
app/OwnerFeeExpress.php

@@ -5,6 +5,7 @@ namespace App;
 use Illuminate\Database\Eloquent\Model;
 
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 class OwnerFeeExpress extends Model
 {
@@ -12,8 +13,28 @@ class OwnerFeeExpress extends Model
 
     public $timestamps = false;
     protected $fillable = [
-        "province_id", "logistic_id", "logistic_number",
-        "weight", "initial_weight","initial_weight_price","additional_weight","additional_weight_amount", "additional_weight_price",
-        "total_fee","tax_rate", "created_at","owner_id"
+        "province_id",
+        "logistic_id",
+        "logistic_number",
+        "weight",
+        "initial_weight",
+        "initial_weight_price",
+        "additional_weight",
+        "additional_weight_amount",
+        "additional_weight_price",
+        "total_fee",
+        "tax_rate",
+        "created_at",
+        "owner_id"
     ];
+
+    public function province(): BelongsTo
+    {
+        return $this->belongsTo(Province::class);
+    }
+
+    public function logistic(): BelongsTo
+    {
+        return $this->belongsTo(Logistic::class);
+    }
 }

+ 26 - 0
app/OwnerFeeLogistic.php

@@ -5,6 +5,7 @@ namespace App;
 use Illuminate\Database\Eloquent\Model;
 
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 class OwnerFeeLogistic extends Model
 {
@@ -35,4 +36,29 @@ class OwnerFeeLogistic extends Model
         "remark",
         "created_at",
     ];
+
+    public function province(): BelongsTo
+    {
+        return $this->belongsTo(Province::class);
+    }
+
+    public function city(): BelongsTo
+    {
+        return $this->belongsTo(City::class);
+    }
+
+    public function owner(): BelongsTo
+    {
+        return $this->belongsTo(Owner::class);
+    }
+
+    public function logistic(): BelongsTo
+    {
+        return $this->belongsTo(Logistic::class);
+    }
+
+    public function unit(): BelongsTo
+    {
+        return $this->belongsTo(Unit::class);
+    }
 }

+ 13 - 1
app/OwnerFeeOperation.php

@@ -5,6 +5,8 @@ namespace App;
 use Illuminate\Database\Eloquent\Model;
 
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
+use Illuminate\Database\Eloquent\Relations\HasMany;
 
 class OwnerFeeOperation extends Model
 {
@@ -23,8 +25,18 @@ class OwnerFeeOperation extends Model
         "owner_id",
     ];
 
-    public function details()
+    public function details(): HasMany
     {
         return $this->hasMany(OwnerFeeOperationDetail::class);
     }
+
+    public function model(): BelongsTo
+    {
+        return $this->belongsTo(OwnerPriceOperation::class, 'model_id', 'id');
+    }
+
+    public function commodity(): BelongsTo
+    {
+        return $this->belongsTo(Commodity::class);
+    }
 }

+ 7 - 1
app/OwnerLogisticFeeReport.php

@@ -14,7 +14,7 @@ class OwnerLogisticFeeReport extends Model
     public $fillable = [
         'owner_logistic_sum_fee_report_id',//
         'logistic_id',//承运商
-        'province', //省份
+        'province_id', //省份
         'counted_date',//统计月份
         'initial_weight',//首重
         'initial_weight_price',//首重价格
@@ -32,4 +32,10 @@ class OwnerLogisticFeeReport extends Model
     {
         return $this->belongsTo(Logistic::class);
     }
+
+    public function province(): BelongsTo
+    {
+        return $this->belongsTo(Province::class);
+    }
 }
+

+ 7 - 0
app/OwnerStoreFeeReport.php

@@ -20,6 +20,8 @@ class OwnerStoreFeeReport extends Model
         'amount', //数量
         'fee',//费用
         'work_name',//作业名称
+        'model_id',//计费模型
+        'tax_fee',//税费
     ];
 
     public $timestamps = false;
@@ -43,4 +45,9 @@ class OwnerStoreFeeReport extends Model
     {
         return $this->unit_price . '/' . $this->unit->name;
     }
+
+    public function model(): BelongsTo
+    {
+        return $this->belongsTo(OwnerPriceOperation::class, 'model_id', 'id');
+    }
 }

+ 7 - 0
app/OwnerStoreOutFeeReport.php

@@ -21,6 +21,8 @@ class OwnerStoreOutFeeReport extends Model
         'owner_id',
         'work_name',//作业名称
         'fee',//费用
+        'model_id',//计费模型
+        'tax_fee',//税费
     ];
 
     public $timestamps = false;
@@ -39,4 +41,9 @@ class OwnerStoreOutFeeReport extends Model
     {
         return $this->belongsTo(Owner::class);
     }
+
+    public function model(): BelongsTo
+    {
+        return $this->belongsTo(OwnerPriceOperation::class, 'model_id', 'id');
+    }
 }

+ 4 - 2
app/Providers/AppServiceProvider.php

@@ -167,6 +167,7 @@ use App\Services\RequirementService;
 use App\Services\RequirementUserService;
 use App\Services\WorkOrderService;
 use App\Services\WorkOrderTypeService;
+use App\Services\OrderPackageRemarkService;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -239,9 +240,9 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('BatchService',BatchService::class);
         app()->singleton('BatchUpdateService', BatchUpdateService::class);
         app()->singleton('CacheService',CacheService::class);
-        app()->singleton('CityService',CityService::class);
         app()->singleton('CacheShelfService',CacheShelfService::class);
         app()->singleton('CheckActiveMenuService',CheckActiveMenuService::class);
+        app()->singleton('CityService',CityService::class);
         app()->singleton('CommodityBarcodeService',CommodityBarcodeService::class);
         app()->singleton('CommodityMaterialBoxModelService',CommodityMaterialBoxModelService::class);
         app()->singleton('CommodityService', CommodityService::class);
@@ -304,6 +305,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('OrderPackageExceptionTypeCountingRecordService', OrderPackageExceptionTypeCountingRecordService::class);
         app()->singleton('OrderPackageReceivedSyncRecordService', OrderPackageReceivedSyncRecordService::class);
         app()->singleton('OrderPackageReceivedSyncService', OrderPackageReceivedSyncService::class);
+        app()->singleton('OrderPackageRemarkService',OrderPackageRemarkService::class);
         app()->singleton('OrderPackageService', OrderPackageService::class);
         app()->singleton('OrderService', OrderService::class);
         app()->singleton('OrderTrackingService', OrderTrackingService::class);
@@ -381,8 +383,8 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('UserWorkgroupService', UserWorkgroupService::class);
         app()->singleton('WarehouseService', WarehouseService::class);
         app()->singleton('WaybillFinancialService', WaybillFinancialService::class);
-        app()->singleton('WeighExceptedService', WeighExceptedService::class);
         app()->singleton('WaybillService', WaybillService::class);
+        app()->singleton('WeighExceptedService', WeighExceptedService::class);
         app()->singleton('WorkOrderService',WorkOrderService::class);
         app()->singleton('WorkOrderTypeService',WorkOrderTypeService::class);
     }

+ 39 - 17
app/Services/AuthorityService.php

@@ -18,32 +18,55 @@ class AuthorityService
     use ServiceAppAop;
     protected $modelClass=Authority::class;
 
+    /**
+     * 携带缓存的权限数据
+     *
+     * @return array|Collection|mixed
+     */
     public function getUserAuthority()
     {
         if (!Auth::user())return new Collection();
         $key = "authorities:user_".Auth::id();
-        $isAdmin = array_search(Auth::user()["name"],config("users.superAdmin"))!==false;
+        $isAdmin = $this->checkAdminIdentity();
         $tag = $isAdmin ? "authorities:admin" : "authorities:user";
-        if (!Cache::tags($tag)->has($key)){
-            if ($isAdmin) Cache::tags("authorities:admin")->forever($key,Authority::query()->get());
-            else Cache::tags("authorities:user")->forever($key,Authority::query()->whereHas("roles",function (Builder $query){
-                $query->whereHas("users",function (Builder $query){
-                    $query->where(DB::raw("users.id"),Auth::id());
-                });
-            })->get());
-        }
+        if (!Cache::tags($tag)->has($key))Cache::tags($tag)->forever($key,$this->getUserAuthorityData($isAdmin));
         return Cache::tags($tag)->get($key);
     }
 
+    private function checkAdminIdentity():bool
+    {
+        if (!Auth::user())return false;
+        return array_search(Auth::user()["name"],config("users.superAdmin"))!==false;
+    }
+    /**
+     * 即时的权限数据
+     *
+     * @param bool $isAdmin
+     *
+     * @return Collection
+     */
+    public function getUserAuthorityData(bool $isAdmin = null):Collection
+    {
+        if ($isAdmin===null)$isAdmin = $this->checkAdminIdentity();
+        if ($isAdmin) return Authority::query()->get();
+        return Authority::query()->whereHas("roles",function (Builder $query){
+            $query->whereHas("users",function (Builder $query){
+                $query->where(DB::raw("users.id"),Auth::id());
+            });
+        })->get();
+    }
+
     public function removeAdminAuth()
     {
         Cache::tags("authorities:admin")->flush();
+        app("MenuService")->removeMenuMapping();
     }
 
     public function removeAllAuth()
     {
         Cache::tags("authorities:admin")->flush();
         Cache::tags("authorities:user")->flush();
+        app("MenuService")->removeMenuMapping();
     }
 
     /**
@@ -52,7 +75,7 @@ class AuthorityService
      * @param Collection $authorities
      * @return array
      */
-    public function format($authorities)
+    public function format(Collection $authorities):array
     {
         $authMap = [];
         foreach ($authorities as $authority){
@@ -89,13 +112,12 @@ class AuthorityService
                 $authMap[$index]["child"][] = $authorities;
                 unset($authMap[$authorities["id"]]);
                 return $authMap;
-            }else{
-                if ($authMap[$index]["child"]){
-                    $re = $this->formatAuthority($authMap[$index]["child"],$authorities);
-                    if ($re){
-                        $authMap[$index]["child"] = $re;
-                        return $authMap;
-                    }
+            }
+            if ($data["child"]){
+                $re = $this->formatAuthority($data["child"],$authorities);
+                if ($re){
+                    $authMap[$index]["child"] = $re;
+                    return $authMap;
                 }
             }
         }

+ 5 - 5
app/Services/DbOpenService.php

@@ -139,12 +139,12 @@ class DbOpenService
             'isdispatched'  => '',
             'ispresaleorder'=> '',
             'isCenterDelivery' => '',
-            'orderExtendFields' => [
-                'value'     => '',
-                'key'       => ''
-            ]
+//            'orderExtendFields' => [
+//                'value'     => '',
+//                'key'       => ''
+//            ]
         ];
-        $param = json_encode($data,1);
+        $param = json_encode($data);
         $timestamp = (integer)getMillisecond();
         return ["params"=>$param,"timestamp"=>$timestamp,
             "digest"=>base64_encode(md5($param.config('api_logistic.DB.prod.app_key').$timestamp)),

+ 1 - 2
app/Services/InventoryService.php

@@ -179,8 +179,7 @@ class InventoryService
             '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;
+        return app(QueryService::class)->query($param,$inventoryDailyLogs,$columnQueryRules);
     }
 
     //库存体积

+ 19 - 104
app/Services/LaborReportsCountingRecordService.php

@@ -6,6 +6,8 @@ namespace App\Services;
 
 use App\LaborReport;
 use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Str;
 use App\Traits\ServiceAppAop;
@@ -51,120 +53,33 @@ class LaborReportsCountingRecordService
         return $result->sortBy('id');
     }
 
-    public function get($start, $end, $unit = '日')
-    {
-        $resultByCache = $this->getByCache($start, $end, $unit);
-        if ($resultByCache['dateList'] == []) {
-            return $resultByCache['dataList'];
-        } else {
-            $this->syncDBToCache($resultByCache['dateList'], $unit);
-            return $this->getByCache($start, $end, $unit)['dataList'];
-        }
-    }
-
-    public function getByCache($start, $end, $unit)
-    {
-        $dataList = collect();
-        $dateList = collect($this->periodDateToArray($start, $end, $unit));
-        $result = [];
-        foreach ($dateList as $date) {
-            $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
-            $item = Cache::get($key);
-            if ($item) {
-                $dataList->push($item);
-                $dateList = $dateList->reject(function ($value) use ($date) {
-                    return $value == $date;
-                });
-            }
-        }
-        $result['dataList'] = $dataList;
-        $result['dateList'] = $dateList->toArray();
-        return $result;
-    }
-
-
     /**
-     * @param $start
-     * @param $end
-     * @param string $unit
-     * @return array
+     * @param $kvPairs
+     * @return array|Builder[]|Collection
      */
-    private function periodDateToArray($start, $end, $unit = '日')
+    public function get($kvPairs)
     {
-        $dataArray = [];
-        switch ($unit) {
-            case '日';
-                foreach (Carbon::parse($start)->daysUntil($end, 1)->toArray() as $item) {
-                    $dataArray[] = $item->toDateString();
-                }
-                break;
-            case '月';
-                foreach (Carbon::parse($start)->monthsUntil($end, 1)->toArray() as $item) {
-                    $dataArray[] = $item->year . '-' . $item->format('m') . '';
-                }
-                break;
-            case '年';
-                foreach (Carbon::parse($start)->yearsUntil($end, 1)->toArray() as $item) {
-                    $dataArray[] = $item->year . '';
-                }
-                break;
-            default:
-                break;
-        }
-        return $dataArray;
-    }
-
-    private function syncDBToCache($dateList, $unit)
-    {
-        switch ($unit) {
+        switch ($kvPairs['unit']) {
             case '日':
-                $query = LaborReport::query()
-                    ->selectRaw("DATE_FORMAT(created_at,'%Y-%m-%d') as date_target, count(DISTINCT enter_number ) as counter");
-                foreach ($dateList as $startOfWeek) {
-                    $query->orWhere(function ($query) use ($startOfWeek) {
-                        $query->whereDate('created_at', $startOfWeek);
-                    });
-                }
-                $dataList = $query->groupBy('date_target')->get();
-                $dataList->each(function ($item) use ($unit) {
-                    $date = $item->date_target;
-                    $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
-                    Cache::put($key, $item, $this->ttl);
-                });
+                $str = "'%Y-%m-%d'";
                 break;
+
             case '月':
-                $query = LaborReport::query()->selectRaw("DATE_FORMAT(created_at,'%Y-%m') as date_target, count(DISTINCT enter_number ) as counter");
-                foreach ($dateList as $date) {
-                    $query->orWhere(function ($query) use ($date) {
-                        $year = Str::of($date)->explode('-')[0];
-                        $month = Str::of($date)->explode('-')[1];
-                        $query->whereYear('created_at', $year)->whereMonth('created_at', $month);
-                    });
-                }
-                $dataList = $query->groupBy('date_target')->get();
-                $dataList->each(function ($item) use ($unit) {
-                    $date = $item->date_target;
-                    $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
-                    Cache::put($key, $item, $this->ttl);
-                });
+                $str = "'%Y-%m'";
                 break;
             case '年':
-                $query = LaborReport::query()->selectRaw("DATE_FORMAT(created_at,'%Y') as date_target, count(DISTINCT enter_number ) as counter");
-                foreach ($dateList as $date) {
-                    $query->orWhere(function ($query) use ($date) {
-                        $year = Str::of($date)->explode('-')[0];
-                        $query->whereYear('created_at', $year)->whereYear('created_at', $year);
-                    });
-                }
-                $dataList = $query->groupBy('date_target')->get();
-                $dataList->each(function ($item) use ($unit) {
-                    $date = $item->date_target;
-                    $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
-                    Cache::put($key, $item, $this->ttl);
-                });
+                $str = "'%Y'";
                 break;
             default:
-                break;
+                $str = "'%Y-%m-%d'";
+        }
+        $queryBuilder = LaborReport::query()
+            ->selectRaw("DATE_FORMAT(created_at,{$str}) as date_target, count(DISTINCT enter_number ) as counter")
+            ->whereBetween('created_at', [$kvPairs['start'], $kvPairs['end']]);
+        if (!empty($kvPairs['userWorkgroupIds'])&&$kvPairs['userWorkgroupIds']!=='all') {
+            $user_workgroup_ids = array_filter(preg_split('/[,, ]+/is', $kvPairs['userWorkgroupIds']));
+            $queryBuilder->whereIn('user_workgroup_id', $user_workgroup_ids);
         }
+        return $queryBuilder->groupBy('date_target')->get();
     }
 }

+ 34 - 7
app/Services/MenuService.php

@@ -6,6 +6,7 @@ use App\Authority;
 use App\Traits\ServiceAppAop;
 use App\Menu;
 use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 
 class MenuService
@@ -27,12 +28,17 @@ class MenuService
         return Cache::get("menus");
     }
 
+    public function removeMenuMapping()
+    {
+        Cache::tags("AUTHORITY_MENU_MAPPING")->flush();
+    }
     public function setMenu()
     {
         //如果需要热更新 为所有用户个人菜单锁定缓存 标记TAGS 在此清除 Cache::tag("tags")->flush()
         Cache::forever("menus",Menu::query()
             ->select("id","name","parent_id","route","font","font_style")
             ->orderByRaw("level DESC,sequence")->get());
+        $this->removeMenuMapping();
     }
 
     public function appendMenu(Menu $menu)
@@ -42,18 +48,38 @@ class MenuService
             $menus->add($menu);
             Cache::forever("menus",$menus);
         }
+        $this->removeMenuMapping();
     }
 
     //菜单与权限关联依据为 name与parent_id字段 当两个表中任意此字段发生变更 必须刷掉缓存
-    public function getVisibleFunctionList($authorities = null,&$mapping = [])
+    public function getVisibleFunctionList($authorities = null,&$mapping = []):array
     {
+        $userId = Auth::id();
+        $isCache = !$authorities && !$mapping && $userId;
+        if ($isCache && Cache::tags("AUTHORITY_MENU_MAPPING")->has("am_mapping_".$userId))
+            return Cache::tags("AUTHORITY_MENU_MAPPING")->get("am_mapping_".$userId);
         /** @var Collection $authorities */
-        if (!$authorities)$authorities = app("AuthorityService")->getUserAuthority();
+        if (!$authorities)$authorities = app("AuthorityService")->getUserAuthorityData();
         $authMap = app("AuthorityService")->format($authorities);
         $menus = $this->format($this->getMenu());
-        return array_values($this->formatMenu($menus,$authMap,$mapping));
+        $result = array_values($this->formatMenu($menus,$authMap,$mapping));
+        if ($isCache)Cache::tags("AUTHORITY_MENU_MAPPING")->forever("am_mapping_".$userId,$result);
+        return $result;
     }
 
+    public function getVisibleMenuListAll()
+    {
+        $key = "am_mapping_all";
+        if (Cache::tags("AUTHORITY_MENU_MAPPING")->has($key))
+            return Cache::tags("AUTHORITY_MENU_MAPPING")->get($key);
+        /** @var Collection $authorities */
+        $authorities = app("AuthorityService")->getUserAuthorityData(true); //获取超管权限(全量)
+        $authMap = app("AuthorityService")->format($authorities);
+        $menus = $this->format($this->getMenu());//菜单权限(全量)
+        $result = array_values($this->formatMenu($menus,$authMap));
+        Cache::tags("AUTHORITY_MENU_MAPPING")->forever($key,$result);
+        return $result;
+    }
 
     /**
      * 格式化为树状结构
@@ -61,7 +87,7 @@ class MenuService
      * @param Collection $menus
      * @return array
      */
-    public function format($menus)
+    public function format(Collection $menus):array
     {
         $menuMap = [];
         foreach ($menus as $menu){
@@ -89,9 +115,9 @@ class MenuService
      * @param array $authorities
      * @param array $mapping
      *
-     * @return array|bool
+     * @return array
      */
-    private function formatMenu(array $menus,array $authorities,&$mapping=[])
+    private function formatMenu(array $menus,array $authorities,array &$mapping=[]):array
     {
         foreach ($menus as $index=>$menu){
             $mark = false;
@@ -120,8 +146,9 @@ class MenuService
     /**
      * 获取菜单与权限映射
      */
-    public function getMenuAndAuthorityMapping()
+    public function getMenuAndAuthorityMapping():array
     {
+        $mapping = [];
         $this->getVisibleFunctionList(Authority::query()->get(),$mapping);
         return $mapping;
     }

+ 13 - 0
app/Services/OrderPackageRemarkService.php

@@ -0,0 +1,13 @@
+<?php 
+
+namespace App\Services;
+
+use App\Traits\ServiceAppAop;
+use App\OrderPackageRemark;
+
+class OrderPackageRemarkService
+{
+    use ServiceAppAop;
+    protected $modelClass=OrderPackageRemark::class;
+
+}

+ 2 - 1
app/Services/OrderService.php

@@ -1383,7 +1383,8 @@ sql
         $feeBill = OwnerFeeDetail::query()->where("outer_table_name","orders")
             ->where("outer_id",$order->id)->whereNull("logistic_fee")->first();
         if (!$feeBill)return false; //是否已有即时账单,没有跳出
-        $order->loadMissing("packages","owner");//加载包裹
+        //加载所需数据
+        $order->loadMissing(["logistic","shop","packages.commodities.commodity","batch"]);
         if (!$order->packages->count() || !$order->owner)return false;
         //获取运输费
         $logisticInfo = $this->getLogisticFeeInfo($order);

+ 58 - 22
app/Services/OwnerFeeTotalService.php

@@ -5,8 +5,10 @@ namespace App\Services;
 use App\OrderIssue;
 use App\Owner;
 use App\OwnerBillReport;
+use App\OwnerFeeOperation;
 use App\OwnerPriceOperation;
 use App\OwnerPriceOperationItem;
+use App\OwnerStoreOutFeeReport;
 use App\Traits\ServiceAppAop;
 use App\OwnerFeeTotal;
 use App\Traits\SettlementBillServiceTrait;
@@ -169,36 +171,70 @@ class OwnerFeeTotalService
                 'name' => $ownerStoragePriceModel->name,
                 'remark' => $remark,
                 'id' => $ownerStoragePriceModel->id,
-                'fee' => number_format($areaFeeService->getTotalFee($owner->id, $counting_month)->storage_fee ?? 0, 2),
+                'fee' => $areaFeeService->getTotalFee($owner->id, $counting_month)->storage_fee ?? 0,
                 'tax_fee' => $areaFeeService->getTotalFee($owner->id, $counting_month)->storage_tax_fee ?? 0
             ];
         }
-
         $ownerPriceOperationsGrouped = $owner->ownerPriceOperations->groupBy('operation_type');
-        /**@var $storeOutFeeDetailsService OwnerStoreOutFeeDetailService */
-        $storeOutFeeDetailsService = app('OwnerStoreOutFeeDetailService');
-        $workFeeTotalGrouped = $storeOutFeeDetailsService->getTotalFee($owner->id, $counting_month)->groupBy('owner_price_operation_id');
-
         //入库
+        $ownerStoreFeeReports = \App\OwnerStoreFeeReport::query()
+            ->selectRaw("
+            sum(fee) as fee,
+            sum(tax_fee) as tax_fee,
+            model_id
+            ")
+            ->where('counting_month', $counting_month)
+            ->where('owner_id', $owner->id)
+            ->groupBy('model_id')
+            ->get();
+        $ownerStoreFeeReportsGroupByModelId = $ownerStoreFeeReports->groupBy('model_id')->toArray();
+
         foreach ($ownerPriceOperationsGrouped['入库'] ?? [] as $ownerPriceOperationsGroupedItem) {
-            $information['storeFee'][] = [
-                'name' => $ownerPriceOperationsGroupedItem->name,
-                'remark' => $this->buildPriceRemarks($ownerPriceOperationsGroupedItem),
-                'id' => $ownerPriceOperationsGroupedItem->id,
-                'fee' => number_format($workFeeTotalGrouped[$ownerPriceOperationsGroupedItem->id][0]->work_fee ?? 0, 2),
-                'tax_fee' => $workFeeTotalGrouped[$ownerPriceOperationsGroupedItem->id][0]->work_tax_fee ?? 0,
-            ];
-        }
+            try {
+                $fee = $ownerStoreFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->id][0]['fee'];
+            } catch (\Exception $e) {
+                $fee = $ownerStoreFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->target_id][0]['fee'] ?? 0;
+                $ownerPriceOperationsGroupedItem = OwnerPriceOperation::query()->with(['items'])->find($ownerPriceOperationsGroupedItem->target_id);
+            }
+            if ($fee > 0) {
+                $information['storeFee'][] = [
+                    'name' => $ownerPriceOperationsGroupedItem->name,
+                    'remark' => $this->buildPriceRemarks($ownerPriceOperationsGroupedItem),
+                    'id' => $ownerPriceOperationsGroupedItem->id,
+                    'fee' => $fee,
+                    'tax_fee' => $ownerStoreFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->id][0]['tax_fee'] ?? 0,
+                ];
+            }
 
+        }
         //出库
+        $ownerStoreOutFeeReports = OwnerStoreOutFeeReport::query()
+            ->selectRaw("
+            sum(fee) as fee,
+            sum(tax_fee) as tax_fee,
+            model_id
+            ")
+            ->where('counting_month', $counting_month)
+            ->where('owner_id', $owner->id)
+            ->groupBy('model_id')
+            ->get();
+        $ownerStoreOutFeeReportsGroupByModelId = $ownerStoreOutFeeReports->groupBy('model_id')->toArray();
         foreach ($ownerPriceOperationsGrouped['出库'] ?? [] as $ownerPriceOperationsGroupedItem) {
-            $information['storeOutFee'][] = [
-                'name' => $ownerPriceOperationsGroupedItem->name,
-                'remark' => $this->buildPriceRemarks($ownerPriceOperationsGroupedItem),
-                'id' => $ownerPriceOperationsGroupedItem->id,
-                'fee' => number_format($workFeeTotalGrouped[$ownerPriceOperationsGroupedItem->id][0]->work_fee ?? 0, 2),
-                'tax_fee' => number_format($workFeeTotalGrouped[$ownerPriceOperationsGroupedItem->id][0]->work_tax_fee ?? 0, 2),
-            ];
+            try {
+                $fee = $ownerStoreOutFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->id][0]['fee'];
+            } catch (\Exception $e) {
+                $fee = $ownerStoreOutFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->target_id][0]['fee'] ?? 0;
+                $ownerPriceOperationsGroupedItem = OwnerPriceOperation::query()->with(['items'])->find($ownerPriceOperationsGroupedItem->target_id);
+            }
+            if ($fee > 0) {
+                $information['storeOutFee'][] = [
+                    'name' => $ownerPriceOperationsGroupedItem->name,
+                    'remark' => $this->buildPriceRemarks($ownerPriceOperationsGroupedItem),
+                    'id' => $ownerPriceOperationsGroupedItem->id,
+                    'fee' => $fee,
+                    'tax_fee' => $ownerStoreOutFeeReportsGroupByModelId[$ownerPriceOperationsGroupedItem->id][0]['tax_fee'] ?? 0,
+                ];
+            }
         }
         return $information;
     }
@@ -389,7 +425,7 @@ class OwnerFeeTotalService
     private function calTaxRate($totalTaxFee, $totalFee, $ownerFeeTotal)
     {
         try {
-            $taxRate = number_format(($totalTaxFee / $totalFee) * 100, 2) ?? 0;
+            $taxRate = ($totalTaxFee / $totalFee) * 100 ?? 0;
         } catch (\Exception $e) {
             $taxRate = 0;
         }

+ 9 - 39
app/Services/OwnerLogisticFeeDetailService.php

@@ -4,6 +4,7 @@ namespace App\Services;
 
 use App\Logistic;
 use App\OwnerFeeDetail;
+use App\OwnerFeeExpress;
 use App\Traits\ServiceAppAop;
 use App\OwnerLogisticFeeDetail;
 use App\Traits\SettlementBillServiceTrait;
@@ -14,14 +15,15 @@ use Illuminate\Pagination\LengthAwarePaginator;
 class OwnerLogisticFeeDetailService implements \App\Interfaces\SettlementBillDetailInterface
 {
     use SettlementBillServiceTrait;
+
     const TYPE = '快递费-明细';
 
     use ServiceAppAop;
 
     /**
-     * @var $modelClass  OwnerLogisticFeeDetail
+     * @var $modelClass  OwnerFeeExpress
      */
-    protected $modelClass = OwnerLogisticFeeDetail::class;
+    protected $modelClass = OwnerFeeExpress::class;
 
 
     /**
@@ -31,15 +33,7 @@ class OwnerLogisticFeeDetailService implements \App\Interfaces\SettlementBillDet
      */
     public function get(array $kvPairs): LengthAwarePaginator
     {
-        $ownerLogisticFeeDetails = $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
-        $items = $this->buildDetails($ownerLogisticFeeDetails);
-        return new LengthAwarePaginator(
-            $items,
-            $ownerLogisticFeeDetails->total(),
-            $ownerLogisticFeeDetails->perPage(),
-            $ownerLogisticFeeDetails->currentPage(),
-            ["path" => $ownerLogisticFeeDetails->path(), "pageName" => "page"]
-        );
+        return $this->getSql($kvPairs['owner_id'], $kvPairs['counting_month'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
     }
 
     /**
@@ -50,37 +44,13 @@ class OwnerLogisticFeeDetailService implements \App\Interfaces\SettlementBillDet
     public function getSql($owner_id, $counting_month): Builder
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return OwnerLogisticFeeDetail::query()->with([
-            'ownerFeeDetailLogistic:id,weight,logistic_fee,logistic_bill',
-            'logistic:id,name'
-        ])
-            ->where('owner_id',$owner_id)
-            ->whereBetween('created_at',[$start, $end])
+        return OwnerFeeExpress::query()
+            ->with(['province', 'logistic'])
+            ->where('owner_id', $owner_id)
+            ->whereBetween('created_at', [$start, $end])
             ->orderBy('logistic_id');
     }
 
-    /**
-     * @param  $ownerLogisticFeeDetails
-     * @return array
-     */
-    public function buildDetails($ownerLogisticFeeDetails): array
-    {
-        $items = [];
-        foreach ($ownerLogisticFeeDetails as $ownerLogisticFeeDetail) {
-            $items[] = [
-                'id' => $ownerLogisticFeeDetail->id,
-                'logistic_name' => $ownerLogisticFeeDetail->logistic->name ?? '',//快递公司
-                'province' => $ownerLogisticFeeDetail->province,//省份
-                'logistic_bill' => $ownerLogisticFeeDetail->logistic_bill ?? '',//快递单号
-                'weight' => $ownerLogisticFeeDetail->ownerFeeDetailLogistic->weight ?? $ownerLogisticFeeDetail->ownerFeeDetail->weight ?? '0.00',//重量
-                'initial_weight_price' => $ownerLogisticFeeDetail->initial_weight_price ?? '',//首重价格
-                'additional_price' => $ownerLogisticFeeDetail->additional_price ?? '',//续重价格
-                'logistic_fee' => $ownerLogisticFeeDetail->fee,//快递费
-            ];
-        }
-        return $items;
-    }
-
     public function switchType($type)
     {
     }

+ 27 - 28
app/Services/OwnerLogisticFeeReportService.php

@@ -4,6 +4,7 @@ namespace App\Services;
 
 use App\OwnerBillReport;
 use App\OwnerBillReportArchive;
+use App\OwnerFeeExpress;
 use App\OwnerLogisticFeeDetail;
 use App\Traits\ServiceAppAop;
 use App\OwnerLogisticFeeReport;
@@ -62,55 +63,53 @@ class OwnerLogisticFeeReportService implements \App\Interfaces\SettlementBillRep
         $this->confirmBillFeeTotal($counting_month, $owner_id);
     }
 
-
-    /**
-     * 生成报表数据
-     * 如果参数$counting_month为空 统计上一个月的
-     * 如果参数$counting_month为2021-01-01 则统计2021-01-01 -- 2021-01-31之间的数据
-     * @param null $counting_month 统计月份,默认统计上个月的 2021-05-01
-     */
     public function recordReport($counting_month = null)
     {
         if (is_null($counting_month)) {
             //默认统计上个月的数据
             $counting_month = now()->subMonth()->startOfMonth()->toDateTimeString();
         }
-        $this->reportDate = $counting_month;
-
-        $start = $this->reportDate;
-        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateTimeString();
-
-
-        $ownerLogisticFeeDetails = OwnerLogisticFeeDetail::query()
-            ->selectRaw("logistic_id,
-            province,
-            DATE_FORMAT(created_at,
-            '%Y-%m') as counted_date,
+        list($start, $end) = $this->getStartAndEnd($counting_month);
+        $ownerLogisticFeeDetails = OwnerFeeExpress::query()
+            ->selectRaw("
+            province_id,
+            logistic_id,
+            DATE_FORMAT(created_at,'%Y-%m') as counted_date,
             initial_weight,
             initial_weight_price,
             count(1) as initial_amount,
-            additional_price,
+            additional_weight_price,
             additional_weight,
-            sum(additional_weigh_weight) as additional_amount,
-            sum(tax_fee) as tax_fee,
-            sum(fee) as fee,
+            sum(additional_weight_amount) as additional_amount,
+            sum(total_fee*tax_rate) as tax_fee,
+            sum(total_fee) as fee,
+            sum(total_fee) as fee,
             created_at,
             owner_id")
             ->whereBetween('created_at', [$start, $end])
-            ->groupBy('initial_weight', 'initial_weight_price', 'additional_price', 'additional_weight', 'logistic_id', 'province', 'counted_date', 'owner_id')
+            ->groupBy(
+                'initial_weight',
+                'initial_weight_price',
+                'additional_weight_price',
+                'additional_weight',
+                'logistic_id',
+                'province_id',
+                'counted_date',
+                'owner_id')
             ->get();
+
         $ownerLogisticFeeReportArray = [];
 
         foreach ($ownerLogisticFeeDetails as $ownerLogisticFeeDetail) {
             $ownerLogisticFeeReportArray[] = [
                 'logistic_id' => $ownerLogisticFeeDetail->logistic_id,
-                'province' => $ownerLogisticFeeDetail->province,
+                'province_id' => $ownerLogisticFeeDetail->province_id,
                 'counted_date' => Carbon::parse($ownerLogisticFeeDetail->counted_date)->firstOfMonth()->toDateString(),
                 'initial_weight' => $ownerLogisticFeeDetail->initial_weight,
                 'initial_weight_price' => $ownerLogisticFeeDetail->initial_weight_price,
                 'initial_amount' => $ownerLogisticFeeDetail->initial_amount,
                 'additional_weight' => $ownerLogisticFeeDetail->additional_weight,
-                'additional_price' => $ownerLogisticFeeDetail->additional_price,
+                'additional_price' => $ownerLogisticFeeDetail->additional_weight_price,
                 'additional_amount' => $ownerLogisticFeeDetail->additional_amount,
                 'fee' => $ownerLogisticFeeDetail->fee,
                 'tax_fee' => $ownerLogisticFeeDetail->tax_fee,
@@ -119,10 +118,10 @@ class OwnerLogisticFeeReportService implements \App\Interfaces\SettlementBillRep
         }
         //保证接口幂等性 删除统计月的数据
         OwnerLogisticFeeReport::query()->where('counted_date', $counting_month)->delete();
-
         OwnerLogisticFeeReport::query()->insertOrIgnore($ownerLogisticFeeReportArray);
     }
 
+
     /**
      * 订单统计分页查询
      * @param $owner_id
@@ -193,11 +192,11 @@ class OwnerLogisticFeeReportService implements \App\Interfaces\SettlementBillRep
     public function getSql($owner_id, $counting_month): Builder
     {
         return OwnerLogisticFeeReport::query()
-            ->with('logistic:id,name')
+            ->with(['logistic:id,name','province'])
             ->where('owner_id', $owner_id)
             ->where('counted_date', $counting_month)
             ->orderByDesc('logistic_id')
-            ->orderByDesc('province');
+            ->orderByDesc('province_id');
     }
 
     /**

+ 4 - 2
app/Services/OwnerProcessSettlementBillService.php

@@ -6,6 +6,7 @@ use App\Interfaces\SettlementBillDetailInterface;
 use App\OwnerFeeDetail;
 use App\Traits\ServiceAppAop;
 use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Support\Facades\DB;
 
 class OwnerProcessSettlementBillService implements SettlementBillDetailInterface
 {
@@ -62,10 +63,11 @@ class OwnerProcessSettlementBillService implements SettlementBillDetailInterface
     public function getTotalFee($owner_id, $counting_month)
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return \Illuminate\Support\Facades\DB::table('owner_fee_details')
+        return DB::table('owner_fee_details')
             ->selectRaw("sum(work_fee) as fee,sum(work_tax_fee) as tax_fee")
             ->where('owner_id', $owner_id)
-            ->whereBetween('created_at', [$start, $end])
+            ->whereBetween('worked_at', [$start, $end])
+            ->where('outer_table_name','processes')
             ->first();
     }
 

+ 10 - 7
app/Services/OwnerStoreFeeDetailService.php

@@ -2,6 +2,8 @@
 
 namespace App\Services;
 
+use App\OwnerFeeOperation;
+use App\OwnerPriceOperation;
 use App\Traits\ServiceAppAop;
 use App\OwnerStoreFeeDetail;
 use App\Traits\SettlementBillTrait;
@@ -20,7 +22,6 @@ class OwnerStoreFeeDetailService
     public function get(array $kvPairs): \Illuminate\Contracts\Pagination\LengthAwarePaginator
     {
         return $this->getSql($kvPairs['counting_month'], $kvPairs['owner_id'])->paginate($kvPairs['paginateParams']['paginate'] ?? 50);
-
     }
 
 
@@ -32,12 +33,14 @@ class OwnerStoreFeeDetailService
     public function getSql($counting_month, $owner_id): Builder
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return OwnerStoreFeeDetail::query()
-            ->with([
-                'ownerFeeDetail:id,worked_at',
-                'commodity:id,name',
-             ])
-            ->whereBetween('created_at', [$start, $end])
+
+        $OwnerPriceOperationQuery = OwnerPriceOperation::query()
+            ->select('id')
+            ->where('operation_type', '入库');
+        return OwnerFeeOperation::query()
+            ->with(['details','model','commodity.barcodes'])
+            ->whereIn('model_id', $OwnerPriceOperationQuery)
+            ->whereBetween('worked_at', [$start, $end])
             ->where('owner_id', $owner_id);
     }
 

+ 23 - 18
app/Services/OwnerStoreFeeReportService.php

@@ -38,29 +38,32 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
             //默认统计上个月的数据
             $counting_month = now()->subMonth()->startOfMonth()->toDateString();
         }
-        $this->reportDate = $counting_month;
-
-        $start = $this->reportDate;
-        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateString();
+        list($start, $end) = $this->getStartAndEnd($counting_month);
         $details =
-            DB::table('owner_store_fee_details')
+            DB::table('owner_fee_operations')
+                ->leftJoin('owner_fee_operation_details','owner_fee_operations.id','=','owner_fee_operation_details.owner_fee_operation_id')
+                ->leftJoin('owner_price_operations','owner_fee_operations.model_id','=','owner_price_operations.id')
                 ->selectRaw("
-                DATE_FORMAT(owner_store_fee_details.created_at,'%Y-%m') as counting_month,
-                unit_id,
-                unit_price,
-                work_name,
-                sum(amount) as amounts ,
-                owner_store_fee_details.owner_id,
-                owner_fee_detail_id,
-                sum(owner_store_fee_details.fee) as fee
+                DATE_FORMAT(owner_fee_operations.worked_at,'%Y-%m') as counting_month,
+                owner_fee_operation_details.unit_id,
+                owner_fee_operation_details.price,
+                owner_price_operations.name,
+                sum(owner_fee_operation_details.amount) as amounts ,
+                owner_fee_operations.owner_id,
+                owner_fee_operations.model_id,
+                sum(owner_fee_operation_details.price*owner_fee_operation_details.amount) as fee,
+                sum(owner_fee_operation_details.price*owner_fee_operation_details.amount*owner_fee_operations.tax_rate) as tax_fee
                 ")
-                ->whereBetween('owner_store_fee_details.created_at', [$start, $end])
+                ->whereBetween('owner_fee_operations.worked_at', [$start, $end])
+                ->whereNotNull('owner_fee_operation_details.price')
+                ->whereNotNull('owner_fee_operation_details.amount')
+                ->whereIn('model_id',\App\OwnerPriceOperation::query()->select('id')->where('operation_type','入库'))
                 ->groupBy(
                     'counting_month',
                     'owner_id',
                     'unit_id',
-                    'unit_price',
-                    'work_name'
+                    'price',
+                    'model_id'
                 )
                 ->get();
         $reports = [];
@@ -75,10 +78,12 @@ class OwnerStoreFeeReportService implements \App\Interfaces\SettlementBillReport
                 'owner_id' => $detail->owner_id,
                 'counting_month' => $counting_month,
                 'unit_id' => $detail->unit_id,
-                'unit_price' => $detail->unit_price,
+                'unit_price' => $detail->price,
                 'amount' => $detail->amounts,
                 'fee' => $detail->fee,
-                'work_name' => $detail->work_name,
+                'work_name' => $detail->name,
+                'model_id' => $detail->model_id,
+                'tax_fee' => $detail->tax_fee,
             ];
         }
         $reports_chunked = array_chunk($reports, 1000);

+ 11 - 7
app/Services/OwnerStoreOutFeeDetailService.php

@@ -4,6 +4,8 @@ namespace App\Services;
 
 use App\Interfaces\SettlementBillDetailInterface;
 use App\OwnerFeeDetail;
+use App\OwnerFeeOperation;
+use App\OwnerPriceOperation;
 use App\Traits\ServiceAppAop;
 use App\OwnerStoreOutFeeDetail;
 use App\Traits\SettlementBillServiceTrait;
@@ -33,13 +35,15 @@ class OwnerStoreOutFeeDetailService implements SettlementBillDetailInterface
     public function getSql($owner_id, $counting_month): Builder
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return OwnerStoreOutFeeDetail::query()
-            ->with([
-                'commodity:id,name,sku',
-                'ownerFeeDetail:id,worked_at,operation_bill,work_fee'
-            ])
-            ->where('owner_id', $owner_id)
-            ->whereBetween('created_at', [$start, $end]);
+
+        $OwnerPriceOperationQuery = OwnerPriceOperation::query()
+            ->select('id')
+            ->where('operation_type', '出库');
+        return OwnerFeeOperation::query()
+            ->with(['details','model','commodity.barcodes'])
+            ->whereIn('model_id', $OwnerPriceOperationQuery)
+            ->whereBetween('worked_at', [$start, $end])
+            ->where('owner_id', $owner_id);
     }
 
     public function switchType($type)

+ 40 - 36
app/Services/OwnerStoreOutFeeReportService.php

@@ -6,10 +6,12 @@ use App\Interfaces\SettlementBillReportInterface;
 use App\OwnerBillReport;
 use App\OwnerBillReportArchive;
 use App\OwnerFeeDetail;
+use App\OwnerPriceOperation;
 use App\OwnerStoreFeeReport;
 use App\OwnerStoreOutFeeDetail;
 use App\Traits\ServiceAppAop;
 use App\OwnerStoreOutFeeReport;
+use App\Traits\SettlementBillServiceTrait;
 use Carbon\Carbon;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Support\Facades\DB;
@@ -20,46 +22,47 @@ class OwnerStoreOutFeeReportService implements SettlementBillReportInterface
 
     use ServiceAppAop;
 
-    use \App\Traits\SettlementBillServiceTrait;
+    use SettlementBillServiceTrait;
 
     protected $modelClass = OwnerStoreOutFeeReport::class;
-    /** @var $detailService OwnerBillReportArchiveService */
+    /** @var $archiveService OwnerBillReportArchiveService */
     private $archiveService;
 
-    /** @var $detailService OwnerStoreOutFeeDetailService */
-    private $detailService;
 
     public function recordReport($counting_month = null)
     {
-        $this->detailService = app('OwnerStoreOutFeeDetailService');
         if (is_null($counting_month)) {
             //默认统计上个月的数据
             $counting_month = now()->subMonth()->startOfMonth()->toDateString();
         }
-        $this->reportDate = $counting_month;
-        $start = $this->reportDate;
-        $end = Carbon::parse($this->reportDate)->endOfMonth()->toDateString();
-        $details = OwnerStoreOutFeeDetail::query()
-            ->selectRaw("
-                DATE_FORMAT(owner_store_out_fee_details.created_at,'%Y-%m') as counting_month,
-                step,
-                unit_id,
-                unit_price,
-                sum(amount) as  amount ,
-                sum(fee) as  fee ,
-                owner_id,
-                work_name
-            ")
-            ->whereBetween('created_at', [$start, $end])
-            ->groupBy(
-                'counting_month',
-                'step',
-                'unit_id',
-                'unit_price',
-                'owner_id',
-                'work_name'
-            )->get();
-
+        list($start, $end) = $this->getStartAndEnd($counting_month);
+        $details =
+            DB::table('owner_fee_operations')
+                ->leftJoin('owner_fee_operation_details','owner_fee_operations.id','=','owner_fee_operation_details.owner_fee_operation_id')
+                ->leftJoin('owner_price_operations','owner_fee_operations.model_id','=','owner_price_operations.id')
+                ->selectRaw("
+                DATE_FORMAT(owner_fee_operations.worked_at,'%Y-%m') as counting_month,
+                owner_fee_operation_details.unit_id,
+                owner_fee_operation_details.price,
+                owner_price_operations.name,
+                sum(owner_fee_operation_details.amount) as amounts ,
+                owner_fee_operations.owner_id,
+                owner_fee_operations.model_id,
+                sum(owner_fee_operation_details.price*owner_fee_operation_details.amount) as fee,
+                sum(owner_fee_operation_details.price*owner_fee_operation_details.amount*owner_fee_operations.tax_rate) as tax_fee
+                ")
+                ->whereBetween('owner_fee_operations.worked_at', [$start, $end])
+                ->whereNotNull('owner_fee_operation_details.price')
+                ->whereNotNull('owner_fee_operation_details.amount')
+                ->whereIn('model_id', OwnerPriceOperation::query()->select('id')->where('operation_type','出库'))
+                ->groupBy(
+                    'counting_month',
+                    'owner_id',
+                    'unit_id',
+                    'price',
+                    'model_id'
+                )
+                ->get();
         $reports = [];
         foreach ($details as $detail) {
             $counting_month = Carbon::parse($detail->counting_month)->startOfMonth()->toDateString();
@@ -71,20 +74,21 @@ class OwnerStoreOutFeeReportService implements SettlementBillReportInterface
                 'owner_bill_report_id' => $ownerBillReport->id ?? null,
                 'owner_id' => $detail->owner_id,
                 'counting_month' => $counting_month,
-                'step' => $detail->step,
                 'unit_id' => $detail->unit_id,
-                'unit_price' => $detail->unit_price,
-                'amount' => $detail->amount,
+                'unit_price' => $detail->price,
+                'amount' => $detail->amounts,
                 'fee' => $detail->fee,
-                'work_name' => $detail->work_name,
+                'work_name' => $detail->name,
+                'model_id' => $detail->model_id,
+                'tax_fee' => $detail->tax_fee,
             ];
         }
-
+        $reports_chunked = array_chunk($reports, 1000);
         //保证幂等性 插入前删除该月的统计数据
         OwnerStoreOutFeeReport::query()->where('counting_month', $counting_month)->delete();
 
-        foreach (array_chunk($reports, 1000) as $reports_chunked) {
-            OwnerStoreOutFeeReport::query()->insertOrIgnore($reports_chunked);
+        foreach ($reports_chunked as $items) {
+            OwnerStoreOutFeeReport::query()->insertOrIgnore($items);
         }
     }
 

+ 27 - 24
app/Services/OwnerWaybillSettlementBillService.php

@@ -3,6 +3,7 @@
 namespace App\Services;
 
 use App\OwnerFeeDetail;
+use App\OwnerFeeLogistic;
 use App\Traits\ServiceAppAop;
 use App\Waybill;
 use Illuminate\Database\Eloquent\Builder;
@@ -30,10 +31,10 @@ class OwnerWaybillSettlementBillService implements \App\Interfaces\SettlementBil
     public function getSql($owner_id, $counting_month): Builder
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return Waybill::query()
+        return OwnerFeeLogistic::query()
             ->where('owner_id', $owner_id)
             ->whereBetween('created_at', [$start, $end])
-            ->with(['ownerWayBillFeeDetail', 'logistic', 'warehouseWeightUnit', 'originationCity', 'destinationCity']);
+            ->with(['province', 'logistic', 'city','unit']);
     }
 
     public function switchType($type)
@@ -47,24 +48,24 @@ class OwnerWaybillSettlementBillService implements \App\Interfaces\SettlementBil
         foreach ($details as $detail) {
             $results[] = [
                 $detail->logistic->name ?? '',
-                $detail->order_id ?? '',
-                $detail->recipient ?? '',
-                $detail->recipient_mobile ?? '',
-                $detail->warehouse_weight ?? '',
-                $detail->warehouseWeightUnit->name ?? '',
-                $detail->ownerWayBillFeeDetail->step ?? '',
-                $detail->ownerWayBillFeeDetail->ownerFeeDetail->province ?? '',
-                $detail->destination_city->name ?? '',
-                $detail->ownerWayBillFeeDetail->price ?? '',
-                $detail->ownerWayBillFeeDetail->delivery_fee ?? '',
-                $detail->pick_up_fee ?? '',
-                $detail->ownerWayBillFeeDetail->fuel_fee ?? '',
-                $detail->ownerWayBillFeeDetail->service_fee ?? '',
+                $detail->order_number ?? '',
+                $detail->recipient_name ?? '',
+                $detail->recipient_phone ?? '',
+                $detail->quantity ?? '',
+                $detail->unit->name ?? '',
+                $detail->interval ?? '',
+                $detail->province->name ?? '',
+                $detail->city->name ?? '',
+                $detail->price ?? '',
+                $detail->delivery_fee ?? '',
+                $detail->pick_fee ?? '',
+                $detail->fuel_fee ?? '',
+                $detail->info_fee ?? '',
                 $detail->other_fee ?? '',
-                $detail->dispatch_remark ?? '',
-                $detail->ownerWayBillFeeDetail->originate_fee ?? '',
-                $detail->ownerWayBillFeeDetail->originate_count ?? '',
-                $detail->ownerWayBillFeeDetail->ownerFeeDetail->logistic_fee ?? '',
+                $detail->remark ?? '',
+                $detail->initial_fee ?? '',
+                $detail->initial_amount ?? '',
+                $detail->total_fee ?? '',
             ];
         }
         return $results;
@@ -78,11 +79,13 @@ class OwnerWaybillSettlementBillService implements \App\Interfaces\SettlementBil
     public function getTotalFee($owner_id, $counting_month)
     {
         list($start, $end) = $this->getStartAndEnd($counting_month);
-        return DB::table('owner_way_bill_fee_details')
-            ->selectRaw("sum(owner_fee_details.logistic_fee) as fee,sum(owner_fee_details.logistic_tax_fee) as tax_fee")
-            ->leftJoin('owner_fee_details', 'owner_way_bill_fee_details.owner_fee_detail_id', '=', 'owner_fee_details.id')
-            ->whereBetween('owner_way_bill_fee_details.created_at', [$start, $end])
-            ->where('owner_fee_details.owner_id',$owner_id)
+        return OwnerFeeLogistic::query()
+            ->selectRaw("
+            sum(total_fee) as fee,
+            sum(tax_rate*total_fee) as tax_fee
+            ")
+            ->where('owner_id', $owner_id)
+            ->whereBetween('created_at', [$start, $end])
             ->first();
     }
 }

+ 4 - 1
app/Services/RoleService.php

@@ -25,7 +25,10 @@ class RoleService
     {
         $ids = array_column(DB::select(DB::raw("SELECT id_user FROM user_role WHERE id_role = ?"),[$roleId]),"id_user");
         foreach ($ids as $id){
-            if ($isAuthority)Cache::tags("authorities:user")->forget("authorities:user_".$id);
+            if ($isAuthority){
+                Cache::tags("AUTHORITY_MENU_MAPPING")->forget("am_mapping_".$id);
+                Cache::tags("authorities:user")->forget("authorities:user_".$id);
+            }
             if ($isOwner)Cache::forget("owners:user_".$id);
             if ($isUserWorkGroup)Cache::forget("userWorkGroups:user_".$id);
         }

+ 5 - 1
app/Services/StationTaskBatchService.php

@@ -194,6 +194,7 @@ class StationTaskBatchService
                     fetchGroup($toLocation, $taskMaterialBoxes, $groupPrefix);//执行料箱任务
                     break;
                 case 'OUTBIN-CACHE-SHELF'://缓存架
+                    $isFetchedFromRobotics = false;break;//21-8-17 暂时关闭缓存架
                     list($toLocation, $taskMaterialBoxes, $map) = $this->apportionLocation($taskMaterialBoxes);
                     if ($toLocation->count()>0){
                         $isFetchedFromRobotics = $this->foreignHaiRoboticsService->
@@ -297,7 +298,8 @@ class StationTaskBatchService
         $toLocation = collect();
         $updateTask = [["id","station_id"]];
         $insertTransaction = [];
-        $exeInsert = function ($task,$taskCommodity,$status)use(&$insertTransaction){
+        $dateTime = date("Y-m-d H:i:s");
+        $exeInsert = function ($task,$taskCommodity,$status)use(&$insertTransaction,$dateTime){
             $insertTransaction[] = [
                 "doc_code" => $taskCommodity->order->code ?? "",
                 "bar_code" => $taskCommodity->commodity->barcodes[0]->code ?? "",
@@ -310,6 +312,8 @@ class StationTaskBatchService
                 "status" => $status,
                 "mark" => 2,
                 "bin_number"=>$taskCommodity->bin_number,
+                "created_at"=>$dateTime,
+                "updated_at"=>$dateTime,
             ];
         };
         foreach ($handleTask as $index=>$task){

+ 1 - 0
app/Services/UserService.php

@@ -116,5 +116,6 @@ class UserService
         Cache::tags("authorities:user")->forget("authorities:user_".$user->id);
         Cache::forget("owners:user_".$user->id);
         Cache::forget("userWorkGroups:user_".$user->id);
+        Cache::tags("AUTHORITY_MENU_MAPPING")->forget("am_mapping_".$user->id);
     }
 }

+ 3 - 2
config/api_logistic.php

@@ -2,6 +2,7 @@
 return [
     'logistic' => [
         'ZTO' => 'ZTO',
+        'ZTO-1' => 'ZTO',
         'SF' => 'SF',
         'YUNDA' => 'YUNDA',
         'STO' => 'STO',
@@ -200,8 +201,8 @@ return [
             'smsNotify' => 'N', //短信通知  Y:需要 N: 不需要
             'passwordSigning' => 'N', //是否口令签收 仅适用于快递,Y:需要 N: 不需要;若为Y,必须收货人提供验证码给快递员才能签收,该服务是有偿的,具体费用请让我司收货营业部联系张宁(491407),请慎重使用!
             'uri' => [
-                'create_order' => 'http://dpsanbox.deppon.com/sandbox-web/dop-standard-ewborder/createOrderNotify.action',
-                'order_locus' => 'http://dpsanbox.deppon.com/sandbox-web/standard-order/newTraceQuery.action',
+                'create_order' => 'http://gwapi.deppon.com/dop-interface-async/standard-order/createOrderNotify.action',
+                'order_locus' => 'http://dpapi.deppon.com/dop-interface-sync/standard-query/newTraceQuery.action',
             ]
         ]
     ],

+ 12 - 0
database/factories/OrderPackageRemarkFactory.php

@@ -0,0 +1,12 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OrderPackageRemark;
+use Faker\Generator as Faker;
+
+$factory->define(OrderPackageRemark::class, function (Faker $faker) {
+    return [
+        //
+    ];
+});

+ 26 - 0
database/factories/OwnerFeeExpressFactory.php

@@ -0,0 +1,26 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerFeeExpress;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerFeeExpress::class, function (Faker $faker) {
+
+    $created_at = now()->subMonth()->startOfMonth()->addDays(random_int(1, 28));
+    return [
+        "province_id" => random_int(1, 30),
+        "logistic_id" => random_int(1, 10),
+        "logistic_number" => $faker->uuid,
+        "weight" => random_int(1, 100),
+        "initial_weight" => random_int(1, 100),
+        "initial_weight_price" => random_int(1, 100),
+        "additional_weight" => random_int(1, 100),
+        "additional_weight_amount" => random_int(1, 100),
+        "additional_weight_price" => random_int(1, 100),
+        "total_fee" => random_int(1, 100),
+        "tax_rate" => random_int(1, 100),
+        "created_at" => $created_at,
+        "owner_id" => random_int(1, 100),
+    ];
+});

+ 36 - 0
database/factories/OwnerFeeLogisticFactory.php

@@ -0,0 +1,36 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\Model;
+use App\OwnerFeeLogistic;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerFeeLogistic::class, function (Faker $faker) {
+    $interval = ['0-10000','10000-20000','20000-50000'];
+    $created_at = now()->subMonth()->startOfMonth()->addDays(random_int(1, 28));
+    return [
+        "province_id"=>random_int(1,10),
+        "owner_id"=>random_int(1,10),
+        "city_id"=>random_int(1,10),
+        "logistic_id"=>random_int(1,10),
+        "order_number"=>random_int(1000000,9999999),
+        "recipient_name"=>$faker->name,
+        "recipient_phone"=>$faker->phoneNumber,
+        "quantity"=>random_int(1,100),
+        "unit_id"=>random_int(1,5),
+        "interval"=>$faker->randomElement($interval),
+        "price"=>random_int(1,100),
+        "delivery_fee"=>random_int(1,100),
+        "pick_fee"=>random_int(1,100),
+        "fuel_fee"=>random_int(1,100),
+        "info_fee"=>random_int(1,100),
+        "other_fee"=>random_int(1,100),
+        "initial_fee"=>random_int(1,100),
+        "initial_amount"=>random_int(1,100),
+        "total_fee"=>random_int(1,100),
+        "tax_rate"=>random_int(1,100),
+        "remark"=>$faker->sentence,
+        "created_at"=>$created_at,
+    ];
+});

+ 32 - 0
database/migrations/2021_08_16_102229_change_province_to_province_id_to_owner_logistic_fee_reports_table.php

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

+ 34 - 0
database/migrations/2021_08_17_112816_add_column_model_id_to_owner_store_fee_reports_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnModelIdToOwnerStoreFeeReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_fee_reports', function (Blueprint $table) {
+            $table->integer('model_id')->comment('计费模型ID');
+            $table->integer('tax_fee')->comment('税费');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_fee_reports', function (Blueprint $table) {
+            $table->dropColumn('model_id');
+            $table->dropColumn('tax_fee');
+        });
+    }
+}

+ 34 - 0
database/migrations/2021_08_17_112924_add_column_model_id_to_owner_store_out_fee_reports_table.php

@@ -0,0 +1,34 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnModelIdToOwnerStoreOutFeeReportsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('owner_store_out_fee_reports', function (Blueprint $table) {
+            $table->integer('model_id')->comment('计费模型ID');
+            $table->integer('tax_fee')->comment('税费');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('owner_store_out_fee_reports', function (Blueprint $table) {
+            $table->dropColumn('model_id');
+            $table->dropColumn('tax_fee');
+        });
+    }
+}

+ 50 - 0
database/migrations/2021_08_18_111331_add_column_sync_routes_flag_to_order_packages_table.php

@@ -0,0 +1,50 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddColumnSyncRoutesFlagToOrderPackagesTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->boolean('sync_routes_flag')->default(false)->comment('是否有同步过信息');
+
+            $table->dropIndex('order_packages_sent_at_exception_index');
+            $table->dropIndex('order_packages_received_at_exception_index');
+            $table->dropIndex('order_packages_logistic_number_index');
+            $table->dropIndex('order_packages_sent_at_exception_type_owner_id_index');
+
+            $table->index(['sent_at','order_id','exception','exception_type','status','received_at','sync_routes_flag'],'order_packages_express_index');
+
+            $table->dropColumn('remark');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_packages', function (Blueprint $table) {
+            $table->dropColumn('sync_routes_flag');
+
+            $table->index(['sent_at', 'exception']);
+            $table->index(['received_at', 'exception']);
+            $table->index('logistic_number');
+            $table->index(['sent_at','exception_type','owner_id']);
+
+            $table->dropIndex('order_packages_express_index');
+
+            $table->text('remark')->comment('客服备注');
+        });
+    }
+}

+ 35 - 0
database/migrations/2021_08_18_141408_create_order_package_remarks_table.php

@@ -0,0 +1,35 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderPackageRemarksTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_package_remarks', function (Blueprint $table) {
+            $table->id();
+            $table->integer('order_package_id')->index();
+            $table->integer('user_id')->index();
+            $table->string('content')->comment('内容');
+            $table->softDeletes();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_package_remarks');
+    }
+}

+ 16 - 0
database/seeds/OrderPackageRemarkSeeder.php

@@ -0,0 +1,16 @@
+<?php
+
+use Illuminate\Database\Seeder;
+
+class OrderPackageRemarkSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        //
+    }
+}

+ 21 - 0
database/seeds/OwnerFeeExpressSeeder.php

@@ -0,0 +1,21 @@
+<?php
+
+use App\OwnerFeeExpress;
+use Illuminate\Database\Seeder;
+
+class OwnerFeeExpressSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        OwnerFeeExpress::query()->truncate();
+        $owners = \App\Owner::query()->limit(10)->get();
+        foreach ($owners as $owner) {
+            factory(OwnerFeeExpress::class)->times(100)->create(['owner_id' => $owner->id]);
+        }
+    }
+}

+ 21 - 0
database/seeds/OwnerFeeLogisticSeeder.php

@@ -0,0 +1,21 @@
+<?php
+
+use App\OwnerFeeLogistic;
+use Illuminate\Database\Seeder;
+
+class OwnerFeeLogisticSeeder extends Seeder
+{
+    /**
+     * Run the database seeds.
+     *
+     * @return void
+     */
+    public function run()
+    {
+        OwnerFeeLogistic::query()->truncate();
+        $owners = \App\Owner::query()->limit(10)->get();
+        foreach ($owners as $owner) {
+            factory(OwnerFeeLogistic::class)->times(100)->create(['owner_id' => $owner->id]);
+        }
+    }
+}

+ 1 - 2
database/seeds/SettlementBillSeeder.php

@@ -24,8 +24,7 @@ class SettlementBillSeeder extends Seeder
             //快递费合计
             SettlementBillExpressFeeReportSeeder::class,
             //快递费明细
-            SettlementBillExpressFeeDetailSeeder::class,
-
+            OwnerFeeExpressSeeder::class,
             //入库费明细
             OwnerStoreFeeDetailSeeder::class,
             //入库费合计

+ 2 - 2
resources/js/lodop/myPrintKit.js

@@ -264,7 +264,7 @@ function printTest(items ='') {
         printOrder.totalCharge = item.charge;
         printOrder.insuranceMoney = 0; //保价
         printOrder.signSheet = item.back_sign_bill ? (item.back_sign_bill == 1 ? '签收单原件返回' : '电子签收单' ) : '无需返单';
-        printOrder.outerField1 = ''; //受理部门
+        printOrder.outerField1 = '上海松江区泗泾泗砖公路营业部'; //受理部门
         printOrder.lastOutLoadOrgName = item.arrived_org_simple_name??'';  //最终外场
         printOrder.departCityName = '上海市'; //原寄地
         printOrder.secondLoadOrgName = '';  //第二外场
@@ -276,7 +276,7 @@ function printTest(items ='') {
         printOrder.billTime = item.order.created_at;
         printOrder.cargoCount = item.total_number;
         printOrder.reciveLoanAccount = ''; //代收账号
-        printOrder.printSerialNos = ''; //流水号
+        printOrder.printSerialNos = '0001'; //流水号
         printOrder.isHideWareHouse = '';
         printOrder.originalNumber = '';
         printList.push(printOrder);

+ 29 - 21
resources/js/queryForm/queryForm.js

@@ -85,10 +85,11 @@ const query = function getQueryForm(data) {
         addHiedDiv();
         rendererSearchForm();
         visibleClearBtn();
-        parentNodeFloat();
+        fixed();
         inputKeyDown();
         selectChange();
         createTip();
+        fixed();
         $('[data-toggle="tooltip"]').tooltip({'trigger': 'hover'})
     }
 
@@ -111,31 +112,38 @@ const query = function getQueryForm(data) {
         return _toggle_btn;
      }
 
+    function fixed(){
+       _parentNode.addClass('header-float');
+       _parentNode.css('top',0);
+    }
+
     // form fixed
     function parentNodeFloat() {
         _parentNode_top = _parentNode.offset().top;
         let height = _parentNode.height();
         let dom = _this.appendDom ? $("#" + _this.appendDom + "") : null;
-        $(window).scroll(function () {
-            let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
-            if(isSmallScreen()){
-                return;
-            }
-            if (scrollTop > _parentNode_top) {
-                _form.addClass('fixed-top');
-                if (dom) {
-                    dom.css('position', 'fixed');
-                    dom.css('background', 'rgb(255, 255, 255)');
-                    dom.css('top', height);
-                    dom.css('z-index', 1000);
-                }
-            } else {
-                _form.removeClass('fixed-top');
-                if (dom) {
-                    dom.attr('style', '');
-                }
-            }
-        });
+
+
+        // $(window).scroll(function () {
+        //     let scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
+        //     if(isSmallScreen()){
+        //         return;
+        //     }
+        //     if (scrollTop > _parentNode_top) {
+        //         _form.addClass('fixed-top');
+        //         if (dom) {
+        //             dom.css('position', 'fixed');
+        //             dom.css('background', 'rgb(255, 255, 255)');
+        //             dom.css('top', height);
+        //             dom.css('z-index', 1000);
+        //         }
+        //     } else {
+        //         _form.removeClass('fixed-top');
+        //         if (dom) {
+        //             dom.attr('style', '');
+        //         }
+        //     }
+        // });
     }
 
     // add  hide div (on submit form )

+ 211 - 128
resources/views/control/panel.blade.php

@@ -156,25 +156,27 @@
                     <div class="card">
                         <div class="card-header">
                             <div class="block row">
-                                    <span class="demonstration"></span>
-                                    <el-date-picker
-                                        size="small"
-                                        style="width: 60%;"
-                                        @blur="logisticsCountingRecordsApi()"
-                                        v-model="logisticsCountingRecordsData"
-                                        type="daterange"
-                                        align="right"
-                                        unlink-panels
-                                        range-separator="-"
-                                        start-placeholder="开始日期"
-                                        end-placeholder="结束日期"
-                                        value-format="yyyy-MM-dd"
-                                        :picker-options="pickerOptions">
-                                    </el-date-picker>
-                                    <el-select  placeholder="请选择对应货主" multiple v-model="selectLogisticsOwners" size="small" style="width: 50%"  @change="logisticsCountingRecordsApi('')">
-                                        <el-option label="选择所有" value="all"></el-option>
-                                        <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
-                                    </el-select>
+                                <span class="demonstration"></span>
+                                <el-date-picker
+                                    size="small"
+                                    style="width: 60%;"
+                                    @blur="logisticsCountingRecordsApi()"
+                                    v-model="logisticsCountingRecordsData"
+                                    type="daterange"
+                                    align="right"
+                                    unlink-panels
+                                    range-separator="-"
+                                    start-placeholder="开始日期"
+                                    end-placeholder="结束日期"
+                                    value-format="yyyy-MM-dd"
+                                    :picker-options="pickerOptions">
+                                </el-date-picker>
+                                <el-select placeholder="请选择对应货主" multiple v-model="selectLogisticsOwners" size="small"
+                                           style="width: 50%" @change="logisticsCountingRecordsApi('')">
+                                    <el-option label="选择所有" value="all"></el-option>
+                                    <el-option v-for="item in owners" :label="item.name" :value="item.id"
+                                               :key="item.id"></el-option>
+                                </el-select>
                             </div>
                         </div>
                         <div class="card-body row">
@@ -205,7 +207,7 @@
                             </div>
                         </div>
                         <div class="card-body row">
-                            <div  id="warehouseCountingRecords" class="col-12"
+                            <div id="warehouseCountingRecords" class="col-12"
                                  style=min-height:500px;"></div>
 
                         </div>
@@ -302,6 +304,16 @@
                                                    v-model="laborReportsCountingRecordUnit">年
                                         </el-button>
                                     </div>
+
+                                    <div class="ml-2">
+                                        <el-select placeholder="请选择对应仓库组" multiple v-model="selectUserGroups"
+                                                   size="small"
+                                                   @change="laborReportsCountingRecordApi('')">
+                                            <el-option label="选择所有" value="all"></el-option>
+                                            <el-option v-for="item in userWorkgroups" :label="item.name" :value="item.id"
+                                                       :key="item.id"></el-option>
+                                        </el-select>
+                                    </div>
                                 </div>
                             </div>
                             <div class="card-body row">
@@ -330,7 +342,7 @@
                                 </el-date-picker>
                             </div>
                             <div class="card-body row">
-                                <div  id="laborReportsUserGroupsCount"
+                                <div id="laborReportsUserGroupsCount"
                                      class="col-12"
                                      style="min-height:500px;"></div>
                             </div>
@@ -340,33 +352,35 @@
             </div>
             <div class="row my-3">
                 @can("控制台-称重统计")
-                <div class="col-6">
-                    <div class="card">
-                        <div class="card-header">
-                            <div class="row">
-                                <el-date-picker size="small" class="col-4 date" @blur="loadWeightInfo()"
-                                                type="daterange" align="right"
-                                                v-model="searchOption.weightDate" unlink-panels range-separator="-"
-                                                start-placeholder="开始日期" end-placeholder="结束日期"
-                                                value-format="yyyy-MM-dd">
-                                </el-date-picker>
-                                <label class="col-3">
-                                    <select class="form-control rounded" v-model="searchOption.weightSelect"
-                                            @change="switchWeightDate()">
-                                        <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
-                                    </select>
-                                </label>
-                                <el-select class="col-3"  placeholder="请选择对应货主" multiple v-model="selectWeightOwners" size="small" style="width: 50%"  @change="loadWeightInfo()">
-                                    <el-option label="选择所有" value="all"></el-option>
-                                    <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
-                                </el-select>
+                    <div class="col-6">
+                        <div class="card">
+                            <div class="card-header">
+                                <div class="row">
+                                    <el-date-picker size="small" class="col-4 date" @blur="loadWeightInfo()"
+                                                    type="daterange" align="right"
+                                                    v-model="searchOption.weightDate" unlink-panels range-separator="-"
+                                                    start-placeholder="开始日期" end-placeholder="结束日期"
+                                                    value-format="yyyy-MM-dd">
+                                    </el-date-picker>
+                                    <label class="col-3">
+                                        <select class="form-control rounded" v-model="searchOption.weightSelect"
+                                                @change="switchWeightDate()">
+                                            <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
+                                        </select>
+                                    </label>
+                                    <el-select class="col-3" placeholder="请选择对应货主" multiple v-model="selectWeightOwners"
+                                               size="small" style="width: 50%" @change="loadWeightInfo()">
+                                        <el-option label="选择所有" value="all"></el-option>
+                                        <el-option v-for="item in owners" :label="item.name" :value="item.id"
+                                                   :key="item.id"></el-option>
+                                    </el-select>
+                                </div>
+                            </div>
+                            <div class="card-body row">
+                                <div id="weight" class="col-12" style="min-height: 500px"></div>
                             </div>
-                        </div>
-                        <div class="card-body row">
-                            <div id="weight" class="col-12" style="min-height: 500px"></div>
                         </div>
                     </div>
-                </div>
                 @endcan
                 {{--异常分布图--}}
                 <div class="col-6">
@@ -375,13 +389,17 @@
                             <div class="flex-column">
                                 <el-date-picker size="small" class="col-6 date" @blur="loadExceptionTypeInfo()"
                                                 type="daterange" align="right"
-                                                v-model="searchOption.exceptionTypeDate" unlink-panels range-separator="-"
+                                                v-model="searchOption.exceptionTypeDate" unlink-panels
+                                                range-separator="-"
                                                 start-placeholder="开始日期" end-placeholder="结束日期"
                                                 value-format="yyyy-MM-dd">
                                 </el-date-picker>
-                                <el-select class="col-3"  placeholder="请选择对应货主" multiple v-model="selectExceptionTypeOwners" size="small" style="width: 20%"  @change="loadExceptionTypeInfo()">
+                                <el-select class="col-3" placeholder="请选择对应货主" multiple
+                                           v-model="selectExceptionTypeOwners" size="small" style="width: 20%"
+                                           @change="loadExceptionTypeInfo()">
                                     <el-option label="选择所有" value="all"></el-option>
-                                    <el-option v-for="item in owners" :label="item.name" :value="item.id" :key="item.id"></el-option>
+                                    <el-option v-for="item in owners" :label="item.name" :value="item.id"
+                                               :key="item.id"></el-option>
                                 </el-select>
                                 <label class="col-3 ">
                                     <select class="form-control rounded" v-model="searchOption.exceptionTypeSelect"
@@ -403,14 +421,17 @@
                     <div class="card">
                         <div class="card-header">
                             <div class="row">
-                                <el-date-picker size="small" class="col-6 date" @blur="loadOrderPackageReceivedSyncRecordInfo()"
+                                <el-date-picker size="small" class="col-6 date"
+                                                @blur="loadOrderPackageReceivedSyncRecordInfo()"
                                                 type="daterange" align="right"
-                                                v-model="searchOption.OrderPackageReceivedSyncRecordDate" unlink-panels range-separator="-"
+                                                v-model="searchOption.OrderPackageReceivedSyncRecordDate" unlink-panels
+                                                range-separator="-"
                                                 start-placeholder="开始日期" end-placeholder="结束日期"
                                                 value-format="yyyy-MM-dd">
                                 </el-date-picker>
                                 <label class="col-3 offset-3">
-                                    <select class="form-control rounded" v-model="searchOption.OrderPackageReceivedSyncRecordSelect"
+                                    <select class="form-control rounded"
+                                            v-model="searchOption.OrderPackageReceivedSyncRecordSelect"
                                             @change="switchOrderPackageReceivedSyncRecordDate()">
                                         <option v-for="(date,i) in dateOptions" :value="i">@{{ date.text }}</option>
                                     </select>
@@ -434,22 +455,25 @@
             el: "#list",
             data: {
                 myChart: null,
-                menus:{!! $menus !!},
-                owners:{!! $owners !!},
+                menus: {!! $menus !!},
+                owners: {!! $owners !!},
+                userWorkgroups: {!! $userWorkgroups !!},
                 selectOrderOwners: [],
+                selectUserGroups: [],
                 selectLogisticsOwners: [],
                 selectWeightOwners: [],
                 selectExceptionTypeOwners: [],
-                warehousesOrders:{!! $warehousesOrders !!},
-                orderCountingRecords:{},
-                logisticsCountingRecords:{},
-                warehouseCountingRecords:{},
-                laborReportsCountingRecords:{},
-                laborReportsUserGroupsCount:{},
+                warehousesOrders: {!! $warehousesOrders !!},
+                orderCountingRecords: {},
+                logisticsCountingRecords: {},
+                warehouseCountingRecords: {},
+                laborReportsCountingRecords: {},
+                laborReportsUserGroupsCount: {},
                 warehouses: {
                     "WH01": '松江一仓',
                     "WH02": '松江二仓',
-                    "WH03": '嘉定一仓',},
+                    "WH03": '嘉定一仓',
+                },
                 totalOrders: {
                     total: null,
                     createOrder: null,
@@ -489,16 +513,52 @@
                         }
                     }]
                 },
-                dateOptions:[{text:'当天',start:moment().format('yyyy-MM-DD'),end:moment().format('yyyy-MM-DD')},
-                    {text:"昨天",start:moment().subtract("1","day").format('yyyy-MM-DD'),end:moment().subtract("1","day").format('yyyy-MM-DD')},
-                    {text:"本周",start:moment().weekday(1).format('yyyy-MM-DD'),end:moment().weekday(7).format('yyyy-MM-DD')},
-                    {text:"上周",start:moment().weekday(-6).format('yyyy-MM-DD'),end:moment().weekday(0).format('yyyy-MM-DD')},
-                    {text:"本月",start:moment().startOf("month").format('yyyy-MM-DD'),end:moment().endOf("month").format('yyyy-MM-DD')},
-                    {text:"上月",start:moment().month(moment().month() - 1).startOf('month').format('yyyy-MM-DD'),end:moment().month(moment().month() - 1).endOf('month').format('yyyy-MM-DD')},
-                    {text:"本季度",start:moment(moment().quarter(moment().quarter()).startOf('quarter').valueOf()).format('yyyy-MM-DD'),end:moment(moment().quarter(moment().quarter()).endOf('quarter').valueOf()).format('yyyy-MM-DD')},
-                    {text:"上季度",start:moment(moment().quarter(moment().quarter() - 1).startOf('quarter').valueOf()).format('yyyy-MM-DD'),end:moment(moment().quarter(moment().quarter() - 1).endOf('quarter').valueOf()).format('yyyy-MM-DD')},
-                    {text:"本年",start:moment(moment().year(moment().year()).startOf('year').valueOf()).format('yyyy-MM-DD'),end:moment(moment().year(moment().year()).endOf('year').valueOf()).format('yyyy-MM-DD')},
-                    {text:"去年",start:moment(moment().year(moment().year() - 1).startOf('year').valueOf()).format('yyyy-MM-DD'),end:moment(moment().year(moment().year() - 1).endOf('year').valueOf()).format('yyyy-MM-DD')}],
+                dateOptions: [{text: '当天', start: moment().format('yyyy-MM-DD'), end: moment().format('yyyy-MM-DD')},
+                    {
+                        text: "昨天",
+                        start: moment().subtract("1", "day").format('yyyy-MM-DD'),
+                        end: moment().subtract("1", "day").format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "本周",
+                        start: moment().weekday(1).format('yyyy-MM-DD'),
+                        end: moment().weekday(7).format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "上周",
+                        start: moment().weekday(-6).format('yyyy-MM-DD'),
+                        end: moment().weekday(0).format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "本月",
+                        start: moment().startOf("month").format('yyyy-MM-DD'),
+                        end: moment().endOf("month").format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "上月",
+                        start: moment().month(moment().month() - 1).startOf('month').format('yyyy-MM-DD'),
+                        end: moment().month(moment().month() - 1).endOf('month').format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "本季度",
+                        start: moment(moment().quarter(moment().quarter()).startOf('quarter').valueOf()).format('yyyy-MM-DD'),
+                        end: moment(moment().quarter(moment().quarter()).endOf('quarter').valueOf()).format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "上季度",
+                        start: moment(moment().quarter(moment().quarter() - 1).startOf('quarter').valueOf()).format('yyyy-MM-DD'),
+                        end: moment(moment().quarter(moment().quarter() - 1).endOf('quarter').valueOf()).format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "本年",
+                        start: moment(moment().year(moment().year()).startOf('year').valueOf()).format('yyyy-MM-DD'),
+                        end: moment(moment().year(moment().year()).endOf('year').valueOf()).format('yyyy-MM-DD')
+                    },
+                    {
+                        text: "去年",
+                        start: moment(moment().year(moment().year() - 1).startOf('year').valueOf()).format('yyyy-MM-DD'),
+                        end: moment(moment().year(moment().year() - 1).endOf('year').valueOf()).format('yyyy-MM-DD')
+                    }],
                 logisticsCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
                     moment(new Date()).format('yyyy-MM-DD')],
                 warehouseCountingRecordsData: [moment().subtract('1', 'month').format('yyyy-MM-DD'),
@@ -538,32 +598,40 @@
                 laborReportsCountingRecordsYearShow: false,
                 laborReportsCountingRecordsStart: moment().subtract('1', 'month').format('yyyy-MM-DD'),
                 laborReportsCountingRecordsEnd: moment(new Date()).format('yyyy-MM-DD'),
-                cardPool:{},
-                searchOption:{
-                    weightDate:[],
+                cardPool: {},
+                searchOption: {
+                    weightDate: [],
                     exceptionTypeDate: [],
-                    weightSelect:"",
-                    exceptionTypeSelect:"",
+                    weightSelect: "",
+                    exceptionTypeSelect: "",
                     OrderPackageReceivedSyncRecordDate: [],
-                    OrderPackageReceivedSyncRecordSelect:"",
+                    OrderPackageReceivedSyncRecordSelect: "",
                 },
             },
-            watch:{
-                selectOrderOwners:function(val,oldval){
-                    let newindex =  val.indexOf('all');
-                    let   oldindex =  oldval.indexOf('all');
-                    if(newindex!=-1 && oldindex==-1 && val.length>1)
-                        this.selectOrderOwners=['all'];
-                    else if(newindex!=-1 && oldindex!=-1 && val.length>1)
-                        this.selectOrderOwners.splice(val.indexOf('all'),1)
+            watch: {
+                selectOrderOwners: function (val, oldval) {
+                    let newindex = val.indexOf('all');
+                    let oldindex = oldval.indexOf('all');
+                    if (newindex != -1 && oldindex == -1 && val.length > 1)
+                        this.selectOrderOwners = ['all'];
+                    else if (newindex != -1 && oldindex != -1 && val.length > 1)
+                        this.selectOrderOwners.splice(val.indexOf('all'), 1)
                 },
-                selectLogisticsOwners:function(val,oldval){
-                    let newindex =  val.indexOf('all');
-                    let   oldindex =  oldval.indexOf('all');
-                    if(newindex!=-1 && oldindex==-1 && val.length>1)
-                        this.selectLogisticsOwners=['all'];
-                    else if(newindex!=-1 && oldindex!=-1 && val.length>1)
-                        this.selectLogisticsOwners.splice(val.indexOf('all'),1)
+                selectUserGroups: function (val, oldval) {
+                    let newindex = val.indexOf('all');
+                    let oldindex = oldval.indexOf('all');
+                    if (newindex != -1 && oldindex == -1 && val.length > 1)
+                        this.selectUserGroups = ['all'];
+                    else if (newindex != -1 && oldindex != -1 && val.length > 1)
+                        this.selectUserGroups.splice(val.indexOf('all'), 1)
+                },
+                selectLogisticsOwners: function (val, oldval) {
+                    let newindex = val.indexOf('all');
+                    let oldindex = oldval.indexOf('all');
+                    if (newindex != -1 && oldindex == -1 && val.length > 1)
+                        this.selectLogisticsOwners = ['all'];
+                    else if (newindex != -1 && oldindex != -1 && val.length > 1)
+                        this.selectLogisticsOwners.splice(val.indexOf('all'), 1)
                 }
             },
             mounted() {
@@ -598,7 +666,7 @@
                 this.warehouseCountingRecordsApi();
 
                 @can('人事管理-临时工报表-可见全部组')
-                this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
+                    this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
                 this.initLaborReportsCountingRecordsChart();
                 this.laborReportsCountingRecordApi('日');
 
@@ -607,11 +675,11 @@
                 this.laborReportsUserGroupsCountApi();
                 @endcan
 
-                @can("控制台-称重统计")
-                this.cardPool.weight = echarts.init(document.getElementById("weight"));
+                    @can("控制台-称重统计")
+                    this.cardPool.weight = echarts.init(document.getElementById("weight"));
                 this.loadWeightInfo();
                 @endcan
-                this.cardPool.orderPackageReceivedSyncRecord = echarts.init(document.getElementById("orderPackageReceivedSyncRecord"));
+                    this.cardPool.orderPackageReceivedSyncRecord = echarts.init(document.getElementById("orderPackageReceivedSyncRecord"));
                 this.loadOrderPackageReceivedSyncRecordInfo();
                 this.cardPool.exceptionType = echarts.init(document.getElementById("exceptionType"));
                 this.loadExceptionTypeInfo();
@@ -926,6 +994,7 @@
                     formData.append('start', this.laborReportsCountingRecordsStart);
                     formData.append('end', this.laborReportsCountingRecordsEnd);
                     formData.append('unit', laborReportsCountingRecordUnit);
+                    formData.append('user_workgroup_ids', this.selectUserGroups);
                     let _this = this;
                     axios.post('{{url('apiLocal/control/panel/menu/laborReportsCountingRecordApi')}}', formData).then(function (res) {
                         if (res.status === 200) {
@@ -952,22 +1021,26 @@
                         }
                     });
                 },
-                loadWeightInfo(){
+                loadWeightInfo() {
                     window.tempTip.setDuration(3000);
-                    if (!this.searchOption.weightDate[0]){
+                    if (!this.searchOption.weightDate[0]) {
                         window.tempTip.show("开始时间未选择");
                         return;
                     }
-                    if (!this.searchOption.weightDate[1]){
+                    if (!this.searchOption.weightDate[1]) {
                         window.tempTip.show("结束时间未选择");
                         return;
                     }
-                    this.cardPool.weight.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
+                    this.cardPool.weight.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
                     let url = "{{url('apiLocal/control/panel/menu/weightApi')}}";
-                    let params = {start:this.searchOption.weightDate[0],end:this.searchOption.weightDate[1],owner_ids:this.selectWeightOwners};
-                    window.tempTip.postBasicRequest(url,params,res=>{
+                    let params = {
+                        start: this.searchOption.weightDate[0],
+                        end: this.searchOption.weightDate[1],
+                        owner_ids: this.selectWeightOwners
+                    };
+                    window.tempTip.postBasicRequest(url, params, res => {
                         this.cardPool.weight.hideLoading();
-                        let myechart = this.cardPool.weight, option = this._setWeightData(res.title,res.data);
+                        let myechart = this.cardPool.weight, option = this._setWeightData(res.title, res.data);
                         myechart.on('updateAxisPointer', function (event) {
                             var xAxisInfo = event.axesInfo[0];
                             if (xAxisInfo) {
@@ -989,60 +1062,70 @@
                         myechart.setOption(option);
                     });
                 },
-                loadOrderPackageReceivedSyncRecordInfo(){
+                loadOrderPackageReceivedSyncRecordInfo() {
                     window.tempTip.setDuration(3000);
-                    if (!this.searchOption.OrderPackageReceivedSyncRecordDate[0]){
+                    if (!this.searchOption.OrderPackageReceivedSyncRecordDate[0]) {
                         window.tempTip.show("开始时间未选择");
                         return;
                     }
-                    if (!this.searchOption.OrderPackageReceivedSyncRecordDate[1]){
+                    if (!this.searchOption.OrderPackageReceivedSyncRecordDate[1]) {
                         window.tempTip.show("结束时间未选择");
                         return;
                     }
-                    this.cardPool.orderPackageReceivedSyncRecord.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
+                    this.cardPool.orderPackageReceivedSyncRecord.showLoading('default', {
+                        text: "加 载 中",
+                        color: '#C0C0C0'
+                    });
                     let url = "{{url('apiLocal/control/panel/menu/orderPackageReceivedSyncRecordApi')}}";
-                    let params = {start:this.searchOption.OrderPackageReceivedSyncRecordDate[0],end:this.searchOption.OrderPackageReceivedSyncRecordDate[1]};
-                    window.tempTip.postBasicRequest(url,params,res=>{
+                    let params = {
+                        start: this.searchOption.OrderPackageReceivedSyncRecordDate[0],
+                        end: this.searchOption.OrderPackageReceivedSyncRecordDate[1]
+                    };
+                    window.tempTip.postBasicRequest(url, params, res => {
                         this.cardPool.orderPackageReceivedSyncRecord.hideLoading();
                         this.cardPool.orderPackageReceivedSyncRecord.setOption(this._setOrderPackageReceivedSyncRecordData(res.title, res.data));
                     });
                 },
                 loadExceptionTypeInfo() {
                     window.tempTip.setDuration(3000);
-                    if (!this.searchOption.exceptionTypeDate[0]){
+                    if (!this.searchOption.exceptionTypeDate[0]) {
                         window.tempTip.show("开始时间未选择");
                         return;
                     }
-                    if (!this.searchOption.exceptionTypeDate[1]){
+                    if (!this.searchOption.exceptionTypeDate[1]) {
                         window.tempTip.show("结束时间未选择");
                         return;
                     }
-                    this.cardPool.exceptionType.showLoading('default',{text:"加 载 中",color:'#C0C0C0'});
+                    this.cardPool.exceptionType.showLoading('default', {text: "加 载 中", color: '#C0C0C0'});
                     let url = "{{url('apiLocal/control/panel/menu/exceptionTypeApi')}}";
-                    let params = {start:this.searchOption.exceptionTypeDate[0],end:this.searchOption.exceptionTypeDate[1],owner_ids:this.selectExceptionTypeOwners};
-                    window.tempTip.postBasicRequest(url,params,res=>{
+                    let params = {
+                        start: this.searchOption.exceptionTypeDate[0],
+                        end: this.searchOption.exceptionTypeDate[1],
+                        owner_ids: this.selectExceptionTypeOwners
+                    };
+                    window.tempTip.postBasicRequest(url, params, res => {
                         this.cardPool.exceptionType.hideLoading();
                         this.cardPool.exceptionType.setOption(this._setExceptionTypeData(res.data));
                     });
                 },
-                switchWeightDate(){
+                switchWeightDate() {
                     let obj = this.dateOptions[this.searchOption.weightSelect];
-                    this.searchOption.weightDate = [obj.start,obj.end];
+                    this.searchOption.weightDate = [obj.start, obj.end];
                     this.loadWeightInfo();
                 },
-                switchOrderPackageReceivedSyncRecordDate(){
+                switchOrderPackageReceivedSyncRecordDate() {
                     let obj = this.dateOptions[this.searchOption.OrderPackageReceivedSyncRecordSelect];
-                    this.searchOption.OrderPackageReceivedSyncRecordDate = [obj.start,obj.end];
+                    this.searchOption.OrderPackageReceivedSyncRecordDate = [obj.start, obj.end];
                     this.loadOrderPackageReceivedSyncRecordInfo();
                 },
-                switchExceptionTypeDate(){
+                switchExceptionTypeDate() {
                     let obj = this.dateOptions[this.searchOption.exceptionTypeSelect];
-                    this.searchOption.exceptionTypeDate = [obj.start,obj.end];
+                    this.searchOption.exceptionTypeDate = [obj.start, obj.end];
                     this.loadExceptionTypeInfo();
                 },
-                _setWeightData(title, data){
-                    let temp = [],len = data.length -1;
-                    for (let i=0; i < len; i++){
+                _setWeightData(title, data) {
+                    let temp = [], len = data.length - 1;
+                    for (let i = 0; i < len; i++) {
                         temp.push({type: 'line', smooth: true, seriesLayoutBy: 'row', emphasis: {focus: 'series'}});
                     }
                     temp.push({
@@ -1052,7 +1135,7 @@
                         center: ['50%', '32%'],
                         emphasis: {focus: 'data'},
                         label: {
-                            formatter: '{b}: {@'+title+'} ({d}%)'
+                            formatter: '{b}: {@' + title + '} ({d}%)'
                         },
                         encode: {
                             itemName: 'product',
@@ -1061,7 +1144,7 @@
                         }
                     });
                     console.log(temp)
-                   return {
+                    return {
                         legend: {},
                         tooltip: {
                             trigger: 'axis',
@@ -1076,7 +1159,7 @@
                         series: temp
                     };
                 },
-                _setOrderPackageReceivedSyncRecordData(title,data){
+                _setOrderPackageReceivedSyncRecordData(title, data) {
                     return {
                         title: {
                             text: '快递信息同步成功失败占比',
@@ -1085,7 +1168,7 @@
                         tooltip: {
                             trigger: 'item',
                             formatter: function (params) {
-                                return params.data.date + "<br>" + "总量:<span class='text-success font-weight-bold'>" + params.data.total + "</span><br>" + "成功:<span class='text-info font-weight-bold'>" + params.data.count + "</span><br>"+ "承运商:<span class='text-info font-weight-bold'>" + params.data.logistic_name + "</span>";
+                                return params.data.date + "<br>" + "总量:<span class='text-success font-weight-bold'>" + params.data.total + "</span><br>" + "成功:<span class='text-info font-weight-bold'>" + params.data.count + "</span><br>" + "承运商:<span class='text-info font-weight-bold'>" + params.data.logistic_name + "</span>";
                             }
                         }, xAxis: {
                             data: title
@@ -1114,8 +1197,8 @@
                     let resData = [];
                     data.forEach(item => {
                         resData.push({
-                            value:item.count,
-                            name:item.exception_type
+                            value: item.count,
+                            name: item.exception_type
                         })
                     })
                     return {

+ 5 - 5
resources/views/finance/settlementBills/expressFee/detail/index.blade.php

@@ -63,13 +63,13 @@
                 details: [
                         @foreach($details as $detail){
                         id: " {!! $detail['id'] !!}",
-                        logistic_name: " {!! $detail['logistic_name'] !!}",
-                        province: " {!! $detail['province'] !!}",
-                        logistic_bill: "{!! $detail['logistic_bill'] !!}",
+                        logistic_name: " {!! $detail['logistic']['name'] !!}",
+                        province: " {!! $detail['province']['name'] !!}",
+                        logistic_bill: "{!! $detail['logistic_number'] !!}",
                         weight: "{!! $detail['weight'] !!}",
-                        logistic_fee: "{!! $detail['logistic_fee'] !!}",
+                        logistic_fee: "{!! $detail['total_fee'] !!}",
                         initial_weight_price: "{!! $detail['initial_weight_price'] !!}",
-                        additional_price: "{!! $detail['additional_price'] !!}",},
+                        additional_price: "{!! $detail['additional_weight_price'] !!}",},
                     @endforeach
                 ],
                 owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],

+ 1 - 1
resources/views/finance/settlementBills/expressFee/report/index.blade.php

@@ -86,7 +86,7 @@
                         :rowspan="calRowspan(report.logistic.name)" class="text-center pt-4 bg-light">@{{
                         report.logistic.name }}
                     </td>
-                    <td>@{{ report.province }}</td>
+                    <td>@{{ report.province.name }}</td>
                     <td>@{{ report.initial_weight }}</td>
                     <td>@{{ report.initial_amount }}</td>
                     <td>@{{ report.additional_weight }}</td>

+ 9 - 0
resources/views/finance/settlementBills/indemnityFee/index.blade.php

@@ -26,6 +26,15 @@
                                 class="text-muted">货主</p></span>
                     </div>
                 </div>
+                <div class="col-3">
+                    <div class="row pt-2">
+                        <span class="fa fa-jpy fa-4x offset-md-3" style="color: #2ca02c;opacity: 0.3"></span>
+                        <span class="ml-4 mt-2">
+                        <h5 class="font-weight-bold">{{ $totalFee }}</h5>
+                        <p class="text-muted">总金额</p>
+                        </span>
+                    </div>
+                </div>
                 <div v-if="(isArchived===1)" class="col-3">
                     <div class="row pt-2">
                         <span class="fa fa-check-circle  fa-4x offset-md-3" aria-hidden="true"

+ 18 - 18
resources/views/finance/settlementBills/logisticFee/index.blade.php

@@ -58,24 +58,24 @@
                     <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
                     <td>@{{ i+1 }}</td>
                     <td>@{{ detail.logistic?detail.logistic.name:'' }}</td>
-                    <td>@{{ detail.order_id }}</td>
-                    <td>@{{ detail.recipient }}</td>
-                    <td>@{{ detail.recipient_mobile }}</td>
-                    <td>@{{ detail.warehouse_weight }}</td>
-                    <td>@{{ detail.warehouse_weight_unit.name }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.step }}</td>
-                    <td>@{{ detail.destination }}</td>
-                    <td>@{{ detail.destination_city.name }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.price }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.delivery_fee }}</td>
-                    <td>@{{ detail.pick_up_fee }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.fuel_fee }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.service_fee }}</td>
+                    <td>@{{ detail.order_number }}</td>
+                    <td>@{{ detail.recipient_name }}</td>
+                    <td>@{{ detail.recipient_phone }}</td>
+                    <td>@{{ detail.quantity }}</td>
+                    <td>@{{ detail.unit.name }}</td>
+                    <td>@{{ detail.interval }}</td>
+                    <td>@{{ detail.province.name }}</td>
+                    <td>@{{ detail.city.name }}</td>
+                    <td>@{{ detail.price }}</td>
+                    <td>@{{ detail.delivery_fee }}</td>
+                    <td>@{{ detail.pick_fee }}</td>
+                    <td>@{{ detail.fuel_fee }}</td>
+                    <td>@{{ detail.info_fee }}</td>
                     <td>@{{ detail.other_fee }}</td>
-                    <td>@{{ detail.dispatch_remark }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.originate_fee }}</td>
-                    <td>@{{ detail.owner_way_bill_fee_detail.originate_count }}</td>
-                    <td>@{{ detail.fee }}</td>
+                    <td>@{{ detail.remark }}</td>
+                    <td>@{{ detail.initial_fee }}</td>
+                    <td>@{{ detail.initial_amount }}</td>
+                    <td>@{{ detail.total_fee }}</td>
                 </tr>
             </table>
             <div class="text-info h5 btn btn">{{$details->count()}}/{{$details->total()}}</div>
@@ -93,7 +93,7 @@
             el: "#list",
             data: {
                 owner: {!! $owner !!},
-                details: [@foreach($details as $detail){!! $detail !!}, @endforeach],
+                details: [@foreach($details as $detail){!! $detail !!},@endforeach],
                 owners: [@foreach($owners as $owner){name: '{{ $owner->id }}', value: '{{ $owner->name}}'},@endforeach],
                 isArchived: {!! $isArchived !!},
                 request: {!! $request !!},

+ 9 - 0
resources/views/finance/settlementBills/packingMaterialFee/index.blade.php

@@ -27,6 +27,15 @@
                         <span class="ml-4 mt-2"><h5 class="font-weight-bold">{{ $owner->name }}</h5><p class="text-muted">货主</p></span>
                     </div>
                 </div>
+                <div class="col-3">
+                    <div class="row pt-2">
+                        <span class="fa fa-jpy fa-4x offset-md-3" style="color: #2ca02c;opacity: 0.3"></span>
+                        <span class="ml-4 mt-2">
+                        <h5 class="font-weight-bold">{{ $total_fee }}</h5>
+                        <p class="text-muted">总金额</p>
+                        </span>
+                    </div>
+                </div>
                 <div  v-if="(isArchived===1)" class="col-3">
                     <div class="row pt-2">
                         <span  class="fa fa-check-circle  fa-4x offset-md-3" aria-hidden="true" style="color: #4c2584;opacity: 0.3"></span>

+ 21 - 9
resources/views/finance/settlementBills/storeFee/detail/index.blade.php

@@ -35,15 +35,27 @@
                     :class="selectTr===i+1?'focusing' : ''">
                     <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
                     <td>@{{ i+1 }}</td>
-                    <td>@{{ detail.owner_fee_detail.worked_at }}</td>
-                    <td>@{{ detail.work_name }}</td>
-                    <td>@{{ detail.asn_code }}</td>
-                    <td>@{{ detail.sku }}</td>
-                    <td>@{{ detail.barcode }}</td>
-                    <td>@{{ detail.commodity.name }}</td>
-                    <td>@{{ detail.amount }}</td>
-                    <td>@{{ detail.unit_price }}</td>
-                    <td>@{{ detail.fee }}</td>
+                    <td>@{{ detail.worked_at }}</td>
+                    <td>@{{ detail.model?detail.model.name:'' }}</td>
+                    <td>@{{ detail.doc_number }}</td>
+                    <td>@{{ detail.commodity?detail.commodity.sku:'' }}</td>
+                    <td>@{{ detail.source_number }}</td>
+                    <td>@{{ detail.commodity?detail.commodity.name:'' }}</td>
+                    <td class="m-0 p-0">
+                        <table class="table  m-0 p-0">
+                            <tr v-for="(item_detail,index) of detail.details" :key="index">
+                                <td>@{{ item_detail.amount }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td class="m-0 p-0">
+                        <table class="table  m-0 p-0">
+                            <tr v-for="(item_detail,index) of detail.details" :key="index">
+                                <td>@{{ item_detail.price }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td>@{{ detail.total_fee }}</td>
                 </tr>
             </table>
             <div class="text-info h5 btn btn">{{$details->count()}}/{{$details->total()}}</div>

+ 3 - 3
resources/views/finance/settlementBills/storeFee/report/index.blade.php

@@ -82,8 +82,8 @@
                 </tr>
                 <tr v-for="(report,i) in reports">
                     <td class="text-center pt-4 bg-light">@{{ report.work_name }}</td>
-                    <td class="m-0 p-0">
-                        <table class="table  m-0 p-0">
+                    <td class="m-0 p-0 overflow-hidden">
+                        <table class="table  m-0 p-0" style="height:50px;">
                             <tr v-for="item in report.data">
                                 <td>@{{ item.unit_price }}/@{{ item.unit.name }}</td>
                             </tr>
@@ -91,7 +91,7 @@
 
                     </td>
                     <td class="m-0 p-0">
-                        <table class="table  m-0 p-0">
+                        <table class="table  m-0 p-0 overflow-hidden" style="height:50px;">
                             <tr v-for="item in report.data">
                                 <td>@{{ item.amount }}</td>
                             </tr>

+ 21 - 9
resources/views/finance/settlementBills/storeOutFee/detail/index.blade.php

@@ -33,16 +33,28 @@
                     :class="selectTr===i+1?'focusing' : ''">
                     <td><input class="checkItem" type="checkbox" :value="detail.id"></td>
                     <td>@{{ i+1 }}</td>
-                    <td>@{{ detail.owner_fee_detail.worked_at }}</td>
-                    <td>@{{ detail.work_name }}</td>
-                    <td>@{{ detail.source_bill }}</td>
-                    <td>@{{ detail.owner_fee_detail.operation_bill }}</td>
-                    <td>@{{ detail.sku }}</td>
-                    <td>@{{ detail.barcode }}</td>
+                    <td>@{{ detail.worked_at }}</td>
+                    <td>@{{ detail.model.name }}</td>
+                    <td>@{{ detail.source_number }}</td>
+                    <td>@{{ detail.doc_number }}</td>
+                    <td>@{{ detail.commodity?detail.commodity.sku:'' }}</td>
+                    <td>@{{ detail.source_number }}</td>
                     <td>@{{ detail.commodity?detail.commodity.name:'' }}</td>
-                    <td>@{{ detail.amount}}</td>
-                    <td>@{{ detail.unit_price}}</td>
-                    <td>@{{ detail.price_remark}}</td>
+                    <td class="m-0 p-0">
+                        <table class="table  m-0 p-0">
+                            <tr v-for="(item_detail,index) of detail.details" :key="index">
+                                <td>@{{ item_detail.amount }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td class="m-0 p-0">
+                        <table class="table  m-0 p-0">
+                            <tr v-for="(item_detail,index) of detail.details" :key="index">
+                                <td>@{{ item_detail.price }}</td>
+                            </tr>
+                        </table>
+                    </td>
+                    <td>@{{ detail.fee_description}}</td>
                     <td>@{{ detail.fee }}</td>
                 </tr>
             </table>

+ 1 - 1
resources/views/finance/settlementBills/storeOutFee/report/index.blade.php

@@ -81,7 +81,7 @@
                     <td class="m-0 p-0">
                         <table class="table table-striped table-sm m-0 p-0">
                             <tr v-for="item in report.data">
-                                <td>@{{ item.step }}</td>
+                                <td>/</td>
                             </tr>
                         </table>
                     </td>

+ 5 - 19
resources/views/finance/settlementBills/totalFee/index.blade.php

@@ -6,18 +6,6 @@
     <div id="list" class="d-none">
         <div class="container-fluid">
             <div id="form_div"></div>
-            <div class="ml-3 form-inline" id="btn">
-                    <span class="dropdown">
-                        <button type="button"
-                                class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
-                                data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">导出Excel
-                        </button>
-                        <div class="dropdown-menu">
-                            <a target="_blank" class="dropdown-item" @click="detailExport(false)" href="javascript:">导出勾选内容</a>
-                            <a target="_blank" class="dropdown-item" @click="detailExport(true)" href="javascript:">导出所有页</a>
-                        </div>
-                    </span>
-            </div>
             <div class="row">
                 <div class="col-3">
                     <div class="row pt-2">
@@ -118,7 +106,7 @@
                     <td class="m-0 p-0">
                         <table class="table  m-0 p-0">
                             <tr v-for="item in feeTotal['information']['storeFee']">
-                                <td class="m-0 p-0" >
+                                <td >
                                     <span v-for="itemInfo in item.remark">@{{ itemInfo }} </span>
                                 </td>
                             </tr>
@@ -161,7 +149,7 @@
                     <td class="m-0 p-0">
                         <table class="table   m-0 p-0">
                             <tr v-for="item in feeTotal['information']['storeOutFee']">
-                                <td class="m-0 p-0" >
+                                <td>
                                     <span v-for="itemInfo in item.remark">@{{ itemInfo }} </span>
                                 </td>
                             </tr>
@@ -310,9 +298,7 @@
                 <tr>
                     <td>包材费</td>
                     <td>包材费</td>
-                    <td><a target="_blank"
-                           href="{{ route('settlementBills.packingMaterialFee',['owner_id' => $request['owner_id'],'year' => $request['year'],'month' => $request['month']]) }}"></a>
-                    </td>
+                    <td><a target="_blank" href="{{ route('settlementBills.packingMaterialFee',['owner_id' => $request['owner_id'],'year' => $request['year'],'month' => $request['month']]) }}">查看明细</a></td>
                     <td>@{{ feeTotal['packing_material_fee'] }}</td>
                     <!--                   TODO -->
                     <td class="m-0 p-0">
@@ -338,7 +324,7 @@
                     <td>卸货费</td>
                     <td>卸货费</td>
                     <td><a target="_blank"
-                           href="{{ route('settlementBills.unloadFee',['owner_id' => $request['owner_id'],'year' => $request['year'],'month' => $request['month']]) }}"></a>
+                           href="{{ route('settlementBills.unloadFee',['owner_id' => $request['owner_id'],'year' => $request['year'],'month' => $request['month']]) }}">查看明细</a>
                     </td>
                     <td>@{{ feeTotal['unload_fee'] }}</td>
                     <!--                   TODO -->
@@ -372,7 +358,7 @@
                         </table>
                     </td>
                     <td class="m-0 p-0">
-                        <table class="table   m-0 p-0"
+                        <table class="table m-0 p-0"
                                v-for="sundryFee in feeTotal['sundry_information']">
                             <tr>
                                 <td><a target="_blank"

+ 30 - 0
resources/views/order/index/delivering.blade.php

@@ -354,6 +354,9 @@
                         {name:'checktime_end',type:'time',tip:['选择显示复核时间的结束日期','选择显示复核时间的结束时间']},
                         {name: 'is_display_all', type: 'checkbox', tip: '是否隐藏装箱完成以后的状态', data: [{name: 'ture', value: '隐藏完成状态'}]},
                     ],
+                    [
+                        {name:'restrict_time',type:'select',tip:'查询限定时间范围',placeholder:'查询时间范围',data:[{name:'1',value:'一天内'},{name:'7',value:'一周内'},{name:"30",value:"一月内"},{name:"90",value:"本季度"}]},
+                    ],
                 ];
                 this.form = new query({
                     el:"#form_div",
@@ -418,6 +421,33 @@
                     this.orders.forEach((order)=>{
                         if (order.c_contact && order.c_contact.length>50 && order.c_contact.substring(0,3)==='~Ag')order.is_encryption = true;
                     });
+                    let start = "{{$request["orderdate_start"] ?? ''}}";
+                    let end = "{{$request["orderdate_end"] ?? ''}}";
+                    let time = "{{$request["restrict_time"] ?? ''}}";
+                    if (start && end && time){
+                        this.changeURLParam("orderdate_start",start);
+                        this.changeURLParam("orderdate_end",end);
+                        this.changeURLParam("restrict_time",time);
+                    }
+                },
+                changeURLParam(name, value) {
+                    let url = document.URL, resultUrl = ''
+                    let reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i')
+                    let r = window.location.search.substr(1).match(reg);
+                    let replaceText = name + '=' + value;
+                    if (r != null) {
+                        let tmp = url.replace(name + '=' + r[2], replaceText);
+                        resultUrl = (tmp);
+                    } else {
+                        if (url.match('[\?]')) {
+                            resultUrl = url + '&' + replaceText;
+                        }
+                        else {
+                            resultUrl = url + '?' + replaceText;
+                        }
+                    }
+
+                    history.replaceState(null, null, resultUrl)
                 },
                 getQueryVariable(variable){
                     let query = window.location.search.substring(1);

+ 1 - 1
resources/views/order/issue/index.blade.php

@@ -1164,7 +1164,7 @@
                         name: ['result_explain', 'addtime'],
                         type: 'input_select',
                         tip: ['情况说明:前或后加 百分号为单个模糊搜索,否则为多条件精确搜索', '查询范围越短,搜索速度越快'],
-                        placeholder: ['处理结果', ''],
+                        placeholder: ['情况说明', ''],
                         data: log_content_range,
                         rules: [{
                             son: {

+ 144 - 28
resources/views/package/logistic/index.blade.php

@@ -1,8 +1,68 @@
 @extends('layouts.app')
 @section('title')快递查询-包裹管理@endsection
+@section('head')
+    <style>
+        /*备注容器*/
+        .order-package-remarks{
+            position:relative;
+        }
+        /*新建按钮*/
+        .btn-create-remark {
+            width: 25px;
+            height: 25px;
+            line-height: 25px;
+            text-align: center;
+            position: absolute;
+            display: none;
+            background-color: rgb(92, 141, 236);
+            border: blue solid 1px;
+            color: #111;
+            box-shadow: 0 0 6px #4747f1;
+            float: left;
+        }
+        .order-package-remarks:hover .btn-create-remark{
+            display: block;
+        }
+        /*新建输入框*/
+        .remark-input {
+            height: 30px;
+            line-height: 30px;
+            padding-left: 16px;
+            margin-left: 35px;
+            box-shadow: 0 0 6px #fff6a1;
+            border-radius: 5px;
+        }
+        /*删除按钮*/
+        .order-package-remarks table .destroy {
+            float: right;
+            position: absolute;
+            right: 0;
+            padding: 0 !important;
+            width: 29px !important;
+            min-width: 30px !important;
+            border: 0 solid transparent !important;
+        }
 
+        .remark-created_at{
+            border-right: none !important;
+        }
+
+        .btn-destroy-remark {
+            display: none;
+            background-color: rgba(0, 0, 0, 0);
+            border: red solid 1px;
+            color: red;
+            box-shadow: 0 0 6px #ac4a4a;
+        }
+
+        .order-package-remarks table:hover .btn-destroy-remark{
+            display: block;
+        }
+
+    </style>
+@stop
 @section('content')
-    <div id="list" class="d-none">
+    <div id="list" class="d-none package-logistic-index">
         <div class="container-fluid">
             <div id="form_div"></div>
             <div class="ml-3 form-inline" id="btn">
@@ -49,7 +109,14 @@
                     <td>
                         <input class="checkItem" type="checkbox" :value="package.logistic_number">
                     </td>
-                    <td><span>@{{ i+1 }} <span class="badge badge-danger" v-if="package.order.issue">问题件</span></span>
+                    <td>
+                        <span style="position:relative">
+                            @{{ i+1 }}
+                            <span class="badge badge-danger" v-if="package.order.issue">问题件</span>
+                            <span
+                                style="display: inline-block;width: 15px;height: 15px;border-radius: 50%;position: absolute;top: 2px; margin-left: 3px;box-shadow: 0 0 3px #211f1f"
+                                  :style="package.sync_routes_flag?'background-color:#4ed32d':'background-color:#e83939'"></span>
+                        </span>
                     </td>
                     <td>
                         <select class="form-control-sm" v-model="package.exception_type"
@@ -90,30 +157,36 @@
                             </label>
                         </div>
                     </td>
-                    <td @mouseover="remarkHover = package.id"
-                        @mouseleave="remarkHover=null;remark=null;isShowRemarkInput = false">
+                    <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
                         @can('包裹管理-快递-客服备注')
-                            <button @click="isShowRemarkInput = true" v-if="remarkHover===package.id">新增</button>
-                            <input @keydown.enter="submitRemark(package)"
-                                   v-if="isShowRemarkInput && remarkHover===package.id" type="text" v-model="remark">
-                            <div v-if="package.remark && package.remark.length>0" :id="'remark-'+i">
-                                <div v-if="showRemarkList[i]" class="text-overflow-warp-200 up">
-                                    <p v-for="remark_item in package.remark">
-                                        @{{ remark_item }}
-                                    </p>
-                                </div>
-                                <div class="text-overflow-warp-200" v-else>
-                                    @{{ package.remark[0] }}
-                                </div>
-                            </div>
-                            <div @click="showRemarkItem(i)" v-if="package.remark && package.remark.length > 1">
-                                <label class="text-center mt-0 p-0 cursor-pointer pull-left">
+                        <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
+                            新
+                        </label>
+                        <input :id="'create_remark_'+package.id" @keyup.enter="submitRemark(package)" v-model="remark" v-show="package.input_remark" type="text" class="remark-input">
+                       <table class="table m-0 p-0 ">
+                           <tr v-show="package.order_package_remarks.length > 0 && package.showMoreRemark===true" v-for="(item,index) of package.order_package_remarks" :key="item.id">
+                               <td :title="item.content" style="width: 100px;overflow:hidden !important;">@{{ item.content }}</td>
+                               <td class="text-secondary">@{{ item.user.name }}</td>
+                               <td class="text-secondary remark-created_at">@{{ item.created_at }}</td>
+                               <td class="destroy"><button   class="btn-destroy-remark" @click="destroyRemark(package,item.id)">删</button></td>
+                           </tr>
+                           <tr v-show="(!package.showMoreRemark) && package.order_package_remarks.length > 0" >
+                               <td :title="package.order_package_remarks[0]? package.order_package_remarks[0].content:''" style="width: 100px;overflow:hidden !important;">@{{ package.order_package_remarks[0]?package.order_package_remarks[0].content:'' }}</td>
+                               <td class="text-secondary">@{{ package.order_package_remarks[0]?package.order_package_remarks[0].user.name:'' }}</td>
+                               <td class="text-secondary remark-created_at">@{{ package.order_package_remarks[0]?package.order_package_remarks[0].created_at:'' }}</td>
+                               <td class="destroy"><button   class="btn-destroy-remark" @click="destroyRemark(package,package.order_package_remarks[0].id)">删</button></td>
+                           </tr>
+                       </table>
+                        <div
+                            class="float-left"
+                            @click="package.showMoreRemark = !package.showMoreRemark" v-show="package.order_package_remarks && package.order_package_remarks.length > 1">
+                            <label class="text-center mt-0 p-0 cursor-pointer pull-left">
                                 <span class="fa"
-                                      :class="package.isShowRemark ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>
-                                    &nbsp;<span v-if="package.remark && showRemarkList[i]">收起</span><span
-                                        v-else>展开</span>&nbsp;@{{ package.remark.length }} 条
-                                </label>
-                            </div>
+                                      :class="package.showMoreRemark ? 'fa-angle-double-down' : 'fa-angle-double-right'"></span>
+                                &nbsp;<span v-if="package.order_package_remarks && package.showMoreRemark">收起</span><span
+                                    v-else>展开</span>&nbsp;@{{ package.order_package_remarks.length }} 条
+                            </label>
+                        </div>
                         @endcan
                     </td>
                     <td class="text-overflow-warp-200"><span v-if="package.order && package.order.issue">@{{ package.order.issue.result_explain }}</span>
@@ -250,7 +323,9 @@
                             placeholder: '是否有物流信息',
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                         },
+
                         {name: 'default_date', type: 'checkbox', tip: '默认15天', data: [{name: 'ture', value: '默认15天'}]},
+                        {name: 'default_logistics', type: 'checkbox', tip: '默认承运商', data: [{name: 'ture', value: '默认承运商'}]},
 
                     ], [
                         {
@@ -279,9 +354,9 @@
 
                         {
                             name: 'exception_type',
-                            type: 'select',
+                            type: 'select_multiple_select',
                             tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
-                            placeholder: '异常类型',
+                            placeholder: ['异常类型', '定位或多选异常类型'],
                             data: [
                                 {name: '疑似库内丢件', value: '疑似库内丢件'},
                                 {name: '揽件异常', value: '揽件异常'},
@@ -292,6 +367,21 @@
                                 {name: '无', value: '无'}
                             ]
                         },
+                        {
+                            name: 'is_issue',
+                            type: 'select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
+                            placeholder: '是否为问题件',
+                            data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
+                        },
+
+                        {
+                            name: 'sync_routes_flag',
+                            type: 'select',
+                            tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的状态'],
+                            placeholder: '是否有查询记录',
+                            data: [{name: true, value: '是'}, {name: false, value: '否'}]
+                        },
                     ]
                 ];
                 _this.form = new query({
@@ -390,9 +480,35 @@
                     }
                     let url = '{{url('apiLocal/package/logistic/')}}';
                     let _this = this;
-                    axios.put(url, {remark: _this.remark, orderPackageId: orderPackage.id}).then(function (response) {
+                    tempTip.setDuration(2000);
+                    tempTip.showSuccess('正在操作请稍后!');
+                    axios.put(url, {remark: _this.remark, orderPackageId: orderPackage.id}).then(response=>{
+                        if (response.data.success) {
+                            orderPackage.order_package_remarks = response.data.data
+                            tempTip.setDuration(2000);
+                            tempTip.showSuccess('成功!');
+                            _this.remark = '';
+                            orderPackage.input_remark = false;
+                        } else {
+                            tempTip.setDuration(5000);
+                            tempTip.show(response.data.fail_info);
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(3000);
+                        tempTip.show("网络错误:" + err)
+                    });
+                },
+                destroyRemark(orderPackage,remarkId) {
+                    let url = '{{url('apiLocal/package/logistic/delete')}}';
+                    if (!confirm('是否却认删除', false)) {
+                        return;
+                    };
+                    let _this = this;
+                    tempTip.setDuration(2000);
+                    tempTip.showSuccess('正在操作请稍后!');
+                    axios.post(url, {orderPackageId: orderPackage.id,remarkId:remarkId}).then(response=>{
                         if (response.data.success) {
-                            orderPackage.remark = response.data.data
+                            orderPackage.order_package_remarks = response.data.data
                             tempTip.setDuration(2000);
                             tempTip.showSuccess('成功!');
                         } else {

+ 8 - 0
resources/views/station/monitor/show.blade.php

@@ -206,6 +206,7 @@
                                 <textarea  name="" id="" cols="30" rows="3" class="form-control" v-model="inputs.manuallyTakeBox.text"
                                            placeholder="点选此处写入料箱号,可以省略IDE前缀和0,多个用空格分隔,例入:5121 156"></textarea>
                                             <button class="btn btn-info btn-lg" @click="manuallyTakeBoxOut">出库</button>
+                                            <button class="btn btn-sm btn-primary btn-lg" @click="paddingEmptyBox">填充空箱</button>
                                         </div>
                                     </div>
                                 </div>
@@ -454,6 +455,13 @@
                         window.manuallyHairouRequesting=false;
                     })
                 },
+                paddingEmptyBox(){
+                    window.tempTip.inputVal("调取数量",amount=>{
+                        window.tempTip.postBasicRequest("{{url('/api/thirdPart/haiq/storage/paddingEmptyBox')}}",{amount:amount},res=>{
+                            this.inputs.manuallyTakeBox.text = res;
+                        });
+                    });
+                },
                 runTheTaskBatch(){
                     let _this=this;
                     _this.current_stationTaskBatch.runningStatus='请求中';

+ 0 - 335
resources/views/store/inStorage/halfChestStorage.blade.temp

@@ -1,335 +0,0 @@
-@extends('layouts.app')
-@section('title')缓存架入库-半箱入库@endsection
-
-@section('content')
-    <div class="container-fluid d-none" id="container">
-        <div class="row">
-            <div class="card offset-md-1 col-md-5 col-sm-12">
-                <div class="card-body">
-                    <div class="form-group text-center mt-2" id="header_title">
-                        <span class="font-weight-bold h4">入库信息</span>
-                        <a class="small" href="#" @click="openModal()">溢出减量</a>
-                    </div>
-                    <div class="form-group row">
-                        <label for="track" class="col-sm-2 col-3 text-right">跟踪号:</label>
-                        <input type="text" class="form-control col-8" id="track" :class="errors.track ? 'is-invalid' : ''" @keydown.enter="enterVal($event)" v-model="info.track" @blur="check()">
-                        <span class="invalid-feedback offset-3" role="alert" v-if="errors.track">
-                            <strong>@{{ errors.track[0] }}</strong>
-                        </span>
-                    </div>
-                    <div class="form-group row">
-                        <label for="station" class="col-sm-2 col-3 text-right">库位:</label>
-                        <input type="text" class="form-control col-8" id="station" placeholder="扫描货架条码"
-                               :class="errors.station ? 'is-invalid' : ''" v-model="info.station" @blur="check()" @keydown.enter="enterVal($event)">
-                        <span class="invalid-feedback offset-3" role="alert" v-if="errors.station">
-                            <strong>@{{ errors.station[0] }}</strong>
-                        </span>
-                    </div>
-                    <div class="form-group row">
-                        <label for="barCode" class="col-sm-2 col-3 text-right">条码:</label>
-                        <input type="text" class="form-control col-8" id="barCode" placeholder="扫描商品条码"
-                               :class="errors.barCode ? 'is-invalid' : ''" v-model="info.barCode" @blur="check()" @keydown.enter="enterVal($event)">
-                        <span class="invalid-feedback offset-3" role="alert" v-if="errors.barCode">
-                            <strong>@{{ errors.barCode[0] }}</strong>
-                        </span>
-                    </div>
-                    <div class="form-group row">
-                        <label for="amount" class="col-sm-2 col-3 text-right">数量:</label>
-                        <input type="number" class="form-control col-8" id="amount"
-                               @keydown.enter="enterVal($event)" :class="errors.amount ? 'is-invalid' : ''" @blur="check()" v-model="info.amount" :placeholder="info.maximum!==undefined ? '最大可上:'+info.maximum : ''" :max="info.maximum" step="1">
-                        <span class="invalid-feedback offset-3" role="alert" v-if="errors.amount">
-                            <strong>@{{ errors.amount[0] }}</strong>
-                        </span>
-                    </div>
-                    <div class="input-group row mt-5">
-                        <button type="submit" id="submit" class="btn btn-success offset-2 col-8" @click="checkInfo()">提交</button>
-                    </div>
-                </div>
-            </div>
-            <div class="card col-md-5 col-sm-12">
-                <div class="card-body">
-                    <div class="mt-1 text-center">
-                        <button class="btn btn-primary" @click="submitBox()">为选中格口手动补充料箱</button>
-                        <button class="btn btn-sm btn-info text-white" @click="reverse()">全选/反选</button>
-                    </div>
-                    <div class="mt-2 h-75">
-                        <div class="w-100 text-center mt-2" style="cursor: pointer" :style="{height:(100/ides.length)+'%'}" v-for="arr in ides">
-                            <div class="row" style="height: 33.3%" v-for="a in arr">
-                                <div class="col-4 border border-dark" v-for="ide in a" :class="[shelfOccupy[ide] ? 'bg-danger' : 'bg-success',selectedBox[ide] ? 'box-shadow-dark' : '']"
-                                     @click="fillingBox(ide)">@{{ ide }}</div>
-                            </div>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            <div class="modal fade" tabindex="-1" role="dialog" id="modal">
-                <div class="modal-dialog modal-lg modal-dialog-centered modal-dialog-scrollable">
-                    <div class="modal-content">
-                        <div class="modal-header">
-                            <div class="font-weight-bold h4">溢出减量</div>
-                            <button type="button" class="close" data-dismiss="modal">&times;</button>
-                        </div>
-                        <div class="modal-body">
-                            <div class="form-group">
-                                <label for="location">库位码</label>
-                                <input id="location" type="text" v-model="ov.station" class="form-control" placeholder="库位码">
-                            </div>
-                            <div class="form-group">
-                                <label for="ov_amount">溢出数量</label>
-                                <input id="ov_amount" type="number" v-model="ov.amount" min="1" step="1" class="form-control" placeholder="溢出数量">
-                            </div>
-                        </div>
-                        <div class="modal-footer">
-                            <button type="button" class="btn btn-success" @click="overflowRevision()">提交</button>
-                        </div>
-                    </div>
-                </div>
-            </div>
-            @include("store.inStorage._setMaximum")
-            @include("store.inStorage._lotModal")
-        </div>
-    </div>
-@stop
-
-@section('lastScript')
-    <script type="text/javascript">
-        new Vue({
-            el:"#container",
-            data:{
-                permissionList:[ //允许聚焦许可列表
-                    "track","station","amount","location","ov_amount"
-                ],
-                info:{},
-                mount:false,
-                /*before:{},*/
-                focus:"",
-                errors:{},
-                ov:{},//溢出减量数值
-                element:[
-                    "track","station","barCode","amount","submit"
-                ],
-                isAndroid:false,
-                shelfOccupy:{},
-                selectedBox:{},
-                ides:[
-                    [
-                        ["HAIB2-03-03","HAIB2-02-03","HAIB2-01-03"],
-                        ["HAIB2-03-02","HAIB2-02-02","HAIB2-01-02"],
-                        ["HAIB2-03-01","HAIB2-02-01","HAIB2-01-01"],
-                    ],
-                    [
-                        ["HAIB1-03-03","HAIB1-02-03","HAIB1-01-03"],
-                        ["HAIB1-03-02","HAIB1-02-02","HAIB1-01-02"],
-                        ["HAIB1-03-01","HAIB1-02-01","HAIB1-01-01"],
-                    ],
-                ],
-                models:null,
-                oldInfo:{},
-                lots:[],
-            },
-            mounted(){
-                if (navigator.userAgent.indexOf("Android")!==-1)this.isAndroid = true;
-                @foreach($stations as $station)this.$set(this.shelfOccupy,"{{$station->code}}",!!{{$station->material_box_id}});@endforeach
-                //this.codeFocus();
-                //this.globalClick();
-                //this.createBefore();
-                this.pageInit();
-                $("#container").removeClass("d-none");
-            },
-            methods:{
-                //页面初始化
-                pageInit(){
-                    if (!this.isAndroid)return;
-                    let element = document.getElementById("navbarSupportedContent").parentElement;
-                    element.className = "row";
-                    element.children[0].className += " col-5";
-                    element.children[0].href = "#";
-                    element.innerHTML = element.children[0].outerHTML;
-                    let e1 = document.getElementById("menu");
-                    let e2 = document.getElementById("demand-div");
-                    if (e1)e1.remove();
-                    if (e2)e2.remove();
-                },
-                //提交溢出减量
-                overflowRevision(){
-                    if (!this.ov.station || !this.ov.amount){
-                        window.tempTip.show("信息不完整");
-                        return;
-                    }
-                    window.tempTip.postBasicRequest("{{url('store/inStorage/overflowRevision')}}",this.ov,()=>{
-                        $("#modal").modal('hide');
-                        this.ov = {};
-                        return "溢出减量成功!";
-                    });
-                },
-                //打开溢出减量模态框
-                openModal(){
-                    $("#modal").modal("show");
-                    setTimeout(function () {
-                        document.getElementById("location").focus();
-                    },500);
-                },
-                /*//聚焦 白名单
-                codeFocus(){
-                    if (!this.permissionList.includes(document.activeElement.id)) document.getElementById("barCode").focus();
-                },
-                //全局点击聚焦
-                globalClick(turn = true){
-                    if (turn===this.mount)return;
-                    this.mount = turn;//防止重复挂载事件
-                    if (turn) window.addEventListener("click",this.codeFocus);
-                    else window.removeEventListener("click",this.codeFocus);
-                },*/
-
-                checkInfo(){
-                    let error = {};
-                    if (!this.info.track)error.track = ["跟踪号必填"];
-                    if (!this.info.barCode)error.barCode = ["商品条码必填"];
-                    if (!this.info.station)error.station = ["库位必填"];
-                    if (!this.info.amount && !this.info.maximum)error.amount = ["数量必填"];
-                    if (JSON.stringify(error)!=='{}'){this.errors = error;return;}
-                    if (!this.info.amount && this.info.maximum)this.info.amount = this.info.maximum;
-                    this._exeTask();
-                },
-                _exeTask(){
-                    window.tempTip.postBasicRequest("{{url('store/inStorage/acquireBox')}}",this.info,()=>{
-                        if (!this.status){
-                            window.tempTip.show("调取失败,内部错误");
-                            return;
-                        }
-                        if (this.amount>0){
-                            this.info.station = "";
-                            this.info.amount = "";
-                        }else this.info = {track:this.info.track};
-                        this.errors = {};
-                        return "上架成功!";
-                    });
-                },
-  /*              createBefore(){
-                    let now = new Date();
-                    let yy = now.getFullYear().toString().substr(2, 2);
-                    let mm = now.getMonth() + 1;
-                    mm = mm <10 ? '0'+mm : mm.toString();
-                    let dd = now.getDate();
-                    dd = dd <10 ? '0'+dd : dd.toString();
-                    this.before.asn = 'ASN'+yy+mm+dd+'000';
-                },*/
-                checkMaximum(){
-                    window.tempTip.postBasicRequest("{{url('store/inStorage/checkMaximum')}}",this.info,res=>{
-                        if (!res.material_box_model_id){
-                            this.info.commodity_id = res.commodity_id;
-                            this.showMaximumModal();
-                            return;
-                        }
-                        this.info.maximum = res.need;
-                        this.info.location = res.location;
-                        this.info.material_box_model_id = res.material_box_model_id;
-                        this.info.commodity_id = res.commodity_id;
-                        if(!this.info.amount)this.info.amount = res.need;
-                        return "该库位最大可上数为"+res.need;
-                    });
-                },
-                check(){
-                    if (!this.info.track || !this.info.barCode)return;
-                    if (!this.info.lotNum || this.info.track !== this.oldInfo.track || this.info.barCode !== this.oldInfo.barCode){
-                        window.tempTip.postBasicRequest("{{url('store/inStorage/checkTask')}}",this.info,res=>{
-                            this.oldInfo = {track:this.info.track,barCode:this.info.barCode};
-                            switch (res.count){
-                                case 0:
-                                    window.tempTip.show("无此上架信息");
-                                    break;
-                                case 1:
-                                    this.info.lotNum = res.lots;
-                                    this.checkMaximum();
-                                    break;
-                                default:
-                                    this.lots = res.lots;
-                                    $("#lotModal").modal("show");
-                            }
-                        });
-                    }
-                },
-                //回车向下TAB
-                enterVal(e){
-                    let index = this.element.indexOf(e.target.id)+1;
-                    let element = document.getElementById(this.element[index]);
-                    if (element)element.focus();
-                    e.preventDefault();
-                    return false;
-                },
-                //提交填充料箱
-                submitBox(){
-                    window.tempTip.setDuration(3000);
-                    if (JSON.stringify(this.selectedBox)==='{}'){window.tempTip.show("未选中格口");return;}
-                    window.tempTip.confirm("确定选中格口已无料箱存在?",()=>{
-                        window.tempTip.setDuration(99999);
-                        window.tempTip.waitingTip("调取料箱中,请稍等");
-                        let boxes = [];
-                        for (let key in this.selectedBox)if (this.selectedBox[key]) boxes.push(key);
-                        window.tempTip.postBasicRequest("{{url('store/inStorage/resetCacheShelf')}}",{boxes:boxes},res=>{
-                            window.tempTip.cancelWaitingTip();
-                            window.tempTip.setDuration(3000);
-                            for (let i=0;i<res.boxes.length;i++){
-                                this.$set(this.shelfOccupy,res.boxes[i],true);
-                                this.$set(this.selectedBox,res.boxes[i],true);
-                            }
-                            if (res.data){
-                                window.tempTip.show(res.data);
-                                return;
-                            }
-                            return "手动补充成功";
-                        },true);
-                    })
-                },
-                reverse(){
-                    let ides = [];
-                    this.ides.forEach(arr=>{
-                        arr.forEach(a=>{
-                            a.forEach(ide=>{
-                                ides.push(ide);
-                            })
-                        })
-                    });
-                    ides.forEach((ideCode)=>{
-                        this.$set(this.selectedBox,ideCode,this.selectedBox[ideCode] ? !this.selectedBox[ideCode] : true);
-                    });
-                },
-                //选中填充料箱
-                fillingBox(ideCode){
-                    this.$set(this.selectedBox,ideCode,this.selectedBox[ideCode] ? !this.selectedBox[ideCode] : true);
-                },
-                showMaximumModal(){
-                    if (this.models){
-                        $("#maximumModal").modal("show");
-                        return;
-                    }
-                    window.tempTip.postBasicRequest("{{url("store/inStorage/getModels")}}",{},res=>{
-                        this.models = res;
-                        $("#maximumModal").modal("show");
-                    })
-                },
-                settingModelMaximum(){
-                    let models = [];
-                    this.models.forEach(model=>{
-                       if (model.maximum)models.push(model);
-                    });
-                    if (models.length<1){
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.setIndex(1099);
-                        window.tempTip.show("请至少设定一个上限型号");
-                        return;
-                    }
-                    window.tempTip.postBasicRequest("{{url('store/inStorage/setMaximum')}}",
-                        {models:models,commodityId:this.info.commodity_id},res=>{
-                        this.checkMaximum();
-                    },true);
-                },
-                selectedLot(index){
-                    this.info.lotNum = this.lots[index].lotnum;
-                    this.checkMaximum();
-                    $("#lotModal").modal("hide");
-                },
-            },
-        });
-    </script>
-@stop

+ 26 - 17
resources/views/transport/waybill/edit.blade.php

@@ -58,7 +58,7 @@
                                 </div>
                             </div>
                             <div class="form-group row">
-                                <label for="deliver_at" class="col-2 col-form-label text-right text-muted">发货时间</label>
+                                <label for="deliver_at" class="col-2 col-form-label text-right text-primary">发货时间 *</label>
                                 <div class="col-8 form-inline">
                                     <input  id="deliver_at_date" @input="spliceDeliverAt" name="deliver_at_date" type="date" class="form-control col-4 @error('deliver_at_date') is-invalid @enderror"
                                             value="@if(old('deliver_at_date')){{ old('deliver_at_date') }}@else{{$waybill->deliver_at_date}}@endif">
@@ -95,10 +95,10 @@
                                                name="total_weight" autocomplete="off" v-model="waybill.total_weight" id="total_weight">
                                     </div>
                                     <label for="deliveryType_id" class="col-2 col-form-label text-right text-primary">送货方式 *</label>
-                                    <div class="col-5">
+                                    <div class="col-3">
                                         <select class="form-control @error('deliveryType_id') is-invalid @enderror" name="deliveryType_id"
                                                 :class="errors['deliveryType_id'] ? 'is-invalid' :''"
-                                                style="width: 30%;"   v-model="waybill.deliveryType_id" id="deliveryType_id">
+                                                style="width: 100%;"   v-model="waybill.deliveryType_id" id="deliveryType_id">
                                             <option v-for="deliveryType in deliveryTypes" :value="deliveryType.id">@{{ deliveryType.name }}</option>
                                         </select>
                                     </div>
@@ -128,15 +128,16 @@
                                 </div>
 
                                 <div class="form-group row">
-                                    <label for="" class="col-2 col-form-label text-right text-primary">支付方式 *</label>
+                                    <label for="" class="col-2 col-form-label text-right text-primary">包装方式 *</label>
                                     <div class="col-3">
-                                        <select class="form-control @error('pay_type') is-invalid @enderror" name="pay_type"
-                                                :class="errors['pay_type'] ? 'is-invalid' :''"
-                                                style="width: 100%;"   v-model="waybill.pay_type" id="pay_type">
-                                            <option v-for="(v,k) in payTypes" :value="k">@{{ v }}</option>
+                                        <select class="form-control  @error('package_service') is-invalid @enderror" name="package_service"
+                                                :class="errors['package_service'] ? 'is-invalid' :''"
+                                                style="width: 100%;"   v-model="waybill.package_service" id="package_service">
+                                            <option v-for="(v,k) in packageServices" :value="v">@{{ v }}</option>
                                         </select>
-                                        @error('pay_type')<span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>@enderror
+                                        @error('package_service')<span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>@enderror
                                     </div>
+
                                     <label for="" class="col-2 col-form-label text-right text-primary">签收回单 *</label>
                                     <div class="col-3">
                                         <select class="form-control @error('back_sign_bill') is-invalid @enderror" name="back_sign_bill"
@@ -148,14 +149,14 @@
                                     </div>
                                 </div>
                                 <div class="form-group row">
-                                    <label for="" class="col-2 col-form-label text-right text-primary">包装方式 *</label>
-                                    <div class="col-3">
-                                        <select class="form-control  @error('package_service') is-invalid @enderror" name="package_service"
-                                                :class="errors['package_service'] ? 'is-invalid' :''"
-                                                style="width: 100%;"   v-model="waybill.package_service" id="package_service">
-                                            <option v-for="(v,k) in packageServices" :value="v">@{{ v }}</option>
+                                    <label for="" class="col-2 col-form-label text-right text-primary">支付方式 *</label>
+                                    <div class="col-6">
+                                        <select class="form-control @error('pay_type') is-invalid @enderror" name="pay_type"
+                                                :class="errors['pay_type'] ? 'is-invalid' :''"
+                                                style="width: 100%;"   v-model="waybill.pay_type" id="pay_type">
+                                            <option v-for="(v,k) in payTypes" :value="k">@{{ v }}</option>
                                         </select>
-                                        @error('package_service')<span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>@enderror
+                                        @error('pay_type')<span class="invalid-feedback" role="alert"><strong>{{ $message }}</strong></span>@enderror
                                     </div>
                                 </div>
                             </div>
@@ -293,7 +294,7 @@
                             </div>
                             <div v-if="waybill.type=='直发车'">
                                 <div class="form-group row">
-                                    <label for="carType_id" class="col-2 col-form-label text-right">车型</label>
+                                    <label for="carType_id" class="col-2 col-form-label text-right text-primary">车型 *</label>
                                     <div class="col-3">
                                         <select class="form-control" name="carType_id" v-model="waybill.carType_id" id="carType_id">
                                             <option v-for="carType in carTypes" :value="carType.id">@{{ carType.name }}</option>
@@ -733,6 +734,14 @@
                         });
                 }
             },
+            created(){
+                this.waybill.deliveryType_id = this.deliveryTypes[2].id;
+                this.waybill.order_type = 2;
+                this.waybill.transport_type = 'JZKH';
+                this.waybill.pay_type = 2;
+                this.waybill.back_sign_bill = 0;
+                this.waybill.package_service = this.packageServices[4];
+            }
         });
     </script>
 @endsection

+ 23 - 14
resources/views/transport/waybill/index.blade.php

@@ -35,6 +35,11 @@
                     <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
                 </div>
             </span>
+            <div class="form-check d-inline-block">
+                <label class="form-check-label">
+                    <input type="checkbox" class="form-check-input" v-model="appendFluxInfo">导出附加FLUX信息
+                </label>
+            </div>
             @can('运输管理-运单-图片上传')<button class="btn btn-sm btn-outline-info" data-target="#batchUploadImg" data-toggle="modal">批量上传图片</button>@endcan
             @can('运输管理-运单-图片删除')<button class="btn btn-sm btn-outline-danger" @click="deleteImg()">批量删除图片</button>@endcan
             @if($uriType=='' || $uriType=='专线')
@@ -46,11 +51,11 @@
                         title="合并多条运单至一条,已填写信息将被累加处理" @click="waybillMerge()">运单合并</button>
             <button class="btn btn-sm btn-outline-info tooltipTarget"
                     title="将已合并运单拆分返回原状态" @click="waybillSplit()">拆单返回</button>
-                @if($uriType=='' || $uriType=='德邦物流')
-                    <button class="btn btn-sm btn-outline-info tooltipTarget"
-                        title="打印快递面单" @click="expressFaceList()">打印快递面单</button>
-                @endif
             @endcan
+            @if($uriType=='' || $uriType=='德邦物流')
+                <button class="btn btn-sm btn-outline-info tooltipTarget"
+                        title="打印快递面单" @click="expressFaceList()">打印快递面单</button>
+            @endif
             <div>
                 @if(Session::has('successTip'))
                     <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
@@ -630,7 +635,8 @@
                 selectTr:'',
                 dailyBilling:{screenDate:'', billing:''},
                 error:{screenDate:'', billing:''},
-                expresss:[{name:1,value:'是'},{name:0,value:'否'}]
+                expresss:[{name:1,value:'是'},{name:0,value:'否'}],
+                appendFluxInfo:false,
             },
             mounted:function(){
                 $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -829,9 +835,8 @@
                 },
                 rendingHeader(){
                     let column = [
-                            @can('运输管理-编辑','运输管理-运单-运单审核','运输管理-运单-调度','运输管理-编辑')
-                        {name:'operation',value: '操作', neglect: true, class:"td-operation"},@endcan
-                            @can('运输管理-运单-置顶'){name:'onTop',value: '置顶', neglect: true, class:"td-operation"},@endcan
+                        {name:'operation',value: '操作', neglect: true, class:"td-operation"},
+                        {name:'onTop',value: '置顶', neglect: true, class:"td-operation"},
                         {name:'status',value: '状态', class:"td-operation"},
                         {name:'express_face_list',value: '快递面单是否打印', class:"td-warm"},
                         {name:'index',value: '序号', neglect: true, class:"td-warm"},
@@ -865,9 +870,9 @@
                         {name:'amount',value: '计件', neglect: true, class:"td-cool"},
                         {name:'mileage',value: '里程', neglect: true, class:"td-cool"},
                         {name:'ordering_remark',value: '运单备注', class:"td-cool"},
-                            @can('运输管理-运单-运费'){name:'fee',value: '运费', neglect: true, class:"td-helpful"},@endcan
+                         @can('运输管理-运单-可见费用项') @can('运输管理-运单-运费'){name:'fee',value: '运费', neglect: true, class:"td-helpful"},@endcan
                         {name:'pick_up_fee',value: '提货费', neglect: true, class:"td-helpful pick-btn"},
-                        {name:'other_fee',value: '其他支出', neglect: true, class:"td-helpful"},
+                        {name:'other_fee',value: '其他支出', neglect: true, class:"td-helpful"},@endcan
                         {name:'deliver_at',value: '发货时间', class:"td-helpful"},
                         {name:'dispatch_remark',value: '调度备注', class:"td-helpful"},
                             @can('运输管理-运单-删除'){name:'remove',value: '操作', neglect: true, class:"td-delete"},@endcan
@@ -880,7 +885,7 @@
                         restorationColumn: 'id',
                         fixedTop:($('#form_div').height())+2,
                         before : [
-                            {colspan:'3',value: '', class:"table-header-layer-1"},
+                            {colspan:'4',value: '', class:"table-header-layer-1"},
                             {colspan:'15',value: '运单信息',font:"fa fa-file-text-o", class:"table-header-layer-1"},
                             {colspan:'17',value: '运输信息',font:"fa fa-truck", class:"table-header-layer-1"},
                             {colspan:'5',value: '收费信息',font:"fa fa-rmb", class:"table-header-layer-1"},
@@ -987,7 +992,7 @@
                 waybillExport(checkAllSign){
                     let url = '{{url('transport/waybill/export')}}';
                     let token='{{ csrf_token() }}';
-                    excelExport(checkAllSign,checkData,url,this.sum,token);
+                    excelExport(checkAllSign,checkData,url,this.sum,token,{append:this.appendFluxInfo});
                 },
                 selectedColor(id){
                     if (id && id===this.selectTr)return;
@@ -1437,6 +1442,7 @@
          */
         function printEWaybill(data, serialNo, barcode, wayNum){
             //打印内容
+            console.log(barcode);
             var printHtml = htmlTemplateObj.find("div#expressPrintArea").html();
 
             LODOP.PRINT_INIT("二级模板");
@@ -1444,8 +1450,11 @@
             LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW", true);
 
             LODOP.ADD_PRINT_TABLE("2mm","0.6mm","95mm","177mm",printHtml);
-            LODOP.ADD_PRINT_BARCODE("79mm","10mm","84mm","15mm","128C", data.waybillNumber);
-            LODOP.ADD_PRINT_BARCODE("117mm","45mm","50mm","8mm","128C", data.waybillNumber);
+            LODOP.ADD_PRINT_BARCODE("79mm","10mm","84mm","15mm","128Auto", barcode);
+            LODOP.ADD_PRINT_BARCODE("117mm","45mm","50mm","8mm","128Auto", barcode);
+
+            //设定固定打印机
+            if(LODOP.SET_PRINTER_INDEX('EK100B'))LODOP.SET_PRINTER_INDEX('EK100B');
 
             //打印
             // LODOP.PREVIEW();

+ 1 - 1
resources/views/transport/waybill/recycle.blade.php

@@ -191,7 +191,7 @@
                         return;
                     }
                     if(!confirm("确定要恢复所有勾选的内容为'未删除'吗?")){return;}
-                    let ajaxUrl = '{{url('apiLocal/waybill/recoverSelected')}}';
+                    let ajaxUrl = '{{url('apiLocal/transport/waybill/recoverSelected')}}';
                     axios.post(ajaxUrl,{ids:_this.waybills_checkBoxes}).then(function (response) {
                         if(response.data.success){
                             tempTip.setDuration(2000);

+ 1 - 0
routes/api/thirdPart/haiq.php

@@ -20,6 +20,7 @@ Route::group(['prefix'=>'storage'],function(){
     Route::post('taskUpdate', "StorageController@taskUpdate");//移库
     Route::post('exception', "StorageController@exception");//移库
     Route::post('takeOutToULine', "StorageController@takeOutToULine");//出库(基于料箱号往U型线出库)
+    Route::post('paddingEmptyBox', "StorageController@paddingEmptyBox");//填充空箱
 });
 Route::group(['prefix'=>'pickStation'],function(){
     Route::post('processed', "PickStationController@processed");//移库

+ 1 - 0
routes/apiLocal.php

@@ -222,6 +222,7 @@ Route::group(['prefix' => 'station'],function(){
 /** 包裹 */
 Route::group(['prefix' => 'package'], function () {
     Route::put('logistic', 'OrderPackageController@update')->name('orderPackage.update');
+    Route::post('logistic/delete', 'OrderPackageController@destroy')->name('orderPackage.destroy');
 });
 /** 快递打印 */
 Route::group(['prefix' => 'print'],function (){

+ 1 - 1
tests/Feature/LogisticZopSyncTest.php

@@ -39,7 +39,7 @@ class LogisticZopSyncTest extends TestCase
 
     public function test_get()
     {
-        LogisticZopSync::dispatch('75600272832573');
+        LogisticZopSync::dispatch('75497969890714');
     }