114 lines
2.7 KiB
JavaScript
114 lines
2.7 KiB
JavaScript
/*
|
|
@config :next999.json
|
|
@filename : ${psFileBasename}
|
|
@title :01_マスタデータ取得
|
|
@name :01_マスタデータ取得
|
|
@siteIds : 335011
|
|
@siteTitles : 実行予算WF申請
|
|
@disabled: false
|
|
*/
|
|
|
|
try {
|
|
//マスタデータ取得
|
|
getMasterData1();
|
|
getMasterData2();
|
|
|
|
} catch (error) {
|
|
context.Log(error);
|
|
|
|
}
|
|
|
|
//マスタデータ取得1
|
|
function getMasterData1() {
|
|
//担当監督マスタ
|
|
let masterTableId = '335031';
|
|
let data = {
|
|
"View": {
|
|
"ColumnSorterHash": {
|
|
"NumA": "asc"
|
|
}
|
|
}
|
|
}
|
|
|
|
let results = items.Get(masterTableId, JSON.stringify(data));
|
|
if (results.Length === 0) {
|
|
context.Log('担当監督マスタデータが見つかりませんでした。1');
|
|
return;
|
|
}
|
|
|
|
let areaNotificationList = {};
|
|
let count = 0;
|
|
for (let item of results) {
|
|
const area = item.ClassA;
|
|
const list1 = item.ClassB;
|
|
const list2 = item.ClassC;
|
|
const list3 = item.ClassD;
|
|
const list4 = item.ClassE;
|
|
|
|
areaNotificationList[area] = {
|
|
"list1": list1,
|
|
"list2": list2,
|
|
"list3": list3,
|
|
"list4": list4
|
|
};
|
|
|
|
count++;
|
|
}
|
|
|
|
//取得したデータをhiddenに格納
|
|
if (count > 0) {
|
|
hidden.Add('areaNotificationList', JSON.stringify(areaNotificationList));
|
|
context.Log('担当監督マスタデータ取得完了');
|
|
return;
|
|
} else {
|
|
context.Log('担当監督マスタデータが見つかりませんでした。2');
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
//マスタデータ取得2
|
|
function getMasterData2() {
|
|
//通知先マスタ
|
|
let masterTableId = '335032';
|
|
let data = {
|
|
"View": {
|
|
"ColumnSorterHash": {
|
|
"NumA": "asc"
|
|
}
|
|
}
|
|
}
|
|
|
|
let results = items.Get(masterTableId, JSON.stringify(data));
|
|
if (results.Length === 0) {
|
|
context.Log('通知先マスタデータが見つかりませんでした。3');
|
|
return;
|
|
}
|
|
|
|
let classNotificationList = {};
|
|
let count = 0;
|
|
for (let item of results) {
|
|
const shubetu = item.ClassA;
|
|
const list1 = item.ClassB;
|
|
const list2 = item.ClassC;
|
|
const list3 = item.ClassD;
|
|
|
|
classNotificationList[shubetu] = {
|
|
"list1": list1,
|
|
"list2": list2,
|
|
"list3": list3
|
|
};
|
|
|
|
count++;
|
|
}
|
|
|
|
//取得したデータをhiddenに格納
|
|
if (count > 0) {
|
|
hidden.Add('classNotificationList', JSON.stringify(classNotificationList));
|
|
context.Log('通知先マスタデータ取得完了');
|
|
return;
|
|
} else {
|
|
context.Log('通知先マスタデータが見つかりませんでした。4');
|
|
return;
|
|
}
|
|
} |