enovia plm export to sap

UPC creation

UPC 结构

PLM 使用的UPC 是 14个数字组成的,兼容。

  1. 前两位为 0,后12位为有效数字,在SAP中0会被忽略,符合国际UPC通用 规则,

 

 

 

  1. 前一位为0,后13 位为有效数字,符合EAN规则

 

 

 

 

UPC 产生规则

 

 

 

 

具体规则一:7位 + 5位 + 1 位     13位

                算法分解:假设前面固定7位 为 0715799

                                中间5位0开始计算,每次产生一个新的UPC,需要加一

                                最后一位的产生规则如下。

* 071579917350 6 -> 0+1+7+9+7+5=29 7+5+9+1+3+0=25*3=75 29+75=104 10-4=6
* 071579917351 3 -> 0+1+7+9+7+5=29 7+5+9+1+3+1=26*3=78 29+78=107 10-7=3
* 071579917352 0 -> 0+1+7+9+7+5=29 7+5+9+1+3+2=27*3=81 29+81=110 10-0=10
* 071579917353 7 -> 0+1+7+9+7+5=29 7+5+9+1+3+3=28*3=84 29+84=113 10-3=7
* 071579917355 1 -> 0+1+7+9+7+5=29 7+5+9+1+3+5=30*3=90 29+90=119 10-9=1
* 071579917356 8 -> 0+1+7+9+7+5=29 7+5+9+1+3+6=31*3=93 29+93=122 10-2=8
* 071579917357 5 -> 0+1+7+9+7+5=29 7+5+9+1+3+7=32*3=96 29+96=125 10-5=5
* 071579917358 2 -> 0+1+7+9+7+5=29 7+5+9+1+3+8=33*3=99 29+99=128 10-8=2
* 071579917359 9 -> 0+1+7+9+7+5=29 7+5+9+1+3+9=34*3=102 29+102=131 10-1=9
* 071579917360 5 -> 0+1+7+9+7+6=30 7+5+9+1+3+0=25*3=75 30+75=105 10-5=5
* 071579917361 2 -> 0+1+7+9+7+6=30 7+5+9+1+3+1=26*3=78 30+78=108 10-8=2
* 071579917362 9 -> 0+1+7+9+7+6=30 7+5+9+1+3+2=27*3=81 30+81=111 10-1=9

    public static String calcolaCRC(String myCode) throws Exception {
        String crc = "";
//      calcolo la somma delle cifre in pos pari e di quelle in pos dispari
        int tot_pari = 0;
        int tot_dispari = 0;
//      i caratteri in posizione pari sono in realta' in pos dispari e viceversa
//      perche' quello che si definisce PRIMO carattere e' in pos ZERO
        for (int i = 0; i < myCode.length(); i++) {
            if (i % 2 == 0) {
//              pos pari
                tot_dispari += Integer.parseInt(myCode.substring(i, i + 1));
            } else {
//              pos dispari
                tot_pari += Integer.parseInt(myCode.substring(i, i + 1));
            }
        }
        int tot = tot_dispari + 3 * tot_pari;
//      del totale mi serve solo l'ultima cifra
        int i_crc = tot / 10;
        i_crc = i_crc * 10;
        i_crc = tot - i_crc;
        crc = String.valueOf(10 - i_crc);
        if (i_crc == 0) {
            crc = "0";
        }

        return crc;
    }

 

具体规则二:7位 + 4位 +1位    12位

07157991735   8

0*2 + 1*2 + (7*2-10+1)+ (9*2 -10 +1) + (7*2 -10 +1)+ (5*2 -10 +1) = 22

22%10 = 2

10-2 = 8

public static String calcolaOPCCRC(String OPC) throws Exception {
    String crc = "";
    int totSum = 0;
    for (int i = 0; i < OPC.length(); i++) {
        String curValue = OPC.substring(i, i + 1);
        Integer intCurValue = new Integer(curValue);
        int parsedInt = intCurValue.intValue();
        if (i % 2 == 0) {
            parsedInt = parsedInt * 2;
            if (parsedInt >= 10) {
                parsedInt = parsedInt - 10 + 1;
            }
        }
        totSum = totSum + parsedInt;
    }
    int toSubtract = totSum % 10;
    if (toSubtract == 0) {
        toSubtract = 10;
    }
    int crcInt = 10 - toSubtract;
    crc = new Integer(crcInt).toString();

    return crc;
}

 

