Browse Source

Merge branch 'master' into zzd

dream 5 years ago
parent
commit
ea127cc7a7
100 changed files with 1754 additions and 1150 deletions
  1. 47 13
      .gitlab-ci.yml
  2. 0 2
      app/Commodity.php
  3. 57 11
      app/Console/Commands/SyncWMSOrderTask.php
  4. 1 0
      app/CustomField.php
  5. 10 0
      app/Http/Controllers/ControlPanelController.php
  6. 361 250
      app/Http/Controllers/InventoryAccountController.php
  7. 0 54
      app/Http/Controllers/PackageController.php
  8. 41 6
      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. 4 10
      app/Imports/InventoryCompareImport.php
  13. 2 2
      app/Imports/StoreCheckingReceiveImport.php
  14. 2 1
      app/LaborReport.php
  15. 1 1
      app/Order.php
  16. 0 15
      app/OrderPackage.php
  17. 10 9
      app/Services/CacheService.php
  18. 4 3
      app/Services/CommodityService.php
  19. 47 0
      app/Services/InventoryAccountService.php
  20. 26 48
      app/Services/InventoryCompareService.php
  21. 1 0
      app/Services/LogisticService.php
  22. 6 2
      app/Services/OracleBasCustomerService.php
  23. 3 0
      app/Services/OracleDOCOrderHeaderService.php
  24. 21 0
      app/Services/OrderCountingRecordService.php
  25. 3 1
      app/Services/OrderIssueService.php
  26. 8 4
      app/Services/OrderPackageCommoditiesService.php
  27. 5 2
      app/Services/OrderPackageService.php
  28. 133 16
      app/Services/OrderService.php
  29. 2 2
      app/Services/OwnerService.php
  30. 7 11
      app/Services/ShopService.php
  31. 1 1
      app/Services/UserService.php
  32. 2 3
      app/Services/WarehouseService.php
  33. 1 1
      app/UserDutyCheck.php
  34. 14 0
      config/sync.php
  35. 15 0
      database/factories/CityFactory.php
  36. 27 0
      database/factories/OrderFactory.php
  37. 41 0
      database/factories/OrderIssueFactory.php
  38. 12 0
      database/factories/OrderPackageFactory.php
  39. 15 0
      database/factories/OwnerTrakingOwnerFactory.php
  40. 12 0
      database/factories/ProvinceFactory.php
  41. 2 2
      database/migrations/2020_03_09_153510_create_stores_table.php
  42. 12 11
      database/migrations/2020_03_30_112202_drop_commodity_barcode_column_to_barcode_table.php
  43. 1 1
      database/migrations/2020_05_25_152252_change_user_workgroup.php
  44. 1 1
      database/migrations/2020_06_02_130804_change_user_duty_check.php
  45. 1 1
      database/migrations/2020_07_06_160500_create_operator_logs_table_and_add_authority_and_change_processes_column_status.php
  46. 1 1
      database/migrations/2020_07_20_162421_create_labor_report_statuses_table.php
  47. 1 1
      database/migrations/2020_08_26_093946_change_inventory_missions_to_inventory_account_missions.php
  48. 1 1
      database/migrations/2020_08_26_094015_change_inventories_to_inventory_accounts.php
  49. 1 1
      database/migrations/2020_08_31_102647_add_inventory_accounts_status.php
  50. 0 33
      database/migrations/2020_09_01_111054_change_inventory_account_mission_column_checked_to_three.php
  51. 1 1
      database/migrations/2020_09_10_143926_drop_shop_unique_name_index.php
  52. 1 1
      database/migrations/2020_09_11_115414_change_labor_reports_labor_company_to_labor_company_id.php
  53. 0 33
      database/migrations/2020_09_16_115715_change_inventory_account_mission_checked_column_checked_to_four.php
  54. 17 15
      database/migrations/2020_09_20_142656_change_order_issue.php
  55. 2 2
      database/migrations/2020_09_23_135848_add_authorities_and_change_inventory_accounts.php
  56. 2 2
      database/migrations/2020_09_24_152015_change_labor_report_status.php
  57. 2 2
      database/migrations/2020_10_12_092325_change_inventory_account_mission_checked_column_checked_to_five.php
  58. 1 1
      database/migrations/2020_10_12_105209_add_order_track_order_code.php
  59. 7 5
      database/migrations/2020_10_14_112825_add_order_issue_second_client_no.php
  60. 4 1
      database/migrations/2020_10_19_113042_create_logistic_timings_table.php
  61. 2 2
      database/migrations/2020_11_03_114135_change_store_status_column.php
  62. 2 2
      database/migrations/2020_11_03_114310_change_store_stored_method_column.php
  63. 2 2
      database/migrations/2020_11_03_180029_change_store_items_status_column.php
  64. 2 2
      database/migrations/2020_11_13_155436_change_inventory_accounts_status_column.php
  65. 2 2
      database/migrations/2020_11_18_092138_change_inventory_accounts_status_default.php
  66. 1 1
      package-lock.json
  67. 3 1
      phpunit.xml
  68. BIN
      public/images/QRCodeIMG/10.png
  69. BIN
      public/images/QRCodeIMG/4.png
  70. BIN
      public/images/QRCodeIMG/5.png
  71. 15 1
      public/js/app.js
  72. 1 2
      public/t.php
  73. 4 0
      resources/sass/text.scss
  74. 194 145
      resources/views/control/panel.blade.php
  75. 155 148
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  76. 11 11
      resources/views/order/index/delivering.blade.php
  77. 8 8
      resources/views/order/issue/index.blade.php
  78. 7 7
      resources/views/personnel/checking-in/importAndExportSuccess.blade.php
  79. 6 6
      resources/views/personnel/checking-in/success.blade.php
  80. 25 1
      resources/views/personnel/laborReport/index.blade.php
  81. 0 38
      resources/views/store/inStorage/index.blade.php
  82. 3 0
      routes/api/thirdPart/haiq.php
  83. 1 0
      routes/web.php
  84. 7 1
      tests/Services/CityService/FindByNameTest.php
  85. 23 3
      tests/Services/LogisticTimingService/FindByParamsTest.php
  86. 43 0
      tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnEditDateTest.php
  87. 21 10
      tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php
  88. 25 9
      tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php
  89. 10 1
      tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnstartDateCreateTest.php
  90. 7 2
      tests/Services/OrderCountingRecordService/DateTestTest.php
  91. 7 14
      tests/Services/OrderIssueService/GetRecycleBinPaginateTest.php
  92. 19 5
      tests/Services/OrderIssueService/OrderIssueTagTest.php
  93. 3 8
      tests/Services/OrderIssueService/RecoverOrderIssueTest.php
  94. 21 18
      tests/Services/OrderPackageCommoditiesService/RegroupOrderCommoditiesTest.php
  95. 0 33
      tests/Services/OrderPackageCommoditiesService/SyncOrderPackageCommoditiesTest.php
  96. 0 28
      tests/Services/OrderPackageService/DeleteUnnecessaryPackageTest.php
  97. 22 4
      tests/Services/OrderPackageService/GetInnerParamsTest.php
  98. 23 12
      tests/Services/OrderPackageService/SyncOrderPackageTest.php
  99. 27 7
      tests/Services/OrderPackageService/SyncPackageByOrderHeadersTest.php
  100. 8 11
      tests/Services/OrderService/CreateOrFindOrderInfoTest.php

+ 47 - 13
.gitlab-ci.yml

@@ -2,31 +2,65 @@ stages:
   - build
   - test
   - deploy
+
 cache:
   paths:
     - vendor/
-    - node_modules/
-    - .env
+
 before_script:
-  # Install composer dependencies
-#  - wget https://composer.github.io/installer.sig -O - -q | tr -d '\n' > installer.sig
-#  - php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
-#  - php -r "if (hash_file('SHA384', 'composer-setup.php') === file_get_contents('installer.sig')) { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
-#  - php composer-setup.php
-#  - php -r "unlink('composer-setup.php'); unlink('installer.sig');"
-#  - php composer.phar install
-  - echo "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_maven:
+build:
   stage: build
   tags:
     - was
   script:
     - echo "build ....."
 
-test_springboot:
+test:
   stage: test
   tags:
     - was
@@ -34,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){

+ 57 - 11
app/Console/Commands/SyncWMSOrderTask.php

@@ -37,23 +37,69 @@ class SyncWMSOrderTask extends Command
      * Execute the console command.
      */
     public function handle()
+    {
+        $this->syncCreatedOrder();
+        $this->syncUpdatedOrder();
+    }
+
+    public function syncCreatedOrder()
     {
         /**
          * @var OracleDOCOrderHeaderService $oracleDOCOrderHeaderService
          * @var OrderService $orderService
          */
-        $oracleDOCOrderHeaderService = app('OracleDOCOrderHeaderService');
+        $newest         = config('sync.order_sync.cache_prefix.created_at');
+        $newest_list    = config('sync.order_sync.cache_prefix.newest_list');
+        $hasKey         = config('sync.order_sync.cache_prefix.newest_has');
+        $prefixKey      = config('sync.order_sync.cache_prefix.newest');
 
         $orderService = app('OrderService');
-        $start_date = Carbon::now()->subSeconds(60+5);
-
-        // 这段时间段内的新增
-        $orderHeaders_addTime = $oracleDOCOrderHeaderService->getWMSOrderOnStartDate($start_date);
-        // 这段时间段内的修改
-        $orderHeaders_editTime = $oracleDOCOrderHeaderService->getWMSOrderOnEditDate($start_date);
-        // 创建
-        $orderService->syncOrder($orderHeaders_addTime);
-        // 创建
-        $orderService->syncOrder($orderHeaders_editTime);
+        $oracleDOCOrderHeaderService = app('OracleDocOrderHeaderService');
+
+        $last_date = $orderService->getOrderSyncAt($newest,'newest');                              // 获取时间点
+        $orderHeaders = $oracleDOCOrderHeaderService->getWMSOrderOnStartDate($last_date);           // WMS订单
+        if(!$orderHeaders)return;
+        $last_order = $orderHeaders->first();                                                           // 时间点靠后的
+        $renewal_orders = $orderHeaders->where('addtime',$last_order->addtime);
+
+        $orderHeaders = $orderService->filterOrderByCache($orderHeaders,$newest_list);                  // 对比缓存
+
+        if(count($orderHeaders)>0 && count($orderHeaders) >0){
+            $orderService->syncOrder($orderHeaders);                                                //  同步订单
+            $orderService->cancelOrderCache($newest_list,$prefixKey);                                   //  清除缓存
+            $orderService->pushOrderCache($renewal_orders,$prefixKey,$hasKey,$newest_list);             //  添加缓存
+            $orderService->setOrderSyncAt($newest,$last_order->addtime,count($orderHeaders)>0);   //  更新时间
+        }
+    }
+
+    public function syncUpdatedOrder()
+    {
+        /**
+         * @var OracleDOCOrderHeaderService $oracleDOCOrderHeaderService
+         * @var OrderService $orderService
+         */
+        $renewal        = config('sync.order_sync.cache_prefix.updated_at');
+        $renewal_list   = config('sync.order_sync.cache_prefix.renewal_list');
+        $hasKey         = config('sync.order_sync.cache_prefix.renewal_has');
+        $prefixKey      = config('sync.order_sync.cache_prefix.renewal');
+
+        $orderService = app('OrderService');
+        $oracleDOCOrderHeaderService = app('OracleDocOrderHeaderService');
+
+        $last_date = $orderService->getOrderSyncAt($renewal,'renewal');                               // 获取时间点
+        $orderHeaders = $oracleDOCOrderHeaderService->getWMSOrderOnEditDate($last_date);                   // WMS订单
+
+        if(!$orderHeaders)return;
+        $renewal_order = $orderHeaders->first();                                                            // 时间点靠后的
+        $renewal_orders =  $orderHeaders->where('edittime',$renewal_order->edittime);
+
+        $orderHeaders = $orderService->filterOrderByCache($orderHeaders,$renewal_list);                     // 对比缓存
+
+        if(count($renewal_orders)>0 && count($orderHeaders)>0){
+            $orderService->syncOrder($orderHeaders);                                                    // 同步订单
+            $orderService->cancelOrderCache($renewal_list,$prefixKey);                                      // 清除缓存
+            $orderService->pushOrderCache($renewal_orders,$prefixKey,$hasKey,$renewal_list);                // 添加缓存
+            $orderService->setOrderSyncAt($renewal,$renewal_order->edittime,count($orderHeaders)>0);   // 更新时间
+        }
     }
 }

