| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <?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\Http\Requests\OrderDelivering;
- use App\Jobs\CacheShelfTaskJob;
- use App\Jobs\OrderCreateInstantBill;
- use App\Jobs\OrderCreateWaybill;
- use App\Jobs\SettlementBillReportTask;
- use App\Jobs\StoreCreateInstantBill;
- use App\Jobs\WeightUpdateInstantBill;
- use App\MaterialBox;
- use App\MaterialBoxModel;
- use App\Order;
- use App\OrderPackage;
- 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\OwnerFeeTotalService;
- use App\Services\OwnerLogisticFeeReportService;
- use App\Services\OwnerPriceOperationService;
- use App\Services\OwnerStoreFeeReportService;
- use App\Services\OwnerStoreOutFeeReportService;
- 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\Foundation\Http\FormRequest;
- 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;
- use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
- class TestController extends Controller
- {
- use AsyncResponse,ErrorPush;
- const ASNREFERENCE_2 = 'ASNREFERENCE2';
- 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()
- {
- $sql = <<<SQL
- select * from DOC_ORDER_HEADER
- where ADDTIME>=to_date('2021-08-15 00:00:00','yyyy-mm-dd hh24:mi:ss') AND
- ADDTIME<=to_date('2021-08-20 16:00:00','yyyy-mm-dd hh24:mi:ss') and SOSTATUS >= '40'
- and CARRIERID in (
- 'BSZFC','BSZX','BSZFCDF','BSZXDF','DBWL','DBWLDF'
- )
- SQL;
- $s = new \App\Http\Controllers\api\thirdPart\flux\WaybillController();
- $arr = DB::connection("oracle")->select(DB::raw($sql));
- foreach ($arr as $ar){
- if (Waybill::query()->where("wms_bill_number",'like','%'.$ar->orderno.'%')
- ->where("created_at",">=",'2021-08-10 00:00:00')->first())continue;
- $sql = <<<SQL
- select * from DOC_ORDER_DETAILS left join bas_sku on DOC_ORDER_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID and DOC_ORDER_DETAILS.sku = BAS_SKU.SKU
- where ORDERNO = ?
- SQL;
- $details = [];
- foreach (DB::connection("oracle")->select(DB::raw($sql),[$ar->orderno]) as $item){
- $details[] = [
- "SKU_Descr_c" => $item->descr_c,
- "SKU" => $item->sku,
- "Alternate_sku1" => $item->alternate_sku1,
- "Qtyordered_each" => $item->qtyordered_each,
- "Cubic" => $item->cubic,
- "GrossWeight" => $item->grossweight,
- "NetWeight" => $item->netweight,
- "ReservedField01" => $ar->soreference1,
- "ReservedField02" => $ar->soreference2,
- "ReservedField03" => $ar->soreference3,
- "ReservedField04" => $ar->soreference4,
- "ReservedField05" => $ar->soreference5,
- ];
- }
- $r = new Request();
- $res = [
- "OrderNo" => $ar->orderno,
- "CustomerID" => $ar->customerid,
- "CarrierID" => $ar->carrierid,
- "ConsigneeName" => $ar->consigneename,
- "C_Tel1" => $ar->c_tel1,
- "C_Address1" => $ar->c_address1,
- "C_Province" => $ar->c_province,
- "C_City" => $ar->c_city,
- "C_District" => $ar->c_district,
- "ReservedField01" => $ar->soreference1,
- "ReservedField02" => $ar->soreference2,
- "ReservedField03" => $ar->soreference3,
- "ReservedField04" => $ar->soreference4,
- "ReservedField05" => $ar->soreference5,
- "order_list" => $details,
- ];
- $a = [$res];
- $r->offsetSet("request",$a);
- $s->new_($r);
- }
- }
- public function test4()
- {
- return response()->redirectTo("transport/waybill/android/waybillDispatch");
- }
- public function OwnerStoreFeeReportService_recordReport()
- {
- /** @var OwnerStoreFeeReportService $service */
- $service = app('OwnerStoreFeeReportService');
- $service->recordReport('2021-08-01');
- }
- public function OwnerStoreOutFeeReportService_recordReport()
- {
- /** @var OwnerStoreOutFeeReportService $service */
- $service = app('OwnerStoreOutFeeReportService');
- $service->recordReport('2021-08-01');
- }
- public function OwnerFeeTotalService_record()
- {
- /** @var OwnerFeeTotalService $service */
- $service = app('OwnerFeeTotalService');
- $service->record('2021-08-01');
- }
- //快递
- public function OwnerLogisticFeeReportService_record()
- {
- ini_set('max_execution_time',-1);
- /** @var OwnerLogisticFeeReportService $service */
- $service = app('OwnerLogisticFeeReportService');
- $service->recordReport('2021-08-01');
- }
- public function order_packages_sync_routes_flag_init()
- {
- OrderPackage::query()->whereNotNull('transfer_status')->update(['sync_routes_flag'=>true]);
- }
- public function SettlementBillReportTask()
- {
- SettlementBillReportTask::dispatchNow('2021-08-01');
- }
- }
|