Case 2:HTKS, ZzTop

MES @ HTKS, China

Description

Let's Go

Define - tmd_plans.xml

以 WIP 以及客製化表格為基礎,分析以工單 (SHOP_ORDER) 為核心的交易數據關聯。

SHOP_ORDER (工單)
┖──ACTIVITY_LOG (SHOP_ODER_BO=HANDLE)
┖──SHOP_ORDER_SFC (SHOP_ODER_BO=HANDLE)
┖──SFC (SHOP_ODER_BO=HANDLE)
   ┖──SFC_BOM (SFC_BO=HANDLE)
   ┖──SFC_ROUTING (SFC_BO=HANDLE)
      ┖──SFC_ROUTER (SFC_ROUTING_BO=HANDLE)
         ┖──SFC_STEP (SFC_ROUTER_BO=HANDLE)
   ┖──HOLD_DETAIL (HOLD_CONTEXT_G_BO=HANDLE)
      ┖──ZR_HOLD_SFC (HOLD_DETAIL_BO=HANDLE)
   ┖──ZD_SFC (SFC_BO=HANDLE)
   ┖──ZR_BINMAP_COMBINE (SFC_BO=HANDLE)
   ┖──ZR_DC_RESULT (SFC_BO=HANDLE)
      ┖──ZR_DC_RESULT_DETAIL (DC_RESULT_BO=ID)
      ┖──ZR_DC_RESULT_RAW (DC_RESULT_BO=ID)
      ┖──ZR_DC_RESULT_STAT (DC_RESULT_BO=ID)
   ┖──ZR_DISPATCH_SFC (SFC_BO=HANDLE)
   ┖──ZR_RUN_DEFECT (SFC_BO=HANDLE)
   ┖──ZR_RUN_JUMP (RUN_SFC_BO=HANDLE)
   ┖──ZR_RUN_MT_SFC (SFC_BO=HANDLE)
   ┖──ZR_RUN_SFC (SFC_BO=HANDLE)
   ┖──ZR_RUN_SPLIT_MERGE (BEF_SOURCE_SFC_BO=HANDLE)
   ┖──ZR_SAMPLING_RESULT (SFC_BO=HANDLE)
   ┖──ZR_BINMAP_COMBINE (SFC_BO=HANDLE)
   ┖──ZR_SFC_LOG (SFC_BO=HANDLE)
   ┖──ZR_SPC_ALARM (SFC_BO=HANDLE)
   ┖──ZR_SPC_ALARM_MAIL (SFC=HANDLE)
┖──ZD_CUSTOMER_ITEM (SHOP_ORDER_BO=HANDLE)
   ┖──ZD_SFC_ITEM (CUSTOMER_ITEM_BO=ID)
   ┖──ZD_SFC_ITEM_GRADE (CUSTOMER_ITEM_BO=ID)
   ┖──ZR_CUSTOMER_ITEM_DEFECT (CUSTOMER_ITEM_BO=ID)
   ┖──ZR_CUSTOMER_ITEM_GRADE (CUSTOMER_ITEM_BO=ID)
   ┖──ZR_SAMPLING_RESULT_DETAIL (CUSTOMER_ITEM_BO=ID)
   ┖──ZR_RUN_SFC_ITEM (CUSTOMER_ITEM_BO=ID)
   ┖──ZR_RUN_SPLIT_MERGE_ITEM (CUSTOMER_ITEM_BO=ID)
┖──ZR_SHOP_ORDER_ITEMSET_LOG (SHOP_ORDER_BO=ID)

ZR_PKG_CONTAINER (包裝)
┖──ZR_PKG_CONTAINER_LOG (ID=ID)
┖──ZR_PKG_CONTAINER_LABEL (CONTAINER_BO=ID)
┖──ZR_PKG_CONTAINER_SFC (CONTAINER_BO=ID)

將上述分系結果制定任務 (task) 與子任務 (next, plan, task)。

Sample 1: SHOP_ORDER 及關聯任務群

