我有一个问题。
我正在尝试通过*.js文件将一些数据从一个表格传输到另一个表格。除了一个问题,一切都很顺利。这个函数会显示:
Error: Timezone "gmt+0200" is not recognized
这是我的函数。
async function submitCompletationCG(database, ulogin, idc) {
await connectToSpecificDatabase(database);
const AC_ID = `SELECT * FROM public.cg_actualcompletations WHERE UserLogin = '`+ulogin+`';`;
let AC_IDs = await client.query(AC_ID);
const ACC_ID = `SELECT * FROM public.cg_actualcompletationscondensed WHERE UserLogin = '`+ulogin+`';`;
let ACC_IDs = await client.query(ACC_ID);
const DEPOT = `SELECT * FROM public.cg_actualdepots WHERE UserLogin = '`+ulogin+`';`;
let DEPOTs = await client.query(DEPOT);
let depot_from, depot_to, code_from, code_to;
for(let Depot of DEPOTs.rows) {
depot_from = Depot.depot_from;
depot_to = Depot.depot_to;
code_from = Depot.code_from;
code_to = Depot.code_to;
}
for(let Completation of ACC_IDs.rows) { //Transfer all Completations Condensed
const ACC_Copy = `INSERT INTO public.cg_completationscondensed(
id_c, userlogin, barcode, quantity, adate)
VALUES ('`+idc+`', '`+ulogin+`', '`+Completation.barcode+`', '`+Completation.quantity+`', '`+Completation.adate+`');`;
await client.query(ACC_Copy);
const ACC_Delete = `DELETE FROM public.cg_actualcompletationscondensed
WHERE id = `+Completation.id+`;`;
await client.query(ACC_Delete);
}
for(let Completation of AC_IDs.rows) { //Transfer all Completations
const AC_Copy = `INSERT INTO public.cg_completations(
id_c, userlogin, barcode, quantity, adate)
VALUES ('`+idc+`', '`+ulogin+`', '`+Completation.barcode+`', '`+Completation.quantity+`', '`+Completation.adate+`');`;
await client.query(AC_Copy);
const AC_Delete = `DELETE FROM public.cg_actualcompletations
WHERE id = `+Completation.id+`;`;
await client.query(AC_Delete);
}
const SUB_UArch = `INSERT INTO public.cg_userarch(
userlogin, id_c, depot_from, depot_to, code_from, code_to)
VALUES ('`+ulogin+`', '`+idc+`', '`+depot_from+`', '`+depot_to+`', '`+code_from+`', '`+code_to+`');`;
await client.query(SUB_UArch);
const SUB_DKill = `DELETE FROM public.cg_actualdepots WHERE UserLogin = '`+ulogin+`';`;
await client.query(SUB_DKill);
return true;
}
我应该在 Angular 文件中设置时区吗?还是这是数据库的问题?忘了说我正在使用 PostgreSQL。ADate 列的类型为“没有时区的时间戳”,之前它是“带有时区的时间戳”,但我认为这会导致问题,所以我改变了它。
我在这一行遇到了这个问题:
for(let Completation of ACC_IDs.rows) { //Transfer all Completations Condensed
const ACC_Copy = `INSERT INTO public.cg_completationscondensed(
id_c, userlogin, barcode, quantity, adate)
VALUES ('`+idc+`', '`+ulogin+`', '`+Completation.barcode+`', '`+Completation.quantity+`', '`+Completation.adate+`');`;
await client.query(ACC_Copy);
const ACC_Delete = `DELETE FROM public.cg_actualcompletationscondensed
WHERE id = `+Completation.id+`;`;
await client.query(ACC_Delete);
}
在下一个for循环中,因为还涉及到日期操作。