소스 검색

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

develop
sosuke.iwabuchi 2 년 전
부모
커밋
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 { setHeaderButton } from "@/common/header-button";
import { makeRecordData } from "@/common/rest-api-client";
import { 契約状況同期 } from "@/logic/契約状況同期";
import {
ConfirmDialog,
ErrorDialog,
@@ -8,6 +9,7 @@ import {
showLoadingDialog,
} from "@/middleware/swal";
import { EmailID, sendEmail } from "@/mypage/メール";
import { get車室契約情報 } from "@/rest-api/車室契約情報";
import { get顧客マスタ } from "@/rest-api/顧客マスタ";
import {
各種申請,
@@ -94,6 +96,8 @@ const getCallBack口座変更申請承認 = (record: 各種申請) => {
};

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

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

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

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



+ 4
- 1
src/apps/定期申込予約/自動承認.ts 파일 보기

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

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

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


+ 1
- 1
src/common/app-template.ts 파일 보기

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


+ 5
- 5
src/rest-api/車室契約情報.ts 파일 보기

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

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

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


Loading…
취소
저장