fix(est): retain legacy quantity links in Excel
This commit is contained in:
@@ -225,10 +225,10 @@ def test_excel_quantity_document_roundtrip_keeps_optional_original_fields():
|
||||
"""(()=>{
|
||||
const p=EstNative.empty();p.quantitySheets=[{Code:'Q',Name:'sheet',options:{digits:2,roundMode:2},
|
||||
rows:[{LineData:'1 = \\x120\\x12',markers:['r1']}],
|
||||
items:[{Code:'r1',Name:'item',Size:null,Unite:null,GN:null,LinkCode:null,Extra:'keep'}]}];
|
||||
items:[{Code:'r1',Name:'item',Size:null,Unite:null,GN:null,LinkCode:'X',Extra:'keep'}]}];
|
||||
const tables={QDocuments:[{Code:'Q',Name:'sheet',digits:2,roundMode:2}],
|
||||
QLines:[{DocumentCode:'Q',Position:1,LineData:'1 = \\x120\\x12',Markers:'["r1"]'}],
|
||||
QItems:[{DocumentCode:'Q',Position:1,Code:'r1',Name:'item',Size:null,Unite:null,GN:null,TargetCode:null,TargetKey:null}]};
|
||||
QItems:[{DocumentCode:'Q',Position:1,Code:'r1',Name:'item',Size:null,Unite:null,GN:null,TargetCode:'X',TargetKey:null}]};
|
||||
return {before:p.quantitySheets,after:EstExchange.apply(p,tables).quantitySheets};
|
||||
})()""",
|
||||
)
|
||||
|
||||
@@ -193,8 +193,14 @@ const EstExchange = (() => {
|
||||
throw Error("수량 항목 수치 오류");
|
||||
next.GN = row.GN;
|
||||
} else if (!previous || previous.GN != null) next.GN = 0;
|
||||
if (row.TargetCode != null) next.TargetCode = row.TargetCode;
|
||||
else if (previous && (previous.TargetCode ?? previous.LinkCode)) next.TargetCode = "";
|
||||
if (row.TargetCode != null) {
|
||||
if (
|
||||
!previous ||
|
||||
Object.hasOwn(previous, "TargetCode") ||
|
||||
row.TargetCode !== previous.LinkCode
|
||||
)
|
||||
next.TargetCode = row.TargetCode;
|
||||
} else if (previous && (previous.TargetCode ?? previous.LinkCode)) next.TargetCode = "";
|
||||
if (row.TargetKey != null) next.TargetKey = row.TargetKey;
|
||||
else if (previous?.TargetKey) next.TargetKey = "";
|
||||
return next;
|
||||
|
||||
Reference in New Issue
Block a user