|
|
@@ -61,6 +61,7 @@ use App\Station;
|
|
|
use App\StationTask;
|
|
|
use App\StationTaskMaterialBox;
|
|
|
use App\Store;
|
|
|
+use App\StoreItem;
|
|
|
use App\TaskTransaction;
|
|
|
use App\Unit;
|
|
|
use App\User;
|
|
|
@@ -419,15 +420,16 @@ sql;
|
|
|
ini_set('max_execution_time', 0);
|
|
|
ini_set('memory_limit', '1024M');
|
|
|
$now = Carbon::now();
|
|
|
- $startDate = $this->getDate();
|
|
|
- $diffDay = 16; // 天数
|
|
|
+// $startDate = $this->getDate();
|
|
|
+ $startDate = '2021-09-19 14:15:58';
|
|
|
+ $diffDay = 2; // 天数
|
|
|
for($i = 0;$i<=$diffDay;$i++){
|
|
|
- $endDate = Carbon::parse($startDate)->addHours(1)->toDateTimeString();
|
|
|
-// $doc_asn_headers = $this->getDocAsnHeader($startDate,$endDate);
|
|
|
-// if (count($doc_asn_headers)>0){
|
|
|
-// $this->syncStores($doc_asn_headers);
|
|
|
-// $this->syncDate($endDate);
|
|
|
-// }
|
|
|
+ $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($endDate);
|
|
|
$startDate = $endDate;
|
|
|
}
|
|
|
@@ -485,4 +487,23 @@ sql;
|
|
|
// 清空保存 ans 号的栈
|
|
|
// 清除 更新时间 开始 结束
|
|
|
}
|
|
|
+
|
|
|
+ public function updateStoreItem()
|
|
|
+ {
|
|
|
+ $storeIds=Store::query()
|
|
|
+ ->where('updated_at','>=','2021-09-19 14:15:58')
|
|
|
+ ->whereColumn('updated_at','<>','created_at')
|
|
|
+ ->pluck('id');
|
|
|
+
|
|
|
+ $storeItemMaxIds=StoreItem::query()
|
|
|
+ ->selectRaw('max(id) as max_id')
|
|
|
+ ->whereIn('store_id',$storeIds)
|
|
|
+ ->groupBy(['store_id','asn_line_code'])
|
|
|
+ ->get();
|
|
|
+ $storeItems=StoreItem::query()
|
|
|
+ ->whereIn('store_id',$storeIds)
|
|
|
+ ->whereNotIn('id',$storeItemMaxIds)
|
|
|
+ ->delete();
|
|
|
+
|
|
|
+ }
|
|
|
}
|