<task name="SHOP_ORDER">
	<sourceSelect table="SHOP_ORDER" />
	<targetUpdate />
	<next>
		<plan taskName="ACTIVITY_LOG" where="SHOP_ORDER_BO=?">
			<param sourceColumn="HANDLE" />
		</plan>
		<plan taskName="SHOP_ORDER_SFC" where="SHOP_ORDER_BO=?">
			<param sourceColumn="HANDLE" />
		</plan>
		<plan taskName="SFC" where="SHOP_ORDER_BO=?">
			<param sourceColumn="HANDLE" />
		</plan>
		<plan taskName="ZD_CUSTOMER_ITEM" where="SHOP_ORDER_BO=?">
			<param sourceColumn="HANDLE" />
		</plan>
		<plan taskName="ZR_SHOP_ORDER_ITEMSET_LOG" where="SHOP_ORDER_BO=?">
			<param sourceColumn="HANDLE" />
		</plan>
	</next>
</task>

Sample 2: SFC_BOM 無子任務群

<task name="SFC_BOM">
	<sourceSelect table="SFC_BOM" />
	<targetUpdate />
</task>

補充主鍵。

<tableSpace>
	<table name="ACTIVITY_LOG">
		<pk>
			<column>SHOP_ORDER_BO</column>
			<column>PARTITION_DATE</column>
		</pk>
	</table>
	<table name="HOLD_DETAIL">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SFC">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SFC_BOM">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SFC_ROUTER">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SFC_ROUTING">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SFC_STEP">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SHOP_ORDER">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
	<table name="SHOP_ORDER_SFC">
		<pk>
			<column>HANDLE</column>
		</pk>
	</table>
</tableSpace>

建立 SHOP_ORDER 與 ZR_PKG_CONTAINER 工作 (job),並添加工作項 (item)。

<jobSpace>
	<job name="SHOP_ORDER" 
	     source="HANA_PROD" 
	     target="HANA_ARCHIVE_TEST" 
	     itemRunner="ui.tmd.zztop.TxKeyItemRunner">
		<item taskName="SHOP_ORDER" 
		      where="SITE='1020' and ACTUAL_COMP_DATE is not null and now()>add_days(ACTUAL_COMP_DATE, 140)" />
	</job>
	<job name="PKG_CONTAINER" 
	     source="HANA_PROD" 
	     target="HANA_ARCHIVE_TEST" 
	     itemRunner="ui.tmd.zztop.TxKeyItemRunner">
		<item taskName="ZR_PKG_CONTAINER" 
		      where="STATE_NAME in ('IN_STOCK') and now()>add_days(PACKING_TIME, 100)" />
	</job>
</jobSpace>

配置來源資料庫與目標資料庫的資訊。

<databaseSpace>
	<database>
		<id>HANA_DEV</id>
		<host>10.160.1.52</host>
		<port>39015</port>
		<dbName>WIP</dbName>
		<user>WIP</user>
		<password>Hdb12345</password>
		<driverClass>uia.tmd.access.HanaAccess</driverClass>
	</database>
	<database>
		<id>HANA_TEST</id>
		<host>10.160.2.23</host>
		<port>31015</port>
		<dbName>WIP</dbName>
		<user>WIP</user>
		<password>Sap12345</password>
		<driverClass>uia.tmd.access.HanaAccess</driverClass>
	</database>
	<database>
		<id>HANA_PROD</id>
		<host>10.160.2.20</host>
		<port>30015</port>
		<dbName>WIP</dbName>
		<user>WIP</user>
		<password>Sap12345</password>
		<driverClass>uia.tmd.access.HanaAccess</driverClass>
	</database>
	<database>
		<id>HANA_ARCHIVE_TEST</id>
		<host>10.160.2.23</host>
		<port>31015</port>
		<dbName>WIP_ARCHIVE</dbName>
		<user>WIP_ARCHIVE</user>
		<password>Sap54321</password>
		<driverClass>uia.tmd.access.HanaAccess</driverClass>
	</database>
	<database>
		<id>HANA_ARCHIVE_PROD</id>
		<host>10.160.2.23</host>
		<port>32015</port>
		<dbName>WIP_ARCHIVE</dbName>
		<user>WIP_ARCHIVE</user>
		<password>Sap54321</password>
		<driverClass>uia.tmd.access.HanaAccess</driverClass>
	</database>
</databaseSpace>

完整配置檔案:

Input - zzt_qtz_clock

Execute - service

Last updated