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

料箱状态字段的相关逻辑

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

+ 9 - 3
app/Http/Controllers/TestController.php

@@ -44,6 +44,7 @@ use App\LaborReport;
 use App\LaborReportStatus;
 use App\Log;
 use App\Logistic;
+use App\MaterialBox;
 use App\MeasuringMachine;
 use App\Menu;
 use App\Notifications\SendEmailNotification;
@@ -989,9 +990,14 @@ class TestController extends Controller
 
     public function ld2()
     {
-        /** @var LogisticService $logisticService */
-        $logisticService=app('LogisticService');
-        var_dump($logisticService->get(['name'=>'顺丰'])->first());
+        $m=MaterialBox::query()->first();
+        dump($m);
+        $m['status'] = '在缓存架';
+        dump($m['status']);
+        $m->update();
+        $m=MaterialBox::query()->first();
+        dump($m['status']);
+
     }
     public function y111()
     {

+ 4 - 0
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\api\thirdPart\haiq;
 
 
 use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
+use App\MaterialBox;
 use App\Services\ForeignHaiRoboticsService;
 use App\Services\LogService;
 use Illuminate\Http\Request;
@@ -323,6 +324,9 @@ class StorageController
         $responseBody = $response->body();
         LogService::log(__CLASS__,__METHOD__,$responseBody);
         $responseBody = strstr($responseBody,'200')?'请求出库料箱"'.implode(',',$codes).'"成功':$responseBody;
+        if(strstr($responseBody,'成功')){
+            MaterialBox::query()->whereIn('code',$codes)->update(['status'=>'在出库中']);
+        }
         return ['result'=> $responseBody];
     }
 }

+ 8 - 3
app/Services/StationTaskMaterialBoxService.php

@@ -166,7 +166,7 @@ class StationTaskMaterialBoxService
                     $stationTask = $this->stationTaskService->getProcessing();
                     $this->stationService->broadcastBinMonitor($stationTaskMaterialBox['station_id'], $stationTask);
                     $stationTaskMaterialBox->materialBox['status']='在U型线';
-                    $stationTaskMaterialBox->materialBox->save();
+                    $stationTaskMaterialBox->materialBox->update();
                     break;
                 case '入立库':
                     $this->set($stationTaskMaterialBox,[
@@ -175,11 +175,11 @@ class StationTaskMaterialBoxService
                     ]);
                     $this->cacheShelfService->putStationTaskMaterialBoxProcess($stationTaskMaterialBox);
                     $stationTaskMaterialBox->materialBox['status']='在立库';
-                    $stationTaskMaterialBox->materialBox->save();
+                    $stationTaskMaterialBox->materialBox->update();
                     break;
                 case '入缓存架':
                     $stationTaskMaterialBox->materialBox['status']='在缓存架';
-                    $stationTaskMaterialBox->materialBox->save();
+                    $stationTaskMaterialBox->materialBox->update();
                     break;
                 default:;
             }
@@ -323,6 +323,11 @@ class StationTaskMaterialBoxService
         ){
             return '入立库';
         }
+        if($isCacheShelf=(
+            $stationTaskMaterialBox['station']['stationType']['name'] == '缓存架')
+        ){
+            return '入缓存架';
+        }
 //        if($isStoring=false){
 //            return '入库';
 //        }

+ 1 - 1
database/migrations/2021_05_19_173442_add_materialBoxes_field_status.php

@@ -14,7 +14,7 @@ class AddMaterialBoxesFieldStatus extends Migration
     public function up()
     {
         Schema::table('material_boxes', function (Blueprint $table) {
-            $table->tinyInteger('status')->index('material_boxes_i_status');
+            $table->tinyInteger('status')->nullable()->index('material_boxes_i_status');
         });
     }