+ 1 - 0
app/CustomField.php

@@ -10,6 +10,7 @@ class CustomField extends Model
         'field',
         'present_name',
         'authority_name',
+        'authority_id',
         'condition_field',
         'condition_value'];
 }

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

@@ -12,6 +12,16 @@ use Illuminate\Http\Request;
 
 class ControlPanelController extends Controller
 {
+
+
+    /**
+     * ControlPanelController constructor.
+     */
+    public function __construct()
+    {
+        $this->middleware('auth');
+    }
+
     public function index()
     {
         /**

+ 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];
+    }
 }

+ 0 - 54
app/Http/Controllers/PackageController.php

@@ -44,7 +44,6 @@ class PackageController extends Controller
      */
     public function store(Request $request)
     {
-        $start_at = microtime(true);
         if(!Gate::allows('称重管理-录入')){ return redirect(url('/'));  }
         $this->validator($request)->validate();
         $logistic_number=$request->input('logistic_number');
@@ -57,10 +56,6 @@ class PackageController extends Controller
         $package=null;
         $successTip = '操作成功';
 
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 1:$time1");
-        $start_at = microtime(true);
-
         /** @var OrderPackage $package */
         if ($order_code){
             $package=OrderPackage::query()->with(['order'=>function($query)use($order_code){
@@ -77,37 +72,19 @@ class PackageController extends Controller
         $accomplishToWMS=new Api\thirdPart\flux\PackageController();
 
 
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 2:$time1");
-        $start_at = microtime(true);
-
         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);
 
 
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 3:$time1");
-            $start_at = microtime(true);
 
             OrderPackage::createPackagesFromBatchCode($batch_number,$weight);
 
 
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 4:$time1");
-            $start_at = microtime(true);
-
             if($package&&$package->isActivityBatch())
                 $package->unifyThisMeasureUnderSameBatch();
 
-
-
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 5.1:$time1");
-            $start_at = microtime(true);
-
-
             if ($result['result']){
                 Controller::logS(__METHOD__,'SUCCESS_'.__FUNCTION__,'批量更改波次上传成功'.$batch_number);
                 $successTip = "批量录入波次成功!波次号:$batch_number";
@@ -115,22 +92,10 @@ class PackageController extends Controller
             }
             Controller::logS(__METHOD__,'error_'.__FUNCTION__,'批量更改波次上传异常:'.$result['message'].$batch_number);
 
-
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 5.2:$time1");
-            $start_at = microtime(true);
-
             return redirect('package/create')->with('successError','录入失败!'.$result['message']);
         }
         if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
         if ($package){
-
-
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 7:$time1");
-            $start_at = microtime(true);
-
-
             if(!$package->batch_number)$package->batch_number=$batch_number;
             //if(!$package->order_code)$package->order_code=$order_code;
             $package->fetchAllFromOracle();
@@ -146,19 +111,8 @@ class PackageController extends Controller
             app('LogService')->log(__METHOD__,'create_'.__FUNCTION__,json_encode($package),Auth::user()['name']);
 //            event(new WeighedEvent($package));
 
-
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 7.1:$time1");
-            $start_at = microtime(true);
-
-
         }else{
 
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 7.3:$time1");
-            $start_at = microtime(true);
-
-
             /** @var OrderPackageService */
             $package = app('OrderPackageService')->firstOrCreate($logistic_number,[
                 'weight'=>$weight,
@@ -180,17 +134,9 @@ class PackageController extends Controller
             $package->save();
             $successTip = $str;
 
-            $time1 = floor((microtime(true)-$start_at));
-            app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 7.4:$time1");
-            $start_at = microtime(true);
-
 
         }
 
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batch_number} 8:$time1");
-        $start_at = microtime(true);
-
 
         return redirect('package/create')->with('successTip', $successTip);
     }

+ 41 - 6
app/Http/Controllers/TestController.php

@@ -6,6 +6,7 @@ namespace App\Http\Controllers;
 use App\Authority;
 use App\Commodity;
 use App\CommodityBarcode;
+use App\Console\Commands\SyncWMSOrderTask;
 use App\Events\CancelOrder;
 use App\Imports\OrderTrackingImport;
 use App\InventoryAccount;
@@ -961,10 +962,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){
@@ -975,14 +980,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(){
@@ -1126,4 +1132,33 @@ 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);
+    }
+
+    public function OrderSync(){
+        $tack = new SyncWMSOrderTask();
+        $tack->handle();
+        dump(11);
+    }
 }

+ 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()];
+    }
+}

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

+ 2 - 2
app/Imports/StoreCheckingReceiveImport.php

@@ -254,8 +254,8 @@ class StoreCheckingReceiveImport implements ToCollection,WithHeadingRow
         app('LogService')->log(__METHOD__,"导入盘收任务-录入盘收任务",json_encode($storeCheckingReceive,JSON_UNESCAPED_UNICODE));
         $storeCheckingReceive->owner_name = $owner_name;
 
-        foreach ($items as &$item){
-            $item["store_checking_receive_id"] = $storeCheckingReceive->id;
+        foreach ($items as &$it){
+            $it["store_checking_receive_id"] = $storeCheckingReceive->id;
         }
 
         app('StoreCheckingReceiveItemService')->insert($items);

+ 2 - 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 = [
@@ -63,6 +63,7 @@ class LaborReport extends Model
         if ($round_check_out_at>=25&&$round_check_out_at<=55) return Carbon::parse($this['check_out_at'])->clone()->setMinutes(30)->setSeconds(00)->format('Y-m-d H:i:s');
         if ($round_check_out_at>55&&$round_check_out_at<=59) return Carbon::parse($this['check_out_at'])->clone()->addHour()->setMinutes(00)->setSeconds(00)->format('Y-m-d H:i:s');
     }
+    //has_group_verify_right'
     public function getHasGroupVerifyRightAttribute(){
         if (!Gate::allows('人事管理-临时工报表')){return null; }
         if (Gate::allows('人事管理-临时工报表-管理全部组')){return true;}

+ 1 - 1
app/Order.php

@@ -14,7 +14,7 @@ class Order extends Model
         'id', 'batch_id',  'owner_id', 'status',
         'created_at', 'code', 'shop_id',  'client_code',
         'logistic_id', 'consignee_name', 'consignee_phone', 'province',
-        'city', 'district', 'address', 'wms_status','status','warehouse_id','wms_edittime'];
+        'city', 'district', 'address', 'wms_status','warehouse_id','wms_edittime'];
 
     /*
      * wms订单号             code=>DOC_ORDER_HEADER[orderno]

+ 0 - 15
app/OrderPackage.php

@@ -96,7 +96,6 @@ class OrderPackage extends Model
         $this['batch_number'] = $this->oracleInfo['waveno']??null;
     }
     static public function createPackagesFromBatchCode($batchCode,$weight){
-        $start_at = microtime(true);
 
 
 
@@ -109,11 +108,6 @@ class OrderPackage extends Model
         $packages = [];
         $now = Carbon::now();
 
-
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batchCode} 3.1:$time1");
-        $start_at = microtime(true);
-
         foreach($resultOracleObjs_grouped as $resultOracleObj_grouped){
             $resultOracleObj = $resultOracleObj_grouped[0];
             /** @var OrderService $orderService*/
@@ -135,11 +129,6 @@ class OrderPackage extends Model
         }
 
 
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batchCode} 3.2:$time1");
-        $start_at = microtime(true);
-
-
         $packagesLogisticNumbers = array_map(function ($orderPackage) {
             return $orderPackage['logistic_number'];
         } ,$packages);
@@ -162,10 +151,6 @@ class OrderPackage extends Model
         });
 
 
-        $time1 = floor((microtime(true)-$start_at));
-        app('LogService')->log(__METHOD__,'timemark_'.__FUNCTION__,"{$batchCode} 3.3:$time1");
-        $start_at = microtime(true);
-
         app('LogService')->log(__METHOD__,"批量录入包裹成功",json_encode($packages),Auth::user()['id']);
     }
     public function unifyThisMeasureUnderSameBatch(){

+ 10 - 9
app/Services/CacheService.php

@@ -9,14 +9,15 @@ use Illuminate\Support\Facades\Cache;
 class CacheService
 {
     function getOrExecute(String $key, $func, $expiration=null){
-        $results = Cache::get($key);
-        if(!$results){
-            if(!$func||gettype($func)!='object') throw new \Exception('执行函数类型错误');
-            $results = $func();
-            if(!$results)return null;
-            if(!$expiration) $expiration=config('cache.expirations.default');
-            Cache::put($key, $results, $expiration);
-        }
-        return $results;
+        return Cache::remember($key, $expiration, $func);
+//        $results = Cache::get($key);
+//        if(!$results){
+//            if(!$func||gettype($func)!='object') throw new \Exception('执行函数类型错误');
+//            $results = $func();
+//            if(!$results)return null;
+//            if(!$expiration) $expiration=config('cache.expirations.default');
+//            Cache::put($key, $results, $expiration);
+//        }
+//        return $results;
     }
 }

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

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

+ 26 - 48
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,41 +84,41 @@ 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');
+            $params = [
+                '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'),
+                'amount_in_compare'=>$amount,
+            ];
             if ($wmsInventoryCompareZp||$wmsInventoryCompareDj) {
-                $wasInventoryCompareZP = [
-                    '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' => ($wmsInventoryCompareZp['在库数量'] ?? 0)+($wmsInventoryCompareDj['在库数量'] ?? 0),
-                    'amount_in_compare' => $amount,
-                    'differ' => $amount-(($wmsInventoryCompareZp['在库数量'] ?? 0) + ($wmsInventoryCompareDj['在库数量'] ?? 0)),
-                ];
-                array_push($wasInventoryCompares,$wasInventoryCompareZP);
+                $params['quality'] = '正品';
+                $params['amount_in_sys'] = ($wmsInventoryCompareZp['在库数量'] ?? 0)+($wmsInventoryCompareDj['在库数量'] ?? 0);
+                $params['differ'] = $amount-(($wmsInventoryCompareZp['在库数量'] ?? 0) + ($wmsInventoryCompareDj['在库数量'] ?? 0));
+                array_push($wasInventoryCompares,$params);
             }
             if ($wmsInventoryCompareCc){
-                $wasInventoryCompareCC=[
-                    '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'=>$wmsInventoryCompareCc['在库数量'],
-                    'amount_in_compare' =>$amount,
-                    'differ' =>$amount-($wmsInventoryCompareCc['在库数量']??0),
-                ];
-                array_push($wasInventoryCompares,$wasInventoryCompareCC);
+                $params['quality'] = '次品';
+                $params['amount_in_sys'] = $wmsInventoryCompareCc['在库数量'];
+                $params['differ'] = $amount-($wmsInventoryCompareCc['在库数量']??0);
+                array_push($wasInventoryCompares,$params);
+            }
+            if ($wmsInventoryCompareYjz){
+                $params['quality'] = '有价值';
+                $params['amount_in_sys'] = $wmsInventoryCompareYjz['在库数量'];
+                $params['differ'] = $amount-($wmsInventoryCompareYjz['在库数量']??0);
+                array_push($wasInventoryCompares,$params);
             }
-            if($unknownQualityStatus->isNotEmpty())return null;
+            if($unknownQualityStatus->isNotEmpty())continue;
         }
         $inventoryCompares=DB::table('inventory_compares')->insert($wasInventoryCompares);
         if (!$inventoryCompares)return null;

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

+ 3 - 0
app/Services/OracleDOCOrderHeaderService.php

@@ -78,6 +78,7 @@ Class OracleDOCOrderHeaderService
                 $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
             }])
             ->where('DOC_Order_Header.addTime','>=',$startDate)
