Bladeren bron

Merge branch 'LD'

# Conflicts:
#	app/Http/Controllers/TestController.php
#	app/Services/CommodityService.php
LD 5 jaren geleden
bovenliggende
commit
1ea0237e06
45 gewijzigde bestanden met toevoegingen van 1127 en 183 verwijderingen
  1. 1 1
      app/Console/Commands/LogExpireDelete.php
  2. 27 9
      app/Exceptions/Handler.php
  3. 2 2
      app/Http/Controllers/CitiesController.php
  4. 5 24
      app/Http/Controllers/TestController.php
  5. 7 0
      app/Http/Controllers/api/thirdPart/haiq/LightController.php
  6. 120 65
      app/Http/Controllers/api/thirdPart/haiq/StorageController.php
  7. 59 0
      app/Http/Requests/ForeignHaiRobotic_taskUpdateRequest.php
  8. 3 0
      app/OrderCommodity.php
  9. 3 4
      app/Providers/AppServiceProvider.php
  10. 27 8
      app/Services/BatchService.php
  11. 97 1
      app/Services/ForeignHaiRoboticsService.php
  12. 30 0
      app/Services/MaterialBoxService.php
  13. 8 6
      app/Services/StationService.php
  14. 141 28
      app/Services/StationTaskBatchService.php
  15. 1 1
      app/Services/StationTaskBatchTypeService.php
  16. 32 0
      app/Services/StationTaskChildService.php
  17. 85 0
      app/Services/StationTaskCommodityService.php
  18. 81 0
      app/Services/StationTaskMaterialBoxService.php
  19. 67 0
      app/Services/StationTaskService.php
  20. 38 0
      app/Services/StationTypeService.php
  21. 13 0
      app/Services/TestService.php
  22. 6 0
      app/StationRuleBatch.php
  23. 10 9
      app/StationTask.php
  24. 12 1
      app/StationTaskBatch.php
  25. 10 0
      app/StationTaskChild.php
  26. 3 0
      app/StationTaskCommodity.php
  27. 4 1
      app/StationTaskMaterialBox.php
  28. 0 10
      app/Validators/UserDutyCheckValidator.php
  29. 1 0
      config/api.php
  30. 5 4
      config/cache.php
  31. 7 0
      config/task.php
  32. 38 0
      database/migrations/2020_12_11_173031_add_relation_column_and_drop_table_children.php
  33. 1 1
      package-lock.json
  34. 2 1
      public/t.php
  35. 1 0
      resources/views/exception/default.blade.php
  36. 21 0
      resources/views/exception/unauthorized.blade.php
  37. 3 1
      resources/views/inventory/stockInventory/blindReceive.blade.php
  38. 3 1
      resources/views/inventory/stockInventory/inventoryMission.blade.php
  39. 3 1
      resources/views/store/blindReceive/index.blade.php
  40. 3 1
      resources/views/store/checkingReceive/show.blade.php
  41. 21 0
      resources/views/unauthorized.blade.php/defaultException.blade.php
  42. 6 1
      routes/api/thirdPart/haiq.php
  43. 1 0
      serves/excelExportGo/api/controller/controller.go
  44. 99 0
      sqlSleeping.txt
  45. 20 2
      tests/webApi/thirdPart/haiq/storage.http

+ 1 - 1
app/Console/Commands/LogExpireDelete.php

@@ -46,6 +46,6 @@ class LogExpireDelete extends Command
     public function deleteLog(){
         $expire_duration=config('logging.expire_duration');//前150天
         $date=Carbon::now()->subDays($expire_duration)->format('Y-m-d');
-        DB::table('logs')->where('created_at','like',$date.'%')->delete();
+        DB::table('logs')->where('created_at','<',$date)->delete();
     }
 }

+ 27 - 9
app/Exceptions/Handler.php

@@ -3,6 +3,7 @@
 namespace App\Exceptions;
 
 use App\Http\Controllers\Controller;
+use App\Services\LogService;
 use Exception;
 use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
 use Illuminate\Http\Exceptions\HttpResponseException;
@@ -56,18 +57,35 @@ class Handler extends ExceptionHandler
     public function render($request, Throwable $exception)
     {
         try{
-            if (method_exists($exception,'getStatusCode')) {
-            $code = $exception->getStatusCode();
-            Controller::logS('exception',$code,$exception->getTraceAsString().'|| '.$exception->getMessage().' ||'.json_encode($request));
-            switch ($code){
-                case 419:return response()->view('exception.login');
-                case 404:return response()->view('exception.404');
-                default: return response()->view('exception.default',compact('code'));
+            if(strpos($exception->getMessage(),'This action is unauthorized')!==false){
+                return response()->view('exception.unauthorized');
             }
+            $errMsg=(function()use($exception){
+                return $errMsg=
+                    '异常: '
+                    .' code:'.$exception->getStatusCode()??''
+                    .' message:'.$exception->getMessage()??''
+                    .' trace:'.$exception->getTraceAsString()??'';
+            })();
+            if (method_exists($exception,'getStatusCode')) {
+                $code = $exception->getStatusCode();
+                switch ($code){
+                    case 419: $view='exception.login';break;
+                    case 404:$view='exception.404';break;
+                    default: $view='exception.default';break;
+                }
+                return response()->view($view,[
+                    'code'=> $code,
+                    'message'=>$exception->getMessage(),
+                    ]);
             }
-            Controller::logS('exception',class_basename($exception),$exception->getTraceAsString().'|| ||'.json_encode($request));
-        }catch (\Exception $e){
 
+        }catch (\Exception $e){}finally{
+            LogService::log(__METHOD__,__FUNCTION__,
+                $errMsg??''
+                .'请求:'.json_encode($request->all())
+                .'调用堆栈:'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,4))
+            );
         }
         return parent::render($request, $exception);
     }

+ 2 - 2
app/Http/Controllers/CitiesController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use App\City;
+use App\Http\Requests\TestAaRequest;
 use App\Province;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Auth;
@@ -11,7 +12,7 @@ use Illuminate\Support\Facades\Validator;
 
 class CitiesController extends Controller
 {
-    public function index()
+    public function index(Request $request)
     {
         if(!Gate::allows('城市-查询')){ return redirect(url('/'));  }
         $cities=City::orderBy('id', 'DESC')->paginate(50);
@@ -25,7 +26,6 @@ class CitiesController extends Controller
         return view('maintenance.city.create',['provinces'=>$provinces]);
     }
 
-
     public function store(Request $request)
     {
         if(!Gate::allows('城市-录入')){ return redirect(url('/'));  }

+ 5 - 24
app/Http/Controllers/TestController.php

@@ -10,6 +10,7 @@ use App\Commodity;
 use App\CommodityBarcode;
 use App\Console\Commands\SyncWMSOrderTask;
 use App\Events\CancelOrder;
+use App\Http\Requests\TestAaRequest;
 use App\Imports\OrderTrackingImport;
 use App\InventoryAccount;
 use App\LaborReport;
@@ -55,6 +56,7 @@ use App\Services\ShopService;
 use App\Services\StoreService;
 use App\Services\WarehouseService;
 use App\Store;
+use App\StationTaskBatch;
 use App\StoreCheckingReceiveItem;
 use App\StoreItems;
 use App\User;
@@ -68,6 +70,7 @@ use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Cache;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\DB;
+use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Str;
 use Maatwebsite\Excel\Facades\Excel;
 use Ramsey\Collection\Collection;
@@ -252,31 +255,9 @@ else $sql .="  AND LOTATT05 IS NULL";
         return "cacheing get:'$cache'<script>document.write('<br>localStorage:'+localStorage.getItem('storedTest'))</script>";
     }
 
-    function t1(Request $request)
+    function t1(TestAaRequest $request)
     {
-        {
-            $username = config('database.connections.oracle.username');
-            $password = config('database.connections.oracle.password');
-            $host = config('database.connections.oracle.host');
-            $service_name = config('database.connections.oracle.service_name');
-            $conn = oci_connect($username, $password, $host . '/' . $service_name); //连接oracle数据库
-            $IN_WarehouseID = '';
-            $IN_TraceID = '';
-            $IN_WavenNo = '';
-            $IN_UserID = '';
-            $IN_Language = '';
-            $OUT_Return_Code = '';
-            $sql_sp = "begin SPCUS_EDI_WCS001(:IN_WarehouseID,:IN_Process_Action_C,:IN_Process_By_C,
-        :IN_WaveNO_C,:IN_OrderNO_C,:IN_OrderLineNO_C,:IN_AllocationDetailsID,:IN_Language,:IN_UserID,:OUT_Return_Code); end;";
-            $stmt = oci_parse($conn, $sql_sp);
-            oci_bind_by_name($stmt, ':IN_Warehouse', $IN_WarehouseID);
-            oci_bind_by_name($stmt, ':IN_TraceID', $IN_TraceID);
-            oci_bind_by_name($stmt, ':IN_WavenNo', $IN_WavenNo);
-            oci_bind_by_name($stmt, ':IN_Language', $IN_Language);
-            oci_bind_by_name($stmt, ':IN_UserID', $IN_UserID);
-            oci_bind_by_name($stmt, ':OUT_Return_Code', $OUT_Return_Code);
-            return oci_execute($stmt);
-        }
+        dd($request['abc']);
     }
     function packageT(Request $request)
     {

+ 7 - 0
app/Http/Controllers/api/thirdPart/haiq/LightController.php

@@ -24,4 +24,11 @@ class LightController
     public function lightOff(Request $request){
     }
 
+    public function update(Request $request){
+        $success = $request->input('success');
+        $location = $success?200:0;
+        app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->all()));
+        return ['location'=>$location,'errMsg'=>'','data'=>$request->all()];
+    }
+
 }

