Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

ANG YU 5 лет назад
Родитель
Сommit
fe7e9da3a4
100 измененных файлов с 3824 добавлено и 719 удалено
  1. 53 3
      .gitlab-ci.yml
  2. 0 2
      app/Commodity.php
  3. 45 0
      app/Console/Commands/SyncUserVisitMenuLogsCacheTask.php
  4. 1 0
      app/Console/Kernel.php
  5. 97 0
      app/Http/Controllers/ControlPanelController.php
  6. 361 250
      app/Http/Controllers/InventoryAccountController.php
  7. 14 1
      app/Http/Controllers/PackageController.php
  8. 43 8
      app/Http/Controllers/TestController.php
  9. 20 20
      app/Http/Controllers/UserDutyCheckController.php
  10. 0 1
      app/Http/Controllers/api/thirdPart/flux/SortingController.php
  11. 24 0
      app/Http/Controllers/api/thirdPart/haiq/PickStationController.php
  12. 1 0
      app/Http/Kernel.php
  13. 24 0
      app/Http/Middleware/CheckActiveMenu.php
  14. 4 10
      app/Imports/InventoryCompareImport.php
  15. 1 1
      app/LaborReport.php
  16. 14 0
      app/Menu.php
  17. 1 2
      app/Order.php
  18. 11 0
      app/OrderCountingRecord.php
  19. 8 0
      app/OrderPackage.php
  20. 25 0
      app/Providers/AppServiceProvider.php
  21. 264 0
      app/Services/CheckActiveMenuService.php
  22. 4 3
      app/Services/CommodityService.php
  23. 53 8
      app/Services/FeatureService.php
  24. 47 0
      app/Services/InventoryAccountService.php
  25. 18 24
      app/Services/InventoryCompareService.php
  26. 168 0
      app/Services/LaborReportsCountingRecordService.php
  27. 0 1
      app/Services/LogService.php
  28. 1 0
      app/Services/LogisticService.php
  29. 6 2
      app/Services/OracleBasCustomerService.php
  30. 361 0
      app/Services/OrderCountingRecordService.php
  31. 6 2
      app/Services/OrderPackageCommoditiesService.php
  32. 5 2
      app/Services/OrderPackageService.php
  33. 6 8
      app/Services/OrderService.php
  34. 1 1
      app/Services/OwnerPriceExpressService.php
  35. 3 4
      app/Services/OwnerPriceLogisticService.php
  36. 96 72
      app/Services/OwnerPriceOperationService.php
  37. 4 2
      app/Services/OwnerService.php
  38. 3 3
      app/Services/OwnerStoragePriceModelService.php
  39. 57 0
      app/Services/RealtimePendingOrdersService.php
  40. 7 11
      app/Services/ShopService.php
  41. 1 2
      app/Services/WarehouseService.php
  42. 1 1
      app/Services/common/QueryService.php
  43. 1 1
      app/UserDutyCheck.php
  44. 14 0
      app/UserVisitMenuLog.php
  45. 11 0
      app/ValueStore.php
  46. 3 3
      database/factories/CarTypeFactory.php
  47. 21 0
      database/factories/CommodityFactory.php
  48. 0 1
      database/factories/OwnerFactory.php
  49. 15 0
      database/factories/OwnerPriceDirectLogisticCarFactory.php
  50. 4 6
      database/factories/OwnerPriceExpressFactory.php
  51. 16 0
      database/factories/OwnerPriceExpressProvinceFactory.php
  52. 23 0
      database/factories/OwnerPriceLogisticDetailFactory.php
  53. 19 0
      database/factories/OwnerPriceLogisticFactory.php
  54. 2 1
      database/factories/OwnerReportFactory.php
  55. 1 1
      database/migrations/2020_09_10_143926_drop_shop_unique_name_index.php
  56. 17 15
      database/migrations/2020_09_20_142656_change_order_issue.php
  57. 7 5
      database/migrations/2020_10_14_112825_add_order_issue_second_client_no.php
  58. 36 0
      database/migrations/2020_11_03_092648_create_menus.php
  59. 88 0
      database/migrations/2020_11_03_095519_seed_menus_level_1.php
  60. 481 0
      database/migrations/2020_11_03_095724_seed_menus_level_2.php
  61. 33 0
      database/migrations/2020_11_03_111159_create_user_visit_menu_logs.php
  62. 38 0
      database/migrations/2020_11_06_114606_create_order_counting_records_table.php
  63. 33 0
      database/migrations/2020_11_23_143015_create_value_stores_table.php
  64. 61 0
      database/migrations/2020_11_23_143145_seed_value_stores_table.php
  65. 14 1
      package-lock.json
  66. 1 0
      package.json
  67. BIN
      public/images/QRCodeIMG/4.png
  68. BIN
      public/images/QRCodeIMG/5.png
  69. 4 4
      public/js/app.js
  70. 1 2
      public/t.php
  71. 3 1
      resources/js/app.js
  72. 3 0
      resources/js/echarts.js
  73. 0 0
      resources/js/element-ui.js
  74. 0 0
      resources/sass/element-ui.css
  75. 557 0
      resources/views/control/panel.blade.php
  76. 1 1
      resources/views/customer/project/area.blade.php
  77. 1 1
      resources/views/customer/project/create.blade.php
  78. 155 148
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  79. 1 1
      resources/views/layouts/app.blade.php
  80. 3 3
      resources/views/layouts/menu.blade.php
  81. 2 2
      resources/views/maintenance/priceModel/operation/_addFeature.blade.php
  82. 2 1
      resources/views/maintenance/priceModel/operation/create.blade.php
  83. 8 8
      resources/views/order/index/delivering.blade.php
  84. 7 7
      resources/views/personnel/checking-in/importAndExportSuccess.blade.php
  85. 6 6
      resources/views/personnel/checking-in/success.blade.php
  86. 33 10
      resources/views/personnel/laborReport/index.blade.php
  87. 0 38
      resources/views/store/inStorage/index.blade.php
  88. 3 0
      routes/api/thirdPart/haiq.php
  89. 8 2
      routes/apiLocal.php
  90. 5 1
      routes/web.php
  91. 1 1
      tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php
  92. 32 0
      tests/Services/CheckActiveMenuService/CheckActiveMenuSyncTest.php
  93. 19 1
      tests/Services/CustomerService/CustomerTest.php
  94. 24 1
      tests/Services/FeatureService/FeatureServiceTest.php
  95. 41 0
      tests/Services/LaborReportsCountingRecordService/ByCacheTest.php
  96. 53 0
      tests/Services/LaborReportsCountingRecordService/GetTest.php
  97. 27 0
      tests/Services/LaborReportsCountingRecordService/UserGroupsCountTest.php
  98. 1 1
      tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php
  99. 2 1
      tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php
  100. 23 0
      tests/Services/OrderCountingRecordService/DateTestTest.php

+ 53 - 3
.gitlab-ci.yml

@@ -3,14 +3,64 @@ stages:
   - test
   - deploy
 
-build_maven:
+cache:
+  paths:
+    - vendor/
+
+before_script:
+  - export PATH=$PATH:/etc/instantclient_19_9
+
+  - if ! command -v composer &> /dev/null
+  - then
+
+  - sudo apt-get update -yqq
+  #- if ! command -v vim &> /dev/null
+  - sudo apt-get install vim -yqq
+  #- fi
+
+  #- if ! command -v unzip &> /dev/null
+  - sudo apt-get install unzip -yqq
+  #- fi
+
+  #- if ! command -v php &> /dev/null
+  - sudo apt-get install php -yqq
+  - sudo apt-get install -yqq php-mbstring mcrypt php-pgsql php-curl php-json php-intl php-gd php-xml php-zip php-bz2 php7.4-opcache php-mysql php-xdebug composer php-bcmath php-pear php-dev
+  - sudo pecl channel-update pecl.php.net
+  #- fi
+
+  - sudo php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"
+  - sudo php composer-setup.php
+  - sudo php -r "unlink('composer-setup.php');"
+  - sudo mv composer.phar /usr/bin/composer
+  # install Oracle Support
+  - phpIni=`php -i|grep "Loaded Configuration File"` && arr=(${phpIni//=>/}) && iniPath=${arr[3]}
+  - sudo sed -i 's/^;\(extension=oci8_12c\)/\1/' ${arr[3]}
+  - sudo wget https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-basic-linux.x64-19.9.0.0.0dbru.zip
+  - sudo wget https://download.oracle.com/otn_software/linux/instantclient/199000/instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip
+  - sudo unzip instantclient-basic-linux.x64-19.9.0.0.0dbru.zip
+  - sudo unzip instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip
+  - sudo mv instantclient_19_9 /etc -f
+  - sudo rm instantclient-basic-linux.x64-19.9.0.0.0dbru.zip instantclient-sdk-linux.x64-19.9.0.0.0dbru.zip -f
+  #- sudo echo /etc/instantclient_19_9/ > /etc/ld.so.conf.d/oracle-instantclient
+  #- sudo ldconfig
+  - sudo sed '$a\export ORACLE_HOME=/etc/instantclient_19_9\n' /etc/profile -i
+  - source /etc/profile
+  - printf "instantclient,/etc/instantclient_19_9\n" |sudo pecl install oci8
+
+  - fi
+  - composer update
+
+
+
+
+build:
   stage: build
   tags:
     - was
   script:
     - echo "build ....."
 
-test_springboot:
+test:
   stage: test
   tags:
     - was
@@ -18,7 +68,7 @@ test_springboot:
     - echo "run test....."
     - vendor/bin/phpunit --testsuite=Unit
 
-deploy_springboot:
+deploy:
   stage: deploy
   tags:
     - was

+ 0 - 2
app/Commodity.php

@@ -36,8 +36,6 @@ class Commodity extends Model
         return $this->owner['code']??'';
     }
 
-
-
     public function newBarcode($barcode){
         $barcodeModel = $this->barcodes()->where('code', $barcode)->first();
         if(!$barcodeModel){

+ 45 - 0
app/Console/Commands/SyncUserVisitMenuLogsCacheTask.php

@@ -0,0 +1,45 @@
+<?php
+
+namespace App\Console\Commands;
+
+use App\Services\LogService;
+use App\Services\CheckActiveMenuService;
+use App\UserVisitMenuLog;
+use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Redis;
+
+class SyncUserVisitMenuLogsCacheTask extends Command
+{
+    /**
+     * The name and signature of the console command.
+     *
+     * @var string
+     */
+    protected $signature = 'syncUserVisitMenuLogsCacheTask';
+
+    /**
+     * The console command description.
+     *
+     * @var string
+     */
+    protected $description = 'Command description';
+
+    /**
+     * Create a new command instance.
+     *
+     * @return void
+     */
+    public function __construct()
+    {
+        parent::__construct();
+    }
+
+    /**
+     * Execute the console command.
+     *
+     */
+    public function handle()
+    {
+        CheckActiveMenuService::sync();
+    }
+}

+ 1 - 0
app/Console/Kernel.php

@@ -19,6 +19,7 @@ class Kernel extends ConsoleKernel
         \App\Console\Commands\InventoryDailyLoggingOwner::class,
         \App\Console\Commands\WASSyncWMSOrderInformation::class,
         \App\Console\Commands\SyncLogCacheTask::class,
+        \App\Console\Commands\SyncUserVisitMenuLogsCacheTask::class,
         \App\Console\Commands\TestTemp::class,
     ];
 

+ 97 - 0
app/Http/Controllers/ControlPanelController.php

@@ -0,0 +1,97 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Services\CheckActiveMenuService;
+use App\Services\LaborReportsCountingRecordService;
+use App\Services\OrderCountingRecordService;
+use App\Services\RealtimePendingOrdersService;
+use Carbon\Carbon;
+use DebugBar\DataFormatter\DataFormatter;
+use Illuminate\Http\Request;
+
+class ControlPanelController extends Controller
+{
+
+
+    /**
+     * ControlPanelController constructor.
+     */
+    public function __construct()
+    {
+        $this->middleware('auth');
+    }
+
+    public function index()
+    {
+        /**
+         * @var CheckActiveMenuService $checkActiveMenuService
+         * @var RealtimePendingOrdersService $realtimePendingOrdersService
+         * @var OrderCountingRecordService $orderCountingRecords
+         * @var LaborReportsCountingRecordService $laborReportsCountingRecordService
+         */
+        $checkActiveMenuService = app(CheckActiveMenuService::class);
+        $menus = $checkActiveMenuService->activeMenus();
+        $realtimePendingOrdersService = app(RealtimePendingOrdersService::class);
+        $warehousesOrders = $realtimePendingOrdersService->warehousesOrders();
+        $orderCountingRecordService = app(OrderCountingRecordService::class);
+        //默认查询一个月的数据
+        $start = (new Carbon())->subMonth()->addDay()->toDateString();
+        $end = (new Carbon())->toDateString();
+        $orderCountingRecords = $orderCountingRecordService->orderCountingRecords($start, $end);
+        $logisticsCountingRecords = $orderCountingRecordService->logisticsCountingRecords($start, $end);
+        $warehouseCountingRecords = $orderCountingRecordService->warehouseCountingRecords($start, $end);
+
+        $laborReportsCountingRecordService = app(LaborReportsCountingRecordService::class);
+        $laborReportsCountingRecords = $laborReportsCountingRecordService->get($start, $end, '日');
+        $laborReportsUserGroupsCount = $laborReportsCountingRecordService->userGroupsCount($start, $end);
+        return view('control.panel', compact('menus', 'warehousesOrders', 'orderCountingRecords', 'logisticsCountingRecords', 'warehouseCountingRecords', 'laborReportsCountingRecords','laborReportsUserGroupsCount'));
+    }
+
+    public function orderCountingRecordsApi(Request $request)
+    {
+        $orderCountingRecordService = app(OrderCountingRecordService::class);
+        $start = $request->start;
+        $end = $request->end;
+        $unit = $request->unit;
+        $orderCountingRecords = $orderCountingRecordService->orderCountingRecords($start, $end, null, $unit, null);
+        return compact('orderCountingRecords');
+    }
+
+    public function logisticsCountingRecordsApi(Request $request)
+    {
+        $orderCountingRecordService = app(OrderCountingRecordService::class);
+        $start = $request->start;
+        $end = $request->end;
+        $logisticsCountingRecords = $orderCountingRecordService->logisticsCountingRecords($start, $end);
+        return compact('logisticsCountingRecords');
+    }
+
+    public function warehouseCountingRecordsApi(Request $request)
+    {
+        $orderCountingRecordService = app(OrderCountingRecordService::class);
+        $start = $request->start;
+        $end = $request->end;
+        $warehouseCountingRecords = $orderCountingRecordService->warehouseCountingRecords($start, $end);
+        return compact('warehouseCountingRecords');
+    }
+
+    public function laborReportsCountingRecordApi(Request $request)
+    {
+        $laborReportsCountingRecordService = app(LaborReportsCountingRecordService::class);
+        $start = $request->start;
+        $end = $request->end;
+        $unit = $request->unit;
+        $laborReportsCountingRecords = $laborReportsCountingRecordService->get($start, $end, $unit);
+        return compact('laborReportsCountingRecords');
+    }
+
+    public function laborReportsUserGroupsCountApi(Request $request)
+    {
+        $laborReportsCountingRecordService = app(LaborReportsCountingRecordService::class);
+        $start = $request->start;
+        $end = $request->end;
+        $laborReportsUserGroupsCount = $laborReportsCountingRecordService->userGroupsCount($start, $end);
+        return compact('laborReportsUserGroupsCount');
+    }
+}

+ 361 - 250
app/Http/Controllers/InventoryAccountController.php

@@ -19,322 +19,433 @@ class InventoryAccountController extends Controller
 {
     public function __construct()
     {
-        app()->singleton('inventoryAccountService',InventoryAccountService::class);
+        app()->singleton('inventoryAccountService', InventoryAccountService::class);
     }
 
     //创建盘点任务
-    public function createStockInventoryMission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
+    public function createStockInventoryMission(Request $request)
+    {
+        if (!Gate::allows("库存管理-盘点")) {
+            return redirect(url('/'));
+        }
 //        $date_start=$request->input('formData.date_start');
 //        $date_end=$request->input('formData.date_end');
 //        $ownerId=$request->input('formData.owner_id')[0];
-        $date_start=$request->input('date_start');
-        $date_end=$request->input('date_end');
-        $ownerId=$request->input('owner_id');
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryAccount=app('inventoryAccountService')->createMission($date_start,$date_end,$ownerId,$location,$barcode);
-        $inventoryAccount=InventoryAccount::with('owner')->find($inventoryAccount->id);
-        if (is_null($inventoryAccount)) return ['success'=>false,'data'=>'参数错误!'];
-        return ['success'=>true,'data'=>$inventoryAccount];
+        $date_start = $request->input('date_start');
+        $date_end = $request->input('date_end');
+        $ownerId = $request->input('owner_id');
+        $location = $request->input('location');
+        $barcode = $request->input('barcode');
+        $inventoryAccount = app('inventoryAccountService')->createMission($date_start, $date_end, $ownerId, $location, $barcode);
+        $inventoryAccount = InventoryAccount::with('owner')->find($inventoryAccount->id);
+        if (is_null($inventoryAccount)) return ['success' => false, 'data' => '参数错误!'];
+        return ['success' => true, 'data' => $inventoryAccount];
     }
+
     //删除盘点任务
-    public function deleteStockInventoryMission($id){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>0,'status'=>'没有权限'];}
-        if(is_null($id)){return ['success'=>false,'data'=>'传入id为空'];}
-        $inventoryAccount=InventoryAccount::where('id',$id)->delete();
-        return ['success'=>true,'data'=>$inventoryAccount];
+    public function deleteStockInventoryMission($id)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => 0, 'status' => '没有权限'];
+        }
+        if (is_null($id)) {
+            return ['success' => false, 'data' => '传入id为空'];
+        }
+        $inventoryAccount = InventoryAccount::where('id', $id)->delete();
+        return ['success' => true, 'data' => $inventoryAccount];
     }