STID creation

与UPC一致

数据导出文件 文件名:MatrixDataExport-LUX_Products-True-91619142007919.xml

总体结构:  

                <MatrixDataExport>

                                <header>

                                                //定义了一些很重要和系统集成有关的参数

                                </header>

                                <object>

                                                //定义具体的导出的数据

                                </object>

</MatrixDataExport>

 

重要标签解释:

Transformation

                <transformation>Z_MD_23_XSLT</transformation>

                定义处理改xml的xslt 程序

 

 

 

sapSerialization

                                    <SapSerialization>

                                               <chrmas>1</chrmas>

                                                <j3agri>1</j3agri>

                                               <j3amat>1</j3amat>

                                 </SapSerialization>

                显示将要产生具体IDOC的数量 (目前来看,只有chrmas 有可能是2,其他都是1)

                                                Chrmas ßàZCHRMAS03

                                                j3agrißàZJ3AGRI02

                                                j3amatßàZ/AFS/MATMAS05

 

listZ08Chars

               

 

 

当前导出的物料,它的sku 属性有哪些。

物料属于不同的classification 的时候,它的characterstic 有所区别,

Z08属性 是说 某个classification 中的sku 属性。

 

 

 

Plm 中 有一个配置文件专门用来配置数据导出的配置项,其中就有此项配置。

 

 

 

object :

                数据结构为不规则的多叉树

                               

 

 

 

 

 

 

数据转换过程

转换过程: (邀请PI协助一下)

                PI 读取XML->根据transformation 定义决定产生哪些Idoc->读取xml里面所有的节点->根据对应的转换文件xslt进行转换->读取转换后文件的所有节点->做适配(mapping,一般不做什么事情)

XSL

XslT语言

                将一个XML 转化成另外一种格式显示的语言

                例子:将一个XML 转换成网页可以显示

index.xml    (utf-8格式编辑)

<?xml version="1.0" encoding="utf-8"?>

<catalog>

  <cd>

    <title>西游记 </title>

    <artist>吴承恩</artist>

  </cd>

  <cd>

    <title>红楼梦 </title>

    <artist>曹雪芹</artist>

  </cd>

</catalog>

 

index.xsl (utf-8格式编辑)

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">

  <html>

  <body>

    <h2>My CD Collection</h2>

    <table border="1">

    <xsl:for-each select="index/cd">

    <tr>

      <td><xsl:value-of select="title"/></td>

      <td><xsl:value-of select="artist"/></td>

    </tr>

    </xsl:for-each>

    </table>

  </body>

  </html>

</xsl:template>

</xsl:stylesheet>

 

合并:

<?xml-stylesheet type="text/xsl" href="index.xsl"?>

 

Chrome 浏览器 安全等级太高,不能引用本地xsl,

需要在 dos 命令里面启动chrome 带上参数  --allow-file-access-from-files

XPath语言

                可以直接访问XML节点的语言

 

 

 

 

 

 

Idoc

               

ZSSD_KSERIAL 

                解释是第几条idoc

 

总 Counter 为3 的情况

IDoc 0000001634665213   counter 为1

IDoc 0000001634665215   counter 为 2

IDoc 0000001634665216(出错) counter 为3

总Counter 为4的情况

IDoc 0000001634644375

IDoc 0000001634644376

IDoc 0000001634644377

IDoc 0000001634644378               

 

ZMM_CLASSIFICATION_HEADER

                里面暂时只看到 D_X , 可能是语言/或者国家

                但是它分为两种,一种BUSINESS 一种TEXT, TEXT 为何,不太清楚

                001  material 

                Z06 size

                Z07 color

                Z08 sku

ZSMMA_PLM_TRANSIT

                料号,物料组类型,工厂,采购类型

E1MARA1

                物料的相关属性

                Size的相关属性

                SKU 的相关属性

E1J3MRA

E1MAKTM

                各种语言版本的描述信息

E1MARMM

(grid value 的详细信息,根节点无特别意义)

                /AFS/E1MARM   Grid value

                E1MEANM      Grid value 对应的UPC/STID

               

               

 

               

               

 

posted @ 2019-11-15 17:15  danieldai  阅读(191)  评论(0编辑  收藏  举报