|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
namespace App\Services;
|
|
|
|
|
|
+use App\KeyValues;
|
|
|
use App\Logistic;
|
|
|
use App\OracleActAllocationDetails;
|
|
|
use App\OracleDOCASNHeader;
|
|
|
@@ -17,7 +18,9 @@ use App\Warehouse;
|
|
|
use Carbon\Carbon;
|
|
|
use Illuminate\Support\Collection;
|
|
|
use Illuminate\Support\Facades\App;
|
|
|
+use Illuminate\Support\Facades\Cache;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
class OrderService
|
|
|
{
|
|
|
@@ -804,13 +807,6 @@ class OrderService
|
|
|
$this->insert($inner_params->toArray());
|
|
|
});
|
|
|
}
|
|
|
-// $this->insert($created_params);
|
|
|
-// $this->insert($created_order->map(function($item){
|
|
|
-// $array = $item->toArray();
|
|
|
-// unset($array['logisticNumbers'],$array['packages'],$array['commodityPackages'],$array['amount']);
|
|
|
-// return $array;
|
|
|
-// })->toArray());
|
|
|
-
|
|
|
$update_params = [
|
|
|
['id','code','warehouse_id','owner_id','shop_id','logistic_id','consignee_name','consignee_phone','province','city','district','address','client_code','wms_status','created_at','updated_at','wms_edittime']
|
|
|
];
|
|
|
@@ -990,4 +986,61 @@ class OrderService
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // TODO 同步时间 是否减1秒
|
|
|
+ public function setOrderSyncAt($key,$date,$bool=false){
|
|
|
+ if(!$bool) KeyValues::query()->where('key',$key)->update(['value'=>$date]);
|
|
|
+ KeyValues::query()->where('key',$key)->update(['value'=>Carbon::parse($date)->subSeconds(1)]);
|
|
|
+ }
|
|
|
+ // TODO 获取最后的时间 $key $set 判断是否有上次缓存
|
|
|
+ public function getOrderSyncAt($key){
|
|
|
+ $keyValue = KeyValues::query()->where('key',$key)->first();
|
|
|
+ return $keyValue->value;
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+ public function pushOrderCreatedCache($orderHeaders){
|
|
|
+ $list = [];
|
|
|
+ collect($orderHeaders)->each(function($item,&$list){
|
|
|
+ $list[] =$item->orderno;
|
|
|
+ Cache::put('order_newest_',$item->orderno);
|
|
|
+ });
|
|
|
+ if(count($orderHeaders) > 0){
|
|
|
+ Cache::put('order_newest_cache_keys',$list);
|
|
|
+ Cache::put('order_newest_has_set',true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+ public function pushOrderUpdatedCache($orderHeaders)
|
|
|
+ {
|
|
|
+ $list = Cache::get('order_newest_update_cache_keys');
|
|
|
+ collect($list)->each(function($item){
|
|
|
+ Cache::forget($item);
|
|
|
+ });
|
|
|
+ $list = collect();
|
|
|
+ collect($orderHeaders)->each(function($item)use($list){
|
|
|
+ $list->push($item->orderno);
|
|
|
+ Cache::put('order_newest_update_'.$item->orderno,true);
|
|
|
+ });
|
|
|
+ if(count($orderHeaders) > 0){
|
|
|
+ Cache::put('order_newest_update_cache_keys',$list->toArray());
|
|
|
+ Cache::put('order_newest_update_has_set',true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+ public function filterCreatedOrder($orderHeaders)
|
|
|
+ {
|
|
|
+ $list = Cache::get('order_newest_cache_keys');
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+ public function filterUpdatedOrder($orderHeaders)
|
|
|
+ {
|
|
|
+ $list = Cache::get('order_newest_update_cache_keys');
|
|
|
+ }
|
|
|
+
|
|
|
+ // TODO
|
|
|
+ public function syncCreatedOrder(){
|
|
|
+ }
|
|
|
+ // TODO
|
|
|
+ public function syncUpdateOrder(){
|
|
|
+
|
|
|
+ }
|
|
|
}
|