+ 120 - 65
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -4,6 +4,7 @@
 namespace App\Http\Controllers\api\thirdPart\haiq;
 
 
+use App\Http\Requests\ForeignHaiRobotic_taskUpdateRequest;
 use App\Services\ForeignHaiRoboticsService;
 use Illuminate\Http\Request;
 use Illuminate\Support\Facades\Http;
@@ -37,98 +38,136 @@ class StorageController
             "bins" => [$bin],//可执行货箱任务
         ]];*/
         $this->post = [[
-            "taskMode"      => 2,
+            "taskMode"      => 1,
             "bins"=>[[
-                "taskCode"  =>"TEST-BS2011160007",
-                "binCode"   => "IDE0000001",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTx1za3X14",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ],[
-                "taskCode"  =>"TEST-BS2011160008",
-                "binCode"   => "IDE0000001",
-//                "fromLocCode" => "BIN-IN1",
-                "toLocCode" => "BIN-OUT1",
-            ],[
-                "taskCode"  =>"TEST-BS2011160009",
-                "binCode"   => "IDE0000001",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTx2za3X43",
+                "binCode"   => "IDE0000131",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ]],
-            "groupCode"     => 21,
+            "groupCode"     => 'WMxz3acX14',
             "priority"      => 20,
-            "sequenceFlag"  => -1,
+            "sequenceFlag"  => 1,
         ]];
         $this->post2 = [[
             "taskMode"      => 2,
             "bins"=>[[
-                "taskCode"  =>"TEST-BS2011160016",
-                "binCode"   => "IDE0000002",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTxx2zbaa1",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "BIN-OUT1",
+            ],[
+                "taskCode"  =>"TESTxx3zbaa1",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ],[
-                "taskCode"  =>"TEST-BS2011160017",
-                "binCode"   => "IDE0000009",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTxx4zbaa1",
+                "binCode"   => "IDE0000128",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ],[
-                "taskCode"  =>"TEST-BS2011160018",
-                "binCode"   => "IDE0000014",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTxx5zbaa1",
+                "binCode"   => "IDE0000129",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ],[
-                "taskCode"  =>"TEST-BS2011160019",
-                "binCode"   => "IDE0000016",
-//                "fromLocCode" => "BIN-IN1",
+                "taskCode"  =>"TESTxx6zbaa1",
+                "binCode"   => "IDE0000127",
+                "fromLocCode" => "BIN-IN1",
                 "toLocCode" => "BIN-OUT1",
             ]],
-            "groupCode"     => 'W12346',
+            "groupCode"     => 'WMxz64b2a1',
             "priority"      => 20,
-            "sequenceFlag"  => -1,
-        ]];
+            "sequenceFlag"  => 1,
+        ]];;
         $this->backIn = [[
             "taskMode"      => 1,
             "bins"=>[[
-                "taskCode"  =>"TESTININ-BS2011160016",
-                "binCode"   => "IDE0000052",
-                "fromLocCode" => "BIN-OUT1",
+                "taskCode"  =>"testIn1ax",
+                "binCode"   => "IDE0000007",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTIN-BS2011160017",
-                "binCode"   => "IDE0000004",
-                "fromLocCode" => "BIN-OUT1",
+                "taskCode"  =>"testIn2ax",
+                "binCode"   => "IDE0000129",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMx135ax',
+            "priority"      => 20,
+            "sequenceFlag"  => 1,
+        ]];
+        $this->backIn2 = [[
+            "taskMode"      => 6,
+            "bins"=>[[
+                "taskCode"  =>"testIn123",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "HAIB2-01-03",
+                "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTIN-BS2011160018",
-                "binCode"   => "IDE0000054",
-                "fromLocCode" => "BIN-OUT1",
+                "taskCode"  =>"testIn223",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "HAIB2-02-03",
+                "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTIN-BS2011160019",
-                "binCode"   => "IDE0005683",
-                "fromLocCode" => "BIN-OUT1",
+                "taskCode"  =>"testIn323",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "HAIB2-03-03",
+                "toLocCode" => "",
             ]],
-            "groupCode"     => 'W12346In',
+            "groupCode"     => 'WMx14',
             "priority"      => 20,
-            "sequenceFlag"  => -1,
+            "sequenceFlag"  => 1,
         ]];
         $this->move = [[
-            "taskMode"      => 3,
+            "taskMode"      => 1,
             "bins"=>[[
-                "taskCode"  =>"TESTINM-BS2011160024",
-                "binCode"   => "IDE0000054",
-                "fromLocCode" => "",
-                "toLocCode" => "HAIB2-01-02",
+                "taskCode"  =>"testm1z6",
+                "binCode"   => "IDE0000034",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTINM-BS2011160023",
-                "binCode"   => "IDE0000004",
-                "fromLocCode" => "",
-                "toLocCode" => "HAIB2-01-01",
+                "taskCode"  =>"testm2z6",
+                "binCode"   => "IDE0000093",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
             ],[
-                "taskCode"  =>"TESTINM-BS2011160022",
-                "binCode"   => "IDE0005683",
-                "fromLocCode" => "",
-                "toLocCode" => "HAIB2-02-03",
-            ]],
-            "groupCode"     => 'WM12352',
+                "taskCode"  =>"testm3z6",
+                "binCode"   => "IDE0000130",
+                "fromLocCode" => "BIN-IN1",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMm1z6',
             "priority"      => 20,
-            "sequenceFlag"  => -1,
+            "sequenceFlag"  => 1,
+        ]];//128,129.127
+        $this->move2 = [[
+            "taskMode"      => 6,
+            "bins"=>[[
+                "taskCode"  =>"testm11",
+                "binCode"   => "IDE0000128",
+                "fromLocCode" => "HAIB2-01-01",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm21",
+                "binCode"   => "IDE000129",
+                "fromLocCode" => "HAIB2-02-01",
+                "toLocCode" => "",
+            ],[
+                "taskCode"  =>"testm31",
+                "binCode"   => "IDE0000127",
+                "fromLocCode" => "HAIB2-03-01",
+                "toLocCode" => "",
+            ],],
+            "groupCode"     => 'WMm2',
+            "priority"      => 20,
+            "sequenceFlag"  => 1,
         ]];
         $this->lightOn = [
             "areaCode"=> "1004",
@@ -149,10 +188,11 @@ class StorageController
                 "uomDesc01"=> "uo",
                 "uomDesc02"=> "uo"
             ],
-            "locCode"=> "1004-BZ04-01-01"
+            "locCode"=> "HAIB2-02-03"
         ];
         $this->lightOff = [
-            "locCode"=> "12G03-21",
+            "PTLAction"=> 0,
+            "locCode"=> "HAIB2-02-03"
         ];
     }
 
@@ -177,7 +217,7 @@ class StorageController
         $response = Http::post(config('api.haiq.storage.light'),$post);
         return $response->body();
     }
-    public function moveBin(Request $request){
+    public function moveBinOut(Request $request){
         return $this->relocate($request,$this->post);
     }
     public function moveBin2(Request $request){
@@ -186,22 +226,37 @@ class StorageController
     public function moveBinIn(Request $request){
         return $this->relocate($request,$this->backIn);
     }
+    public function moveBinIn2(Request $request){
+        return $this->relocate($request,$this->backIn2);
+    }
+
     public function moveBinM(Request $request){
         return $this->relocate($request,$this->move);
     }
+    public function moveBinM2(Request $request){
+        return $this->relocate($request,$this->move2);
+    }
     public function lightOn(Request $request){
         return $this->light($request,$this->lightOn);
     }
     public function lightOff(Request $request){
         return $this->light($request,$this->lightOff);
     }
-    public function taskUpdate(Request $request){
-        $this->service->taskUpdate();
+    public function taskUpdate(ForeignHaiRobotic_taskUpdateRequest $request){
+        $this->service->taskUpdate(
+            $request['groupCode'],
+            $request['taskCode'],
+            $request['updateEventType'],
+            $request['status'],
+            $request['binCode'],
+            $request['kubotId'],
+            $request['description']
+        );
         app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->all()));
         return ['code'=>200,'errMsg'=>'','data'=>$request->all()];
     }
     public function exception(Request $request){
-        $this->service->taskUpdate();
+        $this->service->throwException();
         app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($request->all()));
         return ['code'=>200,'errMsg'=>'','data'=>$request->all()];
     }

+ 59 - 0
app/Http/Requests/ForeignHaiRobotic_taskUpdateRequest.php

@@ -0,0 +1,59 @@
+<?php
+
+namespace App\Http\Requests;
+
+use App\Services\LogService;
+use Illuminate\Foundation\Http\FormRequest;
+use Illuminate\Validation\Validator;
+
+class ForeignHaiRobotic_taskUpdateRequest extends FormRequest
+{
+    /**
+     * Determine if the user is authorized to make this request.
+     *
+     * @return bool
+     */
+    public function authorize()
+    {
+        return true;
+    }
+
+    /**
+     * Get the validation rules that apply to the request.
+     *
+     * @return array
+     */
+    public function rules()
+    {
+        return [
+           'groupCode'=>'required',
+           'taskCode'=>'required',
+           'updateEventType'=>'required',
+           'status'=>'required',
+           'binCode'=>'required',
+           'kubotId'=>'required',
+           'description'=>'nullable',
+        ];
+    }
+    public function withValidator(Validator $validator)
+    {
+        $validator->after(function (Validator $validator) {
+            if($validator->errors()->isNotEmpty()){
+                $validator->errors()->add('code','422');
+                $validator->errors()->add('errMsg', json_encode($validator->errors()->messages()));
+                $validator->errors()->add('data',$validator->errors()->toJson());
+            }
+
+            $errMsg=(function()use($validator){
+                if($validator->errors()->isEmpty())return '';
+                return $errMsg = '错误: '.$validator->errors()->toJson();
+            })();
+
+            LogService::log(__METHOD__,__FUNCTION__,
+                $errMsg??''
+                .'请求:'.json_encode($this->all())
+                .'调用堆栈:'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3))
+            );
+        });
+    }
+}

+ 3 - 0
app/OrderCommodity.php

@@ -17,6 +17,9 @@ class OrderCommodity extends Model
     public function commodity(){
         return $this->hasOne('\App\Commodity','id','commodity_id');
     }
