LD 4 лет назад
Родитель
Сommit
9add5ff4da

+ 30 - 0
app/Http/Controllers/RejectedBillController.php

@@ -7,6 +7,7 @@ use App\Logistic;
 use App\OracleActAllocationDetails;
 use App\OracleBasSKU;
 use App\Owner;
+use App\Package;
 use App\QualityLabel;
 use App\RejectedBill;
 use App\Services\LogService;
@@ -299,6 +300,35 @@ class RejectedBillController extends Controller
         if($result)return ['success' => true,'data' => $result];
         else return ['success'=>false];
     }
+    function loadGap(Request $request)
+    {
+        if(Gate::allows('退货管理-载入'))
+            return ['success'=>false,'message'=>'没有对应权限'];
+        /**
+         * @var RejectedBillService $service
+         */
+        $packages = Package::where('delivery_number', '==', null)->where('logistic_number', null)->where('logistic_number','<>', null)->get();
+        $logistics = Logistic::limit(10)->get();
+        $packages->each(function ($package) use ($logistics) {
+            $logistics->each(function ($logistic) use ($package) {
+                if ($package->WMSReflectPackage->CarrierID == $logistic->delivery_number) {
+                    $package->logistic_id = $logistic->id;
+                    return;
+                }
+            });
+        });
+        foreach ($logistics as $logistic){
+            if($logistic)
+            foreach (range(0,10) as $i){
+                dump(11);
+                dump(shell_exec('php -v'));
+                return shell_exec('ll /');
+                break;
+            }
+            return 'done';
+        };
+        return "OK";
+    }
 
     public function disposeImportApi(Request $request)
     {

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -508,6 +508,10 @@ class TestController extends Controller
             $authority->delete();
         });
     }
+    public function makeTest(Request $request)
+    {
+        dump((new RejectedBillController())->loadGap($request));
+    }
 
     /*1*/
     function socket(Request $request)

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

@@ -1,5 +1,6 @@
 <?php
 
+use App\Authority;
 use App\CustomField;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
@@ -24,6 +25,8 @@ class CreateCustomFieldsTable extends Migration
             $table->string('condition_value')->nullable()->comment('条件字段值,用来作为定义该字段权限和显示名的依据');
             $table->timestamps();
         });
+        if(!Authority::where('name','退货管理-查询-客户定义-爱奇艺')->first())(new Authority(['name'=>'退货管理-查询-客户定义-爱奇艺','alias_name'=>'退货管理-查询-客户定义-爱奇艺']))->save();
+        $authority=Authority::where('name','退货管理-查询-客户定义-爱奇艺')->first();
         CustomField::create(['table'=>'rejected_bills','field'=>'common_01','present_name'=>'寄件方省','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
         CustomField::create(['table'=>'rejected_bills','field'=>'common_02','present_name'=>'退件重量','authority_id'=>$authority['id'],'condition_field'=>'id_owner','condition_value'=>'66']);
     }