当前位置: 首页 > 工具软件 > black-hole.js > 使用案例 >

ETL-kettle-11.在kettle中使用JavaScript生成MD5

解鸿运
2023-12-01

js文件要与转换文件保存路径一样的!
LoadScriptFile(getVariable(“Internal.Transformation.Filename.Directory”, “”) +"/MD5.js");
var 联合ID = XX+XXID+XXID;

var 联合ID_toMD5 = hex_md5(hex_md5(联合ID));

接下来是MD5.JS

<?xml version="1.0" encoding="UTF-8"?>
<transformation>
  <info>
    <name>70DRILL_OPS_BHA_TOUR_DETAIL</name>
    <description />
    <extended_description />
    <trans_version />
    <trans_type>Normal</trans_type>
    <directory>/</directory>
    <parameters>
    </parameters>
    <log>
      <trans-log-table>
        <connection />
        <schema />
        <table />
        <size_limit_lines />
        <interval />
        <timeout_days />
        <field>
          <id>ID_BATCH</id>
          <enabled>Y</enabled>
          <name>ID_BATCH</name>
        </field>
        <field>
          <id>CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>CHANNEL_ID</name>
        </field>
        <field>
          <id>TRANSNAME</id>
          <enabled>Y</enabled>
          <name>TRANSNAME</name>
        </field>
        <field>
          <id>STATUS</id>
          <enabled>Y</enabled>
          <name>STATUS</name>
        </field>
        <field>
          <id>LINES_READ</id>
          <enabled>Y</enabled>
          <name>LINES_READ</name>
          <subject />
        </field>
        <field>
          <id>LINES_WRITTEN</id>
          <enabled>Y</enabled>
          <name>LINES_WRITTEN</name>
          <subject />
        </field>
        <field>
          <id>LINES_UPDATED</id>
          <enabled>Y</enabled>
          <name>LINES_UPDATED</name>
          <subject />
        </field>
        <field>
          <id>LINES_INPUT</id>
          <enabled>Y</enabled>
          <name>LINES_INPUT</name>
          <subject />
        </field>
        <field>
          <id>LINES_OUTPUT</id>
          <enabled>Y</enabled>
          <name>LINES_OUTPUT</name>
          <subject />
        </field>
        <field>
          <id>LINES_REJECTED</id>
          <enabled>Y</enabled>
          <name>LINES_REJECTED</name>
          <subject />
        </field>
        <field>
          <id>ERRORS</id>
          <enabled>Y</enabled>
          <name>ERRORS</name>
        </field>
        <field>
          <id>STARTDATE</id>
          <enabled>Y</enabled>
          <name>STARTDATE</name>
        </field>
        <field>
          <id>ENDDATE</id>
          <enabled>Y</enabled>
          <name>ENDDATE</name>
        </field>
        <field>
          <id>LOGDATE</id>
          <enabled>Y</enabled>
          <name>LOGDATE</name>
        </field>
        <field>
          <id>DEPDATE</id>
          <enabled>Y</enabled>
          <name>DEPDATE</name>
        </field>
        <field>
          <id>REPLAYDATE</id>
          <enabled>Y</enabled>
          <name>REPLAYDATE</name>
        </field>
        <field>
          <id>LOG_FIELD</id>
          <enabled>Y</enabled>
          <name>LOG_FIELD</name>
        </field>
        <field>
          <id>EXECUTING_SERVER</id>
          <enabled>N</enabled>
          <name>EXECUTING_SERVER</name>
        </field>
        <field>
          <id>EXECUTING_USER</id>
          <enabled>N</enabled>
          <name>EXECUTING_USER</name>
        </field>
        <field>
          <id>CLIENT</id>
          <enabled>N</enabled>
          <name>CLIENT</name>
        </field>
      </trans-log-table>
      <perf-log-table>
        <connection />
        <schema />
        <table />
        <interval />
        <timeout_days />
        <field>
          <id>ID_BATCH</id>
          <enabled>Y</enabled>
          <name>ID_BATCH</name>
        </field>
        <field>
          <id>SEQ_NR</id>
          <enabled>Y</enabled>
          <name>SEQ_NR</name>
        </field>
        <field>
          <id>LOGDATE</id>
          <enabled>Y</enabled>
          <name>LOGDATE</name>
        </field>
        <field>
          <id>TRANSNAME</id>
          <enabled>Y</enabled>
          <name>TRANSNAME</name>
        </field>
        <field>
          <id>STEPNAME</id>
          <enabled>Y</enabled>
          <name>STEPNAME</name>
        </field>
        <field>
          <id>STEP_COPY</id>
          <enabled>Y</enabled>
          <name>STEP_COPY</name>
        </field>
        <field>
          <id>LINES_READ</id>
          <enabled>Y</enabled>
          <name>LINES_READ</name>
        </field>
        <field>
          <id>LINES_WRITTEN</id>
          <enabled>Y</enabled>
          <name>LINES_WRITTEN</name>
        </field>
        <field>
          <id>LINES_UPDATED</id>
          <enabled>Y</enabled>
          <name>LINES_UPDATED</name>
        </field>
        <field>
          <id>LINES_INPUT</id>
          <enabled>Y</enabled>
          <name>LINES_INPUT</name>
        </field>
        <field>
          <id>LINES_OUTPUT</id>
          <enabled>Y</enabled>
          <name>LINES_OUTPUT</name>
        </field>
        <field>
          <id>LINES_REJECTED</id>
          <enabled>Y</enabled>
          <name>LINES_REJECTED</name>
        </field>
        <field>
          <id>ERRORS</id>
          <enabled>Y</enabled>
          <name>ERRORS</name>
        </field>
        <field>
          <id>INPUT_BUFFER_ROWS</id>
          <enabled>Y</enabled>
          <name>INPUT_BUFFER_ROWS</name>
        </field>
        <field>
          <id>OUTPUT_BUFFER_ROWS</id>
          <enabled>Y</enabled>
          <name>OUTPUT_BUFFER_ROWS</name>
        </field>
      </perf-log-table>
      <channel-log-table>
        <connection />
        <schema />
        <table />
        <timeout_days />
        <field>
          <id>ID_BATCH</id>
          <enabled>Y</enabled>
          <name>ID_BATCH</name>
        </field>
        <field>
          <id>CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>CHANNEL_ID</name>
        </field>
        <field>
          <id>LOG_DATE</id>
          <enabled>Y</enabled>
          <name>LOG_DATE</name>
        </field>
        <field>
          <id>LOGGING_OBJECT_TYPE</id>
          <enabled>Y</enabled>
          <name>LOGGING_OBJECT_TYPE</name>
        </field>
        <field>
          <id>OBJECT_NAME</id>
          <enabled>Y</enabled>
          <name>OBJECT_NAME</name>
        </field>
        <field>
          <id>OBJECT_COPY</id>
          <enabled>Y</enabled>
          <name>OBJECT_COPY</name>
        </field>
        <field>
          <id>REPOSITORY_DIRECTORY</id>
          <enabled>Y</enabled>
          <name>REPOSITORY_DIRECTORY</name>
        </field>
        <field>
          <id>FILENAME</id>
          <enabled>Y</enabled>
          <name>FILENAME</name>
        </field>
        <field>
          <id>OBJECT_ID</id>
          <enabled>Y</enabled>
          <name>OBJECT_ID</name>
        </field>
        <field>
          <id>OBJECT_REVISION</id>
          <enabled>Y</enabled>
          <name>OBJECT_REVISION</name>
        </field>
        <field>
          <id>PARENT_CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>PARENT_CHANNEL_ID</name>
        </field>
        <field>
          <id>ROOT_CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>ROOT_CHANNEL_ID</name>
        </field>
      </channel-log-table>
      <step-log-table>
        <connection />
        <schema />
        <table />
        <timeout_days />
        <field>
          <id>ID_BATCH</id>
          <enabled>Y</enabled>
          <name>ID_BATCH</name>
        </field>
        <field>
          <id>CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>CHANNEL_ID</name>
        </field>
        <field>
          <id>LOG_DATE</id>
          <enabled>Y</enabled>
          <name>LOG_DATE</name>
        </field>
        <field>
          <id>TRANSNAME</id>
          <enabled>Y</enabled>
          <name>TRANSNAME</name>
        </field>
        <field>
          <id>STEPNAME</id>
          <enabled>Y</enabled>
          <name>STEPNAME</name>
        </field>
        <field>
          <id>STEP_COPY</id>
          <enabled>Y</enabled>
          <name>STEP_COPY</name>
        </field>
        <field>
          <id>LINES_READ</id>
          <enabled>Y</enabled>
          <name>LINES_READ</name>
        </field>
        <field>
          <id>LINES_WRITTEN</id>
          <enabled>Y</enabled>
          <name>LINES_WRITTEN</name>
        </field>
        <field>
          <id>LINES_UPDATED</id>
          <enabled>Y</enabled>
          <name>LINES_UPDATED</name>
        </field>
        <field>
          <id>LINES_INPUT</id>
          <enabled>Y</enabled>
          <name>LINES_INPUT</name>
        </field>
        <field>
          <id>LINES_OUTPUT</id>
          <enabled>Y</enabled>
          <name>LINES_OUTPUT</name>
        </field>
        <field>
          <id>LINES_REJECTED</id>
          <enabled>Y</enabled>
          <name>LINES_REJECTED</name>
        </field>
        <field>
          <id>ERRORS</id>
          <enabled>Y</enabled>
          <name>ERRORS</name>
        </field>
        <field>
          <id>LOG_FIELD</id>
          <enabled>N</enabled>
          <name>LOG_FIELD</name>
        </field>
      </step-log-table>
      <metrics-log-table>
        <connection />
        <schema />
        <table />
        <timeout_days />
        <field>
          <id>ID_BATCH</id>
          <enabled>Y</enabled>
          <name>ID_BATCH</name>
        </field>
        <field>
          <id>CHANNEL_ID</id>
          <enabled>Y</enabled>
          <name>CHANNEL_ID</name>
        </field>
        <field>
          <id>LOG_DATE</id>
          <enabled>Y</enabled>
          <name>LOG_DATE</name>
        </field>
        <field>
          <id>METRICS_DATE</id>
          <enabled>Y</enabled>
          <name>METRICS_DATE</name>
        </field>
        <field>
          <id>METRICS_CODE</id>
          <enabled>Y</enabled>
          <name>METRICS_CODE</name>
        </field>
        <field>
          <id>METRICS_DESCRIPTION</id>
          <enabled>Y</enabled>
          <name>METRICS_DESCRIPTION</name>
        </field>
        <field>
          <id>METRICS_SUBJECT</id>
          <enabled>Y</enabled>
          <name>METRICS_SUBJECT</name>
        </field>
        <field>
          <id>METRICS_TYPE</id>
          <enabled>Y</enabled>
          <name>METRICS_TYPE</name>
        </field>
        <field>
          <id>METRICS_VALUE</id>
          <enabled>Y</enabled>
          <name>METRICS_VALUE</name>
        </field>
      </metrics-log-table>
    </log>
    <maxdate>
      <connection />
      <table />
      <field />
      <offset>0.0</offset>
      <maxdiff>0.0</maxdiff>
    </maxdate>
    <size_rowset>10000</size_rowset>
    <sleep_time_empty>50</sleep_time_empty>
    <sleep_time_full>50</sleep_time_full>
    <unique_connections>N</unique_connections>
    <feedback_shown>Y</feedback_shown>
    <feedback_size>50000</feedback_size>
    <using_thread_priorities>Y</using_thread_priorities>
    <shared_objects_file />
    <capture_step_performance>N</capture_step_performance>
    <step_performance_capturing_delay>1000</step_performance_capturing_delay>
    <step_performance_capturing_size_limit>100</step_performance_capturing_size_limit>
    <dependencies>
    </dependencies>
    <partitionschemas>
    </partitionschemas>
    <slaveservers>
    </slaveservers>
    <clusterschemas>
    </clusterschemas>
    <created_user>-</created_user>
    <created_date>2019/11/14 15:31:55.654</created_date>
    <modified_user>-</modified_user>
    <modified_date>2019/11/14 15:31:55.654</modified_date>
    <key_for_session_key>H4sIAAAAAAAAAAMAAAAAAAAAAAA=</key_for_session_key>
    <is_key_private>N</is_key_private>
  </info>
  <notepads>
  </notepads>
  <connection>
    <name>notebook-GWDC_KD</name>
    <server>172.16.7.14</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>ORCL</database>
    <port>1521</port>
    <username>c##gwdc_KD</username>
    <password>Encrypted 2be98afc86aa7f2e48c0eaa738cc2fe83</password>
    <servername />
    <data_tablespace />
    <index_tablespace />
    <attributes>
      <attribute>
        <code>FORCE_IDENTIFIERS_TO_LOWERCASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>FORCE_IDENTIFIERS_TO_UPPERCASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>IS_CLUSTERED</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>PORT_NUMBER</code>
        <attribute>1521</attribute>
      </attribute>
      <attribute>
        <code>PRESERVE_RESERVED_WORD_CASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>QUOTE_ALL_FIELDS</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>SUPPORTS_BOOLEAN_DATA_TYPE</code>
        <attribute>Y</attribute>
      </attribute>
      <attribute>
        <code>SUPPORTS_TIMESTAMP_DATA_TYPE</code>
        <attribute>Y</attribute>
      </attribute>
      <attribute>
        <code>USE_POOLING</code>
        <attribute>N</attribute>
      </attribute>
    </attributes>
  </connection>
  <connection>
    <name>notebook-GWDCGCY</name>
    <server>172.16.7.14</server>
    <type>ORACLE</type>
    <access>Native</access>
    <database>ORCL</database>
    <port>1521</port>
    <username>c##gwdcgcy</username>
    <password>Encrypted 2be98afc86aa7f2e48c0eaa738cc2fe83</password>
    <servername />
    <data_tablespace />
    <index_tablespace />
    <attributes>
      <attribute>
        <code>FORCE_IDENTIFIERS_TO_LOWERCASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>FORCE_IDENTIFIERS_TO_UPPERCASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>IS_CLUSTERED</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>PORT_NUMBER</code>
        <attribute>1521</attribute>
      </attribute>
      <attribute>
        <code>PRESERVE_RESERVED_WORD_CASE</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>QUOTE_ALL_FIELDS</code>
        <attribute>N</attribute>
      </attribute>
      <attribute>
        <code>SUPPORTS_BOOLEAN_DATA_TYPE</code>
        <attribute>Y</attribute>
      </attribute>
      <attribute>
        <code>SUPPORTS_TIMESTAMP_DATA_TYPE</code>
        <attribute>Y</attribute>
      </attribute>
      <attribute>
        <code>USE_POOLING</code>
        <attribute>N</attribute>
      </attribute>
    </attributes>
  </connection>
  <order>
    <hop>
      <from>JavaScript代码 3 2</from>
      <to>插入 / 更新</to>
      <enabled>N</enabled>
    </hop>
    <hop>
      <from>从结果获取记录 2</from>
      <to>排序记录 9 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>排序记录 8 2</from>
      <to>记录集连接 5 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>排序记录 9 2</from>
      <to>记录集连接 5 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>记录集连接 5 2</from>
      <to>JavaScript代码 3 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>JavaScript代码 3 2</from>
      <to>计算器</to>
      <enabled>N</enabled>
    </hop>
    <hop>
      <from>表输入</from>
      <to>排序记录 8 2</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>计算器</from>
      <to>Excel输出</to>
      <enabled>N</enabled>
    </hop>
    <hop>
      <from>JavaScript代码 3 2</from>
      <to>JavaScript代码</to>
      <enabled>Y</enabled>
    </hop>
    <hop>
      <from>JavaScript代码</from>
      <to>Excel输出</to>
      <enabled>Y</enabled>
    </hop>
  </order>
  <step>
    <name>Excel输出</name>
    <type>ExcelOutput</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <header>Y</header>
    <footer>N</footer>
    <encoding />
    <append>N</append>
    <add_to_result_filenames>Y</add_to_result_filenames>
    <file>
      <name>C:\Users\SHAND\Desktop\1.xls</name>
      <extention>xls</extention>
      <do_not_open_newfile_init>N</do_not_open_newfile_init>
      <create_parent_folder>N</create_parent_folder>
      <split>N</split>
      <add_date>N</add_date>
      <add_time>N</add_time>
      <SpecifyFormat>N</SpecifyFormat>
      <date_time_format />
      <sheetname>Sheet1</sheetname>
      <autosizecolums>N</autosizecolums>
      <nullisblank>N</nullisblank>
      <protect_sheet>N</protect_sheet>
      <password>Encrypted </password>
      <splitevery>0</splitevery>
      <usetempfiles>N</usetempfiles>
      <tempdirectory />
    </file>
    <template>
      <enabled>N</enabled>
      <append>N</append>
      <filename>template.xls</filename>
    </template>
    <fields>
    </fields>
    <custom>
      <header_font_name>arial</header_font_name>
      <header_font_size>10</header_font_size>
      <header_font_bold>N</header_font_bold>
      <header_font_italic>N</header_font_italic>
      <header_font_underline>no</header_font_underline>
      <header_font_orientation>horizontal</header_font_orientation>
      <header_font_color>black</header_font_color>
      <header_background_color>none</header_background_color>
      <header_row_height>255</header_row_height>
      <header_alignment>left</header_alignment>
      <header_image />
      <row_font_name>arial</row_font_name>
      <row_font_size>10</row_font_size>
      <row_font_color>black</row_font_color>
      <row_background_color>none</row_background_color>
    </custom>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>656</xloc>
      <yloc>160</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>JavaScript代码</name>
    <type>ScriptValueMod</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <compatible>N</compatible>
    <optimizationLevel>9</optimizationLevel>
    <jsScripts>
      <jsScript>
        <jsScript_type>0</jsScript_type>
        <jsScript_name>Script 1</jsScript_name>
        <jsScript_script>LoadScriptFile(getVariable("Internal.Transformation.Filename.Directory", "") +"/MD5.js");
