当前位置: 首页>>代码示例>>PHP>>正文


PHP Shipment::where方法代码示例

本文整理汇总了PHP中Shipment::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Shipment::where方法的具体用法?PHP Shipment::where怎么用?PHP Shipment::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Shipment的用法示例。


在下文中一共展示了Shipment::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $delivereds = Orderlog::where('appname', '=', Config::get('jex.tracker_app'))->where('status', '=', 'delivered')->orderBy('deliveryId', 'desc')->orderBy('created_at', 'desc')->groupBy('deliveryId')->get(array('deliveryId', 'merchantTransId', 'deliverytime'));
     /*
     $pendingan = Orderlog::where('appname','=',Config::get('jex.tracker_app'))
                     ->where('pendingCount','!=', strval(0))
                     ->orderBy('created_at','desc')
                     ->orderBy('deliveryId','desc')
                     ->groupBy('deliveryNote')
                     ->get(array( 'deliveryId', 'deliveryNote','status' ));
     */
     $count = 0;
     $data = '';
     foreach ($delivereds as $d) {
         $shipment = \Shipment::where('delivery_id', '=', $d->deliveryId)->first();
         if ($shipment) {
             if (date('Y-m-d', strtotime($d->deliverytime)) != date('Y-m-d', strtotime($shipment->deliverytime))) {
                 //print $d->deliveryId." ".$d->deliverytime." ".$shipment->deliverytime."\r\n";
                 $data .= '"' . $d->deliveryId . '","' . $d->merchantTransId . '","' . $d->deliverytime . '","' . $shipment->deliverytime . '"' . "\r\n";
                 $shipment->deliverytime = $d->deliverytime;
                 $shipment->save();
                 $count++;
             }
         }
     }
     print $data;
     //print "\r\ndifferent date : ".$count;
     /*
     $pc = array();
     foreach ($pendingan as $p) {
         if(isset($pc[$p->deliveryId])){
             if($p->status == 'pending'){
                 $pc[$p->deliveryId] = $pc[$p->deliveryId] + 1;
             }
         }else{
             $pc[$p->deliveryId] = 1;
         }
     }
     */
     //print_r($pc);
     /*
     foreach($pc as $d=>$c){
         //print $d->deliveryId." ".$d->deliverytime."\r\n";
         $count++;
         $shipment = \Shipment::where('delivery_id','=',$d)->first();
     
         if($shipment){
             $shipment->pending_count = $c;
             //$shipment->status = 'delivered';
             //$shipment->deliverytime = $d->deliverytime;
             //$shipment->save();
         }
     
         //print_r($d->toArray());
     }
     */
     print "\r\n" . $count;
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:63,代码来源:DeliveryBacktrack.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $shipped = Shipment::where('deliverytime', 'like', '2016-01-11%')->get();
     //print_r($shipped);
     foreach ($shipped as $shipment) {
         $is_there = Geolog::where('datetimestamp', '=', $shipment->deliverytime)->where('deliveryId', '=', $shipment->delivery_id)->where('sourceSensor', '=', 'gps')->get();
         if ($is_there) {
             print_r($is_there);
             $stay = array_pop($is_there->toArray());
             foreach ($is_there as $there) {
                 print 'there' . "\r\n";
                 print_r($there);
                 //$there->remove();
             }
             print 'stay' . "\r\n";
             print_r($stay);
             if ($stay) {
                 $stay->latitude = doubleval($shipment->latitude);
                 $stay->longitude = doubleval($shipment->longitude);
                 //$stay->save();
             }
         }
     }
     /*
     $dbox = Orderlog::where('pickupStatus','=',Config::get('jayon.trans_status_pickup'))
                         ->where('pickuptime','!=','0000-00-00 00:00:00')
                         ->orderBy('created_at','desc')
                         //->groupBy('created_at')
                         ->get();
     
     if($dbox){
         print count($dbox)."\r\n";
         foreach($dbox as $dbx){
     
             print_r(array($dbx->pickupStatus, $dbx->pickuptime) );
     
             $ship = Shipment::where('delivery_id','=',$dbx->deliveryId)
                         ->where('pickuptime','!=','0000-00-00 00:00:00')
                         ->first();
             if($ship){
                 print 'before : '.$ship->pickup_status."\r\n";
                 print 'before : '.$ship->pickuptime."\r\n";
     
                 $pickuptime = ($dbx->pickuptime == '0000-00-00 00:00:00')? date('Y-m-d H:i:s', $dbx->created_at->sec ) :$dbx->pickuptime;
     
                 $ship->pickup_status = $dbx->pickupStatus;
                 $ship->pickuptime = $pickuptime;
     
                 $ship->save();
                 //print_r( $ship->toArray());
     
                 print 'after : '.$ship->pickup_status."\r\n";
                 print 'after : '.$ship->pickuptime."\r\n";
             }
         }
     }
     */
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:63,代码来源:Backtrack.php