-    public function inventoryChecked(Request $request){
-        if(!Gate::allows('库存管理-盘点-项目审核')){return['success'=>false,'msg'=>'没有权限'];}
-        $id=$request->id;
-        if(is_null($id)){return ['success'=>false,'msg'=>'传入id为空'];}
-        $inventoryAccount=InventoryAccount::query()->where('id',$id)->update([
-            'auditor'=>Auth::user()['id'],
-            'status'=>'已审核',
+
+    public function inventoryChecked(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点-项目审核')) {
+            return ['success' => false, 'msg' => '没有权限'];
+        }
+        $id = $request->id;
+        if (is_null($id)) {
+            return ['success' => false, 'msg' => '传入id为空'];
+        }
+        $inventoryAccount = InventoryAccount::query()->where('id', $id)->update([
+            'auditor' => Auth::user()['id'],
+            'status' => '已审核',
         ]);
-        if ($inventoryAccount==1) {
-            $inventoryAccount=InventoryAccount::query()->with('userAuditor')->find($id);
-            return ['success'=>true,'data'=>$inventoryAccount];
-        }else{
-            return ['success'=>false,'msg'=>'审核失败!'];
+        if ($inventoryAccount == 1) {
+            $inventoryAccount = InventoryAccount::query()->with('userAuditor')->find($id);
+            return ['success' => true, 'data' => $inventoryAccount];
+        } else {
+            return ['success' => false, 'msg' => '审核失败!'];
         }
     }
 
     //盘点-任务页面
-    public function mission(Request $request,OwnerService $ownerService){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
+    public function mission(Request $request, OwnerService $ownerService)
+    {
+        if (!Gate::allows("库存管理-盘点")) {
+            return redirect(url('/'));
+        }
         $paginateParams = $request->input();
-        $queryParam=$request->all();
-        $inventoryAccounts=app('inventoryAccountService')->paginate($queryParam);
-        $owners=$ownerService->getSelection();
-        return view('inventory.stockInventory.mission',compact('owners','inventoryAccounts','paginateParams'));
+        $queryParam = $request->all();
+        $inventoryAccounts = app('inventoryAccountService')->paginate($queryParam);
+        $owners = $ownerService->getSelection();
+        return view('inventory.stockInventory.mission', compact('owners', 'inventoryAccounts', 'paginateParams'));
     }
+
     //进入盘点中或复盘页面
-    public function enterStockInventory($id,Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
-        $inventoryAccount=InventoryAccount::with('owner')->find($id);
-        $inventoryAccountMissions=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->where('inventory_account_id',$id)->orderBy('difference_amount','desc')->get();
-        return view('inventory.stockInventory.inventoryMission',compact('inventoryAccount','inventoryAccountMissions'));
+    public function enterStockInventory($id, Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        if (!$id) return ['success' => false, 'data' => '参数错误!'];
+        $inventoryAccount = InventoryAccount::with('owner')->find($id);
+        $inventoryAccountMissions = InventoryAccountMission::with(['commodity.barcodes', 'stockInventoryPersons'])->where('inventory_account_id', $id)->orderBy('difference_amount', 'desc')->get();
+        return view('inventory.stockInventory.inventoryMission', compact('inventoryAccount', 'inventoryAccountMissions'));
     }
-    public function enterBlindReceive($id){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
-        $inventoryAccount=InventoryAccount::with('owner')->find($id);
-        return view('inventory.stockInventory.blindReceive',compact('inventoryAccount'));
+
+    public function enterBlindReceive($id)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        if (!$id) return ['success' => false, 'data' => '参数错误!'];
+        $inventoryAccount = InventoryAccount::with('owner')->find($id);
+        return view('inventory.stockInventory.blindReceive', compact('inventoryAccount'));
     }
+
     //依据盘点任务id进行 --盘点
-    public function stockInventory(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryId=$request->input('inventoryId');
-        $count=$request->input('count');
-        $id=$request->input('id');
-        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        /** @var InventoryAccountService $inventoryAccountMission */
-        $inventoryAccountService=app('inventoryAccountService');
-        $inventoryAccountMission=$inventoryAccountService->stockInventory($id,$location,$barcode,$count,$inventoryId);
-        if (!$inventoryAccountMission)return ['success'=>false,'data'=>'参数错误!'];
+    public function stockInventory(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        $location = $request->input('location');
+        $barcode = $request->input('barcode');
+        $inventoryId = $request->input('inventoryId');
+        $count = $request->input('count');
+        $id = $request->input('id');
+        if (is_null($count)) return ['success' => false, 'data' => '盘点数不能为空!'];
+        /** @var InventoryAccountService $inventoryAccountService */
+        $inventoryAccountService = app('inventoryAccountService');
+        $inventoryAccountMission = $inventoryAccountService->stockInventory($id, $location, $barcode, $count, $inventoryId);
+        if (!$inventoryAccountMission) return ['success' => false, 'data' => '参数错误!'];
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccount=$inventoryService->updateInventory($inventoryId);
-        $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
-        return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccount = $inventoryService->updateInventory($inventoryId);
+        $stockInventoryPersons = $inventoryAccountMission->stockInventoryPersons;
+        return ['success' => true, 'inventoryMission' => $inventoryAccountMission, 'inventory' => $inventoryAccount, 'stockInventoryPersons' => $stockInventoryPersons];
     }
-    public function baseOnBlindReceive(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $location=$request->input('location');
-        $inventoryId=$request->input('inventoryId');
-        $owner_code=$request->input('owner_code');
-        $goodses=$request->input('goodses');
-        if (!$location) return ['success'=>false,'fail_info'=>'盘点库位不存在!'];
-        if (count($goodses)<1) return ['success'=>false,'fail_info'=>'盘点商品不存在!'];
+
+    public function baseOnBlindReceive(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        $location = $request->input('location');
+        $inventoryId = $request->input('inventoryId');
+        $owner_code = $request->input('owner_code');
+        $goodses = $request->input('goodses');
+        if (!$location) return ['success' => false, 'fail_info' => '盘点库位不存在!'];
+        if (count($goodses) < 1) return ['success' => false, 'fail_info' => '盘点商品不存在!'];
         //dd($location,$owner_code,$goodses,$inventoryId,$owner_id);
         /** @var InventoryAccountService $inventoryAccountMission */
-        $inventoryAccountService=app('inventoryAccountService');
-        $inventoryAccountMissions=$inventoryAccountService->baseOnBlindReceive($location,$owner_code,$goodses,$inventoryId);
-        if (count($inventoryAccountMissions)<0)return ['success'=>false,'fail_info'=>'盲收盘点失败!'];
+        $inventoryAccountService = app('inventoryAccountService');
+        $inventoryAccountMissions = $inventoryAccountService->baseOnBlindReceive($location, $owner_code, $goodses, $inventoryId);
+        if (count($inventoryAccountMissions) < 0) return ['success' => false, 'fail_info' => '盲收盘点失败!'];
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccount=$inventoryService->updateInventory($inventoryId);
-        if ($inventoryAccountMissions&&$inventoryAccount)
-        $stockInventoryPersons=$inventoryAccountMissions[0]->stockInventoryPersons;
-        return ['success'=>true,'inventoryMissions'=>$inventoryAccountMissions,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccount = $inventoryService->updateInventory($inventoryId);
+        if ($inventoryAccountMissions && $inventoryAccount)
+            $stockInventoryPersons = $inventoryAccountMissions[0]->stockInventoryPersons;
+        return ['success' => true, 'inventoryMissions' => $inventoryAccountMissions, 'inventory' => $inventoryAccount, 'stockInventoryPersons' => $stockInventoryPersons];
     }
+
     //根据该库存和产品条码查询该条盘点记录??
-    public function searchStockInventoryRecord(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryId=$request->input('inventoryId');
+    public function searchStockInventoryRecord(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        $location = $request->input('location');
+        $barcode = $request->input('barcode');
+        $inventoryId = $request->input('inventoryId');
         /** @var InventoryAccountService $application */
         $application = app('inventoryAccountService');
-        $inventoryAccountMissions= $application->searchStockInventoryRecord($location,$barcode,$inventoryId);
-        if ($inventoryAccountMissions->isEmpty())return ['success'=>false,'data'=>'没有找到相应记录!'];
+        $inventoryAccountMissions = $application->searchStockInventoryRecord($location, $barcode, $inventoryId);
+        if ($inventoryAccountMissions->isEmpty()) return ['success' => false, 'data' => '没有找到相应记录!'];
 //        $stockInventoryPersons=$inventoryAccountMissions->stockInventoryPersons;
 //        return ['success'=>true,'data'=>$inventoryAccountMissions,'stockInventoryPersons'=>$stockInventoryPersons];
-        return ['success'=>true,'data'=>$inventoryAccountMissions];
+        return ['success' => true, 'data' => $inventoryAccountMissions];
     }
 
     //盘点任务导出
-    public function stockInventoryExport(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        ini_set('max_execution_time',3500);
-        ini_set('memory_limit','3526M');
-        if ($request->checkAllSign){
+    public function stockInventoryExport(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        ini_set('max_execution_time', 3500);
+        ini_set('memory_limit', '3526M');
+        if ($request->checkAllSign) {
             $request->offsetUnset('checkAllSign');
-            $queryParam=$request->all();
-            $inventoryAccounts=app('inventoryAccountService')->get($queryParam);
-        }else{
-            $queryParam=$request->all();
-            $inventoryAccounts=app('inventoryAccountService')->some($queryParam);
-        }
-        $row=[[
-            'id'=>'盘点编号',
-            'status'=>'盘点状态',
-            'created_at'=>'创建时间',
-            'owner_id'=>'货主',
-            'type'=>'任务类型',
-            'start_at'=>'起始时间',
-            'end_at'=>'结束时间',
-            'total'=>'记录数',
-            'processed'=>'已盘数',
-            'surplus'=>'剩余数',
-            'difference'=>'复盘差异',
-            'returned'=>'复盘归位',
+            $queryParam = $request->all();
+            $inventoryAccounts = app('inventoryAccountService')->get($queryParam);
+        } else {
+            $queryParam = $request->all();
+            $inventoryAccounts = app('inventoryAccountService')->some($queryParam);
+        }
+        $row = [[
+            'id' => '盘点编号',
+            'status' => '盘点状态',
+            'created_at' => '创建时间',
+            'owner_id' => '货主',
+            'type' => '任务类型',
+            'start_at' => '起始时间',
+            'end_at' => '结束时间',
+            'total' => '记录数',
+            'processed' => '已盘数',
+            'surplus' => '剩余数',
+            'difference' => '复盘差异',
+            'returned' => '复盘归位',
         ]];
-        $list=[];
-        for ($i=0; $i<count($inventoryAccounts);$i++){
-            $inventoryAccount=$inventoryAccounts[$i];
-            $w=[
-                'id'=>isset($inventoryAccount->id)?$inventoryAccount->id:'',
-                'status'=>isset($inventoryAccount->status)?$inventoryAccount->status:'',
-                'created_at'=>isset($inventoryAccount->created_at)?$inventoryAccount->created_at:'',
-                'owner_id'=>isset($inventoryAccount->owner->name)?$inventoryAccount->owner->name:'',
-                'type'=>isset($inventoryAccount->type)?$inventoryAccount->type:'',
-                'start_at'=>isset($inventoryAccount->start_at)?$inventoryAccount->start_at:'',
-                'end_at'=>isset($inventoryAccount->end_at)?$inventoryAccount->end_at:'',
-                'total'=>isset($inventoryAccount->total)?$inventoryAccount->total:'',
-                'processed'=>isset($inventoryAccount->processed)?$inventoryAccount->processed:'',
-                'surplus'=>isset($inventoryAccount->surplus)?$inventoryAccount->surplus:'',
-                'difference'=>isset($inventoryAccount->difference)?$inventoryAccount->difference:'',
-                'returned'=>isset($inventoryAccount->returned)?$inventoryAccount->returned:'',
+        $list = [];
+        for ($i = 0; $i < count($inventoryAccounts); $i++) {
+            $inventoryAccount = $inventoryAccounts[$i];
+            $w = [
+                'id' => isset($inventoryAccount->id) ? $inventoryAccount->id : '',
+                'status' => isset($inventoryAccount->status) ? $inventoryAccount->status : '',
+                'created_at' => isset($inventoryAccount->created_at) ? $inventoryAccount->created_at : '',
+                'owner_id' => isset($inventoryAccount->owner->name) ? $inventoryAccount->owner->name : '',
+                'type' => isset($inventoryAccount->type) ? $inventoryAccount->type : '',
+                'start_at' => isset($inventoryAccount->start_at) ? $inventoryAccount->start_at : '',
+                'end_at' => isset($inventoryAccount->end_at) ? $inventoryAccount->end_at : '',
+                'total' => isset($inventoryAccount->total) ? $inventoryAccount->total : '',
+                'processed' => isset($inventoryAccount->processed) ? $inventoryAccount->processed : '',
+                'surplus' => isset($inventoryAccount->surplus) ? $inventoryAccount->surplus : '',
+                'difference' => isset($inventoryAccount->difference) ? $inventoryAccount->difference : '',
+                'returned' => isset($inventoryAccount->returned) ? $inventoryAccount->returned : '',
             ];
-            $list[$i]=$w;
+            $list[$i] = $w;
         }
-        return Excel::download(new Export($row,$list),date('YmdHis', time()).'-盘点任务记录单.xlsx');
+        return Excel::download(new Export($row, $list), date('YmdHis', time()) . '-盘点任务记录单.xlsx');
     }
-    public function stockInventoryEnd(Request $request){
-        if (!Gate::allows('库存管理-盘点-结束初盘')){return ['success'=>false,'data'=>'没有权限']; }
-        $id=$request->input('id');
-        if (!$id) return ['success'=>false,'data'=>'参数错误!'];
-        $inventoryAccount=InventoryAccount::query()->where('id',$id)->update(['status'=>'复盘中']);
-        app('LogService')->log(__METHOD__,'结束初盘任务'.__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        if ($inventoryAccount>0) return ['success'=>true,'data'=>'复盘中'];
-        return ['success'=>false,'data'=>'参数错误!'];
+
+    public function stockInventoryEnd(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点-结束初盘')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $id = $request->input('id');
+        if (!$id) return ['success' => false, 'data' => '参数错误!'];
+        $inventoryAccount = InventoryAccount::query()->where('id', $id)->update(['status' => '复盘中']);
+        app('LogService')->log(__METHOD__, '结束初盘任务' . __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+        if ($inventoryAccount > 0) return ['success' => true, 'data' => '复盘中'];
+        return ['success' => false, 'data' => '参数错误!'];
     }
-    public function syncOwners(OwnerService $ownerService){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $owners=$ownerService->syncOwnersData();
-        if (!$owners)return ['success'=>false,'data'=>'同步货主失败!'];
-        return ['success'=>true,'data'=>$owners];
+
+    public function syncOwners(OwnerService $ownerService)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        $owners = $ownerService->syncOwnersData();
+        if (!$owners) return ['success' => false, 'data' => '同步货主失败!'];
+        return ['success' => true, 'data' => $owners];
     }
-    public function 修改质量状态(Request $request){
-        if (!Gate::allows('库存管理-盘点')){return redirect(url('/')); }
-        $id=$request->input('id');
-        $location=$request->location;
-        $sku=$request->sku;
-        $quality=$request->quality;
-        $ownerCode=$request->ownerCode;
-        $inventoryAccountMission=app('inventoryAccountService')->修改质量状态($id,$location,$sku,$quality,$ownerCode);
-        app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->toArray()),Auth::user()['id']);
-        if ($inventoryAccountMission==null) return ['success'=>false,'data'=>'WMS中不存在该条记录!'];
-        return ['success'=>true,'data'=>'质量状态修改成功'];
+
+    public function 修改质量状态(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return redirect(url('/'));
+        }
+        $id = $request->input('id');
+        $location = $request->location;
+        $sku = $request->sku;
+        $quality = $request->quality;
+        $ownerCode = $request->ownerCode;
+        $inventoryAccountMission = app('inventoryAccountService')->修改质量状态($id, $location, $sku, $quality, $ownerCode);
+        app('LogService')->log(__METHOD__, __FUNCTION__, json_encode($request->toArray()), Auth::user()['id']);
+        if ($inventoryAccountMission == null) return ['success' => false, 'data' => 'WMS中不存在该条记录!'];
+        return ['success' => true, 'data' => '质量状态修改成功'];
 
     }
-    public function 完结盘点任务($id){
-        if(!Gate::allows('库存管理-盘点-完结')){return['success'=>false,'status'=>'没有权限'];}
-        if (!$id)return['success'=>false,'status'=>'参数错误!'];
-        $inventoryAccount=app('inventoryAccountService')->完结盘点任务($id);
-        if (!$inventoryAccount)return['success'=>false,'status'=>'修改完结状态失败!'];
-        return['success'=>true,'data'=>$inventoryAccount];
+
+    public function 完结盘点任务($id)
+    {
+        if (!Gate::allows('库存管理-盘点-完结')) {
+            return ['success' => false, 'status' => '没有权限'];
+        }
+        if (!$id) return ['success' => false, 'status' => '参数错误!'];
+        $inventoryAccount = app('inventoryAccountService')->完结盘点任务($id);
+        if (!$inventoryAccount) return ['success' => false, 'status' => '修改完结状态失败!'];
+        return ['success' => true, 'data' => $inventoryAccount];
 
     }
-    public function 增加系统之外的盘点记录(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $location=$request->input('location');
-        $barcode=$request->input('barcode');
-        $inventoryId=$request->input('inventoryId');
-        $count=$request->input('count');
-        $owner_code=$request->input('owner_code');
-        $param=$request->input('param');
-        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        $inventoryAccountMission=app('inventoryAccountService')->增加系统之外的盘点记录($location,$barcode,$inventoryId,$count,$owner_code,$param);
-        if (!$inventoryAccountMission)return ['success'=>false,'data'=>'添加系统之外的库位记录失败!'];
-        $inventoryAccountMission=InventoryAccountMission::with(['commodity.barcodes','stockInventoryPersons'])->where('id',$inventoryAccountMission->id)->first();
-        $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
-        return ['success'=>true,'inventoryAccountMission'=>$inventoryAccountMission,'stockInventoryPersons'=>$stockInventoryPersons];
+
+    public function 增加系统之外的盘点记录(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $location = $request->input('location');
+        $barcode = $request->input('barcode');
+        $inventoryId = $request->input('inventoryId');
+        $count = $request->input('count');
+        $owner_code = $request->input('owner_code');
+        $param = $request->input('param');
+        if (is_null($count)) return ['success' => false, 'data' => '盘点数不能为空!'];
+        $inventoryAccountMission = app('inventoryAccountService')->增加系统之外的盘点记录($location, $barcode, $inventoryId, $count, $owner_code, $param);
+        if (!$inventoryAccountMission) return ['success' => false, 'data' => '添加系统之外的库位记录失败!'];
+        $inventoryAccountMission = InventoryAccountMission::with(['commodity.barcodes', 'stockInventoryPersons'])->where('id', $inventoryAccountMission->id)->first();
+        $stockInventoryPersons = $inventoryAccountMission->stockInventoryPersons;
+        return ['success' => true, 'inventoryAccountMission' => $inventoryAccountMission, 'stockInventoryPersons' => $stockInventoryPersons];
     }
-    public function 盘点选中任务(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $id=$request->input('id');
-        $count=$request->count;
-        $inventoryId=$request->input('inventoryId');
-        $produced_at=$request->input('produced_at');
-        $valid_at=$request->input('valid_at');
-        $batch_number=$request->input('batch_number');
-        if (is_null($count)) return ['success'=>false,'data'=>'盘点数不能为空!'];
-        if ($produced_at||$valid_at||$batch_number){
+
+    public function 盘点选中任务(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $id = $request->input('id');
+        $count = $request->count;
+        $inventoryId = $request->input('inventoryId');
+        $produced_at = $request->input('produced_at');
+        $valid_at = $request->input('valid_at');
+        $batch_number = $request->input('batch_number');
+        if (is_null($count)) return ['success' => false, 'data' => '盘点数不能为空!'];
+        if ($produced_at || $valid_at || $batch_number) {
             /** @var InventoryAccountService $inventoryAccountMission */
-            $inventoryAccountService=app('inventoryAccountService');
-            $inventoryAccountMission=$inventoryAccountService ->盘点生产日期_失效日期_批号有改动任务($id,$count,$inventoryId,$produced_at,$valid_at,$batch_number);
-            if (!$inventoryAccountMission)return ['success'=>false,'data'=>'盘点生产日期_失效日期_批号有改动任务失败!'];
+            $inventoryAccountService = app('inventoryAccountService');
+            $inventoryAccountMission = $inventoryAccountService->盘点生产日期_失效日期_批号有改动任务($id, $count, $inventoryId, $produced_at, $valid_at, $batch_number);
+            if (!$inventoryAccountMission) return ['success' => false, 'data' => '盘点生产日期_失效日期_批号有改动任务失败!'];
             /** @var InventoryAccountService $inventoryService */
-            $inventoryService=app('inventoryAccountService');
-            $inventoryAccount=$inventoryService->updateInventory($inventoryId);
-            $stockInventoryPersons=$inventoryAccountMission[0]->stockInventoryPersons;
-            return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
-        }else{
+            $inventoryService = app('inventoryAccountService');
+            $inventoryAccount = $inventoryService->updateInventory($inventoryId);
+            $stockInventoryPersons = $inventoryAccountMission[0]->stockInventoryPersons;
+            return ['success' => true, 'inventoryMission' => $inventoryAccountMission, 'inventory' => $inventoryAccount, 'stockInventoryPersons' => $stockInventoryPersons];
+        } else {
             /** @var InventoryAccountService $inventoryAccountMission */
-            $inventoryAccountService=app('inventoryAccountService');
-            $inventoryAccountMission=$inventoryAccountService ->盘点选中任务($id,$count,$inventoryId);
-            if (!$inventoryAccountMission)return ['success'=>false,'data'=>'盘点选中任务失败!'];
+            $inventoryAccountService = app('inventoryAccountService');
+            $inventoryAccountMission = $inventoryAccountService->盘点选中任务($id, $count, $inventoryId);
+            if (!$inventoryAccountMission) return ['success' => false, 'data' => '盘点选中任务失败!'];
             /** @var InventoryAccountService $inventoryService */
-            $inventoryService=app('inventoryAccountService');
-            $inventoryAccount=$inventoryService->updateInventory($inventoryId);
-            $stockInventoryPersons=$inventoryAccountMission->stockInventoryPersons;
-            return ['success'=>true,'inventoryMission'=>$inventoryAccountMission,'inventory'=>$inventoryAccount,'stockInventoryPersons'=>$stockInventoryPersons];
+            $inventoryService = app('inventoryAccountService');
+            $inventoryAccount = $inventoryService->updateInventory($inventoryId);
+            $stockInventoryPersons = $inventoryAccountMission->stockInventoryPersons;
+            return ['success' => true, 'inventoryMission' => $inventoryAccountMission, 'inventory' => $inventoryAccount, 'stockInventoryPersons' => $stockInventoryPersons];
         }
     }
 
-    public function 删除盘点记录(Request $request){
-        if(!Gate::allows('库存管理-盘点-删除')){return['success'=>false,'data'=>'没有权限'];}
-        $inventoryAccountMissionId=$request->input('inventoryAccountMissionId');
-        $inventoryAccountId=$request->input('inventoryAccountId');
-        if(is_null($inventoryAccountMissionId)){return ['success'=>false,'data'=>'传入id为空'];}
+    public function 删除盘点记录(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点-删除')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $inventoryAccountMissionId = $request->input('inventoryAccountMissionId');
+        $inventoryAccountId = $request->input('inventoryAccountId');
+        if (is_null($inventoryAccountMissionId)) {
+            return ['success' => false, 'data' => '传入id为空'];
+        }
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccountMission=$inventoryService->删除盘点记录($inventoryAccountMissionId,$inventoryAccountId);
-        return ['success'=>true,'data'=>$inventoryAccountMission];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccountMission = $inventoryService->删除盘点记录($inventoryAccountMissionId, $inventoryAccountId);
+        return ['success' => true, 'data' => $inventoryAccountMission];
     }
-    public function 跳过盘点记录(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $inventoryAccountMissionId=$request->inventoryAccountMissionId;
-        $inventoryAccountId=$request->input('inventoryAccountId');
-        if(is_null($inventoryAccountMissionId)){return ['success'=>false,'data'=>'传入id为空'];}
+
+    public function 跳过盘点记录(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $inventoryAccountMissionId = $request->inventoryAccountMissionId;
+        $inventoryAccountId = $request->input('inventoryAccountId');
+        if (is_null($inventoryAccountMissionId)) {
+            return ['success' => false, 'data' => '传入id为空'];
+        }
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccountMission=$inventoryService->跳过盘点记录($inventoryAccountMissionId,$inventoryAccountId);
-        return ['success'=>true,'inventoryAccountMission'=>$inventoryAccountMission];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccountMission = $inventoryService->跳过盘点记录($inventoryAccountMissionId, $inventoryAccountId);
+        return ['success' => true, 'inventoryAccountMission' => $inventoryAccountMission];
     }
-    public function 确认盘点差异(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $inventoryAccountMissionId=$request->inventoryAccountMissionId;
-        $inventoryAccountId=$request->input('inventoryAccountId');
-        if(is_null($inventoryAccountMissionId)){return ['success'=>false,'data'=>'传入id为空'];}
+
+    public function 确认盘点差异(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $inventoryAccountMissionId = $request->inventoryAccountMissionId;
+        $inventoryAccountId = $request->input('inventoryAccountId');
+        if (is_null($inventoryAccountMissionId)) {
+            return ['success' => false, 'data' => '传入id为空'];
+        }
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccountMission=$inventoryService->确认盘点差异($inventoryAccountMissionId,$inventoryAccountId);
-        return ['success'=>true,'inventoryAccountMission'=>$inventoryAccountMission];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccountMission = $inventoryService->确认盘点差异($inventoryAccountMissionId, $inventoryAccountId);
+        return ['success' => true, 'inventoryAccountMission' => $inventoryAccountMission];
     }
-    public function 批量跳过或确认差异(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $checkData=$request->checkData;
-        if(is_null($checkData)){return ['success'=>false,'data'=>'传入勾选盘点记录为空'];}
-        $marks=[];
-        foreach ($checkData as $inventoryMission){
-            array_push($marks,$inventoryMission['mark']);
-        }
-        if (in_array('确认差异',$marks)||in_array('跳过',$marks)||in_array('无差异',$marks)||in_array('已复盘无差异',$marks))return ['success'=>false,'data'=>'传入勾选盘点记录存在不可操作项!'];
+
+    public function 批量跳过或确认差异(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $checkData = $request->checkData;
+        if (is_null($checkData)) {
+            return ['success' => false, 'data' => '传入勾选盘点记录为空'];
+        }
+        $marks = [];
+        foreach ($checkData as $inventoryMission) {
+            array_push($marks, $inventoryMission['mark']);
+        }
+        if (in_array('确认差异', $marks) || in_array('跳过', $marks) || in_array('无差异', $marks) || in_array('已复盘无差异', $marks)) return ['success' => false, 'data' => '传入勾选盘点记录存在不可操作项!'];
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $inventoryAccountMissions=$inventoryService->批量跳过或确认差异($checkData);
-        return ['success'=>true,'inventoryAccountMissions'=>$inventoryAccountMissions];
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccountMissions = $inventoryService->批量跳过或确认差异($checkData);
+        return ['success' => true, 'inventoryAccountMissions' => $inventoryAccountMissions];
     }
-    public function exportInventoryAccountMission(Request $request){
-        if(!Gate::allows("库存管理-盘点")){ return redirect(url('/'));  }
-        $post = Http::post(config('go.export.url'),['type'=>'inventoryAccountMission','data'=>$request->data]);
-        if ($post->status() == 500){
+
+    public function exportInventoryAccountMission(Request $request)
+    {
+        if (!Gate::allows("库存管理-盘点")) {
+            return redirect(url('/'));
+        }
+        $post = Http::post(config('go.export.url'), ['type' => 'inventoryAccountMission', 'data' => $request->data]);
+        if ($post->status() == 500) {
             throw new Exception($post->header("Msg"));
         }
-        return response($post,200, [
-            "Content-type"=>"application/octet-stream",
-            "Content-Disposition"=>"attachment; filename=库存盘点记录-".date('ymdHis').'.xlsx',
+        return response($post, 200, [
+            "Content-type" => "application/octet-stream",
+            "Content-Disposition" => "attachment; filename=库存盘点记录-" . date('ymdHis') . '.xlsx',
         ]);
     }
-    public function searchCommodityByBarcode(Request $request){
-        if(!Gate::allows('库存管理-盘点')){return['success'=>false,'data'=>'没有权限'];}
-        $barcode=$request->input('barcode');
-        $owner_code=$request->input('owner_code');
+
+    public function searchCommodityByBarcode(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) {
+            return ['success' => false, 'data' => '没有权限'];
+        }
+        $barcode = $request->input('barcode');
+        $owner_code = $request->input('owner_code');
         /** @var InventoryAccountService $inventoryService */
-        $inventoryService=app('inventoryAccountService');
-        $commodity=$inventoryService->searchCommodityByBarcode($barcode,$owner_code);
-        if ($commodity){
-            return ['success'=>true,'data'=>$commodity];
-        }else{
-            return ['success'=>false,'data'=>'输入的条码没有对应商品!'];
+        $inventoryService = app('inventoryAccountService');
+        $commodity = $inventoryService->searchCommodityByBarcode($barcode, $owner_code);
+        if ($commodity) {
+            return ['success' => true, 'data' => $commodity];
+        } else {
+            return ['success' => false, 'data' => '输入的条码没有对应商品!'];
         }
     }
+    //根据库位批量盘点该库位下盘点记录
+    public function batchStockByLocation(Request $request)
+    {
+        if (!Gate::allows('库存管理-盘点')) return ['success' => false, 'msg' => '没有权限'];
+        $missions=$request->mission;
+        $inventoryId=$request->inventoryId;
+        if (!$inventoryId||count($missions)<1) return ['success' => false, 'msg' => '参数错误'];
+        /** @var InventoryAccountService $inventoryService */
+        $inventoryService = app('inventoryAccountService');
+        $inventoryMissions=$inventoryService->batchStockByLocation($missions,$inventoryId);
+        $inventoryService = app('inventoryAccountService');
+        $inventoryAccount = $inventoryService->updateInventory($inventoryId);
+        $stockInventoryPersons = $inventoryMissions[0]->stockInventoryPersons;
+        return ['success' => true, 'inventoryMission' => $inventoryMissions, 'inventory' => $inventoryAccount, 'stockInventoryPersons' => $stockInventoryPersons];
+    }
 }

+ 14 - 1
app/Http/Controllers/PackageController.php

@@ -56,7 +56,6 @@ class PackageController extends Controller
         $package=null;
         $successTip = '操作成功';
 
-
         /** @var OrderPackage $package */
         if ($order_code){
             $package=OrderPackage::query()->with(['order'=>function($query)use($order_code){
@@ -71,11 +70,18 @@ class PackageController extends Controller
             }
         }
         $accomplishToWMS=new Api\thirdPart\flux\PackageController();
+
+
         if($batch_number){
             app('LogService')->log(__METHOD__,'活动波次开始同步_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
 //            $this->syncBatch($package->batch_number,$weight,null,null,null,Carbon::now(),null);
             $result=$accomplishToWMS->markWMSOnBatch($batch_number,$weight);
+
+
+
             OrderPackage::createPackagesFromBatchCode($batch_number,$weight);
+
+
             if($package&&$package->isActivityBatch())
                 $package->unifyThisMeasureUnderSameBatch();
 
@@ -85,6 +91,7 @@ class PackageController extends Controller
                 return redirect('package/create')->with('successTip', $successTip);
             }
             Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].$batch_number);
+
             return redirect('package/create')->with('successError','录入失败!'.$result['message']);
         }
         if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
@@ -103,7 +110,9 @@ class PackageController extends Controller
             $package->save();
             app('LogService')->log(__METHOD__,'create_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
 //            event(new WeighedEvent($package));
+
         }else{
+
             /** @var OrderPackageService */
             $package = app('OrderPackageService')->firstOrCreate($logistic_number,[
                 'weight'=>$weight,
@@ -124,7 +133,11 @@ class PackageController extends Controller
             }
             $package->save();
             $successTip = $str;
+
+
         }
+
+
         return redirect('package/create')->with('successTip', $successTip);
     }
 

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

@@ -33,6 +33,7 @@ use App\RejectedBillItem;
 use App\Services\CacheService;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
+use App\Services\FeatureService;
 use App\Services\InventoryCompareService;
 use App\Services\OracleDocAsnHerderService;
 use App\Services\OracleDOCOrderHeaderService;
@@ -43,6 +44,7 @@ use App\Services\OrderTrackingService;
 use App\Services\OwnerService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
+use App\Unit;
 use App\User;
 use App\Warehouse;
 use Carbon\Carbon;
@@ -51,6 +53,7 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Redis;
 use Illuminate\Support\Str;
 use Maatwebsite\Excel\Facades\Excel;
 use Ramsey\Collection\Collection;
@@ -91,8 +94,12 @@ class TestController extends Controller
         }
     }
     public function test4(){
-        $a = app('CommodityService')->isExist(["barcode"=>"XUNI02"]);
-        dd($a);
+        $units = Unit::get();
+        //dd($units);
+        foreach ($units as $index => $unit){
+            if ($index!=1)unset($units[$index]);
+        }
+        dd($units);
     }
 
     public function updateLaborRemark(){
@@ -954,10 +961,14 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         app(StoreService::class)->syncWmsAsnData($startDate);
     }
 
-    public function chageOrder()
+    public function changeOrder()
     {
+        /**
+         * @var OrderService $orderService
+         */
         $carbon =Carbon::now()->subMinutes(30);
-        $orderHeader = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
+        var_dump('$orderHeader',new Carbon());
+        $orderHeader_start = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
             ->with(['oracleBASCustomer'=>function($query){
                 $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
             },'oracleDOCOrderDetails'=>function($query){
@@ -968,14 +979,15 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
                 $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
             }])
             ->where('DOC_Order_Header.addTime','>=',$carbon)
-//            ->where('orderno','SO201112029795')
+//            ->where('DOC_Order_Header.editTime','>=',$carbon)
             ->get();
-        var_dump($orderHeader->count());
         var_dump((string)Carbon::now());
-        /** @var OrderService $orderService */
+
         $orderService = app('OrderService');
-        $orderService->syncOrder($orderHeader);
+        $orderService->syncOrder($orderHeader_start);
+//      $orderService->syncOrder($orderHeader_edit);
         var_dump((string)Carbon::now());
+//      orderService  getCreateOrderModelsByWMSOrderHeaders
     }
 
     public function testOrderPackages(){
@@ -1119,4 +1131,27 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
 //        app('LogService')->log(__METHOD__,__FUNCTION__,json_encode(['$orderIds'=>$orderIds,'$orderPackages'=>$orderPackages,'$orderPackageIds'=>$orderPackageIds,'$orderTrackingIds'=>$orderTrackingIds,]));
 //
 //    }
+
+    public function testSyncOrder()
+     {
+        $carbon =Carbon::now()->subHours(1);
+        $date = '2020-05-18 18:13:50';
+        $orderHeader = OracleDOCOrderHeader::query()->selectRaw(implode(',',OracleDOCOrderHeaderService::$columns))
+            ->with(['oracleBASCustomer'=>function($query){
+                $query->selectRaw('BAS_CUSTOMER.CustomerID,BAS_CUSTOMER.Customer_Type,BAS_CUSTOMER.Descr_C,BAS_CUSTOMER.Active_Flag');
+            },'oracleDOCOrderDetails'=>function($query){
+                $query->selectRaw('doc_order_details.orderNo,doc_order_details.customerid,doc_order_details.sku,doc_order_details.QtyOrdered');
+            }, 'actAllocationDetails'=>function($query){
+                $query->selectRaw('ACT_Allocation_Details.AllocationDetailsID,ACT_Allocation_Details.OrderNo,ACT_Allocation_Details.Qty_Each,ACT_Allocation_Details.PickToTraceID,ACT_Allocation_Details.CustomerID,ACT_Allocation_Details.Sku');
+            },'oracleBASCode'=>function($query){
+                $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
+            }])
+//            ->where('DOC_Order_Header.addTime','>=',$startDate)
+//            ->where('orderno','SO201112029795')
+            ->where('DOC_Order_Header.addTime','>=',$carbon)
+            ->get();
+        /** @var OrderService $service */
+        $service = app('OrderService');
+        $service->syncOrder($orderHeader);
+    }
 }

+ 20 - 20
app/Http/Controllers/UserDutyCheckController.php

@@ -135,26 +135,26 @@ class UserDutyCheckController extends Controller
             $userDutyCheck->save();
             app('LogService')->log(__METHOD__, "创建打卡记录" . __FUNCTION__, json_encode($userDutyCheck));
             return $userDutyCheck;
-        }
-
-        if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'import') {
-            if ($userDutyCheckOld->type == '登入'&&$userDutyCheckOld->laborReport) {
-                $userDutyCheck->import = true;//已入场的不能再入场
-                return $userDutyCheck;
+        }else{
+            if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'import') {
+                if ($userDutyCheckOld->type == '登入'&&$userDutyCheckOld->laborReport) {
+                    $userDutyCheck->import = true;//已入场的不能再入场
+                    return $userDutyCheck;
+                }
+                $userDutyCheck->type = '登入';
             }
-            $userDutyCheck->type = '登入';
-        }
-        if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'export') {
-            if ($userDutyCheckOld->type == '登出') {
-                $userDutyCheck->export = true;//已出场的不能再出场
-                return $userDutyCheck;
+            if ($importAndExportQRCodeType && $importAndExportQRCodeType == 'export') {
+                if ($userDutyCheckOld->type == '登出') {
+                    $userDutyCheck->export = true;//已出场的不能再出场
+                    return $userDutyCheck;
+                }
+                $userDutyCheck->verify_user_id = $userDutyCheckOld->verify_user_id;
+                $userDutyCheck->type = '登出';
             }
-            $userDutyCheck->verify_user_id = $userDutyCheckOld->verify_user_id;
-            $userDutyCheck->type = '登出';
+            $userDutyCheck->save();
+            app('LogService')->log(__METHOD__, "创建打卡记录" . __FUNCTION__, json_encode($userDutyCheck));
+            return $userDutyCheck;
         }
-        $userDutyCheck->save();
-        app('LogService')->log(__METHOD__, "创建打卡记录" . __FUNCTION__, json_encode($userDutyCheck));
-        return $userDutyCheck;
     }
     //去往登记资料页面
     public function createUserDetail($mobile_phone)
@@ -196,7 +196,7 @@ class UserDutyCheckController extends Controller
         if ($errorMessage) return $errorMessage;
         $laravelEchoPrefix = config('database.redis.options.prefix');
         return response()->view('personnel/checking-in/importAndExportSuccess',['full_name'=>$userDetail->full_name,'checked_at'=>$userDutyCheck->checked_at,'type'=>$userDutyCheck->type,'laravelEchoPrefix'=>$laravelEchoPrefix])
-            ->cookie('userLaborToken', $userLaborToken, config('users.cookie_expire_minutes'), '/');
+            ->cookie('userLaborToken', $userLaborToken, config('users.token_check_in_expire_minutes'), '/');
     }
 
     public function updateValidator(Request $request)
@@ -256,7 +256,7 @@ class UserDutyCheckController extends Controller
         Controller::logS(__METHOD__,"录入临时工,用户,对应工作组,打卡记录".__FUNCTION__,json_encode($userDetail));
         $laravelEchoPrefix = config('database.redis.options.prefix');
         return response()->view('personnel/checking-in/importAndExportSuccess',['full_name'=>$userDetail->full_name,'checked_at'=>$userDutyCheck->checked_at,'type'=>$userDutyCheck->type,'laravelEchoPrefix'=>$laravelEchoPrefix])
-            ->cookie('userLaborToken',$userLaborToken,config('users.cookie_expire_minutes'),'/');
+            ->cookie('userLaborToken',$userLaborToken,config('users.token_check_in_expire_minutes'),'/');
 
     }
 
@@ -334,7 +334,7 @@ class UserDutyCheckController extends Controller
         }
         if ($userLaborToken){
             return response()->view('personnel/checking-in/success', ['group_name' => $group_name ?? '', 'full_name' => $userDetail->full_name, 'check_in_at' => $newLaborReport->check_in_at, 'laravelEchoPrefix' => $laravelEchoPrefix])
-                ->cookie('userLaborToken',$userLaborToken,config('users.cookie_expire_minutes'),'/');
+                ->cookie('userLaborToken',$userLaborToken,config('users.token_check_in_expire_minutes'),'/');
         }else{
             return response()->view('personnel/checking-in/success', ['group_name' => $group_name ?? '', 'full_name' => $userDetail->full_name, 'check_in_at' => $newLaborReport->check_in_at, 'laravelEchoPrefix' => $laravelEchoPrefix]);
         }

+ 0 - 1
app/Http/Controllers/api/thirdPart/flux/SortingController.php

@@ -187,7 +187,6 @@ class SortingController extends Controller
         return true;
     }
 
-
     public function informBatchFinished(Batch $batch){
         $sendingData=['request'=>[]];
         $batch->orders()->each(function (Order $order)use($batch,&$sendingData){

+ 24 - 0
app/Http/Controllers/api/thirdPart/haiq/PickStationController.php

@@ -0,0 +1,24 @@
+<?php
+
+
+namespace App\Http\Controllers\api\thirdPart\haiq;
+
+
+
+
+use Illuminate\Http\Request;
+
+class PickStationController
+{
+    protected $request;
+
+    public function __construct()
+    {
+    }
+
+    public function processed(Request $request){
+        $success = $request->input('success');
+        $code= $success?200:0;
+        return ['code'=>$code,'errMsg'=>'','data'=>$request->all()];
+    }
+}

+ 1 - 0
app/Http/Kernel.php

@@ -20,6 +20,7 @@ class Kernel extends HttpKernel
         \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
         \App\Http\Middleware\TrustProxies::class,
         \App\Http\Middleware\DecodingRequest::class,
+        \App\Http\Middleware\CheckActiveMenu::class,
     ];
 
     /**

+ 24 - 0
app/Http/Middleware/CheckActiveMenu.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Http\Middleware;
+
+use App\Services\CheckActiveMenuService;
+use Closure;
+use Illuminate\Http\Request;
+
+class CheckActiveMenu
+{
+    /**
+     * Handle an incoming request.
+     *
+     * @param Request $request
+     * @param \Closure $next
+     * @return mixed
+     */
+    public function handle(Request $request, Closure $next)
+    {
+        $response = $next($request);
+        CheckActiveMenuService::set($request);
+        return $response;
+    }
+}

+ 4 - 10
app/Imports/InventoryCompareImport.php

@@ -24,7 +24,6 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
     protected $ownerArr=[];
     public function __construct()
     {
-//            $this->owner_id=$owner_id;
             app()->singleton('InventoryCompareService',InventoryCompareService::class);
     }
 
@@ -45,9 +44,9 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
             if($array[0]['仓库']??false) return '仓库';
             if($array[0]['属性仓']??false) return '属性仓';
         })();
-        $sku=$array[0][$skuName];
-        $amount=$array[0][$amountName];
-        $customLocation=$array[0][$customLocationName];
+        $sku=$array[0][$skuName] ?? null;
+        $amount=$array[0][$amountName] ?? null;
+        $customLocation=$array[0][$customLocationName] ?? null;
 
         $endIS = false;
         if (!isset($sku) || !isset($amount) || !isset($customLocation)) {
@@ -57,7 +56,7 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
         }
         foreach ($collection as $row) {
             $customLocationArr=[
-                'custom_location'=>$row[$customLocationName],
+                'custom_location'=>$row[$customLocationName] ?? null,
             ];
             array_push($this->customLocationArrs,$customLocationArr);
         }
@@ -76,7 +75,6 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                 'custom_location'=>$customLocation,
             ];
             $this->ownerArr = array_merge($this->ownerArr,[$owners['custom_location']=>$owners]);
-
         }
         $skuAndWarehouseArr=[];
         $inventoryCompares=[];
@@ -97,7 +95,6 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                     $sum++;
                     continue;
                 }
-
                 if ($this->ownerArr["$row[$customLocationName]"]['owner_id']){
                     $this->owner_id=$this->ownerArr["$row[$customLocationName]"]['owner_id'];
                     $this->ownerCode=$this->ownerArr["$row[$customLocationName]"]['owner_code'];
@@ -158,13 +155,10 @@ class InventoryCompareImport implements ToCollection, WithHeadingRow, WithMultip
                 array_push($inventoryCompares,$inventoryCompare);
                 $sum++;
             }
-//            if(empty($exception)){
                 /** @var InventoryCompareService $service */
                 $service = app('InventoryCompareService');
                 $inventoryCompare= $service->createInventoryCompares($inventoryCompares);
                 if (!$inventoryCompare) array_push($exception, ['创建库存对比失败!']);
-//            }
-
         }
         Cache::put('exception', $exception, 86400);
     }

+ 1 - 1
app/LaborReport.php

@@ -20,7 +20,7 @@ class LaborReport extends Model
         'user_duty_check_id','relax_time','remark'
     ];
     protected $appends = [
-        'is_exportGroup','is_export', 'exit_at','enter_at','sequence', 'amountOfJoined',/*'remark',*/'thisRecordOnlineTime','thisRecordWorkingTime','thisRoundRecordWorkingTime',
+        'is_exportGroup','is_export', 'exit_at','enter_at','sequence', 'amountOfJoined','thisRecordOnlineTime','thisRecordWorkingTime','thisRoundRecordWorkingTime',
         'totalOnlineTime','verifyPerson','userDutyCheckVerifyUserId','isAdult','round_check_in_at','round_check_out_at','has_group_verify_right',
     ];
     protected $tempFields = [

+ 14 - 0
app/Menu.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+class Menu extends Model
+{
+    use ModelTimeFormat;
+    protected $fillable=[
+        'name','level', 'parent_id', 'route','sequence',
+    ];
+}

+ 1 - 2
app/Order.php

@@ -60,8 +60,7 @@ class Order extends Model
 
     public function warehouse()
     {
-        return $this->hasOne(Warehouse::class, 'id', 'owner_id');
-
+        return $this->belongsTo(Warehouse::class);
     }
     public function orderCommodities(){
         return $this->hasMany('App\OrderCommodity','order_id','id');

+ 11 - 0
app/OrderCountingRecord.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class OrderCountingRecord extends Model
+{
+    //
+    protected $fillable = ['owner_id','shop_id' ,'warehouse_id' ,'logistic_id' ,'date_target' ,'counting_unit' ,'amount'];
+}

+ 8 - 0
app/OrderPackage.php

@@ -96,6 +96,9 @@ class OrderPackage extends Model
         $this['batch_number'] = $this->oracleInfo['waveno']??null;
     }
     static public function createPackagesFromBatchCode($batchCode,$weight){
+
+
+
         $queryBuilder=OracleDOCOrderHeader::query()->select(self::$oracleOrderHeaderFields);
         $queryBuilder->where('doc_order_header.waveno',$batchCode);
         $queryBuilder->leftJoin('act_allocation_details','act_allocation_details.orderno','doc_order_header.orderno');
@@ -104,6 +107,7 @@ class OrderPackage extends Model
         $resultOracleObjs_grouped=$resultOracleObjs->groupBy('soreference5');
         $packages = [];
         $now = Carbon::now();
+
         foreach($resultOracleObjs_grouped as $resultOracleObj_grouped){
             $resultOracleObj = $resultOracleObj_grouped[0];
             /** @var OrderService $orderService*/
@@ -123,6 +127,8 @@ class OrderPackage extends Model
                 "created_at"=>$now,
             ]);
         }
+
+
         $packagesLogisticNumbers = array_map(function ($orderPackage) {
             return $orderPackage['logistic_number'];
         } ,$packages);
@@ -143,6 +149,8 @@ class OrderPackage extends Model
         DB::transaction(function ()use($newPackages){
             OrderPackage::query()->insert($newPackages);
         });
+
+
         app('LogService')->log(__METHOD__,"批量录入包裹成功",json_encode($packages),Auth::user()['id']);
     }
     public function unifyThisMeasureUnderSameBatch(){

+ 25 - 0
app/Providers/AppServiceProvider.php

@@ -15,11 +15,13 @@ use App\Services\DepositoryService;
 use App\Services\FeatureService;
 use App\Services\InventoryAccountMissionService;
 use App\Services\InventoryCompareService;
+use App\Services\LaborReportsCountingRecordService;
 use App\Services\LogService;
 use App\Services\OracleBasCustomerService;
 use App\Services\OracleBasSkuService;
 use App\Services\OracleDocAsnDetailService;
 use App\Services\OracleDOCOrderHeaderService;
+use App\Services\OrderCountingRecordService;
 use App\Services\OracleDocAsnHerderService;
 use App\Services\OrderIssuePerformanceService;
 use App\Services\AllInventoryService;
@@ -50,6 +52,7 @@ use App\Services\ProcessesContentService;
 use App\Services\ProcessMethodService;
 use App\Services\ProcessService;
 use App\Services\ProcessStatisticService;
+use App\Services\RealtimePendingOrdersService;
 use App\Services\RejectedBillItemService;
 use App\Services\RejectedBillService;
 use App\Services\ShopService;
@@ -58,6 +61,7 @@ use App\Services\StoreCheckingReceiveItemService;
 use App\Services\StoreCheckingReceiveService;
 use App\Services\StoreItemService;
 use App\Services\StoreService;
+use App\Services\CheckActiveMenuService;
 use App\Services\UnitService;
 use App\Services\UserOwnerGroupService;
 use App\Services\UserService;
@@ -164,6 +168,10 @@ class AppServiceProvider extends ServiceProvider
         $this->loadingOrderModuleService();
         $this->loadingBasedModuleService();
         $this->loadingRejectedModuleService();
+        $this->loadingCheckActiveMenuService();
+        $this->loadingRealtimePendingOrdersService();
+        $this->loadingOrderCountingRecordService();
+        $this->loadingLaborReportsCountingRecordService();
     }
 
     private function loadingOrderModuleService(){
@@ -198,4 +206,21 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('RejectedService',RejectedService::class);
     }
 
+    private function loadingCheckActiveMenuService()
+    {
+        app()->singleton('CheckActiveMenuService',CheckActiveMenuService::class);
+    }
+
+    private function loadingRealtimePendingOrdersService()
+    {
+        app()->singleton('RealtimePendingOrdersService',RealtimePendingOrdersService::class);
+    }
+    private function loadingOrderCountingRecordService()
+    {
+        app()->singleton('OrderCountingRecordService',OrderCountingRecordService::class);
+    }
+    private function loadingLaborReportsCountingRecordService()
+    {
+        app()->singleton('LaborReportsCountingRecordService',LaborReportsCountingRecordService::class);
+    }
 }

+ 264 - 0
app/Services/CheckActiveMenuService.php

@@ -0,0 +1,264 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Menu;
+use App\UserVisitMenuLog;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Model;
+use Illuminate\Http\Request;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Redis;
+
+class CheckActiveMenuService
+{
+    /**
+     *同步数据到数据库并且将L1转移到L2
+     */
+    public static function sync()
+
+    {
+        try {
+            self::syncToDB();
+            self::switchL1ToL2();
+        } catch (\Exception $e) {
+            // TODO 同步异常的处理策略
+            return;
+        }
+    }
+
+    /**
+     * 将用户菜单点击事件保存
+     * @param Request $request
+     */
+    public static function set(Request $request): void
+    {
+        // 请求方法为get
+        if ($request->method() == 'GET') {
+            $menu = Menu::query()->where('route', substr($request->getRequestUri(), 1))->first();
+            if ($menu) {
+                //redis正常保存在缓存中
+                $date = date('Y-m-d H:i:s');
+                $userVisitMenuLog = new UserVisitMenuLog([
+                    'user_id' => Auth::user()['id'],
+                    'menu_id' => $menu->id,
+                    'created_at' => $date,
+                    'updated_at' => $date,
+                ]);
+                try {
+                    //菜单点击入缓存
+                    Redis::LPUSH('UserVisitMenuLogsL1', $userVisitMenuLog);
+                } catch (\Exception $e) {
+                    // TODO 缓存异常的处理策略
+                    $userVisitMenuLog->save();
+                }
+            }
+        }
+    }
+
+    /**
+     * 获取活跃菜单
+     * @return Builder|Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
+     */
+    public static function activeMenus()
+    {
+        $user_id = self::getUserId();
+        try {
+            Redis::LLEN('UserVisitMenuLogsL1');
+            if (Redis::LLEN('UserVisitMenuLogsL1') + Redis::LLEN('UserVisitMenuLogsL2') > 0) {
+                //缓存中有数据
+                return self::getFromRedis($user_id);
+            }else{
+                return self::getFromDB($user_id);
+            }
+        } catch (\Exception $e) {
+            // TODO 缓存异常的处理策略
+            return self::getFromDB($user_id);
+        }
+    }
+
+    /**
+     * 将缓存中的数据拿出保存,转换为数组,方便数据库保存
+     * @param $userVisitMenuLogsStr
+     * @return array
+     */
+    public static function redisListToArray($userVisitMenuLogsStr): array
+    {
+        $userVisitMenuLogsArr = [];
+        foreach ($userVisitMenuLogsStr as $userVisitMenuLog) {
+            $userVisitMenuLogObj = json_decode($userVisitMenuLog);
+            $userVisitMenuLogsArr[] = [
+                'user_id' => $userVisitMenuLogObj->user_id,
+                'menu_id' => $userVisitMenuLogObj->menu_id,
+                'created_at' => $userVisitMenuLogObj->created_at,
+                'updated_at' => $userVisitMenuLogObj->updated_at,
+            ];
+        }
+        return $userVisitMenuLogsArr;
+    }
+
+    /**
+     *将L1缓存转移到L2
+     */
+    public static function switchL1ToL2(): void
+    {
+        while (Redis::LLEN('UserVisitMenuLogsL1') > 0) {
+            Redis::LPUSH('UserVisitMenuLogsL2', Redis::LPOP('UserVisitMenuLogsL1'));
+        }
+    }
+
+    /**
+     * @return int
+     */
+    public static function getUserId(): int
+    {
+        $user_id = 1;
+        if (Auth::user()) {
+            $user_id = Auth::user()->id;
+        }
+        return $user_id;
+    }
+
+    /**
+     * 从数据库获取活跃菜单
+     * @param $user_id
+     * @return Builder|Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
+     */
+    public static function getFromDB($user_id)
+    {
+        return self::getMenusAndSort(self::getMenuIdsFromDB($user_id));
+    }
+
+    /**
+     * 从缓存获取活跃菜单
+     * @param $user_id
+     * @return Builder|Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
+     */
+    public static function getFromRedis($user_id)
+    {
+        return self::getMenusAndSort(self::getMenuIdsFromRedis($user_id));
+    }
+
+    /**
+     * 获取活跃菜单并按照活跃度排序
+     * @param Collection $menuIds
+     * @return Builder|Builder[]|\Illuminate\Database\Eloquent\Collection|Model|Collection|\Tightenco\Collect\Support\Collection|null
+     */
+    public static function getMenusAndSort(Collection $menuIds)
+    {
+        return self::buildResult(self::getMenusAndSortByActive($menuIds));
+    }
+
+    /**
+     * @param $user_id
+     * @return Collection|\Tightenco\Collect\Support\Collection
+     */
+    public static function getMenuIdsFromRedis($user_id)
+    {
+        return collect(array_merge(self::redisListToArray(Redis::LRANGE('UserVisitMenuLogsL1', 0, -1)), self::redisListToArray(Redis::LRANGE('UserVisitMenuLogsL2', 0, -1))))
+            //从缓存中查找全部用户的活跃菜单数据,合并L1,L2
+            ->filter(function ($item) use ($user_id) {
+                return $user_id === $item['user_id'];
+            })
+            //根据user_id筛选
+            ->groupBy('menu_id')
+            //根据menu_id分组
+            ->sortByDesc(function ($item) {
+                return $item->count();
+            })
+            //根据分组结果的二级列表降序排列
+//            ->forPage(0, 5)
+            //取前数量最高的五条
+            ->keys();
+        //只获取对应的菜单Id
+    }
+
+    /**
+     * @param $user_id
+     * @return Builder[]|\Illuminate\Database\Eloquent\Collection|Collection
+     */
+    public static function getMenuIdsFromDB($user_id)
+    {
+        return UserVisitMenuLog::query()
+            ->selectRaw('menu_id')
+            ->where('user_id', $user_id)
+            ->groupBy('menu_id')
+            ->get()->sortByDesc(function ($item) {
+                return $item->count();
+            })
+//            ->forPage(0, 5)
+            ->map(function ($item) {
+                return $item->menu_id;
+            });
+    }
+
+    public static function syncToDB(): void
+    {
+        UserVisitMenuLog::query()->insert(self::redisListToArray(Redis::LRANGE('UserVisitMenuLogsL1', 0, -1)));
+    }
+
+    /**
+     * 将排好序的菜单集合构造为一级菜单嵌套二级菜单的形式
+     * @param $menus
+     * @return Collection|\Tightenco\Collect\Support\Collection
+     */
+    public static function buildResult($menus)
+    {
+        $result = collect([]);
+        foreach ($menus as $menu) {
+            switch ($menu->level) {
+                case 1:
+                    if (!$result->where('id', $menu->parent_id)->first()) {
+                        //结果集中尚未包含当前菜单,添加
+                        $result->add($menu);
+                    }
+                    break;
+                case 2:
+                    self::setToParent($result, $menu);
+                    //查找到对应子菜单的父菜单,并将其放入到父菜单的集合中
+                    break;
+                default:
+                    break;
+            }
+        }
+        return $result;
+    }
+
+    /**
+     * 查找到对应子菜单的父菜单,并将其放入到父菜单的集合中
+     * @param $data
+     * @param $menu
+     */
+    public static function setToParent($data, $menu): void
+    {
+        //二级菜单
+        $firstLevelMenu = $data->where('id', $menu->parent_id)->first();
+        if (!$firstLevelMenu) {
+            //当前集合中不存在该一级菜单,从数据库中获取,并将其放入集合中
+            $firstLevelMenu = Menu::query()->where('id', $menu->parent_id)->first();
+            $data->push($firstLevelMenu);
+        }
+        $secondLevelMenu = $firstLevelMenu->secondLevelMenu ?? collect();
+        $secondLevelMenu->push($menu);
+        $firstLevelMenu->secondLevelMenu = $secondLevelMenu;
+    }
+
+    /**
+     * 根据菜单Id查询菜单,并安装点击频率排序
+     * @param Collection $arr
+     * @return Builder|Builder[]|\Illuminate\Database\Eloquent\Collection|Model|null
+     */
+    public static function getMenusAndSortByActive(Collection $arr)
+    {
+        return Menu::query()
+            ->find($arr)
+            //根据菜单Id查询
+            ->sortBy(function ($item) use ($arr) {
+                return $arr->search($item->id);
+                //将查询结果按照上面拍好的顺序重新排列
+            });
+    }
+}

+ 4 - 3
app/Services/CommodityService.php

@@ -177,15 +177,17 @@ Class CommodityService
     {
         if(!$params) return [];
         $bas_sku_arr = OracleBasSKU::query()
+            ->selectRaw('customerid,sku,descr_c,skulength,skuwidth,skuhigh,cube')
             ->whereIn('CustomerID',data_get($params,'*.owner_code'))
             ->whereIn('Sku',data_get($params,'*.sku'))
             ->get();
         $insert_params = [];
-
+        $created_at = Carbon::now()->format('Y-m-d H:i:s');
         foreach ($bas_sku_arr as $bas_sku) {
             $owner = $owners_code_map[$bas_sku->customerid] ?? '';
             if(!$owner)continue;
-            $created_at = Carbon::now()->format('Y-m-d H:i:s');
+            if($bas_sku->sku==null)continue;
+            if($bas_sku->descr_c=='')continue;
             $insert_params[] = [
                 'owner_id' => $owner->id,
                 'sku' => $bas_sku->sku,
@@ -197,7 +199,6 @@ Class CommodityService
                 'volumn' => $bas_sku->cube
             ];
         }
-
         if(count($insert_params) > 0){
             try {
                 $this->insert($insert_params);

+ 53 - 8
app/Services/FeatureService.php

@@ -196,28 +196,43 @@ Class FeatureService
      *      $vale : 特征简述 例: "1&2|(3|4)"
      *      $columnMapping : 列映射 例:["商品名称"=>"commodity_name"]
      *      $matchObject : 被匹配对象,必须存在列映射所指定字段 例:["commodity_name"=>"衣服"]
+     *      $isMultiMatching 是否开启多重匹配 开启将匹配对象视为二维数组深层寻找商品(入库需要)
      *      bool true匹配成功 false匹配失败
      *
      * @param string $value
      * @param array $columnMapping
      * @param array $matchObject
+     * @param bool $isMultiMatching
      * @return bool
      */
-    public function matchFeature($value, $columnMapping, $matchObject) :bool
+    public function matchFeature($value, $columnMapping, $matchObject, $isMultiMatching = false) :bool
     {
-        preg_match_all('/\d+/',$value,$ids);
-        if ($ids[0])$fs = Feature::query()->whereIn("id",$ids[0])->get();
-        else return false;
-        $features = [];
-        foreach ($fs as $f){
-            $features[$f->id] = $f;
-        }
         preg_match_all('/\d+|[\&\|\(\)]/',$value,$result);
+        if (implode("",$result[0]) != $value)return false;
+
+        $features = app(CacheService::class)->getOrExecute($value,function ()use($value){
+            preg_match_all('/\d+/',$value,$ids);
+            if ($ids[0])$fs = Feature::query()->whereIn("id",$ids[0])->get();
+            else return false;
+            $features = [];
+            foreach ($fs as $f){
+                $features[$f->id] = $f;
+            }
+            return $features;
+        });
+
+
         foreach ($result[0] as &$str) {
             if (is_numeric($str) && isset($features[$str])) {
                 $column = $features[$str]["type"];
                 $logic = $features[$str]["logic"];
                 $describe = $features[$str]["describe"];
+                if ($column == '商品名称' && $isMultiMatching){
+                    $packageColumn = $columnMapping["packages"] ?? "packages";
+                    $packages = $matchObject[$packageColumn] ?? [];
+                    $str = $this->multiMatching($packages,$logic,$describe,$columnMapping[$column] ?? '');
+                    continue;
+                }
                 $value = isset($columnMapping[$column]) ? $matchObject[$columnMapping[$column]] : '';
                 switch ($logic) {
                     case "包含":
@@ -244,4 +259,34 @@ Class FeatureService
         return eval("return $is;");
     }
 
+    /**
+     * 多重子项匹配
+     *
+     * @param array $packages
+     * @param string $logic
+     * @param string $describe
+     * @param string $column
+     * @return string           //"true" || "false"
+     */
+    private function multiMatching($packages, $logic, $describe, $column):string
+    {
+        if(!$column)return 'false';
+
+        foreach ($packages as $package){
+            $value = $package[$column] ?? '';
+            switch ($logic) {
+                case "包含":
+                    if (mb_strpos($value,$describe)!==false)return 'true';
+                    break;
+                case "不包含":
+                    if (mb_strpos($value,$describe) === false)return 'true';
+                    break;
+                case "等于":
+                    if ($value == $describe)return 'true';
+                    break;
+            }
+        }
+        return "false";
+    }
+
 }

+ 47 - 0
app/Services/InventoryAccountService.php

@@ -14,6 +14,7 @@ use App\OracleInvLotAtt;
 use App\OracleBasCustomer;
 use App\OracleInvLotLocId;
 use App\Owner;
+use App\Services\common\BatchUpdateService;
 use App\Services\common\QueryService;
 use Carbon\Carbon;
 use Illuminate\Support\Facades\Auth;
@@ -635,4 +636,50 @@ class InventoryAccountService
         return $inventoryAccountMissions;
     }
 
+    public function batchStockByLocation($missions,$inventoryId)
+    {
+        $inventory=InventoryAccount::query()->find($inventoryId);
+        if($inventory->status=='复盘中'){
+            $updateParams = [[
+                'id','returned','difference_amount','re_checked_amount','checked','updated_at'
+            ]];
+            foreach ($missions as $mission){
+                if (($mission['amount']-$mission['stored_amount'])==0){
+                    $return='是';
+                }else{
+                    $return='否';
+                }
+                $updateParams[] = [
+                    'id'=>$mission['id'],
+                    're_checked_amount'=>$mission['amount'],
+                    'difference_amount'=>$mission['amount']-$mission['stored_amount'],
+                    'returned'=>$return,
+                    'checked'=>'已复核',
+                    'updated_at' =>Carbon::now()->format('Y-m-d H:i:s'),
+                ];
+            }
+        }else{//初盘
+            $updateParams = [[
+                'id','difference_amount','checked','verified_amount','updated_at'
+            ]];
+            foreach ($missions as $mission){
+                $updateParams[] = [
+                    'id'=>$mission['id'],
+                    'verified_amount'=>$mission['amount'],
+                    'difference_amount'=>$mission['amount']-$mission['stored_amount'],
+                    'checked'=>'是',
+                    'updated_at' =>Carbon::now()->format('Y-m-d H:i:s'),
+                ];
+            }
+        }
+        if(count($updateParams) > 1) app(BatchUpdateService::class)->batchUpdate('inventory_account_missions',$updateParams);
+        LogService::log(__METHOD__,__FUNCTION__,'根据库位批量盘点'.count($updateParams).json_encode($updateParams));
+        $ids = array_unique(data_get($missions,'*.id'));
+        $inventoryMissions=InventoryAccountMission::query()->whereIn('id',$ids)->get();
+        foreach ($inventoryMissions as $inventoryMission){
+            $inventoryMission->createSignStockInventoryPersons();
+        }
+        return InventoryAccountMission::query()->with(['commodity.barcodes','stockInventoryPersons'])->whereIn('id',$ids)->get();
+    }
+
 }

+ 18 - 24
app/Services/InventoryCompareService.php

@@ -19,28 +19,6 @@ use Ramsey\Uuid\Uuid;
 class InventoryCompareService
 {
     static private $missionCode;
-//    private function conditionQuery($SKU,$LotAtt05,$descr_c){
-//        $sql='select * from (select result.*,rownum rn from (';
-//        $sql.=' select customer.Descr_C as 货主,storeStatus.CUSTOMERID 客户,storeStatus.LocationID 库位, sku.SKU 产品编码, sku.ALTERNATE_SKU1 产品条码, ';
-//        $sql.=' sku.Descr_C 商品名称, lot.LotAtt05 属性仓, lot.LotAtt08 质量状态, lot.LotAtt02 失效日期, storeStatus.ADDTIME 创建时间, ';
-//        $sql.=' lot.LotAtt04 批号 ';
-//        $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
-//        $sql.=' INV_LOT_LOC_ID storeStatus';
-//        $sql.=' left join BAS_Customer customer on customer.CustomerID=storeStatus.CUSTOMERID ';
-//        $sql.=' left join BAS_SKU sku on sku.SKU=storeStatus.SKU and sku.CUSTOMERID=storeStatus.CUSTOMERID ';
-//        $sql.=' left join INV_LOT_ATT lot on lot.LOTNUM = storeStatus.LOTNUM AND lot.CUSTOMERID = storeStatus.CUSTOMERID ';
-//        $sql.=' group by storeStatus.LocationID,customer.Descr_C,sku.SKU,sku.ALTERNATE_SKU1 ';
-//        $sql.=' ,sku.Descr_C,lot.LotAtt05,lot.LotAtt08,lot.LotAtt02,lot.LotAtt04 ';
-//        $sql.=' , storeStatus.QTY, storeStatus.QtyAllocated,storeStatus.CUSTOMERID,storeStatus.ADDTIME  ';
-//        $sql.=' )result where 1=1 ';
-//        if ($SKU)$sql.=" and 产品编码 like '".$SKU."' ";
-//        if ($LotAtt05)$sql .=" and 属性仓 like '".$LotAtt05."' ";
-//        if ($descr_c)$sql.=" and 货主 = '".$descr_c."' ";
-//        $sql.=' )  ';
-//        return DB::connection('oracle')->select($sql);
-//    }
-
-
     public function getCreatingMissionCode($ownerName=''){
         if(self::$missionCode)return self::$missionCode;
         $sequence=Cache::get('InventoryCompareMissionSequence');
@@ -106,9 +84,11 @@ class InventoryCompareService
             $wmsInventoryCompareZp=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->where('质量状态','ZP')->first();
             $wmsInventoryCompareCc=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->where('质量状态','CC')->first();
             $wmsInventoryCompareDj=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->where('质量状态','DJ')->first();
-            $unknownQualityStatus=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->whereNotIn('质量状态',['DJ','CC','ZP']);
+            $wmsInventoryCompareYjz=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->where('质量状态','YJZ')->first();
+            $unknownQualityStatus=$query->where('属性仓',$custom_location)->where('产品编码',$sku)->whereNotIn('质量状态',['DJ','CC','ZP','YJZ']);
             if (!$wmsInventoryCompareZp&&!$wmsInventoryCompareCc&&!$wmsInventoryCompareDj&&$unknownQualityStatus->isEmpty()){
                 $this->createInventoryCompare_underImport($sku, $custom_location, $amount, $owner_id,$owner_name);
+                continue;
             }
             $creatingMissionCode = $this->getCreatingMissionCode($owner_name);
             $commodityId=Commodity::where('sku',$sku)->where('owner_id',$owner_id)->value('id');
@@ -140,7 +120,21 @@ class InventoryCompareService
                 ];
                 array_push($wasInventoryCompares,$wasInventoryCompareCC);
             }
-            if($unknownQualityStatus->isNotEmpty())return null;
+            if ($wmsInventoryCompareYjz){
+                $wasInventoryCompareYjz=[
+                    'owner_id'=>$owner_id,
+                    'commodity_id'=>$commodityId,
+                    'mission_code'=>$creatingMissionCode,
+                    'custom_location'=>$custom_location,
+                    'created_at'=>Carbon::now()->format('Y-m-d H:i:s'),
+                    'quality'=>'有价值',
+                    'amount_in_sys'=>$wmsInventoryCompareYjz['在库数量'],
+                    'amount_in_compare' =>$amount,
+                    'differ' =>$amount-($wmsInventoryCompareYjz['在库数量']??0),
+                ];
+                array_push($wasInventoryCompares,$wasInventoryCompareYjz);
+            }
+            if($unknownQualityStatus->isNotEmpty())continue;
         }
         $inventoryCompares=DB::table('inventory_compares')->insert($wasInventoryCompares);
         if (!$inventoryCompares)return null;

+ 168 - 0
app/Services/LaborReportsCountingRecordService.php

@@ -0,0 +1,168 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\LaborReport;
+use Carbon\Carbon;
+use DateTime;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Str;
+use Ramsey\Uuid\Type\Integer;
+
+class LaborReportsCountingRecordService
+{
+    public function userGroupsCount($start, $end)
+    {
+        $resultByCache = Cache::remember('userGroupsCount_' . $start . '_' . $end, 600, function () use ($start, $end) {
+            return LaborReport::query()->selectRaw('user_workgroup_id,count(user_workgroup_id) amount')
+                ->with('userWorkgroup','laborReportStatus')
+                ->whereDate('created_at', '>=', $start)
+                ->whereDate('created_at', '<', $end)
+                ->groupBy('user_workgroup_id')->get();
+        });
+
+        $resultByCache = $resultByCache->filter(function ($item) {
+            return $item->amount != 0;
+        });
+
+        $result = collect();
+        $resultByCache->each(function ($item) use (&$result) {
+            $result->push(
+                [
+                    'value' => $item->amount,
+                    'name' => $item->userWorkgroup->name,
+                    'id' => $item->userWorkgroup->id,
+                ]
+            );
+        });
+        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
+     */
+    private function periodDateToArray($start, $end, $unit = '日')
+    {
+        $dataArray = [];
+        switch ($unit) {
+            case '日';
+                foreach (Carbon::parse($start)->daysUntil($end, 1)->toArray() as $item) {
+                    $dataArray[] = $item->toDateString();
+                }
+                break;
+            case '周';
+                foreach (Carbon::parse($start)->startOfWeek(1)->weeksUntil($end, 1)->toArray() as $item) {
+                    $dataArray[] = $item->year . '-' . $item->week . '';
+                }
+                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 . '-' . $item->month . '';
+                }
+                break;
+            default:
+                break;
+        }
+        return $dataArray;
+    }
+
+    private function syncDBToCache($dateList, $unit)
+    {
+        switch ($unit) {
+            case '日':
+                $query = LaborReport::query()
+                    ->selectRaw("DATE_FORMAT(created_at,'%Y-%m-%d') as date_target, count(1) 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);
+                });
+                break;
+            case '周':
+                $query = LaborReport::query()->selectRaw("DATE_FORMAT(created_at,'%x-%v') as date_target, count(1) as counter");
+                foreach ($dateList as $date) {
+                    $query->orWhere(function ($query) use ($date) {
+                        $year = Str::of($date)->explode('-')[0];
+                        $week = Str::of($date)->explode('-')[1];
+                        $startOfWeek = Carbon::now()->setISODate($year, $week)->startOfWeek()->toDateString();
+                        $endOfWeek = Carbon::parse($startOfWeek)->endOfWeek()->toDateString();
+                        $query->whereDate('created_at', '>=', $startOfWeek)->whereDate('created_at', '<=', $endOfWeek);
+                    });
+                }
+                $dataList = $query->groupBy('date_target')->get();
+                $dataList->each(function ($item) use ($unit) {
+                    $date = $item->date_target;
+                    $item->date_target = Carbon::now()->setISODate(Str::of($date)->explode('-')[0], Str::of($date)->explode('-')[1])->startOfWeek()->toDateString();
+                    Cache::put('laborReportsCountingRecords_' . $date . '_' . $unit, $item);
+                });
+                break;
+            case '月':
+                $query = LaborReport::query()->selectRaw("DATE_FORMAT(created_at,'%Y-%m') as date_target, count(1) 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);
+                });
+                break;
+            default:
+                break;
+        }
+    }
+}

+ 0 - 1
app/Services/LogService.php

@@ -7,7 +7,6 @@ namespace App\Services;
 use App\Log;
 use Exception;
 use Illuminate\Support\Facades\Redis;
-use Illuminate\Support\Facades\Request;
 
 class LogService
 {

+ 1 - 0
app/Services/LogisticService.php

@@ -46,6 +46,7 @@ Class LogisticService
     public function createLogisticByCarrierIds($codes){
         if(!$codes){return [];}
         $baseCustomers = OracleBasCustomer::query()
+            ->selectRaw('Customer_Type,CustomerID,Descr_C')
             ->where('Customer_Type','CA')
             ->whereIn('CustomerID',$codes)
             ->get();

+ 6 - 2
app/Services/OracleBasCustomerService.php

@@ -14,9 +14,13 @@ Class OracleBasCustomerService
     public function getWareHouse($customerIDs = null)
     {
         if(!$customerIDs){
-            return OracleBasCustomer::query()->where('Customer_Type','WH')->get();
+            return OracleBasCustomer::query()->selectRaw('Customer_Type,CustomerId,Descr_C')->where('Customer_Type','WH')->get();
         }
-        return  OracleBasCustomer::query()->where('Customer_Type','WH')->get();
+        return  OracleBasCustomer::query()
+            ->selectRaw('Customer_Type,CustomerId,Descr_C')
+            ->where('Customer_Type','WH')
+            ->whereIn('CustomerId',$customerIDs)
+            ->get();
     }
     public function getCustomers($codes)
     {

+ 361 - 0
app/Services/OrderCountingRecordService.php

@@ -0,0 +1,361 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Logistic;
+use App\Order;
+use App\OrderCountingRecord;
+use App\Warehouse;
+use Carbon\Carbon;
+use DateTime;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use App\User;
+use Illuminate\Support\Str;
+
+
+class OrderCountingRecordService
+{
+    /** @var $ownerService OwnerService */
+    private $ownerService = null;
+
+    function __construct()
+    {
+        $this->ownerService = app(OwnerService::class);
+    }
+
+    /**
+     * @param $start
+     * @param $end
+     * @param null $ownerIds
+     * @param string $unit
+     * @param $user
+     * @return mixed
+     */
+    public function get($start, $end, $ownerIds = null, $unit = '日', $user)
+    {
+        $resultByCache = $this->getByCache($start, $end, $ownerIds, $unit, $user);
+        if (!($resultByCache['unExistingOrders'])) return $resultByCache['resultOrders'];
+        $resultByOrderCountingRecords = $this->getByDatabase($resultByCache['unExistingOrders'], $unit);
+        $this->createByDatabase($resultByOrderCountingRecords['unExistingOrders'], $unit);
+        $this->getByDatabase($resultByCache['unExistingOrders'], $unit);
+        $resultByCache = $this->getByCache($start, $end, $ownerIds, $unit, $user);
+        return $resultByCache['resultOrders'];
+    }
+
+    public function orderCountingRecords($start, $end, $ownerIds = null, $unit = '日', $user = null)
+    {
+        $key = 'orderCountingRecords_' . $start . '_' . $end . '_' . $unit . '_' . Auth::user()->id;
+        return Cache::remember($key, 600, function () use ($start, $end, $unit, $ownerIds, $user) {
+            $orders = $this->get($start, $end, null, $unit, null);
+            $dataList = collect();
+            $orders->groupBy('date_target')->each(function ($items) use (&$dataList, $unit) {
+                $counter = $items->reduce(function ($sum, $item) {
+                    return $sum + $item->amount;
+                }, 0);
+                $date_target = $items[0]->date_target;
+                if ($unit == '周') {
+                    $date_target = (new DateTime())->setISODate(Str::of($date_target)->explode('-')[0], Str::of($date_target)->explode('-')[1])->format('yy-m-d');
+                }
+                $dataList->push([
+                    'counter' => $counter,
+                    'date_target' => $date_target,
+                ]);
+            });
+            return $dataList->sortBy("date_target");
+        });
+    }
+
+    /**
+     * @param $start
+     * @param $end
+     * @param null $ownerIds
+     * @param null $user
+     * @return \Illuminate\Support\Collection|\Tightenco\Collect\Support\Collection
+     */
+    public function logisticsCountingRecords($start, $end, $ownerIds = null, $user = null)
+    {
+        $key = 'logisticsCountingRecords_' . $start . '_' . $end . '_' . Auth::user()->id;
+        return Cache::remember($key, 600, function () use ($start, $end, $ownerIds, $user) {
+            $dataList = collect();
+            $resultOrders = $this->get($start, $end, $ownerIds, '日', $user);
+            $resultOrders->groupBy('logistic_id')->each(function ($item) use (&$dataList) {
+                $counter = $item->reduce(function ($sum, $item) {
+                    return $sum + $item->amount;
+                }, 0);
+                $dataList->push([
+                    'value' => $counter,
+                    'logistic_id' => $item[0]->logistic_id,
+                ]);
+            });
+            $map = [];
+            $logistics = Logistic::query()->whereIn('id', data_get($dataList, '*.logistic_id'))->get();
+            $logistics->each(function ($logistic) use (&$map) {
+                $map[$logistic->id] = $logistic;
+            });
+            return $dataList->map(function (&$item) use ($map) {
+                $logistic = $map[$item['logistic_id']] ?? '';
+                $item['name'] = $logistic->name ?? '';
+                return $item;
+            });
+        });
+    }
+
+    public function warehouseCountingRecords($start, $end, $ownerIds = null, $user = null)
+    {
+        $key = 'warehouseCountingRecords_' . $start . '_' . $end . '_' . Auth::user()->id;
+        return Cache::remember($key, 600, function () use ($start, $end, $ownerIds, $user) {
+            $dataList = collect();
+            $resultOrders = $this->get($start, $end, $ownerIds, '日', $user);
+            $resultOrders->groupBy('warehouse_id')->each(function ($item) use (&$dataList) {
+                $counter = $item->reduce(function ($sum, $item) {
+                    return $sum + $item->amount;
+                }, 0);
+                $dataList->push([
+                    'value' => $counter,
+                    'warehouse_id' => $item[0]->warehouse_id,
+                ]);
+            });
+            $map = [];
+            $logistics = Warehouse::query()->whereIn('id', data_get($dataList, '*.warehouse_id'))->get();
+            $logistics->each(function ($warehouse) use (&$map) {
+                $map[$warehouse->id] = $warehouse;
+            });
+            return $dataList->map(function (&$item) use ($map) {
+                $warehouse = $map[$item['warehouse_id']] ?? '';
+                $item['code'] = $warehouse->name ?? '';
+                switch ($item['code']) {
+                    case 'WH01':
+                        $item['name'] = '松江一仓';
+                        break;
+                    case 'WH02':
+                        $item['name'] = '松江二仓';
+                        break;
+                    case 'WH03':
+                        $item['name'] = '嘉定一仓';
+                        break;
+                    default:
+                        $item['name'] = '仓库为空';
+                        break;
+                }
+                return $item;
+            });
+        });
+    }
+
+    /**
+     * @param $start
+     * @param $end
+     * @param null $ownerIds
+     * @param string $unit
+     * @param $user
+     * @return array
+     */
+    public function getByCache($start, $end, $ownerIds = null, $unit = '日', $user)
+    {// Order[] results, Array [$date=>[$ownerIds]]
+        $countingOwnerIds = $this->getCountingOwnerIds($ownerIds, $user);
+        $resultOrders = collect();
+        $unExistingOrders = [];
+        $carbonInterfaces = $this->periodDateToArray($start, $end, $unit);
+        foreach ($carbonInterfaces as $dateStr) {
+            foreach ($countingOwnerIds as $ownerId) {
+                $key = "order_counting_records_{$dateStr}_{$ownerId}_{$unit}";
+                $orders = Cache::get($key);
+                if ($orders) {
+                    $orders->each(function ($item) use (&$resultOrders) {
+                        $resultOrders->push($item);
+                    });
+                    continue;
+                }
+                $unExistingOrders[$dateStr][] = $ownerId;
+            }
+        }
+        return ['resultOrders' => $resultOrders, 'unExistingOrders' => $unExistingOrders];
+    }
+
+    public function getByDatabase($targetOwnerIdsUnderDates, $unit = '日')
+    {// Order[] results, Array [$date=>[$ownerIds]]
+        $orderSqlBuilder = OrderCountingRecord::query();
+        foreach ($targetOwnerIdsUnderDates as $date => $owners) {
+            $orderSqlBuilder->orWhere(function ($query) use ($owners, $date, $unit) {
+                $query->whereIn('owner_id', $owners)->where('date_target', $date)->where('counting_unit', $unit);
+            });
+        }
+        $resultOrders = $orderSqlBuilder->get();
+        $resultOrders->groupBy(['date_target', 'owner_id'])->each(function ($item, $dateStr) use ($unit) {
+            $item->each(function ($item, $owner_id) use ($dateStr, $unit) {
+                $key = "order_counting_records_{$dateStr}_{$owner_id}_{$unit}";
+                $ttl = 3600 * 24;
+                if ($dateStr==Carbon::now()->toDateString()) {
+                    $ttl = 60;
+                }
+                Cache::put($key, $item, $ttl);
+            });
+        });
+        $map = [];
+        $resultOrders->each(function ($item) use (&$map) {
+            $key = 'owner_id=' . $item->owner_id . ' date_target' . $item->date_target;
+            $map[$key] = true;
+        });
+        foreach ($targetOwnerIdsUnderDates as $dateStr => $ownerIds) {
+            foreach ($ownerIds as $key => $ownerId) {
+                $key1 = 'owner_id=' . $ownerId . ' date_target' . $dateStr;
+                if (isset($map[$key1])) {
+                    unset($targetOwnerIdsUnderDates[$dateStr][$key]);
+                }
+            }
+        }
+        return ['resultOrders' => $resultOrders, 'unExistingOrders' => $targetOwnerIdsUnderDates];
+    }
+
+    public function createByDatabase($targetOwnerIdsUnderDates, $unit = '日')
+    {// Order[] results]
+        switch ($unit) {
+            case '日':
+                $resultOrders = $this->getCreateByDatabaseUnitDay($targetOwnerIdsUnderDates);
+                break;
+            case'周':
+                $resultOrders = $this->getCreateByDatabaseUnitWeek($targetOwnerIdsUnderDates);
+                break;
+            case'月':
+                $resultOrders = $this->getCreateByDatabaseUnitMonth($targetOwnerIdsUnderDates);
+                break;
+            default:
+                $resultOrders = collect();
+                break;
+        }
+        $result = collect();
+
+        foreach ($targetOwnerIdsUnderDates as $dateStr => $ownerIds) {
+            if ($dateStr != Carbon::now()->format('Y-m-d')
+                || $dateStr != Carbon::now()->year . '-' . Carbon::now()->week
+                ||$dateStr != Carbon::now()->year . '-' . Carbon::now()->month)
+            {
+                foreach ($ownerIds as $ownerId) {
+                    if ($resultOrders->where('date_target', $dateStr)->where('owner_id', $ownerId)->count()==0) {
+                        $result->push([
+                            'owner_id' =>$ownerId,
+                            'shop_id' => null,
+                            'warehouse_id' => null,
+                            'logistic_id' => null,
+                            'date_target' => $dateStr,
+                            'counting_unit' => $unit,
+                            'amount' => 0,
+                        ]);
+                    }
+                }
+            }
+        }
+        $resultOrders->each(function ($order) use (&$result, $unit) {
+            $orderCountingRecord = new OrderCountingRecord([
+                'owner_id' => $order->owner_id,
+                'shop_id' => $order->shop_id,
+                'warehouse_id' => $order->warehouse_id,
+                'logistic_id' => $order->logistic_id,
+                'date_target' => $order->date_target,
+                'counting_unit' => $unit,
+                'amount' => $order->amounts,
+            ]);
+            $result->push($orderCountingRecord);
+        });
+        OrderCountingRecord::query()->insert($result->toArray());
+        return ['resultOrders' => $result];
+    }
+
+
+    public function periodDateToArray($start, $end, $unit = '日')
+    {
+        $dataArray = [];
+        switch ($unit) {
+            case '日';
+                foreach (Carbon::parse($start)->daysUntil($end, 1)->toArray() as $item) {
+                    $dataArray[] = $item->toDateString();
+                }
+                break;
+            case '周';
+                foreach (Carbon::parse($start)->weeksUntil($end, 1)->toArray() as $item) {
+                    $dataArray[] = $item->year . '-' . $item->week . '';
+                }
+                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 . '-' . $item->month . '';
+                }
+                break;
+            default:
+                break;
+        }
+        return $dataArray;
+    }
+
+    /**
+     * @param $ownerIds
+     * @return array
+     */
+    public function getCountingOwnerIds($ownerIds = null, $user): array
+    {
+        if ($user == null) {
+            $user = auth()->user();
+        }
+        /** @var UserService $userService */
+        $userService = app('UserService');
+        $permittingOwnerIds = $userService->getPermittingOwnerIds($user);
+        if (!$ownerIds) {
+            return $permittingOwnerIds;
+        }
+        return Cache::remember(
+            'PermittingOwnerIds' . '_' . auth()->user()->id . '_' . implode('_', $ownerIds),
+            600, function () use ($ownerIds, $permittingOwnerIds) {
+            /** @var User $user */
+            return array_intersect($ownerIds, $permittingOwnerIds);
+        });
+    }
+
+    /**
+     * @param $targetOwnerIdsUnderDates
+     * @return \Illuminate\Database\Eloquent\Builder[]|Collection
+     */
+    private function getCreateByDatabaseUnitDay($targetOwnerIdsUnderDates)
+    {
+        $orderSqlBuilder = Order::query()->selectRaw("owner_id,warehouse_id,shop_id,logistic_id,count(1) as amounts ,DATE_FORMAT(created_at,'%Y-%m-%d') as date_target");
+        foreach ($targetOwnerIdsUnderDates as $dateStr => $ownerIds) {
+            $orderSqlBuilder->orWhere(function ($query) use ($ownerIds, $dateStr) {
+                $query->whereIn('owner_id', $ownerIds)->whereDate('created_at', $dateStr)->where('wms_status', '订单完成');
+            });
+        }
+        return $orderSqlBuilder->groupBy(['owner_id', 'warehouse_id', 'shop_id', 'logistic_id', 'date_target'])->get();
+    }
+
+    private function getCreateByDatabaseUnitWeek($targetOwnerIdsUnderDates)
+    {
+        $orderSqlBuilder = Order::query()->selectRaw("owner_id,warehouse_id,shop_id,logistic_id,count(1) as amounts ,DATE_FORMAT(created_at,'%x-%v') as date_target");
+        foreach ($targetOwnerIdsUnderDates as $dateStr => $ownerIds) {
+            $orderSqlBuilder->orWhere(function ($query) use ($ownerIds, $dateStr) {
+                $dateStr = (new DateTime())->setISODate(Str::of($dateStr)->explode('-')[0], Str::of($dateStr)->explode('-')[1])->format('yy-m-d');
+                $query->whereIn('owner_id', $ownerIds)->whereDate('created_at', '>=', $dateStr)->whereDate('created_at', '<', Carbon::parse($dateStr)->addWeek()->toDateString())->where('wms_status', '订单完成');;
+            });
+        }
+        return $orderSqlBuilder->groupBy(['owner_id', 'warehouse_id', 'shop_id', 'logistic_id', 'date_target'])->get();
+    }
+
+    private function getCreateByDatabaseUnitMonth($targetOwnerIdsUnderDates)
+    {
+        $orderSqlBuilder = Order::query()->selectRaw("owner_id,warehouse_id,shop_id,logistic_id,count(1) as amounts ,DATE_FORMAT(created_at,'%Y-%m') as date_target");
+        foreach ($targetOwnerIdsUnderDates as $dateStr => $ownerIds) {
+            $orderSqlBuilder->orWhere(function ($query) use ($ownerIds, $dateStr) {
+                $year = Str::of($dateStr)->explode('-')[0];
+                $month = Str::of($dateStr)->explode('-')[1];
+                $query->whereIn('owner_id', $ownerIds)->whereMonth('created_at', $month)->whereYear('created_at', $year)->where('wms_status', '订单完成');;
+            });
+        }
+        return $orderSqlBuilder->groupBy(['owner_id', 'warehouse_id', 'shop_id', 'logistic_id', 'date_target'])->get();
+    }
+}

+ 6 - 2
app/Services/OrderPackageCommoditiesService.php

@@ -775,6 +775,7 @@ class OrderPackageCommoditiesService
         foreach ($inner_params as $inner_param) {
             if($inner_param['logistic_number'] === '*' || $inner_param['logistic_number'] === ' ')continue;
             $package = $dataHandlerService->getKeyValue(['logistic_number'=>$inner_param['logistic_number']],$package_map);
+            if(!$package)continue;
             $commodity = $commodity_map[' owner='.$inner_param['owner_code'].' sku='.$inner_param['sku']] ?? null;
             $create_params[] = [
                 'order_package_id'=>$package->id,
@@ -786,8 +787,11 @@ class OrderPackageCommoditiesService
         }
         if(count($create_params)>0){
             try {
-                $bool = $this->insert($create_params);
-                LogService::log(__METHOD__,__FUNCTION__,'批量添加 orderCommodity --'. $bool ." || ".count($create_params).' || '.json_encode($create_params));
+                $inner_array = array_chunk($create_params,1000);
+                foreach ($inner_array as $item) {
+                    $bool = $this->insert($item);
+                    LogService::log(__METHOD__,__FUNCTION__,'批量添加 orderCommodity --'. $bool ." || ".count($create_params).' || '.json_encode($create_params));
+                }
             } catch (\Exception $e) {
                 LogService::log(__METHOD__,__FUNCTION__.'error','批量添加 orderCommodity error'." || ".count($create_params).' || '.json_encode($create_params));
             }

+ 5 - 2
app/Services/OrderPackageService.php

@@ -439,8 +439,11 @@ class OrderPackageService
         }
         if(count($inner_params)>0){
             try {
-                $bool = $this->insert($inner_params);
-                $bool ? LogService::log(__METHOD__, __FUNCTION__, '批量添加 OrderPackage ' . count($inner_params) . ' || ' . json_encode($inner_params)) : null;
+                $inner_array = array_chunk($inner_params,1000);
+                foreach ($inner_array as $params) {
+                    $bool = $this->insert($params);
+                    $bool ? LogService::log(__METHOD__, __FUNCTION__, '批量添加 OrderPackage ' . count($inner_params) . ' || ' . json_encode($inner_params)) : null;
+                }
             } catch (\Exception $e) {
                 LogService::log(__METHOD__, __FUNCTION__, '批量添加 OrderPackage error ' . count($inner_params) . ' || ' .json_encode($e->getMessage()). json_encode($inner_params).json_encode($e->getTraceAsString()));
             }

+ 6 - 8
app/Services/OrderService.php

@@ -30,10 +30,11 @@ class OrderService
         if(count($params)==0) return true;
         try {
             $bool= Order::query()->insert($params);
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量创建 Order' . json_encode($params));
+            if($bool)app('LogService')->log(__METHOD__, __FUNCTION__, '批量创建 Order' . json_encode($params));
+            else app('LogService')->log(__METHOD__,'ERROR'. __FUNCTION__, '批量创建 Order ERROR' . json_encode($params));
             return $bool;
         } catch (\Exception $e) {
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量创建 Order error' . json_encode($params).json_encode($e->getMessage()).json_encode($e->getTraceAsString()));
+            app('LogService')->log(__METHOD__, 'ERROR'.__FUNCTION__, '批量创建 Order ERROR' . json_encode($params).json_encode($e->getMessage()).json_encode($e->getTraceAsString()));
             return false;
         }
     }
@@ -977,17 +978,14 @@ class OrderService
          */
         $orderPackageService = app('OrderPackageService');
         $orderPackageCommoditiesService = app('OrderPackageCommoditiesService');
-        $order = Order::query()->with('packages.commodities')->where('code',$orderHeader->orderno)->first();
-        if($order) return $order;
-        $create_param = $this->getParamByOrderHeader($orderHeader);
+        $orderHeaders = [$orderHeader];
         try {
-            $orderHeaders = [$orderHeader];
-            $order = Order::query()->create($create_param);
+            $this->syncOrderByWMSOrderHeaders($orderHeaders);
             $orderPackageService->syncOrderPackage($orderHeaders);
             $orderPackageCommoditiesService->syncOrderPackageCommodities($orderHeaders);
             return  Order::query()->with('packages.commodities')->where('code',$orderHeader->orderno)->first();
         } catch (\Exception $e) {
-            app('LogService')->log(__METHOD__, 'Error'.__FUNCTION__, '创建 Order Error' .' || '. json_encode($order).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
+            app('LogService')->log(__METHOD__, 'Error'.__FUNCTION__, '创建 Order Error' .' || '. json_encode($orderHeader).' || '.json_encode($e->getMessage()).' || '.json_encode($e->getTraceAsString()));
             return null;
         }
     }

+ 1 - 1
app/Services/OwnerPriceExpressService.php

@@ -125,6 +125,6 @@ Class OwnerPriceExpressService
         if ($weight < $model->initial_weight)$weight = $model->initial_weight;
         $initialMoney = $model->initial_weight*$model->details[0]->initial_weight_price;
         $weight -= $model->initial_weight;
-        return ($weight*$model->details[0]->additional_weight_price)+$initialMoney;
+        return (ceil($weight/$model->additional_weight)*$model->details[0]->additional_weight_price)+$initialMoney;
     }
 }

+ 3 - 4
app/Services/OwnerPriceLogisticService.php

@@ -131,9 +131,8 @@ Class OwnerPriceLogisticService
     private function calculation($amount, $detail, $fee)
     {
         if ($amount < $detail->initial_amount)$amount = $detail->initial_amount; //小于起始数以起始数为准
-        $initialMoney = $detail->initial_amount*$detail->unit_price; //起始数计费
-        $amount -= $detail->initial_amount; //减起始数为续数
-        if ($initialMoney < $detail->initial_fee)$initialMoney = $detail->initial_fee; //小于起始计费以起始计费为准
-        return ($amount*$detail->unit_price)+$initialMoney+$detail->delivery_fee+$fee;
+        $money = $amount * $detail->unit_price;
+        if ($money < $detail->initial_fee)$money = $detail->initial_fee; //小于起始计费以起始计费为准
+        return $money+$detail->delivery_fee+$fee;
     }
 }

+ 96 - 72
app/Services/OwnerPriceOperationService.php

@@ -97,29 +97,29 @@ Class OwnerPriceOperationService
     /** 参数顺序: 数量 匹配对象 列映射 货主ID 单位ID 类型 SKU .
      *  匹配顺序: 类型 货主 策略 单位 特征                    ..多对多匹配规则废弃,1对1,设单位必定为件,对应规则必然只有一项存在
      *  单位匹配: 件,箱,单 由小到大,依次换算匹配           .
-     * @param int $amount
+     *
+     *  2:没有总数量存在,都为子项内数量
+     *
      * @param array|object $matchObject  key-val
      * @param array $columnMapping       key-val
      * @param string $owner_id
      * @param string $type
      * @param string $sku
      * @return double
-     * 错误代码: -1:非法数量 -2:无计费模型 -3:未知单位 -4:sku为空 -5:货主未找到 -6:无箱规 -7:未匹配到计费模型
+     * 错误代码: -1:无匹配对象 -2:无计费模型 -3:未知单位 -4:sku为空 -5:货主未找到 -6:无箱规 -7:未匹配到计费模型
      */
-    public function matchRule($amount, $matchObject, $columnMapping, $owner_id, $sku = null, $type = '出库')
+    public function matchRule($matchObject, $columnMapping, $owner_id, $sku = null, $type = '出库')
     {
-        if ($amount <= 0 )return -1;
-
         $unitModels = Unit::query()->whereIn("name",["件","箱","单"])->get();
         $units = [];
         foreach ($unitModels as $unitModel)$units[$unitModel->id] = $unitModel->name;
 
         $withs = $type=='出库' ? ['ownerOutStorageRules'=>function($query){
             /** @var Builder $query */
-            $query->orderByRaw("CASE strategy  WHEN '默认' THEN 1 WHEN '特征' THEN 2 WHEN '起步' THEN 3 END DESC,priority DESC");
+            $query->orderByRaw("CASE strategy  WHEN '起步' THEN 1 WHEN '默认' THEN 2 WHEN '特征' THEN 3 END DESC,priority DESC");
         }] : ['ownerInStorageRule'] ;
         $rules = OwnerPriceOperation::query()->with($withs)
-            ->where("operation_type","出库")
+            ->where("operation_type",$type)
             ->whereHas("ownerPriceOperationOwners",function ($query)use($owner_id){
                 /** @var Builder $query */
                 $query->where("id",$owner_id);
@@ -128,27 +128,36 @@ Class OwnerPriceOperationService
         if (!$rules)return -2;
 
         if ($type == '入库'){
+            $amountColumn = $columnMapping["amount"] ?? "amount";
+            $packageColumn = $columnMapping["packages"] ?? "packages";
+            $packages = $matchObject[$packageColumn] ?? false;
+            if (!$packages)return -1;
+
+            $amount = 0;
+            foreach ($packages as $package)$amount += $package[$amountColumn] ?? 0;
+            if (!$amount)return -1;
             foreach ($rules as $rule){
+                $sum = $amount;
                 if (!$rule->ownerInStorageRule)continue;
                 if ($rule->strategy == '特征'){
                     $bool = app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject);
                     if ($bool === true){
                         if (!isset($units[$rule->ownerInStorageRule->unit_id])) return -3;
                         if ($units[$rule->ownerInStorageRule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
-                            $amount = $this->changeUnit($amount,$owner_id,$sku);
-                            if ($amount<0) return $amount;
+                            $sum = $this->changeUnit($sum,$owner_id,$sku);
+                            if ($sum<0)return $sum;
                         }
-                        if ($units[$rule->ownerInStorageRule->unit_id] == '单')$amount = 1; //为单时数量设为1;
-                        return ceil($amount/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
+                        if ($units[$rule->ownerInStorageRule->unit_id] == '单')$sum = 1; //为单时数量设为1;
+                        return ceil($sum/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
                     };
                 }else{
                     if (!isset($units[$rule->ownerInStorageRule->unit_id])) return -3;
                     if ($units[$rule->ownerInStorageRule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
-                        $amount = $this->changeUnit($amount,$owner_id,$sku);
-                        if ($amount<0) return $amount;
+                        $sum = $this->changeUnit($sum,$owner_id,$sku);
+                        if ($sum<0)return $sum;
                     }
-                    if ($units[$rule->ownerInStorageRule->unit_id] == '单')$amount = 1; //为单时数量设为1;
-                    return ceil($amount/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
+                    if ($units[$rule->ownerInStorageRule->unit_id] == '单')$sum = 1; //为单时数量设为1;
+                    return ceil($sum/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
                 };
             }
             return -7;
@@ -159,11 +168,11 @@ Class OwnerPriceOperationService
             if ($rule->strategy == '特征'){
                 $bool = app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject);//匹配特征
                 if ($bool === true){
-                    $money = $this->matchOutStorage($amount,$rule->ownerOutStorageRules,$columnMapping,$matchObject,$units,$owner_id,$sku);
+                    $money = $this->matchOutStorage($rule->ownerOutStorageRules,$columnMapping,$matchObject,$units,$owner_id,$sku);
                     if ($money>0)return $money;
                 };
             }else{
-                $money = $this->matchOutStorage($amount,$rule->ownerOutStorageRules,$columnMapping,$matchObject,$units,$owner_id,$sku);
+                $money = $this->matchOutStorage($rule->ownerOutStorageRules,$columnMapping,$matchObject,$units,$owner_id,$sku);
                 if ($money>0)return $money;
             };
         }
@@ -176,78 +185,93 @@ Class OwnerPriceOperationService
         if (!$pack)return -6;
         return ceil($amount/$pack);
     }
-    private function matchOutStorage($amount, $rules, $columnMapping, $matchObject, $units, $owner_id, $sku)
+
+    private function matchOutStorage($rules, $columnMapping, $matchObject, $units, $owner_id, $sku)
     {
-        $money = 0;
+        $amountColumn = $columnMapping["amount"] ?? "amount";
+        $packageColumn = $columnMapping["packages"] ?? "packages";
+        $packages = $matchObject[$packageColumn] ?? false;
+        $commodityColumn = $columnMapping["商品名称"] ?? 'commodity';
+        if (!$packages)return -1;
+
+        $unitName = "";
         foreach ($rules as $rule){
             switch ($rule->strategy){
-                case "起步":
-                    $money = $rule->amount * $rule->unit_price;
-                    if ($units[$rule->unit_id] == '箱') { //为箱时同步商品寻找箱规
-                        if (!$sku)return -4;
-                        $pack = app("CommodityService")->getPack($owner_id,$sku);
-                        if (!$pack)return -6;
-                        $rule->amount *= $pack;
-                    }
-
-                    if ($amount < $rule->amount)$amount = $rule->amount;
-                    else $amount -= $rule->amount;
-                    break;
                 case "特征":
-                    if (app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject)){
-                        if (!isset($units[$rule->unit_id]) || $units[$rule->unit_id] == '单') return -3;
+                    foreach ($packages as &$package){
+                        if ($package["price"] ?? false)continue;
+                        if (!app("FeatureService")->matchFeature($rule->feature,["商品名称"=>"commodity"],["commodity"=>$package[$commodityColumn] ?? ''])) continue;
+
+                        if (!$unitName)$unitName = $units[$rule->unit_id];
+                        else {
+                            if ($unitName != $units[$rule->unit_id])
+                                return -3;
+                        }
+                        $package["price"] = $rule->unit_price;
+                        if (!isset($units[$rule->unit_id]) || $units[$rule->unit_id] == '单')return -3;
                         if ($units[$rule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
-                            $amount = $this->changeUnit($amount,$owner_id,$sku);
+                            $amount = $this->changeUnit($package[$amountColumn],$owner_id,$sku);
+                            if ($amount<0)return $amount;
+                            $package[$amountColumn] = $amount;
                         }
-                        return (ceil($amount/$rule->amount)*$rule->unit_price)+$money;
-                    };
+                    }
                     break;
                 case "默认":
-                    if (!isset($units[$rule->unit_id]) || $units[$rule->unit_id] == '单') return -3;
-                    if ($units[$rule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
-                        $amount = $this->changeUnit($amount,$owner_id,$sku);
+                    foreach ($packages as &$package){
+                        if ($package["price"] ?? false)continue; //校验是否已匹配到
+                        if (!$unitName)$unitName = $units[$rule->unit_id]; //校验单位是否一致
+                        else {
+                            if ($unitName != $units[$rule->unit_id])
+                                return -3;
+                        }
+
+                        $package["price"] = $rule->unit_price;
+                        if (!isset($units[$rule->unit_id]) || $units[$rule->unit_id] == '单')return -3;
+                        if ($units[$rule->unit_id] == '箱'){ //为箱时同步商品寻找箱规
+                            $amount = $this->changeUnit($package[$amountColumn],$owner_id,$sku);
+                            if ($amount<0)return $amount;
+                            $package[$amountColumn] = $amount;
+                        }
                     }
-                    return (ceil($amount/$rule->amount)*$rule->unit_price)+$money;
                     break;
+                default:
+                    if ($unitName && $unitName != $units[$rule->unit_id])return -3; //校验单位是否一致
+
+                    $money = $rule->amount * $rule->unit_price;
+                    $startNumber = $rule->amount;
+                    $packages = $this->settingCount($packages,$amountColumn,$startNumber);
+                    if ($packages){
+                        foreach ($packages as $package){
+                            $money += $package[$amountColumn] * $package["price"];
+                        }
+                    }
+                    return $money;
             }
         }
         return -7;
     }
-
-    private function matchInStorage($amount, $matchObject, $columnMapping, $owner_id, $unit_id, $rules, $sku, $units = null, $isMatch = false)
+    //设置数量
+    private function settingCount($packages,$amountColumn,$startNumber)
     {
-        /*foreach ($rules as $rule){
-            if ($unit_id != $rule->ownerInStorageRule->unit_id)continue;
-            else{
-                if ($rule->strategy == '特征'){
-                    $bool = app("FeatureService")->matchFeature($rule->feature,$columnMapping,$matchObject);
-                    if ($bool === true){
-                        return ceil($amount/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
-                    };
-                }else{
-                    return ceil($amount/$rule->ownerInStorageRule->amount)*$rule->ownerInStorageRule->unit_price;
-                };
+        if (!$packages) return null;
+        $maxPrice = 0;
+        $index = null;
+        foreach ($packages as $i => $package){
+            if ($package[$amountColumn] <= 0){
+                unset($packages[$i]);continue;
+            }
+            if ($package["price"] > $maxPrice){
+                $maxPrice = $package["price"];
+                $index = $i;
             }
         }
-        //单位换算
-        if (!$units){
-            $unitModels = Unit::query()->whereIn("name",["件","箱","单"])->get();
-            if (!$unitModels) return null;
-            foreach ($unitModels as $unitModel)$units[$unitModel->name] = $unitModel->id;
+        if ($packages[$index][$amountColumn] >= $startNumber){
+            $packages[$index][$amountColumn] -= $startNumber;
+            return $packages;
+        }else{
+            unset($packages[$index]);
+            $startNumber -= $packages[$index][$amountColumn];
+            $this->settingCount($packages,$amountColumn,$startNumber);
         }
-        $name = array_search($unit_id,$units);
-        //递归匹配
-        switch ($name){
-            case "件"://布尔值校验是否匹配过件来确保箱只匹配一次件
-                return $this->matchInStorage($amount, $matchObject, $columnMapping, $owner_id, $units["箱"], $rules, $sku, $units, true);
-            case "箱"://箱存在向下向上转换
-                if ($isMatch){
-                    return $this->matchInStorage($amount, $matchObject, $columnMapping, $owner_id, $units["单"], $rules, $sku, $units);
-                }else{
-                    return $this->matchInStorage($amount, $matchObject, $columnMapping, $owner_id, $units["件"], $rules, $sku, $units);
-                }
-            case "单"://三次匹配皆无,返回null
-                return null;
-        }*/
     }
 }

+ 4 - 2
app/Services/OwnerService.php

@@ -166,10 +166,12 @@ Class OwnerService
         return Owner::query()->whereIn('id',app('UserService')->getPermittingOwnerIds($user)??[])->get();
     }
 
-    public function get(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false)
+    public function get(array $params, array $withs = null, bool $authority = true, bool $notShowSoftDelete = false,$user)
     {
         /** @var User $user */
-        $user = Auth::user();
+        if ($user==null) {
+            $user = Auth::user();
+        }
         $query = Owner::query();
         if ($withs)$query->with($withs);
         if ($authority){

+ 3 - 3
app/Services/OwnerStoragePriceModelService.php

@@ -43,10 +43,10 @@ Class OwnerStoragePriceModelService
     }
 
     //暂时不考虑单位换算问题:后期可能存在多单位换算,此处仅视为单位为 m²
-    public function calculationAmount(OwnerStoragePriceModel $model, $area, $owner_id = null, $month = null) :int
+    public function calculationAmount(OwnerStoragePriceModel $model, $area, $owner_id = null, $month = null)
     {
         if (!$model || !$area) return 0;
-        if ((int)$area < $model->minimum_area) $area = (int)$model->minimum_area;
+        if ($area < $model->minimum_area) $area = $model->minimum_area;
         $money = $area*$model->price;
         switch ($model->discount_type){
             case "按单减免":
@@ -58,7 +58,7 @@ Class OwnerStoragePriceModelService
                 }
                 break;
             case "固定减免":
-                $money -= (int)$model->discount_value;
+                $money -= $model->discount_value;
                 break;
         }
         return $money;

+ 57 - 0
app/Services/RealtimePendingOrdersService.php

@@ -0,0 +1,57 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Order;
+use Illuminate\Database\Eloquent\Builder;
+use Illuminate\Database\Eloquent\Collection;
+use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Cache;
+use Illuminate\Support\Facades\DB;
+
+class RealtimePendingOrdersService
+{
+    /**
+     * 获取实时待处理订单
+     * @param null $start
+     * @param null $end
+     * @return Builder[]|Collection|mixed
+     */
+    public function warehousesOrders($start = null, $end = null)
+    {
+        try {
+            return Cache::remember('RealTimePendingOrders' . Auth::id(), 60, function () use ($start, $end) {
+                return $this->getOrderStatistics($start, $end);
+            });
+        } catch (\Exception $e) {
+            return $this->getOrderStatistics($start, $end);
+        }
+    }
+
+    /**
+     * @param $start
+     * @param $end
+     * @return Builder[]|Collection
+     */
+    public function getOrderStatistics($start, $end)
+    {
+        $start = $start ?? date('Y-m-d 00:00:00');
+        $end = $end ?? date('Y-m-d 23:59:59');
+        $ownerIds = app('OwnerService')->getSelectionId();
+        $builders = Order::query()->selectRaw("warehouses.name," .
+            "count(case wms_status when '创建订单' then 1 end) as createOrder, " .
+            "count(case wms_status when '分配完成' then 1 end) as assignedComplete, " .
+            "count(case wms_status when '部分分配' then 1 end) as partialAllocation, " .
+            "count(case wms_status when '部分装箱' then 1 end) as partPacking, " .
+            "count(case wms_status when '播种完成' then 1 end) as sowComplete, " .
+            "count(1) as total"
+        )->whereBetween('orders.created_at', [$start, $end,])
+            ->whereIn('wms_status', ['创建订单', '分配完成', '部分分配', '部分装箱', '播种完成'])
+            ->leftJoin('warehouses', 'orders.warehouse_id', 'warehouses.id')
+            ->groupBy('warehouse_id');
+        if ($ownerIds) $builders->whereIn('owner_id', $ownerIds);
+        return $builders->get();
+    }
+}

+ 7 - 11
app/Services/ShopService.php

@@ -31,8 +31,8 @@ class ShopService
     }
 
     public function getByWmsOrders($orderHeaders)
-    {    //issuepartyname
-        $maps = [];
+    {
+        $maps = []; //issuepartyname
         foreach ($orderHeaders as $orderHeader) {
             $value = ['owner_code'=>$orderHeader->customerid,'issuepartyname'=>$orderHeader->issuepartyname];
             if(!in_array($value,$maps))
@@ -46,10 +46,10 @@ class ShopService
             })->whereIn('name',$issuepartynames)->get();
         if($shops->count() < count($issuepartynames)){
             $shops_code = data_get($shops,'*.name');
-            $issuepartynames = array_diff($issuepartynames,$shops_code);
+            $names = array_diff($issuepartynames,$shops_code);
             $params = [];
             foreach ($maps as $item){
-               if(in_array($item['issuepartyname'],$issuepartynames))
+               if(in_array($item['issuepartyname'],$names))
                    $params[] = $item;
             }
             $shops_list = $this->createByNameAndOwnerCode($params);
@@ -59,9 +59,7 @@ class ShopService
     }
 
     public function createByNameAndOwnerCode(array $params){
-        $owners = Owner::query()
-            ->whereIn('code',data_get($params,'*.owner_code'))
-            ->get();
+        $owners = Owner::query()->whereIn('code',data_get($params,'*.owner_code'))->get();
         $owners_map = [];
         foreach ($owners as $owner) {
             $owners_map[$owner->code] = $owner;
@@ -82,11 +80,9 @@ class ShopService
                 app('LogService')->log(__METHOD__, __FUNCTION__, '批量创建 shop ' . count($insert_params) . json_encode($insert_params));
             }
         } catch (\Exception $e) {
-            app('LogService')->log(__METHOD__, __FUNCTION__, '批量创建 shop ' . json_encode($insert_params) .'||'.$e->getMessage().'||'.$e->getTraceAsString());
+            app('LogService')->log(__METHOD__, 'Error '.__FUNCTION__, '批量创建 shop Error' . json_encode($insert_params) .'||'.$e->getMessage().'||'.$e->getTraceAsString());
         } finally {
-            return Shop::query()
-                ->whereIn('name',data_get($params,'*.issuepartyname'))
-                ->get();
+            return Shop::query()->whereIn('name',data_get($params,'*.issuepartyname'))->get();
         }
     }
 

+ 1 - 2
app/Services/WarehouseService.php

@@ -42,7 +42,7 @@ Class WarehouseService
         $oracleBasCustomers=app(OracleBasCustomerService::class)->getWareHouse($warehouse_ids);
         $warehouses=Warehouse::query()->where('code',data_get($oracleBasCustomers,'*.CustomerID'))->get();
         $oracleBasCustomers=$oracleBasCustomers->filter(function($oracleBasCustomer)use($warehouses){
-            return $warehouses->where('code',$oracleBasCustomer->warehouseid)->count()>0;
+            return $warehouses->where('code',$oracleBasCustomer->warehouseid)->count()==0;
         });
         foreach ($oracleBasCustomers as $oracleBasCustomer){
             $wereHouse=Warehouse::query()->create([
@@ -78,7 +78,6 @@ Class WarehouseService
                 'created_at' => $created_at,
             ];
         }
-
         try {
             if (count($insert_params) > 0) {
                 $this->insert($insert_params);

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

@@ -42,7 +42,7 @@ Class QueryService
                     $queryTemp=$queryTemp->where($tableName.$column,'like','%'.$params[$param].'%')
                         ->where($tableName.'created_at','>',$today);
                     if($queryTemp->count()==0 || $queryTemp->first()[$column]==$params[$param]){
-                        $query=$query->where($tableName.$column,$params[$param]);
+                        $query=$query->where($tableName.$column,"like",$params[$param]."%");
                     }else{
                         $query=$query->where($tableName.$column,'like','%'.$params[$param].'%')
                             ->where($tableName.'created_at','>',$today);

+ 1 - 1
app/UserDutyCheck.php

@@ -28,7 +28,7 @@ class UserDutyCheck extends Model
         return $this->belongsTo('App\UserWorkgroup','workgroup_id','id');
     }
     public function laborReport(){
-        return $this->belongsTo('App\LaborReport');
+        return $this->belongsTo('App\LaborReport','id','user_duty_check_id');
     }
 
     public function laborEnterCheck(){

+ 14 - 0
app/UserVisitMenuLog.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App;
+
+use App\Traits\ModelTimeFormat;
+use Illuminate\Database\Eloquent\Model;
+
+class UserVisitMenuLog extends Model
+{
+    use ModelTimeFormat;
+    protected $fillable=[
+        'user_id','menu_id','created_at','updated_at',
+    ];
+}

+ 11 - 0
app/ValueStore.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class ValueStore extends Model
+{
+    //
+    protected $fillable = ['name','value'];
+}

+ 3 - 3
database/factories/CarTypeFactory.php

@@ -9,8 +9,8 @@ $factory->define(CarType::class, function (Faker $faker) {
     return [
         'name' => $faker->name,
         'model' => $faker->name,
-        'length',
-        'load',
-        'remark'
+        'length' => mt_rand(6,250) / 4,
+        'load' => mt_rand(6,250) / 4,
+        'remark' => $faker->text(20),
     ];
 });

+ 21 - 0
database/factories/CommodityFactory.php

@@ -0,0 +1,21 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\Commodity;
+use Faker\Generator as Faker;
+
+$factory->define(Commodity::class, function (Faker $faker) {
+    $type = ["无","临时"];
+    return [
+        'name' => $faker->name,
+        'sku' => md5(date('Ymd').\Illuminate\Support\Str::random(3)),
+        'owner_id' => factory(\App\Owner::class),
+        'length' => mt_rand(1,90) / 3,
+        'width' => mt_rand(1,90) / 3,
+        'height' => mt_rand(1,90) / 3,
+        'volumn' => mt_rand(10,900) / 3,
+        "type" => $type[array_rand($type)],
+        "pack_spec" => mt_rand(1,100)
+    ];
+});

+ 0 - 1
database/factories/OwnerFactory.php

@@ -10,7 +10,6 @@ $factory->define(Owner::class, function (Faker $faker) {
         'name' => $faker->name,                 //名称
         'code' => \Illuminate\Support\Str::random(5).date('yymmdd'),                 //代码
         'checking_count' => mt_rand(0,5),       //审核数量
-        "customer_id" => factory(App\Customer::class),          //客户ID
         "tax_rate" => mt_rand(0,100) / 10,             //税率
         "contract_number" => \Illuminate\Support\Str::random(5).date('yymmdd'),      //合同号
         "salesman" => $faker->name,             //销售名称

+ 15 - 0
database/factories/OwnerPriceDirectLogisticCarFactory.php

@@ -0,0 +1,15 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceDirectLogisticCar;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerPriceDirectLogisticCar::class, function (Faker $faker) {
+    return [
+        "owner_price_direct_logistic_id" => factory(\App\OwnerPriceDirectLogistic::class),   //直发车计费ID
+        "car_type_id" => factory(\App\CarType::class),                      //车型ID
+        "base_fee" => mt_rand(6,250) / 4,                         //起步费
+        "additional_fee" => mt_rand(6,250) / 4,                   //续费(元/KM)
+    ];
+});

+ 4 - 6
database/factories/OwnerPriceExpressFactory.php

@@ -5,12 +5,10 @@
 use App\OwnerPriceExpress;
 use Faker\Generator as Faker;
 
-$unit = \App\Unit::query()->first();
-$factory->define(OwnerPriceExpress::class, function (Faker $faker)use(&$unit) {
-    if (!$unit)$unit = \App\Unit::query()->first();
+$factory->define(OwnerPriceExpress::class, function (Faker $faker) {
     return [
-        "name" => $faker->name,                     //名称
-        "initial_weight_unit_id" => $unit ? $unit->id : factory(\App\Unit::class),   //首重单位
-        "additional_weight_unit_id" => $unit ? $unit->id : factory(\App\Unit::class),//续重单位
+        "name" => $faker->name,
+        "initial_weight" => mt_rand(6,260) / 5,
+        "additional_weight" => mt_rand(6,260) / 5,
     ];
 });

+ 16 - 0
database/factories/OwnerPriceExpressProvinceFactory.php

@@ -0,0 +1,16 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceExpressProvince;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerPriceExpressProvince::class, function (Faker $faker) {
+    $province = \App\Province::query()->first();
+    return [
+        "owner_price_express_id" => factory(\App\OwnerPriceExpress::class),   //快递价格ID
+        "province_id" => $province->id,              //省份ID
+        "initial_weight_price" => mt_rand(6,260) / 5,     //初始单价
+        "additional_weight_price"=>mt_rand(6,260) / 5,  //续重单价
+    ];
+});

+ 23 - 0
database/factories/OwnerPriceLogisticDetailFactory.php

@@ -0,0 +1,23 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceLogisticDetail;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerPriceLogisticDetail::class, function (Faker $faker) {
+    $province = \App\Province::query()->first();
+    $city = \App\City::query()->where("province_id",$province->id)->first();
+    return [
+        "owner_price_logistic_id" => factory(\App\OwnerPriceLogistic::class),  //物流计费
+        "unit_id" => factory(\App\Unit::class),                  //单位ID
+        "range" => "0-5",                    //区间
+        "province_id" => $province->id,              //省份ID
+        "city_id" => $city->id,                  //城市ID
+        "unit_price" => mt_rand(1,36) / 3,               //单价
+        "delivery_fee" => mt_rand(1,136) / 3,             //送货费
+        "initial_fee" => mt_rand(1,136) / 3,              //起始计费
+        "initial_amount" => mt_rand(1,136) / 3,           //起始计数
+        "rate" =>  mt_rand(1,136) / 3,                       //费率
+    ];
+});

+ 19 - 0
database/factories/OwnerPriceLogisticFactory.php

@@ -0,0 +1,19 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OwnerPriceLogistic;
+use Faker\Generator as Faker;
+
+$factory->define(OwnerPriceLogistic::class, function (Faker $faker) {
+    return [
+        "name" => $faker->name,             //名称
+        "unit_range" => "0-5,5-10,10-15,15-20",       //单价一区间
+        "unit_id" => factory(\App\Unit::class),          //单位一ID
+        "other_unit_range" => "0-5,5-10,10-15,15-20,30-", //单位二区间
+        "other_unit_id" => factory(\App\Unit::class),    //单位二ID
+        "pick_up_price" => mt_rand(2,230) / 3,    //提货费
+        "fuel_price" => mt_rand(2,230) / 3,       //燃油附加费
+        "service_price" => mt_rand(2,230) / 3,    //信息服务费
+    ];
+});

+ 2 - 1
database/factories/OwnerReportFactory.php

@@ -13,6 +13,7 @@ $factory->define(OwnerReport::class, function (Faker $faker)use($owner) {
         "daily_average_order_amount" => mt_rand(0,10000),  //日均单量
         "current_month_counting_area" => mt_rand(100,100000) / 50,  //结算月盘点面积
         "last_month_counting_area"   => mt_rand(100,100000) / 50,  //结算月上月盘点面积
-        "owner_bill_report_id"  =>factory(App\OwnerBillReport::class)        //账单ID
+        "owner_bill_report_id"  =>factory(App\OwnerBillReport::class),        //账单ID
+        "total" => mt_rand(1,2000),
     ];
 });

+ 1 - 1
database/migrations/2020_09_10_143926_drop_shop_unique_name_index.php

@@ -27,7 +27,7 @@ class DropShopUniqueNameIndex extends Migration
     public function down()
     {
         Schema::table('shops', function (Blueprint $table) {
-            $table->string('name')->unique();
+            $table->string('name')->unique('shops_name_unique');
         });
     }
 }

+ 17 - 15
database/migrations/2020_09_20_142656_change_order_issue.php

@@ -18,12 +18,13 @@ class ChangeOrderIssue extends Migration
             $table->string('logistic_number_return')->nullable()->index()->after('order_id');
         });
 
-        $orderIssues = \App\OrderIssue::query()->get();
-
-        foreach ($orderIssues as $orderIssue) {
-            $rejectedBill = $orderIssue->hasOne(RejectedBill::class, 'id', 'rejected_bill_id')->first();
-            if($rejectedBill ?? false){
-                $orderIssue->update(['logistic_number_return'=>$rejectedBill->logistic_number_return ?? null]);
+        $orderIssues = \App\OrderIssue::query()->withTrashed()->get();
+        if($orderIssues->count()>0){
+            foreach ($orderIssues as $orderIssue) {
+                $rejectedBill = $orderIssue->hasOne(RejectedBill::class, 'id', 'rejected_bill_id')->first();
+                if($rejectedBill ?? false){
+                    $orderIssue->update(['logistic_number_return'=>$rejectedBill->logistic_number_return ?? null]);
+                }
             }
         }
 
@@ -45,17 +46,18 @@ class ChangeOrderIssue extends Migration
 //            $table->integer('rejected_bill_id')->index()->nullable()->comment('退回单')->after('order_id');
 //        });
 
-        $orderIssues = \App\OrderIssue::query()->get();
-
-        foreach ($orderIssues as $orderIssue) {
-            $rejectedBill =  $orderIssue->hasOne(RejectedBill::class, 'logistic_number_return', 'logistic_number_return')->first();
-            if($rejectedBill ?? false){
-                $orderIssue->update(['rejected_bill_id'=>$rejectedBill->id ?? null]);
+        $orderIssues = \App\OrderIssue::query()->withTrashed()->get();
+        if($orderIssues->count()>0){
+            foreach ($orderIssues as $orderIssue) {
+                $rejectedBill =  $orderIssue->hasOne(RejectedBill::class, 'logistic_number_return', 'logistic_number_return')->first();
+                if($rejectedBill ?? false){
+                    $orderIssue->update(['rejected_bill_id'=>$rejectedBill->id ?? null]);
+                }
             }
         }
 
-        Schema::table('order_issues',function (Blueprint $table) {
-            $table->dropColumn('logistic_number_return');
-        });
+//        Schema::table('order_issues',function (Blueprint $table) {
+//            $table->dropColumn('logistic_number_return');
+//        });
     }
 }

+ 7 - 5
database/migrations/2020_10_14_112825_add_order_issue_second_client_no.php

@@ -18,11 +18,13 @@ class AddOrderIssueSecondClientNo extends Migration
         Schema::table('order_issues', function (Blueprint $table) {
             $table->string('second_client_no')->index()->nullable()->comment('二次客户订单号')->after('second_order_id');
         });
-        $orderIssues = \App\OrderIssue::query()->whereNotNull('second_order_id')->get();
-        foreach ($orderIssues as $orderIssue) {
-            $order = $orderIssue->hasOne('App\Order', 'id', 'second_order_id')->first();
-            if($order ?? false){
-                $orderIssue->update(['second_client_no'=>$order->client_code ?? null]);
+        $orderIssues = \App\OrderIssue::query()->withTrashed()->whereNotNull('second_order_id')->get();
+        if($orderIssues->count() > 0){
+            foreach ($orderIssues as $orderIssue) {
+                $order = $orderIssue->hasOne('App\Order', 'id', 'second_order_id')->first();
+                if($order ?? false){
+                    $orderIssue->update(['second_client_no'=>$order->client_code ?? null]);
+                }
             }
         }
     }

+ 36 - 0
database/migrations/2020_11_03_092648_create_menus.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateMenus extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('menus', function (Blueprint $table) {
+            $table->id();
+            $table->string('name')->comment('名称');
+            $table->integer('level')->comment('等级');
+            $table->integer('parent_id')->nullable();
+            $table->string('route')->comment('路由地址');
+            $table->integer('sequence')->comment('顺序');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('menus');
+    }
+}

+ 88 - 0
database/migrations/2020_11_03_095519_seed_menus_level_1.php

@@ -0,0 +1,88 @@
+<?php
+
+use App\Menu;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class SeedMenusLevel1 extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        \App\Menu::create([
+            'name'=>'退货管理',
+            'level'=>1,
+            'route'=>'rejected/index/general',
+            'sequence'=>1,
+        ]);
+        \App\Menu::create([
+            'name'=>'入库管理',
+            'level'=>1,
+            'route'=>'store/checkingReceive/mission',
+            'sequence'=>2,
+        ]);
+        \App\Menu::create([
+            'name'=>'订单管理',
+            'level'=>1,
+            'route'=>'order/index/delivering',
+            'sequence'=>3,
+        ]);
+        \App\Menu::create([
+            'name'=>'运输管理',
+            'level'=>1,
+            'route'=>'waybill/index',
+            'sequence'=>4,
+        ]);
+        \App\Menu::create([
+            'name'=>'称重管理',
+            'level'=>1,
+            'route'=>'package',
+            'sequence'=>5,
+        ]);
+        \App\Menu::create([
+            'name'=>'库存管理',
+            'level'=>1,
+            'route'=>'inventory/statement/allInventory',
+            'sequence'=>6,
+        ]);
+        \App\Menu::create([
+            'name'=>'二次加工管理',
+            'level'=>1,
+            'route'=>'process',
+            'sequence'=>7,
+        ]);
+        \App\Menu::create([
+            'name'=>'客户管理',
+            'level'=>1,
+            'route'=>'customer/project/report',
+            'sequence'=>8,
+        ]);
+        \App\Menu::create([
+            'name'=>'人事管理',
+            'level'=>1,
+            'route'=>'personnel/laborReport',
+            'sequence'=>9,
+        ]);
+        \App\Menu::create([
+            'name'=>'基础设置',
+            'level'=>1,
+            'route'=>'maintenance',
+            'sequence'=>10,
+        ]);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Menu::query()->where('level',1)->delete();
+    }
+}

+ 481 - 0
database/migrations/2020_11_03_095724_seed_menus_level_2.php

@@ -0,0 +1,481 @@
+<?php
+
+use App\Menu;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class SeedMenusLevel2 extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Menu::create([
+            'name'=>'查询',
+            'level'=>2,
+            'parent_id'=>1,
+            'route'=>'rejected/index/general',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'录入',
+            'level'=>2,
+            'parent_id'=>1,
+            'route'=>'rejected/create',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>1,
+            'route'=>'rejected/relating',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'回收站',
+            'level'=>2,
+            'parent_id'=>1,
+            'route'=>'rejected/recycle',
+            'sequence'=>4,
+        ]);
+
+        Menu::create([
+            'name'=>'盘收一体',
+            'level'=>2,
+            'parent_id'=>2,
+            'route'=>'store/checkingReceive/mission',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'快速入库',
+            'level'=>2,
+            'parent_id'=>2,
+            'route'=>'store/fast/create',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'盲收',
+            'level'=>2,
+            'parent_id'=>2,
+            'route'=>'store/blindReceive/excels',
+            'sequence'=>3,
+        ]);
+
+        Menu::create([
+            'name'=>'订单',
+            'level'=>2,
+            'parent_id'=>3,
+            'route'=>'order/index/delivering',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'波次',
+            'level'=>2,
+            'parent_id'=>3,
+            'route'=>'order/wave/index/',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'问题件',
+            'level'=>2,
+            'parent_id'=>3,
+            'route'=>'order/issue/index?addtime=15',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'跟踪',
+            'level'=>2,
+            'parent_id'=>3,
+            'route'=>'order/tracking/index',
+            'sequence'=>4,
+        ]);
+
+        //运输
+        Menu::create([
+            'name'=>'查询',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/index',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'录入',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/create?type=ZX',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'发运',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/delivering',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/relating',
+            'sequence' => 4,
+        ]);
+        Menu::create([
+            'name'=>'财务报表',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/waybillFinancialSnapshot',
+            'sequence'=>5,
+        ]);
+        Menu::create([
+            'name'=>'异常报表',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/waybillFinancialExcepted',
+            'sequence'=>6,
+        ]);
+        Menu::create([
+            'name'=>'回收站',
+            'level'=>2,
+            'parent_id'=>4,
+            'route'=>'waybill/recycle',
+            'sequence'=>7,
+        ]);
+        //称重
+        Menu::create([
+            'name'=>'记录',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'设备',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/measureMonitor',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'统计',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/statistics',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'手动录入',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/create',
+            'sequence'=>4,
+        ]);
+        Menu::create([
+            'name'=>'异常记录',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/weightExcepted/indexCreate',
+            'sequence'=>5,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>5,
+            'route'=>'package/relating',
+            'sequence'=>6,
+        ]);
+        //库存管理
+        Menu::create([
+            'name'=>'库存',
+            'level'=>2,
+            'parent_id'=>6,
+            'route'=>'inventory/statement/changeInventory?range=1',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'盘点',
+            'level'=>2,
+            'parent_id'=>6,
+            'route'=>'inventory/stockInventory/mission',
+            'sequence'=>2,
+        ]);
+        //二次加工
+        Menu::create([
+            'name'=>'查询',
+            'level'=>2,
+            'parent_id'=>7,
+            'route'=>'process/',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'录入',
+            'level'=>2,
+            'parent_id'=>7,
+            'route'=>'process/create',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'统计',
+            'level'=>2,
+            'parent_id'=>7,
+            'route'=>'process/statistic',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'回收站',
+            'level'=>2,
+            'parent_id'=>7,
+            'route'=>'process/recycle',
+            'sequence'=>4,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>7,
+            'route'=>'process/relating',
+            'sequence'=>5,
+        ]);
+        //客户管理
+        Menu::create([
+            'name'=>'项目',
+            'level'=>2,
+            'parent_id'=>8,
+            'route'=>'customer/project/report',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'财务',
+            'level'=>2,
+            'parent_id'=>8,
+            'route'=>'customer/finance/instantBill',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>8,
+            'route'=>'customer/relating',
+            'sequence'=>3,
+        ]);
+        //人事管理
+        Menu::create([
+            'name'=>'临时工报表',
+            'level'=>2,
+            'parent_id'=>9,
+            'route'=>'personnel/laborReport',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'打卡相关',
+            'level'=>2,
+            'parent_id'=>9,
+            'route'=>'personnel/checking-in/createReplenishClock',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'相关设置',
+            'level'=>2,
+            'parent_id'=>9,
+            'route'=>'personnel/relating',
+            'sequence'=>3,
+        ]);
+
+
+        //基础设置
+        Menu::create([
+            'name'=>'用户',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/user',
+            'sequence'=>1,
+        ]);
+        Menu::create([
+            'name'=>'角色',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/role',
+            'sequence'=>2,
+        ]);
+        Menu::create([
+            'name'=>'权限',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/authority',
+            'sequence'=>3,
+        ]);
+        Menu::create([
+            'name'=>'工作组',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/userWorkgroup',
+            'sequence'=>4,
+        ]);
+        Menu::create([
+            'name'=>'项目组',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/userOwnerGroup',
+            'sequence'=>5,
+        ]);
+        Menu::create([
+            'name'=>'仓库',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/warehouse',
+            'sequence'=>6,
+        ]);
+        Menu::create([
+            'name'=>'客户',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/customer',
+            'sequence'=>7,
+        ]);
+        Menu::create([
+            'name'=>'货主',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/owner',
+            'sequence'=>8,
+        ]);
+        Menu::create([
+            'name'=>'品质标签',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/qualityLabel',
+            'sequence'=>9,
+        ]);
+        Menu::create([
+            'name'=>'作业类型',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/processMethod',
+            'sequence'=>10,
+        ]);
+        Menu::create([
+            'name'=>'商品信息',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/commodity',
+            'sequence'=>11,
+        ]);
+        Menu::create([
+            'name'=>'计量单位',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/unit',
+            'sequence'=>12,
+        ]);
+        Menu::create([
+            'name'=>'省份',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/province',
+            'sequence'=>13,
+        ]);
+        Menu::create([
+            'name'=>'城市',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/city',
+            'sequence'=>14,
+        ]);
+        Menu::create([
+            'name'=>'物流公司',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/logistic',
+            'sequence'=>15,
+        ]);
+        Menu::create([
+            'name'=>'承运商',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/carrier',
+            'sequence'=>16,
+        ]);
+        Menu::create([
+            'name'=>'车型',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/carType',
+            'sequence'=>17,
+        ]);
+        Menu::create([
+            'name'=>'作业类型',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/jobType',
+            'sequence'=>18,
+        ]);
+        Menu::create([
+            'name'=>'特征',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/feature',
+            'sequence'=>19,
+        ]);
+        Menu::create([
+            'name'=>'计费模型',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/priceModel/waybillPriceModel',
+            'sequence'=>20,
+        ]);
+        Menu::create([
+            'name'=>'纸箱',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/paperBox/index/model',
+            'sequence'=>21,
+        ]);
+        Menu::create([
+            'name'=>'测量设备',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/measuringMachine',
+            'sequence'=>22,
+        ]);
+        Menu::create([
+            'name'=>'教程',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/tutorial',
+            'sequence'=>23,
+        ]);
+        Menu::create([
+            'name'=>'临时工',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/userLabor',
+            'sequence'=>24,
+        ]);
+        Menu::create([
+            'name'=>'劳务所',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/laborCompany',
+            'sequence'=>25,
+        ]);
+        Menu::create([
+            'name'=>'日志',
+            'level'=>2,
+            'parent_id'=>10,
+            'route'=>'maintenance/log',
+            'sequence'=>26,
+        ]);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Menu::query()->where('level',2)->delete();
+    }
+}

+ 33 - 0
database/migrations/2020_11_03_111159_create_user_visit_menu_logs.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateUserVisitMenuLogs extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('user_visit_menu_logs', function (Blueprint $table) {
+            $table->id();
+            $table->integer('user_id')->index();
+            $table->integer('menu_id')->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('user_visit_menu_logs');
+    }
+}

+ 38 - 0
database/migrations/2020_11_06_114606_create_order_counting_records_table.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateOrderCountingRecordsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('order_counting_records', function (Blueprint $table) {
+            $table->id();
+            $table->integer('owner_id')->index()->comment('外键货主');
+            $table->integer('shop_id')->nullable()->index()->comment('外键商铺');
+            $table->integer('warehouse_id')->nullable()->index()->comment('外键仓库');
+            $table->integer('logistic_id')->nullable()->index()->comment('外键快递');
+            $table->string('date_target')->index()->comment('该时间为时间, 根据单位扔掉部分信息');
+            $table->enum('counting_unit',['日','周','月','年'])->index()->comment('时间粒度');
+            $table->integer('amount')->comment('该货主下某天订单总数量');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('order_counting_records');
+    }
+}

+ 33 - 0
database/migrations/2020_11_23_143015_create_value_stores_table.php

@@ -0,0 +1,33 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class CreateValueStoresTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('value_stores', function (Blueprint $table) {
+            $table->id();
+            $table->string('name');
+            $table->timestamp('value', 0)->nullable()->index();
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('value_stores');
+    }
+}

+ 61 - 0
database/migrations/2020_11_23_143145_seed_value_stores_table.php

@@ -0,0 +1,61 @@
+<?php
+
+use App\ValueStore;
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class SeedValueStoresTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        \App\ValueStore::create([
+            'name' => 'order_last_created_sync_at',
+            'value' => null,
+        ]);
+        \App\ValueStore::create([
+            'name' => 'order_last_updated_sync_at',
+            'value' => null,
+        ]);
+
+        \App\ValueStore::create([
+            'name' => 'commodity_last_created_sync_at',
+            'value' => null,
+        ]);
+        \App\ValueStore::create([
+            'name' => 'commodity_last_updated_sync_at',
+            'value' => null,
+        ]);
+
+        \App\ValueStore::create([
+            'name' => 'asn_last_created_sync_at',
+            'value' => null,
+        ]);
+        \App\ValueStore::create([
+            'name' => 'asn_last_updated_sync_at',
+            'value' => null,
+        ]);
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        ValueStore::query()->whereIn(
+            'name', ['order_last_created_sync_at',
+            'order_last_updated_sync_at',
+            'commodity_last_created_sync_at',
+            'commodity_last_updated_sync_at',
+            'asn_last_created_sync_at',
+            'asn_last_updated_sync_at',
+        ])->delete();
+    }
+}

+ 14 - 1
package-lock.json

@@ -3425,6 +3425,14 @@
                 "safer-buffer": "^2.1.0"
             }
         },
+        "echarts": {
+            "version": "4.9.0",
+            "resolved": "https://registry.npm.taobao.org/echarts/download/echarts-4.9.0.tgz?cache=0&sync_timestamp=1603712828556&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fecharts%2Fdownload%2Fecharts-4.9.0.tgz",
+            "integrity": "sha1-qbm6oD8Doqcx5jQMVb77V6nhNH0=",
+            "requires": {
+                "zrender": "4.3.2"
+            }
+        },
         "ee-first": {
             "version": "1.1.1",
             "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@@ -6192,7 +6200,7 @@
         },
         "minimist": {
             "version": "1.2.0",
-            "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
+            "resolved": "https://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz",
             "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
             "dev": true
         },
@@ -10775,6 +10783,11 @@
             "version": "0.1.2",
             "resolved": "https://registry.npmjs.org/yeast/-/yeast-0.1.2.tgz",
             "integrity": "sha1-AI4G2AlDIMNy28L47XagymyKxBk="
+        },
+        "zrender": {
+            "version": "4.3.2",
+            "resolved": "https://registry.npm.taobao.org/zrender/download/zrender-4.3.2.tgz?cache=0&sync_timestamp=1603693382261&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fzrender%2Fdownload%2Fzrender-4.3.2.tgz",
+            "integrity": "sha1-7HQy+UFcgsc1hLa3uMR+GwFiCcY="
         }
     }
 }

+ 1 - 0
package.json

@@ -26,6 +26,7 @@
   },
   "dependencies": {
     "bootstrap-select": "^1.13.18",
+    "echarts": "^4.9.0",
     "jquery.cookie": "^1.4.1",
     "js-cookie": "^2.2.1",
     "laravel-echo": "^1.8.0",

BIN
public/images/QRCodeIMG/4.png


BIN
public/images/QRCodeIMG/5.png


+ 4 - 4
public/js/app.js

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

+ 1 - 2
public/t.php

@@ -1,4 +1,3 @@
 <?php
 
-$a = '12345678.12345';
-echo substr($a, 2, 2);
+var_dump((bool)[]);

+ 3 - 1
resources/js/app.js

@@ -1,12 +1,14 @@
 
 require('./bootstrap');
 require('./mounted');
+require('./element-ui');
 
 window.Vue = require('vue');
 window.tempTip=require('./utilities/tempTip');
+window.ElementUI=require('./utilities/tempTip');
 window.getGetVal=require('./utilities/getGetVal');
 window.scanner=require('./utilities/scanner');
 window.datetimeRelating=require('./utilities/datetimeRelating');
-
+window.Vue.use(window.ElementUI)
 require('bootstrap-select');
 

+ 3 - 0
resources/js/echarts.js

@@ -0,0 +1,3 @@
+window.echarts = require('echarts');
+import echarts from 'echarts'
+Vue.prototype.$echarts = echarts

Разница между файлами не показана из-за своего большого размера
+ 0 - 0
resources/js/element-ui.js


Разница между файлами не показана из-за своего большого размера
+ 0 - 0
resources/sass/element-ui.css


+ 557 - 0
resources/views/control/panel.blade.php

@@ -0,0 +1,557 @@
+@extends('layouts.app')
+@section('title')控制台@endsection
+@section('head')
+    <link href="{{ mix('css/element-ui.css') }}" rel="stylesheet">
+@endsection
+@section('content')
+    <div class="d-none" id="list">
+        <div class="container-fluid">
+            <div class="card">
+                <h5 class="card-header">最近使用功能</h5>
+                <div class="card-body row">
+                    <ul class="list-group" v-for="(menu,index) in menus">
+                        <div class="container-fluid btn-group justify-content-center">
+                            <a class="btn-primary btn-lg" v-if="index<=3" :href="'/'+menu.route">@{{ menu.name }}</a>
+                        </div>
+                        <div v-if="menu.secondLevelMenu && menu.secondLevelMenu.length>0&&index<=3">
+                            <div class="container-fluid btn-group m-1">
+                                <a class="bth btn-sm btn-info m-1" v-for="(secondMenu,index) in menu.secondLevelMenu"
+                                   :href="'/'+secondMenu.route" v-if="index < 2"> @{{ secondMenu.name }}</a>
+                            </div>
+                        </div>
+                    </ul>
+                </div>
+            </div>
+            <div class="row my-3">
+                <div class="col-2">
+                    <div class="card">
+                        <div class="card-header text-dark h5">
+                            <p>实时待处理订(总):@{{ totalOrders.total }}</p>
+                        </div>
+                        <div class="card-body">
+                            <p>创建订单:@{{ totalOrders.createOrder }}</p>
+                            <p>分配完成:@{{ totalOrders.assignedComplete }}</p>
+                            <p>部分分配:@{{ totalOrders.partialAllocation }}</p>
+                            <p>部分装箱:@{{ totalOrders.partPacking }}</p>
+                            <p>播种完成:@{{ totalOrders.sowComplete }}</p>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-2" v-for="(warehousesOrder,index) in warehousesOrders">
+                    <div class="card">
+                        <div class="card-header text-success h5">
+                            <p>@{{ getWareHouse(warehousesOrder.name) }}:@{{ warehousesOrder.total }}</p>
+                        </div>
+                        <div class="card-body">
+                            <p>创建订单:@{{ warehousesOrder.createOrder }}</p>
+                            <p>分配完成:@{{ warehousesOrder.assignedComplete }}</p>
+                            <p>部分分配:@{{ warehousesOrder.partialAllocation }}</p>
+                            <p>部分装箱:@{{ warehousesOrder.partPacking }}</p>
+                            <p>播种完成:@{{ warehousesOrder.sowComplete }}</p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+            <div class="row my-3">
+                <div class="col-5">
+                    <div class="card">
+                        <div class="card-header">
+                            <span class="demonstration"></span>
+                            <el-date-picker @blur="orderCountingRecordApi('')"
+                                            v-model="orderCountingRecordsDate"
+                                            type="daterange"
+                                            align="right"
+                                            unlink-panels
+                                            range-separator="-"
+                                            start-placeholder="开始日期"
+                                            end-placeholder="结束日期"
+                                            value-format="yyyy-MM-dd"
+                                            :picker-options="pickerOptions">
+                            </el-date-picker>
+                            <el-button type="primary" value="日" @click="orderCountingRecordApi('日')"
+                                       v-model="orderCountingRecordsUnit">日
+                            </el-button>
+                            <el-button type="primary" value="周" @click="orderCountingRecordApi('周')"
+                                       v-model="orderCountingRecordsUnit">周
+                            </el-button>
+                            <el-button type="primary" value="月" @click="orderCountingRecordApi('月')"
+                                       v-model="orderCountingRecordsUnit">月
+                            </el-button>
+                        </div>
+                        <div class="card-body row">
+                            <div v-show="orderCountingRecordsShow" id="orderCountingRecords" class="col"
+                                 style="width:600px;height:600px;"></div>
+                        </div>
+                        <div v-show="!orderCountingRecordsShow" class="text-center">
+                            <h3>正在加载...</h3>
+                        </div>
+                    </div>
+                </div>
+                <div class="col-7">
+                    <div class="row">
+                        <div class="col-6">
+                            <div class="card">
+                                <div class="card-header">
+                                    <div class="col-5 row">
+                                        <div class="block">
+                                            <span class="demonstration"></span>
+                                            <el-date-picker @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>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="card-body row">
+                                    <div v-show="logisticsCountingRecordsShow" id="logisticsCountingRecords" class="col"
+                                         style="width: 600px;height:600px;"></div>
+                                    <div v-show="!logisticsCountingRecordsShow" class="text-center">
+                                        <h3>正在加载...</h3>
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="col-6">
+                            <div class="card">
+                                <div class="card-header">
+                                    <div class="col-5 row">
+                                        <div class="block">
+                                            <span class="demonstration"></span>
+                                            <el-date-picker @blur="warehouseCountingRecordsApi()"
+                                                            v-model="warehouseCountingRecordsData"
+                                                            type="daterange"
+                                                            align="right"
+                                                            unlink-panels
+                                                            range-separator="-"
+                                                            start-placeholder="开始日期"
+                                                            end-placeholder="结束日期"
+                                                            value-format="yyyy-MM-dd"
+                                                            :picker-options="pickerOptions">
+                                            </el-date-picker>
+                                        </div>
+                                    </div>
+                                </div>
+                                <div class="card-body row">
+                                    <div v-show="warehouseCountingRecordsShow" id="warehouseCountingRecords" class="col"
+                                         style="width: 600px;height:600px;"></div>
+                                    <div v-show="!warehouseCountingRecordsShow">
+                                        正在加载
+                                    </div>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+                @can('人事管理-临时工报表-可见全部组')
+                    <div class="col-5">
+                        <div class="card">
+                            <div class="card-header">
+                                <span class="demonstration"></span>
+                                <el-date-picker @blur="laborReportsCountingRecordApi('')"
+                                                v-model="laborReportsCountingRecordsDate"
+                                                type="daterange"
+                                                align="right"
+                                                unlink-panels
+                                                range-separator="-"
+                                                start-placeholder="开始日期"
+                                                end-placeholder="结束日期"
+                                                value-format="yyyy-MM-dd"
+                                                :picker-options="pickerOptions">
+                                </el-date-picker>
+                                <el-button type="primary" value="日" @click="laborReportsCountingRecordApi('日')"
+                                           v-model="laborReportsCountingRecordUnit">日
+                                </el-button>
+                                <el-button type="primary" value="周" @click="laborReportsCountingRecordApi('周')"
+                                           v-model="laborReportsCountingRecordUnit">周
+                                </el-button>
+                                <el-button type="primary" value="月" @click="laborReportsCountingRecordApi('月')"
+                                           v-model="laborReportsCountingRecordUnit">月
+                                </el-button>
+                            </div>
+                            <div class="card-body row">
+                                <div v-show="laborReportsCountingRecordsShow" id="laborReportsCountingRecords" class="col"
+                                     style="width:600px;height:600px;"></div>
+                                <div v-show="!laborReportsCountingRecordsShow">
+                                    正在加载
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                    <div class="col-7">
+
+                        <div class="card">
+                            <div class="card-header">
+                                <span class="demonstration"></span>
+                                <el-date-picker @blur="laborReportsUserGroupsCountApi('')"
+                                                v-model="laborReportsUserGroupsCountDate"
+                                                type="daterange"
+                                                align="right"
+                                                unlink-panels
+                                                range-separator="-"
+                                                start-placeholder="开始日期"
+                                                end-placeholder="结束日期"
+                                                value-format="yyyy-MM-dd"
+                                                :picker-options="pickerOptions">
+                                </el-date-picker>
+                            </div>
+                            <div class="card-body row">
+                                <div v-show="laborReportsUserGroupsCountShow" id="laborReportsUserGroupsCount" class="col"
+                                     style="width:600px;height:600px;"></div>
+                                <div v-show="!laborReportsUserGroupsCountShow">
+                                    正在加载
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                @endcan
+            </div>
+        </div>
+    </div>
+@endsection
+@section('lastScript')
+    <script src="{{ mix('js/echarts.js') }}"></script>
+    <!-- 引入样式 -->
+    <!-- 引入组件库 -->
+    <script src="{{ mix('js/element-ui.js') }}"></script>
+    <script>
+        let vue = new Vue({
+            el: "#list",
+            data: {
+                myChart: null,
+                menus:{!! $menus !!},
+                warehousesOrders:{!! $warehousesOrders !!},
+                orderCountingRecords:{!! $orderCountingRecords !!},
+                logisticsCountingRecords:{!! $logisticsCountingRecords !!},
+                warehouseCountingRecords:{!! $warehouseCountingRecords !!},
+                laborReportsCountingRecords:{!! $laborReportsCountingRecords !!},
+                laborReportsUserGroupsCount:{!! $laborReportsUserGroupsCount !!},
+                warehouses: {},
+                totalOrders: {
+                    total: null,
+                    createOrder: null,
+                    assignedComplete: null,
+                    partialAllocation: null,
+                    partPacking: null,
+                    sowComplete: null,
+                },
+                orderCountingRecordsDateTarget: [],
+                orderCountingRecordsData: [],
+                laborReportsCountingRecordsDateTarget: [],
+                laborReportsCountingRecordsData: [],
+                pickerOptions: {
+                    shortcuts: [{
+                        text: '最近一周',
+                        onClick(picker) {
+                            const end = new Date();
+                            const start = new Date();
+                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+                            picker.$emit('pick', [start, end]);
+                        }
+                    }, {
+                        text: '最近一个月',
+                        onClick(picker) {
+                            const end = new Date();
+                            const start = new Date();
+                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+                            picker.$emit('pick', [start, end]);
+                        }
+                    }, {
+                        text: '最近三个月',
+                        onClick(picker) {
+                            const end = new Date();
+                            const start = new Date();
+                            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+                            picker.$emit('pick', [start, end]);
+                        }
+                    }]
+                },
+                orderCountingRecordsDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
+                    moment(new Date()).format('yyyy-MM-DD')],
+                logisticsCountingRecordsData: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
+                    moment(new Date()).format('yyyy-MM-DD')],
+                warehouseCountingRecordsData: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
+                    moment(new Date()).format('yyyy-MM-DD')],
+                laborReportsCountingRecordsDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
+                    moment(new Date()).format('yyyy-MM-DD')],
+                laborReportsUserGroupsCountDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
+                    moment(new Date()).format('yyyy-MM-DD')],
+                orderCountingRecordsUnit: '日',
+                laborReportsCountingRecordUnit: '日',
+                orderCountingRecordsShow: true,
+                logisticsCountingRecordsShow: true,
+                warehouseCountingRecordsShow: true,
+                laborReportsCountingRecordsShow: true,
+                laborReportsUserGroupsCountShow: true,
+            },
+            mounted: function () {
+                $('#list').removeClass('d-none');
+                let _this = this;
+                this.warehouses = {
+                    "WH01": '松江一仓',
+                    "WH02": '松江二仓',
+                    "WH03": '嘉定一仓',
+                }
+                this.warehousesOrders.forEach(function (item) {
+                    _this.totalOrders.total += parseInt(item.total);
+                    _this.totalOrders.createOrder += item.createOrder;
+                    _this.totalOrders.assignedComplete += item.assignedComplete;
+                    _this.totalOrders.partialAllocation += item.partialAllocation;
+                    _this.totalOrders.partPacking += item.partPacking;
+                    _this.totalOrders.sowComplete += item.sowComplete;
+                });
+                this.initOrderCountingRecords();
+                this.orderCountingRecordsChart = echarts.init(document.getElementById('orderCountingRecords'));
+                this.initOrderCountingRecordsChart();
+
+                this.logisticsCountingRecordsChart = echarts.init(document.getElementById('logisticsCountingRecords'));
+                this.initLogisticsCountingRecordsChart();
+
+                this.warehouseCountingRecordsChart = echarts.init(document.getElementById('warehouseCountingRecords'));
+                this.initWarehouseCountingRecordsChart();
+
+                this.initLaborReportsCountingRecords();
+                this.laborReportsCountingRecordsChart = echarts.init(document.getElementById('laborReportsCountingRecords'));
+                this.initLaborReportsCountingRecordsChart();
+
+                this.laborReportsUserGroupsCountChart = echarts.init(document.getElementById('laborReportsUserGroupsCount'));
+                this.initLaborReportsUserGroupsCountChart();
+
+            },
+            methods: {
+                getWareHouse: function (code) {
+                    return this.warehouses[code];
+                },
+                initOrderCountingRecords() {
+                    let _this = this;
+                    this.orderCountingRecords.forEach(function (item) {
+                        _this.orderCountingRecordsDateTarget.push(item.date_target);
+                        _this.orderCountingRecordsData.push(item.counter);
+                    });
+                },
+                initOrderCountingRecordsChart() {
+                    this.orderCountingRecordsChart.setOption({
+                        title: {text: '订单量趋势'},
+                        tooltip: {},
+                        legend: {data: ['订单数']},
+                        xAxis: {
+                            type: 'category',
+                            data: this.orderCountingRecordsDateTarget
+                        },
+                        yAxis: {type: 'value'},
+                        series: [{
+                            data: this.orderCountingRecordsData,
+                            type: 'line',
+                            smooth: true
+                        }]
+                    });
+                },
+                initLaborReportsCountingRecordsChart() {
+                    this.laborReportsCountingRecordsChart.setOption({
+                        title: {text: '临时用工趋势'},
+                        tooltip: {},
+                        legend: {data: ['临时用工数']},
+                        xAxis: {
+                            type: 'category',
+                            data: this.laborReportsCountingRecordsDateTarget
+                        },
+                        yAxis: {type: 'value'},
+                        series: [{
+                            data: this.laborReportsCountingRecordsData,
+                            type: 'line',
+                            smooth: true
+                        }]
+                    });
+                },
+                initLogisticsCountingRecordsChart() {
+                    this.logisticsCountingRecordsChart.setOption({
+                        title: {
+                            text: '快递分布',
+                            left: 'left'
+                        },
+                        tooltip: {
+                            trigger: 'item',
+                            formatter: '{a} <br/>{b} : {c} ({d}%)'
+                        },
+                        series: [
+                            {
+                                name: '快递分布',
+                                type: 'pie',
+                                radius: '55%',
+                                center: ['50%', '60%'],
+                                data: this.logisticsCountingRecords,
+                                emphasis: {
+                                    itemStyle: {
+                                        shadowBlur: 10,
+                                        shadowOffsetX: 0,
+                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                                    }
+                                }
+                            }
+                        ]
+                    });
+                },
+                initWarehouseCountingRecordsChart() {
+                    this.warehouseCountingRecordsChart.setOption({
+                        title: {
+                            text: '仓库分布',
+                            left: 'left'
+                        },
+                        tooltip: {
+                            trigger: 'item',
+                            formatter: '{a} <br/>{b} : {c} ({d}%)'
+                        },
+                        series: [
+                            {
+                                name: '仓库分布',
+                                type: 'pie',
+                                radius: '55%',
+                                center: ['50%', '60%'],
+                                data: this.warehouseCountingRecords,
+                                emphasis: {
+                                    itemStyle: {
+                                        shadowBlur: 10,
+                                        shadowOffsetX: 0,
+                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                                    }
+                                }
+                            }
+                        ]
+                    });
+                },
+                initLaborReportsUserGroupsCountChart() {
+                    this.laborReportsUserGroupsCountChart.setOption({
+                        title: {
+                            text: '小组临时工分布',
+                            left: 'left'
+                        },
+                        tooltip: {
+                            trigger: 'item',
+                            formatter: '{a} <br/>{b} : {c} ({d}%)'
+                        },
+                        series: [
+                            {
+                                name: '小组临时工分布',
+                                type: 'pie',
+                                radius: '55%',
+                                center: ['50%', '60%'],
+                                data: this.laborReportsUserGroupsCount,
+                                emphasis: {
+                                    itemStyle: {
+                                        shadowBlur: 10,
+                                        shadowOffsetX: 0,
+                                        shadowColor: 'rgba(0, 0, 0, 0.5)'
+                                    }
+                                }
+                            }
+                        ]
+                    });
+                },
+                initLaborReportsCountingRecords() {
+                    let _this = this;
+                    this.laborReportsCountingRecords.forEach(function (item) {
+                        _this.laborReportsCountingRecordsDateTarget.push(item.date_target);
+                        _this.laborReportsCountingRecordsData.push(item.counter);
+                    });
+                },
+
+                orderCountingRecordApi(orderCountingRecordsUnit) {
+                    if (orderCountingRecordsUnit === '') {
+                        orderCountingRecordsUnit = this.orderCountingRecordsUnit;
+                    }
+                    this.orderCountingRecordsUnit = orderCountingRecordsUnit;
+                    let formData = new FormData();
+                    formData.append('start', this.orderCountingRecordsDate[0]);
+                    formData.append('end', this.orderCountingRecordsDate[1]);
+                    formData.append('unit', orderCountingRecordsUnit);
+                    this.orderCountingRecordsShow = false;
+                    let _this = this;
+                    axios.post('{{url('apiLocal/control/panel/menu/orderCountingRecordApi')}}', formData).then(function (res) {
+                        if (res.status === 200) {
+                            _this.orderCountingRecords = res.data.orderCountingRecords;
+                            _this.orderCountingRecordsDateTarget = [];
+                            _this.orderCountingRecordsData = [];
+                            _this.initOrderCountingRecords();
+                            _this.initOrderCountingRecordsChart();
+                            _this.orderCountingRecordsShow = true;
+                        }
+                    });
+                },
+                logisticsCountingRecordsApi() {
+                    this.logisticsCountingRecordsShow = false;
+                    let formData = new FormData();
+                    formData.append('start', this.logisticsCountingRecordsData[0]);
+                    formData.append('end', this.logisticsCountingRecordsData[1]);
+                    let _this = this;
+                    axios.post('{{url('apiLocal/control/panel/menu/logisticsCountingRecordsApi')}}', formData).then(function (res) {
+                        if (res.status === 200) {
+                            _this.logisticsCountingRecords = res.data.logisticsCountingRecords;
+                            _this.initLogisticsCountingRecordsChart();
+                            _this.logisticsCountingRecordsShow =true;
+                        }
+                    });
+                },
+
+                warehouseCountingRecordsApi() {
+                    this.warehouseCountingRecordsShow = false;
+                    let formData = new FormData();
+                    formData.append('start', this.warehouseCountingRecordsData[0]);
+                    formData.append('end', this.warehouseCountingRecordsData[1]);
+                    let _this = this;
+                    axios.post('{{url('apiLocal/control/panel/menu/warehouseCountingRecordsApi')}}', formData).then(function (res) {
+                        if (res.status === 200) {
+                            _this.warehouseCountingRecords = res.data.warehouseCountingRecords;
+                            _this.initWarehouseCountingRecordsChart();
+                            _this.warehouseCountingRecordsShow = true;
+
+                        }
+                    });
+                },
+
+                laborReportsCountingRecordApi(laborReportsCountingRecordUnit) {
+                    this.laborReportsCountingRecordsShow = false;
+                    if (laborReportsCountingRecordUnit === '') {
+                        laborReportsCountingRecordUnit = this.laborReportsCountingRecordUnit;
+                    }
+                    this.laborReportsCountingRecordUnit = laborReportsCountingRecordUnit;
+                    let formData = new FormData();
+                    formData.append('start', this.laborReportsCountingRecordsDate[0]);
+                    formData.append('end', this.laborReportsCountingRecordsDate[1]);
+                    formData.append('unit', laborReportsCountingRecordUnit);
+                    let _this = this;
+                    axios.post('{{url('apiLocal/control/panel/menu/laborReportsCountingRecordApi')}}', formData).then(function (res) {
+                        if (res.status === 200) {
+                            _this.laborReportsCountingRecords = res.data.laborReportsCountingRecords;
+                            _this.laborReportsCountingRecordsDateTarget = [];
+                            _this.laborReportsCountingRecordsData = [];
+                            _this.initLaborReportsCountingRecords();
+                            _this.initLaborReportsCountingRecordsChart();
+                            _this.laborReportsCountingRecordsShow = true;
+                        }
+                    });
+                },
+                laborReportsUserGroupsCountApi() {
+                    this.laborReportsUserGroupsCountShow = false;
+                    let formData = new FormData();
+                    formData.append('start', this.laborReportsUserGroupsCountDate[0]);
+                    formData.append('end', this.laborReportsUserGroupsCountDate[1]);
+                    let _this = this;
+                    axios.post('{{url('apiLocal/control/panel/menu/laborReportsUserGroupsCountApi')}}', formData).then(function (res) {
+                        if (res.status === 200) {
+                            _this.laborReportsUserGroupsCount = res.data.laborReportsUserGroupsCount;
+                            _this.initLaborReportsUserGroupsCountChart();
+                            _this.laborReportsUserGroupsCountShow = true;
+                        }
+                    });
+                },
+            }
+        });
+    </script>
+@endsection
+

+ 1 - 1
resources/views/customer/project/area.blade.php

@@ -30,7 +30,7 @@
                     <td>@{{ i+1 }}</td>
                     <td>
                         <span v-if="area.status=='已完成'" class="text-success">@{{ area.status }}</span>
-                        <span v-else><button class="btn btn-sm btn-outline-info" @click="edit(area,i)">编辑</button></span>
+                        <span v-if="area.status!='已完成' && editIndex!=i"><button class="btn btn-sm btn-outline-info" @click="edit(area,i)">编辑</button></span>
                         <span v-if="editIndex==i">
                             <button class="btn btn-sm btn-success" @click="submitArea()">确定</button>
                             <button class="btn btn-sm btn-danger" @click="editIndex='-1'">取消</button>

+ 1 - 1
resources/views/customer/project/create.blade.php

@@ -57,7 +57,7 @@
                 </div>
                 <div class="row mt-3">
                     <label for="tax_rate" class="col-2">税率<span class="badge badge-secondary">%</span></label>
-                    <input type="number" v-model="owner.tax_rate" id="tax_rate" class="form-control form-control-sm col-3 mb-0" :class="errors.tax_rate ? 'is-invalid' : ''"  name="tax_rate">
+                    <input type="number" v-model="owner.tax_rate" step="0.01" id="tax_rate" class="form-control form-control-sm col-3 mb-0" :class="errors.tax_rate ? 'is-invalid' : ''"  name="tax_rate">
                     <span class="invalid-feedback offset-2 mt-0" role="alert" v-if="errors.tax_rate">
                         <strong>@{{ errors.tax_rate[0] }}</strong>
                     </span>

+ 155 - 148
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -21,7 +21,7 @@
                     <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode">切换为列表</button>
                 @endcan
                 @can('库存管理-盘点')
-                    <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="listMode&&inventory.status!=='已完成'">切换为盘点</button>
+                    <button class="btn btn-sm" @click="listMode?listMode=false:listMode=true" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="listMode&&inventory.status!=='已完成'&&inventory.status!=='已审核'">切换为盘点</button>
                 @endcan
             </span>
 
@@ -45,6 +45,10 @@
                     批量跳过
                 </button>
             </span>
+            <span>
+                <button class="btn btn-sm btn-info" @click="新增盘点记录()" :class="listMode?'btn-dark':'btn-outline-dark'" v-if="!listMode&&!addInventoryMission">新增盘点记录</button>
+                 <button class="btn btn-sm" @click="收起新增()" :class="addInventoryMission?'btn-dark':'btn-outline-dark'" v-if="addInventoryMission">收起新增</button>
+            </span>
 
 
             <span class="form-group  mb-5">
@@ -208,7 +212,7 @@
                    @change="locationChange($event)"
                    name="location" type="text" class="form-control  input"  autocomplete="off" value="@if(old('location')){{old('location')}}@endif">
         </span>
-                    <span class="form-group ml-4">
+                    <span class="form-group ml-4" v-if="addInventoryMission">
             <label for="barcode" class="text-secondary font-weight-bold">请输产品条码</label>
                 <input id="barcodeInput" name="barcode"  @keypress="barcodePress($event)"
                        @change="barcodeChange($event)"
@@ -216,18 +220,19 @@
 
         </span>
 
-                    <span class="form-group ml-4" v-if="dataExtraStatus.addingNew" id="countBlock">
+                    <span class="form-group ml-4" v-if="dataExtraStatus.addingNew&&addInventoryMission" id="countBlock">
                         <label for="count" class="text-secondary font-weight-bold">请输盘点数</label>
                         <input type="text" id="amountInput"  @keypress="amountPress($event)"
                                name="count" class="form-control input" value="@if(old('count')){{old('count')}}@endif"  autocomplete="off">
                     </span>
+                    <span type="button" class="btn btn-sm btn-outline-danger col-md-2 form-group ml-4" v-if="location" style="max-width: 160px" @click="stockInventoryByLocation()">盘点该库位下所有记录</span>
                 </div>
             </div>
             <!--相同库位和条码 pc端-->
 
             <div class="row d-none d-xl-block">
                 <div class="col-12 col-md-12 col-sm-12 showBlueTable d-none">
-                    <table class="table table-sm table-bordered table-info mt-2" {{--v-if="!listMode"--}} :class="!listMode?'':'d-none'" id="blueTablePc">
+                    <table class="table table-sm table-bordered table-info mt-2" :class="!listMode?'':'d-none'" id="blueTablePc">
                         <tr>
                             <td class="font-weight-bold">输入盘点数</td>
                             <td>操作</td>
@@ -260,7 +265,7 @@
                             <td><input type="text" class="form-control-sm batch_number" name="batch_number" onchange="batchNumberChange(event)"></td>
                             <td class="erp_type_position"></td>
                             <td class="quality"></td>
-                            <td class="verified_amount"></td>
+                            <td class="verified_amount font-weight-bold text-success"></td>
                             <td class="re_checked_amount"></td>
                             <td class="difference_amount"></td>
                         </tr>
@@ -293,7 +298,7 @@
                                     <span class="mr-3 text-nowrap"><span>属性仓:</span><span class="erp_type_position"></span></span>
                                     <span class="mr-3 text-nowrap"><span>质量状态:</span><span class="quality"></span></span>
                                     <div>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">盘点数量:</span><span style="color:#af7651" class="verified_amount"></span></span>
+                                        <span class="mr-3 text-nowrap"><span style="color:#783000">盘点数量:</span><span  class="verified_amount font-weight-bold text-success"></span></span>
                                         <span class="mr-3 text-nowrap"><span style="color:#783000">复盘数量:</span><span style="color:#af7651" class="re_checked_amount"></span></span>
                                         <span class="mr-3 text-nowrap"><span style="color:#783000">盘点差异:</span><span class="difference_amount"></span></span>
                                     </div>
@@ -314,7 +319,7 @@
             <table class="table table-sm table-striped d-none d-xl-block p-0 text-nowrap table-bordered"
                    id="headerParent" ref="boxPc">
                 <tr class="p-0" id="header"></tr>
-                <tr {{--v-for="(inventoryMission,i) in inventoryMissions"--}} v-for="(inventoryMission, i) in 显示记录列" :key="i"
+                <tr v-for="(inventoryMission, i) in 显示记录列" :key="i"
                     :style="{'opacity': inventoryMission.mark==='跳过'?'0.7':'','opacity': inventoryMission.mark==='确认差异'?'0.7':''}" :class="[
                     inventoryMission.mark==='已复盘有差异'?'td-cool':'',
                     inventoryMission.mark==='已复盘无差异'?'td-cool text-muted':'',
@@ -511,7 +516,7 @@
                                       @click="跳过盘点记录(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
                                      <span class="btn  btn-sm btn-outline-secondary" v-if="inventoryMission.mark==='已复盘有差异'||inventoryMission.mark==='未复盘有差异'"
                                            @click="确认盘点差异(inventoryMission.id,inventory.id,inventoryMission.commodity.name)">跳过</span>
-                                    <span class="btn  btn-sm btn-outline-secondary"
+                                        <span class="btn  btn-sm btn-outline-secondary"
                                           v-if="inventory.type=='动盘'&& inventoryMission.mark=='未盘' &&!listMode"
                                           @click="选中盘点起始位置(inventoryMission.id,inventoryMission.location)">以此为起点</span>
                             </span>
@@ -659,6 +664,7 @@
                     },
                     @endforeach
                 ],
+                库位盘点记录:[],
                 条码索引_记录: {},
                 库位索引_记录: {},
                 checkData: [],
@@ -669,6 +675,7 @@
                 inventoryAccountMissions:[],
                 listMode:false,
                 blindReceive:false,
+                addInventoryMission:false,
                 分割位置id:null,
                 显示记录列:[],
 
@@ -686,8 +693,6 @@
                     scanEndInputted:false,binDisable:false,barcodeDisable:true,amountDisable:false,
                 },
                 goodses:[],//{barcode,amount,bin,produce_date,valid_date,batch_number}
