|
|
@@ -413,9 +413,13 @@ async function doExecFinalComposite(taskId, taskInfo, finalGroups) {
|
|
|
let usedGroups = [];
|
|
|
for (let i = retWillDelLst.length - 1; i >= 0; i--) {
|
|
|
let idx = retWillDelLst[i];
|
|
|
+ lk.log(`[${id}]编号订单删除`);
|
|
|
usedGroups.push(finalGroups[idx]);
|
|
|
finalGroups.splice(idx, 1);
|
|
|
}
|
|
|
+ let tmpJsonStr = JSON.stringify(finalGroups, null, 2);
|
|
|
+ lk.log(`剩余未完成的组合如下:\n${tmpJsonStr}`);
|
|
|
+
|
|
|
setCompositeTaskFinalList(taskInfo, finalGroups);
|
|
|
refreshMaterialAfterComposite(usedGroups);
|
|
|
} else {
|
|
|
@@ -438,6 +442,9 @@ function setCompositeTaskFinalList(taskInfo, finalGroups) {
|
|
|
}
|
|
|
|
|
|
function refreshMaterialAfterComposite(usedGroups) {
|
|
|
+ if (usedGroups.length == 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!gAllMaterialDetails) {
|
|
|
let jsonStr = lk.getVal(GandartConstKey.PrivCollectionDetail);
|
|
|
if (!lk.isEmpty(jsonStr)) {
|
|
|
@@ -447,7 +454,25 @@ function refreshMaterialAfterComposite(usedGroups) {
|
|
|
} catch (error) {
|
|
|
lk.logErr(error);
|
|
|
}
|
|
|
+ for (let group of usedGroups) {
|
|
|
+ deleteMaterial(group.castingId, group.orderList);
|
|
|
+ }
|
|
|
+ jsonStr = JSON.stringify(gAllMaterialDetails, null, 2);
|
|
|
+ lk.setVal(GandartConstKey.PrivCollectionDetail, jsonStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function deleteMaterial(castingId, recordIdLst) {
|
|
|
+ let itemLst = gAllMaterialDetails[castingId];
|
|
|
+ if (itemLst) {
|
|
|
+ let remainLst = [];
|
|
|
+ for (let i = 0; i < itemLst.length; i++) {
|
|
|
+ if (recordIdLst.indexOf(itemLst[i].id) == -1) {
|
|
|
+ remainLst.push(itemLst[i]);
|
|
|
+ }
|
|
|
}
|
|
|
+ gAllMaterialDetails[castingId] = remainLst;
|
|
|
}
|
|
|
}
|
|
|
|