11.移转 Aras PLM大小事- 汇出 Mutiple Level BOM

汇出 Mutiple Level BOM

如果要制作出下图表格,可以利用原厂的程序码稍微修改
https://ithelp.ithome.com.tw/upload/images/20210911/20106503EwFpRcUhm5.png

这样就能在料号的报表中使用
https://ithelp.ithome.com.tw/upload/images/20210911/20106503PLPdpFvo41.png

如果选三个料号也能一次显示
https://ithelp.ithome.com.tw/upload/images/20210911/20106503rwvoFYtYio.png


那麽就来解说一下该如何设定
1.先将Part的报表新增完成,并将提供的程序码填写上去
2.将XSLT更新
3.确认栏位并微调
4.完成
参考程序码
https://github.com/panda0909/Aras-PLM-Exercise/tree/master/Report/Multiple%20Level%20BOM%20R1_R2


https://ithelp.ithome.com.tw/upload/images/20210911/20106503NsOrvOTzdR.png

https://ithelp.ithome.com.tw/upload/images/20210911/20106503OkYNdBjwrb.png

https://ithelp.ithome.com.tw/upload/images/20210911/201065039BK6Rgvoec.png

注意
jpc_getMutipleBOMLevel.c有一段逻辑解决一个问题,系统将小位数超过6位时变成科学记号,这里我将科学记号还原回来

private string ConvertNumber(string qStr){
    Decimal de;
    Decimal.TryParse(qStr,System.Globalization.NumberStyles.Any,null,out de);
    return de.ToString();
}

Item part = inn.applyAML(aml);
Item bom = part.getItemsByXPath("//Item[@type='Part BOM']");
for(int i=0;i<bom.getItemCount();i++){
    Item b = bom.getItemByIndex(i);
    string qStr = b.getProperty("quantity","0");
    b.setProperty("quantity",ConvertNumber(qStr));
    qStr = b.getProperty("cn_attrition_rate","0");
    b.setProperty("cn_attrition_rate",ConvertNumber(qStr));
}
bom = part.getItemsByXPath("//Item[@type='BOM Substitute']");
for(int i=0;i<bom.getItemCount();i++){
    Item b = bom.getItemByIndex(i);
    string qStr = b.getProperty("cn_substitute_quantity","0");
    b.setProperty("cn_substitute_quantity",ConvertNumber(qStr));
    qStr = b.getProperty("cn_substitute_shrinkrate","0");
    b.setProperty("cn_substitute_shrinkrate",ConvertNumber(qStr));
}

XSLT 有增加下载按钮,可以参考右上角Export按钮

<script>
            <![CDATA[
                function fnExcelReport()
                {
                    var tab_text="<meta http-equiv='content-type' content='application/vnd.ms-excel; charset=UTF-8'/><table border='2px'download='Part'><tr>";
                    var textRange; var j=0;
                    tab = document.getElementById('headerTable'); // id of table

                    for(j = 0 ; j < tab.rows.length ; j++) 
                    {     
                        tab_text=tab_text+tab.rows[j].innerHTML+"</tr>";
                        //tab_text=tab_text+"</tr>";
                    }

                    tab_text=tab_text+"</table>";
                    tab_text= tab_text.replace(/<A[^>]*>|<\/A>/g, "");//remove if u want links in your table
                    tab_text= tab_text.replace(/<img[^>]*>/gi,""); // remove if u want images in your table
                    tab_text= tab_text.replace(/<input[^>]*>|<\/input>/gi, ""); // reomves input params

                    var ua = window.navigator.userAgent;
                    var msie = ua.indexOf("MSIE "); 

                    if (msie > 0 || !!navigator.userAgent.match(/Trident.*rv\:11\./))      // If Internet Explorer
                    {
                        txtArea1.document.open("txt/html","replace");
                        txtArea1.document.write(tab_text);
                        txtArea1.document.close();
                        txtArea1.focus(); 
                        sa=txtArea1.document.execCommand("SaveAs",true,"Part");
                    }  
                    else                 //other browser not tested on IE 11
                        sa = window.open('data:application/vnd.ms-excel,' + encodeURIComponent(tab_text));  

                    return (sa);
                }
            ]]>
            </script> 

<<:  DAY4.看了两个YT的影片

>>:  DAY11 资料室--Vuex模组作用域略说

[DAY16]跟 Vue.js 认识的30天 - Vue 过渡(转场)及动画效果上篇(`<transition>`)

先看上图来了解 Vue 将动画进入跟离开这 2 种阶段,而在进入跟离开阶段又分别配置了 3 种状态...

NIST SDLC和RMF(续)

根据FIPS 199,“确定信息系统的安全类别需要进行更多的分析,并且必须考虑驻留在信息系统上的所有...

[Day6] 初见输入系统

今日目标 键盘滑鼠输入 GLFW Input Callback 第一篇的时候,有简单的介绍glfw管...

Day17-Node.js

前言 今天是第十七天,很高兴我的意志力让我挺过了一半的铁人赛? 前面十六篇的JS章节,其实已经把Ja...

前端工程学习日记第22天

跟字型相关的CSS设定 font-family 指定使用的字体,可以设定多个,让浏览器依照排序使用 ...