TestController.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Authority;
  4. use App\Commodity;
  5. use App\CommodityMaterialBoxModel;
  6. use App\Components\AsyncResponse;
  7. use App\Components\ErrorPush;
  8. use App\ErrorTemp;
  9. use App\Feature;
  10. use App\Jobs\CacheShelfTaskJob;
  11. use App\Jobs\OrderCreateInstantBill;
  12. use App\Jobs\OrderCreateWaybill;
  13. use App\Jobs\StoreCreateInstantBill;
  14. use App\MaterialBox;
  15. use App\MaterialBoxModel;
  16. use App\Order;
  17. use App\Owner;
  18. use App\OwnerFeeDetail;
  19. use App\OwnerFeeDetailLogistic;
  20. use App\OwnerFeeExpress;
  21. use App\OwnerFeeLogistic;
  22. use App\OwnerFeeOperation;
  23. use App\OwnerFeeOperationDetail;
  24. use App\OwnerFeeStorage;
  25. use App\OwnerPriceOperation;
  26. use App\OrderPackageCountingRecord;
  27. use App\RejectedBill;
  28. use App\Services\CacheShelfService;
  29. use App\Services\ForeignHaiRoboticsService;
  30. use App\Services\OrderService;
  31. use App\Services\OwnerFeeTotalService;
  32. use App\Services\OwnerLogisticFeeReportService;
  33. use App\Services\OwnerPriceOperationService;
  34. use App\Services\OwnerStoreFeeReportService;
  35. use App\Services\OwnerStoreOutFeeReportService;
  36. use App\Services\StationService;
  37. use App\Services\StorageService;
  38. use App\Station;
  39. use App\StationTask;
  40. use App\StationTaskMaterialBox;
  41. use App\Store;
  42. use App\TaskTransaction;
  43. use App\Unit;
  44. use App\Waybill;
  45. use Carbon\Carbon;
  46. use Carbon\CarbonPeriod;
  47. use Illuminate\Database\Eloquent\Collection;
  48. use Illuminate\Http\Request;
  49. use Illuminate\Support\Facades\Cache;
  50. use Illuminate\Support\Facades\Auth;
  51. use Illuminate\Support\Facades\Cookie;
  52. use Illuminate\Support\Facades\DB;
  53. use Illuminate\Support\Facades\Http;
  54. use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
  55. class TestController extends Controller
  56. {
  57. use AsyncResponse,ErrorPush;
  58. const ASNREFERENCE_2 = 'ASNREFERENCE2';
  59. private $data = [];
  60. public function __construct()
  61. {
  62. $this->data["active_test"] = "active";
  63. }
  64. public function method(Request $request, $method)
  65. {
  66. return call_user_func([$this, $method], $request);
  67. }
  68. public function test1(){
  69. ini_set('max_execution_time',-1);
  70. $date = date("Y-m-d H:i:s");
  71. ErrorTemp::query()->truncate();
  72. OwnerFeeStorage::query()->truncate();
  73. OwnerFeeExpress::query()->truncate();
  74. OwnerFeeLogistic::query()->truncate();
  75. OwnerFeeOperation::query()->truncate();
  76. OwnerFeeOperationDetail::query()->truncate();
  77. foreach (Order::query()->where("wms_edittime",">=","2021-08-16 00:00:00")
  78. ->where("wms_status","订单完成")
  79. ->where("wms_edittime","<",$date)->get() as $order){
  80. $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
  81. if ($fee){
  82. OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
  83. $fee->delete();
  84. }
  85. $a = new Collection([$order]);
  86. $this->dispatch(new OrderCreateInstantBill($a));
  87. }
  88. foreach (Store::query()->where("updated_at",">=","2021-08-16 00:00:00")
  89. ->where("status","已入库")
  90. ->where("updated_at","<",$date)->get() as $store){
  91. OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
  92. $a = new Collection([$store]);
  93. $this->dispatch(new StoreCreateInstantBill($a));
  94. }
  95. }
  96. public function test()
  97. {
  98. ini_set('max_execution_time',-1);
  99. $day = (string)\request("day");
  100. $d = (int)$day+1;
  101. $d = $d<10 ? '0'.(string)$d : (string)$d;
  102. foreach (Order::query()->where("wms_edittime",">=","2021-08-{$day} 00:00:00")
  103. ->where("wms_status","订单完成")
  104. ->where("wms_edittime","<","2021-08-{$d} 00:00:00")->get() as $order){
  105. $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
  106. if ($fee){
  107. OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
  108. $fee->delete();
  109. }
  110. $a = new Collection([$order]);
  111. $this->dispatch(new OrderCreateInstantBill($a));
  112. }
  113. foreach (Store::query()->where("updated_at",">=","2021-08-{$day} 00:00:00")
  114. ->where("status","已入库")
  115. ->where("updated_at","<","2021-08-{$d} 00:00:00")->get() as $store){
  116. OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
  117. $a = new Collection([$store]);
  118. $this->dispatch(new StoreCreateInstantBill($a));
  119. }
  120. }
  121. public function test3()
  122. {
  123. $a = new CacheShelfService();
  124. $a->_stationCacheLightOff("HAIB1-01-01");
  125. $a->_stationCacheLightOff("HAIB1-01-02");
  126. $a->_stationCacheLightOff("HAIB1-01-03");
  127. $a->_stationCacheLightOff("HAIB1-02-01");
  128. $a->_stationCacheLightOff("HAIB1-02-02");
  129. $a->_stationCacheLightOff("HAIB1-02-03");
  130. $a->_stationCacheLightOff("HAIB1-03-01");
  131. $a->_stationCacheLightOff("HAIB1-03-02");
  132. $a->_stationCacheLightOff("HAIB1-03-03");
  133. $a->_stationCacheLightOff("HAIB2-01-01");
  134. $a->_stationCacheLightOff("HAIB2-01-02");
  135. $a->_stationCacheLightOff("HAIB2-02-01");
  136. $a->_stationCacheLightOff("HAIB2-02-02");
  137. $a->_stationCacheLightOff("HAIB2-03-01");
  138. }
  139. public function testZC()
  140. {
  141. // $batch=Batch::query()
  142. // ->with('orders.orderCommodities.commodity.barcodes')
  143. // ->where('code','W210814000158')
  144. // ->first();
  145. // dd($batch);
  146. // app(ForeignZhenCangService::class)->broadcastBatch($batch);
  147. // dd('上传成功');
  148. }
  149. public function OwnerStoreFeeReportService_recordReport()
  150. {
  151. /** @var OwnerStoreFeeReportService $service */
  152. $service = app('OwnerStoreFeeReportService');
  153. $service->recordReport('2021-08-01');
  154. }
  155. public function OwnerStoreOutFeeReportService_recordReport()
  156. {
  157. /** @var OwnerStoreOutFeeReportService $service */
  158. $service = app('OwnerStoreOutFeeReportService');
  159. $service->recordReport('2021-08-01');
  160. }
  161. public function OwnerFeeTotalService_record()
  162. {
  163. /** @var OwnerFeeTotalService $service */
  164. $service = app('OwnerFeeTotalService');
  165. $service->record('2021-08-01');
  166. }
  167. //快递
  168. public function OwnerLogisticFeeReportService_record()
  169. {
  170. ini_set('max_execution_time',-1);
  171. /** @var OwnerLogisticFeeReportService $service */
  172. $service = app('OwnerLogisticFeeReportService');
  173. $service->recordReport('2021-08-01');
  174. }
  175. }