FTV_M2M_LINES: TimeNew пишется явно (в боевой DEPO у таблицы строк нет умолчания GETDATE())

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
This commit is contained in:
zuevav
2026-09-29 15:39:34 +03:00
parent 44d6d7a74d
commit 0c42691d59
2 changed files with 52 additions and 0 deletions
+9
View File
@@ -242,6 +242,7 @@ func depoUpsertOrder(rc *RuntimeConfig, guid, direction, cpCode, deponentName, d
}
// SHARE (ID бумаги в DEPO) — заполняем, если колонка есть (джоба может подставить сама)
hasShare := depoHasColumn(ctx, db, "FTV_M2M_LINES", "SHARE")
hasLineTimeNew := depoHasColumn(ctx, db, "FTV_M2M_LINES", "TimeNew")
for _, ln := range lines {
var share sql.NullInt64
if ln.ISIN != "" && hasShare {
@@ -255,6 +256,14 @@ func depoUpsertOrder(rc *RuntimeConfig, guid, direction, cpCode, deponentName, d
if hasDepoNumber {
cols, vals = cols+", DEPO_NUMBER", vals+", @acc"
}
// TimeNew — явно: у FTV_M2M_LINES в боевой DEPO нет умолчания GETDATE() (29.09.2026), время было пустым
if hasLineTimeNew {
now := "GETDATE()"
if rc.Snapshot().Fancy.IsPostgres() {
now = "LOCALTIMESTAMP"
}
cols, vals = cols+", TimeNew", vals+", "+now
}
q := fsql.Ev06 + cols + `) VALUES (` + vals + `)`
if _, err := tx.ExecContext(ctx, q,
sql.Named("g", guid), sql.Named("r", ln.Ref), sql.Named("i", nullStr(ln.ISIN)), sql.Named("c", nullStr(ln.Code)), sql.Named("sh", share), sql.Named("a", ln.Amount), sql.Named("p", nullStr(ln.Place)), sql.Named("lnk", strings.TrimSpace(rc.Snapshot().NSD.AccountID)), sql.Named("acc", clientAcc)); err != nil {