|
|
@@ -461,22 +461,18 @@ sql;
|
|
|
public function store()
|
|
|
{
|
|
|
ini_set('max_execution_time', 0);
|
|
|
- ini_set('memory_limit', '1024M');
|
|
|
-// $now = Carbon::now();
|
|
|
-// $startDate = $this->getDate();
|
|
|
- $startDate = '2021-09-25 13:23:14';
|
|
|
- $diffDay = 1; // 天数
|
|
|
+ ini_set('memory_limit', '1024M');//2021-12-09 10:57:00
|
|
|
+
|
|
|
+ $startDate = '2021-11-13 00:00:00';
|
|
|
+ $diffDay = 26; // 天数
|
|
|
for($i = 0;$i<=$diffDay;$i++){
|
|
|
$endDate = Carbon::parse($startDate)->addDays(1)->toDateTimeString();
|
|
|
$doc_asn_headers = $this->getDocAsnHeader($startDate,$endDate);
|
|
|
-// if (count($doc_asn_headers)>0){
|
|
|
-// $this->syncStores($doc_asn_headers);
|
|
|
-// $this->syncDate($endDate);
|
|
|
-// }
|
|
|
- dump($startDate,$endDate);
|
|
|
+ $this->syncStores($doc_asn_headers);
|
|
|
+ dump([$startDate,$endDate]);
|
|
|
$startDate = $endDate;
|
|
|
}
|
|
|
- $this->clearCache();
|
|
|
+
|
|
|
// ValueStore::query()->updateOrCreate([
|
|
|
// 'name' => 'last_asn_sync_task_end_at',
|
|
|
// ], [
|
|
|
@@ -494,19 +490,20 @@ sql;
|
|
|
->select('asnno','asnstatus','asntype','addtime','edittime','customerid','notes','warehouseid','asnreference3','asnreference2')
|
|
|
->where('EditTime', '>=', $startDate)
|
|
|
->where('EditTime', '<=', $endDate)
|
|
|
- ->whereColumn('EditTime', '<>', 'addTime')
|
|
|
+// ->whereColumn('EditTime', '<>', 'addTime')
|
|
|
+// ->where('EditTime', '>=', $startDate)
|
|
|
+// ->where('EditTime', '<=', $endDate)
|
|
|
+// ->whereColumn('EditTime', '=', 'addTime')
|
|
|
->orderByDesc('EditTime')
|
|
|
->get();
|
|
|
}
|
|
|
|
|
|
- public function getDate(){
|
|
|
- return ValueStore::query()->where('name','asn_last_updated_sync_at')->value('value');
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
public function syncStores($doc_asn_headers){
|
|
|
$service = new StoreService();
|
|
|
$service->createStore($doc_asn_headers,"update");
|
|
|
- $service->updateStore($doc_asn_headers);
|
|
|
+// $service->updateStore($doc_asn_headers);
|
|
|
$service->createStoreRejected($doc_asn_headers);
|
|
|
unset($doc_asn_headers);
|
|
|
}
|
|
|
@@ -857,4 +854,18 @@ sql;
|
|
|
public function workOrder(){
|
|
|
dd(route('workOrder.damage.storeApi'));
|
|
|
}
|
|
|
+ public function testStore(){
|
|
|
+ $asnnos=['ASN2112061086','ASN2003030612','ASN2004140340'];
|
|
|
+ $collect=collect();
|
|
|
+ $result=[];
|
|
|
+ foreach (array_chunk($asnnos,1) as $item){
|
|
|
+ $res= OracleDOCASNDetail::query()
|
|
|
+ ->with(['lineStatus', 'qualityStatus'])
|
|
|
+ ->whereIn('asnno',$item)
|
|
|
+ ->select('asnno','asnlineno','customerid','sku','skudescrc','linestatus','lotatt08','lotatt05','receivedqty','expectedqty','addtime','edittime')
|
|
|
+ ->get();
|
|
|
+ array_push($result,...$res);
|
|
|
+ }
|
|
|
+ dd(collect($result));
|
|
|
+ }
|
|
|
}
|