TestController.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Commodity;
  4. use App\CommodityMaterialBoxModel;
  5. use App\Components\AsyncResponse;
  6. use App\Components\ErrorPush;
  7. use App\ErrorTemp;
  8. use App\Feature;
  9. use App\Jobs\CacheShelfTaskJob;
  10. use App\Jobs\OrderCreateWaybill;
  11. use App\Jobs\TestJob;
  12. use App\MaterialBox;
  13. use App\MaterialBoxModel;
  14. use App\Order;
  15. use App\Owner;
  16. use App\OwnerAreaReport;
  17. use App\OwnerFeeDetail;
  18. use App\OwnerFeeOperation;
  19. use App\OwnerFeeOperationDetail;
  20. use App\OwnerFeeStorage;
  21. use App\OwnerPriceOperation;
  22. use App\OrderPackageCountingRecord;
  23. use App\RejectedBill;
  24. use App\Services\ForeignHaiRoboticsService;
  25. use App\Services\OwnerPriceOperationService;
  26. use App\Services\StationService;
  27. use App\Services\StorageService;
  28. use App\Services\TestService;
  29. use App\Station;
  30. use App\StationTask;
  31. use App\StationTaskMaterialBox;
  32. use App\Store;
  33. use App\TaskTransaction;
  34. use App\Unit;
  35. use App\Waybill;
  36. use Carbon\Carbon;
  37. use Carbon\CarbonPeriod;
  38. use Illuminate\Database\Eloquent\Collection;
  39. use Illuminate\Http\Request;
  40. use Illuminate\Support\Facades\Cache;
  41. use Illuminate\Support\Facades\Auth;
  42. use Illuminate\Support\Facades\Cookie;
  43. use Illuminate\Support\Facades\DB;
  44. use Illuminate\Support\Facades\Http;
  45. class TestController extends Controller
  46. {
  47. use AsyncResponse,ErrorPush;
  48. const ASNREFERENCE_2 = 'ASNREFERENCE2';
  49. private $data = [];
  50. public function __construct()
  51. {
  52. $this->data["active_test"] = "active";
  53. }
  54. public function method(Request $request, $method)
  55. {
  56. return call_user_func([$this, $method], $request);
  57. }
  58. public function lightUp()
  59. {
  60. app("CacheShelfService")->lightUp('HAIB1-02-02','3','0');
  61. }
  62. public function lightOff()
  63. {
  64. }
  65. public function test()
  66. {
  67. ini_set('max_execution_time',2500);
  68. $stores = Store::query()->where("status","已入库")->limit(1)->get();
  69. foreach ($stores as $store){
  70. /** @var OwnerPriceOperationService $service */
  71. $service = app("OwnerPriceOperationService");
  72. $GLOBALS["FEE_INFO"] = [];
  73. list($id,$money,$taxFee) = $service->matching($store, Feature::MAPPING["store"], $store->owner_id, "入库");
  74. $defaultInfo = [
  75. "worked_at" => $store->updated_at,
  76. "owner_id" => $store->owner_id,
  77. "model_id" => $id,
  78. "source_number"=> null,
  79. "doc_number" => $store->asn_code,
  80. "commodity_id" => 0,
  81. "total_fee" =>0,
  82. "tax_rate" =>0,
  83. "fee_description"=>'',
  84. ];
  85. foreach ($GLOBALS["FEE_INFO"] as $info){
  86. $operation = $defaultInfo;
  87. foreach ($operation as $key=>$val)if (isset($info[$key]))$operation[$key] = $info[$key];
  88. dump($operation);
  89. }
  90. }
  91. }
  92. }