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

表结构修改
增加testControllor中从log重建波次下载信息

LD 5 лет назад
Родитель
Сommit
bb80baf67b

+ 46 - 22
app/Http/Controllers/TestController.php

@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
 
 
 use App\Authority;
+use App\Batch;
 use App\Carrier;
 use App\Commodity;
 use App\CommodityBarcode;
@@ -334,28 +335,6 @@ class TestController extends Controller
         }
     }
 
-    public function delme()
-    {
-        $fields = [
-            'doc_order_header.userdefine1',
-            'doc_order_header.userdefine2',
-            'doc_order_header.SOReference5',
-            'doc_order_header.waveno',
-            'doc_order_header.orderno',
-            'doc_order_header.customerid',
-            'doc_order_header.Consigneename'
-        ];
-        if ('') {
-            $resultOracleObj = OracleDOCOrderHeader::select($fields)->where('orderno', 'SO200603004708');
-        } else {
-            $resultOracleObj = OracleActAllocationDetails::select($fields);
-            $resultOracleObj->where('picktotraceid', '546152742096');
-            $resultOracleObj->leftJoin('DOC_Order_Header', 'act_allocation_details.orderno', 'doc_order_header.orderno');
-        }
-        $_temOracleInfo = $resultOracleObj->first();
-
-        dd($_temOracleInfo);
-    }
 
     public function mergerPackageData()
     {
@@ -1209,4 +1188,49 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         $tack->handle();
         dump(11);
     }
+
+    public function reNewBatches3()
+    {
+        $batches=Batch::query()->where('id','>',324)->get('code');
+//        $batchCodes = $batches->map(function($batch){
+//            return $batch['code'];
+//        })->toArray();
+        $batchCodes = ['W201201000037',
+            'W201201000038',
+            'W201201000039',
+            'W201201000040',
+            'W201201000041',
+            'W201201000052',
+            'W201201000053',
+            'W201201000054',
+            'W201201000055',
+            'W201201000056',
+            'W201201000057',
+            'W201201000071',
+            'W201201000074',
+            'W201201000075',
+            'W201201000076',];
+        $requests=[];
+//        $logs=Log::query()->select('description')->where('CREATED_AT','>','2020-11-11')
+//            ->where('type',"issued_newBatch")
+//            ->get();
+//        dd($logs);
+        foreach($batchCodes as $code){
+//            $request=Cache::get('temp'.$code)['description'];
+            $request=Log::query()->select('description')->where('CREATED_AT','>','2020-12-01')
+                ->where('type',"issued_newBatch")
+                ->where('description','like',"%{$code}%")
+                ->first();
+            if($request){
+                $response=Zttp::post('https://wcs.baoshi56.com/api/thirdPart/flux/sorting/newBatch',
+                    json_decode($request['description'])
+                );
+                app('LogService')->log(__METHOD__,__FUNCTION__,$response->body());
+                $requests[]=$response->body();
+            }
+//            Cache::put('temp'.$code,$request);
+//            $requests[]=$request;
+        }
+        dd($requests);
+    }
 }

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

@@ -95,6 +95,8 @@ class SortingController extends Controller
                                 'wms_ptltaskid' => $requestBarcode['ptltaskid'],
                             ]);
                         }
+                        if(!$orderCommodity['amount'])$orderCommodity['amount']=$requestBarcode['fmqty_each']??0;
+                        if(!$orderCommodity['wms_ptltaskid'])$orderCommodity['wms_ptltaskid']=$requestBarcode['ptltaskid'];
                         $allocation=$oracleAlloactions->where('orderno',$requestOrder['docno'])->where('sku',$commodity['sku'])->where('qty',$requestBarcode['fmqty_each'])->first();
                         if($allocation)
                             $orderCommodity['location'] = $allocation['location'];

+ 1 - 1
app/Station.php

@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class Station extends Model
 {
-    protected $fillable=['name', 'code', 'station_type_id','sequence'];
+    protected $fillable=['name', 'code', 'station_type_id','sequence','parent_id'];
 }

+ 1 - 1
app/StationMissionCommodity.php

@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class StationMissionCommodity extends Model
 {
-    //
+    protected $fillable= ['station_id','material_box_id','commodity_id','amount','order_id','status','station_id'];
 }

+ 1 - 1
app/StationType.php

@@ -6,5 +6,5 @@ use Illuminate\Database\Eloquent\Model;
 
 class StationType extends Model
 {
-    protected $fillable=[];
+    protected $fillable=['name'];
 }

+ 0 - 38
database/migrations/2020_07_24_072012_create_orders_table.php.bak

@@ -1,38 +0,0 @@
-<?php
-
-use Illuminate\Support\Facades\Schema;
-use Illuminate\Database\Schema\Blueprint;
-use Illuminate\Database\Migrations\Migration;
-
-class CreateOrdersTable extends Migration
-{
-    /**
-     * Run the migrations.
-     *
-     * @return void
-     */
-    public function up()
-    {
-        Schema::create('orders', function (Blueprint $table) {
-            $table->bigIncrements('id');
-            $table->string("batch_id")->index()->nullable();
-            $table->string("code")->index();
-            $table->integer("owner_id")->nullable();
-            $table->enum("status",['处理中','未处理','已处理','取消','异常'])->default('未处理');
-            $table->string("wms_status");
-
-
-            $table->timestamps();
-        });
-    }
-
-    /**
-     * Reverse the migrations.
-     *
-     * @return void
-     */
-    public function down()
-    {
-        Schema::dropIfExists('orders');
-    }
-}

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

@@ -15,7 +15,7 @@ class CreateOrdersTable extends Migration
     {
         Schema::create('orders', function (Blueprint $table) {
             $table->bigIncrements('id');
-            $table->string("batch_id")->index()->nullable();
+            $table->integer("batch_id")->index()->nullable();
             $table->string("code")->index()->nullable();
             $table->integer("owner_id")->nullable();
             $table->enum("status",['处理中','未处理','已处理','取消','异常'])->default('未处理');

+ 3 - 0
database/migrations/2020_11_30_141318_create_station_types_table.php → database/migrations/2020_11_30_140957_create_station_types_table.php

@@ -18,6 +18,9 @@ class CreateStationTypesTable extends Migration
             $table->string('name')->index();
             $table->timestamps();
         });
+        \App\StationType::query()->firstOrCreate(['name'=>'料箱出货口']);
+        \App\StationType::query()->firstOrCreate(['name'=>'料箱入货口']);
+        \App\StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
     }
 
     /**

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

@@ -1,5 +1,7 @@
 <?php
 
+use App\Station;
+use App\StationType;
 use Illuminate\Database\Migrations\Migration;
 use Illuminate\Database\Schema\Blueprint;
 use Illuminate\Support\Facades\Schema;
@@ -15,12 +17,18 @@ class CreateStationsTable extends Migration
     {
         Schema::create('stations', function (Blueprint $table) {
             $table->id();
+            $table->integer('parent_id')->index()->nullable();
             $table->string('name')->index()->nullable();
             $table->string('code')->index()->nullable()->comment('机器编码');
             $table->integer('station_type_id')->index();
             $table->integer('sequence')->index()->nullable();
             $table->timestamps();
         });
+        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱出货口']);
+        $station= Station::query()->firstOrCreate(['code'=>'BIN-OUT01']);
+        $station['sequence']=1;
+        $station['station_type_id']=$stationType['id'];
+        $station->save();
     }
 
     /**

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

@@ -21,7 +21,7 @@ class CreateStationMissionCommoditiesTable extends Migration
             $table->integer('amount')->default(0);
             $table->integer('order_id')->index();
             $table->enum('status',['待处理','挂起','处理中','完成','异常','取消'])->index();  //联合索引
-            $table->index(['station_id','material_box_id','status']);
+            $table->index(['station_id','material_box_id','status'],'station_mission_commodities_s_m_s_index');
             $table->timestamps();
         });
     }