From f216a6fa6456b704f29e299363011f457a9945d5 Mon Sep 17 00:00:00 2001 From: "sosuke.iwabuchi" Date: Mon, 18 Dec 2023 20:25:40 +0900 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=8B=95=E6=89=BF=E8=AA=8D=E3=81=AE?= =?UTF-8?q?=E5=AF=BE=E8=B1=A1=E8=BB=8A=E5=AE=A4=E3=81=AE=E5=AE=9A=E7=BE=A9?= =?UTF-8?q?=E3=82=92=E5=8F=8D=E6=98=A0=E3=81=99=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apps/定期申込予約/自動承認.ts | 17 +++++++++++++++-- src/types/自動承認グループ.ts | 2 -- src/types/車室情報2.ts | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/apps/定期申込予約/自動承認.ts b/src/apps/定期申込予約/自動承認.ts index 84f6176..dc1dd25 100644 --- a/src/apps/定期申込予約/自動承認.ts +++ b/src/apps/定期申込予約/自動承認.ts @@ -20,7 +20,7 @@ import { import { 定期駐車場プランマスタ } from "@/types/定期駐車場プランマスタ"; import { 自動承認グループ } from "@/types/自動承認グループ"; import { 車室契約情報, 車室契約情報フィールド名 } from "@/types/車室契約情報"; -import { 車室情報2 } from "@/types/車室情報2"; +import { 車室情報2, 車室情報2モデル } from "@/types/車室情報2"; import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; import { sprintf } from "sprintf"; import { CancelError, Message } from "@/exception"; @@ -126,7 +126,20 @@ export class 申込 { const target = this.自動承認グループ?.対象車室番号.value .filter(({ value: 定義 }) => { // 自動承認車室でない場合は対象外とする - if (定義.自動承認スキップ.value.length !== 0) return false; + const 車室 = this.車室一覧.find((room) => { + return room.車室番号.value === 定義.車室番号.value; + }); + if (!車室) { + throw new Message( + sprintf( + "車室情報に車室番号:%sのレコードが存在しません", + 定義.車室番号.value + ) + ); + } + const 車室モデル = new 車室情報2モデル(車室); + if (!車室モデル.自動承認対象()) return false; + // 契約中の車室は対象外とする const 同一車室の契約中情報: 車室契約情報 | undefined = this.契約一覧.find((契約) => { diff --git a/src/types/自動承認グループ.ts b/src/types/自動承認グループ.ts index c020b18..fd52aae 100644 --- a/src/types/自動承認グループ.ts +++ b/src/types/自動承認グループ.ts @@ -23,8 +23,6 @@ export const 自動承認グループフィールド名 = F; export type 対象車室番号行データ = { 割当順: KintoneRecordField.Number; 車室番号: KintoneRecordField.SingleLineText; - 利用中: KintoneRecordField.CheckBox; - 自動承認スキップ: KintoneRecordField.CheckBox; }; export type 自動承認グループ = AppRecord & { [F.プラン名]: KintoneRecordField.SingleLineText; diff --git a/src/types/車室情報2.ts b/src/types/車室情報2.ts index b2dc34f..318a86e 100644 --- a/src/types/車室情報2.ts +++ b/src/types/車室情報2.ts @@ -14,6 +14,10 @@ export const 状態Dropdown = { } as const; export type 状態Dropdown = (typeof 状態Dropdown)[keyof typeof 状態Dropdown]; +export const 自動承認CheckBox = { + 自動承認しない: "自動承認しない", +} as const; + export const 車室情報2フィールド名 = F; export type 車室情報2 = AppRecord & { @@ -32,3 +36,17 @@ export type 車室情報2 = AppRecord & { 契約駐車場プラン: KintoneRecordField.SingleLineText; 自動承認: KintoneRecordField.CheckBox; }; + +export class 車室情報2モデル { + public model: 車室情報2; + + constructor(model: 車室情報2) { + this.model = model; + } + + 自動承認対象() { + return !this.model.自動承認.value.find( + (val) => val === 自動承認CheckBox.自動承認しない + ); + } +}