示例3: postLast

 public function postLast()
 {
     $in = Input::get();
     $orderid = trim($in['orderId']);
     $orderff = trim($in['orderFf']);
     $delivery_id = trim($in['delivery_id']);
     if (isset($in['delivery_id'])) {
         $order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->where('delivery_id', '=', $delivery_id)->orderBy('pick_up_date', 'desc')->first();
     } else {
         $order = Shipment::where('fulfillment_code', '=', $orderff)->where('no_sales_order', '=', $orderid)->orderBy('pick_up_date', 'desc')->first();
     }
     $statuses = array();
     if ($order) {
         if ($order->logistic_type == 'external') {
             $conf = Config::get('cs.' . $order->consignee_olshop_cust);
             if (!isset($conf['status'])) {
                 $conf = Config::get('cs.default');
             }
             $mdl = Threeplstatuses::where($conf['awb'], '=', strval($order->{$conf['order_awb']}))->where(function ($q) use($order) {
                 $q->where('consignee_olshop_cust', '=', strval($order->consignee_olshop_cust))->orWhere('consignee_logistic_id', '=', strval($order->consignee_olshop_cust));
             });
             if (count($conf['group']) > 0) {
                 foreach ($conf['group'] as $g) {
                     $mdl = $mdl->groupBy($g);
                 }
             }
             $mdl = $mdl->orderBy($conf['order'], 'desc');
             if ($conf['status'] == 'single') {
                 //$statuses = $mdl->take(1)->timeout(-1)->get();
                 $statuses = $mdl->timeout(-1)->first();
             } else {
                 if (count($conf['get']) > 0) {
                     $statuses = $mdl->timeout(-1)->get($conf['get']);
                 } else {
                     $statuses = $mdl->timeout(-1)->get();
                 }
             }
             if ($statuses) {
                 $statuses = $statuses->toArray();
             } else {
                 $statuses = array();
             }
             //print_r($statuses);
         }
         $order->picList = $this->picList($order);
     }
     return View::make('cs.lastdetail')->with('order', $order)->with('status', $statuses)->render();
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:48,代码来源:CsController.php

示例4: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $count = Shipment::where('consignee_olshop_cust', '=', '1400000655')->where('logistic_status', 'regexp', '/^DELIVERED/i')->where('status', '!=', 'delivered')->count();
     print $count;
     $orders = Shipment::where('consignee_olshop_cust', '=', '1400000655')->where('logistic_status', 'regexp', '/^DELIVERED/i')->where('status', '!=', 'delivered')->get();
     foreach ($orders as $ord) {
         //print_r($ord->toArray());
         $lstat = $ord->logistic_raw_status;
         //print_r($lstat);
         $ord->status = 'delivered';
         $ord->delivered_time = $lstat['delivered_date'] . ' ' . $lstat['delivered_time'];
         print $ord->delivered_time . ' ' . $ord->status . "\r\n";
         //$ord->save();
     }
     $fl_status = Shipment::distinct('logistic_status')->where('logistic', '=', 'FL')->get();
     print_r($fl_status->toArray());
     //
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:23,代码来源:FLBacktrack.php

示例5: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $orders = Shipment::where('buyerdeliveryzone', '=', '')->orderBy('created', 'desc')->get();
     if ($orders) {
         $cities = array();
         foreach ($orders as $order) {
             $cities[] = $order->buyerdeliverycity;
         }
         $cities = array_unique($cities);
         $districts = Coverage::whereIn('city', $cities)->get();
         $district_list = array();
         foreach ($districts as $d) {
             $district_list[$d->city][] = $d->district;
             if (strpos($d->city, 'Jakarta')) {
                 $district['Jakarta'][] = $d->district;
             }
         }
         //print_r($district_list);
         $matches = 0;
         foreach ($orders as $order) {
             print $order->delivery_id . ' ' . $order->buyerdeliverycity . ' ' . $order->buyerdeliveryzone . "\r\n";
             if (isset($district_list[$order->buyerdeliverycity])) {
                 $cd = $district_list[$order->buyerdeliverycity];
                 print_r($cd);
                 foreach ($cd as $d) {
                     if (preg_match('/' . $d . '/i', $order->shipping_address)) {
                         print $d . ' ================' . "\r\n";
                         print 'match ' . $d . ' for ' . $order->delivery_id . ' ' . $order->shipping_address;
                         print "\r\n";
                         $order->buyerdeliveryzone = $d;
                         $order->save();
                         $matches++;
                     }
                     # code...
                 }
             }
         }
         print 'found ' . $matches . ' matches';
     } else {
         print 'nothing to fill in';
     }
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:47,代码来源:FillDistrict.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $key = Input::get('key');
     $order_id = Input::get('orderid');
     $ff_id = Input::get('ffid');
     if (is_null($key) || $key == '') {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
         return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
     }
     $app = \Application::where('key', '=', $key)->first();
     if ($app) {
         if ($order_id != '' && $ff_id != '') {
             $order = \Shipment::where('merchant_trans_id', '=', trim($order_id))->where('fulfillment_code', '=', trim($ff_id))->where('application_key', '=', trim($key))->first();
         } else {
             if ($order_id != '' && $ff_id == '') {
                 $order = \Shipment::where('merchant_trans_id', '=', trim($order_id))->where('application_key', '=', trim($key))->first();
             } else {
                 $order = false;
             }
         }
         if ($order) {
             //print_r($order);
             $actor = 'merchant id :' . $app->merchant_id;
             \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'awb ' . $order->delivery_id));
             return \Response::json(array('status' => 'OK', 'awb' => $order->delivery_id, 'timestamp' => date('Y-m-d H:i:s', time()), 'pending' => $order->pending_count, 'order_status' => $order->status, 'note' => $order->delivery_note));
         } else {
             $actor = 'merchant id :' . $app->merchant_id;
             \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'order not found'));
             return \Response::json(array('status' => 'ERR:NOTFOUND', 'timestamp' => time(), 'message' => 'Record Not Found'));
         }
     } else {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'account not found'));
         return \Response::json(array('status' => 'ERR:INVALIDACC', 'timestamp' => time(), 'message' => 'Invalid Account'));
     }
     //
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:43,代码来源:McconnectController.php

