| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- <?php
- namespace App\Http\Controllers;
- use App\Authority;
- use App\Commodity;
- use App\CommodityMaterialBoxModel;
- use App\Components\AsyncResponse;
- use App\Components\ErrorPush;
- use App\ErrorTemp;
- use App\Feature;
- use App\Jobs\CacheShelfTaskJob;
- use App\Jobs\OrderCreateInstantBill;
- use App\Jobs\OrderCreateWaybill;
- use App\Jobs\StoreCreateInstantBill;
- use App\MaterialBox;
- use App\MaterialBoxModel;
- use App\Order;
- use App\Owner;
- use App\OwnerFeeDetail;
- use App\OwnerFeeDetailLogistic;
- use App\OwnerFeeExpress;
- use App\OwnerFeeLogistic;
- use App\OwnerFeeOperation;
- use App\OwnerFeeOperationDetail;
- use App\OwnerFeeStorage;
- use App\OwnerPriceOperation;
- use App\OrderPackageCountingRecord;
- use App\RejectedBill;
- use App\Services\CacheShelfService;
- use App\Services\ForeignHaiRoboticsService;
- use App\Services\OrderService;
- use App\Services\OwnerPriceOperationService;
- use App\Services\StationService;
- use App\Services\StorageService;
- use App\Station;
- use App\StationTask;
- use App\StationTaskMaterialBox;
- use App\Store;
- use App\TaskTransaction;
- use App\Unit;
- use App\Waybill;
- use Carbon\Carbon;
- use Carbon\CarbonPeriod;
- use Illuminate\Database\Eloquent\Collection;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Cache;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Support\Facades\Cookie;
- use Illuminate\Support\Facades\DB;
- use Illuminate\Support\Facades\Http;
- class TestController extends Controller
- {
- use AsyncResponse,ErrorPush;
- const ASNREFERENCE_2 = 'ASNREFERENCE2';
- private $data = [];
- public function __construct()
- {
- $this->data["active_test"] = "active";
- }
- public function method(Request $request, $method)
- {
- return call_user_func([$this, $method], $request);
- }
- public function test1(){
- ini_set('max_execution_time',-1);
- $date = date("Y-m-d H:i:s");
- ErrorTemp::query()->truncate();
- OwnerFeeStorage::query()->truncate();
- OwnerFeeExpress::query()->truncate();
- OwnerFeeLogistic::query()->truncate();
- OwnerFeeOperation::query()->truncate();
- OwnerFeeOperationDetail::query()->truncate();
- foreach (Order::query()->where("wms_edittime",">=","2021-08-16 00:00:00")
- ->where("wms_status","订单完成")
- ->where("wms_edittime","<",$date)->get() as $order){
- $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
- if ($fee){
- OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
- $fee->delete();
- }
- $a = new Collection([$order]);
- $this->dispatch(new OrderCreateInstantBill($a));
- }
- foreach (Store::query()->where("updated_at",">=","2021-08-16 00:00:00")
- ->where("status","已入库")
- ->where("updated_at","<",$date)->get() as $store){
- OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
- $a = new Collection([$store]);
- $this->dispatch(new StoreCreateInstantBill($a));
- }
- }
- public function test()
- {
- ini_set('max_execution_time',-1);
- $day = (string)\request("day");
- $d = (int)$day+1;
- $d = $d<10 ? '0'.(string)$d : (string)$d;
- foreach (Order::query()->where("wms_edittime",">=","2021-08-{$day} 00:00:00")
- ->where("wms_status","订单完成")
- ->where("wms_edittime","<","2021-08-{$d} 00:00:00")->get() as $order){
- $fee = OwnerFeeDetail::query()->where("outer_table_name","orders")->where("outer_id",$order->id)->first();
- if ($fee){
- OwnerFeeDetailLogistic::query()->where("owner_fee_detail_id",$fee->id)->delete();
- $fee->delete();
- }
- $a = new Collection([$order]);
- $this->dispatch(new OrderCreateInstantBill($a));
- }
- foreach (Store::query()->where("updated_at",">=","2021-08-{$day} 00:00:00")
- ->where("status","已入库")
- ->where("updated_at","<","2021-08-{$d} 00:00:00")->get() as $store){
- OwnerFeeDetail::query()->where("outer_table_name","stores")->where("outer_id",$store->id)->delete();
- $a = new Collection([$store]);
- $this->dispatch(new StoreCreateInstantBill($a));
- }
- }
- public function test3()
- {
- $row = [
- "运单类型", "货主", "上游单号", "wms订单号", "运单号", "运输收费",
- "其他收费", "其他收费备注", "始发地", "目的地","下单备注", "承运商", "承运商单号",
- "仓库计抛", "承运商计抛", "仓库计重", "承运商计重", "车型", "车辆信息",
- "计件", "里程数", "运费(元)", "提货费(元)", "其他费用(元)", "发货时间",
- "调度备注", "创建时间", "省", "市", "区", "FLUX地址", "FLUX重量", "FLUX数量"
- ];
- dd($row[27]);
- }
- public function testZC()
- {
- // $batch=Batch::query()
- // ->with('orders.orderCommodities.commodity.barcodes')
- // ->where('code','W210814000158')
- // ->first();
- // dd($batch);
- // app(ForeignZhenCangService::class)->broadcastBatch($batch);
- // dd('上传成功');
- }
- }
|