+            ->orderByDesc('DOC_Order_Header.addTime')
             ->get();
     }
 
@@ -93,6 +94,8 @@ Class OracleDOCOrderHeaderService
                 $query->selectRaw('BAS_Codes.CodeID,BAS_Codes.CodeName_C,BAS_Codes.Code');
             }])
             ->where('DOC_Order_Header.editTime','>=',$startDate)
+            ->whereColumn('DOC_Order_Header.editTime','!=','DOC_Order_Header.addTime')
+            ->orderByDesc('DOC_Order_Header.editTime')
             ->get();
     }
 }

+ 21 - 0
app/Services/OrderCountingRecordService.php

@@ -228,6 +228,27 @@ class OrderCountingRecordService
                 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,

+ 3 - 1
app/Services/OrderIssueService.php

@@ -320,6 +320,7 @@ class OrderIssueService
         $orders = Order::query()->whereIn('code',data_get($orderHeaders,'*.orderno'))->whereHas('packages')->get();
         if($orders->count()==0)return false;
         $innerParams = [];
+        $data = Carbon::now()->format('Y-m-d H:i:s');
         foreach ($orderHeaders as $orderHeader) {
             $order = $orders->where('code',$orderHeader->orderno)->first();
             if($order==null){
@@ -331,7 +332,8 @@ class OrderIssueService
                 'result_explain' => $result_explain,
                 'imported_status' => $imported_status,
                 'custom_code' => $custom_code,
-                'hidden_tag' => $hiddenTag
+                'hidden_tag' => $hiddenTag,
+                'updated_at' => $data
             ];
         }
         try {

+ 8 - 4
app/Services/OrderPackageCommoditiesService.php

@@ -696,10 +696,10 @@ class OrderPackageCommoditiesService
             if(isset($orderAllocationDetails[$key])){
                 if(count($orderCommodity) == 1  && $orderAllocationDetails[$key]['amount'] != $orderCommodity[0]['amount']){
                     $update_params[$key] = $orderCommodity[0];
-                    $update_params['amount'] = $orderAllocationDetails[$key]['amount'];
+                    $update_params[$key]['amount'] = $orderAllocationDetails[$key]['amount'];
                 }elseif(count($orderCommodity)>1){
                     $update_params[$key] = array_shift($orderCommodity);
-                    $update_params[$key]['amount'] = $orderAllocationDetails[$key]['amount'];
+                    $update_params[$key][0]['amount'] = $orderAllocationDetails[$key]['amount'];
                     collect($orderCommodity)->each(function($item)use(&$del_orderCommodities){
                         $del_orderCommodities[] = $item;
                     });
@@ -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()));
             }

+ 133 - 16
app/Services/OrderService.php

@@ -13,11 +13,14 @@ use App\RejectedBill;
 use App\Services\common\BatchUpdateService;
 use App\Services\common\DataHandlerService;
 use App\Shop;
+use App\ValueStore;
 use App\Warehouse;
 use Carbon\Carbon;
 use Illuminate\Support\Collection;
 use Illuminate\Support\Facades\App;
+use Illuminate\Support\Facades\Cache;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Redis;
 
 class OrderService
 {
@@ -30,10 +33,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;
         }
     }
@@ -543,7 +547,7 @@ class OrderService
         $insert_params = $this->getParamsByOrderHeader($orderHeaders,$owners_code_map,$logistics_code_map,$shop_name_map,$warehouses_code_map);
         $update_params = $this->getUpdateParams($orderHeaders,$owners_code_map,$logistics_code_map,$shop_name_map,$warehouses_code_map);
         if(count($insert_params)> 0){
-            $this->create($insert_params);
+            $this->insert($insert_params);
         }
         if(count($update_params)>1){
             $this->batchUpdate($update_params);
@@ -562,6 +566,7 @@ class OrderService
         foreach ($orders as $order) {
             $order_code_map[$order->code]= $order;
         }
+        $date = Carbon::now()->format('Y-m-d H:i:s');
         foreach ($orderHeaders_map as $orderHeader) {
             if($order_code_map[$orderHeader->orderno] ?? false)continue;
             $owner = $owners_code_map[$orderHeader->customerid] ?? null;
@@ -574,6 +579,7 @@ class OrderService
                 'owner_id' => $owner->id ?? null,
                 'wms_status' => $orderHeader->oracleBASCode ? $orderHeader->oracleBASCode->codename_c : null,
                 'created_at' => $orderHeader->addtime,
+                'updated_at' =>$date,
                 'logistic_id' => $logistic->id ?? null,
                 'shop_id' => $shop->id ?? null,
                 'consignee_name' => $orderHeader->c_contact,
@@ -796,6 +802,7 @@ class OrderService
         $warehouses = $warehouseService->getByWmsOrders($orderHeaders);
         $orders = $this->getByWmsOrders($orderHeaders);
         $created_params = $this->getCreateOrderModelsByWMSOrderHeaders($orderHeaders,$orders,$warehouses,$owners,$logistics,$shops); //3s
+
         $update_order = $this->getUpdateOrderModelByWMSOrderHeaders($orderHeaders,$orders,$warehouses,$owners,$logistics,$shops);
         // 转换插入 3s
         if(count($created_params) > 0){
@@ -803,13 +810,6 @@ class OrderService
                 $this->insert($inner_params->toArray());
             });
         }
-//        $this->insert($created_params);
-//        $this->insert($created_order->map(function($item){
-//            $array = $item->toArray();
-//            unset($array['logisticNumbers'],$array['packages'],$array['commodityPackages'],$array['amount']);
-//            return $array;
-//        })->toArray());
-
         $update_params = [
             ['id','code','warehouse_id','owner_id','shop_id','logistic_id','consignee_name','consignee_phone','province','city','district','address','client_code','wms_status','created_at','updated_at','wms_edittime']
         ];
@@ -977,19 +977,136 @@ 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 = collect();
+        $orderHeaders->push($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;
         }
     }
 
+
+    // TODO
+    public function setOrderSyncAt($key,$date,$bool=true){
+        if($bool){
+            ValueStore::query()->where('name',$key)->update(['value'=>Carbon::parse($date)->subSeconds(1)]);
+        } else {
+            ValueStore::query()->where('name',$key)->update(['value'=>$date]);
+        }
+    }
+    // TODO
+    public function getOrderSyncAt($key,$type='newest'){
+        $keyValue = ValueStore::query()->where('name',$key)->first();
+        if($keyValue->value)return $keyValue->value;
+        if($type == 'newest') $order = Order::query()->orderByDesc('Created_At')->first();
+        else $order = Order::query()->orderByDesc('Wms_EditTime')->first();
+        if($order)return $order->created_at;
+        return Carbon::now()->subSeconds(65);
+    }
+    // TODO
+    public function pushOrderCache($orderHeaders,$prefixKey,$hasKey,$list_key){
+        $list = [];
+        try {
+            Redis::LLEN($list_key);
+            collect($orderHeaders)->each(function($item)use(&$list,$prefixKey){
+                $list[] =$item->orderno;
+                Cache::put($prefixKey.$item->orderno,true);
+            });
+            if(count($orderHeaders) > 0){
+                Cache::put($list_key,$list);
+                Cache::put($hasKey,true);
+            }
+        } catch (\Exception $e) {
+
+        }
+    }
+    // TODO
+    public function filterOrderByCache($orderHeaders,$key)
+    {
+        /**
+         * @var OracleDOCOrderHeader $item
+         */
+        if(!$orderHeaders)return $orderHeaders;
+        if(!$key)return $orderHeaders;
+        try {
+            Redis::LLEN($key);
+            return array_filter($orderHeaders,function($item)use($key){
+                $bool = Cache::get($key.$item->orderno);
+                return !$bool;
+            });
+        } catch (\Exception $e) {
+            return $orderHeaders;
+        }
+    }
+    // TODO
+    public function cancelOrderCache($key,string $prefix)
+    {
+        try {
+            $list = Cache::get($key);
+            collect($list)->each(function ($item)use($prefix) {
+                Cache::forget($prefix.$item);
+            });
+            Cache::put($key,[]);
+        } catch (\Exception $e) {
+        }
+    }
+    // TODO
+    public function syncCreatedOrder(){
+        /**
+         * @var OracleDOCOrderHeaderService $oracleDOCOrderHeaderService
+         * @var OrderService $orderService
+         */
+        $newest         = config('sync.order_sync.cache_prefix.created_at');
+        $newest_list    = config('sync.order_sync.cache_prefix.newest_list');
+        $hasKey         = config('sync.order_sync.cache_prefix.newest_has');
+        $prefixKey      = config('sync.order_sync.cache_prefix.newest');
+
+        $last_date = $orderService->getOrderSyncAt($newest,'newest');                              // 获取时间点
+
+        $orderHeaders = $oracleDOCOrderHeaderService->getWmsOrderOnStartDateEdit($last_date);           // WMS订单
+
+        $last_order = $orderHeaders->first();                                                           // 时间点靠后的
+        $renewal_orders = $orderHeaders->where('addTime',$last_order->addtime);
+
+        $orderHeaders = $orderService->filterOrderByCache($orderHeaders,$newest_list);                  // 对比缓存
+
+        if(count($orderHeaders)>0 && count($orderHeaders) >0){
+            $orderService->syncOrder($orderHeaders);                                                //  同步订单
+            $orderService->cancelOrderCache($newest_list);                                              //  清除缓存
+            $orderService->pushOrderCache($renewal_orders,$prefixKey,$hasKey,$newest_list);             //  添加缓存
+            $orderService->setOrderSyncAt($newest,$last_order->addTime,count($orderHeaders)>0);   //  更新时间
+        }
+    }
+    // TODO
+    public function syncUpdatedOrder(){
+        /**
+         * @var OracleDOCOrderHeaderService $oracleDOCOrderHeaderService
+         * @var OrderService $orderService
+         */
+        $renewal        = config('sync.order_sync.cache_prefix.updated_at');
+        $renewal_list   = config('sync.order_sync.cache_prefix.renewal_list');
+        $hasKey         = config('sync.order_sync.cache_prefix.renewal_has');
+        $prefixKey      = config('sync.order_sync.cache_prefix.renewal');
+
+        $last_date = $orderService->getOrderSyncAt($renewal,'renewal');                               // 获取时间点
+
+        $orderHeaders = $oracleDOCOrderHeaderService->getWMSOrderOnStartDate($last_date);                   // WMS订单
+
+        $renewal_order = $orderHeaders->first();                                                            // 时间点靠后的
+        $renewal_orders =  $orderHeaders->where('addTime',$renewal_order->addtime);
+
+        $orderHeaders = $orderService->filterOrderByCache($orderHeaders,$renewal_list);                     // 对比缓存
+
+        if(count($renewal_orders)>0 && count($orderHeaders)>0){
+            $orderService->syncOrder($orderHeaders);                                                    // 同步订单
+            $orderService->cancelOrderCache($renewal_list);                                                 // 清除缓存
+            $orderService->pushOrderCache($renewal_orders,$prefixKey,$hasKey,$renewal_list);                // 添加缓存
+            $orderService->setOrderSyncAt($renewal,$renewal_order->addTime,count($orderHeaders)>0);   // 更新时间
+        }
+    }
 }

+ 2 - 2
app/Services/OwnerService.php

@@ -118,9 +118,9 @@ Class OwnerService
     public function getByWmsOrders($orderHeaders){
         $customerIds = array_unique(data_get($orderHeaders,'*.customerid'));
         $customerIds = array_diff($customerIds,[null,'','*']);
-        $owners = Owner::query()->whereIn('code',data_get($orderHeaders,'*.customerid'))->get();
+        $owners = Owner::query()->whereIn('code',$customerIds)->get();
 
-        if($owners->count() < count($customerIds)){
+         if($owners->count() < count($customerIds)){
             $customerIds = array_diff($customerIds,data_get($owners,'*.code'));
             $owner_list = $this->createByWmsCustomerIds($customerIds);
             $owners=$owners->concat($owner_list);

+ 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 - 1
app/Services/UserService.php

@@ -28,6 +28,6 @@ class UserService
         if(!$user)return [];
         return $this->cacheService->getOrExecute("user{$user['id']}->getPermittingOwnerIds",function()use($user){
             return $user->getPermittingOwnerIdsAttribute() ?? [];
-        });
+        })??[];
     }
 }

