TestController.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Components\AsyncResponse;
  4. use App\Components\ErrorPush;
  5. use App\ErrorTemp;
  6. use App\Feature;
  7. use App\MaterialBox;
  8. use App\MaterialBoxModel;
  9. use App\Owner;
  10. use App\OwnerFeeDetail;
  11. use App\OwnerPriceOperation;
  12. use App\RejectedBill;
  13. use App\Services\ForeignHaiRoboticsService;
  14. use App\Station;
  15. use App\StationTask;
  16. use App\StationTaskMaterialBox;
  17. use App\TaskTransaction;
  18. use App\Unit;
  19. use Illuminate\Http\Request;
  20. use Illuminate\Support\Facades\Auth;
  21. use Illuminate\Support\Facades\Cache;
  22. use Illuminate\Support\Facades\Cookie;
  23. use Illuminate\Support\Facades\DB;
  24. use Illuminate\Support\Facades\Http;
  25. class TestController extends Controller
  26. {
  27. use AsyncResponse,ErrorPush;
  28. const ASNREFERENCE_2 = 'ASNREFERENCE2';
  29. private $data = [];
  30. public function __construct()
  31. {
  32. $this->data["active_test"] = "active";
  33. }
  34. public function method(Request $request, $method)
  35. {
  36. return call_user_func([$this, $method], $request);
  37. }
  38. public function lightUp()
  39. {
  40. app("CacheShelfService")->lightUp('HAIB1-02-02','3','0');
  41. }
  42. public function lightOff()
  43. {
  44. $params = [
  45. "areaCode" => "1004",
  46. 'locCode' => "HAIB1-02-02",
  47. 'PTLAction' => 0,
  48. ];
  49. $response = Http::post(config('api.haiq.storage.light'), $params);
  50. return json_decode($response->body());
  51. }
  52. private $key = "CACHE_SHELF_AVAILABLE";
  53. public function test()
  54. {
  55. $modelId = 1;
  56. $blacklist = [];
  57. $query = MaterialBox::query()->where("material_box_model_id",$modelId)
  58. ->where("status",4);
  59. $boxes = $query->whereNotIn("id",$query->select("id")->whereHas("performTask"));
  60. if ($blacklist)$boxes = $boxes->whereNotIn("id",$blacklist);
  61. dd($boxes->get());
  62. }
  63. }