From e2164fe5d2418108e66358531171bb6fff01db5c Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Fri, 22 Mar 2024 18:20:07 +0900 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/kintone-event.ts | 8 ++++++++ src/rest-api/定期駐車場プランマスタ.ts | 2 +- src/rest-api/顧客マスタ.ts | 8 ++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/common/kintone-event.ts b/src/common/kintone-event.ts index 032b941..de73dcf 100644 --- a/src/common/kintone-event.ts +++ b/src/common/kintone-event.ts @@ -27,6 +27,14 @@ export const KintoneEvent = { フィールドの値を変更したとき: (fieldCode: string) => sprintf("app.record.edit.change.%s", fieldCode), }, + + 追加編集: { + 保存するとき: ["app.record.create.submit", "app.record.edit.submit"], + フィールドの値を変更したとき: (fieldCode: string) => [ + sprintf("app.record.create.change.%s", fieldCode), + sprintf("app.record.edit.change.%s", fieldCode), + ], + }, } as const; export const 画面遷移 = (event: any, url: string) => { diff --git a/src/rest-api/定期駐車場プランマスタ.ts b/src/rest-api/定期駐車場プランマスタ.ts index bfd5149..842a313 100644 --- a/src/rest-api/定期駐車場プランマスタ.ts +++ b/src/rest-api/定期駐車場プランマスタ.ts @@ -12,7 +12,7 @@ export const get定期駐車場プランマスタ = async ( プラン名: string ): Promise<定期駐車場プランマスタ> => { const query = sprintf( - sprintf('%s = "%s"', 定期駐車場プランマスタフィールド名.プラン名, プラン名) + sprintf('%s = "%s"', 定期駐車場プランマスタフィールド名.KEY, プラン名) ); const { records } = await client.record.getRecords<定期駐車場プランマスタ>({ diff --git a/src/rest-api/顧客マスタ.ts b/src/rest-api/顧客マスタ.ts index 6a569c7..9ecd366 100644 --- a/src/rest-api/顧客マスタ.ts +++ b/src/rest-api/顧客マスタ.ts @@ -4,6 +4,7 @@ import { 顧客マスタ, 顧客マスタフィールド名 } from "@/types/顧 import { KintoneRestAPIClient } from "@kintone/rest-api-client"; import { sprintf } from "sprintf"; import { QueryBuilder } from "./query"; +import { max } from "lodash"; const client = new KintoneRestAPIClient(); @@ -74,6 +75,7 @@ export const getNext顧客コード = async () => { }; export const getNextSMBC番号 = async () => { + const min = 90000; const query = sprintf( "order by %s desc limit 1", 顧客マスタフィールド名.SMBC契約番号 @@ -83,7 +85,9 @@ export const getNextSMBC番号 = async () => { query, }); if (records.length === 0) { - return 1; + return min; } - return Number(records[0][顧客マスタフィールド名.SMBC契約番号].value) + 1; + + const num = Number(records[0][顧客マスタフィールド名.SMBC契約番号].value) + 1; + return max([min, num]); };