+ 2 - 3
app/Services/WarehouseService.php

@@ -40,9 +40,9 @@ Class WarehouseService
         if(!$warehouse_ids)return null;
         /** @var Collection $oracleBasCustomers */
         $oracleBasCustomers=app(OracleBasCustomerService::class)->getWareHouse($warehouse_ids);
-        $warehouses=Warehouse::query()->where('code',data_get($oracleBasCustomers,'*.CustomerID'))->get();
+        $warehouses=Warehouse::query()->whereIn('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/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
config/sync.php

@@ -8,4 +8,18 @@ return [
         'interval' => 1,   // 时间以分为单位
         'start_at'=> '',    // 开始同步WMS的时间  时间格式: yyyy-MM-dd HH:mm:ss 如 2020-09-05 13:15:16
     ],
+    'order_sync' => [
+        'interval' => 1,   // 时间以分为单位
+        'start_at'=> '',    // 开始同步WMS的时间  时间格式: yyyy-MM-dd HH:mm:ss 如 2020-09-05 13:15:16
+        'cache_prefix' => [
+            'newest' =>'order_newest_',
+            'renewal' =>'order_renewal_',
+            'newest_has' => 'order_newest_has_set',             // 创建标记
+            'renewal_has' => 'order_renewal_has_set',           // 跟新标记
+            'created_at' => 'order_last_created_sync_at',       // 最后创建时间
+            'updated_at' => 'order_last_updated_sync_at',       // 最后更新时间
+            'newest_list' => 'order_newest_cache_keys',               // 新增保存记录
+            'renewal_list' => 'order_renewal_cache_keys'              // 创建保存记录
+        ]
+    ]
 ];

+ 15 - 0
database/factories/CityFactory.php

@@ -0,0 +1,15 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\City;
+use Faker\Generator as Faker;
+
+$factory->define(City::class, function (Faker $faker) {
+    return [
+        'province_id' => function(){
+            return factory(\App\Province::class)->create()->id;
+        },
+        'name'=>$faker->name
+    ];
+});

+ 27 - 0
database/factories/OrderFactory.php

@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * @var \Illuminate\Database\Eloquent\Factory $factory
+ */
+use App\Order;
+use Faker\Generator as Faker;
+
+
+$factory->define(Order::class, function (Faker $faker) {
+    $status = ['处理中','未处理','已处理','取消','异常'];
+    $wms_status = ['分配完成','部分分配','订单完成'];
+    return [
+        'status' => $status[rand(0,4)],
+        'created_at'=>$faker->dateTime->format('y-m-d'),
+        'code' => $faker->uuid,
+        'client_code' =>$faker->uuid,
+        'consignee_name'=>$faker->uuid,
+        'consignee_phone' => $faker->phoneNumber,
+        'province' => $faker->state,
+        'city' =>$faker->city,
+        'district'=>$faker->secondaryAddress,
+        'address' => $faker->address,
+        'wms_status' => $wms_status[rand(0,2)],
+        'wms_edittime' => $faker->dateTimeBetween( '-30 hour', 'now',  null)
+    ];
+});

+ 41 - 0
database/factories/OrderIssueFactory.php

@@ -0,0 +1,41 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OrderIssue;
+use Faker\Generator as Faker;
+
+$factory->define(OrderIssue::class, function (Faker $faker) {
+    $rejecting_status = ['无','未退回','全部退回','部分退回','差异退回','超量退回','全部退回'];
+    $is_new_rejecting = ['无','有','已处理'];
+    $finance_confirm = ['是','否'];
+    $final_status = ['已解决','待退回','退回中'];
+    $logistic_express_remission = ['原单减免','部分减免','全部减免'];
+    $baoshi_express_remission = ['原单减免','部分减免','全部减免'];
+    $imported_status = ['正常','导入未处理','导入已梳理'];
+    return [
+        'order_id' =>function(){
+            return factory(\App\Order::class)->create()->id;
+        },
+        'created_at' => $faker->date('y-m-d'),
+        'rejected_bill_id' => 0,
+        'rejecting_status' => $rejecting_status[rand(0,count($rejecting_status)-1)],
+        'result_explain' => $faker->text(20),
+        'logistic_number_return'=>$faker->name,
+        'order_issue_type_id' => 0,
+        'second_order_id' => 0,
+        'is_new_rejecting' => $is_new_rejecting[rand(0,count($is_new_rejecting) -1)],
+        'second_client_no' => $faker->name,
+        'second_logistic_number' => $faker->name,
+        'final_status' => $final_status[rand(0,count($final_status)-1)],
+        'logistic_indemnity_money' => rand(0,10),
+        'logistic_express_remission' =>$logistic_express_remission[rand(0,1)] ,
+        'baoshi_indemnity_money' =>rand(0,1),
+        'baoshi_express_remission' => $baoshi_express_remission[rand(0,1)],
+        'user_workgroup_id' => 0,
+        'custom_code' => $faker->name,
+        'imported_status' => $imported_status[rand(0,count($imported_status)-1)],
+        'finance_confirm' =>$finance_confirm[rand(0,1)],
+        'hidden_tag' => $faker->name
+    ];
+});

+ 12 - 0
database/factories/OrderPackageFactory.php

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

+ 15 - 0
database/factories/OwnerTrakingOwnerFactory.php

@@ -0,0 +1,15 @@
+<?php
+
+/** @var \Illuminate\Database\Eloquent\Factory $factory */
+
+use App\OrderTrackingOwner;
+use Faker\Generator as Faker;
+
+$factory->define(OrderTrackingOwner::class, function (Faker $faker) {
+    return [
+        'owner_id'=>function(){
+            return factory(\App\Owner::class)->create()->id;
+        },
+        'status' => '启用'
+    ];
+});

+ 12 - 0
database/factories/ProvinceFactory.php

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

+ 2 - 2
database/migrations/2020_03_09_153510_create_stores_table.php

@@ -18,8 +18,8 @@ class CreateStoresTable extends Migration
             $table->string('asn_code')->nullable()->unique()->comment('WMS的ASNNO单号');
             $table->integer('warehouse_id')->nullable()->comment('仓库ID');
             $table->integer('owner_id')->index()->nullable()->comment('货主ID');
-            $table->enum('stored_method',['正常','快速入库'])->default('正常');
-            $table->enum('status',['无需入库','已入库','未入库','待推单'])->nullable();
+            $table->enum('stored_method',['正常','快速入库','采购入库','笕尚退货入库单','笕尚进仓入库单','笕尚移仓入库单','B2B入库','笕尚调整入库单','换货入库','初始化库存','虚拟入库','其他入库','退货入库','调拨入库'])->default('正常');
+            $table->enum('status',['待盘点','盘点中','复盘中','已完成','已审核'])->default(null)->nullable();
             $table->string('remark')->nullable();
             $table->timestamp('deleted_at')->nullable()->index();
             $table->timestamp('updated_at')->nullable();

+ 12 - 11
database/migrations/2020_03_30_112202_drop_commodity_barcode_column_to_barcode_table.php

@@ -15,21 +15,22 @@ class DropCommodityBarcodeColumnToBarcodeTable extends Migration
      */
     public function up()
     {
-        DB::insert('INSERT commodity_barcodes (code,commodity_id) SELECT barcode, id FROM commodities');
-        $this->delRepeated();
+//        \App\Commodity::query()->count();
+//        DB::insert('INSERT commodity_barcodes (code,commodity_id) SELECT barcode, id FROM commodities');
+//        $this->delRepeated();
         Schema::table('commodities', function (Blueprint $table) {
             $table->dropColumn('barcode');
         });
     }
 
-    private function delRepeated(){
-        $codes=CommodityBarcode::groupBy('code','commodity_id')->havingRaw('count(*) > ?', [1])->get();
-        $codes->each(function(CommodityBarcode $code){
-            $delCodes=CommodityBarcode::where('code',$code['code'])->where('commodity_id',$code['commodity_id'])->where('id','!=',$code['id'])->get();
-            $delCodes->each(function(CommodityBarcode $delcode){
-                $delcode->delete();
-            });
-        });
-    }
+//    private function delRepeated(){
+//        $codes=CommodityBarcode::groupBy('code','commodity_id')->havingRaw('count(*) > ?', [1])->get();
+//        $codes->each(function(CommodityBarcode $code){
+//            $delCodes=CommodityBarcode::where('code',$code['code'])->where('commodity_id',$code['commodity_id'])->where('id','!=',$code['id'])->get();
+//            $delCodes->each(function(CommodityBarcode $delcode){
+//                $delcode->delete();
+//            });
+//        });
+//    }
 
 }

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

@@ -14,7 +14,7 @@ class ChangeUserWorkgroup extends Migration
     public function up()
     {
         Schema::table('user_workgroups', function (Blueprint $table) {
-            $table->bigInteger('warehouse_id')->comment('外键到工作组');
+            $table->bigInteger('warehouse_id')->nullable()->comment('外键到工作组');
         });
     }
 

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

@@ -14,7 +14,7 @@ class ChangeUserDutyCheck extends Migration
     public function up()
     {
         Schema::table('user_duty_checks', function (Blueprint $table) {
-            $table->bigInteger('workgroup_id')->comment('外键到工作组');
+            $table->bigInteger('workgroup_id')->nullable()->comment('外键到工作组');
         });
     }
 

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

@@ -43,7 +43,7 @@ class CreateOperatorLogsTableAndAddAuthorityAndChangeProcessesColumnStatus exten
             $table->dropColumn('status');
         });
         Schema::table('processes',function (Blueprint $table){
-            $table->enum('status',['待审核','已驳回','待接单','待加工','加工中','待验收','待交接','交接完成'])->comment('状态');
+            $table->enum('status',['待审核','已驳回','待接单','待加工','加工中','待验收','待交接','交接完成'])->default('待审核')->comment('状态');
         });
     }
 

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

@@ -16,7 +16,7 @@ class CreateLaborReportStatusesTable extends Migration
         Schema::create('labor_report_statuses', function (Blueprint $table) {
             $table->bigIncrements('id');
             $table->bigInteger('labor_report_id')->index()->comment('外键临时工报表')->nullable();
-            $table->enum('status',['未审核','已入场','已退场','已换组','已退组'])->default('未审核')->nullable();
+            $table->enum('status',['未审核','已入场','已退场','已换组','已退组','已删除'])->default('未审核')->nullable();
             $table->timestamps();
         });
     }

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

@@ -31,7 +31,7 @@ class ChangeInventoryMissionsToInventoryAccountMissions extends Migration
             $table->integer('re_checked_amount')->nullable()->comment('复盘数量');
             $table->integer('difference_amount')->nullable()->comment('盘点差异');
             $table->integer('occupied_amount')->nullable()->comment('分配数量');
-            $table->enum('checked',['是','否'])->default('否')->comment('已盘点');
+            $table->enum('checked',['是','否','已复核','跳过','确认差异'])->default('否')->comment('否');
             $table->enum('returned',['是','否','无'])->default('无')->comment('已归位');
             $table->timestamps();
         });

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