-                // 加载后盒子底部位置:'',
-                // 加载前盒子底部位置:'',
             },
             beforeMount: function () {
                 this.重排序并标记全列表类型();
@@ -789,70 +794,7 @@
                                 _this.加载下方数据并置空上方数据()
                             }
                     }
-                    //可视区域高度(浏览器页面的高度)
-                    //let height=window.innerHeight;
-                    //滚动区域高度
-                    //let scrollHeight = document.documentElement.scrollTop || document.body.scrollTop;
-                    //let _this=this;
-                    // 可视区域+滚动条距离顶部位置 = 浏览器窗口底部的位置
-                    //const count = height + scrollHeight;
-                    //懒加载盒子高度+懒加载盒子距离顶部位置=计算出盒子底部的距离
-                    //const box_bottom = _this.$refs.box.offsetHeight + _this.$refs.box.offsetTop-500;//移动
-                    //const box_bottomPc = _this.$refs.boxPc.offsetHeight + _this.$refs.boxPc.offsetTop;//pc
-                    //console.log("浏览器底部位置",count);
-                    //console.log("隐藏部分",box_bottomPc-count);
-                    // if (box_bottom===-500&&count >= box_bottomPc) {//pc端下划加载
-                    //     if (_this.显示记录列.length < _this.inventoryMissions.length) {
-                    //         _this.加载下方数据并置空上方数据();
-                    //     }
-                    // }
-                    // if (box_bottomPc===0&&count >= box_bottom) {//移动端下划加载
-                    //     if (_this.显示记录列.length < _this.inventoryMissions.length) {
-                    //         _this.加载下方数据并置空上方数据()
-                    //     }
-                    // }
-                    // 窗口高,滚动条位置,页面长度,追加数据长度
-                    // 滚动条位置+窗口高度=当前显示中的页面底部Y
-                    // 页面长度-当前显示中的页面底部Y=(隐藏的高度!!!!+行高)->求出隐藏了多少行
-                    // 隐藏的高度- (func(去掉10行)=去掉后的隐藏高度)=10行去掉了高
-                    // 10行去掉了高/10=每行实际多高
-                    // 隐藏的高度/每行实际多高=去掉多少行可以把下方都清理干净
-                },
-                加载上方数据(){
-                    //1.找到显示中第一条ID
-                    let _this=this;
-                    let 去除空对象的显示数据列=[];
-                    let 空对象数据列=[];
-                    _this.显示记录列.forEach(function (inventoryMission) {
-                        if (!($.isEmptyObject(inventoryMission))){
-                            去除空对象的显示数据列.push(inventoryMission);
-                        }
-                        if (($.isEmptyObject(inventoryMission))){
-                            空对象数据列.push(inventoryMission);
-                        }
-                    })
-                    let 初条显示数据=去除空对象的显示数据列[0];
-                    let 末条显示数据=去除空对象的显示数据列[去除空对象的显示数据列.length-1];
-                    let 空对象条数=空对象数据列.length;
-                    //_this.清理下方数据(去除空对象的显示数据列);
-                    console.log(去除空对象的显示数据列)
-                    console.log(空对象条数)
-                    //console.log(_this.显示记录列)
-                    //2.以1的ID从总列表网上倒退找到N条(N=10)
-                    //2.5, 计算有空行到第几行
-                    //3.将显示中的列表从头清理N行,的2.5的结果下标后插入2的结果
-                },
-                // 清理上方数据(){
-                //
-                // },
-                // 清理下方数据(去除空对象的显示数据列){
-                //     let _this=this;
-                //     let index;
-                //     _this.显示记录列.forEach(function (inventoryMission,i) {
-                //         if (inventoryMission.id===去除空对象的显示数据列[去除空对象的显示数据列.length-6].id) index=i;
-                //         if (i>index) _this.显示记录列.splice(i,1);
-                //     })
-                // },
+                },
                 加载下方数据并置空上方数据(){
                     let _this=this;
                     const count = _this.显示记录列.length;
@@ -860,8 +802,6 @@
                         _this.inventoryMissions.map((inventoryMission, index) => {
                             if (_this.显示记录列.length < 5 + count) {
                                 if (_this.显示记录列.length < _this.inventoryMissions.length) {
-                                    //_this.显示记录列.splice(_this.显示记录列.length-30,1);
-                                    //_this.显示记录列.unshift({});
                                     _this.显示记录列.push(_this.inventoryMissions[_this.显示记录列.length]);
                                 }
                             }
@@ -893,6 +833,7 @@
                         newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
                         newDom.show();
                         newDom.find('.blueAmount').attr('data_id', $appointInventoryList[i].id);
+                        newDom.find('.blueAmount').attr('stored_amount', $appointInventoryList[i].stored_amount);
                         newDom.find('.stockButton').attr('data_id', $appointInventoryList[i].id);
                         newDom.addClass('blueTr'+i);
                         newDom.appendTo($blueTable);
@@ -917,6 +858,7 @@
                         newDom.find('.difference_amount').text($appointInventoryList[i].difference_amount);
                         newDom.show();
                         newDom.find('.blueAmountPc').attr('data_id', $appointInventoryList[i].id);
+                        newDom.find('.blueAmountPc').attr('stored_amount', $appointInventoryList[i].stored_amount);
                         newDom.find('.stockButtonPc').attr('data_id', $appointInventoryList[i].id);
                         newDom.addClass('blueTrPc'+i);
                         newDom.appendTo($blueTablePc);
@@ -960,6 +902,9 @@
                 locationChange(e){
                     this.inputs().location = e.target.value;
                     this.提交部分输入();
+                    if(!this.addInventoryMission){
+                        this.location=this.inputs().location ;
+                    }
                 },
                 提交部分输入:_.throttle(function(){
                     let _this = this;
@@ -968,7 +913,11 @@
                     (new Promise(function (resolve, reject) {
                         resolve()
                     })).then(function () {
-                        _this.提交库位和条码();
+                        if(_this.addInventoryMission){
+                            _this.提交库位和条码();
+                        }else{
+                            _this.提交库位();
+                        }
                         _this.显示盘点计数input_按情况();
                     })
 
@@ -983,14 +932,7 @@
                     let id = $(e.target).attr('data_id');
                     _this.selectingId=id;
                     if(e.key==='Enter'){
-                        this.放置焦点光标至正确位置();
-
-                        let re=true;
-                        _this.提交新增并盘点().then(function(result){
-                            if(!result){
-                                _this.提交盘点();
-                            }
-                        })
+                        _this.提交盘点();
                     }
                 },
                 提交库位和条码:_.throttle(async function(){
@@ -1003,6 +945,11 @@
                     }
                     this.筛选出记录(_this.inputs().location,_this.inputs().barcode);
                 },100,{ 'trailing': false }),
+                提交库位:_.throttle(async function(){
+                    let _this=this;
+                    this.清空指定盘点记录列();
+                    this.筛选库位出记录(_this.inputs().location);
+                },100,{ 'trailing': false }),
                 建立记录索引(){
                     let _this=this;
                     _this.inventoryMissions.forEach(function (inventoryMission) {
@@ -1019,11 +966,14 @@
                     $jqueryTable.forEach(function (newDom,i) {
                         newDom.remove();
                     })
-                    $appointInventoryList.forEach(function (inventoryMission,i) {
-                        $appointInventoryList.splice(i,1);
-                    });
+                    // $appointInventoryList.forEach(function (inventoryMission,i) {
+                    //     $appointInventoryList.splice(i,1);
+                    // });
+                    $appointInventoryList=[];
                     $showBlueTable.attr('class','d-none');
                     _this.selectingId='';
+                    _this.location='';
+                    _this.库位盘点记录=[];
                 },
                 显示盘点计数input_按情况(){
                     let _this=this;
@@ -1057,6 +1007,23 @@
                         _this.cloneBlueTrPcDom($appointInventoryList);
                     }
                 },
+                async 筛选库位出记录(库位){
+                    库位=库位.trim();
+                    let _this=this;
+                    if(!库位)return false;
+                    if (!_this.库位索引_记录[库位]) return;
+                    if(Array.isArray(_this.库位索引_记录[库位])){
+                        _this.库位索引_记录[库位].forEach(function(inventoryMission){
+                            if (inventoryMission.location===库位){
+                                $appointInventoryList.push(inventoryMission);
+                                $appointInventoryList=_this.unique($appointInventoryList);
+                            }
+                        });
+                        $showBlueTable.removeClass('d-none');
+                        _this.cloneBlueTrDom($appointInventoryList);
+                        _this.cloneBlueTrPcDom($appointInventoryList);
+                    }
+                },
                 unique(arr){
                     return Array.from(new Set(arr));
                 },
@@ -1067,9 +1034,11 @@
                         $locationInput.focus();
                         return;
                     }
-                    if (!$barcodeInput.val().trim()){
-                        $barcodeInput.focus();
-                        return;
+                    if (_this.addInventoryMission){
+                        if (!$barcodeInput.val().trim()){
+                            $barcodeInput.focus();
+                            return;
+                        }
                     }
                     setTimeout(function(){
                         if(_this.dataExtraStatus.addingNew){
@@ -1149,8 +1118,7 @@
                     let 盘点数=_this.inputs().amount.trim();
                     let 选定盘点记录id=_this.selectingId;
                     $appointInventoryList.forEach(function (inventoryMission) {
-                        inventoryMission.commodity_barcodes.forEach(function (barcode) {
-                            if (inventoryMission.location === 库位 && 条码 === barcode.code) {
+                            if (inventoryMission.location === 库位) {
                                 if (inventoryMission.stockInventoryPersons.length > 0 && inventoryMission.id === _this.selectingId) {
                                     _this.lastStockInventoryRecord = inventoryMission;
                                     _this.stockInventoryPersons = inventoryMission.stockInventoryPersons;
@@ -1162,7 +1130,6 @@
                                 _this.盘点(选定盘点记录id,库位,条码,_this.inventory.id,盘点数);
                                 _this.清空指定盘点记录列();
                             }
-                        })
                     });
                 },100,{ 'trailing': false }),
                 //结束初盘任务
@@ -1522,7 +1489,6 @@
                                 });
                                 if(!Array.isArray(_this.库位索引_记录[location])) _this.库位索引_记录[location]=[];
                                 _this.库位索引_记录[location].push(inventoryAccountMission);
-                                // _this.重排序并标记全列表类型(_this.inventoryMissions);
                                 _this.重排序并显示();
                                 _this.清空inputs();
                                 tempTip.setDuration(3000);
@@ -1596,7 +1562,6 @@
                                 }
                                 return true;
                             });
-                            //_this.重排序并标记全列表类型(_this.inventoryMissions);
                             _this.重排序并显示();
                             if (response.data.inventoryMission.difference_amount!==0)_this.初盘有盘点差异_确认是否重盘();
                             if (response.data.inventoryMission.difference_amount===0){
@@ -1657,7 +1622,6 @@
                     let produced_at=_this.inputs().produced_at.trim();
                     let valid_at=_this.inputs().valid_at.trim();
                     let batch_number=_this.inputs().batch_number.trim();
-                    _this.清空指定盘点记录列();
                     let url = '{{url('inventory/盘点选中任务')}}';
                     axios.post(url, {id:id,count:count,inventoryId:inventoryId,produced_at:produced_at,valid_at:valid_at,batch_number:batch_number}).then(function (response) {
                         if (!response.data.success) {
@@ -1670,22 +1634,22 @@
                                 _this.inventory.surplus = response.data.inventory.surplus;
                                 _this.inventory.check_surplus = response.data.inventory.check_surplus;
                             }
-                            if (response.data.inventoryMission.length >1) {
-                                response.data.inventoryMission.forEach(function (mission) {
-                                    let isToEdit=false;
-                                    let commodity_barcodes=_this.条码索引_记录[_this.inputs().barcode][0].commodity_barcodes;
-                                    _this.条码索引_记录[_this.inputs().barcode].every(function (inventoryMission){
-                                        if (parseInt(inventoryMission.id) === parseInt(mission.id)){
-                                            isToEdit=true;
-                                            inventoryMission.checked = mission.checked;
-                                            inventoryMission.verified_amount = mission.verified_amount;
-                                            inventoryMission.difference_amount =mission.difference_amount;
-                                            inventoryMission.re_checked_amount = mission.re_checked_amount;
-                                            inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
-                                            return false;
-                                        }
-                                        return true;
-                                    })
+                                    if (response.data.inventoryMission.length >1) {
+                                        response.data.inventoryMission.forEach(function (mission) {
+                                            let isToEdit=false;
+                                            let commodity_barcodes=mission.commodity_barcodes;
+                                            _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission){
+                                                if (parseInt(inventoryMission.id) === parseInt(mission.id)){
+                                                    isToEdit=true;
+                                                    inventoryMission.checked = mission.checked;
+                                                    inventoryMission.verified_amount = mission.verified_amount;
+                                                    inventoryMission.difference_amount =mission.difference_amount;
+                                                    inventoryMission.re_checked_amount = mission.re_checked_amount;
+                                                    inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
+                                                    return false;
+                                                }
+                                                return true;
+                                            })
                                     if (!isToEdit){
                                         mission.commodity_barcodes= commodity_barcodes;
                                         mission.stockInventoryPersons=response.data.stockInventoryPersons;
@@ -1693,7 +1657,7 @@
                                     }
                                 });
                             }else {
-                                _this.条码索引_记录[_this.inputs().barcode].every(function (inventoryMission,i) {
+                                _this.库位索引_记录[_this.inputs().location.trim()].every(function (inventoryMission,i) {
                                     if (parseInt(inventoryMission.id) === parseInt(response.data.inventoryMission.id)){
                                         inventoryMission.checked = response.data.inventoryMission.checked;
                                         inventoryMission.verified_amount = response.data.inventoryMission.verified_amount;
@@ -1707,7 +1671,7 @@
                                     return true;
                                 })
                             }
-                            _this.重排序并标记全列表类型(_this.inventoryMissions);
+                            _this.重排序并显示();
                             _this.清空inputs();
                             _this.清空指定盘点记录列();
                             tempTip.setDuration(3000);
@@ -1749,7 +1713,82 @@
                         excelExport(checkAllSign,data,url,this.sum,token);
                     }
                 },
-                //盲收
+                stockInventoryByLocation(){
+                    let _this=this;
+                    let inventoryId=_this.inventory.id;
+                    let difference=[];
+                    let trPc = $("#blueTablePc tr:gt(1)").get();
+                    let tr = $("#blueTable tr:gt(0)").get();
+                    $(trPc).each(function(item,key){
+                         input = $(key).find('.blueAmountPc');
+                         let obj=new Object();
+                         obj.id=input.attr('data_id');
+                         obj.stored_amount=input.attr('stored_amount');
+                         obj.amount=input.val();
+                         if (input.val()) _this.库位盘点记录.push(obj);
+                    });
+                    $(tr).each(function(item,key){
+                        input = $(key).find('.blueAmount');
+                        let obj=new Object();
+                        obj.id=input.attr('data_id');
+                        obj.stored_amount=input.attr('stored_amount');
+                        obj.amount=input.val();
+                        if (input.val()) _this.库位盘点记录.push(obj);
+                    });
+                    let url = '{{url('inventory/stockInventory/batchStockByLocation')}}';
+                    axios.post(url,{mission:_this.库位盘点记录,inventoryId:inventoryId}).then(function(response){
+                        if (!response.data.success) {
+                            tempTip.setDuration(2000);
+                            tempTip.show('盘点失败!' + '   ' + response.data.msg);
+                            return;
+                        }else {
+                            if (_this.inventory.id === response.data.inventory.id) {
+                                _this.inventory.processed = response.data.inventory.processed;
+                                _this.inventory.surplus = response.data.inventory.surplus;
+                                _this.inventory.check_surplus = response.data.inventory.check_surplus;
+                            }
+                                response.data.inventoryMission.forEach(function (mission) {
+                                    if(mission.difference_amount>0) difference.push(mission.commodity.barcodes[0].code);
+                                    _this.inventoryMissions.every(function (inventoryMission,i){
+                                        if (parseInt(inventoryMission.id) === parseInt(mission.id)){
+                                            inventoryMission.checked = mission.checked;
+                                            inventoryMission.verified_amount = mission.verified_amount;
+                                            inventoryMission.difference_amount =mission.difference_amount;
+                                            inventoryMission.re_checked_amount = mission.re_checked_amount;
+                                            inventoryMission.stockInventoryPersons = response.data.stockInventoryPersons;
+                                            _this.inventoryMissions.splice(i, 1);
+                                            _this.inventoryMissions.unshift(inventoryMission);
+                                            return false;
+                                        }
+                                        return true;
+                                    })
+                                });
+                            _this.重排序并显示();
+                            _this.清空inputs();
+                            _this.清空指定盘点记录列();
+                            tempTip.setDuration(5000);
+                            if (difference.length>0){
+                                tempTip.show('给库位下:条码为'+difference+'存在差异,如需重盘请针对该条码重新盘点!');
+                                difference=[];
+                            }else {
+                                tempTip.showSuccess('盘点成功!');
+                            }
+                        }
+                    }).catch(function (err) {
+                        tempTip.setDuration(2000);
+                        tempTip.show('盘点失败!' + '网络错误' + err);
+                    })
+                },
+                新增盘点记录(){
+                    let _this=this;
+                    _this.addInventoryMission=true;
+                    _this.清空指定盘点记录列();
+                },
+                收起新增(){
+                    let _this=this;
+                    _this.addInventoryMission=false;
+                    _this.清空指定盘点记录列();
+                },
                 盲收(){
                     let _this=this;
                     _this.blindReceive=true;
@@ -1826,8 +1865,6 @@
                                 case 'increasing': data.commitGoodsOnIncreasingMode();break;
                                 case 'multiIncreasing': data.commitGoodsOnMultiIncreasingMode();break;
                             }
-                            //$('#amount').focus();
-                            //$(document).off('keypress');
                         }
                     });
                 },
@@ -1855,21 +1892,6 @@
                             window.tempTip.showSuccess('保存成功');
                             data.focusDocument();
                             data.audioDing();
-                            // window.tempTip.inputVal('该商品第一件递增请输入隔口号:',function(bin){
-                            //     if(bin===''){
-                            //         window.tempTip.setDuration(1500);
-                            //         window.tempTip.show('未输入隔口号,请重新扫描');
-                            //         data.alertVibrate();
-                            //         data.focusDocument();return}
-                            //     data.inputting.bin=bin;
-                            //     data.inputting.amount=1;
-                            //     data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
-                            //     data.status.binDisable=true;
-                            //     window.tempTip.setDuration(500);
-                            //     window.tempTip.showSuccess('保存成功');
-                            //     data.focusDocument();
-                            //     data.audioDing();
-                            // })
                         }else{
                             increase();
                         }
@@ -1908,21 +1930,6 @@
                         window.tempTip.showSuccess('保存成功');
                         data.focusDocument();
                         data.audioDing();
-                        // window.tempTip.inputVal('该商品第一件递增请输入隔口号:',function(bin){
-                        //     if(bin===''){
-                        //         window.tempTip.setDuration(1500);
-                        //         window.tempTip.show('未输入隔口号,请重新扫描');
-                        //         data.alertVibrate();
-                        //         data.focusDocument();return}
-                        //     data.inputting.bin=bin;
-                        //     data.inputting.amount=1;
-                        //     data.goodses.unshift(JSON.parse(JSON.stringify(data.inputting)));
-                        //     data.status.binDisable=true;
-                        //     window.tempTip.setDuration(500);
-                        //     window.tempTip.showSuccess('保存成功');
-                        //     data.focusDocument();
-                        //     data.audioDing();
-                        // })
                     }else{
                         increase();
                     }

+ 1 - 1
resources/views/layouts/app.blade.php

@@ -16,7 +16,7 @@
 <div id="app">
     <nav class="navbar navbar-expand-md navbar-light bg-white shadow-sm">
         <div class="container-fluid">
-            <a class="navbar-brand" href="{{ url('/') }}" title="宝时 Warehouse Assistance System" style="vertical-align: text-bottom">
+            <a class="navbar-brand" href="{{ url('/control/panel/menu') }}" title="宝时 Warehouse Assistance System" style="vertical-align: text-bottom">
                 <img src="{{asset('icon/logo100b.png')}}" alt="宝时 Warehouse Assistance System" height="30" >
             </a>
             <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="{{ __('Toggle navigation') }}">

+ 3 - 3
resources/views/layouts/menu.blade.php

@@ -23,7 +23,7 @@
                     <span class="fa fa-truck" style="color: #4c2584"></span>
                     运输管理</a></li> @endcan
         @can('称重管理')
-            <li class="nav-item"><a href="{{url("package/")}}" class="nav-link"
+            <li class="nav-item"><a href="{{url("package")}}" class="nav-link"
                                     :class="{active:isActive('package',1)}">
                     <span class="fa fa-balance-scale" style="color: #1b7234"></span>
                     称重管理</a></li> @endcan
@@ -33,7 +33,7 @@
                     <span class="fa fa-list-alt" style="color: #32721b"></span>
                     库存管理</a></li> @endcan
         @can('二次加工管理')
-            <li class="nav-item"><a href="{{url("process/")}}" class="nav-link"
+            <li class="nav-item"><a href="{{url("process")}}" class="nav-link"
                                     :class="{active:isActive('process',1)}">
                     <span class="fa fa-hand-scissors-o" style="color: #726e1b"></span>
                     二次加工管理</a></li> @endcan
@@ -48,7 +48,7 @@
                     <span class="fa fa-header" style="color: #72441b"></span>
                     人事管理</a></li> @endcan
         @can('基础设置')
-            <li class="nav-item"><a href="{{url("maintenance/")}}" class="nav-link"
+            <li class="nav-item"><a href="{{url("maintenance")}}" class="nav-link"
                                     :class="{active:isActive('maintenance',1)}">
                     <span class="fa fa-server"></span>
                     基础设置</a></li> @endcan

+ 2 - 2
resources/views/maintenance/priceModel/operation/_addFeature.blade.php

@@ -27,12 +27,12 @@
                         </label>
                         <label class="col-2">
                             <select class="form-control form-control-sm" v-model="feature.type">
-                                <option v-for="t in type" :value="t">@{{ t }}</option>
+                                <option v-for="t in type" :value="t" v-if="(thisIndex == '-1' && t != '商品名称') || (thisIndex != '-1' && t=='商品名称')">@{{ t }}</option>
                             </select>
                         </label>
                         <label class="col-1">
                             <select class="form-control form-control-sm" v-model="feature.logic">
-                                <option v-for="l in logic" :value="l">@{{ l }}</option>
+                                <option v-for="l in logic" :value="l" v-if="thisIndex == '-1' || l != '不包含'">@{{ l }}</option>
                             </select>
                         </label>
                         <label class="col-4">

+ 2 - 1
resources/views/maintenance/priceModel/operation/create.blade.php

@@ -80,7 +80,8 @@
                         <div class="row">
                             <div class="col-4 form-inline">
                                 <label for="amount"><span v-if="model.operation_type=='出库'">起步数:</span><span v-else>计量:</span></label>
-                                <input id="amount" type="number" :class="errors['rules.'+i+'.amount'] ? 'is-invalid' : ''" v-model="rule.amount" class="form-control" required>
+                                <input id="amount" :readonly="(model.operation_type=='出库' && rule.strategy=='起步') || model.operation_type!='出库' ? false : true"
+                                       type="number" :class="errors['rules.'+i+'.amount'] ? 'is-invalid' : ''" v-model="rule.amount" class="form-control" required>
                                 <span class="invalid-feedback mt-0 offset-2" role="alert" v-if="errors['rules.'+i+'.amount']">
                                     <strong>必须为整数</strong>
                                 </span>

+ 8 - 8
resources/views/order/index/delivering.blade.php

@@ -106,8 +106,8 @@
                                     <td><div style="width: 180px;overflow: hidden">@{{ oracleDOCOrderDetail.sku }}</div></td>
                                     <td><div style="width: 180px;overflow: hidden">@{{ oracleDOCOrderDetail.alternate_sku1 }}</div></td>
                                     <td>
-                                        <div class="text-truncate text-primary tooltipTarget" style="width: 100px;cursor:pointer;text-decoration: underline" title="双击展开" @dblclick="nowrapText($event)">@{{ oracleDOCOrderDetail.descr_c  }}</div>
-                                        <div class="text-nowrap tooltipTarget"  style="display: none;cursor:pointer" @dblclick="truncateText($event)" title="双击收起">@{{ oracleDOCOrderDetail.descr_c  }}</div>
+                                        <div class="text-truncate text-primary tooltipTarget" style="width: 100px;cursor:pointer;text-decoration: underline" title="双击展开全部" @dblclick="nowrapText($event)">@{{ oracleDOCOrderDetail.descr_c  }}</div>
+                                        <div class="text-nowrap tooltipTarget"  style="display: none;cursor:pointer" @dblclick="truncateText($event)" title="双击收起全部">@{{ oracleDOCOrderDetail.descr_c  }}</div>
 {{--                                        <div :title="oracleDOCOrderDetail.descr_c" class="tooltipTarget" style="width: 180px;overflow: hidden">@{{ oracleDOCOrderDetail.descr_c }}</div>--}}
                                     </td>
                                     <td>@{{ oracleDOCOrderDetail.qtyordered }}</td>
@@ -808,14 +808,14 @@
                     })
                 },
                 truncateText(e){
-                    let nowrapSpan = $(e.target);
-                    nowrapSpan.hide();
-                    nowrapSpan.siblings('.text-truncate').show();
+                    $table = $(e.target).parents('.table').first();
+                    $table.find('.text-nowrap').hide();
+                    $table.find('.text-truncate').show();
                 },
                 nowrapText(e) {
-                    let truncateSpan = $(e.target);
-                    truncateSpan.hide();
-                    truncateSpan.siblings('.text-nowrap').show();
+                    $table = $(e.target).parents('.table').first();
+                    $table.find('.text-truncate').hide();
+                    $table.find('.text-nowrap').show();
                 },
                 getTagOrder(orderNos){
                     this.tagOrders = []

+ 7 - 7
resources/views/personnel/checking-in/importAndExportSuccess.blade.php

@@ -38,35 +38,35 @@
         },
         mounted(){
             initEcho();
+            let _this=this;
             Echo.channel('{{$laravelEchoPrefix}}userDutyCheck').listen('GuardAuditEvent',(e)=>{
-                let _this=this;
                 let userDutyCheck=e.userDutyCheck;
                 _this.userDutyCheck.verify_user_id=userDutyCheck.verify_user_id;
             });
         },
     });
-    var secondsInit = 0;
+    let secondsInit = 0;
     function _fresh()
     {
         secondsInit ++;
-        var seconds = secondsInit;
-        var result = '';
+        let seconds = secondsInit;
+        let result = '';
         if (seconds >= 3600)
         {
-            var h = Math.floor(seconds / 3600);
+            let h = Math.floor(seconds / 3600);
             result += h + "小时";
             seconds -= 3600 * h;
         }
         if (seconds >= 60)
         {
-            var m = Math.floor(seconds / 60);
+            let m = Math.floor(seconds / 60);
             result += m + "分";
             seconds -= 60 * m;
         }
         result += seconds + "秒";
         document.getElementById('_lefttime').innerHTML = result;
     }
-    _fresh()
+    _fresh();
     setInterval(_fresh,1000);
 </script>
 </body>

+ 6 - 6
resources/views/personnel/checking-in/success.blade.php

@@ -34,28 +34,28 @@
             });
         },
     });
-    var secondsInit = 0;
+    let secondsInit = 0;
     function _fresh()
     {
         secondsInit ++;
-        var seconds = secondsInit;
-        var result = '';
+        let seconds = secondsInit;
+        let result = '';
         if (seconds >= 3600)
         {
-            var h = Math.floor(seconds / 3600);
+            let h = Math.floor(seconds / 3600);
             result += h + "小时";
             seconds -= 3600 * h;
         }
         if (seconds >= 60)
         {
-            var m = Math.floor(seconds / 60);
+            let m = Math.floor(seconds / 60);
             result += m + "分";
             seconds -= 60 * m;
         }
         result += seconds + "秒";
         document.getElementById('_lefttime').innerHTML = result;
     }
-    _fresh()
+    _fresh();
     setInterval(_fresh,1000);
 </script>
 </body>

+ 33 - 10
resources/views/personnel/laborReport/index.blade.php

@@ -45,11 +45,11 @@
                     &nbsp;&nbsp;&nbsp;&nbsp;
                     @can('人事管理-组长审核')
                         <span>
-                                <button v-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export&&laborReport.has_group_verify_right" @click="groupExport(laborReport.id,laborReport.name)" class="btn btn-sm btn-outline-danger">退组</button>
-                              <span  v-else-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export&&!laborReport.has_group_verify_right"><b class="text-success">在组</b></span>
+                                <button v-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export{{--&&laborReport.has_group_verify_right--}}" @click="groupExport(laborReport.id,laborReport.name)" class="btn btn-sm btn-outline-danger">退组</button>
+                              <span  v-else-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export{{--&&!laborReport.has_group_verify_right--}}"><b class="text-success">在组</b></span>
                         <span v-else-if="laborReport.groupUserId&&laborReport.is_exportGroup&&!laborReport.is_export" class="text-info">已退组</span>
                             <span v-else-if="laborReport.is_export" class="text-black">已退场</span>
-                        <button v-else-if="laborReport.user_workgroup_id&&laborReport.has_group_verify_right" @click="groupClockAudit(laborReport.id,laborReport.userWorkgroupNeedRemark)" class="btn btn-sm btn-outline-primary">组长审核</button>
+                        <button v-else-if="laborReport.user_workgroup_id{{--&&laborReport.has_group_verify_right--}}" @click="groupClockAudit(laborReport.id,laborReport.userWorkgroupNeedRemark)" class="btn btn-sm btn-outline-primary">组长审核</button>
                         </span>
                     @else
                         <span  v-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export"><b class="text-success">在组</b></span>
@@ -123,11 +123,11 @@
                                     &nbsp;&nbsp;&nbsp;&nbsp;
                                 @can('人事管理-组长审核')
                                                     <span>
-                                <button v-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export&&laborReport.has_group_verify_right" @click="groupExport(laborReport.id,laborReport.name)" style="transform:scale(1.1)" class="btn btn-lg btn-danger">退组</button>
-                                     <span  v-else-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export&&!laborReport.has_group_verify_right"><b class="text-success">在组</b></span>
+                                <button v-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export{{--&&laborReport.has_group_verify_right--}}" @click="groupExport(laborReport.id,laborReport.name)" style="transform:scale(1.1)" class="btn btn-lg btn-danger">退组</button>
+                                     <span  v-else-if="laborReport.groupUserId&&!laborReport.is_exportGroup&&!laborReport.is_export{{--&&!laborReport.has_group_verify_right--}}"><b class="text-success">在组</b></span>
                                      <b v-else-if="laborReport.groupUserId&&laborReport.is_exportGroup&&!laborReport.is_export" class="text-info">已退组</b>
                                     <b v-else-if="laborReport.is_export" class="text-black">已退场</b>
-                                <button v-else-if="laborReport.user_workgroup_id&&laborReport.has_group_verify_right" @click="groupClockAudit(laborReport.id,laborReport.userWorkgroupNeedRemark)" class="btn btn-lg btn-outline-primary"  style="transform:scale(1.1)" >组长审核</button>
+                                <button v-else-if="laborReport.user_workgroup_id{{--&&laborReport.has_group_verify_right--}}" @click="groupClockAudit(laborReport.id,laborReport.userWorkgroupNeedRemark)" class="btn btn-lg btn-outline-primary"  style="transform:scale(1.1)" >组长审核</button>
 
                                                     </span>
                                                 @else
@@ -380,9 +380,32 @@
                     //进组
                     _this.permittingWorkgroups.forEach(function(workgroup){
                         Echo.channel('{{$laravelEchoPrefix}}'+workgroup.token).listen('ClockinEvent',(e)=>{
-                            setTimeout(function () {
-                                window.location.reload();
-                            },500);
+                            let labor=e.laborReport;
+                            let res=false;
+                            laborReports.forEach(function (item){
+                                if(item.id==labor.id){
+                                    res=true;
+                                }
+                            })
+                            if (res){
+                                laborReports.every(function (laborReport) {
+                                    if (laborReport.id==labor.id){
+                                        laborReport.userWorkGroupName=labor.user_workgroup.name;
+                                        laborReport.user_workgroup_id=labor.user_workgroup_id;
+                                        laborReport.checkInAt=labor.check_in_at;
+                                        laborReport.round_check_in_at=labor.round_check_in_at;
+                                        return false
+                                    }
+                                    return true;
+                                });
+                            }else {
+                                labor.userWorkGroupName=labor.user_workgroup.name;
+                                labor.checkInAt=labor.check_in_at;
+                                laborReports.push(labor);
+                            }
+                            // setTimeout(function () {
+                            //     window.location.reload();
+                            // },500);
                         });
                     });
                     //退组
@@ -467,7 +490,7 @@
                             vue:vue
                         });
                         header.init();
-                        let $dom_thisRecordWorkingTime=$('#dom_thisRecordWorkingTime');
+                        let $dom_thisRecordWorkingTime=$('#dom_thisRoundRecordWorkingTime');
                         $dom_thisRecordWorkingTime.attr('title','用工总工时:'+_this.totalWorkingHours);
                         $dom_thisRecordWorkingTime.tooltip({'trigger':'manual'});
                         $dom_thisRecordWorkingTime.tooltip('show')

+ 0 - 38
resources/views/store/inStorage/index.blade.php

@@ -18,44 +18,6 @@
                 <td>
                     <input class="checkItem" type="checkbox" :value="store.id" v-model="checkData">
                 </td>
-{{--                <td v-if="store.store_items" class="text-muted"--}}
-{{--                    :rowspan="store.is_multi_row?2:''">--}}
-{{--                    <span>--}}
-{{--                                        <a href="#" v-if="store.store_items.length>0"--}}
-{{--                                           class="dropdown-toggle btn btn-sm btn-outline-info"--}}
-{{--                                           data-toggle="dropdown">--}}
-{{--                                            查看明细--}}
-{{--                                        </a>--}}
-{{--                                        <div--}}
-{{--                                            style="position: absolute;width:1050px;margin-left:-50px;background-color: white;max-height:175px ;overflow-y:auto"--}}
-{{--                                            class="small mt-0 dropdown-menu">--}}
-{{--                                            <table class="table table-sm table-striped table-bordered">--}}
-{{--                                                <tr class="text-center">--}}
-{{--                                                    <th>ASN单号</th>--}}
-{{--                                                    <th>行号</th>--}}
-{{--                                                    <th>商品名称</th>--}}
-{{--                                                    <th>商品编码</th>--}}
-{{--                                                    <th>商品条码</th>--}}
-{{--                                                     <th>数量</th>--}}
-{{--                                                     <th>质量</th>--}}
-{{--                                                     <th>状态</th>--}}
-{{--                                                     <th>创建时间</th>--}}
-{{--                                                </tr>--}}
-{{--                                                <tr v-for="storeItem in store.store_items" class="text-center">--}}
-{{--                                                    <td>@{{store.asn_code}}</td>--}}
-{{--                                                    <td>@{{ storeItem.asn_line_code }}</td>--}}
-{{--                                                    <td>@{{ storeItem.name }}</td>--}}
-{{--                                                    <td>@{{ storeItem.sku }}</td>--}}
-{{--                                                    <td>@{{ storeItem.barcode }}</td>--}}
-{{--                                                    <td>@{{ storeItem.amount }}</td>--}}
-{{--                                                    <td>@{{ storeItem.quality }}</td>--}}
-{{--                                                    <td>@{{ storeItem.status }}</td>--}}
-{{--                                                    <td>@{{ storeItem.created_at }}</td>--}}
-{{--                                                </tr>--}}
-{{--                                            </table>--}}
-{{--                                        </div>--}}
-{{--                                        </span>--}}
-{{--                </td>--}}
                                 <td>
                                     <button class="btn btn-sm btn-outline-info" v-if="!store.isOpenStoreItem" @click="openStoreItems(store,i,$event);store.isOpenStoreItem=true">查看明细</button>
                                     <button v-if="store.isOpenStoreItem"  @click="closeStoreItems();store.isOpenStoreItem=false" class="btn btn-sm btn-dark">收起明细</button>

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

@@ -10,3 +10,6 @@ use Illuminate\Support\Facades\Route;
 Route::group(['prefix'=>'storage'],function(){
     Route::post('relocate', "StorageController@relocate");//移库
 });
+Route::group(['prefix'=>'pickStation'],function(){
+    Route::post('processed', "PickStationController@processed");//移库
+});

+ 8 - 2
routes/apiLocal.php

@@ -90,5 +90,11 @@ Route::group(['prefix'=>'maintenance'],function (){
     });
 });
 
-
-
+/** 控制台 */
+Route::group(['prefix'=>'control'],function () {
+    Route::post('panel/menu/orderCountingRecordApi','ControlPanelController@orderCountingRecordsApi') ;
+    Route::post('panel/menu/logisticsCountingRecordsApi','ControlPanelController@logisticsCountingRecordsApi');
+    Route::post('panel/menu/warehouseCountingRecordsApi','ControlPanelController@warehouseCountingRecordsApi');
+    Route::post('panel/menu/laborReportsCountingRecordApi','ControlPanelController@laborReportsCountingRecordApi');
+    Route::post('panel/menu/laborReportsUserGroupsCountApi','ControlPanelController@laborReportsUserGroupsCountApi');
+});

+ 5 - 1
routes/web.php

@@ -465,6 +465,7 @@ Route::group(['prefix'=>'inventory'],function(){
         Route::post('searchCommodityByBarcode','InventoryAccountController@searchCommodityByBarcode');
         Route::get('blindReceive/{id}','InventoryAccountController@enterBlindReceive');
         Route::post('baseOnBlindReceive','InventoryAccountController@baseOnBlindReceive');
+        Route::post('batchStockByLocation','InventoryAccountController@batchStockByLocation');
     });
     /** 库存比对 */
     Route::group(['prefix'=>'inventoryCompare'],function(){
@@ -588,4 +589,7 @@ Route::group(['prefix'=>'customer'],function(){
     });
     Route::get('relating',function (){return view('customer.relating');});
 });
-
+/** 控制台 */
+Route::group(['prefix'=>'control'],function () {
+   Route::get('panel/menu','ControlPanelController@index') ;
+});

+ 1 - 1
tests/Inventory/Services/InventoryAccountService/InventoryAccountService_CreateInventoryMissionRecordTest.php

@@ -18,7 +18,7 @@ class InventoryServiceCreateInventoryMissionRecordTest extends TestCase
     public $wmsInventoryAccounts;
     function setUp(): void
     {
-        parent::setUp(); // TODO: Change the autogenerated stub
+        parent::setUp();
         $this->inventory=factory(InventoryAccount::class)->create();
         $this->realService=new InventoryAccountService();
         $this->wmsInventoryAccounts=$this->realService->conditionPortStock('2020-08-20','2020-08-20',3);

+ 32 - 0
tests/Services/CheckActiveMenuService/CheckActiveMenuSyncTest.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace Tests\Services\CheckActiveMenuService;
+
+use App\Services\CacheService;
+use App\Services\CheckActiveMenuService;
+use App\UserVisitMenuLog;
+use Illuminate\Support\Facades\Redis;
+use Tests\TestCase;
+
+class CheckActiveMenuSyncTest extends TestCase
+{
+    /** @var CheckActiveMenuService $checkActiveMenuService */
+    public $checkActiveMenuService;
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->checkActiveMenuService = app('CheckActiveMenuService');
+    }
+
+    public function testHandle()
+    {
+        $l1Len = Redis::LLEN('UserVisitMenuLogsL1');
+        $l2Len = Redis::LLEN('UserVisitMenuLogsL2');
+        $DBLen = UserVisitMenuLog::query()->count();
+        $this->checkActiveMenuService->sync();
+        $this->assertTrue(Redis::LLEN('UserVisitMenuLogsL1') === 0);
+        $this->assertTrue(Redis::LLEN('UserVisitMenuLogsL2') === $l2Len + $l1Len);
+        $this->assertTrue(UserVisitMenuLog::query()->count() === $DBLen + $l1Len);
+    }
+}

+ 19 - 1
tests/Services/CustomerTest.php → tests/Services/CustomerService/CustomerTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Tests\Unit\Customer;
+namespace Tests\Unit\Customer\CustomerService;
 
 use App\Customer;
 use App\Services\CustomerService;
@@ -22,6 +22,9 @@ class CustomerTest extends TestCase
         ];
     }
 
+    /**
+     * @group customer
+     */
     public function testCreate(){
         $model = $this->service->create([
             "code" => date('Ymd').Str::random(4),
@@ -31,20 +34,32 @@ class CustomerTest extends TestCase
         $this->assertNotNull($model);
         $this->data["models"][] = $model->toArray();
     }
+    /**
+     * @group customer
+     */
     public function testGetSelection(){
         $models = $this->service->getSelection(["id","name","company_name"]);
         $this->assertGreaterThanOrEqual(1,count($models));
         $this->assertArrayHasKey("company_name",$models[0]);
     }
+    /**
+     * @group customer
+     */
     public function testPaginate(){
         $models = $this->service->paginate(5);
         $this->assertGreaterThanOrEqual(1,count($models));
         $this->assertLessThanOrEqual(5,count($models));
     }
+    /**
+     * @group customer
+     */
     public function testFind(){
         $model = $this->service->find($this->data["models"][0]["id"]);
         $this->assertNotNull($model);
     }
+    /**
+     * @group customer
+     */
     public function testUpdate()
     {
         $value = date('YmdH').Str::random(4);
@@ -54,6 +69,9 @@ class CustomerTest extends TestCase
         $this->data["models"][0]["name"] = $value;
         $this->assertEquals($row,1);
     }
+    /**
+     * @group customer
+     */
     public function testDestroy()
     {
         $row = $this->service->destroy($this->data["models"][0]["id"]);

+ 24 - 1
tests/Services/FeatureServiceTest.php → tests/Services/FeatureService/FeatureServiceTest.php

@@ -1,6 +1,6 @@
 <?php
 
-namespace Tests\Unit\Customer;
+namespace Tests\Unit\Customer\FeatureService;
 
 use App\Feature;
 use App\Services\FeatureService;
@@ -23,10 +23,16 @@ class FeatureServiceTest extends TestCase
         ];
     }
 
+    /**
+     * @group customer
+     */
     public function testGetMapArray(){
         $models = $this->service->getMapArray();
         $this->assertGreaterThanOrEqual(3,count($models));
     }
+    /**
+     * @group customer
+     */
     public function testTranslationFeature(){
         $str = $this->data["models"][0]["id"]."&(".$this->data["models"][1]["id"]."|".$this->data["models"][2]["id"].")";
         $result = $this->service->translationFeature($str);
@@ -38,6 +44,9 @@ class FeatureServiceTest extends TestCase
         $this->assertEquals(true,$result[2]["strategyGroupEndSign"]);
         $this->assertEquals("或",$result[2]["calculation"]);
     }
+    /**
+     * @group customer
+     */
     public function testAnalysisFeature(){
         $models = $this->data["models"];
         $params = [
@@ -71,6 +80,9 @@ class FeatureServiceTest extends TestCase
         $this->assertArrayHasKey("feature",$result);
         $this->assertEquals($expected,$result["feature"]);
     }
+    /**
+     * @group customer
+     */
     public function testFormatFeature(){
         $model1 = factory(Feature::class)->make([
             "id" => 1,
@@ -99,6 +111,9 @@ class FeatureServiceTest extends TestCase
         $expected = "commodity_name like '%衣服%' and (order_type not like '%创建%' or logistic_name = '顺丰')";
         $this->assertEquals($expected,$result);
     }
+    /**
+     * @group customer
+     */
     public function testMatchFeature(){
         $model1 = factory(Feature::class)->create([
             "type" => "商品名称",
@@ -118,11 +133,19 @@ class FeatureServiceTest extends TestCase
         $this->data["models"][] = $model1->toArray();
         $this->data["models"][] = $model2->toArray();
         $this->data["models"][] = $model3->toArray();
+
         $columnMapping = ["商品名称"=>"commodity","订单类型"=>"order","店铺类型"=>"shop"];
         $matchObject = ["commodity"=>Str::random(2).$model1->describe,"order"=>$model1->describe,"shop"=>$model3->describe];
         $value = $model1->id."&(".$model2->id."&".$model3->id.")";
         $result = $this->service->matchFeature($value,$columnMapping,$matchObject);
         $this->assertEquals(true,$result);
+
+        $columnMapping = ["商品名称"=>"commodity","订单类型"=>"order","店铺类型"=>"shop","packages"=>"ps"];
+        $matchObject = ["ps"=>[["a"=>1,"commodity"=>Str::random(2).$model1->describe]],"order"=>$model1->describe,"shop"=>$model3->describe];
+        $value = $model1->id."&(".$model2->id."&".$model3->id.")";
+        $result = $this->service->matchFeature($value,$columnMapping,$matchObject,true);
+        $this->assertEquals(true,$result);
+
         $matchObject = ["commodity"=>$model1->describe.Str::random(2),"order"=>$model2->describe.Str::random(2),"shop"=>"1"];
         $result = $this->service->matchFeature($value,$columnMapping,$matchObject);
         $this->assertEquals(false,$result);

+ 41 - 0
tests/Services/LaborReportsCountingRecordService/ByCacheTest.php

@@ -0,0 +1,41 @@
+<?php
+
+namespace LaborReportsCountingRecordService;
+
+use App\Services\LaborReportsCountingRecordService;
+use Illuminate\Support\Facades\Cache;
+use Tests\TestCase;
+
+class ByCacheTest extends TestCase
+{
+    /** @var LaborReportsCountingRecordService $laborReportsCountingRecordService */
+    public $laborReportsCountingRecordService;
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->laborReportsCountingRecordService = new LaborReportsCountingRecordService();
+    }
+
+    public function testSet()
+    {
+        $start = '2025-10-01';
+        $end = '2025-10-05';
+        $dateList = [
+            '2025-10-01',
+            '2025-10-02',
+            '2025-10-03',
+            '2025-10-04',
+            '2025-10-05',
+        ];
+        $unit = '日';
+        foreach ($dateList as $date) {
+            $key = 'laborReportsCountingRecords_' . $date . '_' . $unit;
+            Cache::put($key, '111111111111');
+        }
+        $result = $this->laborReportsCountingRecordService->getByCache($start,$end, $unit);
+
+        self::assertTrue($result['dataList']->isnotEmpty());
+        self::assertTrue($result['dateList'] == []);
+    }
+}

+ 53 - 0
tests/Services/LaborReportsCountingRecordService/GetTest.php

@@ -0,0 +1,53 @@
+<?php
+
+namespace LaborReportsCountingRecordService;
+
+use App\Services\CacheService;
+use App\Services\LaborReportsCountingRecordService;
+use App\Services\OrderCountingRecordService;
+use Illuminate\Support\Facades\Cache;
+use Tests\TestCase;
+
+class GetTest extends TestCase
+{
+    /** @var LaborReportsCountingRecordService $laborReportsCountingRecordService */
+    public $laborReportsCountingRecordService;
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->laborReportsCountingRecordService = new LaborReportsCountingRecordService();
+    }
+
+    public function testGet()
+    {
+        $this->assertTrue(true);
+    }
+
+//    public function testGet日()
+//    {
+//        $start = '2020-11-08';
+//        $end = '2020-12-19';
+//        $unit = '日';
+//        $result =  $this->laborReportsCountingRecordService->get($start, $end, $unit);
+//        self::assertTrue($result->isNotEmpty());
+//    }
+//
+//    public function testGet周()
+//    {
+//        $start = '2020-11-08';
+//        $end = '2020-12-19';
+//        $unit = '周';
+//        $result =  $this->laborReportsCountingRecordService->get($start, $end, $unit);
+//        self::assertTrue($result->isNotEmpty());
+//    }
+//
+//    public function testGet月()
+//    {
+//        $start = '2020-08-01';
+//        $end = '2020-11-1';
+//        $unit = '月';
+//        $result =  $this->laborReportsCountingRecordService->get($start, $end, $unit);
+//        self::assertTrue($result->isNotEmpty());
+//    }
+}

+ 27 - 0
tests/Services/LaborReportsCountingRecordService/UserGroupsCountTest.php

@@ -0,0 +1,27 @@
+<?php
+
+namespace LaborReportsCountingRecordService;
+
+use App\Services\CacheService;
+use App\Services\LaborReportsCountingRecordService;
+use App\Services\OrderCountingRecordService;
+use Illuminate\Support\Facades\Cache;
+use Tests\TestCase;
+
+class UserGroupsCountTest extends TestCase
+{
+    /** @var LaborReportsCountingRecordService $laborReportsCountingRecordService */
+    public $laborReportsCountingRecordService;
+
+    public function setUp(): void
+    {
+        parent::setUp();
+        $this->laborReportsCountingRecordService = new LaborReportsCountingRecordService();
+    }
+
+    public function testUserGroupsCount()
+    {
+        $result =  $this->laborReportsCountingRecordService->userGroupsCount('2020-10-17','2020-11-16');
+        self::assertTrue(true);
+    }
+}

+ 1 - 1
tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php

@@ -21,7 +21,7 @@ class GetWMSOrderOnStartDateTest extends TestCase
 
     public function testGetWMSOrderOnStartDate()
     {
-        $carbon =Carbon::now()->subSeconds(10);
+        $carbon =Carbon::now()->subMinutes(5);
         $orderHeaders = $this->service->getWMSOrderOnStartDate($carbon);
         $this->assertNotNull($orderHeaders);
         $orderHeader = $orderHeaders->first();

+ 2 - 1
tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php

@@ -15,13 +15,14 @@ class GetWmsOrderOnStartDateEditTest extends TestCase
 
     public function setUp(): void
     {
-        $this->service = app(OracleDOCOrderHeaderService::class);
         parent::setUp();
+        $this->service = app(OracleDOCOrderHeaderService::class);
     }
 
     public function testGetWmsOrderOnStartDateEdit()
     {
         $carbon =Carbon::now()->subHours(10);
+        $carbon =Carbon::now()->subMinutes(5);
         $orderHeaders = $this->service->getWmsOrderOnStartDateEdit($carbon);
         $this->assertNotNull($orderHeaders);
         $orderHeader = $orderHeaders->first();

+ 23 - 0
tests/Services/OrderCountingRecordService/DateTestTest.php

@@ -0,0 +1,23 @@
+<?php
+
+namespace OrderCountingRecordService;
+
+
+use Carbon\Carbon;
+use DateInterval;
+use DatePeriod;
+use DateTime;
+use Tests\TestCase;
+
+class DateTestTest extends TestCase
+{
+    /**
+     * @test
+     */
+    public function carbon_date_equals()
+    {
+        $this->assertTrue('2020-11-25' == Carbon::now()->format('Y-m-d'));
+        $this->assertTrue('2020-48' == Carbon::now()->year . '-' . Carbon::now()->week);
+        $this->assertTrue('2020-11' == Carbon::now()->year . '-' . Carbon::now()->month);
+    }
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов