Jelajahi Sumber

迁移整理与PHP版本错误BUG纠正

Zhouzhendong 4 tahun lalu
induk
melakukan
3a41e7606c
45 mengubah file dengan 87 tambahan dan 908 penghapusan
  1. 2 2
      app/Jobs/CacheShelfTaskJob.php
  2. 1 1
      database/migrations/2019_11_22_094213_create_units_table.php
  3. 0 37
      database/migrations/2020_06_29_111337_add_unit_jian_tuo.php
  4. 4 1
      database/migrations/2020_07_29_164130_create_order_issue_types_table.php
  5. 0 9
      database/migrations/2020_08_28_134321_change_ids_of_tables_not_int.php
  6. 0 14
      database/migrations/2020_09_11_115414_change_labor_reports_labor_company_to_labor_company_id.php
  7. 3 19
      database/migrations/2020_09_20_142656_change_order_issue.php
  8. 0 2
      database/migrations/2020_10_12_105209_add_order_track_order_code.php
  9. 0 11
      database/migrations/2020_10_14_112825_add_order_issue_second_client_no.php
  10. 0 358
      database/migrations/2020_10_19_113042_create_logistic_timings_table.php
  11. 0 2
      database/migrations/2020_10_22_102316_change_order_issues_table.php
  12. 0 2
      database/migrations/2020_10_23_101444_change_order_issues_tabel.php
  13. 0 33
      database/migrations/2020_11_02_201426_add_logisties_item_xjwldf.php
  14. 0 2
      database/migrations/2020_11_16_142745_add_soft_delete_to_order_issues.php
  15. 0 2
      database/migrations/2020_11_18_142512_add_finance_confirm_to_order_issue_and_add_auth.php
  16. 19 34
      database/migrations/2020_11_23_143145_seed_value_stores_table.php
  17. 0 2
      database/migrations/2020_11_30_133112_save_value_store_data_date.php
  18. 9 3
      database/migrations/2020_11_30_140957_create_station_types_table.php
  19. 8 10
      database/migrations/2020_11_30_140958_create_stations_table.php
  20. 4 1
      database/migrations/2020_11_30_151800_create_station_task_batch_types_table.php
  21. 0 2
      database/migrations/2020_11_30_153512_add_column_outer_table_owner_fee_details.php
  22. 7 2
      database/migrations/2020_12_03_144334_add_monitor_default_station_and_station_hardware_id_column.php
  23. 0 3
      database/migrations/2020_12_14_103401_create_customerlogstatuses_table.php
  24. 0 36
      database/migrations/2020_12_22_143202_change_column_order_id_to_order_issues.php
  25. 0 40
      database/migrations/2020_12_23_174008_add_column_logistic_id_to_order_trackings.php
  26. 2 3
      database/migrations/2020_12_28_160507_change_inventory_compares_quality_column.php
  27. 0 10
      database/migrations/2020_12_29_182249_change_station_rule_batch_column_default_batch_type.php
  28. 0 11
      database/migrations/2021_01_07_092258_create_order_issue_rejected_bill_table.php
  29. 0 32
      database/migrations/2021_01_15_175210_sync_order_issue_user_workgroup.php
  30. 0 29
      database/migrations/2021_01_19_151928_fix_order_package_status.php
  31. 0 24
      database/migrations/2021_01_20_145822_add_owner_id_to_order_packages.php
  32. 0 2
      database/migrations/2021_01_21_100909_add_created_at_index_order_packages.php
  33. 0 32
      database/migrations/2021_01_29_161734_add_units_data.php
  34. 2 1
      database/migrations/2021_03_06_090856_create_tax_rates_table.php
  35. 14 12
      database/migrations/2021_03_23_140544_add_configurations_data.php
  36. 0 1
      database/migrations/2021_04_06_155509_add_exception_message_to_order_packages_table.php
  37. 0 1
      database/migrations/2021_04_07_155234_add_exception_type_order_packages_table.php
  38. 10 19
      database/migrations/2021_04_13_140632_add_station_type_and_add_station.php
  39. 0 1
      database/migrations/2021_04_24_091321_change_delivery_appointments_table_add_logistic_number_column.php
  40. 0 28
      database/migrations/2021_04_29_133306_drop_station_cache_shelf_grips_table.php
  41. 1 0
      database/migrations/2021_05_27_103720_create_ownersundryfeedetails_table.php
  42. 0 28
      database/migrations/2021_05_31_140957_create_station_types2_table.php
  43. 0 2
      database/migrations/2021_06_03_171554_create_material_box_models_table.php
  44. 0 43
      database/migrations/2021_06_18_093536_add__authority_discharge_task_authority.php
  45. 1 1
      routes/web.php

+ 2 - 2
app/Jobs/CacheShelfTaskJob.php

@@ -15,8 +15,8 @@ class CacheShelfTaskJob implements ShouldQueue
 {
     use Dispatchable, InteractsWithQueue, Queueable;
 
-    protected string $key;
-    protected int $count;
+    protected $key;
+    protected $count;
     /**
      * Create a new job instance.
      *

+ 1 - 1
database/migrations/2019_11_22_094213_create_units_table.php

@@ -7,7 +7,7 @@ use Illuminate\Support\Facades\DB;
 
 class CreateUnitsTable extends Migration
 {
-    protected $units = ['kg','m³','T'];
+    protected $units = ['kg','m³','T','件', '托',"箱",'单',"日","月","m²","年"];
     /**
      * Run the migrations.
      *

+ 0 - 37
database/migrations/2020_06_29_111337_add_unit_jian_tuo.php

@@ -1,37 +0,0 @@
-<?php
-
-use App\Unit;
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class AddUnitJianTuo extends Migration
-{
-    protected $names=[
-        '件',
-        '托',
-    ];
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        foreach ($this->names as $name){
-            if(!Unit::where('name',$name)->first())(new Unit(['name'=>$name]))->save();
-        }
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        foreach ($this->names as $name){
-            Unit::where('name',$name)->delete();
-        }
-    }
-}

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

@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class CreateOrderIssueTypesTable extends Migration
@@ -38,7 +39,9 @@ class CreateOrderIssueTypesTable extends Migration
         });
 
         foreach ($this->types as $type){
-            \App\OrderIssueType::create(['name'=>$type]);
+           DB::insert(DB::raw("INSERT INTO order_issue_types(name,created_at,updated_at) VALUES(?,?,?)"),[
+               $type,date("Y-m-d"),date("Y-m-d")
+           ]);
         }
     }
 

+ 0 - 9
database/migrations/2020_08_28_134321_change_ids_of_tables_not_int.php

@@ -35,13 +35,4 @@ class ChangeIdsOfTablesNotInt extends Migration
             $table->bigInteger('owner_id')->change();
         });
     }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-    }
 }

+ 0 - 14
database/migrations/2020_09_11_115414_change_labor_reports_labor_company_to_labor_company_id.php

@@ -16,13 +16,6 @@ class ChangeLaborReportsLaborCompanyToLaborCompanyId extends Migration
         Schema::table('labor_reports', function (Blueprint $table) {
             $table->bigInteger('labor_company_id')->nullable()->index()->comment('劳务所');
         });
-        $laborReports=\App\LaborReport::query()->get();
-        foreach ($laborReports as $laborReport){
-            $laborCompanyId=\App\LaborCompany::query()->where('name',$laborReport->labor_company)->value('id');
-            $laborReport->update([
-                $laborReport->labor_company_id=$laborCompanyId
-            ]);
-        }
         Schema::table('labor_reports', function (Blueprint $table) {
             $table->dropColumn('labor_company');
         });
@@ -38,13 +31,6 @@ class ChangeLaborReportsLaborCompanyToLaborCompanyId extends Migration
         Schema::table('labor_reports', function (Blueprint $table) {
             $table->string('labor_company')->nullable()->comment('劳务所');
         });
-        $laborReports=\App\LaborReport::query()->get();
-        foreach ($laborReports as $laborReport){
-            $laborCompanyName=\App\LaborCompany::query()->where('id',$laborReport->labor_company_id)->value('name');
-            $laborReport->update([
-                $laborReport->labor_company=$laborCompanyName
-            ]);
-        }
         Schema::table('labor_reports', function (Blueprint $table) {
             $table->dropColumn('labor_company_id');
         });

+ 3 - 19
database/migrations/2020_09_20_142656_change_order_issue.php

@@ -17,16 +17,6 @@ class ChangeOrderIssue extends Migration
         Schema::table('order_issues',function (Blueprint $table) {
             $table->string('logistic_number_return')->nullable()->index()->after('order_id');
         });
-
-        $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]);
-                }
-            }
-        }
     }
 
     /**
@@ -36,14 +26,8 @@ class ChangeOrderIssue extends Migration
      */
     public function down()
     {
-        $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');
+        });
     }
 }

+ 0 - 2
database/migrations/2020_10_12_105209_add_order_track_order_code.php

@@ -13,7 +13,6 @@ class AddOrderTrackOrderCode extends Migration
      */
     public function up()
     {
-        //
         Schema::table('order_trackings', function (Blueprint $table) {
             $table->string('order_client_code')->nullable()->index()->comment('订单号')->after('web_order_number');
         });
@@ -26,7 +25,6 @@ class AddOrderTrackOrderCode extends Migration
      */
     public function down()
     {
-        //
         Schema::table('order_trackings', function (Blueprint $table) {
             $table->dropColumn('order_client_code');
         });

+ 0 - 11
database/migrations/2020_10_14_112825_add_order_issue_second_client_no.php

@@ -14,19 +14,9 @@ class AddOrderIssueSecondClientNo extends Migration
      */
     public function up()
     {
-        //
         Schema::table('order_issues', function (Blueprint $table) {
             $table->string('second_client_no')->index()->nullable()->comment('二次客户订单号')->after('second_order_id');
         });
-        $orderIssues = \App\OrderIssue::query()->withTrashed()->whereNotNull('second_order_id')->get();
-        if($orderIssues->count() > 0){
-            foreach ($orderIssues as $orderIssue) {
-                $order = $orderIssue->hasOne('App\Order', 'id', 'second_order_id')->first();
-                if($order ?? false){
-                    $orderIssue->update(['second_client_no'=>$order->client_code ?? null]);
-                }
-            }
-        }
     }
 
     /**
@@ -36,7 +26,6 @@ class AddOrderIssueSecondClientNo extends Migration
      */
     public function down()
     {
-        //
         Schema::table('order_issues',function(Blueprint $table){
             $table->dropColumn('second_client_no');
         });

+ 0 - 358
database/migrations/2020_10_19_113042_create_logistic_timings_table.php

@@ -25,7 +25,6 @@ class CreateLogisticTimingsTable extends Migration
             $table->integer('days_at_working')->nullable()->comment('工作日用日');
             $table->timestamps();
         });
-        $this->addLogisticTiming();
     }
 
     /**
@@ -37,361 +36,4 @@ class CreateLogisticTimingsTable extends Migration
     {
         Schema::dropIfExists('logistic_timings');
     }
-
-    public function addLogisticTiming()
-    {
-        $create_array = [];
-        $map = $this->getMap();
-        $logistic=Logistic::firstOrCreate(['name'=>'顺丰特惠','code'=>'SFTH']);
-        $time = \Carbon\Carbon::now()->format('Y-m-d H:i:s');
-        foreach ($map as $item) {
-            $provinceName = $item[0];
-            $cityName = $item[1];
-            $days_at_working = $item[2];
-            $province =  Province::query()->firstOrCreate(['name'=>$provinceName]);
-            $city = City::query()->where('name',$cityName)->first();
-            if($city){
-                $city->province_id = $province->id;
-                $city->save();
-            }else{
-                $city = City::query()->firstOrCreate(['province_id'=>$province->id,'name'=>$cityName] );
-            }
-            $logisticTiming = LogisticTiming::query()->where('to_province_id',$province->id)->where('to_city_id',$city->id)->count();
-            if($logisticTiming>0){continue;}
-            $create_array[] = [
-                'logistic_id' => $logistic->id,
-                'to_province_id' => $province->id,
-                'to_city_id' => $city->id,
-                'days_at_working' => $days_at_working,
-                'created_at' => $time,
-                'updated_at' => $time
-            ];
-        }
-        $inner_param = array_chunk($create_array,100);
-        foreach ($inner_param as $item) {
-            LogisticTiming::query()->insert($item);
-        }
-    }
-
-    public function getMap()
-    {
-        return [['北京','北京','4','5'],
-            ['广东','广州','4','5'],
-            ['上海','上海','2','3'],
-            ['天津','天津','4','5'],
-            ['重庆','重庆','4','5'],
-            ['辽宁','沈阳','4','5'],
-            ['江苏','南京','2','3'],
-            ['湖北','武汉','4','5'],
-            ['四川','成都','5','6'],
-            ['陕西','西安','4','5'],
-            ['贵州','遵义','5','6'],
-            ['贵州','安顺','5','6'],
-            ['云南','泸水','5','6'],
-            ['云南','丽江','5','6'],
-            ['河北','邯郸','4','5'],
-            ['河北','石家庄','4','5'],
-            ['河北','保定','4','5'],
-            ['河北','张家口','4','5'],
-            ['河北','承德','4','5'],
-            ['河北','唐山','4','5'],
-            ['河北','廊坊','4','5'],
-            ['河北','沧州','4','5'],
-            ['河北','衡水','5','6'],
-            ['河北','邢台','4','5'],
-            ['河北','秦皇岛','4','5'],
-            ['山西','朔州','5','6'],
-            ['山西','忻州','4','5'],
-            ['山西','太原','4','5'],
-            ['山西','大同','4','5'],
-            ['山西','阳泉','4','5'],
-            ['山西','晋中','4','5'],
-            ['山西','长治','4','5'],
-            ['山西','晋城','4','5'],
-            ['山西','临汾','5','6'],
-            ['山西','吕梁','4','5'],
-            ['山西','运城','4','5'],
-            ['河南','商丘','3','4'],
-            ['河南','郑州','4','5'],
-            ['河南','安阳','4','5'],
-            ['河南','新乡','4','5'],
-            ['河南','许昌','4','5'],
-            ['河南','平顶山','4','5'],
-            ['河南','信阳','3','4'],
-            ['河南','南阳','4','5'],
-            ['河南','开封','4','5'],
-            ['河南','洛阳','4','5'],
-            ['河南','焦作','4','5'],
-            ['河南','鹤壁','4','5'],
-            ['河南','濮阳','4','5'],
-            ['河南','周口','3','4'],
-            ['河南','漯河','4','5'],
-            ['河南','驻马店','4','5'],
-            ['河南','三门峡','4','5'],
-            ['辽宁','大连','4','5'],
-            ['辽宁','鞍山','5','6'],
-            ['辽宁','本溪','5','6'],
-            ['辽宁','丹东','5','6'],
-            ['辽宁','锦州','4','5'],
-            ['辽宁','营口','5','6'],
-            ['辽宁','阜新','6','7'],
-            ['辽宁','辽阳','4','5'],
-            ['辽宁','朝阳','5','6'],
-            ['辽宁','盘锦','5','6'],
-            ['辽宁','葫芦岛','4','5'],
-            ['吉林','长春','4','5'],
-            ['吉林','吉林','5','6'],
-            ['吉林','延吉','5','6'],
-            ['吉林','四平','5','6'],
-            ['吉林','通化','5','6'],
-            ['吉林','白城','5','6'],
-            ['吉林','辽源','5','6'],
-            ['吉林','松原','5','6'],
-            ['吉林','白山','5','6'],
-            ['黑龙江','哈尔滨','5','6'],
-            ['黑龙江','齐齐哈尔','5','6'],
-            ['黑龙江','牡丹江','5','6'],
-            ['黑龙江','佳木斯','5','6'],
-            ['黑龙江','绥化','5','6'],
-            ['黑龙江','黑河','6','7'],
-            ['黑龙江','大兴安岭','6','7'],
-            ['黑龙江','伊春','5','6'],
-            ['黑龙江','大庆','5','6'],
-            ['黑龙江','七台河','5','6'],
-            ['黑龙江','鸡西','6','7'],
-            ['黑龙江','鹤岗','6','7'],
-            ['黑龙江','双鸭山','6','7'],
-            ['内蒙古','呼伦贝尔','6','7'],
-            ['内蒙古','呼和浩特','5','6'],
-            ['内蒙古','包头','5','6'],
-            ['内蒙古','乌海','5','6'],
-            ['内蒙古','乌兰察布','5','6'],
-            ['内蒙古','通辽','5','6'],
-            ['内蒙古','赤峰','4','5'],
-            ['内蒙古','鄂尔多斯','5','6'],
-            ['内蒙古','巴彦淖尔','5','6'],
-            ['内蒙古','锡林浩特','5','6'],
-            ['内蒙古','乌兰浩特','5','6'],
-            ['内蒙古','阿拉善','4','5'],
-            ['江苏','无锡','2','3'],
-            ['江苏','镇江','2','3'],
-            ['江苏','苏州','2','3'],
-            ['江苏','南通','2','3'],
-            ['江苏','扬州','2','3'],
-            ['江苏','盐城','2','3'],
-            ['江苏','徐州','2','3'],
-            ['江苏','淮安','2','3'],
-            ['江苏','连云港','2','3'],
-            ['江苏','常州','2','3'],
-            ['江苏','泰州','2','3'],
-            ['江苏','宿迁','2','3'],
-            ['山东','菏泽','4','5'],
-            ['山东','济南','4','5'],
-            ['山东','青岛','3','4'],
-            ['山东','淄博','4','5'],
-            ['山东','德州','4','5'],
-            ['山东','烟台','4','5'],
-            ['山东','潍坊','4','5'],
-            ['山东','济宁','3','4'],
-            ['山东','泰安','3','4'],
-            ['山东','临沂','3','4'],
-            ['山东','滨州','4','5'],
-            ['山东','东营','4','5'],
-            ['安徽','滁州','3','4'],
-            ['安徽','合肥','3','4'],
-            ['安徽','蚌埠','3','4'],
-            ['安徽','芜湖','3','4'],
-            ['安徽','淮南','3','4'],
-            ['安徽','马鞍山','3','4'],
-            ['安徽','安庆','3','4'],
-            ['安徽','宿州','3','4'],
-            ['安徽','阜阳','3','4'],
-            ['安徽','黄山','3','4'],
-            ['安徽','淮北','3','4'],
-            ['安徽','铜陵','3','4'],
-            ['安徽','宣城','3','4'],
-            ['安徽','六安','3','4'],
-            ['安徽','池州','3','4'],
-            ['浙江','衢州','2','3'],
-            ['浙江','杭州','2','3'],
-            ['浙江','湖州','2','3'],
-            ['浙江','嘉兴','2','3'],
-            ['浙江','宁波','2','3'],
-            ['浙江','绍兴','2','3'],
-            ['浙江','台州','2','3'],
-            ['浙江','温州','2','3'],
-            ['浙江','丽水','2','3'],
-            ['浙江','金华','2','3'],
-            ['浙江','舟山','2','3'],
-            ['福建','福州','3','4'],
-            ['福建','厦门','4','5'],
-            ['福建','宁德','3','4'],
-            ['福建','莆田','4','5'],
-            ['福建','泉州','4','5'],
-            ['福建','漳州','4','5'],
-            ['福建','龙岩','4','5'],
-            ['福建','三明','4','5'],
-            ['福建','南平','3','4'],
-            ['山东','威海','4','5'],
-            ['山东','枣庄','3','4'],
-            ['山东','日照','3','4'],
-            ['山东','聊城','4','5'],
-            ['广东','汕尾','4','5'],
-            ['广东','阳江','4','5'],
-            ['广东','揭阳','4','5'],
-            ['广东','茂名','6','7'],
-            ['云南','景洪','5','6'],
-            ['云南','瑞丽','6','7'],
-            ['江西','鹰潭','3','4'],
-            ['湖北','襄阳','4','5'],
-            ['湖北','鄂州','3','4'],
-            ['湖北','孝感','4','5'],
-            ['湖北','黄冈','3','4'],
-            ['湖北','黄石','3','4'],
-            ['湖北','咸宁','4','5'],
-            ['湖北','荆州','4','5'],
-            ['湖北','宜昌','4','5'],
-            ['湖北','恩施','4','5'],
-            ['湖北','十堰','4','5'],
-            ['湖北','随州','4','5'],
-            ['湖北','荆门','4','5'],
-            ['湖北','仙桃','4','5'],
-            ['湖南','岳阳','4','5'],
-            ['湖南','长沙','4','5'],
-            ['湖南','湘潭','4','5'],
-            ['湖南','株洲','4','5'],
-            ['湖南','衡阳','4','5'],
-            ['湖南','郴州','4','5'],
-            ['湖南','常德','4','5'],
-            ['湖南','益阳','4','5'],
-            ['湖南','娄底','4','5'],
-            ['湖南','邵阳','4','5'],
-            ['湖南','吉首','4','5'],
-            ['湖南','张家界','4','5'],
-            ['湖南','怀化','4','5'],
-            ['湖南','永州','4','5'],
-            ['广东','江门','4','5'],
-            ['广东','韶关','4','5'],
-            ['广东','惠州','4','5'],
-            ['广东','梅州','5','6'],
-            ['广东','汕头/汕尾','4','5'],
-            ['广东','深圳','4','5'],
-            ['广东','珠海','4','5'],
-            ['广东','佛山','4','5'],
-            ['广东','肇庆','4','5'],
-            ['广东','湛江','5','6'],
-            ['广东','中山','4','5'],
-            ['广东','河源','4','5'],
-            ['广东','清远','4','5'],
-            ['广东','云浮','4','5'],
-            ['广东','潮州','4','5'],
-            ['广东','东莞','4','5'],
-            ['广西','防城港','5','6'],
-            ['广西','南宁','5','6'],
-            ['广西','来宾','5','6'],
-            ['广西','桂林','5','6'],
-            ['广西','贺州','5','6'],
-            ['广西','贵港','5','6'],
-            ['广西','百色','5','6'],
-            ['广西','钦州','5','6'],
-            ['广西','河池','4','5'],
-            ['广西','北海','5','6'],
-            ['江西','新余','4','5'],
-            ['江西','南昌','3','4'],
-            ['江西','九江','3','4'],
-            ['江西','上饶','3','4'],
-            ['江西','抚州','3','4'],
-            ['江西','宜春','4','5'],
-            ['江西','吉安','4','5'],
-            ['江西','赣州','4','5'],
-            ['江西','景德镇','3','4'],
-            ['江西','萍乡','4','5'],
-            ['四川','攀枝花','5','6'],
-            ['四川','自贡','5','6'],
-            ['四川','绵阳','5','6'],
-            ['四川','南充','5','6'],
-            ['四川','达州','4','5'],
-            ['四川','遂宁','5','6'],
-            ['四川','广安','5','6'],
-            ['四川','巴中','5','6'],
-            ['四川','泸州','5','6'],
-            ['四川','宜宾','5','6'],
-            ['四川','内江','5','6'],
-            ['四川','乐山','5','6'],
-            ['四川','西昌','5','6'],
-            ['四川','雅安','5','6'],
-            ['四川','康定','4','5'],
-            ['四川','阿坝藏族羌族州','5','6'],
-            ['四川','德阳','5','6'],
-            ['四川','广元','5','6'],
-            ['贵州','贵阳','4','5'],
-            ['贵州','都匀','4','5'],
-            ['贵州','凯里','4','5'],
-            ['贵州','铜仁','5','6'],
-            ['贵州','毕节','5','6'],
-            ['贵州','六盘水','5','6'],
-            ['贵州','兴义','5','6'],
-            ['云南','昭通','5','6'],
-            ['云南','昆明','5','6'],
-            ['云南','大理','5','6'],
-            ['云南','红河哈尼族彝族州','5','6'],
-            ['云南','曲靖','5','6'],
-            ['云南','保山','5','6'],
-            ['云南','文山','5','6'],
-            ['云南','玉溪','5','6'],
-            ['云南','楚雄','5','6'],
-            ['云南','普洱','5','6'],
-            ['云南','临沧','5','6'],
-            ['云南','香格里拉','5','6'],
-            ['海南','海口','5','6'],
-            ['新疆','乌苏','6','7'],
-            ['新疆','哈密','6','7'],
-            ['新疆','和田市','6','7'],
-            ['新疆','阿勒泰市','6','7'],
-            ['新疆','阿图什市','6','7'],
-            ['新疆','博尔塔拉蒙古州','6','7'],
-            ['陕西','延安','4','5'],
-            ['陕西','榆林','4','5'],
-            ['陕西','渭南','4','5'],
-            ['陕西','商洛','4','5'],
-            ['陕西','安康','4','5'],
-            ['陕西','汉中','4','5'],
-            ['陕西','宝鸡','4','5'],
-            ['陕西','铜川','4','5'],
-            ['甘肃','临夏','4','5'],
-            ['甘肃','兰州','5','6'],
-            ['甘肃','定西','5','6'],
-            ['甘肃','平凉','5','6'],
-            ['甘肃','庆阳','4','5'],
-            ['甘肃','武威','5','6'],
-            ['甘肃','张掖','5','6'],
-            ['甘肃','酒泉','5','6'],
-            ['甘肃','天水','4','5'],
-            ['甘肃','陇南','5','6'],
-            ['甘肃','合作','5','6'],
-            ['甘肃','白银','5','6'],
-            ['宁夏','银川','5','6'],
-            ['宁夏','石嘴山','5','6'],
-            ['宁夏','吴忠','5','6'],
-            ['宁夏','固原','5','6'],
-            ['宁夏','中卫','5','6'],
-            ['青海','海北藏族自治州','5','6'],
-            ['青海','西宁','5','6'],
-            ['青海','海东','5','6'],
-            ['青海','同仁县','5','6'],
-            ['青海','共和县','5','6'],
-            ['青海','玛訫县','5','6'],
-            ['青海','德令哈','5','6'],
-            ['青海','格尔木','5','6'],
-            ['新疆','克拉玛依','6','7'],
-            ['新疆','乌鲁木齐','6','7'],
-            ['新疆','奎屯','6','7'],
-            ['新疆','石河子','6','7'],
-            ['新疆','昌吉州','6','7'],
-            ['新疆','吐鲁番','6','7'],
-            ['新疆','库尔勒','6','7'],
-            ['新疆','阿克苏市','6','7'],
-            ['新疆','喀什市','6','7'],
-            ['新疆','伊犁哈萨克州','6','7']];
-    }
 }

+ 0 - 2
database/migrations/2020_10_22_102316_change_order_issues_table.php

@@ -14,7 +14,6 @@ class ChangeOrderIssuesTable extends Migration
     public function up()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            // 二次快递单号
             $table->string('second_logistic_number')->index()->nullable()->comment('二次运单号')->after('second_client_no');
         });
     }
@@ -27,7 +26,6 @@ class ChangeOrderIssuesTable extends Migration
     public function down()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            // 二次快递单号
             $table->dropColumn('second_logistic_number');
         });
     }

+ 0 - 2
database/migrations/2020_10_23_101444_change_order_issues_tabel.php

@@ -14,7 +14,6 @@ class ChangeOrderIssuesTabel extends Migration
     public function up()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            // 用于客户 客服 录入
             $table->string('custom_code')->nullable()->comment('自定义单号')->after('final_status');
         });
     }
@@ -27,7 +26,6 @@ class ChangeOrderIssuesTabel extends Migration
     public function down()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            //
             $table->dropColumn('custom_code');
         });
     }

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

@@ -1,33 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class AddLogistiesItemXjwldf extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        //
-        $logistic= \App\Logistic::query()->where('name','新杰物流到付')->first();
-        if(!$logistic){
-            \App\Logistic::query()->create(['name'=>'新杰物流到付','code'=>'XJWLDF']);
-        }
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        //
-        \App\Logistic::query()->where('code','XJWLDF')->delete();
-    }
-}

+ 0 - 2
database/migrations/2020_11_16_142745_add_soft_delete_to_order_issues.php

@@ -14,7 +14,6 @@ class AddSoftDeleteToOrderIssues extends Migration
     public function up()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            // 软删除
             $table->softDeletes();
         });
     }
@@ -27,7 +26,6 @@ class AddSoftDeleteToOrderIssues extends Migration
     public function down()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            //
             $table->dropColumn('deleted_at');
         });
     }

+ 0 - 2
database/migrations/2020_11_18_142512_add_finance_confirm_to_order_issue_and_add_auth.php

@@ -14,7 +14,6 @@ class AddFinanceConfirmToOrderIssueAndAddAuth extends Migration
     public function up()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            //
             $table->enum('finance_confirm',['是','否'])->default('否')->after('rejecting_status')->comment('财务确认');
         });
     }
@@ -27,7 +26,6 @@ class AddFinanceConfirmToOrderIssueAndAddAuth extends Migration
     public function down()
     {
         Schema::table('order_issues', function (Blueprint $table) {
-            //
             $table->dropColumn('finance_confirm');
         });
     }

+ 19 - 34
database/migrations/2020_11_23_143145_seed_value_stores_table.php

@@ -3,10 +3,21 @@
 use App\ValueStore;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class SeedValueStoresTable extends Migration
 {
+    protected $arr = [
+        'order_last_created_sync_at',
+        'order_last_updated_sync_at',
+        'commodity_last_created_sync_at',
+        'commodity_last_updated_sync_at',
+        'asn_last_created_sync_at',
+        'asn_last_updated_sync_at',
+        "wave_last_sync_date",
+        "wave_detail_last_sync_date",
+    ];
     /**
      * Run the migrations.
      *
@@ -14,32 +25,11 @@ class SeedValueStoresTable extends Migration
      */
     public function up()
     {
-        \App\ValueStore::create([
-            'name' => 'order_last_created_sync_at',
-            'value' => null,
-        ]);
-        \App\ValueStore::create([
-            'name' => 'order_last_updated_sync_at',
-            'value' => null,
-        ]);
-
-        \App\ValueStore::create([
-            'name' => 'commodity_last_created_sync_at',
-            'value' => null,
-        ]);
-        \App\ValueStore::create([
-            'name' => 'commodity_last_updated_sync_at',
-            'value' => null,
-        ]);
-
-        \App\ValueStore::create([
-            'name' => 'asn_last_created_sync_at',
-            'value' => null,
-        ]);
-        \App\ValueStore::create([
-            'name' => 'asn_last_updated_sync_at',
-            'value' => null,
-        ]);
+        foreach ($this->arr as $value){
+            DB::insert(DB::raw("INSERT INTO value_stores(name,value) VALUES(?,?)"),[
+                $value,null
+            ]);
+        }
     }
 
     /**
@@ -49,13 +39,8 @@ class SeedValueStoresTable extends Migration
      */
     public function down()
     {
-        ValueStore::query()->whereIn(
-            'name', ['order_last_created_sync_at',
-            'order_last_updated_sync_at',
-            'commodity_last_created_sync_at',
-            'commodity_last_updated_sync_at',
-            'asn_last_created_sync_at',
-            'asn_last_updated_sync_at',
-        ])->delete();
+        foreach ($this->arr as $value){
+            DB::insert(DB::raw("DELETE FROM value_stores WHERE name = ?"),[$value]);
+        }
     }
 }