var lhID = 日报ID+钻具组合ID+分段钻具明细ID;

var lhID_toMD5 = hex_md5(hex_md5(lhID));</jsScript_script>
      </jsScript>
    </jsScripts>
    <fields>
      <field>
        <name>lhID_toMD5</name>
        <rename>lhID_toMD5</rename>
        <type>String</type>
        <length>-1</length>
        <precision>-1</precision>
        <replace>N</replace>
      </field>
    </fields>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>512</xloc>
      <yloc>336</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>JavaScript代码 3 2</name>
    <type>ScriptValueMod</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <compatible>N</compatible>
    <optimizationLevel>9</optimizationLevel>
    <jsScripts>
      <jsScript>
        <jsScript_type>0</jsScript_type>
        <jsScript_name>Script 1</jsScript_name>
        <jsScript_script>//Script here

if(BSFLAG==0){
var 字段状态 = 1
}else if(BSFLAG==1){
	var 字段状态 = 0
		}
</jsScript_script>
      </jsScript>
    </jsScripts>
    <fields>
      <field>
        <name>字段状态</name>
        <rename>字段状态</rename>
        <type>String</type>
        <length>1</length>
        <precision>-1</precision>
        <replace>N</replace>
      </field>
    </fields>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>384</xloc>
      <yloc>224</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>从结果获取记录 2</name>
    <type>RowsFromResult</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <fields>      </fields>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>112</xloc>
      <yloc>448</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>排序记录 8 2</name>
    <type>SortRows</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <directory>%%java.io.tmpdir%%</directory>
    <prefix>out</prefix>
    <sort_size>1000000</sort_size>
    <free_memory />
    <compress>N</compress>
    <compress_variable />
    <unique_rows>N</unique_rows>
    <fields>
      <field>
        <name>WELL_ID</name>
        <ascending>Y</ascending>
        <case_sensitive>N</case_sensitive>
        <collator_enabled>N</collator_enabled>
        <collator_strength>0</collator_strength>
        <presorted>N</presorted>
      </field>
      <field>
        <name>WELLBORE_ID</name>
        <ascending>Y</ascending>
        <case_sensitive>N</case_sensitive>
        <collator_enabled>N</collator_enabled>
        <collator_strength>0</collator_strength>
        <presorted>N</presorted>
      </field>
    </fields>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>192</xloc>
      <yloc>208</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>排序记录 9 2</name>
    <type>SortRows</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <directory>%%java.io.tmpdir%%</directory>
    <prefix>out</prefix>
    <sort_size>1000000</sort_size>
    <free_memory />
    <compress>N</compress>
    <compress_variable />
    <unique_rows>N</unique_rows>
    <fields>
      <field>
        <name>工程院井ID</name>
        <ascending>Y</ascending>
        <case_sensitive>N</case_sensitive>
        <collator_enabled>N</collator_enabled>
        <collator_strength>0</collator_strength>
        <presorted>N</presorted>
      </field>
      <field>
        <name>工程院井筒ID</name>
        <ascending>Y</ascending>
        <case_sensitive>N</case_sensitive>
        <collator_enabled>N</collator_enabled>
        <collator_strength>0</collator_strength>
        <presorted>N</presorted>
      </field>
    </fields>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>208</xloc>
      <yloc>432</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>插入 / 更新</name>
    <type>InsertUpdate</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <connection>notebook-GWDC_KD</connection>
    <commit>100</commit>
    <update_bypassed>N</update_bypassed>
    <lookup>
      <schema>C##GWDC_KD</schema>
      <table>lookup table</table>
      <value>
        <name>ROW_STATE</name>
        <rename>字段状态</rename>
        <update>Y</update>
      </value>
    </lookup>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>736</xloc>
      <yloc>288</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>表输入</name>
    <type>TableInput</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <connection>notebook-GWDCGCY</connection>
    <sql>select 
	zjzh.WELL_ID as TASK_ID,
	zjzh.WELL_ID as WELL_ID,
	zjzh.WELL_ID as JOB_ID,
	zjzh.TOUR_BHA_ID as TOUR_BHA_ID,
	zjzh.WELLBORE_ID,
  dt.MAKEUP_STRING_NO as TOOL_ORDER_NUMBER, --单项钻具序号
	dt.LENGTH as BHA_LENGTH,  --单项钻具长度
	dt.DRILL_STRING_ASSEMBLY_ORDER as BHA_NO, --钻具编号
	dt.STRUCT_NAME as BHA_NAME,  --单项钻具名称
	dt.MODEL as BHA_SPEC, --单项钻具规格	
	dt.MODEL as BHA_MODEL, --钻具类型
	dt.FACTORY as BHA_PRODUCER, --厂家
	dt.INSIDE_DIAMETER_DRILLTOOL as BHA_INNER_DIAMETER, --单项钻具内径
	dt.EXTERNAL_DIAMETER_DRILLTOOL as BHA_OUTER_DIAMETER, --单项钻具外径
	dt.LENGTH_ACCUM as MAKEUP_STRING_ADDUP_LENGTH, --累计长度
	dt.UNIT_WEIGHT_SUM as MAKEUP_STRING_ADDUP_WEIGHT, --钻具组合累计重量
	dt.bsflag,
	
	'' as TOUR_BHA_DETAIL_ID,-- 川庆主键,应由 日报ID+钻具组合ID+分段钻具明细Id 计算得到。
	zjzh.TOUR_BHA_ID as "日报ID",
	zjzh.zjzh_id  as "钻具组合ID",
	dt.STRING_RECORD_ID as "分段钻具明细ID"