+    public function orderBin(){
+        return $this->hasOne(OrderBin::class,'order_id','order_id');
+    }
     public function getBarcodeAttribute(){
         $commodity=$this->commodity()->first();
         if($commodity)return $commodity['barcode'];

+ 3 - 4
app/Providers/AppServiceProvider.php

@@ -83,7 +83,7 @@ use Illuminate\Support\Facades\Schema;
 use Illuminate\Support\Facades\View;
 use Illuminate\Support\ServiceProvider;
 use Ramsey\Uuid\Uuid;
-use Validator;
+use Illuminate\Support\Facades\Validator;
 
 class AppServiceProvider extends ServiceProvider
 {
@@ -95,8 +95,6 @@ class AppServiceProvider extends ServiceProvider
     public function register()
     {
         //
-        app()->singleton('OrderIssuePerformanceService',OrderIssuePerformanceService::class);
-        app()->singleton('InventoryCompareService',InventoryCompareService::class);
     }
 
     /**
@@ -146,6 +144,7 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('ForeignHaiRoboticsService',ForeignHaiRoboticsService::class);
         app()->singleton('InventoryDailyLogService',InventoryDailyLogService::class);
         app()->singleton('InventoryAccountMissionService',InventoryAccountMissionService::class);
+        app()->singleton('InventoryCompareService',InventoryCompareService::class);
         app()->singleton('LaborReportsCountingRecordService',LaborReportsCountingRecordService::class);
         app()->singleton('LogService',LogService::class);
         app()->singleton('LogisticService',LogisticService::class);
@@ -158,9 +157,9 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('OrderCommodityService',OrderCommodityService::class);
         app()->singleton('OrderCommodityAssignService',OrderCommodityAssignService::class);
         app()->singleton('OrderCountingRecordService',OrderCountingRecordService::class);
+        app()->singleton('OrderIssuePerformanceService',OrderIssuePerformanceService::class);
         app()->singleton('OrderIssueService',OrderIssueService::class);
         app()->singleton('OrderIssueWorkLoadService',OrderIssueWorkLoadService::class);
-        app()->singleton('OrderIssuePerformanceService',OrderIssuePerformanceService::class);
         app()->singleton('OrderPackageCommoditiesService',OrderPackageCommoditiesService::class);
         app()->singleton('OrderPackageService',OrderPackageService::class);
         app()->singleton('OrderService',OrderService::class);

+ 27 - 8
app/Services/BatchService.php

@@ -9,12 +9,24 @@ Class BatchService
 {
     /** @var StationTaskBatchService $stationTaskBatchService */
     private $stationTaskBatchService;
+    /** @var StationRuleBatchService $stationRuleBatchService */
+    private $stationRuleBatchService;
+    /** @var StationTaskMaterialBoxService $stationTaskMaterialBoxService */
+    private $stationTaskMaterialBoxService;
+    /** @var StationTaskCommodityService $stationTaskCommodityService */
+    private $stationTaskCommodityService;
+    /** @var StationTaskService $stationTaskService */
+    private $stationTaskService;
     public function __construct(){
         $this->stationTaskBatchService=null;
+        $this->stationRuleBatchService=null;
+        $this->stationTaskMaterialBoxService=null;
+        $this->stationTaskCommodityService=null;
+        $this->stationTaskService=null;
     }
 
     public function get(array $params)
-    {
+    {~
         $query = Batch::query();
         foreach ($params as $column=>$param){
             if (is_array($param))$query->whereIn($column,$param);
@@ -42,13 +54,20 @@ Class BatchService
     public function assignTasks(array $batches)
     {
         $this->stationTaskBatchService=app('StationTaskBatchService');
-        //按规则过滤需要的波次
-        //分配
-        $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches); //注册波次任务
-        //注册料箱任务
-        //注册商品任务
-        //注册总任务
-        //执行总任务
+        $this->stationRuleBatchService=app('StationRuleBatchService');
+        $this->stationTaskService=app('StationTaskService');
+        $this->stationTaskCommodityService=app('StationTaskCommodityService');
+        $this->stationTaskMaterialBoxService=app('StationTaskMaterialBoxService');
+
+        $batches_canProcess = $this->stationRuleBatchService->getBatches_canProcess($batches); //按规则过滤需要的波次
+        if($batches_canProcess->isEmpty()) return;
+
+        $stationTasks =  $this->stationTaskService->create($batches_canProcess->count()); //生成总任务
+        $stationTaskBatches=$this->stationTaskBatchService->createByBatches($batches_canProcess,$stationTasks); //注册波次任务
+        $this->stationTaskCommodityService->createByBatches($batches_canProcess,$stationTasks); //注册商品任务
+        $this->stationTaskMaterialBoxService->createByBatches($batches_canProcess,$stationTasks); //注册料箱任务
+
+        $this->stationTaskBatchService->runMany($stationTaskBatches);//执行波次任务
     }
 
     public function getBatchByCodes($codes)

+ 97 - 1
app/Services/ForeignHaiRoboticsService.php

@@ -4,10 +4,96 @@
 namespace App\Services;
 
 
+use App\MaterialBox;
+use App\StationTaskMaterialBox;
 use Illuminate\Http\Request;
+use Illuminate\Http\Response;
+use Illuminate\Support\Facades\Http;
+use Ramsey\Collection\Collection;
 
 class ForeignHaiRoboticsService
 {
+    /**
+     * @param string $modeName '输送线入立架'|'立架出至输送线'|'移动立架内位置'|'缓存架入立架'|'立架出至缓存架'
+     * @param string $fromLocation
+     * @param string $toLocation
+     * @param Collection $taskMaterialBoxes
+     * @param string $groupId
+     * @param int $priority
+     * @param int $isSequenced
+     */
+    private function makeJson_move(
+        Collection $taskMaterialBoxes,
+        string $modeName,
+        string $fromLocation='',
+        string $toLocation='',
+        $groupId=''
+        , $priority=10
+        , $isSequenced=1
+    ){
+        $timestampSuffix = microtime(true);
+        $taskMode=(function()use($modeName){
+            switch ($modeName){
+                case '输送线入立架': return 1;
+                case '立架出至输送线': return 2;
+                case '移动立架内位置': return 3;
+                case '缓存架入立架':
+                case '立架出至缓存架': return 6;
+                default: throw new \Exception('发至海柔的移料箱请求,模式不存在');
+            }
+        })();
+        $bins=$taskMaterialBoxes->map(function (StationTaskMaterialBox $taskMaterialBox)use($timestampSuffix){
+            return [
+                "taskCode"  =>"{$taskMaterialBox['id']}_{$taskMaterialBox['material_box_id']}_{$timestampSuffix}",
+                "binCode"   => $taskMaterialBox['materialBox']['code'],
+                "fromLocCode" => $fromLocation??'',
+                "toLocCode" => $toLocation??'',
+            ];
+        });
+        $groupId .= $timestampSuffix;
+        return [
+            "taskMode"  =>$taskMode,
+            "bins"=>$bins,
+            "groupCode"=>$groupId,
+            "priority"=>$priority,
+            "sequenceFlag"=>$isSequenced,
+        ];
+    }
+
+    public function fetchGroupToProcessor($toLocation, Collection $taskMaterialBoxes, $groupIdPrefix=''): bool
+    {
+        $dataToPost=$this->makeJson_move(
+            $taskMaterialBoxes,
+            '立架出至输送线',
+            '',
+            $toLocation,
+            $groupIdPrefix
+        );
+        $response = Http::post(config('api.haiq.storage.moveBin'),$dataToPost);
+        $errMsg=(function()use($response){
+            if($response->ok())return '';
+            $errMsg = '错误: ';
+            if (!$response){
+                return $errMsg.'没有返回内容,检查连接或目标服务器';
+            }
+            switch (((string)$response["code"])[0]){
+                case 5: $errMsg.='目标服务器代码错误,请联系对方';break;
+                case 4: $errMsg.='权限不足以请求资源,请检查对方服务器规范';break;
+                default: $errMsg.='出现未知请求错误';break;
+            }
+            $responseDetails=' code:'.$response["code"]
+                .' header:'.$response->body()
+                .' response:'.json_encode($response->headers());
+            return $errMsg.$responseDetails;
+        })();
+
+        LogService::log(__METHOD__,__FUNCTION__,
+            $errMsg??''
+            .'请求:'.json_encode($dataToPost)
+            .'调用堆栈:'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3))
+        );
+        return $isSuccess=!$errMsg;
+    }
 
     public function moveBin(){
 
@@ -16,10 +102,20 @@ class ForeignHaiRoboticsService
     public function markBinProcessed(){
 
     }
-    public function taskUpdate(){
+    public function taskUpdate(
+        $groupCode,
+        $taskCode,
+        $updateEventType,   //0:task_begin(取货)1:task_end(放货)
+        $status,            //0:任务成功1:任务失败
+        $binCode,
+        $robotId,
+        $description
+    ){
+
 
     }
     public function throwException(){
 
     }
+
 }

+ 30 - 0
app/Services/MaterialBoxService.php

@@ -0,0 +1,30 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\MaterialBox;
+use Illuminate\Support\Facades\Cache;
+
+class MaterialBoxService
+{
+
+    function get(array $kvPairs){
+        ksort($kvPairs);
+        return Cache::remember('MaterialBox_'.md5(json_encode($kvPairs)), config('cache.expirations.rarelyChange'), function ()use($kvPairs) {
+            $query = MaterialBox::query();
+            foreach ($kvPairs as $column => $value){
+                if (is_array($value))$query->whereIn($column,$value);
+                else $query->where($column,$value);
+            }
+            return $query->get();
+        });
+    }
+
+    function firstOrCreate(array $kvPairs){
+        $materialBox=$this->get($kvPairs);
+        if(!$materialBox)
+            return MaterialBox::query()->create($kvPairs);
+    }
+}

+ 8 - 6
app/Services/StationService.php

@@ -18,12 +18,14 @@ class StationService
      * @return Station
      * @throws Exception
      */
-    function getDefaultStation(string $typeName):Station{
-        $station= Cache::remember('StationType_default_name_'.$typeName,config('rarelyChange'), function ()use($typeName) {
-            $stationType= StationType::query()->where('name',$typeName)->orderBy('id')->get('id')->first();
-            if(!$stationType) throw new Exception('指定站类型获取不到');
-            return Station::query()->where('station_type_id',$stationType['id'])->first();
-        });
+    function getStation_byType(string $typeName):Station{
+        $station= Cache::remember('Station_typeName_'.$typeName,
+            config('cache.expirations.rarelyChange'),
+            function ()use($typeName) {
+                $stationType= StationType::query()->where('name',$typeName)->orderBy('id')->get('id')->first();
+                if(!$stationType) throw new Exception('指定站类型获取不到');
+                return Station::query()->where('station_type_id',$stationType['id'])->first();
+            });
         if(!$station)throw new Exception('默认站获取不到');
         return $station;
     }

+ 141 - 28
app/Services/StationTaskBatchService.php

@@ -5,7 +5,9 @@ namespace App\Services;
 
 
 use App\Batch;
+use App\Log;
 use App\Station;
+use App\StationTask;
 use App\StationTaskBatch;
 use App\StationTaskBatchType;
 use Exception;
@@ -20,45 +22,156 @@ class StationTaskBatchService
     private $stationTaskBatchTypeService;
     /** @var BatchService $batchService */
     private $batchService;
-    public function __construct(){
-        $this->stationService=null;
-        $this->stationTaskBatchTypeService=null;
-        $this->batchService=null;
+    /** @var StationTypeService $stationTypeService */
+    private $stationTypeService;
+    /** @var StationTaskService $stationTaskService */
+    private $stationTaskService;
+    /** @var ForeignHaiRoboticsService $foreignHaiRoboticsService */
+    private $foreignHaiRoboticsService;
+
+    public function __construct()
+    {
+        $this->stationService = null;
+        $this->stationTypeService = null;
+        $this->stationTaskBatchTypeService = null;
+        $this->batchService = null;
+        $this->stationTaskService = null;
+        $this->foreignHaiRoboticsService = null;
     }
 
     /**
      * @param $batches Batch[]
-     * @param Station $station
+     * @param Collection $stationTasks_toAttach
      * @return Collection
+     * @throws Exception
      */
-    public function createByBatches(array $batches,Station $station): Collection
+    function createByBatches(array $batches, Collection $stationTasks_toAttach): Collection
     {
-        $this->stationService=app('StationService');
-        $this->stationTaskBatchTypeService=app('StationTaskBatchTypeService');
-        $this->batchService=app('BatchService');
-
-        $stationMissionBatches_toCreate=new Collection();
-//        $station=$this->stationService->getDefaultStation('料箱出货口');
-        $id_stationMissionBatchType=$this->stationTaskBatchTypeService->firstByWhere('name','U型线分捡');
-
-        $batches_handled=[];
-        foreach ($batches as $batch){
-            if ($batch['status']=='未处理'){
-                $stationMissionBatches_toCreate->push([
-                    'batch_id'=>$batch['id'],
-                    'station_id'=>$station['id'],
-                    'station_mission_batch_type_id'=> $id_stationMissionBatchType,
-                    'status'=>'待处理'
+        $this->stationService = app('StationService');
+        $this->stationTypeService = app('StationTypeService');
+        $this->stationTaskBatchTypeService = app('StationTaskBatchTypeService');
+        $this->batchService = app('BatchService');
+
+        $stationTaskBatches_toCreate = new Collection();
+        $id_stationTaskBatchType = $this->stationTaskBatchTypeService->firstByWhere('name', 'U型线分捡');
+
+        $batches_handled = collect();
+        foreach ($batches as $batch) {
+            if ($batch['status'] == '未处理') {
+                $stationType = $this->stationTypeService->getByBatch($batch);
+                $station = $this->stationService->getStation_byType($stationType['name']);
+                $stationTaskBatches_toCreate->push([
+                    'batch_id' => $batch['id'],
+                    'station_id' => $station['id'],
+                    'station_task_batch_type_id' => $id_stationTaskBatchType,
+                    'status' => '待处理'
                 ]);
-                $batches_handled[]=$batch;
+                $batches_handled->push($batch);
             }
         }
-        $this->batchService->updateWhereIn('id',data_get($batches_handled,'*.id'),['status'=>'处理中']);
-        $this->insert($stationMissionBatches_toCreate->toArray());
-        return $stationMissionBatches_toCreate;
+        $this->batchService->updateWhereIn('id', data_get($batches_handled, '*.id'), ['status' => '处理中']);
+        $this->insert($stationTaskBatches_toCreate->toArray());
+        $this->stationTaskService->registerSubTasks($stationTasks_toAttach,
+            $stationTaskBatches_toCreate->map(function ($stationMissionBatch) {
+                return [$stationMissionBatch];
+            })
+        );
+
+        return $stationTaskBatches_toCreate;
+    }
+
+    function insert(array $stationMissionBatches): bool
+    {
+        $inserted = StationTaskBatch::query()->insert($stationMissionBatches);
+        LogService::log(__METHOD__, __FUNCTION__, json_encode($stationMissionBatches) .
+            '||' . json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 0, 3)));
+        return $inserted;
+    }
+
+    function markManyExcepted(Collection $stationTaskBatches_failed)
+    {
+        foreach (
+            $stationTaskBatches_failed
+                 as $stationTaskBatch) {
+            if($stationTaskBatch['status']!='异常')
+                $this->markExcepted($stationTaskBatch);
+        }
+
+        ($logAtFailings_andWait =
+            function ($stationTaskBatches_failed) {
+                if ($stationTaskBatches_failed->isEmpty()) return;
+                LogService::log(__METHOD__, __FUNCTION__,
+                    '任务波次异常失败的:' . $stationTaskBatches_failed->toJson()
+                    . '调用堆栈:' . json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 0, 3))
+                );
+            })($stationTaskBatches_failed);
     }
 
-    public function insert(array $stationMissionBatches_inArray){
-        return StationTaskBatch::query()->insert($stationMissionBatches_inArray);
+    /**
+     * @param Collection $stationTaskBatches
+     * @return Collection|\Tightenco\Collect\Support\Collection|null 返回执行失败的记录
+     */
+    function runMany(Collection $stationTaskBatches)
+    {
+        $stationTaskBatches_failed = null;
+        ($execute =
+            function (
+                Collection $stationTaskBatches, &$stationTaskBatches_failed) {
+                if ($stationTaskBatches->isEmpty()) return;
+                $stationTaskBatches_failed = collect();
+                foreach ($stationTaskBatches as $stationTaskBatch) {
+                    $failed = !$this->run($stationTaskBatch);
+                    if ($failed) $stationTaskBatches_failed->push($stationTaskBatch);
+                }
+            })($stationTaskBatches, $stationTaskBatches_failed);
+
+        ($logAtFailings_andWait =
+            function ($stationTaskBatches_failed) {
+                if ($stationTaskBatches_failed->isEmpty()) return;
+                $retry_after_sec = config('task.batchTask.retry_after_sec');
+                LogService::log(__METHOD__, __FUNCTION__,
+                    '任务波次没有执行完的,' . $retry_after_sec . '秒后准备重试:' . $stationTaskBatches_failed->toJson()
+                    . '调用堆栈:' . json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), 0, 3))
+                );
+                sleep($retry_after_sec);
+            })($stationTaskBatches_failed);
+
+        $execute                    ($stationTaskBatches_failed, $stationTaskBatches_failed); //再次尝试
+        $this->markManyExcepted  ($stationTaskBatches_failed);
+        return                      $stationTaskBatches_failed;
+    }
+
+    function run(StationTaskBatch $stationTaskBatch): bool
+    {
+        $toLocation         = $stationTaskBatch['station']['code'];
+        $groupPrefix        = $stationTaskBatch['id'];
+        $taskMaterialBoxes  = $stationTaskBatch['stationTask']['taskMaterialBoxes'] ??
+            function () use ($stationTaskBatch) {
+                throw new Exception('找不到料箱:' . json_encode($stationTaskBatch));
+            };
+        $isFetchedFromRobotics          = $this->foreignHaiRoboticsService->
+                                    fetchGroupToProcessor($toLocation, $taskMaterialBoxes, $groupPrefix);
+        ($markNewStatus
+            =function()use($isFetchedFromRobotics,$stationTaskBatch){
+            $isFetchedFromRobotics?
+                $this->markProcessing($stationTaskBatch):
+                $this->markExcepted($stationTaskBatch);
+        })();
+        return $isFetchedFromRobotics;
+    }
+
+    function markProcessing(StationTaskBatch $stationTaskBatch)
+    {
+        $stationTaskBatch   ['status']                  = '处理中';
+        $stationTaskBatch   ->update();
+        $stationTaskBatch   ->loadMissing               ('stationTask');
+        $stationTaskBatch   ['stationTask']['status']   = '异常';
+        $stationTaskBatch   ['stationTask']             ->update();
+    }
+
+    function markExcepted(StationTaskBatch $stationTaskBatch)
+    {
+        $stationTaskBatch['status'] = '异常';
+        $stationTaskBatch           ->update();
     }
 }

+ 1 - 1
app/Services/StationTaskBatchTypeService.php

@@ -17,7 +17,7 @@ class StationTaskBatchTypeService
      * @return Station
      */
     public function firstByWhere(string $key,string $value):Station{
-        return Cache::remember('station_mission_batch_type_id_by_'.$key.$value, config('rarelyChange'), function ()use($key,$value) {
+        return Cache::remember('station_mission_batch_type_id_by_'.$key.$value, config('cache.expirations.rarelyChange'), function ()use($key,$value) {
             $stationMissionBatchType =StationTaskBatchType::query()->where($key, $value)->first();
             if(!$stationMissionBatchType)throw new \Exception("找不到 StationMissionBatchType,where $key = $value");
             return $stationMissionBatchType;

+ 32 - 0
app/Services/StationTaskChildService.php

@@ -0,0 +1,32 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\StationTaskBatch;
+use App\StationTaskChild;
+use Illuminate\Support\Facades\Cache;
+
+class StationTaskChildService
+{
+
+    function get(array $kvPairs){
+        ksort($kvPairs);
+        return Cache::remember('stationTaskChild_'.md5(json_encode($kvPairs)), config('cache.expirations.oftenChange'), function ()use($kvPairs) {
+            $query = StationTaskChild::query();
+            foreach ($kvPairs as $column => $value){
+                if (is_array($value))$query->whereIn($column,$value);
+                else $query->where($column,$value);
+            }
+            return $query->get();
+        });
+    }
+    public function insert(array $stationMissionBatches): bool
+    {
+        $inserted = StationTaskChild::query()->insert($stationMissionBatches);
+        LogService::log(__METHOD__,__FUNCTION__,json_encode($stationMissionBatches).
+            '||'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3)));
+        return $inserted;
+    }
+}

+ 85 - 0
app/Services/StationTaskCommodityService.php

@@ -0,0 +1,85 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Batch;
+use App\OrderCommodity;
+use App\StationTaskCommodity;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Cache;
+
+class StationTaskCommodityService
+{
+    /** @var StationService $stationService */
+    private $stationService;
+    /** @var StationTypeService $stationTypeService */
+    private $stationTypeService;
+    /** @var StationTaskService $stationTaskService */
+    private $stationTaskService;
+    /** @var MaterialBoxService $materialBoxService */
+    private $materialBoxService;
+    public function __construct(){
+        $this->stationService=null;
+        $this->stationTypeService=null;
+        $this->stationTaskService=null;
+        $this->materialBoxService=null;
+    }
+    function get(array $kvPairs){
+        ksort($kvPairs);
+        return Cache::remember('stationTaskChild_'.md5(json_encode($kvPairs)), config('cache.expirations.oftenChange'), function ()use($kvPairs) {
+            $query = StationTaskCommodity::query();
+            foreach ($kvPairs as $column => $value){
+                if (is_array($value))$query->whereIn($column,$value);
+                else $query->where($column,$value);
+            }
+            return $query->get();
+        });
+    }
+    function createByBatches(array $batches,Collection $stationTasks_toAttach): Collection
+    {
+        $this->stationTaskService=app('StationTaskService');
+        $stationTaskCommodities_listByBatch=new Collection();
+        foreach ($batches as $batch){
+            $stationTaskCommodities_listByBatch->push(
+                $this->createByBatch($batch)
+            );
+        }
+        $this->stationTaskService->registerSubTasks($stationTasks_toAttach,$stationTaskCommodities_listByBatch);
+
+    }
+
+    function createByBatch(Batch $batch): Collection
+    {
+        $this->stationTypeService=app('StationTypeService');
+        $this->stationService=app('StationService');
+        $this->materialBoxService=app('MaterialBoxService');
+        $stationTaskCommodities_toCreate=new Collection();
+        $order_ids=data_get($batch['orders'],'*.id');
+        $orderCommodities=OrderCommodity::query()->with('orderBin')->whereIn('order_id',$order_ids)->get();
+        foreach ($orderCommodities as $orderCommodity){
+            $stationType=$this->stationTypeService->getForCommodity();
+            $station=$this->stationService->getStation_byType($stationType['name']);
+            $materialBox=$this->materialBoxService->firstOrCreate(['code' => $orderCommodity['location']]);
+            $stationTaskCommodities_toCreate->push([
+                'station_id'=>$station['id'],
+                'material_box_id'=>$materialBox['id'],
+                'commodity_id'=>$orderCommodity['commodity_id'],
+                'amount'=>$orderCommodity['amount'],
+                'bin_number'=>$orderCommodity['orderBin']['number']??'',
+                'order_id'=>$orderCommodity['order_id'],
+                'status'=>'待处理'
+            ]);
+        }
+        $this->insert($stationTaskCommodities_toCreate->toArray());
+    }
+
+    public function insert(array $stationTaskCommodities): bool
+    {
+        $inserted = StationTaskCommodity::query()->insert($stationTaskCommodities);
+        LogService::log(__METHOD__,__FUNCTION__,json_encode($stationTaskCommodities).
+            '||'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3)));
+        return $inserted;
+    }
+}

+ 81 - 0
app/Services/StationTaskMaterialBoxService.php

@@ -0,0 +1,81 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Batch;
+use App\OrderCommodity;
+use App\StationTaskMaterialBox;
+use Illuminate\Support\Collection;
+use Illuminate\Support\Facades\Cache;
+
+class StationTaskMaterialBoxService
+{
+    /** @var StationService $stationService */
+    private $stationService;
+    /** @var StationTypeService $stationTypeService */
+    private $stationTypeService;
+    /** @var StationTaskService $stationTaskService */
+    private $stationTaskService;
+    /** @var MaterialBoxService $materialBoxService */
+    private $materialBoxService;
+    public function __construct(){
+        $this->stationService=null;
+        $this->stationTypeService=null;
+        $this->stationTaskService=null;
+        $this->materialBoxService=null;
+    }
+    function createByBatches(array $batches,Collection $stationTasks_toAttach): Collection
+    {
+        $stationTaskMaterialBoxes_listByBatch=new Collection();
+        foreach ($batches as $batch){
+            $stationTaskMaterialBoxes_listByBatch->push(
+                $this->createByBatch($batch)
+            );
+        }
+        $this->stationTaskService->registerSubTasks($stationTasks_toAttach,$stationTaskMaterialBoxes_listByBatch);
+
+    }
+
+    function createByBatch(Batch $batch): Collection
+    {
+        $this->materialBoxService=app('MaterialBoxService');
+        $this->stationTypeService=app('StationTypeService');
+        $this->stationService=app('StationService');
+        $stationMaterialBoxes_toCreate=new Collection();
+        $order_ids=data_get($batch['orders'],'*.id');
+        $orderCommodities=OrderCommodity::query()->with('orderBin')->whereIn('order_id',$order_ids)->get();
+        foreach ($orderCommodities as $orderCommodity){
+            $stationType=$this->stationTypeService->getForMaterialBox();
+            $station=$this->stationService->getStation_byType($stationType['name']);
+            $materialBox=$this->materialBoxService->firstOrCreate(['code' => $orderCommodity['location']]);
+            $stationMaterialBoxes_toCreate->push([
+                'station_id'=>$station['id'],
+                'material_box_id'=>$materialBox['id'],
+                'status'=>'待处理'
+            ]);
+        }
+        $this->insert($stationMaterialBoxes_toCreate->toArray());
+    }
+
+    function get(array $kvPairs){
+        ksort($kvPairs);
+        return Cache::remember('StationTaskMaterialBox'.md5(json_encode($kvPairs)), config('cache.expirations.fastChange'), function ()use($kvPairs) {
+            $query = StationTaskMaterialBox::query();
+            foreach ($kvPairs as $column => $value){
+                if (is_array($value))$query->whereIn($column,$value);
+                else $query->where($column,$value);
+            }
+            return $query->get();
+        });
+    }
+
+    public function insert(array $stationTaskMaterialBoxes): bool
+    {
+        $inserted = StationTaskMaterialBox::query()->insert($stationTaskMaterialBoxes);
+        LogService::log(__METHOD__,__FUNCTION__,json_encode($stationTaskMaterialBoxes).
+            '||'.json_encode(array_slice(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS),0,3)));
+        return $inserted;
+    }
+}

+ 67 - 0
app/Services/StationTaskService.php

@@ -0,0 +1,67 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\StationTask;
+use App\StationTaskBatch;
+use App\StationTaskChild;
+use App\StationTaskCommodity;
+use App\StationTaskMaterialBox;
+use Illuminate\Support\Collection;
+
+class StationTaskService
+{
+    /** @var StationTaskChildService $stationTaskChildService  */
+    private $stationTaskChildService;
+    public function __construct()
+    {
+        $this->stationTaskChildService=null;
+    }
+
+    function create(int $amountToCreate):Collection
+    {
+
+        $stationTasks=collect();
+        for ($i=0;$i<$amountToCreate;$i++){
+            $stationTasks->push(StationTask::query()->create(['status'=>'待处理']));
+        }
+        return $stationTasks;
+    }
+
+    /**
+     * 丙个列表一一对应,每个task注册一组子任务: [task,task...],[[subTask,subTask],[subTask,subTask]....]
+     * @param Collection $tasks
+     * @param Collection $subTaskLists 二维数组,第一维是对应注册的任务
+     * @return array
+     */
+    function registerSubTasks(Collection $tasks, Collection $subTaskLists): array
+    {
+        $this->stationTaskChildService=app('StationTaskChildService');
+        $taskChildren_toInsert=collect();
+        foreach ($subTaskLists as $i=>$subTaskList){
+            foreach ($subTaskList as $subTask){
+                $tableName=(function()use($subTask){
+                    switch (get_class($subTask)){
+                        case StationTaskBatch::class: return 'station_task_batches';
+                        case StationTaskCommodity::class: return 'station_task_commodities';
+                        case StationTaskMaterialBox::class: return 'station_task_material_boxes';
+                        default:
+                            throw new \Exception('任务类型没有定义相应的模型类');
+                    }
+                })();
+                $paramToInsert = [
+                    'station_task_id' => $tasks[$i]['id'],
+                    'station_task_table_type' => $tableName,
+                    'station_task_table_id' => $subTask['id'],
+                ];
+                $taskChild=$this->stationTaskChildService->get($paramToInsert)->frist();
+                if(!$taskChild)
+                    $taskChildren_toInsert->push($paramToInsert);
+            }
+        }
+        $this->stationTaskChildService->insert($taskChildren_toInsert->toArray());
+    }
+
+}

+ 38 - 0
app/Services/StationTypeService.php

@@ -0,0 +1,38 @@
+<?php
+
+
+namespace App\Services;
+
+
+use App\Batch;
+use App\StationRuleBatch;
+use App\StationType;
+
+class StationTypeService
+{
+    /** @var StationRuleBatchService $stationRuleBatchService */
+    private $stationRuleBatchService;
+    public function __construct()
+    {
+        $this->stationRuleBatchService=null;
+    }
+
+    function getByBatch(Batch $batch): StationType
+    {
+        $this->stationRuleBatchService=app('StationRuleBatchService');
+        $stationRuleBatch=$this->stationRuleBatchService->getByBatch($batch);
+        return $stationRuleBatch['stationType'];
+    }
+    function getForCommodity(): StationType
+    {
+        /** @var StationType $stationType */
+        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
+        return $stationType;
+    }
+    function getForMaterialBox(): StationType
+    {
+        /** @var StationType $stationType */
+        $stationType= StationType::query()->firstOrCreate(['name'=>'料箱监视器']);
+        return $stationType;
+    }
+}

+ 13 - 0
app/Services/TestService.php

@@ -0,0 +1,13 @@
+<?php
+
+
+namespace App\Services;
+
+
+class TestService
+{
+    public function __construct()
+    {
+        dd(323333);
+    }
+}

+ 6 - 0
app/StationRuleBatch.php

@@ -3,8 +3,14 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasOne;
 
 class StationRuleBatch extends Model
 {
     protected $fillable=['name','station_type_id','batch_type','owner_id'];
+
+    public function stationType(): HasOne
+    {
+        return $this->hasOne(StationType::class);
+    }
 }

+ 10 - 9
app/StationTask.php

@@ -8,20 +8,21 @@ class StationTask extends Model
 {
     protected $fillable = ['status'];
 
+    public function tasks()
+    {
+        return $this->morphTo();
+    }
 
-    public function taskCommodities()
+    public function stationTaskCommodities()
     {   //任务商品列表
-        return $this->belongsToMany(StationTaskCommodity::class,"station_task_children","station_task_id","station_task_table_id")
-            ->where("station_task_table_type","station_task_commodities");
+        return $this->morphTo()->where("station_task_table_type","station_task_commodities");
     }
-    public function taskBatches()
+    public function stationTaskBatches()
     {   //任务波次 目前为单个,取值时应取第一个即可
-        return $this->belongsToMany(StationTaskBatch::class,"station_task_children","station_task_id","station_task_table_id")
-            ->where("station_task_table_type","station_task_batches");
+        return $this->morphTo()->where("station_task_table_type","station_task_batches");
     }
-    public function taskMaterialBoxes()
+    public function stationTaskMaterialBoxes()
     {   //任务料箱
-        return $this->belongsToMany(StationTaskMaterialBox::class,"station_task_children","station_task_id","station_task_table_id")
-            ->where("station_task_table_type","station_task_material_boxes");
+        return $this->morphTo()->where("station_task_table_type","station_task_material_boxes");
     }
 }

+ 12 - 1
app/StationTaskBatch.php

@@ -3,12 +3,23 @@
 namespace App;
 
 use Illuminate\Database\Eloquent\Model;
+use Illuminate\Database\Eloquent\Relations\HasOne;
+use Illuminate\Database\Eloquent\Relations\MorphOne;
 
 class StationTaskBatch extends Model
 {
     protected $fillable=['batch_id','station_id','station_task_batch_type_id','status'];
 
-    public function batch()
+    function station(): HasOne
+    {
+        return $this->hasOne(Station::class);
+    }
+    function stationTask(): MorphOne
+    {
+        return $this->morphOne(StationTask::class,'station_taskable');
+    }
+
+    public function batch(): HasOne
     {   //波次
         return $this->hasOne(Batch::class,"id","batch_id");
     }

+ 10 - 0
app/StationTaskChild.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class StationTaskChild extends Model
+{
+    protected $fillable= ['station_task_id','station_task_table_type','station_task_table_id'];
+}

+ 3 - 0
app/StationTaskCommodity.php

@@ -16,4 +16,7 @@ class StationTaskCommodity extends Model
     {   //料箱
         return $this->hasOne(MaterialBox::class,"id","material_box_id");
     }
+    function parentTask(){
+        return $this->morphOne(StationTask::class,'station_taskable');
+    }
 }

+ 4 - 1
app/StationTaskMaterialBox.php

@@ -8,8 +8,11 @@ class StationTaskMaterialBox extends Model
 {
     protected $fillable=['station_id','material_box_id','status'];
 
-    public function box()
+    public function materialBox()
     {   //料箱
         return $this->hasOne(MaterialBox::class,"id","material_box_id");
     }
+    function parentTask(){
+        return $this->morphOne(StationTask::class,'station_taskable');
+    }
 }

+ 0 - 10
app/Validators/UserDutyCheckValidator.php

@@ -1,10 +0,0 @@
-<?php
-
-
-namespace App\Validators;
-
-
-class UserDutyCheckValidator
-{
-
-}

+ 1 - 0
config/api.php

@@ -41,6 +41,7 @@ return [
      *  https://was.baoshi56.com/api/thirdPart/haiq/pickStation/processed  //标记料箱已处理
      *  https://was.baoshi56.com/api/thirdPart/haiq/storage/taskUpdate  //任务状态更新
      *  https://was.baoshi56.com/api/thirdPart/haiq/storage/exception  //异常通知
+     *  https://was.baoshi56.com/api/thirdPart/haiq/light/update  //拍灯通知
      */
     'haiq'=>[
         'storage'=>[

+ 5 - 4
config/cache.php

@@ -5,10 +5,11 @@ use Illuminate\Support\Str;
 return [
 
     'expirations'=>[
-        'default'=>10,          //默认
-        'oftenChange'=>5,       //经常改
-        'rarelyChange'=>60,     //几乎不变
-        'commonFrequent'=>20,  //一般频率
+        'default'=>20,          //默认
+        'fastChange'=>3,       //很快改
+        'oftenChange'=>15,       //经常改
+        'rarelyChange'=>260,     //几乎不变
+        'commonFrequent'=>200,  //一般频率
         'forever' =>null,       //永久
 
         'owners'=>20,           //模型Owner

+ 7 - 0
config/task.php

@@ -0,0 +1,7 @@
+<?php
+
+return [
+    'batchTask'=>[
+        'retry_after_sec'=>30,
+    ],
+];

+ 38 - 0
database/migrations/2020_12_11_173031_add_relation_column_and_drop_table_children.php

@@ -0,0 +1,38 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddRelationColumnAndDropTableChildren extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('station_tasks', function (Blueprint $table) {
+            $table->string('station_taskable_type');
+            $table->bigInteger('station_taskable_id');
+            $table->index('station_taskable_id','station_taskable_type');
+        });
+        Schema::drop('station_task_children');
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('station_tasks', function (Blueprint $table) {
+            //
+        });
+        Schema::create('station_task_children', function (Blueprint $table) {
+            $table->id();
+        });
+    }
+}

+ 1 - 1
package-lock.json

@@ -8845,7 +8845,7 @@
         },
         "socket.io-client": {
             "version": "2.3.0",
-            "resolved": "https://registry.npm.taobao.org/socket.io-client/download/socket.io-client-2.3.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsocket.io-client%2Fdownload%2Fsocket.io-client-2.3.0.tgz",
+            "resolved": "https://registry.npm.taobao.org/socket.io-client/download/socket.io-client-2.3.0.tgz",
             "integrity": "sha1-FNW6LgC5vNFFrkQ6uWs/hsvMG7Q=",
             "requires": {
                 "backo2": "1.0.2",

+ 2 - 1
public/t.php

@@ -1,3 +1,4 @@
 <?php
 
-var_dump((bool)[]);
+$a['a'] = 321;
+echo $a['a'][1];

+ 1 - 0
resources/views/exception/default.blade.php

@@ -10,6 +10,7 @@
                     <div class="card-body">
 
                         <h2 class="text-danger">页面出现错误,请刷新重试或联系管理员,错误代码:{{$code}}</h2>
+                        <h3 class="text-danger">{{$message??''}}</h3>
                         <a href="{{url('/')}}">
                             <button class="btn btn-info">前往首页</button>
                         </a>

+ 21 - 0
resources/views/exception/unauthorized.blade.php

@@ -0,0 +1,21 @@
+@extends('layouts.app')
+@section('title')
+    没有权限请求当前资源
+@endsection
+@section('content')
+    <div class="container-fluid">
+        <div class="row justify-content-center">
+            <div class="col-md-8">
+                <div class="card">
+                    <div class="card-body">
+
+                        <h2 class="text-danger">没有权限请求当前页面或资源,如未登录请重新登录</h2>
+                        <a href="{{url('/')}}">
+                            <button class="btn btn-info">前往首页</button>
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

+ 3 - 1
resources/views/inventory/stockInventory/blindReceive.blade.php

@@ -154,7 +154,9 @@
                                 <td>@{{ goods.produce_date }}</td>
                                 <td>@{{ goods.valid_date }}</td>
                                 <td>@{{ goods.batch_number }}</td>
-                                <td><button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button></td>
+                                <td>
+                                    <button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button>
+                                </td>
                             </tr>
                         </table>
                         <hr>

+ 3 - 1
resources/views/inventory/stockInventory/inventoryMission.blade.php

@@ -193,7 +193,9 @@
                                     <td>@{{ goods.produce_date }}</td>
                                     <td>@{{ goods.valid_date }}</td>
                                     <td>@{{ goods.batch_number }}</td>
-                                    <td><button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button></td>
+                                    <td>
+                                        <button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button>
+                                    </td>
                                 </tr>
                             </table>
                             <hr>

+ 3 - 1
resources/views/store/blindReceive/index.blade.php

@@ -105,7 +105,9 @@
                                 <td>@{{ goods.valid_date }}</td>
                                 <td>@{{ goods.batch_number }}</td>
                                 <td>@{{ goods.unique_code }}</td>
-                                <td><button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button></td>
+                                <td>
+                                    <button class="btn btn-outline-danger btn-sm" @click="removeGoods($event,goods.barcode)">删</button>
+                                </td>
                             </tr>
                         </table>
                         <hr>

+ 3 - 1
resources/views/store/checkingReceive/show.blade.php

@@ -125,7 +125,9 @@
                     <td>@{{ storeCheckingReceiveItem.invalid_at }}</td>
                     <td>@{{ storeCheckingReceiveItem.batch_code }}</td>
                     <td>@{{ storeCheckingReceiveItem.unique_code }}</td>
-                    <td>@can('入库管理-盘收一体-盘收-编辑')<button @click="destroyItem(storeCheckingReceiveItem,i)" class="btn btn-sm btn-outline-danger">删除</button>@endcan</td>
+                    <td>
+{{--                        @can('入库管理-盘收一体-盘收-编辑')<button @click="destroyItem(storeCheckingReceiveItem,i)" class="btn btn-sm btn-outline-danger">删除</button>@endcan--}}
+                    </td>
                 </tr>
             </table>
         </div>

+ 21 - 0
resources/views/unauthorized.blade.php/defaultException.blade.php

@@ -0,0 +1,21 @@
+@extends('layouts.app')
+@section('title')
+    页面出现错误,错误代码:{{$code}}
+@endsection
+@section('content')
+    <div class="container-fluid">
+        <div class="row justify-content-center">
+            <div class="col-md-8">
+                <div class="card">
+                    <div class="card-body">
+
+                        <h2 class="text-danger">页面出现错误,请刷新重试或联系管理员,错误代码:{{$code}}</h2>
+                        <a href="{{url('/')}}">
+                            <button class="btn btn-info">前往首页</button>
+                        </a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

+ 6 - 1
routes/api/thirdPart/haiq.php

@@ -8,10 +8,12 @@ use Illuminate\Support\Facades\Route;
 
 
 Route::group(['prefix'=>'storage'],function(){
-    Route::post('moveBin', "StorageController@moveBin");//出库
+    Route::post('moveBinOut', "StorageController@moveBinOut");//出库
     Route::post('moveBin2', "StorageController@moveBin2");//出库
     Route::post('moveBinIn', "StorageController@moveBinIn");//移库
+    Route::post('moveBinIn2', "StorageController@moveBinIn2");//移库
     Route::post('moveBinM', "StorageController@moveBinM");//移库
+    Route::post('moveBinM2', "StorageController@moveBinM2");//移库
     Route::post('lightOn', "StorageController@lightOn");//移库
     Route::post('lightOff', "StorageController@lightOff");//移库
     Route::post('taskUpdate', "StorageController@taskUpdate");//移库
@@ -20,3 +22,6 @@ Route::group(['prefix'=>'storage'],function(){
 Route::group(['prefix'=>'pickStation'],function(){
     Route::post('processed', "PickStationController@processed");//移库
 });
+Route::group(['prefix'=>'light'],function(){
+    Route::post('update', "LightController@update");//移库
+});

+ 1 - 0
serves/excelExportGo/api/controller/controller.go

@@ -56,6 +56,7 @@ func selectModule(params map[string]string) (row []interface{}, list [][]interfa
 		err := json.Unmarshal([]byte(params["data"]),&val)
 		if err != nil {
 			utilities.WriteLog("/api/controller/controller.go:58  JSON解析失败!","ERROR")
+			utilities.WriteLog(params["data"],"ERROR")
 		}
 		row = val.ROW
 		list = val.LIST

+ 99 - 0
sqlSleeping.txt

@@ -0,0 +1,99 @@
++-------+------------+-----------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+
+| Id    | User       | Host                  | db    | Command | Time | State        | Info                                                                                                 | Progress |
++-------+------------+-----------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+
+| 30573 | wacs       | localhost:60024       | bswas | Sleep   | 32   |              |                                                                                                      | 0.000    |
+| 30574 | wacs       | localhost:60026       | bswas | Sleep   | 2    |              |                                                                                                      | 0.000    |
+| 30576 | wacs       | localhost:60034       | bswas | Sleep   | 8    |              |                                                                                                      | 0.000    |
+| 30578 | wacs       | localhost:60044       | bswas | Sleep   | 5    |              |                                                                                                      | 0.000    |
+| 30579 | wacs       | localhost:60052       | bswas | Sleep   | 26   |              |                                                                                                      | 0.000    |
+| 30580 | wacs       | localhost:60054       | bswas | Sleep   | 35   |              |                                                                                                      | 0.000    |
+| 30581 | wacs       | localhost:60062       | bswas | Sleep   | 5    |              |                                                                                                      | 0.000    |
+| 30582 | wacs       | localhost:60066       | bswas | Sleep   | 35   |              |                                                                                                      | 0.000    |
+| 30583 | wacs       | localhost:60076       | bswas | Sleep   | 2    |              |                                                                                                      | 0.000    |
+| 82709 | wacs       | localhost:60110       | bswas | Sleep   | 80   |              |                                                                                                      | 0.000    |
+| 83531 | wacs       | localhost:36828       | bswas | Sleep   | 5853 |              |                                                                                                      | 0.000    |
+| 83537 | wacs       | localhost:36864       | bswas | Sleep   | 5841 |              |                                                                                                      | 0.000    |
+| 83545 | wacs       | localhost:36910       | bswas | Sleep   | 5828 |              |                                                                                                      | 0.000    |
+| 83549 | wacs       | localhost:36934       | bswas | Sleep   | 5814 |              |                                                                                                      | 0.000    |
+| 83565 | wacs       | localhost:37016       | bswas | Sleep   | 5802 |              |                                                                                                      | 0.000    |
+| 83566 | wacs       | localhost:37020       | bswas | Execute | 15   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83571 | wacs       | localhost:37054       | bswas | Sleep   | 5789 |              |                                                                                                      | 0.000    |
+| 83580 | wacs       | localhost:37106       | bswas | Sleep   | 5774 |              |                                                                                                      | 0.000    |
+| 83587 | wacs       | localhost:37150       | bswas | Sleep   | 5761 |              |                                                                                                      | 0.000    |
+| 83596 | wacs       | localhost:37208       | bswas | Sleep   | 5748 |              |                                                                                                      | 0.000    |
+| 83610 | wacs       | localhost:37288       | bswas | Sleep   | 5735 |              |                                                                                                      | 0.000    |
+| 83792 | wacs       | localhost:38180       | bswas | Sleep   | 5491 |              |                                                                                                      | 0.000    |
+| 83793 | wacs       | localhost:38184       | bswas | Execute | 16   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83802 | wacs       | localhost:38244       | bswas | Sleep   | 5477 |              |                                                                                                      | 0.000    |
+| 83803 | wacs       | localhost:38254       | bswas | Execute | 5    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83811 | wacs       | localhost:38302       | bswas | Sleep   | 5464 |              |                                                                                                      | 0.000    |
+| 83812 | wacs       | localhost:38310       | bswas | Execute | 7    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83815 | wacs       | localhost:38330       | bswas | Sleep   | 5452 |              |                                                                                                      | 0.000    |
+| 83816 | wacs       | localhost:38334       | bswas | Execute | 13   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83826 | wacs       | localhost:38386       | bswas | Sleep   | 5439 |              |                                                                                                      | 0.000    |
+| 83827 | wacs       | localhost:38390       | bswas | Execute | 6    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83832 | wacs       | localhost:38420       | bswas | Sleep   | 5426 |              |                                                                                                      | 0.000    |
+| 83840 | wacs       | localhost:38466       | bswas | Sleep   | 5413 |              |                                                                                                      | 0.000    |
+| 83848 | wacs       | localhost:38516       | bswas | Sleep   | 5400 |              |                                                                                                      | 0.000    |
+| 83849 | wacs       | localhost:38520       | bswas | Execute | 13   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83853 | wacs       | localhost:38548       | bswas | Sleep   | 5387 |              |                                                                                                      | 0.000    |
+| 83854 | wacs       | localhost:38552       | bswas | Execute | 1    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83864 | wacs       | localhost:38608       | bswas | Sleep   | 5374 |              |                                                                                                      | 0.000    |
+| 83865 | wacs       | localhost:38612       | bswas | Execute | 7    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83868 | wacs       | localhost:38632       | bswas | Sleep   | 5361 |              |                                                                                                      | 0.000    |
+| 83876 | wacs       | localhost:38676       | bswas | Sleep   | 5348 |              |                                                                                                      | 0.000    |
+| 83881 | wacs       | localhost:38706       | bswas | Sleep   | 5335 |              |                                                                                                      | 0.000    |
+| 83882 | wacs       | localhost:38710       | bswas | Execute | 5    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83890 | wacs       | localhost:38754       | bswas | Sleep   | 5322 |              |                                                                                                      | 0.000    |
+| 83900 | wacs       | localhost:38806       | bswas | Sleep   | 5309 |              |                                                                                                      | 0.000    |
+| 83906 | wacs       | localhost:38840       | bswas | Sleep   | 5296 |              |                                                                                                      | 0.000    |
+| 83907 | wacs       | localhost:38846       | bswas | Execute | 5    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83915 | wacs       | localhost:38902       | bswas | Sleep   | 5283 |              |                                                                                                      | 0.000    |
+| 83920 | wacs       | localhost:38934       | bswas | Sleep   | 5270 |              |                                                                                                      | 0.000    |
+| 83932 | wacs       | localhost:38996       | bswas | Sleep   | 5257 |              |                                                                                                      | 0.000    |
+| 83933 | wacs       | localhost:39000       | bswas | Execute | 9    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83937 | wacs       | localhost:39026       | bswas | Sleep   | 5244 |              |                                                                                                      | 0.000    |
+| 83938 | wacs       | localhost:39030       | bswas | Execute | 1    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 83946 | wacs       | localhost:39078       | bswas | Sleep   | 5231 |              |                                                                                                      | 0.000    |
+| 83953 | wacs       | localhost:39124       | bswas | Sleep   | 5218 |              |                                                                                                      | 0.000    |
+| 83959 | wacs       | localhost:39160       | bswas | Sleep   | 5205 |              |                                                                                                      | 0.000    |
+| 83986 | wacs       | localhost:39302       | bswas | Sleep   | 5179 |              |                                                                                                      | 0.000    |
+| 86075 | baoshiRoot | 180.174.192.107:59164 | bswas | Sleep   | 1042 |              |                                                                                                      | 0.000    |
+| 87490 | wacs       | localhost:58264       | bswas | Sleep   | 1894 |              |                                                                                                      | 0.000    |
+| 87492 | wacs       | localhost:58276       | bswas | Execute | 7    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 87552 | wacs       | localhost:58548       | bswas | Sleep   | 1868 |              |                                                                                                      | 0.000    |
+| 87594 | wacs       | localhost:58736       | bswas | Sleep   | 1855 |              |                                                                                                      | 0.000    |
+| 87634 | wacs       | localhost:58920       | bswas | Sleep   | 1842 |              |                                                                                                      | 0.000    |
+| 87635 | wacs       | localhost:58924       | bswas | Execute | 10   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 87673 | wacs       | localhost:59090       | bswas | Sleep   | 1829 |              |                                                                                                      | 0.000    |
+| 87675 | wacs       | localhost:59098       | bswas | Execute | 6    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 87687 | wacs       | localhost:59158       | bswas | Sleep   | 1814 |              |                                                                                                      | 0.000    |
+| 87690 | wacs       | localhost:59166       | bswas | Execute | 9    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 87720 | wacs       | localhost:59328       | bswas | Sleep   | 1802 |              |                                                                                                      | 0.000    |
+| 87723 | wacs       | localhost:59342       | bswas | Execute | 0    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 87736 | wacs       | localhost:59426       | bswas | Sleep   | 1789 |              |                                                                                                      | 0.000    |
+| 88693 | wacs       | localhost:36806       | bswas | Sleep   | 811  |              |                                                                                                      | 0.000    |
+| 88694 | wacs       | localhost:36810       | bswas | Execute | 7    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88710 | wacs       | localhost:36900       | bswas | Sleep   | 797  |              |                                                                                                      | 0.000    |
+| 88711 | wacs       | localhost:36904       | bswas | Execute | 10   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88750 | wacs       | localhost:37078       | bswas | Sleep   | 785  |              |                                                                                                      | 0.000    |
+| 88751 | wacs       | localhost:37082       | bswas | Execute | 1    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88765 | wacs       | localhost:37168       | bswas | Sleep   | 772  |              |                                                                                                      | 0.000    |
+| 88767 | wacs       | localhost:37178       | bswas | Execute | 6    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88780 | wacs       | localhost:37266       | bswas | Sleep   | 759  |              |                                                                                                      | 0.000    |
+| 88781 | wacs       | localhost:37270       | bswas | Execute | 2    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88795 | wacs       | localhost:37360       | bswas | Sleep   | 746  |              |                                                                                                      | 0.000    |
+| 88796 | wacs       | localhost:37364       | bswas | Execute | 4    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88818 | wacs       | localhost:37492       | bswas | Sleep   | 731  |              |                                                                                                      | 0.000    |
+| 88831 | wacs       | localhost:37546       | bswas | Execute | 11   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88842 | wacs       | localhost:37628       | bswas | Sleep   | 718  |              |                                                                                                      | 0.000    |
+| 88843 | wacs       | localhost:37632       | bswas | Execute | 13   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 88854 | wacs       | localhost:37704       | bswas | Sleep   | 705  |              |                                                                                                      | 0.000    |
+| 88855 | wacs       | localhost:37708       | bswas | Execute | 6    | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 89075 | wacs       | localhost:39056       | bswas | Sleep   | 490  |              |                                                                                                      | 0.000    |
+| 89078 | wacs       | localhost:39079       | bswas | Execute | 10   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 89084 | wacs       | localhost:39122       | bswas | Sleep   | 477  |              |                                                                                                      | 0.000    |
+| 89085 | wacs       | localhost:39126       | bswas | Execute | 12   | Sending data | select * from `commodity_barcodes` where exists (select * from `commodities` where `commodity_barcod | 0.000    |
+| 89458 | wacs       | localhost:41314       | bswas | Execute | 6    | Sending data | select order_issues.* ,order_issue_on_tops.id top_id ,order_issue_on_tops.remark,order_issue_on_tops | 0.000    |
+| 89465 | root       | localhost             |       | Query   | 0    |              | show processlist                                                                                     | 0.000    |
++-------+------------+-----------------------+-------+---------+------+--------------+------------------------------------------------------------------------------------------------------+----------+

+ 20 - 2
tests/webApi/thirdPart/haiq/storage.http

@@ -5,15 +5,35 @@
 ## * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
 ## * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
 ### out to roller
+POST http://bswas/api/thirdPart/haiq/storage/moveBinOut
+
+###
+POST http://bswas/api/thirdPart/haiq/storage/moveBin2
+
+###
 POST http://bswas/api/thirdPart/haiq/storage/moveBinM
 
+###
+POST http://bswas/api/thirdPart/haiq/storage/moveBinM2
+
 ###
 POST http://bswas/api/thirdPart/haiq/storage/moveBinIn
 
+###
+POST http://bswas/api/thirdPart/haiq/storage/moveBinIn2
+
 ###
 POST http://bswas/api/thirdPart/haiq/storage/lightOn
 
 ###
+POST http://bswas/api/thirdPart/haiq/storage/lightOff
+
+###
+POST https://was.baoshi56.com/api/thirdPart/haiq/light/update
+Content-Type: application/json
+
+{"locCode":"2323"}
+###
 
 
 POST http://bswas/api/thirdPart/haiq/storage/taskUpdate
@@ -26,8 +46,6 @@ POST http://bswas/api/thirdPart/haiq/storage/exception
 Content-Type: application/json
 
 {"exception":"2"}
-
-
 ###