TestController.php 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Authority;
  4. use App\Batch;
  5. use App\Events\CancelOrder;
  6. use App\Events\WmsReceiveNewEvent;
  7. use App\Http\Controllers\Api\thirdPart\flux\WaybillController;
  8. use App\Logistic;
  9. use App\Order;
  10. use App\Package;
  11. use App\Rejected;
  12. use App\RejectedBill;
  13. use App\RejectedBillItem;
  14. use App\Unit;
  15. use App\User;
  16. use App\UserToken;
  17. use App\Waybill;
  18. use App\OraccleBasCustomer;
  19. use App\WMSReflectReceive;
  20. use Carbon\Carbon;
  21. use Endroid\QrCode\Response\QrCodeResponse;
  22. use Illuminate\Http\Request;
  23. use Illuminate\Support\Facades\DB;
  24. use Zttp\Zttp;
  25. class TestController extends Controller
  26. {
  27. private $data=[];
  28. public function __construct()
  29. {
  30. $this->data["active_test"]="active";
  31. }
  32. public function method(Request $request,$method)
  33. {
  34. return call_user_func([$this, $method],$request);
  35. }
  36. function t1(Request $request){ //x $packagesBatch=Package::where('batch_number',$batch_number)->first();
  37. $waybills=Waybill::all();
  38. $controller=(new WaybillController());
  39. $waybills->each(function ($waybill)use($controller){
  40. $controller->accomplishToWMS($waybill);
  41. });
  42. }
  43. function tj(Request $request){
  44. $a=11;
  45. try{
  46. $b=22;
  47. }catch (\Exception $exception){
  48. $this->log(__METHOD__,'Exception_'.__FUNCTION__,'请求异常:'.$exception->getMessage(),null);
  49. return ['result'=>'false'];
  50. }
  51. echo $a+$b;
  52. }
  53. function injectJS(Request $request){
  54. $items=RejectedBillItem::whereHas('rejectedBill',function($query){
  55. return $query->where('id_owner',2);
  56. })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get();
  57. (new RejectedBillItemController())->collectionsToPackConfirm($items);
  58. }
  59. public function tj2(Request $request)
  60. {
  61. $rejected = Rejected::find(10);
  62. $rejectedJianshang=new \App\Http\Controllers\api\jianshang\RejectedController();
  63. dd( $rejectedJianshang->sendRejected($rejected));
  64. }
  65. public function excelIt()
  66. {
  67. $excel=new ExcelController();
  68. return $excel->makeExcel();
  69. }
  70. public function featureIt()
  71. {
  72. LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5,2500);
  73. }
  74. public function newSku()
  75. {
  76. $url='http://bswcs/api/sorting/flux/newSku';
  77. $response = Zttp::post($url, [
  78. 'request'=>[
  79. [
  80. "SKU"=> "1234567890",
  81. "NAME"=> "瑞士莲**巧克力",
  82. "Alternate_SKU1"=> "1122334455",
  83. "GrossWeight"=> "1.2",
  84. "Cube"=> "0.75",
  85. "SKULength"=> "0.25",
  86. "SKUWidth"=> "0.15",
  87. "SKUHigh"=> "0.05"
  88. ],
  89. [
  90. "SKU"=> "1234567892",
  91. "NAME"=> "跳跳饼",
  92. "Alternate_SKU1"=> "",
  93. "GrossWeight"=> "1.3",
  94. "Cube"=> "0.75",
  95. "SKULength"=> "0.25",
  96. "SKUWidth"=> "0.15",
  97. "SKUHigh"=> "0.25"
  98. ],
  99. ]
  100. ]);
  101. return $response->json();
  102. }
  103. public function changePackage(){
  104. $packages=Package::where('delivery_number','<>',null)->where('logistic_id',null)->get();
  105. dd($packages);
  106. $packages=Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get();
  107. $logistics=Logistic::get();
  108. $packages->each(function ($package)use($logistics){
  109. $logistics->each(function ($logistic)use($package){
  110. if ($package->WMSReflectPackage->CarrierID==$logistic->code){
  111. $package->logistic_id=$logistic->id;
  112. return;
  113. }
  114. });
  115. });
  116. return "OK";
  117. }
  118. public function tNull(){
  119. }
  120. public function deletePackageAuthority()
  121. {
  122. $authorities=Authority::where('name','like','%包裹信息%')->get();
  123. $authorities->each(function ($authority){
  124. $authority->delete();
  125. });
  126. }
  127. public function test1(){
  128. $str=",15984854564564,154484645684,874545454 4565546,";
  129. $str=trim($str,',');
  130. dd($str);
  131. }
  132. }