@@ -17,7 +17,7 @@ class ChangeInventoriesToInventoryAccounts extends Migration
         Schema::create('inventory_accounts', function (Blueprint $table) {
             $table->bigIncrements('id');
             $table->integer('owner_id')->index();
-            $table->enum('type',['全盘','动盘'])->comment('盘点类型');
+            $table->enum('type',['全盘','动盘','局部盘点'])->comment('盘点类型');
             $table->timestamp('start_at')->nullable();
             $table->timestamp('end_at')->nullable();
             $table->integer('total')->nullable()->comment('记录数');

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

@@ -14,7 +14,7 @@ class AddInventoryAccountsStatus extends Migration
     public function up()
     {
         Schema::table('inventory_accounts', function (Blueprint $table) {
-            $table->enum('status',['待盘点','盘点中','复盘中','已完成'])->default('待盘点')->comment('盘点状态');
+            $table->enum('status',['待盘点','盘点中','复盘中','已完成','已审核'])->nullable()->default(null)->comment('盘点状态');
         });
     }
 

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

@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Schema;
-
-class ChangeInventoryAccountMissionColumnCheckedToThree extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核') default '否'");
-        Schema::table('inventory_account_missions', function (Blueprint $table) {
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否') default '否'");
-        Schema::table('inventory_account_missions', function (Blueprint $table) {
-        });
-    }
-}

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

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

@@ -14,7 +14,7 @@ class ChangeLaborReportsLaborCompanyToLaborCompanyId extends Migration
     public function up()
     {
         Schema::table('labor_reports', function (Blueprint $table) {
-            $table->bigInteger('labor_company_id')->index()->comment('劳务所');
+            $table->bigInteger('labor_company_id')->nullable()->index()->comment('劳务所');
         });
         $laborReports=\App\LaborReport::query()->get();
         foreach ($laborReports as $laborReport){

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

@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Schema;
-
-class ChangeInventoryAccountMissionCheckedColumnCheckedToFour extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核','跳过') default '否'");
-        Schema::table('inventory_account_missions', function (Blueprint $table) {
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核') default '否'");
-        Schema::table('inventory_account_missions', function (Blueprint $table) {
-        });
-    }
-}

+ 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');
+//        });
     }
 }

+ 2 - 2
database/migrations/2020_09_23_135848_add_authorities_and_change_inventory_accounts.php

@@ -16,7 +16,7 @@ class AddAuthoritiesAndChangeInventoryAccounts extends Migration
     public function up()
     {
         (new Authority(['name'=>'人事管理-临时工报表-编辑备注','alias_name'=>'人事管理-临时工报表-编辑备注']))->save();
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘','局部盘点')");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘','局部盘点')");
         Schema::table('inventory_accounts', function (Blueprint $table) {
             $table->string('remark')->nullable()->comment('备注');
         });
@@ -31,7 +31,7 @@ class AddAuthoritiesAndChangeInventoryAccounts extends Migration
     public function down()
     {
         Authority::where('name','人事管理-临时工报表-编辑备注')->delete();
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘')");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN type enum ('全盘','动盘')");
         Schema::table('inventory_accounts', function (Blueprint $table) {
             $table->dropColumn('remark');
         });

+ 2 - 2
database/migrations/2020_09_24_152015_change_labor_report_status.php

@@ -14,7 +14,7 @@ class ChangeLaborReportStatus extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组','已删除') default '未审核'");
+//        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组','已删除') default '未审核'");
     }
 
     /**
@@ -24,6 +24,6 @@ class ChangeLaborReportStatus extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组') default '未审核'");
+//        DB::statement("ALTER TABLE labor_report_statuses MODIFY COLUMN status enum ('未审核','已入场','已退场','已换组','已退组') default '未审核'");
     }
 }

+ 2 - 2
database/migrations/2020_10_12_092325_change_inventory_account_mission_checked_column_checked_to_five.php

@@ -14,7 +14,7 @@ class ChangeInventoryAccountMissionCheckedColumnCheckedToFive extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核','跳过','确认差异') default '否'");
+//        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核','跳过','确认差异') default '否'");
         Schema::table('inventory_account_missions', function (Blueprint $table) {
         });
     }
@@ -26,7 +26,7 @@ class ChangeInventoryAccountMissionCheckedColumnCheckedToFive extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核','跳过') default '否'");
+//        DB::statement("ALTER TABLE inventory_account_missions MODIFY COLUMN checked enum ('是','否','已复核','跳过') default '否'");
         Schema::table('inventory_account_missions', function (Blueprint $table) {
         });
     }

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

@@ -15,7 +15,7 @@ class AddOrderTrackOrderCode extends Migration
     {
         //
         Schema::table('order_trackings', function (Blueprint $table) {
-            $table->string('order_client_code')->index()->comment('订单号')->after('web_order_number');
+            $table->string('order_client_code')->nullable()->index()->comment('订单号')->after('web_order_number');
         });
     }
 

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

+ 4 - 1
database/migrations/2020_10_19_113042_create_logistic_timings_table.php

@@ -68,7 +68,10 @@ class CreateLogisticTimingsTable extends Migration
                 'updated_at' => $time
             ];
         }
-        LogisticTiming::query()->insert($create_array);
+        $inner_param = array_chunk($create_array,100);
+        foreach ($inner_param as $item) {
+            LogisticTiming::query()->insert($item);
+        }
     }
 
     public function getMap()

+ 2 - 2
database/migrations/2020_11_03_114135_change_store_status_column.php

@@ -14,7 +14,7 @@ class ChangeStoreStatusColumn extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE stores MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单','完全收货','部分收货','已码盘','订单创建','ASN关闭','等待释放','收货取消') default null");
+//        DB::statement("ALTER TABLE stores MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单','完全收货','部分收货','已码盘','订单创建','ASN关闭','等待释放','收货取消') default null");
         Schema::table('stores', function (Blueprint $table) {
         });
     }
@@ -26,7 +26,7 @@ class ChangeStoreStatusColumn extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE stores MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单') default null");
+//        DB::statement("ALTER TABLE stores MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单') default null");
         Schema::table('stores', function (Blueprint $table) {
         });
     }

+ 2 - 2
database/migrations/2020_11_03_114310_change_store_stored_method_column.php

@@ -14,7 +14,7 @@ class ChangeStoreStoredMethodColumn extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE stores MODIFY COLUMN stored_method enum ('正常','快速入库','采购入库','笕尚退货入库单','笕尚进仓入库单','笕尚移仓入库单','B2B入库','笕尚调整入库单','换货入库','初始化库存','虚拟入库','其他入库','退货入库','调拨入库') default '正常'");
+//        DB::statement("ALTER TABLE stores MODIFY COLUMN stored_method enum ('正常','快速入库','采购入库','笕尚退货入库单','笕尚进仓入库单','笕尚移仓入库单','B2B入库','笕尚调整入库单','换货入库','初始化库存','虚拟入库','其他入库','退货入库','调拨入库') default '正常'");
         Schema::table('stores', function (Blueprint $table) {
         });
     }
@@ -26,7 +26,7 @@ class ChangeStoreStoredMethodColumn extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE stores MODIFY COLUMN stored_method enum ('正常','快速入库') default '正常'");
+//        DB::statement("ALTER TABLE stores MODIFY COLUMN stored_method enum ('正常','快速入库') default '正常'");
         Schema::table('stores', function (Blueprint $table) {
         });
     }

+ 2 - 2
database/migrations/2020_11_03_180029_change_store_items_status_column.php

@@ -14,7 +14,7 @@ class ChangeStoreItemsStatusColumn extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE store_items MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单','完全收货','部分收货','已码盘','订单创建','ASN关闭','等待释放','收货取消') default null");
+//        DB::statement("ALTER TABLE store_items MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单','完全收货','部分收货','已码盘','订单创建','ASN关闭','等待释放','收货取消') default null");
         Schema::table('store_items', function (Blueprint $table) {
         });
     }
@@ -26,7 +26,7 @@ class ChangeStoreItemsStatusColumn extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE store_items MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单') default null");
+//        DB::statement("ALTER TABLE store_items MODIFY COLUMN status enum ('无需入库','已入库','未入库','待推单') default null");
         Schema::table('store_items', function (Blueprint $table) {
         });
     }

+ 2 - 2
database/migrations/2020_11_13_155436_change_inventory_accounts_status_column.php

@@ -14,7 +14,7 @@ class ChangeInventoryAccountsStatusColumn extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default null");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default null");
         Schema::table('inventory_accounts', function (Blueprint $table) {
         });
 
@@ -27,7 +27,7 @@ class ChangeInventoryAccountsStatusColumn extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成') default null");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成') default null");
         Schema::table('inventory_accounts', function (Blueprint $table) {
         });
     }

+ 2 - 2
database/migrations/2020_11_18_092138_change_inventory_accounts_status_default.php

@@ -14,7 +14,7 @@ class ChangeInventoryAccountsStatusDefault extends Migration
      */
     public function up()
     {
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default '待盘点'");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default '待盘点'");
         Schema::table('inventory_accounts', function (Blueprint $table) {
         });
     }
@@ -26,7 +26,7 @@ class ChangeInventoryAccountsStatusDefault extends Migration
      */
     public function down()
     {
-        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default null");
+//        DB::statement("ALTER TABLE inventory_accounts MODIFY COLUMN status enum ('待盘点','盘点中','复盘中','已完成','已审核') default null");
         Schema::table('inventory_accounts', function (Blueprint $table) {
         });
     }

+ 1 - 1
package-lock.json

@@ -6200,7 +6200,7 @@
         },
         "minimist": {
             "version": "1.2.0",
-            "resolved": "https://registry.npm.taobao.org/minimist/download/minimist-1.2.0.tgz",
+            "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
             "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
             "dev": true
         },

+ 3 - 1
phpunit.xml

@@ -33,7 +33,9 @@
     <php>
         <server name="APP_ENV" value="testing"/>
         <server name="BCRYPT_ROUNDS" value="4"/>
-        <server name="CACHE_DRIVER" value="array"/>
+        <server name="CACHE_DRIVER" value="redis"/>
+        <server name="DB_CONNECTION" value="sqlite"/>
+        <server name="DB_DATABASE" value=":memory:"/>
         <server name="MAIL_DRIVER" value="array"/>
         <server name="QUEUE_CONNECTION" value="sync"/>
         <server name="SESSION_DRIVER" value="array"/>

BIN
public/images/QRCodeIMG/10.png


BIN
public/images/QRCodeIMG/4.png


BIN
public/images/QRCodeIMG/5.png


File diff suppressed because it is too large
+ 15 - 1
public/js/app.js


+ 1 - 2
public/t.php

@@ -1,4 +1,3 @@
 <?php
 
-$start_at = microtime(true);
-echo (microtime(true)-$start_at)*1000;
+var_dump((bool)[]);

+ 4 - 0
resources/sass/text.scss

@@ -51,3 +51,7 @@
 .fa-sort{
     opacity: 0.3;
 }
+
+.text-letter{
+    word-break: break-all
+}

+ 194 - 145
resources/views/control/panel.blade.php

@@ -4,88 +4,61 @@
     <link href="{{ mix('css/element-ui.css') }}" rel="stylesheet">
 @endsection
 @section('content')
-    <div class="container-fluid" id="list">
-        <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 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>
-                </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 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="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 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>
-        </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 id="orderCountingRecords" class="col" style="width:600px;height:600px;"></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="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"
+            <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
@@ -94,92 +67,151 @@
                                             end-placeholder="结束日期"
                                             value-format="yyyy-MM-dd"
                                             :picker-options="pickerOptions">
-                                        </el-date-picker>
+                            </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 class="card-body row">
-                                <div id="logisticsCountingRecords" class="col"
-                                     style="width: 600px;height:600px;"></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 class="col-6">
+                </div>
+                @can('人事管理-临时工报表-可见全部组')
+                    <div class="col-5">
                         <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>
+                                <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 id="warehouseCountingRecords" class="col"
-                                     style="width: 600px;height:600px;"></div>
+                                <div v-show="laborReportsCountingRecordsShow" id="laborReportsCountingRecords" class="col"
+                                     style="width:600px;height:600px;"></div>
+                                <div v-show="!laborReportsCountingRecordsShow">
+                                    正在加载
+                                </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 id="laborReportsCountingRecords" class="col" style="width:600px;height:600px;"></div>
-                    </div>
-                </div>
-            </div>
-            <div class="col-7">
+                    <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 id="laborReportsUserGroupsCount" class="col" style="width:600px;height:600px;"></div>
+                        <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>
-                </div>
+                @endcan
             </div>
-            @endcan
         </div>
     </div>
 @endsection
@@ -251,9 +283,15 @@
                 laborReportsUserGroupsCountDate: [moment(new Date(new Date().getTime() - 3600 * 1000 * 24 * 30)).format('yyyy-MM-DD'),
                     moment(new Date()).format('yyyy-MM-DD')],
                 orderCountingRecordsUnit: '日',
