Просмотр исходного кода

自動承認を未来の解約分を考慮するように修正

develop
sosuke.iwabuchi 2 лет назад
Родитель
Сommit
1c2a705255
4 измененных файлов: 17 добавлений и 7 удалений
  1. +7
    -0
      src/apps/各種申請/index.tsx
  2. +4
    -1
      src/apps/定期申込予約/自動承認.ts
  3. +1
    -1
      src/common/app-template.ts
  4. +5
    -5
      src/rest-api/車室契約情報.ts

+ 7
- 0
src/apps/各種申請/index.tsx Просмотреть файл

@@ -1,6 +1,7 @@
import { AppID } from "@/common/appids"; import { AppID } from "@/common/appids";
import { setHeaderButton } from "@/common/header-button"; import { setHeaderButton } from "@/common/header-button";
import { makeRecordData } from "@/common/rest-api-client"; import { makeRecordData } from "@/common/rest-api-client";
import { 契約状況同期 } from "@/logic/契約状況同期";
import { import {
ConfirmDialog, ConfirmDialog,
ErrorDialog, ErrorDialog,
@@ -8,6 +9,7 @@ import {
showLoadingDialog, showLoadingDialog,
} from "@/middleware/swal"; } from "@/middleware/swal";
import { EmailID, sendEmail } from "@/mypage/メール"; import { EmailID, sendEmail } from "@/mypage/メール";
import { get車室契約情報 } from "@/rest-api/車室契約情報";
import { get顧客マスタ } from "@/rest-api/顧客マスタ"; import { get顧客マスタ } from "@/rest-api/顧客マスタ";
import { import {
各種申請, 各種申請,
@@ -94,6 +96,8 @@ const getCallBack口座変更申請承認 = (record: 各種申請) => {
}; };


const 解約申請承認 = async (record: 各種申請) => { const 解約申請承認 = async (record: 各種申請) => {
const 契約 = await get車室契約情報(record.契約情報.value);

// 車室契約情報への反映 // 車室契約情報への反映
await client.record.updateRecord({ await client.record.updateRecord({
app: AppID.車室契約情報, app: AppID.車室契約情報,
@@ -103,6 +107,9 @@ const 解約申請承認 = async (record: 各種申請) => {
}), }),
}); });


// 契約情報の同期処理
await 契約状況同期(契約.駐車場名.value, Number(契約.車室番号.value));

// 申請の完了 // 申請の完了
await 各種申請完了(record); await 各種申請完了(record);




+ 4
- 1
src/apps/定期申込予約/自動承認.ts Просмотреть файл

@@ -26,6 +26,7 @@ import { 車室情報2 } from "@/types/車室情報2";
import { 顧客マスタフィールド名 } from "@/types/顧客マスタ"; import { 顧客マスタフィールド名 } from "@/types/顧客マスタ";
import { sprintf } from "sprintf"; import { sprintf } from "sprintf";
import { CancelError, Message } from "@/exception"; import { CancelError, Message } from "@/exception";
import { dateParse, now } from "@/common/datetime";


export class 申込 { export class 申込 {
private 定期申込予約: 定期申込予約; private 定期申込予約: 定期申込予約;
@@ -102,9 +103,11 @@ export class 申込 {
if (!this.定期申込予約.駐車場.value) { if (!this.定期申込予約.駐車場.value) {
throw new Message("駐車場名の設定をしてください"); throw new Message("駐車場名の設定をしてください");
} }

const 基準日 = dateParse(this.定期申込予約.利用開始希望日.value) ?? now();
this.契約一覧 = await get車室契約情報一覧({ this.契約一覧 = await get車室契約情報一覧({
駐車場名: this.定期申込予約.駐車場.value, 駐車場名: this.定期申込予約.駐車場.value,
契約中のみ: true,
契約中のみ: 基準日,
}); });
} }
private async 自動承認グループ取得() { private async 自動承認グループ取得() {


+ 1
- 1
src/common/app-template.ts Просмотреть файл

@@ -4,7 +4,7 @@ import { ErrorDialog } from "@/middleware/swal";
export const apptemplate = (callback: () => Promise<void>) => { export const apptemplate = (callback: () => Promise<void>) => {
return async () => { return async () => {
try { try {
const ret = await callback();
await callback();
} catch (e) { } catch (e) {
if (e instanceof CancelError) { if (e instanceof CancelError) {
console.log("canceled"); console.log("canceled");


+ 5
- 5
src/rest-api/車室契約情報.ts Просмотреть файл

@@ -7,7 +7,7 @@ import { QueryBuilder } from "./query";
const client = new KintoneRestAPIClient(); const client = new KintoneRestAPIClient();


export const get車室契約情報 = async ( export const get車室契約情報 = async (
レコード番号: number
レコード番号: number | string
): Promise<車室契約情報> => { ): Promise<車室契約情報> => {
const { record } = await client.record.getRecord<車室契約情報>({ const { record } = await client.record.getRecord<車室契約情報>({
app: AppID.車室契約情報, app: AppID.車室契約情報,
@@ -20,7 +20,7 @@ export const get車室契約情報 = async (
type get車室契約情報一覧オプション = { type get車室契約情報一覧オプション = {
駐車場名?: string; 駐車場名?: string;
車室番号?: number | string; 車室番号?: number | string;
契約中のみ?: boolean;
契約中のみ?: Date;
}; };
export const get車室契約情報一覧 = async ({ export const get車室契約情報一覧 = async ({
駐車場名, 駐車場名,
@@ -35,9 +35,9 @@ export const get車室契約情報一覧 = async ({
if (車室番号) { if (車室番号) {
builder.where(車室契約情報フィールド名.車室番号, 車室番号); builder.where(車室契約情報フィールド名.車室番号, 車室番号);
} }
if (契約中のみ) {
const todayStr = formatDateStr(now());
builder.where(車室契約情報フィールド名.解約日, todayStr, ">");
if (契約中のみ instanceof Date) {
const 基準日文字列 = formatDateStr(契約中のみ);
builder.where(車室契約情報フィールド名.解約日, 基準日文字列, ">");
} }


const record = await client.record.getAllRecords<車室契約情報>({ const record = await client.record.getAllRecords<車室契約情報>({


Загрузка…
Отмена
Сохранить