|
@@ -85,7 +85,6 @@ if (!lk.isExecComm) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
async function all() {
|
|
async function all() {
|
|
|
let taskLst = [];
|
|
let taskLst = [];
|
|
|
if (isGetTaskListEnable()) {
|
|
if (isGetTaskListEnable()) {
|
|
@@ -128,37 +127,53 @@ async function all() {
|
|
|
lk.log('合成任务列表为空');
|
|
lk.log('合成任务列表为空');
|
|
|
}
|
|
}
|
|
|
if (isCaclMateListEnable()) {
|
|
if (isCaclMateListEnable()) {
|
|
|
- let taskId = getWillCompositeTaskId();
|
|
|
|
|
|
|
+ let isFoundOnce = await checkToCompositeConformingTasks(taskLst);
|
|
|
|
|
+ if (!isFoundOnce) {
|
|
|
|
|
+ lk.log('没有任何相符合的合成任务');
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ lk.msg('');
|
|
|
|
|
+ lk.done();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+async function checkToCompositeConformingTasks(taskLst) {
|
|
|
|
|
+ let taskIds = getWillCompositeTaskIds();
|
|
|
|
|
+ let isFoundOnce = false;
|
|
|
|
|
+ for (let i = 0; i < taskIds.length; i++) {
|
|
|
|
|
+ let taskId = taskIds[i];
|
|
|
|
|
+ let found = false;
|
|
|
if (taskId > 0) {
|
|
if (taskId > 0) {
|
|
|
- let found = false;
|
|
|
|
|
- for (let i = 0; i < taskLst.length; i++) {
|
|
|
|
|
- let taskInfo = taskLst[i];
|
|
|
|
|
|
|
+ for (let j = 0; j < taskLst.length; j++) {
|
|
|
|
|
+ let taskInfo = taskLst[j];
|
|
|
if (taskInfo.id == taskId) {
|
|
if (taskInfo.id == taskId) {
|
|
|
found = true;
|
|
found = true;
|
|
|
lk.setVal(GandartConstKey.CompositeTaskNameDisplay, taskInfo.compositeTaskName);
|
|
lk.setVal(GandartConstKey.CompositeTaskNameDisplay, taskInfo.compositeTaskName);
|
|
|
- await tryToExecCompositeTask(taskInfo.id, taskInfo);
|
|
|
|
|
|
|
+ await tryToExecCompositeTask(taskInfo.id, taskInfo, i);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (!found) {
|
|
if (!found) {
|
|
|
lk.log(`当前任务列表找不到指定任务[${taskId}]`);
|
|
lk.log(`当前任务列表找不到指定任务[${taskId}]`);
|
|
|
- await checkTrySearchToCompositeTask(taskLst);
|
|
|
|
|
|
|
+ found = await checkTrySearchToCompositeTask(taskLst, i);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
lk.log('没有设置指定任务ID,检查是否需进行检索合成');
|
|
lk.log('没有设置指定任务ID,检查是否需进行检索合成');
|
|
|
- await checkTrySearchToCompositeTask(taskLst);
|
|
|
|
|
|
|
+ found = await checkTrySearchToCompositeTask(taskLst, i);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (found) {
|
|
|
|
|
+ isFoundOnce = found;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- lk.msg('');
|
|
|
|
|
- lk.done();
|
|
|
|
|
|
|
+ return isFoundOnce;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-async function checkTrySearchToCompositeTask(taskLst) {
|
|
|
|
|
|
|
+async function checkTrySearchToCompositeTask(taskLst, sortIdx) {
|
|
|
if (!isTaskNameSearchMode()) {
|
|
if (!isTaskNameSearchMode()) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
lk.log('开始尝试通过名称来检索任务进行合成');
|
|
lk.log('开始尝试通过名称来检索任务进行合成');
|
|
|
- let keyName = lk.getVal(GandartConstKey.CompositeTaskSearchKey);
|
|
|
|
|
|
|
+ let keyNames = getWillCompositeTaskSearchKeys();
|
|
|
|
|
+ let keyName = keyNames[sortIdx];
|
|
|
if (lk.isEmpty(keyName)) {
|
|
if (lk.isEmpty(keyName)) {
|
|
|
lk.log(`当前检索关键字为空`);
|
|
lk.log(`当前检索关键字为空`);
|
|
|
return;
|
|
return;
|
|
@@ -171,13 +186,14 @@ async function checkTrySearchToCompositeTask(taskLst) {
|
|
|
found = true;
|
|
found = true;
|
|
|
lk.log(`检索到相符的任务[${taskName}#${taskInfo.id}]`);
|
|
lk.log(`检索到相符的任务[${taskName}#${taskInfo.id}]`);
|
|
|
lk.setVal(GandartConstKey.CompositeTaskNameDisplay, taskName);
|
|
lk.setVal(GandartConstKey.CompositeTaskNameDisplay, taskName);
|
|
|
- await tryToExecCompositeTask(taskInfo.id, taskInfo);
|
|
|
|
|
|
|
+ await tryToExecCompositeTask(taskInfo.id, taskInfo, sortIdx);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!found) {
|
|
if (!found) {
|
|
|
lk.log(`当前关键字[${keyName}]没有检索到相关的任务`);
|
|
lk.log(`当前关键字[${keyName}]没有检索到相关的任务`);
|
|
|
}
|
|
}
|
|
|
|
|
+ return found;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function getCompositeTaskListStatus() {
|
|
function getCompositeTaskListStatus() {
|
|
@@ -246,14 +262,32 @@ function checkIsCompositeTaskExec(taskInfo) {
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function getWillCompositeTaskId() {
|
|
|
|
|
- let val = lk.getVal(GandartConstKey.CompositeTaskId);
|
|
|
|
|
- if (lk.isEmpty(val)) {
|
|
|
|
|
- val = 0;
|
|
|
|
|
|
|
+function getWillCompositeTaskIds() {
|
|
|
|
|
+ let valArr = lk.getVal(GandartConstKey.CompositeTaskId);
|
|
|
|
|
+ if (!lk.isEmpty(valArr)) {
|
|
|
|
|
+ valArr = [];
|
|
|
|
|
+ let segments = valArr.split('|');
|
|
|
|
|
+ for (let vstr of segments) {
|
|
|
|
|
+ valArr.push(Number(vstr));
|
|
|
|
|
+ }
|
|
|
} else {
|
|
} else {
|
|
|
- val = Number(val);
|
|
|
|
|
|
|
+ valArr = [];
|
|
|
}
|
|
}
|
|
|
- return val;
|
|
|
|
|
|
|
+ return valArr;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function getWillCompositeTaskSearchKeys() {
|
|
|
|
|
+ let keyArr = lk.getVal(GandartConstKey.CompositeTaskSearchKey)
|
|
|
|
|
+ if (!lk.isEmpty(keyArr)) {
|
|
|
|
|
+ keyArr = [];
|
|
|
|
|
+ let segments = keyArr.split('|');
|
|
|
|
|
+ for (let vstr of segments) {
|
|
|
|
|
+ keyArr.push(vstr);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ keyArr = [];
|
|
|
|
|
+ }
|
|
|
|
|
+ return keyArr;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function isTaskNameSearchMode() {
|
|
function isTaskNameSearchMode() {
|
|
@@ -326,7 +360,7 @@ async function checkGetMaterialDetails(gUsedMaterialDetails, materialDict) {
|
|
|
return gUsedMaterialDetails;
|
|
return gUsedMaterialDetails;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-async function tryToExecCompositeTask(taskId, taskInfo = {}) {
|
|
|
|
|
|
|
+async function tryToExecCompositeTask(taskId, taskInfo = {}, sortIdx = 0) {
|
|
|
if (getCompositeTaskMode() == 1) {
|
|
if (getCompositeTaskMode() == 1) {
|
|
|
lk.log('开始极速模式执行合成任务');
|
|
lk.log('开始极速模式执行合成任务');
|
|
|
let data = getCompositeTaskFinalList();
|
|
let data = getCompositeTaskFinalList();
|
|
@@ -366,7 +400,7 @@ async function tryToExecCompositeTask(taskId, taskInfo = {}) {
|
|
|
// printMaterialGroupsInfo(validCompositeGroups, '预估可行组合数');
|
|
// printMaterialGroupsInfo(validCompositeGroups, '预估可行组合数');
|
|
|
|
|
|
|
|
if (isGenFinalLisstEnable()) {
|
|
if (isGenFinalLisstEnable()) {
|
|
|
- let compositeCountDict = getCompositeCountDict();
|
|
|
|
|
|
|
+ let compositeCountDict = getCompositeCountDict(sortIdx);
|
|
|
let finalGroups = [];
|
|
let finalGroups = [];
|
|
|
for (let k in compositeCountDict) {
|
|
for (let k in compositeCountDict) {
|
|
|
let mGroup = validCompositeGroups[k];
|
|
let mGroup = validCompositeGroups[k];
|
|
@@ -557,14 +591,19 @@ function getCompositeTaskFinalList() {
|
|
|
return data;
|
|
return data;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-function getCompositeCountDict() {
|
|
|
|
|
|
|
+function getCompositeCountDict(sortIdx) {
|
|
|
let str = lk.getVal(GandartConstKey.CompositeCountArray, '0#1');
|
|
let str = lk.getVal(GandartConstKey.CompositeCountArray, '0#1');
|
|
|
- let arr1 = str.split(',');
|
|
|
|
|
|
|
+ let arr0 = str.split('|');
|
|
|
let ret = {};
|
|
let ret = {};
|
|
|
- for (let i = 0; i < arr1.length; i++) {
|
|
|
|
|
- let arr2 = arr1[i].split('#');
|
|
|
|
|
- let key = arr2[0];
|
|
|
|
|
- ret[key] = Number(arr2[1] || 1);
|
|
|
|
|
|
|
+ if (sortIdx < arr0.length) {
|
|
|
|
|
+ let arr1 = arr0[sortIdx].split(',');
|
|
|
|
|
+ for (let i = 0; i < arr1.length; i++) {
|
|
|
|
|
+ let arr2 = arr1[i].split('#');
|
|
|
|
|
+ let key = arr2[0];
|
|
|
|
|
+ ret[key] = Number(arr2[1] || 1);
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ret[0] = 1;
|
|
|
}
|
|
}
|
|
|
return ret;
|
|
return ret;
|
|
|
}
|
|
}
|