-                laborReportsCountingRecordUnit: '日'
+                laborReportsCountingRecordUnit: '日',
+                orderCountingRecordsShow: true,
+                logisticsCountingRecordsShow: true,
+                warehouseCountingRecordsShow: true,
+                laborReportsCountingRecordsShow: true,
+                laborReportsUserGroupsCountShow: true,
             },
             mounted: function () {
+                $('#list').removeClass('d-none');
                 let _this = this;
                 this.warehouses = {
                     "WH01": '松江一仓',
@@ -432,6 +470,7 @@
                     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) {
@@ -440,10 +479,12 @@
                             _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]);
@@ -452,11 +493,13 @@
                         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]);
@@ -465,11 +508,14 @@
                         if (res.status === 200) {
                             _this.warehouseCountingRecords = res.data.warehouseCountingRecords;
                             _this.initWarehouseCountingRecordsChart();
+                            _this.warehouseCountingRecordsShow = true;
+
                         }
                     });
                 },
 
                 laborReportsCountingRecordApi(laborReportsCountingRecordUnit) {
+                    this.laborReportsCountingRecordsShow = false;
                     if (laborReportsCountingRecordUnit === '') {
                         laborReportsCountingRecordUnit = this.laborReportsCountingRecordUnit;
                     }
@@ -486,10 +532,12 @@
                             _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]);
@@ -498,6 +546,7 @@
                         if (res.status === 200) {
                             _this.laborReportsUserGroupsCount = res.data.laborReportsUserGroupsCount;
                             _this.initLaborReportsUserGroupsCountChart();
+                            _this.laborReportsUserGroupsCountShow = true;
                         }
                     });
                 },

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

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

@@ -90,12 +90,12 @@
                             </div>
                             <span v-else>@{{ order.soreference5 }}</span>
                         </td>
-                        <td class="text-muted text-nowrap">@{{ order.c_contact }}</td>
-                        <td class="text-muted text-nowrap">@{{ order.c_tel2?order.c_tel2:order.c_tel1 }}</td>
+                        <td class="text-muted text-wrap text-letter" style="max-width: 200px">@{{ order.c_contact }}</td>
+                        <td class="text-muted text-wrap text-letter" style="max-width: 200px">@{{ order.c_tel2?order.c_tel2:order.c_tel1 }}</td>
                         <td class="text-nowrap"> @{{ order.c_province }}</td>
                         <td class="text-nowrap"> @{{ order.c_city }}</td>
                         <td class="text-nowrap"> @{{ order.c_district }}</td>
-                        <td class="text-muted">@{{ order.c_address1 }}</td>
+                        <td class="text-muted text-wrap text-letter" style="max-width: 500px">@{{ order.c_address1 }}</td>
                         <td class="text-nowrap">@{{ order.waveno }}</td>
                         <td class="text-nowrap"> @{{ order.warehouseid }}</td>
                         <td class="text-nowrap"><span v-if="order.edisendflag2=='Y'">是</span><span v-if="order.edisendflag2=='N'">否</span><span v-if="order.edisendflag2=='W'">错误</span></td>
@@ -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 = []

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

@@ -111,8 +111,8 @@
                         <th class="tow-layer align-middle td-yellow" rowspan="2" style="min-width: 150px;">原始运单号</th>
                         {{--原始商品明细 开始--}}
                         <th class="tow-layer align-middle td-yellow" v-if="!isShowOrderInfo" rowspan="2" style="min-width:50px">展开</th>
-                        <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 90px">收货人名称</th>
-                        <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 120px;">收货人电话</th>
+                        <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 200px">收货人名称</th>
+                        <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 200px;">收货人电话</th>
                         <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">省</th>
                         <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">市</th>
                         <th class="tow-layer align-middle td-yellow" v-if="isShowOrderInfo" rowspan="2" style="min-width: 70px">区</th>
@@ -129,7 +129,7 @@
                             <th class="three-layer  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 120px;">二次客户订单号</th>
                             <th class="three-layer  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 100px;">二次承运商</th>
                             <th class="three-layer  align-middle" rowspan="2" v-if="isShowSecondOrderInfo" style=" min-width: 200px;">二次运单号</th>
-                            <th class="three-layer" colspan="3" style="min-width: 300px" v-if="isShowSecondOrderInfo" style=" min-width: 350px;">二次商品明细</th>
+                            <th class="three-layer" colspan="3" v-if="isShowSecondOrderInfo" style=" min-width: 350px;">二次商品明细</th>
                         @endcannot
                         @cannot('订单管理-问题件-客户自定义订单号')
                         <th class="three-layer  align-middle" rowspan="2" style="min-width: 120px">自定义订单号</th>
@@ -270,13 +270,13 @@
                         <td class="td-yellow p-0 m-0 child-layer-2" v-if="!isShowOrderInfo && index===0" style="width:50px" :rowspan="orderIssues.length">
                             <span class="btn btn-outline-secondary "  @click="showOrderInfo" :style="orderIssues.length>4 ?'{height: 200px;line-height: 100px':''" >展开运单列</span>
                         </td>
-                        <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_name }}</td>
-                        <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo">@{{ orderIssue.order.consignee_phone }}</td>
+                        <td class="td-yellow child-layer-2-hide text-wrap text-letter" v-if="isShowOrderInfo" style="max-width: 320px">@{{ orderIssue.order.consignee_name }}</td>
+                        <td class="td-yellow child-layer-2-hide text-wrap text-letter" v-if="isShowOrderInfo" style="max-width: 320px">@{{ orderIssue.order.consignee_phone }}</td>
                         <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo">@{{ orderIssue.order.province }}</td>
-                        <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo">@{{ orderIssue.order.city }}</td>
+                        <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo" >@{{ orderIssue.order.city }}</td>
                         <td class="td-yellow child-layer-2-hide" v-if="isShowOrderInfo">@{{ orderIssue.order.district }}</td>
-                        <td class="td-yellow child-layer-2-hide" style="width: 400px" v-if="isShowOrderInfo">
-                            <span class="text-wrap m-0 p-0 " style="width: 400px">@{{ orderIssue.order.address }}</span>
+                        <td class="td-yellow child-layer-2-hide" style="max-width: 400px" v-if="isShowOrderInfo" >
+                            <span class="text-wrap m-0 p-0 text-wrap text-letter" style="max-width: 550px">@{{ orderIssue.order.address }}</span>
                         </td>
                         <td class="td-yellow p-0 child-layer-2-hide" :id="orderIssue.id+'items'" colspan="3" v-if="isShowOrderInfo" :data-value="orderIssue.orderCount = 0" :data-value1='orderIssue.orderPackagecount = 0'>
                             <div v-if="orderIssue.order">

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

+ 25 - 1
resources/views/personnel/laborReport/index.blade.php

