| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
- namespace App\Http\Controllers;
- use App\Authority;
- use App\Batch;
- use App\Carrier;
- use App\Commodity;
- use App\CommodityBarcode;
- use App\Events\CancelOrder;
- use App\Events\WeighedEvent;
- use App\Events\WmsReceiveNewEvent;
- use App\Jobs\MeasuringMachineQueue;
- use App\Jobs\ProcessReceiveCombinedJob;
- use App\Logistic;
- use App\MeasuringMachine;
- use App\Order;
- use App\Package;
- use App\ProcessDaily;
- use App\Rejected;
- use App\RejectedBill;
- use App\RejectedBillItem;
- use App\Role;
- use App\User;
- use App\UserDutyCheck;
- use App\WMSReflectReceive;
- use Carbon\Carbon;
- use Illuminate\Database\Eloquent\Builder;
- use Illuminate\Database\Eloquent\Collection;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Gate;
- use Zttp\Zttp;
- class TestController extends Controller
- {
- private $data=[];
- public function __construct()
- {
- $this->data["active_test"]="active";
- }
- public function method(Request $request,$method)
- {
- return call_user_func([$this, $method],$request);
- }
- function t1(Request $request){ //x
- if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"123",null);
- }
- function tj(Request $request){
- $bills=RejectedBill::where('is_loaded',2)->where('created_at','<',Carbon::now()->subHours(10)->toDateTimeString());
- $bills->each(function ($bill){
- $receives=WMSReflectReceive::where('ASNREFERENCE3',$bill['logistic_number_return'])->where('is_uploaded',0)->get();
- if($receives->isNotEmpty()){
- event(new WmsReceiveNewEvent($bill['logistic_number_return'],$receives->first()));
- (new Controller())->log(__METHOD__,'replenished_'.__FUNCTION__,$bill['logistic_number_return']);
- }
- });
- }
- function injectJS(Request $request){
- $items=RejectedBillItem::whereHas('rejectedBill',function($query){
- return $query->where('id_owner',2);
- })->where('created_at','>','2019-12-23 18:11:00')->where('created_at','<','2019-12-24 11:25:00')->get();
- (new RejectedBillItemController())->collectionsToPackConfirm($items);
- }
- public function tj2(Request $request)
- {
- $rejected = Rejected::find(10);
- $rejectedJianshang=new \App\Http\Controllers\api\jianshang\RejectedController();
- dd( $rejectedJianshang->sendRejected($rejected));
- }
- public function excelIt()
- {
- $excel=new ExcelController();
- return $excel->makeExcel();
- }
- public function featureIt()
- {
- LogisticNumberFeatureController::loadRecentRejectedsToFeatures(5,2500);
- }
- public function newSku()
- {
- $url='http://bswcs/api/sorting/flux/newSku';
- $response = Zttp::post($url, [
- 'request'=>[
- [
- "SKU"=> "1234567890",
- "NAME"=> "瑞士莲**巧克力",
- "Alternate_SKU1"=> "1122334455",
- "GrossWeight"=> "1.2",
- "Cube"=> "0.75",
- "SKULength"=> "0.25",
- "SKUWidth"=> "0.15",
- "SKUHigh"=> "0.05"
- ],
- [
- "SKU"=> "1234567892",
- "NAME"=> "跳跳饼",
- "Alternate_SKU1"=> "",
- "GrossWeight"=> "1.3",
- "Cube"=> "0.75",
- "SKULength"=> "0.25",
- "SKUWidth"=> "0.15",
- "SKUHigh"=> "0.25"
- ],
- ]
- ]);
- return $response->json();
- }
- public function changePackage(){
- $packages=Package::where('delivery_number','<>',null)->where('logistic_id',null)->get();
- dd($packages);
- $packages=Package::whereRaw('delivery_number IS NOT NULL AND logistic_id IS NULL')->get();
- $logistics=Logistic::get();
- $packages->each(function ($package)use($logistics){
- $logistics->each(function ($logistic)use($package){
- if ($package->WMSReflectPackage->CarrierID==$logistic->code){
- $package->logistic_id=$logistic->id;
- return;
- }
- });
- });
- return "OK";
- }
- public function tNull(){
- }
- public function deletePackageAuthority()
- {
- $authorities=Authority::where('name','like','%包裹信息%')->get();
- $authorities->each(function ($authority){
- $authority->delete();
- });
- }
- public function test1(){
- /* $a=Package::orderBy('id')->first();
- $date=date("Y-m-d",strtotime("+1 day",strtotime($a->created_at->format('Y-m-d'))));
- dd($a->created_at->format('Y-m-d'));
- $b=Package::orderBy('id','desc')->first();
- $sf=$a->created_at->format('Y-m-d');dd((int)$sf);
- $result=$sf->lte("11:00");
- $c=Carbon::parse("9:10:05");
- $d=Carbon::parse("18:01:20");
- $x=($d->diffInSeconds($c))/3600;
- dd($c,$d,round($x,2)-1);*/
- $userDutyCheckStart=UserDutyCheck::select('id','checked_at')->where('user_id',1)
- ->where('checked_at','like','2020-03-13%')->where('type','登入')->orderBy('id')->first();
- $today=Carbon::now()->format('Y-m-d');
- $date=date("Y-m-d",strtotime('+'.strval(5)." day",strtotime($today)));
- $startDate=Carbon::parse("2020-03-31");
- $diffDay=$startDate->diffInDays($today,true);
- dd($diffDay);
- $package=Package::orderBy('updated_at','DESC')->get();
- }
- }
|