TestController.php 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Authority;
  4. use App\Batch;
  5. use App\Carrier;
  6. use App\Events\CancelOrder;
  7. use App\Events\WeighedEvent;
  8. use App\Events\WmsReceiveNewEvent;
  9. use App\Jobs\MeasuringMachineQueue;
  10. use App\Jobs\ProcessReceiveCombined;
  11. use App\Logistic;
  12. use App\MeasuringMachine;
  13. use App\Order;
  14. use App\Package;
  15. use App\Process;
  16. use App\ProcessDaily;
  17. use App\ProcessDailyParticipant;
  18. use App\Rejected;
  19. use App\RejectedBill;
  20. use App\RejectedBillItem;
  21. use App\Role;
  22. use App\Tutorial;
  23. use App\User;
  24. use App\UserDetail;
  25. use App\UserDutyCheck;
  26. use App\WMSReflectReceive;
  27. use Carbon\Carbon;
  28. use Illuminate\Database\Eloquent\Collection;
  29. use Illuminate\Http\Request;
  30. use Illuminate\Support\Facades\Gate;
  31. use Te7aHoudini\LaravelTrix\Models\TrixAttachment;
  32. use Zttp\Zttp;
  33. class TestController extends Controller
  34. {
  35. private $data=[];
  36. public function __construct()
  37. {
  38. $this->data["active_test"]="active";
  39. }
  40. public function method(Request $request,$method)
  41. {
  42. return call_user_func([$this, $method],$request);
  43. }
  44. function t1(Request $request){ //x
  45. $url=url(config('api.flux.receive.new'));
  46. dd($url,config('api.flux.receive'),config('api.flux'));
  47. }
  48. function tj(Request $request){
  49. $bills=RejectedBill::where('is_loaded',2)->where('created_at','<',Carbon::now()->subHours(10)->toDateTimeString());
  50. $bills->each(function ($bill){
  51. $receives=WMSReflectReceive::where('ASNREFERENCE3',$bill['logistic_number_return'])->where('is_uploaded',0)->get();
  52. if($receives->isNotEmpty()){
  53. event(new WmsReceiveNewEvent($bill['logistic_number_return'],$receives->first()));
  54. (new Controller())->log(__METHOD__,'replenished_'.__FUNCTION__,$bill['logistic_number_return']);
  55. }
  56. });
  57. }
  58. function injectJS(Request $request){
  59. $items=RejectedBillItem::whereHas('rejectedBill',function($query){
  60. return $query->where('id_owner',2);
  61. })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get();
  62. (new RejectedBillItemController())->collectionsToPackConfirm($items);
  63. }
  64. public function tj2(Request $request)
  65. {
  66. $rejected = Rejected::find(10);
  67. $rejectedJianshang=new \App\Http\Controllers\api\jianshang\RejectedController();
  68. dd( $rejectedJianshang->sendRejected($rejected));
  69. }
  70. public function excelIt()
  71. {
  72. $excel=new ExcelController();
  73. return $excel->makeExcel();
  74. }
  75. public function featureIt()
  76. {
  77. LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5,2500);
  78. }
  79. public function newSku()
  80. {
  81. $url='http://bswcs/api/sorting/flux/newSku';
  82. $response = Zttp::post($url, [
  83. 'request'=>[
  84. [
  85. "SKU"=> "1234567890",
  86. "NAME"=> "瑞士莲**巧克力",
  87. "Alternate_SKU1"=> "1122334455",
  88. "GrossWeight"=> "1.2",
  89. "Cube"=> "0.75",
  90. "SKULength"=> "0.25",
  91. "SKUWidth"=> "0.15",
  92. "SKUHigh"=> "0.05"
  93. ],
  94. [
  95. "SKU"=> "1234567892",
  96. "NAME"=> "跳跳饼",
  97. "Alternate_SKU1"=> "",
  98. "GrossWeight"=> "1.3",
  99. "Cube"=> "0.75",
  100. "SKULength"=> "0.25",
  101. "SKUWidth"=> "0.15",
  102. "SKUHigh"=> "0.25"
  103. ],
  104. ]
  105. ]);
  106. return $response->json();
  107. }
  108. public function changePackage(){
  109. $packages=Package::where('delivery_number','<>',null)->where('logistic_id',null)->get();
  110. dd($packages);
  111. $packages=Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get();
  112. $logistics=Logistic::get();
  113. $packages->each(function ($package)use($logistics){
  114. $logistics->each(function ($logistic)use($package){
  115. if ($package->WMSReflectPackage->CarrierID==$logistic->code){
  116. $package->logistic_id=$logistic->id;
  117. return;
  118. }
  119. });
  120. });
  121. return "OK";
  122. }
  123. public function tNull(){
  124. }
  125. public function deletePackageAuthority()
  126. {
  127. $authorities=Authority::where('name','like','%包裹信息%')->get();
  128. $authorities->each(function ($authority){
  129. $authority->delete();
  130. });
  131. }
  132. public function test1(Request $request){
  133. /* $attachment = TrixAttachment::where('attachment', basename('yHHxWX8Hujm3Smf2aBAUnYzHHCpgerpn1GKiIazm.png'))->first();
  134. dd(response()->json(optional($attachment)->purge()));*/
  135. //$a=Process::with('tutorials')->find(1);
  136. //$a->tutorials()->syncWithoutDetaching([25]);
  137. $tutorials=Tutorial::with('owner')->where('owner_id',2)->get();
  138. $tutorials=$tutorials->except([27]);
  139. echo ini_get('post_max_size');
  140. dd();
  141. }
  142. }