@@ -380,6 +380,30 @@
                     //进组
                     _this.permittingWorkgroups.forEach(function(workgroup){
                         Echo.channel('{{$laravelEchoPrefix}}'+workgroup.token).listen('ClockinEvent',(e)=>{
+                            // 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.has_group_verify_right=labor.has_group_verify_right;
+                            //             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;
+                            //     labor.has_group_verify_right=labor.has_group_verify_right;
+                            //     laborReports.push(labor);
+                            // }
                             setTimeout(function () {
                                 window.location.reload();
                             },500);
@@ -467,7 +491,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");//移库
+});

+ 1 - 0
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(){

+ 7 - 1
tests/Services/CityService/FindByNameTest.php

@@ -10,6 +10,7 @@ use Tests\TestCase;
 
 class FindByNameTest extends TestCase
 {
+    use RefreshDatabase;
 
     /** @var CityService $cityService */
     public $cityService;
@@ -18,9 +19,14 @@ class FindByNameTest extends TestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $this->cityService = app(CityService::class);
+        if(!City::query()->where('name','南京')->exists())
+            factory(City::class)->create(['name'=>'南京']);
     }
 
-    public function testFindByName()
+    /**
+     * @test
+     */
+    public function findByName()
     {
         /** @var City $city */
         $city = $this->cityService->findByName('南京市');

+ 23 - 3
tests/Services/LogisticTimingService/FindByParamsTest.php

@@ -2,27 +2,47 @@
 
 namespace Tests\CacheService\LogisticTimingService\FindByParamsTest;
 
+use App\City;
 use App\Logistic;
+use App\Province;
 use App\Services\LogisticTimingService;
+use Illuminate\Foundation\Testing\RefreshDatabase;
 use Tests\TestCase;
 
 class FindByParamsTest extends TestCase
 {
-    /** @var LogisticTimingService $logisticTimingService */
+    use RefreshDatabase;
+
+    /**
+     * @var LogisticTimingService $logisticTimingService
+     */
     public $logisticTimingService;
 
     public function setUp(): void
     {
         parent::setUp();
         $this->logisticTimingService = app(LogisticTimingService::class);
+
+        factory(Logistic::class)->create(['name'=>'新杰物流','code'=>'XJWL']);
+        $province = null;
+        if(!Province::query()->where('name','like','江苏')->exists())
+            $province = factory(Province::class)->create(['name'=>'江苏']);
+        else
+            $province = Province::query()->where('name','like','江苏')->first();
+
+        if(!city::query()->where('name','like','南京'))
+            factory(City::class)->create(['name'=>'南京', 'province_id'=>$province->id]);
     }
 
-    public function testFindByParams()
+    /**
+     * @test
+     */
+    public function findByParams()
     {
         $cityName = '江苏省';
         $provinceName = '南京市';
         $logistic = Logistic::query()->where('name','like','新杰物流'.'%')->first();
-        $result=$this->logisticTimingService->findByParams($cityName,$provinceName,$logistic->id);
+        $result = $this->logisticTimingService->findByParams($cityName,$provinceName,$logistic->id);
         $this->assertNull($result);
     }
 }

+ 43 - 0
tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnEditDateTest.php

@@ -0,0 +1,43 @@
+<?php
+
+namespace Tests\Services\OracleDOCOrderHeaderService;
+
+use App\OracleDOCOrderHeader;
+use App\Services\OracleDOCOrderHeaderService;
+use App\Services\OrderService;
+use Carbon\Carbon;
+use Illuminate\Foundation\Testing\RefreshDatabase;
+use Illuminate\Foundation\Testing\WithFaker;
+use Tests\TestCase;
+
+class GetWMSOrderOnEditDateTest extends TestCase
+{
+    use RefreshDatabase;
+    /** @var OracleDOCOrderHeaderService $service */
+    private $service;
+
+    public function setUp(): void
+    {
+        parent::setUp(); // TODO: Change the autogenerated stub
+        $this->service = app('OracleDocOrderHeaderService');
+    }
+
+    /**
+     * @test
+     */
+    public function getWMSOrderOnEditDate()
+    {
+        $orderHeader = OracleDOCOrderHeader::query()->orderByDesc('editTime')->first();
+        if(!$orderHeader){
+            $this->assertNull($orderHeader);
+            return;
+        }
+        $carbon = Carbon::parse($orderHeader->editTime)->subMinutes(5);
+        $orderHeaders = $this->service->getWMSOrderOnEditDate($carbon);
+        if(!$orderHeaders){
+            $this->assertNull($orderHeaders);
+            return;
+        }
+        $this->assertNotNull($orderHeaders);
+    }
+}

+ 21 - 10
tests/Services/OracleDOCOrderHeaderService/GetWMSOrderOnStartDateTest.php

@@ -1,34 +1,45 @@
 <?php
 
-namespace Tests\Services\OracleDOCOrderHeaderService;
+namespace Tests\Services\OracleDOCOrderHeaderService\GetWMSORderOnStartDateTest;
 
+use App\OracleDOCOrderHeader;
+use App\OrderTrackingOwner;
+use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
-//use Illuminate\Foundation\Testing\RefreshDatabase;
-//use Illuminate\Foundation\Testing\WithFaker;
+use Illuminate\Foundation\Testing\RefreshDatabase;
 use Tests\TestCase;
 
 class GetWMSOrderOnStartDateTest extends TestCase
 {
+    use RefreshDatabase;
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
 
     public function setUp(): void
     {
-        $this->service = app(OracleDOCOrderHeaderService::class);
         parent::setUp();
+        $this->service = app(OracleDOCOrderHeaderService::class);
+        factory(OrderTrackingOwner::class)->create([
+            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'status'=>'启用']);
     }
 
-    public function testGetWMSOrderOnStartDate()
+    /**
+     * @test
+     */
+    public function getWMSOrderOnStartDate()
     {
-        $carbon =Carbon::now()->subSeconds(10);
+        $orderHeader = OracleDOCOrderHeader::query()->orderByDesc('addTime')->first();
+        if(!$orderHeader){
+            $this->assertNull($orderHeader);
+            return ;
+        }
+        $carbon =Carbon::parse($orderHeader->addtime)->subMinutes(5);
         $orderHeaders = $this->service->getWMSOrderOnStartDate($carbon);
         $this->assertNotNull($orderHeaders);
         $orderHeader = $orderHeaders->first();
-        $this->assertNotNull($orderHeader->oracleDOCOrderDetails);
-        $this->assertNotNull($orderHeader->actAllocationDetails);
-        $this->assertNotNull($orderHeader->oracleBASCustomer);
-        $this->assertNotNull($orderHeader->oracleBASCode);
+        $this->assertNotNull($orderHeader);
     }
 
 }

+ 25 - 9
tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnStartDateEditTest.php

@@ -1,33 +1,49 @@
 <?php
 
-namespace Tests\Services\OracleDOCOrderHeaderService;
+namespace Tests\Services\OracleDocOrderHeaderServie\GetWmsOrderOnStartDateEditTest;
 
+use App\OracleDOCOrderHeader;
+use App\OrderTrackingOwner;
+use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
 use Tests\TestCase;
 
 class GetWmsOrderOnStartDateEditTest extends TestCase
 {
+    use RefreshDatabase;
+
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
 
     public function setUp(): void
     {
-        $this->service = app(OracleDOCOrderHeaderService::class);
         parent::setUp();
-    }
+        $this->service = app(OracleDOCOrderHeaderService::class);
+        factory(OrderTrackingOwner::class)->create([
+            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'status'=>'启用']);
+     }
 
-    public function testGetWmsOrderOnStartDateEdit()
+    /**
+     * @test
+     */
+    public function getWmsOrderOnStartDateEdit()
     {
-        $carbon =Carbon::now()->subHours(10);
+        $orderHeader= OracleDOCOrderHeader::query()->where('CustomerID','WANLING')->orderByDesc('EditTime')->first();
+        if(!$orderHeader){
+            $this->assertNull($orderHeader);
+            return ;
+        }
+        $carbon =Carbon::parse($orderHeader->addtime)->subMinutes(5);
         $orderHeaders = $this->service->getWmsOrderOnStartDateEdit($carbon);
-        $this->assertNotNull($orderHeaders);
-        $orderHeader = $orderHeaders->first();
-        if($orderHeaders->count() == 0){
+        if(!$orderHeaders){
+            $this->assertNull($orderHeaders);
             return ;
         }
+        $this->assertNotNull($orderHeaders);
+        $orderHeader = $orderHeaders->first();
         $this->assertNotNull($orderHeader->oracleDOCOrderDetails);
         $this->assertNotNull($orderHeader->actAllocationDetails);
         $this->assertNotNull($orderHeader->oracleBASCustomer);

+ 10 - 1
tests/Services/OracleDOCOrderHeaderService/GetWmsOrderOnstartDateCreateTest.php

@@ -3,6 +3,8 @@
 namespace Tests\Services\OracleDOCOrderHeaderService;
 
 use App\OracleDOCOrderHeader;
+use App\OrderTrackingOwner;
+use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
@@ -11,6 +13,7 @@ use Tests\TestCase;
 
 class GetWmsOrderOnstartDateCreateTest extends TestCase
 {
+    use RefreshDatabase;
     /** @var OracleDOCOrderHeaderService $service */
     public $service;
 
@@ -18,9 +21,15 @@ class GetWmsOrderOnstartDateCreateTest extends TestCase
     {
         $this->service = app(OracleDOCOrderHeaderService::class);
         parent::setUp();
+        factory(OrderTrackingOwner::class)->create([
+            'owner_id'=>factory(Owner::class)->create(['user_owner_group_id'=>null,'code'=>'WANLING'])->id,
+            'status'=>'启用']);
     }
 
-    public function testGetWmsOrderOnstartDateCreate()
+    /**
+     * @test
+     */
+    public function getWmsOrderOnStartDateCreate()
     {
         $carbon =Carbon::now()->subHours(10);
         $orderHeaders = $this->service->getWmsOrderOnStartDateCreate($carbon);

+ 7 - 2
tests/Services/OrderCountingRecordService/DateTestTest.php

@@ -11,8 +11,13 @@ use Tests\TestCase;
 
 class DateTestTest extends TestCase
 {
-    public function test01()
+    /**
+     * @test
+     */
+    public function carbon_date_equals()
     {
-        $this->assertTrue(true);
+        $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);
     }
 }

+ 7 - 14
tests/Services/OrderIssueService/GetRecycleBinPaginateTest.php

@@ -5,11 +5,11 @@ namespace Tests\Services\OrderIssueService;
 use App\OrderIssue;
 use App\Services\OrderIssueService;
 use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
 use Tests\TestCase;
 
 class GetRecycleBinPaginateTest extends TestCase
 {
+    use RefreshDatabase;
     /**
      * @var OrderIssueService $service
      */
@@ -19,24 +19,17 @@ class GetRecycleBinPaginateTest extends TestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $this->service = app('OrderIssueService');
-        $orderIssues = $this->service->getRecycleBinPaginate([]);
-        if($orderIssues->count() == 0){
-            $orderIssue = OrderIssue::query()->create([
-                'is_new_rejecting' => '无',
-                'rejecting_status' => '无',
-                'imported_status' => '正常',
-            ]);
-            $data['orderIssue'] = $orderIssue;
-            $orderIssue->delete();
-        }
+        $orderIssue = factory(OrderIssue::class)->create([
+            'is_new_rejecting' => '无',
+            'rejecting_status' => '无',
+            'imported_status' => '正常',
+        ]);
+        $orderIssue->delete();
     }
 
     public function testGetRecycleBinPaginate()
     {
         $orderIssue = $this->service->getRecycleBinPaginate([]);
         $this->assertNotEmpty($orderIssue);
-        if(isset($data['orderIssue'])){
-            $data['orderIssue']->delete();
-        }
     }
 }

+ 19 - 5
tests/Services/OrderIssueService/OrderIssueTagTest.php

@@ -3,12 +3,17 @@
 namespace Tests\Services\OrderIssueService\OrderIssueTagTest;
 
 use App\OracleDOCOrderHeader;
+use App\Order;
+use App\OrderIssue;
+use App\OrderPackage;
 use App\Services\OrderIssueService;
 use Carbon\Carbon;
+use Illuminate\Foundation\Testing\RefreshDatabase;
 use Tests\TestCase;
 
 class OrderIssueTagTest extends TestCase
 {
+    use RefreshDatabase;
     /** @var OrderIssueService $service */
     public $service;
     public function setUp(): void
@@ -19,16 +24,25 @@ class OrderIssueTagTest extends TestCase
 
     public function testOrderIssueTag()
     {
-
-        $orderHeader = OracleDOCOrderHeader::query()->orderByDesc('AddTime')->first();
-        $addtime = $orderHeader->addtime;
-        $addtime = Carbon::parse((string)$addtime)->subMinutes(30);
+        $orderHeader = OracleDOCOrderHeader::query()->where('sostatus',99)->orderByDesc('AddTime')->first();
         $orderNos = OracleDOCOrderHeader::query()
-            ->where('AddTime','>=',$addtime)
+            ->where('AddTime','>=',$orderHeader->addtime)
+            ->where('sostatus',99)
             ->get()
             ->map(function($orderHeader){
                 return $orderHeader->orderno;
             });
+        $orderNo_arr = collect($orderNos)->chunk(5)->toArray();
+        $orderNos  = $orderNo_arr[0];
         $this->assertNotNull($orderNos);
+        $arr = [];
+        $arr['orderNos'] = $orderNos;
+        $arr['typeId'] = 0;
+        $arr['result_explain'] = '';
+        $this->service->orderIssueTag($arr);
+        $orderIssue = OrderIssue::query()->whereHas('order',function($query)use($orderNos){
+            $query->whereIn('code',$orderNos);
+        })->get();
+        $this->assertEquals($orderIssue->count(),count($orderNos));
     }
 }

+ 3 - 8
tests/Services/OrderIssueService/RecoverOrderIssueTest.php

@@ -10,6 +10,7 @@ use Tests\TestCase;
 
 class RecoverOrderIssueTest extends TestCase
 {
+    use RefreshDatabase;
     /**
      * @var OrderIssueService $service
      */
@@ -20,13 +21,8 @@ class RecoverOrderIssueTest extends TestCase
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $this->service = app('OrderIssueService');
-        $orderIssue = OrderIssue::query()->create([
-            'is_new_rejecting' => '无',
-            'rejecting_status' => '无',
-            'imported_status' => '正常',
-        ]);
-        $this->data['orderIssue'] = $orderIssue;
-        $orderIssue->delete();
+        $this->data['orderIssue'] = factory(OrderIssue::class)->create();
+        $this->data['orderIssue']->delete();
     }
 
     public function testRecoverOrderIssue()
@@ -35,6 +31,5 @@ class RecoverOrderIssueTest extends TestCase
         $this->service->recoverOrderIssue($ids);
         $orderIssue = OrderIssue::query()->where('id',$ids[0])->first();
         $this->assertNotEmpty($orderIssue);
-        $orderIssue->forceDelete();
     }
 }

+ 21 - 18
tests/Services/OrderPackageCommoditiesService/RegroupOrderCommoditiesTest.php

@@ -2,11 +2,13 @@
 
 namespace Tests\Services\OrderPackageCommoditiesService\RegroupOrderCommoditiesTest;
 
+use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderPackage;
 use App\OrderPackageCommodities;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageCommoditiesService;
+use App\Services\OrderService;
 use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
 use Illuminate\Foundation\Testing\WithFaker;
@@ -14,46 +16,49 @@ use Tests\TestCase;
 
 class RegroupOrderCommoditiesTest extends TestCase
 {
+    use RefreshDatabase;
+
     /**
      * @var OrderPackageCommoditiesService $service
      * @var OracleDOCOrderHeaderService $orderHeaderService
+     * @var OrderService $orderService
      */
-    public $service;
-    public $orderHeaderService;
+    private $service;
+    private $orderHeaderService;
+    private $orderService;
 
     public function setUp(): void
     {
         parent::setUp();
         $this->service = app('OrderPackageCommoditiesService');
+        $this->orderService = app('OrderService');
         $this->orderHeaderService = app('OracleDocOrderHeaderService');
     }
 
     public function testRegroupOrderCommodities()
     {
-        /*
-        * createOrderPackage($orderHeaders,$orders,$packages)
-        * */
-        $carbon =Carbon::now()->subHours(10);
-        $date = '2020-06-18 18:13:50';
-        $orderHeaders = $this->orderHeaderService->getWMSOrderOnStartDate($date);
-        if($orderHeaders->count()==0){
-            return;
+        $orderHeader = OracleDOCOrderHeader::query()->where('sostatus',99)->orderByDesc('AddTime')->first();
+        if(!$orderHeader){
+            $this->assertNull($orderHeader);
+            return ;
         }
-        $order_nos = Order::all()->map(function($order){
-            return $order->code;
-        });
+
+        $orderHeaders = OracleDOCOrderHeader::query()->where('sostatus',99)
+            ->where('addtime','>=',$orderHeader->addtime)
+            ->get();
+
+        $this->orderService->syncOrder($orderHeaders);
         $order_nos = data_get($orderHeaders,'*.orderno');
         $order_commodities = OrderPackageCommodities::query()->with(['commodity','package.order'])->whereHas('package',function($query)use($order_nos){
             $query->whereHas('order',function ($query)use($order_nos){
                 $query->whereIn('code',$order_nos);
             });
         })->get();
-        $orders = Order::query()->whereIn('code',$order_nos)->get();
-
 
-        $order = Order::query()->whereIn('code',$order_nos)->sql();
         $params = $this->service->regroupOrderCommodities($order_commodities);
+
         $_params = [];
+
         $orderHeaders->each(function($order_header)use(&$_params){
             $order_header->actAllocationDetails->each(function($detail)use(&$_params){
                 $order_no = $detail->orderno;
@@ -73,10 +78,8 @@ class RegroupOrderCommoditiesTest extends TestCase
                 }
             });
         });
-
         foreach ($_params as $key=>$param) {
             $this->assertNotEmpty($params[$key]);
         }
-
     }
 }

+ 0 - 33
tests/Services/OrderPackageCommoditiesService/SyncOrderPackageCommoditiesTest.php

@@ -1,33 +0,0 @@
-<?php
-
-namespace Tests\Services\OrderPackageService\SyncOrderPackageCommoditiesTest;
-
-use App\Services\OracleDOCOrderHeaderService;
-use App\Services\OrderPackageCommoditiesService;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
-use Tests\TestCase;
-
-class SyncOrderPackageCommoditiesTest extends TestCase
-{
-    /**
-     * @var OrderPackageCommoditiesService $service
-     * @var OracleDOCOrderHeaderService $orderHeaderService
-     */
-    public $service;
-    public $orderHeaderService;
-
-    public function setUp(): void
-    {
-        parent::setUp();
-        $this->service = app('OrderPackageCommoditiesService');
-        $this->orderHeaderService = app('OracleDocOrderHeaderService');
-    }
-
-    public function testExample()
-    {
-        $response = $this->get('/');
-
-        $response->assertStatus(200);
-    }
-}

+ 0 - 28
tests/Services/OrderPackageService/DeleteUnnecessaryPackageTest.php

@@ -1,28 +0,0 @@
-<?php
-
-namespace Tests\Services\OrderPackageService\DeleteUnnecessaryPackageTest;
-
-use App\Services\OracleDOCOrderHeaderService;
-use App\Services\OrderPackageService;
-use App\Services\OrderService;
-use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
-use Tests\TestCase;
-
-class DeleteUnnecessaryPackageTest extends TestCase
-{
-    /**
-     * @var OrderPackageService $service
-     * @var OracleDOCOrderHeaderService $orderHeaderService
-     */
-    public $service;
-    public $orderHeaderService;
-
-    public function setUp(): void
-    {
-        parent::setUp();
-        $this->service = app('OrderPackageService');
-        $this->orderHeaderService = app('OracleDOCOrderHeaderService');
-    }
-
-}

+ 22 - 4
tests/Services/OrderPackageService/GetInnerParamsTest.php

@@ -2,17 +2,21 @@
 
 namespace Tests\Services\OrderPackageSerivce\GetInnerParamsTest;
 
+use App\Logistic;
 use App\OracleDOCOrderHeader;
 use App\Order;
+use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageService;
 use App\Services\OrderService;
+use App\Shop;
 use Illuminate\Foundation\Testing\RefreshDatabase;
 use Illuminate\Foundation\Testing\WithFaker;
 use Tests\TestCase;
 
 class GetInnerParamsTest extends TestCase
 {
+    use RefreshDatabase;
     /**
      * @var OrderPackageService $service
      * @var OracleDOCOrderHeaderService $orderHeaderService
@@ -27,13 +31,27 @@ class GetInnerParamsTest extends TestCase
         parent::setUp();
         $this->service = app('OrderPackageService');
         $this->orderService = app('OrderService');
-        $this->orderHeaderService = app('OracleDOCOrderHeaderService');
+        $this->orderHeaderService = app('OracleDocOrderHeaderService');
     }
-    public function testGetInnerParamsTest()
+
+    /**
+     * @test
+     */
+    public function getInnerParamsTest()
     {
-        $orderHeader = OracleDOCOrderHeader::query()->with('actAllocationDetails')->orderByDesc('AddTime')->first();
+        $orderHeader = OracleDOCOrderHeader::query()
+            ->with('actAllocationDetails')
+            ->where('sostatus',99)
+            ->orderByDesc('AddTime')->first();
+        Logistic::query()->firstOrCreate(['code'=>$orderHeader->userdefine1,'name'=>'']);
+        $owner = Owner::query()->firstOrCreate(['code'=>$orderHeader->customerid,'name'=>'']);
+        Shop::query()->firstOrCreate(['name'=>$orderHeader->issuepartyname ?? '','owner_id'=>$owner->id]);
+        app('WarehouseService')->firstOrCreate(["code"=>$orderHeader->warehouseid],["code"=>$orderHeader->warehouseid,"name"=>$orderHeader->warehouseid]);
+        $orderHeaders = collect();
+        $orderHeaders = $orderHeaders->push($orderHeader);
+        $this->orderService->syncOrder($orderHeaders);
         $order = Order::query()->where('code',$orderHeader->orderno)->first();
-        $inner_params = $this->service->getInnerParams($orderHeader,$order,[]);
+        $inner_params = $this->service->getInnerParams($orderHeader,$order,['mapkey'=>['logistic_number']]);
         $this->assertNotEmpty($inner_params);
         $actAllocationDetails = $orderHeader->actAllocationDetails;
 

+ 23 - 12
tests/Services/OrderPackageService/SyncOrderPackageTest.php

@@ -2,6 +2,7 @@
 
 namespace Tests\Services\OrderPackageService\SyncOrderPackageTest;
 
+use App\OracleDOCOrderHeader;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageService;
 use App\Services\OrderService;
@@ -12,6 +13,8 @@ use Tests\TestCase;
 
 class SyncOrderPackageTest extends TestCase
 {
+    use RefreshDatabase;
+
     /**
      * @var OrderPackageService $service
      * @var OracleDOCOrderHeaderService $orderHeaderService
@@ -26,20 +29,28 @@ class SyncOrderPackageTest extends TestCase
         parent::setUp();
         $this->service = app('OrderPackageService');
         $this->orderService = app('OrderService');
-        $this->orderHeaderService = app('OracleDOCOrderHeaderService');
+        $this->orderHeaderService = app('OracleDocOrderHeaderService');
     }
-    public function testSyncOrderPackage()
-    {
-        /*
-       * createOrderPackage($orderHeaders,$orders,$packages)
-       * */
 
-        $carbon =Carbon::now()->subHours(10);
-        $date = '2020-09-18 18:13:50';
-        $orderHeaders = $this->orderHeaderService->getWMSOrderOnStartDate($carbon);
-        if($orderHeaders->count()==0){
-            return;
-        }
+    /**
+     * @test
+     */
+    public function syncOrderPackage()
+    {
+        $orderHeader = OracleDOCOrderHeader::query()->orderByDesc('addTime')->first();
+        $orderHeaders = 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','>=',$orderHeader->addtime)
+            ->orderByDesc('DOC_Order_Header.addTime')
+            ->get();
         $orders = $this->orderService->getByWmsOrders($orderHeaders);
         $packages = $this->service->getByWmsOrders($orderHeaders);
         $this->service->syncOrderPackage($orderHeaders,$orders,$packages);

+ 27 - 7
tests/Services/OrderPackageService/SyncPackageByOrderHeadersTest.php

@@ -2,16 +2,20 @@
 
 namespace Tests\Services\OrderPackageService\SyncPackageByOrderHeadersTest;
 
+use App\Logistic;
+use App\OracleDOCOrderHeader;
+use App\Owner;
 use App\Services\OracleDOCOrderHeaderService;
 use App\Services\OrderPackageService;
 use App\Services\OrderService;
-use Carbon\Carbon;
+use App\Shop;
 use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
 use Tests\TestCase;
 
 class SyncPackageByOrderHeadersTest extends TestCase
 {
+    use RefreshDatabase;
+
     /**
      * @var OrderPackageService $service
      * @var OracleDOCOrderHeaderService $orderHeaderService
@@ -26,25 +30,41 @@ class SyncPackageByOrderHeadersTest extends TestCase
         parent::setUp();
         $this->service = app('OrderPackageService');
         $this->orderService = app('OrderService');
-        $this->orderHeaderService = app('OracleDOCOrderHeaderService');
+        $this->orderHeaderService = app('OracleDocOrderHeaderService');
     }
     public function testSyncPackageByOrderHeaders()
     {
         /**
          * createOrDeletePackageByOrderHeader($orderHeaders)
          */
-        $carbon = Carbon::now()->subHours(10);
-        $date = '2020-09-18 18:13:50';
-        $orderHeaders = $this->orderHeaderService->getWMSOrderOnStartDate($carbon);
+        $orderHeader = OracleDOCOrderHeader::query()
+            ->with('actAllocationDetails')
+            ->where('sostatus',99)
+            ->orderByDesc('AddTime')
+            ->first();
+
+        $orderHeaders = OracleDOCOrderHeader::query()
+            ->with('actAllocationDetails')
+            ->where('sostatus',99)
+            ->where('addtime','>=',$orderHeader->addtime)
+            ->orderByDesc('AddTime')
+            ->get();
+
         if ($orderHeaders->count() == 0) {
+            $this->assertNull($orderHeaders);
             return;
         }
+
+        Logistic::query()->firstOrCreate(['code'=>$orderHeader->userdefine1,'name'=>'']);
+        $owner = Owner::query()->firstOrCreate(['code'=>$orderHeader->customerid,'name'=>'']);
+        Shop::query()->firstOrCreate(['name'=>$orderHeader->issuepartyname,'owner_id'=>$owner->id]);
+        app('WarehouseService')->firstOrCreate(["code"=>$orderHeader->warehouseid],["code"=>$orderHeader->warehouseid,"name"=>$orderHeader->warehouseid]);
+        $this->orderService->syncOrderByWMSOrderHeaders($orderHeaders);
         $this->service->syncPackageByOrderHeaders($orderHeaders);
         $packages = $this->service->getByWmsOrders($orderHeaders);
         $order_nos = array_unique(data_get($orderHeaders, '*.actAllocationDetails.*.picktotraceid'));
         foreach ($order_nos as $order_no) {
             $this->assertNotEmpty($packages->where('logistic_number', $order_no));
-
         }
     }
 }

+ 8 - 11
tests/Services/OrderService/CreateOrFindOrderInfoTest.php

@@ -4,37 +4,34 @@ namespace Tests\Services\OrderService;
 
 use App\OracleDOCOrderHeader;
 use App\Order;
-use App\Owner;
 use App\Services\OrderService;
-use Carbon\Carbon;
 use Illuminate\Foundation\Testing\RefreshDatabase;
-use Illuminate\Foundation\Testing\WithFaker;
-use Illuminate\Support\Str;
 use Tests\TestCase;
 
 class CreateOrFindOrderInfoTest extends TestCase
 {
+    use RefreshDatabase;
 
     /**
      * @var OrderService $orderService
      */
     public $orderService;
     public $data = [];
-    public $order ;
+    public $order;
+
     public function setUp(): void
     {
         parent::setUp(); // TODO: Change the autogenerated stub
         $this->orderService = app('OrderService');
-        $this->data['orderHeader'] = OracleDOCOrderHeader::query()->orderBy('addTime')->first();
     }
+
     public function testCreateOrFindOrderInfo()
     {
-        $this->orderService->createOrFindOrderInfo($this->data['orderHeader']);
-        $order =Order::query()->where('code',$this->data['orderHeader']['orderno'])->first();
+        $orderHeader =  OracleDOCOrderHeader::query()->orderByDesc('addTime')->first();
+        $this->orderService->createOrFindOrderInfo($orderHeader);
+        $order = Order::query()->where('code',$orderHeader->orderno)->first();
         $this->assertNotNull($order);
-        $this->order = $order;
-        $this->assertEquals($order->code,$this->data['orderHeader']['orderno']);
-        $this->order->delete();
+        $this->assertEquals($order->code,$orderHeader->orderno);
     }
 
 }

Some files were not shown because too many files changed in this diff