Commit 9ab9c7419d493d5ff80bece90bf1807c0ca403be
1 parent
9866d8b9
1.处理工艺卡复制到工艺,成品工序下面,拿到对应的成品材料
Showing
1 changed file
with
46 additions
and
35 deletions
src/components/Manufacture/ProcessCardPackTableTreeNew/index.js
| ... | ... | @@ -566,41 +566,6 @@ const ProcessCardPackTableTreeNewEvent = props => { |
| 566 | 566 | }); |
| 567 | 567 | } |
| 568 | 568 | |
| 569 | - if (commonUtils.isNotEmptyArr(copyTo.materialsData)) { | |
| 570 | - copyTo.materialsData.filter(item => item.sType === "2").forEach(materialsItem => { | |
| 571 | - newCopyTo.materials = materialsItem; | |
| 572 | - let materialsRow = commonFunc.getDefaultData(config.materialsConfig, newCopyTo); // 取默认值 | |
| 573 | - materialsRow = { | |
| 574 | - ...materialsRow, | |
| 575 | - ...commonFunc.getAssignFieldValue(materialsAssignField, materialsItem, newCopyTo), | |
| 576 | - }; // 取赋值字段 | |
| 577 | - materialsRow.handleType = "add"; | |
| 578 | - materialsRow.sId = commonUtils.createSid(); | |
| 579 | - materialsRow.sParentId = masterData.sId; | |
| 580 | - materialsRow.sType = materialsItem.sType; | |
| 581 | - /* 根据从表源sOriginalId找到新sId */ | |
| 582 | - let sNewIds = ""; | |
| 583 | - let sNewNames = ""; | |
| 584 | - const sOldIds = materialsItem.sCombinePartsName; | |
| 585 | - if (commonUtils.isNotEmptyObject(sOldIds)) { | |
| 586 | - const sOldArr = sOldIds.split(","); | |
| 587 | - for (const sId of sOldArr) { | |
| 588 | - const index = slaveData.findIndex(item => item.sOriginalId === sId); | |
| 589 | - if (index > -1) { | |
| 590 | - const tableDataRow = slaveData[index]; | |
| 591 | - sNewIds += `${tableDataRow.sId},`; | |
| 592 | - sNewNames += `${tableDataRow.sProductName},`; | |
| 593 | - } | |
| 594 | - } | |
| 595 | - sNewIds = commonUtils.isNotEmptyObject(sNewIds) ? sNewIds.slice(0, -1) : ""; | |
| 596 | - sNewNames = commonUtils.isNotEmptyObject(sNewNames) ? sNewNames.slice(0, -1) : ""; | |
| 597 | - } | |
| 598 | - materialsRow.sCombinePartsName = sNewIds; | |
| 599 | - materialsRow.sCombinePartsNameNew = sNewNames; | |
| 600 | - materialsData.push(materialsRow); | |
| 601 | - }); | |
| 602 | - } | |
| 603 | - | |
| 604 | 569 | if (commonUtils.isNotEmptyArr(copyTo.processData)) { |
| 605 | 570 | copyTo.processData.filter(item => item.sType === "3").forEach(processItem => { |
| 606 | 571 | newCopyTo.process = processItem; |
| ... | ... | @@ -671,6 +636,52 @@ const ProcessCardPackTableTreeNewEvent = props => { |
| 671 | 636 | }); |
| 672 | 637 | } |
| 673 | 638 | |
| 639 | + if (commonUtils.isNotEmptyArr(copyTo.materialsData)) { | |
| 640 | + copyTo.materialsData.filter(item => item.sType === "2").forEach(materialsItem => { | |
| 641 | + newCopyTo.materials = materialsItem; | |
| 642 | + let materialsRow = commonFunc.getDefaultData(config.materialsConfig, newCopyTo); // 取默认值 | |
| 643 | + materialsRow = { | |
| 644 | + ...materialsRow, | |
| 645 | + ...commonFunc.getAssignFieldValue(materialsAssignField, materialsItem, newCopyTo), | |
| 646 | + }; // 取赋值字段 | |
| 647 | + materialsRow.handleType = "add"; | |
| 648 | + materialsRow.sId = commonUtils.createSid(); | |
| 649 | + materialsRow.sParentId = masterData.sId; | |
| 650 | + materialsRow.sType = materialsItem.sType; | |
| 651 | + /* 根据从表源sOriginalId找到新sId */ | |
| 652 | + let sNewIds = ""; | |
| 653 | + let sNewNames = ""; | |
| 654 | + const sOldIds = materialsItem.sCombinePartsName; | |
| 655 | + if (commonUtils.isNotEmptyObject(sOldIds)) { | |
| 656 | + const sOldArr = sOldIds.split(","); | |
| 657 | + for (const sId of sOldArr) { | |
| 658 | + const index = slaveData.findIndex(item => item.sOriginalId === sId); | |
| 659 | + if (index > -1) { | |
| 660 | + const tableDataRow = slaveData[index]; | |
| 661 | + sNewIds += `${tableDataRow.sId},`; | |
| 662 | + sNewNames += `${tableDataRow.sProductName},`; | |
| 663 | + } | |
| 664 | + } | |
| 665 | + sNewIds = commonUtils.isNotEmptyObject(sNewIds) ? sNewIds.slice(0, -1) : ""; | |
| 666 | + sNewNames = commonUtils.isNotEmptyObject(sNewNames) ? sNewNames.slice(0, -1) : ""; | |
| 667 | + } | |
| 668 | + materialsRow.sCombinePartsName = sNewIds; | |
| 669 | + materialsRow.sCombinePartsNameNew = sNewNames; | |
| 670 | + | |
| 671 | + if (commonUtils.isNotEmptyArr(processData)) { | |
| 672 | + const iProcessIndex = processData.findIndex( | |
| 673 | + item => item.sSrcProcessTbId === materialsItem.sProcessTbId | |
| 674 | + ); | |
| 675 | + if (iProcessIndex > -1) { | |
| 676 | + materialsRow.sProcessTbId = processData[iProcessIndex].sId; | |
| 677 | + } | |
| 678 | + } | |
| 679 | + materialsData.push(materialsRow); | |
| 680 | + }); | |
| 681 | + } | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 674 | 685 | if (commonUtils.isNotEmptyArr(copyTo.colorData)) { |
| 675 | 686 | if (commonUtils.isNotEmptyObject(config.colorConfig)) { |
| 676 | 687 | copyTo.colorData.forEach(colorItem => { | ... | ... |