mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
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) . '=====库存导入未找到');
|
||||
continue;
|
||||
}
|
||||
$goodsSku->stock = $row[6] + $row[7];
|
||||
$goodsSku->save();
|
||||
$updateIds[] = $goodsSku->id;
|
||||
DailyStockRecord::where('sku_id', $goodsSku->id)->where('day', $day)->update([
|
||||
'arrived_today_num' => $row[7],
|
||||
'inventory' => $row[6],
|
||||
'inventory_time' => $dateTime
|
||||
]);
|
||||
@ -64,13 +67,16 @@ class InventoryImport implements ToCollection, SkipsEmptyRows
|
||||
throw $exception;
|
||||
}
|
||||
$onSkuIds = GoodsSku::query()
|
||||
->where('stock', '>', 0)
|
||||
->where('status', '<>', 0)
|
||||
->pluck('id')
|
||||
->toArray();
|
||||
if ($downSkuIds = array_diff($onSkuIds, $updateIds)) {
|
||||
GoodsSku::whereIn('id', $onSkuIds)->update(['stock' => 0]);
|
||||
event(new StockUpdateEvent($downSkuIds));
|
||||
$downSkuIds = array_diff($onSkuIds, $updateIds);
|
||||
foreach ($downSkuIds as $downSkuId) {
|
||||
$goodsSku = GoodsSku::query()->find($downSkuId);
|
||||
$goodsSku->yesterday_num -= $goodsSku->stock;
|
||||
$goodsSku->stock = 0;
|
||||
$goodsSku->save();
|
||||
event(new StockUpdateEvent($goodsSku));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<br />
|
||||
<el-checkbox v-model="checked">记住密码</el-checkbox>
|
||||
<br />
|
||||
<el-button type="primary" @click="Login()">登录</el-button>
|
||||
<el-button type="primary" @click="Login()" @keyup.enter="Login()">登录</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@ -32,6 +32,7 @@ export default {
|
||||
},
|
||||
mounted() {
|
||||
this.getCookie();
|
||||
window.addEventListener('keydown', this.keyDown);
|
||||
},
|
||||
methods: {
|
||||
Login() {
|
||||
@ -103,7 +104,15 @@ export default {
|
||||
clearCookie: function () {
|
||||
this.setCookie("", "", false, -1);
|
||||
},
|
||||
keyDown(e) {
|
||||
if (13 === e.keyCode) {
|
||||
this.Login();
|
||||
}
|
||||
}
|
||||
},
|
||||
destroyed() {
|
||||
window.removeEventListener('keydown', this.keyDown, false);
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user