示例7: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $logistic_id = 'CGKN00027';
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     $res = array();
     print 'count ' . count($orders->toArray());
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             //$req[] = array('order_id'=>$ord->no_sales_order.'-'.$ord->consignee_olshop_orderid,'awb'=>$ord->awb);
             $req[] = array('order_id' => $ord->consignee_olshop_orderid, 'awb' => $ord->consignee_olshop_orderid);
         }
         $client = new GuzzleClient();
         //TO DO : Send data in chunk
         $reqchunks = array_chunk($req, 100);
         foreach ($reqchunks as $rq) {
             $this->sendData($rq, $client, $logistic, $logistic_id);
         }
     } else {
         print 'Empty order list' . "\r\n";
     }
     $actor = $this->name;
     Event::fire('log.api', array('JayaStatusDaemon', 'get', $actor, 'JAYA STATUS PULL'));
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:41,代码来源:JayaStatusDaemon.php

示例8: postShipmentlist

 public function postShipmentlist()
 {
     $in = Input::get();
     $city = $in['city'];
     $date = $in['date'];
     $pick_up_date = new MongoDate(strtotime($date));
     $shipments = Shipment::where('pick_up_date', '=', $pick_up_date)->where('status', '=', Config::get('jayon.trans_status_admin_dated'))->where('consignee_olshop_city', '=', $city)->get();
     $shipments = $shipments->toArray();
     for ($i = 0; $i < count($shipments); $i++) {
         $shipments[$i]['pick_up_date'] = date('Y-m-d', $shipments[$i]['pick_up_date']->sec);
     }
     $city = trim($city);
     $devices = Device::where('city', 'regex', new MongoRegex('/' . $city . '/i'))->where(function ($on) {
         $on->where('is_on', '=', 1)->orWhere('is_on', '=', strval(1));
     })->get();
     $caps = array();
     foreach ($devices as $d) {
         $caps[$d->key]['identifier'] = $d->identifier;
         $caps[$d->key]['key'] = $d->key;
         $caps[$d->key]['city'] = $d->city;
         $caps[$d->key]['count'] = Shipment::where('device_key', $d->key)->where('pick_up_date', $pick_up_date)->count();
     }
     return Response::json(array('result' => 'OK', 'shipment' => $shipments, 'device' => $caps));
     //print_r($caps);
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:25,代码来源:ZoningController.php

示例9: dupeFF

 public function dupeFF($data)
 {
     $count = Shipment::where('consignee_olshop_orderid', '=', $data['consignee_olshop_orderid'])->count();
     $ccount = 0;
     if ($count > 1) {
         $ccount = Shipment::where('consignee_olshop_orderid', '=', $data['consignee_olshop_orderid'])->where('status', '=', Config::get('jayon.trans_status_canceled'))->count();
         return '<span class="red">' . $data['consignee_olshop_orderid'] . '</span>' . '<div class="badge pull-right">' . ($count - 1) . ' dup.</div>' . '<div class="badge pull-right">' . $ccount . ' canceled</div>';
     } else {
         return $data['consignee_olshop_orderid'];
     }
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:11,代码来源:IncomingController.php

示例10: postOrder

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postOrder()
 {
     $key = \Input::get('key');
     //$user = \Apiauth::user($key);
     $user = \Device::where('key', '=', $key)->first();
     if (!$user) {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'device not found, upload image failed'));
         return \Response::json(array('status' => 'ERR:NODEVICE', 'timestamp' => time(), 'message' => 'Device Unregistered'));
     }
     $json = \Input::all();
     $batch = \Input::get('batch');
     $result = array();
     foreach ($json as $j) {
         //$j['mtimestamp'] = new \MongoDate(time());
         if (is_array($j)) {
             $olog = new \Orderlog();
             foreach ($j as $k => $v) {
                 $olog->{$k} = $v;
             }
             $olog->mtimestamp = new \MongoDate(time());
             $r = $olog->save();
             $shipment = \Shipment::where('delivery_id', '=', $olog->deliveryId)->first();
             if ($shipment) {
                 //$shipment->status = $olog->status;
                 $shipment->courier_status = $olog->courierStatus;
                 $shipment->pending_count = new \MongoInt32($olog->pendingCount);
                 if ($olog->courierStatus == \Config::get('jayon.trans_cr_oncr') || $olog->courierStatus == \Config::get('jayon.trans_cr_oncr_partial')) {
                     $shipment->pickup_status = \Config::get('jayon.trans_status_pickup');
                 }
                 $shipment->save();
             }
             if ($r) {
                 $result[] = array('status' => 'OK', 'timestamp' => time(), 'message' => 'log inserted');
             } else {
                 $result[] = array('status' => 'NOK', 'timestamp' => time(), 'message' => 'insertion failed');
             }
         }
     }
     //print_r($result);
     //die();
     $actor = $user->identifier . ' : ' . $user->devname;
     \Event::fire('log.api', array($this->controller_name, 'get', $actor, 'sync scan log'));
     return Response::json($result);
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:50,代码来源:SyncapiController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     date_default_timezone_set('Asia/Jakarta');
     $key = Input::get('key');
     $order_id = Input::get('orderid');
     $ff_id = Input::get('ffid');
     $is_dev = Input::get('dev');
     if (is_null($is_dev) || $is_dev == '') {
         $is_dev = 0;
     }
     if (is_null($key) || $key == '' || $key != $this->g21_key) {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
         return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
     }
     $date_from = Input::get('from');
     $date_to = Input::get('to');
     if (is_null($date_from) || $date_from == '') {
         $date_from = new \MongoDate(strtotime(date('Y-m-d', time()) . ' 00:00:00'));
     } else {
         $date_from = new \MongoDate(strtotime($date_from . ' 00:00:00'));
     }
     if (is_null($date_to) || $date_to == '') {
         $date_to = new \MongoDate(strtotime(date('Y-m-d', time()) . ' 23:59:59'));
     } else {
         $date_to = new \MongoDate(strtotime($date_to . ' 23:59:59'));
     }
     //$logistic = \Logistic::where('api_key','=',$key)->first();
     $logistic = \Logistic::where('consignee_olshop_cust', '=', $this->g21_id)->first();
     $logistic_id = $logistic->consignee_olshop_cust;
     $orders = \Shipment::where('awb', '!=', '')->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->where(function ($q) {
         $q->where('status', '=', \Config::get('jayon.trans_status_admin_dated'))->orWhere('status', '=', \Config::get('jayon.trans_status_confirmed'));
     })->where(function ($qd) use($date_from, $date_to) {
         $qd->whereBetween('pick_up_date', array($date_from, $date_to));
     })->where(function ($q) {
         $q->where('uploaded', '!=', 1)->orWhere('uploaded', 'exists', false);
     })->get();
     $orderres = clone $orders;
     $orders = $orders->toArray();
     $orderlist = array();
     for ($n = 0; $n < count($orders); $n++) {
         $o = $orders[$n];
         $entry = array();
         $entry['awb'] = $o['awb'];
         $entry['remark'] = '-';
         if (isset($o['consignee_olshop_addr'])) {
             $con_address = str_replace(array("\r", "\n"), ' ', $o['consignee_olshop_addr']);
         } else {
             $con_address = '';
         }
         $consignee = array('cn_name' => $o['consignee_olshop_name'], 'address' => $con_address, 'district' => $o['district'], 'city' => $o['consignee_olshop_city'], 'province' => $o['consignee_olshop_region'], 'country' => $o['consignee_olshop_region'], 'phone' => $o['consignee_olshop_phone']);
         $insurance = 'NO';
         if (isset($o['consignee_olshop_inst_amt'])) {
             if ($o['consignee_olshop_inst_amt'] == '' || is_null($o['consignee_olshop_inst_amt'])) {
                 $insurance = 'NO';
             } else {
                 $insurance = 'YES';
             }
         }
         //if($o['pick_up_date'] instanceOf MongoDate){
         $pickupdate = date('Y-m-d', $o['pick_up_date']->sec);
         //}else{
         //    $pickupdate = $o['pick_up_date'];
         //}
         $o['cod'] = isset($o['cod']) ? $o['cod'] : 0;
         $order = array('orderid' => $o['no_sales_order'] . '-' . $o['fulfillment_code'], 'actweight' => $o['w_v'], 'pieces' => $o['number_of_package'], 'items' => array('itemname' => $o['consignee_olshop_desc']), 'goodsval' => $o['cod'], 'insurance' => $insurance, 'cod' => $o['cod'] == 0 ? '0' : '1', 'pickupdate' => $pickupdate, 'service' => $o['consignee_olshop_service']);
         $shipper = array('merchant' => 'Bilna.com', 'merchant_address' => 'Kawasan Pergudangan PT. WIDYA SAKTI KUSUMA Jl. Raya Bekasi KM 28 ( Jl. Wahab Affan ) Pondok Ungu, Medan Satria, Bekasi 17132', 'merchant_district' => 'Medan Satria', 'merchant_city' => 'Bekasi', 'merchant_province' => 'Jawa Barat', 'merchant_country' => 'Indonesia', 'merchant_phone' => '02129022132', 'merchant_contact' => 'Bilna CS');
         $entry['consignee'] = $consignee;
         $entry['order'] = $order;
         $entry['shipper'] = $shipper;
         $orderlist[] = $entry;
     }
     if ($is_dev != 1) {
         foreach ($orderres as $ord) {
             $ord->uploaded = 1;
             $ord->save();
         }
     }
     $reslog = $orderlist;
     $reslog['timestamp'] = new \MongoDate();
     $reslog['consignee_logistic_id'] = $logistic->logistic_code;
     $reslog['consignee_olshop_cust'] = $logistic->consignee_olshop_cust;
     \Threepluploadlog::insert($reslog);
     $actor = $key;
     \Event::fire('log.api', array($this->controller_name, 'get', $actor, 'G21 PULL DATA'));
     return $orderlist;
     //
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:93,代码来源:G21apiController.php

示例12: getEffDates

 public function getEffDates($year, $week)
 {
     $model = new Shipment();
     $start = $model->where(DB::raw('year(ordertime)'), '=', $year)->where(DB::raw('weekofyear(ordertime)'), '=', $week)->min(DB::raw('date(ordertime)'));
     $end = $model->where(DB::raw('year(ordertime)'), '=', $year)->where(DB::raw('weekofyear(ordertime)'), '=', $week)->max(DB::raw('date(ordertime)'));
     return array($start, $end);
 }
开发者ID:awidarto,项目名称:jexadmin,代码行数:7,代码来源:__DeliveryreportController.php

示例13: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     //$base_url = 'http://localhost/jexadmin/public/api/v1/service/status';
     $base_url = 'http://api.sap-express.com/api/tracking/list/ref/';
     //$base_url = 'http://182.23.64.151/serverapi.sap/api/tracking/list/id/';
     $base_url = 'http://api.sap-express.com/api/tracking/list';
     $logistic_id = 'CGKN00284';
     $delivery_trigger = 'DELIVERED';
     $returned_trigger = 'UNDELIVERED';
     $logistic = Logistic::where('consignee_olshop_cust', '=', $logistic_id)->first();
     if (Prefs::isRunning($this->name)) {
         $l = array();
         $l['ts'] = new MongoDate();
         $l['error'] = 'process already running';
         $l['consignee_logistic_id'] = $logistic->logistic_code;
         $l['consignee_olshop_cust'] = $logistic_id;
         Threeplstatuserror::insert($l);
         die('process already running');
     }
     $orders = Shipment::where('awb', '!=', '')->where('bucket', '=', Config::get('jayon.bucket_tracker'))->where(function ($sq) {
         $sq->where('status', '!=', 'delivered')->where('status', '!=', 'undelivered')->where('status', '!=', 'canceled')->where('status', '!=', 'returned');
     })->where('logistic_type', '=', 'external')->where('consignee_olshop_cust', '=', $logistic_id)->get();
     if ($orders && count($orders->toArray()) > 0) {
         $req = array();
         foreach ($orders as $ord) {
             //$req[] = array('awb'=>$ord->awb);
             //$client = new GuzzleClient();
             //$request = $client->get($url, array());
             //$request->setAuth('sapclientapi', 'SAPCLIENTAPI_2014');
             //$response = $request->send();
             //print $response->getBody();
             //$url = $base_url.$ord->consignee_olshop_orderid;
             $username = 'sapclientapi';
             $password = 'SAPCLIENTAPI_2014';
             $url = $base_url . '?ref=' . $ord->consignee_olshop_orderid;
             print $url;
             $ch = curl_init();
             curl_setopt($ch, CURLOPT_URL, $url);
             curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
             curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
             curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
             curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true);
             //$result = curl_exec($ch);
             if (!($result = curl_exec($ch))) {
                 die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
             }
             $status_code = curl_getinfo($ch);
             //get status code
             //$status_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);   //get status code
             curl_close($ch);
             //print $result;
             $res = json_decode($result, true);
             $reslog = $res;
             $reslog['timestamp'] = new MongoDate();
             $reslog['consignee_logistic_id'] = $logistic->logistic_code;
             $reslog['consignee_olshop_cust'] = $logistic_id;
             Threeplstatuslog::insert($reslog);
             print_r($res);
             if (isset($res['cn_no'])) {
                 $pre = clone $ord;
                 $ls = $res['laststatus'];
                 if ($ls['status'] == $delivery_trigger) {
                     $ord->status = Config::get('jayon.trans_status_mobile_delivered');
                     $ord->position = 'CUSTOMER';
                 }
                 if ($ls['status'] == $returned_trigger) {
                     $ord->status = Config::get('jayon.trans_status_mobile_return');
                 }
                 //$ord->district = $ls->district;
                 $ord->logistic_status = $ls['status'];
                 $ord->logistic_status_ts = $ls['time'];
                 $ord->logistic_raw_status = $ls;
                 $ord->save();
                 $ts = new MongoDate();
                 $hdata = array();
                 $hdata['historyTimestamp'] = $ts;
                 $hdata['historyAction'] = 'api_shipment_change_status';
                 $hdata['historySequence'] = 1;
                 $hdata['historyObjectType'] = 'shipment';
                 $hdata['historyObject'] = $ord->toArray();
                 $hdata['actor'] = $this->name;
                 $hdata['actor_id'] = '';
                 //History::insert($hdata);
                 $sdata = array();
                 $sdata['timestamp'] = $ts;
                 $sdata['action'] = 'api_shipment_change_status';
                 $sdata['reason'] = 'api_update';
                 $sdata['objectType'] = 'shipment';
                 $sdata['object'] = $ord->toArray();
                 $sdata['preObject'] = $pre->toArray();
                 $sdata['actor'] = $this->name;
                 $sdata['actor_id'] = '';
                 Shipmentlog::insert($sdata);
                 $this->saveStatus($res, $logistic->logistic_code, $logistic_id);
             }
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:SapStatusDaemon.php

示例14: postAssigncourier

 public function postAssigncourier()
 {
     //courier_name:Shia Le Beouf
     //courier_id:5605512bccae5b64010041b6
     //device_key:0f56deadbc6df60740ef5e2c576876b0e3310f7d
     //device_name:JY-002
     //pickup_date:28-09-2
     $in = Input::get();
     $pickup_date = new MongoDate(strtotime($in['pickup_date']));
     $shipments = Shipment::where('device_key', '=', $in['device_key'])->where('pick_up_date', '=', $pickup_date)->where('status', '=', Config::get('jayon.trans_status_admin_zoned'))->get();
     //print_r($shipments->toArray());
     $ts = new MongoDate();
     foreach ($shipments as $sh) {
         $pre = clone $sh;
         $sh->bucket = Config::get('jayon.bucket_tracker');
         $sh->status = Config::get('jayon.trans_status_admin_courierassigned');
         $sh->courier_id = $in['courier_id'];
         $sh->courier_name = $in['courier_name'];
         $sh->save();
         $hdata = array();
         $hdata['historyTimestamp'] = $ts;
         $hdata['historyAction'] = 'assign_courier';
         $hdata['historySequence'] = 1;
         $hdata['historyObjectType'] = 'shipment';
         $hdata['historyObject'] = $sh->toArray();
         $hdata['actor'] = Auth::user()->fullname;
         $hdata['actor_id'] = Auth::user()->_id;
         History::insert($hdata);
         $sdata = array();
         $sdata['timestamp'] = $ts;
         $sdata['action'] = 'assign_courier';
         $sdata['reason'] = 'initial';
         $sdata['objectType'] = 'shipment';
         $sdata['object'] = $sh->toArray();
         $sdata['preObject'] = $pre->toArray();
         $sdata['actor'] = Auth::user()->fullname;
         $sdata['actor_id'] = Auth::user()->_id;
         Shipmentlog::insert($sdata);
         //print_r($sh);
     }
     return Response::json(array('result' => 'OK', 'shipment' => $shipments));
 }
开发者ID:awidarto,项目名称:bilnatracker,代码行数:42,代码来源:CourierassignController.php

示例15: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     date_default_timezone_set('Asia/Jakarta');
     $key = Input::get('key');
     $order_id = Input::get('orderid');
     $ff_id = Input::get('ffid');
     $is_dev = Input::get('dev');
     if (is_null($is_dev) || $is_dev == '') {
         $is_dev = 0;
     }
     if (is_null($key) || $key == '') {
         $actor = 'no id : no name';
         \Event::fire('log.api', array($this->controller_name, 'post', $actor, 'empty key'));
         return \Response::json(array('status' => 'ERR:EMPTYKEY', 'timestamp' => time(), 'message' => 'Empty Key'));
     }
     $logistic = \Logistic::where('api_key', '=', $key)->first();
     $logistic_id = $logistic->consignee_olshop_cust;
     $orders = \Shipment::where('awb', '!=', '')->where('logistic_type', '=', 'external')->where('status', '=', \Config::get('jayon.trans_status_admin_dated'))->where('consignee_olshop_cust', '=', $logistic_id)->where(function ($q) {
         $q->where('uploaded', '!=', 1)->orWhere('uploaded', 'exists', false);
     })->get();
     $orderres = clone $orders;
     $orders = $orders->toArray();
     $orderlist = array();
     for ($n = 0; $n < count($orders); $n++) {
         $o = $orders[$n];
         $entry = array();
         $entry['hawb'] = $o['awb'];
         $entry['remark'] = '-';
         $consignee = array('cn_name' => $o['consignee_olshop_name'], 'address' => str_replace(array("\r", "\n"), ' ', $o['consignee_olshop_addr']), 'distric' => $o['district'], 'city' => $o['consignee_olshop_city'], 'province' => $o['consignee_olshop_region'], 'country' => $o['consignee_olshop_region'], 'phone' => $o['consignee_olshop_phone']);
         $insurance = 'NO';
         if (isset($o['consignee_olshop_inst_amt'])) {
             if ($o['consignee_olshop_inst_amt'] == '' || is_null($o['consignee_olshop_inst_amt'])) {
                 $insurance = 'NO';
             } else {
                 $insurance = 'YES';
             }
         }
         //if($o['pick_up_date'] instanceOf MongoDate){
         $pickupdate = date('Y-m-d', $o['pick_up_date']->sec);
         //}else{
         //    $pickupdate = $o['pick_up_date'];
         //}
         $o['cod'] = isset($o['cod']) ? $o['cod'] : 0;
         $order = array('orderid' => $o['no_sales_order'] . '-' . $o['fulfillment_code'], 'actweight' => '0', 'pieces' => $o['number_of_package'], 'items' => array('itemname' => $o['consignee_olshop_desc']), 'goodsval' => $o['cod'], 'assoption' => $insurance, 'cod' => $o['cod'] == 0 ? '0' : '1', 'pubrate' => '0', 'pickupdate' => $pickupdate, 'service' => $o['consignee_olshop_service']);
         $shipper = array('merchant' => 'Bilna.com', 'merchant_address' => 'Kawasan Pergudangan PT. WIDYA SAKTI KUSUMA Jl. Raya Bekasi KM 28 ( Jl. Wahab Affan ) Pondok Ungu, Medan Satria, Bekasi 17132', 'merchant_distric' => 'Medan Satria', 'merchant_city' => 'Bekasi', 'merchant_province' => 'Jawa Barat', 'merchant_country' => 'Indonesia', 'merchant_phone' => '02129022132', 'merchant_contact' => 'Bilna CS');
         $entry['consignee'] = $consignee;
         $entry['order'] = $order;
         $entry['shipper'] = $shipper;
         /*
         array (
           '_id' => new MongoId("564c5dedccae5b110f0041f7"),
           'awb' => '007735-17-112015-00146067',
           'bucket' => 'tracker',
           'cod' => 127000,
           'consignee_olshop_addr' => 'bagus sulaiman
         jl.bakti rt.004 rw.008 no.10b cililitan kramatjati 13640
         Jakarta Timur JK 13640
         Indonesia',
           'consignee_olshop_city' => 'Jakarta Timur',
           'consignee_olshop_cust' => '7735',
           'consignee_olshop_desc' => 'Susu dan Perlengkapan Bayi',
           'consignee_olshop_name' => '106191 bagus sulaiman',
           'consignee_olshop_orderid' => '334975',
           'consignee_olshop_phone' => '81317857612',
           'consignee_olshop_region' => 'JK',
           'consignee_olshop_service' => 'COD',
           'consignee_olshop_zip' => '13640',
           'contact' => '106191 bagus sulaiman',
           'courier_id' => '',
           'courier_name' => '',
           'courier_status' => 'at_initial_node',
           'createdDate' => new MongoDate(1447845357, 699000),
           'created_at' => '2015-11-18 18:15:20',
           'delivery_id' => '18-112015-JEJVV',
           'delivery_type' => 'REG',
           'device_id' => '',
           'device_key' => '',
           'device_name' => '',
           'district' => '',
           'email' => 'bagus_sulaiman@india.com',
           'fulfillment_code' => '334975',
           'lastUpdate' => new MongoDate(1447845357, 699000),
           'logistic' => 'JEX',
           'logistic_raw_status' =>
           array (
             'awb' => '007735-17-112015-00146067',
             'timestamp' => '2015-11-19 11:18:23',
             'pending' => '0',
             'status' => 'delivered',
             'note' => 'iwan 12.05',
           ),
           'logistic_status' => 'delivered',
           'logistic_status_ts' => '2015-11-19 11:18:23',
           'logistic_type' => 'external',
           'no_sales_order' => '100364363',
//.........这里部分代码省略.........
开发者ID:awidarto,项目名称:bilnatracker,代码行数:101,代码来源:SapapiController.php


注:本文中的Shipment::where方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。