fix: #0909 盘点导入优化
This commit is contained in:
parent
e0b82d1132
commit
78a122bd4c
@ -51,8 +51,11 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
|
|||||||
Log::warning(json_encode($row, 256) . '=====库存导入未找到');
|
Log::warning(json_encode($row, 256) . '=====库存导入未找到');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$goodsSku->stock = $row[6] + $row[7];
|
||||||
|
$goodsSku->save();
|
||||||
$updateIds[] = $goodsSku->id;
|
$updateIds[] = $goodsSku->id;
|
||||||
DailyStockRecord::where('sku_id', $goodsSku->id)->where('day', $day)->update([
|
DailyStockRecord::where('sku_id', $goodsSku->id)->where('day', $day)->update([
|
||||||
|
'arrived_today_num' => $row[7],
|
||||||
'inventory' => $row[6],
|
'inventory' => $row[6],
|
||||||
'inventory_time' => $dateTime
|
'inventory_time' => $dateTime
|
||||||
]);
|
]);
|
||||||
@ -64,13 +67,16 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
|
|||||||
throw $exception;
|
throw $exception;
|
||||||
}
|
}
|
||||||
$onSkuIds = GoodsSku::query()
|
$onSkuIds = GoodsSku::query()
|
||||||
->where('stock', '>', 0)
|
|
||||||
->where('status', '<>', 0)
|
->where('status', '<>', 0)
|
||||||
->pluck('id')
|
->pluck('id')
|
||||||
->toArray();
|
->toArray();
|
||||||
if ($downSkuIds = array_diff($onSkuIds, $updateIds)) {
|
$downSkuIds = array_diff($onSkuIds, $updateIds);
|
||||||
GoodsSku::whereIn('id', $onSkuIds)->update(['stock' => 0]);
|
foreach ($downSkuIds as $downSkuId) {
|
||||||
event(new StockUpdateEvent($downSkuIds));
|
$goodsSku = GoodsSku::query()->find($downSkuId);
|
||||||
|
$goodsSku->yesterday_num -= $goodsSku->stock;
|
||||||
|
$goodsSku->stock = 0;
|
||||||
|
$goodsSku->save();
|
||||||
|
event(new StockUpdateEvent($goodsSku));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@
|
|||||||
<br />
|
<br />
|
||||||
<el-checkbox v-model="checked">记住密码</el-checkbox>
|
<el-checkbox v-model="checked">记住密码</el-checkbox>
|
||||||
<br />
|
<br />
|
||||||
<el-button type="primary" @click="Login()">登录</el-button>
|
<el-button type="primary" @click="Login()" @keyup.enter="Login()">登录</el-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -32,6 +32,7 @@ export default {
|
|||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getCookie();
|
this.getCookie();
|
||||||
|
window.addEventListener('keydown', this.keyDown);
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
Login() {
|
Login() {
|
||||||
@ -103,7 +104,15 @@ export default {
|
|||||||
clearCookie: function () {
|
clearCookie: function () {
|
||||||
this.setCookie("", "", false, -1);
|
this.setCookie("", "", false, -1);
|
||||||
},
|
},
|
||||||
|
keyDown(e) {
|
||||||
|
if (13 === e.keyCode) {
|
||||||
|
this.Login();
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
destroyed() {
|
||||||
|
window.removeEventListener('keydown', this.keyDown, false);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user