|
|
@@ -62,7 +62,7 @@ class U8SettleInventory extends Command
|
|
|
];
|
|
|
|
|
|
foreach ($tasks as $name => $config) {
|
|
|
- $currentU8Nos = [];
|
|
|
+// $currentU8Nos = [];
|
|
|
$lastCode = ""; // 分页依据:存货编码
|
|
|
|
|
|
while (true) {
|
|
|
@@ -70,7 +70,7 @@ class U8SettleInventory extends Command
|
|
|
if (!$status || empty($items)) break;
|
|
|
|
|
|
$nos = collect($items)->pluck('product_code')->toArray();
|
|
|
- $currentU8Nos = array_merge($currentU8Nos, $nos);
|
|
|
+// $currentU8Nos = array_merge($currentU8Nos, $nos);
|
|
|
|
|
|
// 获取本地快照(注意:快照表的 ufts 字段需要是字符串类型)
|
|
|
$snapshots = DB::table('sync_snapshot_product')
|
|
|
@@ -89,13 +89,6 @@ class U8SettleInventory extends Command
|
|
|
} elseif (strtolower($u8Ufts) !== strtolower($snapshot->ufts)) {
|
|
|
$opType = SyncTempRecordProduct::opt_one;
|
|
|
}
|
|
|
-// if (!$snapshot) {
|
|
|
-// // 本地无记录 -> 新增
|
|
|
-// $opType = SyncTempRecordProduct::opt_zero;
|
|
|
-// } elseif ($u8Ufts !== $snapshot->ufts) {
|
|
|
-// // 本地 ufts 字符串与 U8 不一致 -> 修改
|
|
|
-// $opType = SyncTempRecordProduct::opt_one;
|
|
|
-// }
|
|
|
|
|
|
if ($opType !== null) {
|
|
|
$this->createSyncTask($no, $item, $opType, $u8Ufts, $time);
|
|
|
@@ -107,16 +100,16 @@ class U8SettleInventory extends Command
|
|
|
}
|
|
|
|
|
|
// --- 第二步:处理删除 ---
|
|
|
- DB::table('sync_snapshot_product')->orderBy('code')->chunk(1000, function ($snapshots) use ($currentU8Nos, $time) {
|
|
|
- $localNos = $snapshots->pluck('code')->toArray();
|
|
|
- $deletedNos = array_diff($localNos, $currentU8Nos);
|
|
|
-
|
|
|
- if (! empty($deletedNos)) {
|
|
|
- foreach ($deletedNos as $no) {
|
|
|
- $this->createSyncTask($no, ['product_code' => $no], SyncTempRecordProduct::opt_two, "", $time);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
+// DB::table('sync_snapshot_product')->orderBy('code')->chunk(1000, function ($snapshots) use ($currentU8Nos, $time) {
|
|
|
+// $localNos = $snapshots->pluck('code')->toArray();
|
|
|
+// $deletedNos = array_diff($localNos, $currentU8Nos);
|
|
|
+//
|
|
|
+// if (! empty($deletedNos)) {
|
|
|
+// foreach ($deletedNos as $no) {
|
|
|
+// $this->createSyncTask($no, ['product_code' => $no], SyncTempRecordProduct::opt_two, "", $time);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// });
|
|
|
}
|
|
|
}
|
|
|
|