+ 0 - 2
database/migrations/2020_11_30_133112_save_value_store_data_date.php

@@ -13,7 +13,6 @@ class SaveValueStoreDataDate extends Migration
      */
     public function up()
     {
-        \App\ValueStore::query()->firstOrCreate(["name"=>"wave_last_sync_date"]);
         Schema::table("batches",function (Blueprint $table){
             $table->string("remark")->nullable()->comment("中文描述");
             $table->string("owner_id")->index()->nullable()->comment("外键货主");
@@ -27,7 +26,6 @@ class SaveValueStoreDataDate extends Migration
      */
     public function down()
     {
-        \App\ValueStore::query()->where("name","wave_last_sync_date")->delete();
         Schema::table("batches",function (Blueprint $table){
             $table->dropColumn("remark");
             $table->dropColumn("owner_id");

+ 9 - 3
database/migrations/2020_11_30_140957_create_station_types_table.php

@@ -3,10 +3,14 @@
 use App\StationType;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class CreateStationTypesTable extends Migration
 {
+    protected $arr = [
+        '料箱出货口',"料箱入货口","料箱监视器","料箱监视器01","立库","缓存架","镜像架"
+    ];
     /**
      * Run the migrations.
      *
@@ -19,9 +23,11 @@ class CreateStationTypesTable extends Migration
             $table->string('name')->index();
             $table->timestamps();
         });
-        StationType::query()->firstOrCreate(['name'=>'料箱出货口']);
-        StationType::query()->firstOrCreate(['name'=>'料箱入货口']);
-        StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
+        foreach ($this->arr as $value){
+            DB::insert(DB::raw("INSERT INTO station_types(name,created_at,updated_at) VALUES(?,?,?)"),[
+                $value,date("Y-m-d"),date("Y-m-d")
+            ]);
+        }
     }
 
     /**

+ 8 - 10
database/migrations/2020_11_30_140958_create_stations_table.php

@@ -4,6 +4,7 @@ use App\Station;
 use App\StationType;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class CreateStationsTable extends Migration
@@ -24,16 +25,13 @@ class CreateStationsTable extends Migration
             $table->integer('sequence')->index()->nullable();
             $table->timestamps();
         });
-        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱出货口']);
-        $station料箱监视器01= StationType::query()->firstOrCreate(['name'=>'料箱监视器01']);
-        $station= Station::query()->firstOrCreate(['name'=>'U型线入货口01'
-            ,'code'=>'BIN-OUT1'
-            ,'station_type_id'=>$stationType['id']
-            ,'parent_id'=>$station料箱监视器01['id']
-        ]);
-        $station['sequence']=1;
-        $station['station_type_id']=$stationType['id'];
-        $station->save();
+        $db1 = DB::selectOne(DB::raw("SELECT * FROM station_types where name = ?"),["料箱出货口"]);
+        $db2 = DB::selectOne(DB::raw("SELECT * FROM station_types where name = ?"),["料箱监视器01"]);
+        if ($db1 && $db2){
+            DB::insert(DB::raw("INSERT INTO stations(name,code,station_type_id,parent_id,sequence) VALUES (?,?,?,?,?)"),[
+                'U型线入货口01','BIN-OUT1',$db1->id,$db2->id,1,
+            ]);
+        }
     }
 
     /**

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

@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class CreateStationTaskBatchTypesTable extends Migration
@@ -18,7 +19,9 @@ class CreateStationTaskBatchTypesTable extends Migration
             $table->string('name');
             $table->timestamps();
         });
-        \App\StationTaskBatchType::query()->firstOrCreate(['name'=>'U型线分捡']);
+        DB::insert(DB::raw("INSERT INTO station_task_batch_types(name) VALUES (?)"),[
+            'U型线分捡'
+        ]);
     }
 
     /**

+ 0 - 2
database/migrations/2020_11_30_153512_add_column_outer_table_owner_fee_details.php

@@ -13,7 +13,6 @@ class AddColumnOuterTableOwnerFeeDetails extends Migration
      */
     public function up()
     {
-        \App\ValueStore::query()->firstOrCreate(["name"=>"wave_detail_last_sync_date"]);
         Schema::table('owner_fee_details', function (Blueprint $table) {
             $table->bigInteger("outer_id")->nullable()->index()->comment("关联表ID");
             $table->string("outer_table_name")->nullable()->comment("关联表名称");
@@ -27,7 +26,6 @@ class AddColumnOuterTableOwnerFeeDetails extends Migration
      */
     public function down()
     {
-        \App\ValueStore::query()->where("name","wave_detail_last_sync_date")->delete();
         Schema::table('owner_fee_details', function (Blueprint $table) {
             $table->dropColumn("outer_id");
             $table->dropColumn("outer_table_name");

+ 7 - 2
database/migrations/2020_12_03_144334_add_monitor_default_station_and_station_hardware_id_column.php

@@ -4,6 +4,7 @@ use App\Station;
 use App\StationType;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class AddMonitorDefaultStationAndStationHardwareIdColumn extends Migration
@@ -18,8 +19,12 @@ class AddMonitorDefaultStationAndStationHardwareIdColumn extends Migration
         Schema::table('stations', function (Blueprint $table) {
             $table->string('remark')->nullable();
         });
-        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
-        Station::query()->firstOrCreate(['name'=>'料箱监视器01','sequence'=>1,'station_type_id'=>$stationType['id']]);
+        $db = DB::selectOne(DB::raw("SELECT * FROM station_types where name = ?"),["料箱监视器"]);
+        if ($db){
+            DB::insert(DB::raw("INSERT INTO stations(name,station_type_id,sequence) VALUES (?,?,?)"),[
+                '料箱监视器01',$db->id,1,
+            ]);
+        }
     }
     /**
      * Reverse the migrations.

+ 0 - 3
database/migrations/2020_12_14_103401_create_customerlogstatuses_table.php

@@ -14,9 +14,6 @@ class CreateCustomerLogStatusesTable extends Migration
             $table->text('description');
             $table->timestamps();
         });
-		\App\CustomerLogStatus::query()->create([
-		    "name"=>"日志"
-        ]);
 	}
 
 	public function down()

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

@@ -14,7 +14,6 @@ class ChangeColumnOrderIdToOrderIssues extends Migration
      */
     public function up()
     {
-        $this->cleanOrderIssueRepeat();
         Schema::table('order_issues', function (Blueprint $table) {
             $table->integer('order_id')->unique('order_issues_order_id_unique')->change();
         });
@@ -31,39 +30,4 @@ class ChangeColumnOrderIdToOrderIssues extends Migration
             $table->dropUnique('order_issues_order_id_unique');
         });
     }
-
-    public function cleanOrderIssueRepeat()
-    {
-        $orderIssue_unique = \App\OrderIssue::withTrashed()
-            ->selectRaw('count(1) as count,id,order_id')
-            ->whereNotNull('order_id')
-            ->orderByDesc('created_at')
-            ->groupBy('order_id')
-            ->having('count', '>', 1)
-            ->limit(100)
-            ->get();
-        if ($orderIssue_unique->count() == 0) return;
-        foreach ($orderIssue_unique as $item) {
-            $orderIssue_delete = OrderIssue::withTrashed()->where('order_id', $item->order_id)->get();
-            /** @var OrderIssue $order_issue_unique */
-            $order_issue_unique = $orderIssue_delete->whereNull('deleted_at')->first();
-            if (!$order_issue_unique) $order_issue_unique = $orderIssue_delete->first();
-            $ids = [];
-            foreach ($orderIssue_delete as $key => $order_issue) {
-                if ($order_issue->id == $order_issue_unique->id) continue;
-                $ids[] = $order_issue->id;
-                if($order_issue['logistic_number_return'])$order_issue_unique['logistic_number_return'] =$order_issue['logistic_number_return'];
-                if($order_issue['rejecting_status']!='未退回')$order_issue_unique['rejecting_status'] =$order_issue['rejecting_status'];
-                if($order_issue['is_new_rejecting']!='无')$order_issue_unique['is_new_rejecting'] =$order_issue['is_new_rejecting'];
-                if($order_issue['user_workgroup_id'])$order_issue_unique['user_workgroup_id'] =$order_issue['user_workgroup_id'];
-                if($order_issue['imported_status']!='正常')$order_issue_unique['imported_status'] =$order_issue['imported_status'];
-                if($order_issue['custom_code'])$order_issue_unique['custom_code'] =$order_issue['custom_code'];
-            }
-            $order_issue_unique->save();
-            app('LogService')->log(__METHOD__, __FUNCTION__, '修改OrderIssue:' . json_encode($order_issue_unique));
-            $orderIssues = OrderIssue::query()->whereIn('id',$ids)->get();
-            $bool = OrderIssue::query()->whereIn('id',$ids)->forceDelete();
-            if($bool)app('LogService')->log(__METHOD__, __FUNCTION__, '删除OrderIssue:' . json_encode($orderIssues));
-        }
-    }
 }

+ 0 - 40
database/migrations/2020_12_23_174008_add_column_logistic_id_to_order_trackings.php

@@ -17,7 +17,6 @@ class AddColumnLogisticIdToOrderTrackings extends Migration
         Schema::table('order_trackings', function (Blueprint $table) {
             $table->integer('logistic_id')->index()->comment('快递');
         });
-        $this->migrationLogistic();
     }
 
     /**
@@ -31,43 +30,4 @@ class AddColumnLogisticIdToOrderTrackings extends Migration
             $table->dropColumn('logistic_id');
         });
     }
-
-    public function migrationLogistic()
-    {
-        /** @var OrderTrackingService $service */
-        $service = app(OrderTrackingService::class);
-        $maxId= \App\OrderTracking::query()->orderByDesc('id')->first();
-        $orderTracking_min = \App\OrderTracking::query()->where('logistic_id',0)->orderBy('id')->first();
-        if(!$maxId)return;
-        $maxId = $maxId->id;
-        $minId= $orderTracking_min->id;
-        $logistic = \App\Logistic::query()->where('name','新杰物流')->first();
-        $logistic_zt = \App\Logistic::query()->where('name','自提')->first();
-
-        for ($i=$minId;$i<= $maxId;$i+=100){
-            $orderTrackings = \App\OrderTracking::query()
-                ->where('id','>=',$i)
-                ->where('id','<=',$i+100)
-                ->where('logistic_id','=',0)
-                ->where('created_at','!=','0000-00-00 00:00:00')
-                ->get();
-            if($orderTrackings->count() ==0) continue;
-            $update_params = [['id','logistic_id']];
-            $orderTrackings->each(function($orderTracking)use($logistic_zt,$logistic,&$update_params){
-                $order =$orderTracking->commodities->package->order;
-                $logistic_id = $order->logistic_id;
-                if($logistic_id!=null){
-                    if($order->logistic_id == $logistic_zt->id)$logistic_id = $logistic->id;
-                    if($logistic_id==0)dd($order,$logistic_id);
-                    $update_params[] = [
-                        'id' => $orderTracking->id,
-                        'logistic_id' => $logistic_id,
-                    ];
-                }
-            });
-            if(count($update_params) > 1){
-                $service->batchUpdate($update_params);
-            }
-        }
-    }
 }

+ 2 - 3
database/migrations/2020_12_28_160507_change_inventory_compares_quality_column.php

@@ -1,8 +1,7 @@
 <?php
 
 use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
+use Illuminate\Support\Facades\DB;
 
 class ChangeInventoryComparesQualityColumn extends Migration
 {
@@ -13,7 +12,7 @@ class ChangeInventoryComparesQualityColumn extends Migration
      */
     public function up()
     {
-               DB::statement("ALTER TABLE inventory_compares MODIFY COLUMN quality enum ('正品','次品','未知','有价值') default null");
+       DB::statement("ALTER TABLE inventory_compares MODIFY COLUMN quality enum ('正品','次品','未知','有价值') default null");
     }
 
     /**

+ 0 - 10
database/migrations/2020_12_29_182249_change_station_rule_batch_column_default_batch_type.php

@@ -17,14 +17,4 @@ class ChangeStationRuleBatchColumnDefaultBatchType extends Migration
             $table->string('batch_type')->default('无')->change();
         });
     }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        //
-    }
 }

+ 0 - 11
database/migrations/2021_01_07_092258_create_order_issue_rejected_bill_table.php

@@ -18,7 +18,6 @@ class CreateOrderIssueRejectedBillTable extends Migration
             $table->bigInteger('order_issue_id')->index();
             $table->string('logistic_number_return')->index();
         });
-        $this->processOrderIssueRejectedBill();
     }
 
     /**
@@ -30,14 +29,4 @@ class CreateOrderIssueRejectedBillTable extends Migration
     {
         Schema::dropIfExists('order_issue_rejected_bill');
     }
-
-    public function processOrderIssueRejectedBill()
-    {
-        OrderIssue::query()->withTrashed()->whereNotNull('logistic_number_return')->chunkById(200,function($orderIssues){
-            $orderIssues->each(function($orderIssue){
-                if($orderIssue->logistic_number_return)
-                    $orderIssue->rejectedBills()->syncWithoutDetaching([$orderIssue->logistic_number_return]);
-            });
-        });
-    }
 }

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

@@ -1,32 +0,0 @@
-<?php
-
-use App\OrderIssue;
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class SyncOrderIssueUserWorkgroup extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        $orderIssues = OrderIssue::query()->whereNotNull('user_workgroup_id')->get();
-        foreach ($orderIssues as $orderIssue) {
-            $orderIssue->userWorkgroups()->attach($orderIssue->user_workgroup_id);
-        }
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        //
-    }
-}

+ 0 - 29
database/migrations/2021_01_19_151928_fix_order_package_status.php

@@ -1,29 +0,0 @@
-<?php
-
-use App\OrderPackage;
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class FixOrderPackageStatus extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        OrderPackage::query()->whereNotNull('weighed_at')->update(['status'=>'已称重']);
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-
-    }
-}

+ 0 - 24
database/migrations/2021_01_20_145822_add_owner_id_to_order_packages.php

@@ -18,9 +18,6 @@ class AddOwnerIdToOrderPackages extends Migration
         Schema::table('order_packages', function (Blueprint $table) {
             $table->bigInteger('owner_id')->nullable()->index();
         });
-
-        $this->changeOwnerId();
-
     }
 
     /**
@@ -34,25 +31,4 @@ class AddOwnerIdToOrderPackages extends Migration
             $table->dropColumn('owner_id');
         });
     }
-
-    public function changeOwnerId()
-    {
-        /**
-         * @var OrderPackageService  $order_packages_service
-         */
-        $order_packages_service = app(OrderPackageService::class);
-        OrderPackage::query()->with('order')->chunkById(200,function($order_packages)use($order_packages_service){
-            $update_params = [];
-            $update_params[] = ['id','owner_id'];
-            foreach ($order_packages as $order_package) {
-                if($order_package->order && $order_package->order->owner_id){
-                    $update_params[] = [
-                        'id'=>$order_package->id,
-                        'owner_id'=>$order_package->order->owner_id
-                    ];
-                }
-            }
-            $order_packages_service->batchUpdate($update_params);
-        });
-    }
 }

+ 0 - 2
database/migrations/2021_01_21_100909_add_created_at_index_order_packages.php

@@ -14,7 +14,6 @@ class AddCreatedAtIndexOrderPackages extends Migration
     public function up()
     {
         Schema::table('order_packages', function (Blueprint $table) {
-            //
             $table->index('created_at');
             $table->index(['status','created_at']);
         });
@@ -28,7 +27,6 @@ class AddCreatedAtIndexOrderPackages extends Migration
     public function down()
     {
         Schema::table('order_packages', function (Blueprint $table) {
-            //
             $table->dropIndex('order_packages_created_at_index');
             $table->dropIndex('order_packages_status_created_at_index');
         });

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

@@ -1,32 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class AddUnitsData extends Migration
-{
-    protected $units = [
-        "件","箱",'单',"日","月","m²","m³","件","托"
-    ];
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        foreach ($this->units as $unit){
-            \App\Unit::query()->firstOrCreate(["name"=>$unit]);
-        }
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-    }
-}

+ 2 - 1
database/migrations/2021_03_06_090856_create_tax_rates_table.php

@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Schema;
 
 class CreateTaxRatesTable extends Migration
@@ -26,7 +27,7 @@ class CreateTaxRatesTable extends Migration
             $table->bigInteger("tax_rate_id")->nullable()->comment("外键税率");
             $table->string("relevance")->nullable()->comment("关联模型的JSON数组");
         });
-        foreach ($this->values as $value) \App\TaxRate::query()->firstOrCreate(["value"=>$value]);
+        foreach ($this->values as $value) DB::insert(DB::raw("INSERT INTO tax_rates(value) VALUES(?)"),[$value]);
         Schema::table('warehouses', function (Blueprint $table) {
             $table->decimal("production_capacity")->default(0)->comment("产能");
             $table->integer("reduced_production_capacity_coefficient")->default(0)->comment("SKU减产系数");

+ 14 - 12
database/migrations/2021_03_23_140544_add_configurations_data.php

@@ -4,9 +4,15 @@ use App\Configuration;
 use Illuminate\Database\Migrations\Migration;
 
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 
 class AddConfigurationsData extends Migration
 {
+    protected $configurations=[
+        ['name'=>'price_coefficient','value'=>1.3,'description'=>'采购管理价格系数'],
+        ['name'=>'enquiry_time','value'=>4,'description'=>'报价需在询价发起延时时间之内有效'],
+        ['name'=>'receive_time','value'=>24,'description'=>'接单需在询价发起延时时间之内有效']
+    ];
     /**
      * Run the migrations.
      *
@@ -14,15 +20,11 @@ class AddConfigurationsData extends Migration
      */
     public function up()
     {
-        $time=\Illuminate\Support\Carbon::now()->toDateTimeString();
-        $configurations = [];
-        $conf_one=['name'=>'price_coefficient','value'=>1.3,'description'=>'采购管理价格系数','operator'=>Auth::id(),'created_at'=>$time,'updated_at'=>$time];
-        $conf_two=['name'=>'enquiry_time','value'=>4,'description'=>'报价需在询价发起延时时间之内有效','operator'=>Auth::id(),'created_at'=>$time,'updated_at'=>$time];
-        $conf_three=['name'=>'receive_time','value'=>24,'description'=>'接单需在询价发起延时时间之内有效','operator'=>Auth::id(),'created_at'=>$time,'updated_at'=>$time];
-        $configurations[]=$conf_one;
-        $configurations[]=$conf_two;
-        $configurations[]=$conf_three;
-        Configuration::query()->insert($configurations);
+        foreach ($this->configurations as $configuration){
+            DB::insert(DB::raw("INSERT INTO configurations(name,value,description,operator,created_at,updated_at) VALUES(?,?,?,?,?,?)"),[
+               $configuration["name"],$configuration["value"],$configuration["description"],0,date("Y-m-d"),date("Y-m-d")
+            ]);
+        }
     }
 
     /**
@@ -32,8 +34,8 @@ class AddConfigurationsData extends Migration
      */
     public function down()
     {
-        Configuration::query()->where('name','price_coefficient')->delete();
-        Configuration::query()->where('name','enquiry_time')->delete();
-        Configuration::query()->where('name','receive_time')->delete();
+        foreach ($this->configurations as $configuration){
+            DB::delete(DB::raw("DELETE FROM configurations WHERE name = ?"),[$configuration["name"]]);
+        }
     }
 }

+ 0 - 1
database/migrations/2021_04_06_155509_add_exception_message_to_order_packages_table.php

@@ -26,7 +26,6 @@ class AddExceptionMessageToOrderPackagesTable extends Migration
     public function down()
     {
         Schema::table('order_packages', function (Blueprint $table) {
-            //
             $table->dropColumn('exception_message');
         });
     }

+ 0 - 1
database/migrations/2021_04_07_155234_add_exception_type_order_packages_table.php

@@ -14,7 +14,6 @@ class AddExceptionTypeOrderPackagesTable extends Migration
     public function up()
     {
         Schema::table('order_packages', function (Blueprint $table) {
-            //
             $table->enum('exception_type', [
                 '疑似库内丢件',
                 '揽件异常',

+ 10 - 19
database/migrations/2021_04_13_140632_add_station_type_and_add_station.php

@@ -4,11 +4,12 @@ use Illuminate\Database\Migrations\Migration;
 use App\Station;
 use App\StationType;
 use App\Authority;
+use Illuminate\Support\Facades\DB;
 
 class AddStationTypeAndAddStation extends Migration
 {
 
-    public $stationTypeNames = ['缓存架'];
+    public $stationTypeName = '缓存架';
 
     public $stationNames = ['缓存架01', '缓存架02'];
 
@@ -19,17 +20,11 @@ class AddStationTypeAndAddStation extends Migration
      */
     public function up()
     {
-        foreach ($this->stationTypeNames as $name) {
-            if (StationType::query()->where('name', $name)->exists()) continue;
-            StationType::query()->create(['name' => $name]);
-        }
-        $stationType = StationType::query()->where('name', '缓存架')->first();
-        foreach ($this->stationNames as $stationName) {
-            if (Station::query()->where('name', $stationName)->exists()) continue;
-            Station::query()->create([
-                'name' => $stationName,
-                'code' => $stationName,
-                'station_type_id' => $stationType['id'],
+        DB::insert(DB::raw("INSERT INTO station_types(name) VALUES(?)"),[$this->stationTypeName]);
+        $s = DB::selectOne(DB::raw("SELECT * FROM station_types WHERE name = ?"),[$this->stationTypeName]);
+        foreach ($this->stationNames as $name){
+            DB::insert(DB::raw("INSERT INTO stations(name,code,station_type_id) VALUES(?,?,?)"),[
+                $name,$name,$s->id
             ]);
         }
     }
@@ -41,13 +36,9 @@ class AddStationTypeAndAddStation extends Migration
      */
     public function down()
     {
-        foreach ($this->stationNames as $stationName) {
-            if (!Station::query()->where('name', $stationName)->exists()) continue;
-            Station::query()->where('name', $stationName)->delete();
-        }
-        foreach ($this->stationTypeNames as $name) {
-            if (!Station::query()->where('name', $name)->exists()) continue;
-            Station::query()->where('name', $name)->delete();
+        DB::delete(DB::raw("DELETE FROM station_types WHERE name = ?"), [$this->stationTypeName]);
+        foreach ($this->stationNames as $name) {
+            DB::delete(DB::raw("DELETE FROM stations WHERE name = ?"), [$name]);
         }
     }
 }

+ 0 - 1
database/migrations/2021_04_24_091321_change_delivery_appointments_table_add_logistic_number_column.php

@@ -25,7 +25,6 @@ class ChangeDeliveryAppointmentsTableAddLogisticNumberColumn extends Migration
         Schema::table("owner_price_systems",function (Blueprint $table){
             $table->bigInteger("time_unit_id")->nullable()->comment("计时单位");
         });
-        \App\Unit::query()->firstOrCreate(["name"=>"年"]);
     }
 
     /**

+ 0 - 28
database/migrations/2021_04_29_133306_drop_station_cache_shelf_grips_table.php

@@ -1,28 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class DropStationCacheShelfGripsTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::dropIfExists('station_cache_shelf_grids');
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        //
-    }
-}

+ 1 - 0
database/migrations/2021_05_27_103720_create_ownersundryfeedetails_table.php

@@ -2,6 +2,7 @@
 
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Database\Migrations\Migration;
+use Illuminate\Support\Facades\Schema;
 
 class CreateOwnerSundryFeeDetailsTable extends Migration
 {

+ 0 - 28
database/migrations/2021_05_31_140957_create_station_types2_table.php

@@ -1,28 +0,0 @@
-<?php
-
-use App\StationType;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateStationTypes2Table extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        StationType::query()->firstOrCreate(['name'=>'立库']);
-        StationType::query()->firstOrCreate(['name'=>'缓存架']);
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        StationType::query()->whereIn('name',['立库','缓存架'])->delete();
-    }
-}

+ 0 - 2
database/migrations/2021_06_03_171554_create_material_box_models_table.php

@@ -26,7 +26,6 @@ class CreateMaterialBoxModelsTable extends Migration
             $table->bigInteger("material_box_model_id")->comment("料箱模型ID");
             $table->integer("maximum")->default(0)->comment("存储最大限值");
         });
-        \App\StationType::query()->create(["name"=>"镜像架"]);
     }
 
     /**
@@ -41,6 +40,5 @@ class CreateMaterialBoxModelsTable extends Migration
             $table->dropColumn("material_box_model_id");
         });
         Schema::dropIfExists('commodity_material_box_model');
-        \App\StationType::query()->where("name","镜像架")->delete();
     }
 }

+ 0 - 43
database/migrations/2021_06_18_093536_add__authority_discharge_task_authority.php

@@ -1,43 +0,0 @@
-<?php
-
-use Illuminate\Database\Migrations\Migration;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Support\Facades\Schema;
-
-class AddAuthorityDischargeTaskAuthority extends Migration
-{
-
-    private $name = '人事管理-卸货-成本可见';
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        $authority = \App\Authority::query()->where('alias_name','卸货')->first();
-        $saveAuthority =  \App\Authority::query()->firstOrCreate(['alias_name' => $this->name],['name' => '卸货人事可见','parent_id' => $authority['id'] ?? '']);
-
-        $roles = \App\Role::query()->where('name','like','人事%')->get();
-        foreach ($roles as $role) {
-            $role->authorities()->attach($saveAuthority['id']);
-        }
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        $authority = \App\Authority::query()->where(['alias_name' => $this->name])->first();
-        if(!$authority) return ;
-
-        $roles = \App\Role::query()->where('name','like','人事%')->get();
-        foreach ($roles as $role) {
-            $role->detach($authority['id']);
-        }
-        $authority->delete();
-    }
-}

+ 1 - 1
routes/web.php

@@ -26,8 +26,8 @@ Route::any('test/{method}', 'TestController@method');
 Route::post('package/weigh/measureMonitor/speech','MeasureMonitorController@speech');
 //称重显示
 Route::get('package/measureMonitor','MeasureMonitorController@index');
-Route::resource('package/measureMonitor','MeasureMonitorController');
 Route::resource('package/weigh/measureMonitor','MeasureMonitorController');
+Route::resource('package/measureMonitor','MeasureMonitorController');
 //入库预约终端
 Route::get('store/deliveryAppointment/exhibition','DeliveryAppointmentController@exhibition');
 //入库预约预约码输入