from (

 select
		--to_char(dd.RECORD_DATE,'yyyy-mm-dd') as CURRENTS_DATE,
		dd.RECORD_DATE as CURRENTS_DATE,
		dd.daysrep_id as TOUR_BHA_ID,
		dd.BSFLAG,
		dd.RECORD_DATE as BHA_DATE,
		t1.RECORD_ID as zjzh_id,
		t1.HOLE_ID as WELLBORE_ID,
		t1.WELL_ID as WELL_ID
 from fact_dy_days dd
 LEFT JOIN FACT_BOING_MAKEUP_STRING t1 on dd.WELL_ID=t1.WELL_ID 
                                      and t1.BSFLAG=0
																		  and dd.RECORD_DATE>= t1.RECORD_DATE_IN
																			and dd.RECORD_DATE&lt;=t1.RECORD_DATE_OUT
 LEFT JOIN sys_enum_all enum on t1.MAKEUP_STRING_TYPE=enum.node_id

 
 where t1.record_id is not null
       --and dd.well_id='92ff71292b274239912ac347ce898b88' 
       --and dd.BSFLAG=0
			 
 ORDER BY dd.well_id,dd.RECORD_DATE,TO_NUMBER(t1.MAKEUP_STRING_NO)
 )zjzh
 
 LEFT JOIN DRILL_BOING_MAKEUP_STRING dt on dt.well_id=zjzh.well_id and dt.COMMON_BOING_ID=zjzh.zjzh_id 
 where dt.STRING_RECORD_ID is not null 
    --   and zjzh.well_id='2001438bc5884b5fb883c4c1ad25fc72' 
 
 </sql>
    <limit>0</limit>
    <lookup />
    <execute_each_row>N</execute_each_row>
    <variables_active>N</variables_active>
    <lazy_conversion_active>N</lazy_conversion_active>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>112</xloc>
      <yloc>112</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>计算器</name>
    <type>Calculator</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <calculation>
      <field_name>ID</field_name>
      <calc_type>MD5</calc_type>
      <field_a>日报ID</field_a>
      <field_b>分段钻具明细ID</field_b>
      <field_c>钻具组合ID</field_c>
      <value_type>String</value_type>
      <value_length>-1</value_length>
      <value_precision>-1</value_precision>
      <remove>N</remove>
      <conversion_mask />
      <decimal_symbol />
      <grouping_symbol />
      <currency_symbol />
    </calculation>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>512</xloc>
      <yloc>144</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step>
    <name>记录集连接 5 2</name>
    <type>MergeJoin</type>
    <description />
    <distribute>Y</distribute>
    <custom_distribution />
    <copies>1</copies>
    <partitioning>
      <method>none</method>
      <schema_name />
    </partitioning>
    <join_type>INNER</join_type>
    <step1>排序记录 8 2</step1>
    <step2>排序记录 9 2</step2>
    <keys_1>
      <key>WELL_ID</key>
      <key>WELLBORE_ID</key>
    </keys_1>
    <keys_2>
      <key>工程院井ID</key>
      <key>工程院井筒ID</key>
    </keys_2>
    <cluster_schema />
    <remotesteps>
      <input>
      </input>
      <output>
      </output>
    </remotesteps>
    <GUI>
      <xloc>384</xloc>
      <yloc>384</yloc>
      <draw>Y</draw>
    </GUI>
  </step>
  <step_error_handling>
  </step_error_handling>
  <slave-step-copy-partition-distribution>
  </slave-step-copy-partition-distribution>
  <slave_transformation>N</slave_transformation>
</transformation>

 类似资料: