Select to view content in your preferred language

TrackTraceDeploymentTools.zip

5531
8
12-06-2016 04:41 PM
Labels (1)

TrackTraceDeploymentTools.zip

Tracking and Traceability Deployment pattern zip file.  Contains Barcode decode GP Tool and MXD's to help with publishing the overall solution.

Labels (1)
Attachments
Comments
BrianBaldwin
Esri Regular Contributor

One issue that was noted by a user was that after publishing the StagingGDB, they were unable to collect features using Collector for ArcGIS.  The issue stems from the fact that the feature classes have z-values and when publishing directly from ArcMap to ArcGIS Online, the feature service sets "'enableZDefaults' : false,".  Without the ability to collect z-values or set a default, Collector is not able to add new features.  A workaround for this, is to create a Service Definition from ArcMap (Share As, Publish, Save a service definition file) and then uploads this to ArcGIS Online.  This will set the "'enableZDefaults': true". 

If publishing to ArcGIS Server, users can change the z-defaults parameter during the publishing stage.

Or, you can simply publish from ArcGIS Pro and the value will be set to 'true' as well.

JordanMiller4
Frequent Contributor

Hello Tom, do you have an email i can contact you?

TomDeWitte
Esri Regular Contributor

Hi Jordan,

You can reach me via my esri email account:  tdewitte@esri.com

Tom

BrianKratcha
Regular Contributor

I was able to configure the script with my data, but I am having one problem.  The barcode decoder only works if every feature has a barcode value entered.  If one feature has a null value the tool will skip all other features that have barcodes and not decode any of them.  Is there a way to get around this problem?  

Thanks,

Brian

BrianBaldwin
Esri Regular Contributor

Matthew Baber‌ & Tom DeWitte‌ I understand that there is a newer version of the script? Would one of you guys mind helping out Brian?

TomDeWitte
Esri Regular Contributor

Hi Brian,

Within the python script is a function called: AppendSelectedRecords.  this function is where each featureclass of selected features is processed. The first part of this function runs a cursor to test individually each record in the featureclasses selected set.  For each row it tests whether the BARCODE value is NULL.  If it is NULL is skips the row and moves onto the next row in the selection set.  If the BARCODE value is populated, it attempts to decode it.

There is messaging built into the function to indicate for each ROW whether it thinks the BARCODE is NULL or whether it is processing the BARCODE. 

If you are not seeing either of these two messages, than the script is not seeing a selection set. When this occurs you should see a message stating: "No Selected Staging Features".

This would happen if you did not run the tool interactively in ArcMap, and draw the polygon which is used to intersect (ie. Select by Location) the staging featureclasses.

Hope this helps

Tom DeWitte

Technical Lead - Natural Gas Industry

Esri, Inc

TomDeWitte
Esri Regular Contributor

Hi Brian,

Yes, we have successfully prototyped the use of Arcade scripting and the new Attribute Rule capability to automatically decode the ASTM F2897 barcodes.  There are a couple of minor issues with the scripts that we have not yet had a chance to address.  Specifically;

1) The Error handling of the Manufacture Date is not consistently working correctly in all use cases.

2) For Diameter and Wallthickness the decoding of a 2 diameter fitting (i.e. reducer) is not processing correctly.  Single diameter fittings and pipe are working correctly.

These Attribute Rules will work with Collector, ArcGIS Pro, and web maps.  They do not work within ArcMap.  Additionally they require an Enterprise Geodatabase working with ArcGIS Enterprise 10.6.1 or higher.

Until, there two known issues are resolved, I do not intend to post the arcade scripts.  But, if you are interested in using them, please contact me directly and I will provide them to you.

Tom DeWitte

Technical Lead - Natural Gas Industry

email: tdewitte@esri.com

BrianKratcha
Regular Contributor

Hi Tom,

It doesn't appear that the script I am running is testing  each row whether the BARCODE value is NULL.  If I have any that are null at all it fails.  I am using ArcMap 10.6.

My Gas Main Connector layer is the only current layer that has Barcode values populated.

Appending Gas Main Connector
Processing Barcode = PE3tlZ96MB830v60
Processing Barcode = None
Failed script AppendStagingGDBData...

Traceback (most recent call last):
File "R:\Tracking and Traceability\AppendStagingGDBData.py", line 442, in <module>
AppendSelectedRecords(Staking_GasMainConnector, Enterprise_GasMainConnector, Feature_Set, "MANUFACTURER","MANUFACTURELOTNO","","","","","","","")
File "R:\Tracking and Traceability\AppendStagingGDBData.py", line 180, in AppendSelectedRecords
MFGMATERIAL = BARCODE[9]
IndexError: string index out of range

Failed to execute (AppendStagingGDBData).
Failed at Wed Nov 14 14:41:54 2018 (Elapsed Time: 54.81 seconds)

# ---------------------------------------------------------------------------
# AppendStagingGDBData.py
# Created on: 2016-09-23
# Updated on: 2017-04-11 Added support for multi-diameter devices
#
# Usage: AppendStagingGDBData <Feature_Set>
#
# Description: Purpose is to interactively select the hosted feature layer data
# which was collected via digital as-builting and load it into the enterprise GDB.
# As part of the append process the BARCODE value is decoded and attirbutes are
# auto-populated.
# ---------------------------------------------------------------------------

# Import arcpy module
import collections
import sys, os, arcpy, traceback, datetime
from arcpy import env
import math

arcpy.env.overwriteOutput = True
arcpy.env.maintainAttachments = True

# Script arguments
Feature_Set = arcpy.GetParameterAsText(0)
if Feature_Set == '#' or not Feature_Set:
arcpy.AddMessage("Feature Set is Empty")
Feature_Set = "in_memory\\{E4B69402-D56F-43EB-91A6-E84B26D09D9F}" # provide a default value if unspecified

# Staging Geodatabase Layers:
Staking_GasServicePoint = "Staking\\Gas Service Point"
Staking_GasMainPipe = "Staking\\Staking Gas Main Pipe"
Staking_GasDimension = "Staking\\Staking Gas Dimension"
Staking_GasAnode = "Staking\\Staking Gas Anode"
Staking_GasValve = "Staking\\Staking Gas Valve"
Staking_GasCPTestPoint = "Staking\\Staking Gas CP Test Point"
Staking_GasFlowControlDevice = "Staking\\Staking Gas Flow Control Device"
Staking_GasFitting = "Staking\\Staking Gas Fitting"
Staking_GasMonitoringDevice = "Staking\\Staking Gas Monitoring Device"
Staking_GasServiceValve = "Staking\\Staking Gas Service Valve"
Staking_GasLocatingPoint = "Staking\\Staking Gas Locating Point"
Staking_GasMainConnector = "Staking\\Staking Gas Main Connector"
Staking_GasServicePipe = "Staking\\Staking Gas Service Pipe"
# StagingAnode = "RockGas.DBO.Staking\\Anode"
# StagingRectifier = "RockGas.DBO.Staking\\Rectifier"
# StagingProjectLocation= "RockGas.DBO.Staking\\Project Location"

# Enterprise Geodatabase Layers:
Enterprise_GasServicePoint = "Master\\Gas Service Point"
Enterprise_GasMainPipe = "Master\\Gas Main Pipe"
Enterprise_GasDimension = "Master\\Gas Dimension"
Enterprise_GasAnode = "Master\\Gas Anode"
Enterprise_GasValve = "Master\\Gas Valve"
Enterprise_CPTestPoint = "Master\\Gas CP Test Point"
Enterprise_GasFlowControlDevice = "Master\\Gas Flow Control Device"
Enterprise_GasFitting = "Master\\Gas Fitting"
Enterprise_GasMonitoringDevice = "Master\\Gas Monitoring Device"
Enterprise_GasServiceValve = "Master\\Gas Service Valve"
Enterprise_GasLocatingPoint = "Master\\Gas Locating Point"
Enterprise_GasMainConnector = "Master\\Gas Main Connector"
Enterprise_GasServicePipe = "Master\\Gas Service Pipe"
# Enterprise_CompressorStation = "RockGas.DBO.Network\\Pipe System\\Compressor Station"
# Enterprise_Tank = "RockGas.DBO.Network\\Pipe System\\Tank"
# Enterprise_RectifierCable = "RockGas.DBO.Network\\CP System\\Rectifier Cable"
# Enterprise_GasDimension = "RockGas.DBO\\CP System\\GasDimension"
# Enterprise_GasPipeCasing = "RockGas.DBO.Network\\Pipe System\\Gas Pipe Casing"
# Enterprise_BondJunction = "RockGas.DBO.Network\\CP System\\Bond Junction"
# Enterprise_TestPoint = "RockGas.DBO.Network\\CP System\\Test Point"
# Enterprise_Anode = "RockGas.DBO.Network\\CP System\\Anode"
# Enterprise_Rectifier = "RockGas.DBO.Network\\CP System\\Rectifier"
# Enterprise_ProjectLocation= "RockGas.DBO.Network\\Project Location"
# Enterprise_PipelineMarker = "RockGas.DBO.Network\\Pipeline Marker"
# Enterprise_MainJobSeparator = "RockGas.DBO.Network\\Pipe Job Separator"

###############################################################################
# Function Convert Base62 to Base 10
#
# ---------------DO NOT MODIFY THIS FUNCTION--------------------
#
###############################################################################
BASE2 = "01"
BASE10 = "0123456789"
BASE16 = "0123456789ABCDEF"
BASE62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

def baseconvert(number,fromdigits,todigits):
""" converts a "number" between two bases of arbitrary digits

The input number is assumed to be a string of digits from the
fromdigits string (which is in order of smallest to largest
digit). The return value is a string of elements from todigits
(ordered in the same way). The input and output bases are
determined from the lengths of the digit strings. Negative
signs are passed through.

decimal to a base that uses A-Z0-9a-z for its digits
>>> baseconvert(257938572394L,BASE10,BASE62)
'E78Lxik'

..convert back
>>> baseconvert('E78Lxik',BASE62,BASE10)
'257938572394'
"""

if str(number)[0]=='-':
number = str(number)[1:]
neg=1
else:
neg=0

# make an integer out of the number
x=0
for digit in str(number):
x = x*len(fromdigits) + fromdigits.index(digit)

# create the result in base 'len(todigits)'
if x == 0:
res = todigits[0]
else:
res=""
while x>0:
digit = x % len(todigits)
res = todigits[digit] + res
x = int(x / len(todigits))
if neg:
res = "-"+res

return res


#############################################################################
# Function Append Selected Records
#
# ---------------DO NOT MODIFY THIS FUNCTION--------------------
#
# StagingLayer- Name of TrackingGDB Staging Layer to have its selected features appended
# EnterpriseLayer- Name of the EnterpriseGDB Enterprise Layer to receive the selected features of the TrackingGDB Staging Layer
# FeatureSet- The User defined polygon which will act as a spatial filter on the TrackingGDB Staging Layer
# MANUFACTURER- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer name
# MFGLOTNO- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Lot number value
# MANUFACTUREDATE- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Date
# MANUFACTUREMAT- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Material value
# MANUFACTURECOMP- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Model value
# MANUFACTUREDIAMETER- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Diameter value
# MANUFACTUREWALLTHICK- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Wall thickness value
# MANUFACTUREDIAMETER2- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Diameter 2 value
# MANUFACTUREWALLTHICK2-Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Wall thickness 2 value
#
#############################################################################
def AppendSelectedRecords(StagingLayer,EnterpriseLayer,FeatureSet,MANUFACTURER,MFGLOTNO,MANUFACTUREDATE,MANUFACTUREMAT,MANUFACTURECOMP,MANUFACTUREDIAMETER,MANUFACTUREWALLTHICK,MANUFACTUREDIAMETER2,MANUFACTUREWALLTHICK2):

Count = str(arcpy.GetCount_management(StagingLayer))
CountINT = int(Count)
if CountINT > 0:
# Process: Select Staging Layer By Location
arcpy.SelectLayerByLocation_management(StagingLayer, "INTERSECT", FeatureSet, "1 Feet", "NEW_SELECTION", "NOT_INVERT")

# Process: Export Selected Hosted Feature Service Layer features to in-memory layer
arcpy.FeatureClassToFeatureClass_conversion(StagingLayer, "in_memory", "INMEMORY_TEMP", "", "", "")
INMEMORY_TEMP = "in_memory\\INMEMORY_TEMP"
CountSelected = str(arcpy.GetCount_management(INMEMORY_TEMP))

# Check for existance of BARCODE attribute. If does not exist, skip decoding
fields = arcpy.ListFields(StagingLayer, "BARCODE")

# Use Update Cursor to decode BARCODE for newly appended records with a not NULL BARCODE attribute
for field in fields:
cursor = arcpy.UpdateCursor(INMEMORY_TEMP)
row = cursor.next()
if row == None:
arcpy.AddMessage(" No Selected Staging Features")
elif row.isNull("BARCODE"):
arcpy.AddMessage(" BARCODE value is NULL")
else:
while row:
BARCODE = str(row.getValue("BARCODE"))
arcpy.AddMessage(" Processing Barcode = " + BARCODE)
MFG = BARCODE[0:2]
LOTNO = BARCODE[2:6]
MFGDATE = BARCODE[6:9]
MFGMATERIAL = BARCODE[9]
MFGCOMPONENT = BARCODE[10:12]
MFGSIZE = BARCODE[12:15]

#Convert from Base62 and parse Manufacture date
MFGDATEBASE10 = baseconvert(MFGDATE,BASE62,BASE10)
MFGDATELENGTH = len(MFGDATEBASE10)
if MFGDATELENGTH == 3:
MFGDATEYEAR = 2000 + int(MFGDATEBASE10[1:])
MFGDATEDAY = int(MFGDATEBASE10[0])
elif MFGDATELENGTH == 4:
MFGDATEYEAR = 2000 + int(MFGDATEBASE10[2:])
MFGDATEDAY = int(MFGDATEBASE10[0:2])
else:
MFGDATEYEAR = 2000 + int(MFGDATEBASE10[3:])
MFGDATEDAY = int(MFGDATEBASE10[0:3])
MFGDATECONVERTED = datetime.date(MFGDATEYEAR, 1, 1) + datetime.timedelta(MFGDATEDAY - 1)

# Query for Pipes or fittings where C1 = C2
SIZECODE = int(baseconvert(MFGSIZE,BASE62,BASE10))
C1FACTOR = (SIZECODE - 1)/379
if ASTMSIZE.has_key(C1FACTOR):
C1VALUESET = ASTMSIZE.get(C1FACTOR)
MFGDIAMETER = C1VALUESET[0]
MFGWALLTHICKNESS = C1VALUESET[3]
else:
MFGDIAMETER = 0
MFGWALLTHICKNESS = 0
arcpy.AddMessage("Multiple Diameters")
##########################################################################
# Need to add in logic to query for fittings with 2 diameters
# NOTES: Valid answer is first combination of C1/C2 values meeting the following criteria
# NOTES: C1 and C2 valid values are 1 to 378
# NOTES: C2 much be greater then C1 value
# NOTES: Equation to solve: SIZECODE = (C1 * 378)+ C2 + 1
##########################################################################
C1Candidate = 0
for C1Candidate in range(1, 378):
C2Start = C1Candidate + 1
for C2Candidate in range(C2Start, 378):
SIZECODECandidate = (C1Candidate * 378) + C2Candidate + 1
if SIZECODECandidate == SIZECODE:
C1VALUESET = ASTMSIZE.get(C1Candidate)
C2VALUESET = ASTMSIZE.get(C2Candidate)
break
# end if
# end for C2Candidate
# end for C1Candidate
MFGDIAMETER = C1VALUESET[0]
MFGWALLTHICKNESS = C1VALUESET[3]
MFGDIAMETER2 = C2VALUESET[0]
MFGWALLTHICKNESS2 = C2VALUESET[3]

# Update columns with BARCODE decoded values
if MANUFACTURER != "":
row.setValue(MANUFACTURER, MFG)
if MFGLOTNO != "":
row.setValue(MFGLOTNO, baseconvert(LOTNO,BASE62,BASE10))
if MANUFACTUREDATE != "":
row.setValue(MANUFACTUREDATE, str(MFGDATECONVERTED))
if MANUFACTUREMAT != "":
row.setValue(MANUFACTUREMAT, MFGMATERIAL)
if MANUFACTURECOMP != "":
row.setValue(MANUFACTURECOMP, MFGCOMPONENT)
if MANUFACTUREDIAMETER != "":
row.setValue(MANUFACTUREDIAMETER, MFGDIAMETER)
if MANUFACTUREWALLTHICK != "":
row.setValue(MANUFACTUREWALLTHICK, MFGWALLTHICKNESS)
if MANUFACTUREDIAMETER2 != "":
row.setValue(MANUFACTUREDIAMETER2, MFGDIAMETER2)
if MANUFACTUREWALLTHICK2 != "":
row.setValue(MANUFACTUREWALLTHICK2, MFGWALLTHICKNESS2)
cursor.updateRow(row)

row = cursor.next()

# Process: Append onto RockGas.DBO.Network
arcpy.Append_management(INMEMORY_TEMP, EnterpriseLayer, "NO_TEST", "")

arcpy.AddMessage(" Added " + CountSelected + " Selected Staging Features")

else:
Count is None
CountINT is None
arcpy.AddMessage(" No Selected Staging Features")

###############################################################################
# Create Dictionary for Pipe Sizes [C1 value: Diameter,Pipe Sizing Method,Wallthickness(in)]
# CTS = Copper Tubing Size
# IPS = Iron Pipe Size
# NPS = Nominal Pipe Size
###############################################################################
ASTMSIZE = {1:(0.25,0,"CTS",0.062),2:(0.375,0,"CTS",0.062),3:(0.50,0,"CTS",0.062),4:(0.50,0,"CTS",0.090),5:(0.50,0,"CTS",0.104), \
6:(0.75,0,"CTS",0.062),7:(0.75,0,"CTS",0.077),8:(0.75,0,"CTS",0.090),9:(1.0,0,"CTS",0.062),10:(1.0,0,"CTS",0.090), \
11:(1.0,0,"CTS",0.099),12:(1.0,0,"CTS",1.01),13:(1.0,0,"CTS",0.121),14:(1.25,0,"CTS",0.062),15:(1.25,0,"CTS",0.090), \
16:(1.25,0,"CTS",0.121),17:(1.75,0,"CTS",0.062),18:(0.50,9.3,"IPS",0.090),19:(0.50,11,"IPS",0.076),20:(0.75,11,"IPS",0.095), \
21:(0.75,"D","IPS",0.090),22:(1.0,9.33,"IPS",0.140),23:(1.0,9.9,"IPS",0.133),24:(1.0,11,"IPS",0.120),25:(1.0,13.5,"IPS",0.097), \
26:(1.0,"D","IPS",0.090),27:(1.25,9.33,"IPS",0.178),28:(1.25,10,"IPS",0.166),29:(1.25,11,"IPS",0.151),30:(1.25,13.5,"IPS",0.123), \
31:(1.25,17,"IPS",0.098),32:(1.25,"D","IPS",0.090),33:(1.50,11,"IPS",0.173),34:(1.50,13.5,"IPS",0.141),35:(1.50,17,"IPS",0.112), \
36:(1.50,"D","IPS",0.090),37:(2.0,9.33,"IPS",0.255),38:(2.0,11,"IPS",0.216),39:(2.0,13.5,"IPS",0.176),40:(3.0,11,"IPS",0.318), \
41:(3.0,11.5,"IPS",0.304),42:(3.0,13.5,"IPS",0.259),43:(4.0,9.33,"IPS",0.482),44:(4.0,11,"IPS",0.409),45:(4.0,11.5,"IPS",0.391), \
46:(4.0,13.5,"IPS",0.333),47:(4.0,15.5,"IPS",0.290),48:(4.0,17,"IPS",0.265),49:(6.0,11,"IPS",0.602),50:(6.0,11.5,"IPS",0.576), \
51:(6.0,13.5,"IPS",0.491),52:(6.0,17,"IPS",0.390),53:(6.0,21,"IPS",0.315),54:(8.0,11,"IPS",0.784),55:(8.0,11.5,"IPS",0.750), \
56:(8.0,13.5,"IPS",0.639),57:(8.0,17,"IPS",0.507),58:(8.0,21,"IPS",0.411),59:(10.0,11,"IPS",0.977),60:(10.0,11.5,"IPS",0.935), \
61:(10.0,13.5,"IPS",0.796),62:(10.0,17,"IPS",0.632),63:(10.0,21,"IPS",0.512),64:(12.0,11,"IPS",1.159),65:(12.0,11.5,"IPS",1.109), \
66:(12.0,13.5,"IPS",0.944),67:(12.0,17,"IPS",0.750),68:(12.0,21,"IPS",0.607),69:(14.0,11,"IPS",1.273),70:(14.0,13.5,"IPS",1.037), \
71:(14.0,17,"IPS",0.824),72:(14.0,21,"IPS",0.667),73:(16.0,11,"IPS",1.455),74:(16.0,13.5,"IPS",1.185),75:(16.0,17,"IPS",0.941), \
76:(16.0,21,"IPS",0.762),77:(18.0,11,"IPS",1.636),78:(18.0,13.5,"IPS",1.333),79:(18.0,17,"IPS",1.059),80:(18.0,21,"IPS",0.857), \
81:(20.0,11,"IPS",1.818),82:(20.0,13.5,"IPS",1.481),83:(20.0,17,"IPS",1.176),84:(20.0,21,"IPS",0.952),85:(22.0,11,"IPS",2.000), \
86:(22.0,13.5,"IPS",1.630),87:(22.0,17,"IPS",1.294),88:(22.0,21,"IPS",1.048),89:(24.0,11,"IPS",2.182),90:(24.0,13.5,"IPS",1.778), \
91:(24.0,17,"IPS",1.412),92:(24.0,21,"IPS",1.143),101:(0.5,-1,"MPT",-1),102:(0.75,-1,"MPT",-1),103:(1.0,-1,"MPT",-1), \
104:(1.25,-1,"MPT",-1),105:(1.50,-1,"MPT",-1),106:(2.0,-1,"MPT",-1),107:(3.0,-1,"MPT",-1),108:(4.0,-1,"MPT",-1),109:(6.0,-1,"MPT",-1), \
110:(8.0,-1,"MPT",-1),111:(10.0,-1,"MPT",-1),112:(12.0,-1,"MPT",-1),121:(0.5,-1,"FPT",-1),122:(0.75,-1,"FPT",-1),123:(1.0,-1,"FPT",-1), \
124:(1.25,-1,"FPT",-1),125:(1.50,-1,"FPT",-1),126:(2.0,-1,"FPT",-1),127:(3.0,-1,"FPT",-1),128:(4.0,-1,"FPT",-1),129:(6.0,-1,"FPT",-1), \
130:(8.0,-1,"FPT",-1),131:(10.0,-1,"FPT",-1),132:(12.0,-1,"FPT",-1),151:(0.125,-1,"NPS",0.068),152:(0.125,-1,"NPS",0.095), \
153:(0.25,-1,"NPS",0.088),154:(0.25,-1,"NPS",0.119),155:(0.375,-1,"NPS",0.091),156:(0.375,-1,"NPS",0.126),157:(0.5,-1,"NPS",0.109), \
158:(0.5,-1,"NPS",0.147),159:(0.75,-1,"NPS",0.113),160:(0.75,-1,"NPS",0.154),161:(1,-1,"NPS",0.133),162:(1,-1,"NPS",0.179), \
163:(1.25,-1,"NPS",0.14),164:(1.25,-1,"NPS",0.191),165:(1.5,-1,"NPS",0.145),167:(2,-1,"NPS",0.154),168:(2,-1,"NPS",0.218), \
169:(3,-1,"NPS",0.188),170:(3,-1,"NPS",0.216),171:(4,-1,"NPS",0.156),172:(4,-1,"NPS",0.188),173:(4,-1,"NPS",0.237), \
175:(6,-1,"NPS",0.188),176:(6,-1,"NPS",0.219),177:(6,-1,"NPS",0.25),178:(6,-1,"NPS",0.28),181:(8,-1,"NPS",0.188), \
182:(8,-1,"NPS",0.219),183:(8,-1,"NPS",0.25),184:(8,-1,"NPS",0.322),187:(10,-1,"NPS",0.188),188:(10,-1,"NPS",0.203), \
189:(10,-1,"NPS",0.219),190:(10,-1,"NPS",0.279),191:(10,-1,"NPS",0.365),193:(12,-1,"NPS",0.219),194:(12,-1,"NPS",0.25), \
195:(12,-1,"NPS",0.312),196:(12,-1,"NPS",0.375),197:(14,-1,"NPS",0.209),198:(14,-1,"NPS",0.25),199:(14,-1,"NPS",0.375), \
200:(14,-1,"NPS",0.625),201:(14,-1,"NPS",0.687),202:(14,-1,"NPS",0.938),203:(15,-1,"NPS",0.209),204:(15,-1,"NPS",0.25), \
205:(16,-1,"NPS",0.188),206:(16,-1,"NPS",0.219),207:(16,-1,"NPS",0.225),208:(16,-1,"NPS",0.243),209:(16,-1,"NPS",0.25), \
210:(16,-1,"NPS",0.26),211:(16,-1,"NPS",0.27),212:(16,-1,"NPS",0.28),213:(16,-1,"NPS",0.312),214:(16,-1,"NPS",0.325), \
215:(16,-1,"NPS",0.345),216:(16,-1,"NPS",0.357),217:(16,-1,"NPS",0.365),218:(16,-1,"NPS",0.375),219:(16,-1,"NPS",0.406), \
220:(16,-1,"NPS",0.5),221:(16,-1,"NPS",0.53),222:(16,-1,"NPS",0.55),223:(16,-1,"NPS",0.56),224:(16,-1,"NPS",0.625), \
225:(16,-1,"NPS",0.656),226:(16,-1,"NPS",0.843),227:(16,-1,"NPS",1.039),228:(16,-1,"NPS",1.125),229:(16,-1,"NPS",1.218), \
230:(16,-1,"NPS",1.438),231:(16,-1,"NPS",1.594),232:(18,-1,"NPS",0.219),233:(18,-1,"NPS",0.25),234:(18,-1,"NPS",0.312), \
235:(18,-1,"NPS",0.344),236:(18,-1,"NPS",0.375),237:(18,-1,"NPS",0.406),238:(18,-1,"NPS",0.5),239:(18,-1,"NPS",0.75), \
240:(18,-1,"NPS",0.938),241:(18,-1,"NPS",1.125),242:(18,-1,"NPS",1.156),243:(18,-1,"NPS",1.375),244:(18,-1,"NPS",2.1), \
245:(20,-1,"NPS",0.219),246:(20,-1,"NPS",0.234),247:(20,-1,"NPS",0.25),248:(20,-1,"NPS",0.265),249:(20,-1,"NPS",0.281), \
250:(20,-1,"NPS",0.288),251:(20,-1,"NPS",0.312),252:(20,-1,"NPS",0.328),253:(20,-1,"NPS",0.344),254:(20,-1,"NPS",0.375), \
255:(20,-1,"NPS",0.406),256:(20,-1,"NPS",0.438),257:(20,-1,"NPS",0.469),258:(20,-1,"NPS",0.5),259:(22,-1,"NPS",0.219), \
260:(22,-1,"NPS",0.237),261:(22,-1,"NPS",0.25),262:(22,-1,"NPS",0.281),263:(22,-1,"NPS",0.312),264:(22,-1,"NPS",0.344), \
265:(22,-1,"NPS",0.371),266:(22,-1,"NPS",0.375),267:(22,-1,"NPS",0.432),268:(22,-1,"NPS",0.438),269:(22,-1,"NPS",0.5), \
270:(22,-1,"NPS",0.562),271:(22,-1,"NPS",0.625),272:(24,-1,"NPS",0.25),273:(24,-1,"NPS",0.265),274:(24,-1,"NPS",0.271), \
275:(24,-1,"NPS",0.281),276:(24,-1,"NPS",0.289),277:(24,-1,"NPS",0.307),278:(24,-1,"NPS",0.312),279:(24,-1,"NPS",0.32), \
280:(24,-1,"NPS",0.344),281:(24,-1,"NPS",0.375),282:(24,-1,"NPS",0.382),283:(24,-1,"NPS",0.391),284:(24,-1,"NPS",0.406), \
285:(24,-1,"NPS",0.5),286:(24,-1,"NPS",0.562),287:(24,-1,"NPS",0.625),288:(24,-1,"NPS",1.531),289:(26,-1,"NPS",0.25), \
290:(26,-1,"NPS",0.264),291:(26,-1,"NPS",0.278),292:(26,-1,"NPS",0.281),293:(26,-1,"NPS",0.291),294:(26,-1,"NPS",0.312), \
295:(26,-1,"NPS",0.344),296:(26,-1,"NPS",0.375),297:(26,-1,"NPS",0.438),298:(26,-1,"NPS",0.5),299:(30,-1,"NPS",0.25), \
300:(30,-1,"NPS",0.281),301:(30,-1,"NPS",0.287),302:(30,-1,"NPS",0.312),303:(30,-1,"NPS",0.328),304:(30,-1,"NPS",0.337), \
305:(30,-1,"NPS",0.344),306:(30,-1,"NPS",0.35),307:(30,-1,"NPS",0.365),308:(30,-1,"NPS",0.375),309:(30,-1,"NPS",0.391), \
310:(30,-1,"NPS",0.406),311:(30,-1,"NPS",0.417),312:(30,-1,"NPS",0.421),313:(30,-1,"NPS",0.428),314:(30,-1,"NPS",0.43), \
315:(30,-1,"NPS",0.437),316:(30,-1,"NPS",0.438),317:(30,-1,"NPS",0.45),318:(30,-1,"NPS",0.469),319:(30,-1,"NPS",0.5), \
320:(30,-1,"NPS",0.562),321:(30,-1,"NPS",0.563),322:(30,-1,"NPS",0.593),323:(30,-1,"NPS",0.625),324:(30,-1,"NPS",0.75), \
325:(34,-1,"NPS",0.375),326:(34,-1,"NPS",0.416),327:(34,-1,"NPS",0.438),328:(34,-1,"NPS",0.469),329:(34,-1,"NPS",0.5), \
330:(34,-1,"NPS",0.524),331:(34,-1,"NPS",0.562),332:(34,-1,"NPS",0.566),333:(34,-1,"NPS",0.6),334:(34,-1,"NPS",0.628), \
335:(34,-1,"NPS",0.75),336:(34,-1,"NPS",0.754),337:(34,-1,"NPS",0.875),338:(34,-1,"NPS",1.25),339:(36,-1,"NPS",0.312), \
340:(36,-1,"NPS",0.322),341:(36,-1,"NPS",0.344),342:(36,-1,"NPS",0.375),343:(36,-1,"NPS",0.391),344:(36,-1,"NPS",0.406), \
345:(36,-1,"NPS",0.422),346:(36,-1,"NPS",0.428),347:(36,-1,"NPS",0.438),348:(36,-1,"NPS",0.453),349:(36,-1,"NPS",0.469), \
350:(36,-1,"NPS",0.484),351:(36,-1,"NPS",0.5),352:(36,-1,"NPS",0.525),353:(36,-1,"NPS",0.562),354:(36,-1,"NPS",0.594), \
355:(42,-1,"NPS",0.625),356:(42,-1,"NPS",0.75),357:(42,-1,"NPS",0.375),358:(42,-1,"NPS",0.5),359:(42,-1,"NPS",0.688)}

###################################################################
##
## Mapping of Enterprise GDB Layer attributes for receiving the appending Tracking features
##
## StagingLayer- Name of TrackingGDB Staging Layer to have its selected features appended
## EnterpriseLayer- Name of the EnterpriseGDB Enterprise Layer to receive the selected features of the TrackingGDB Staging Layer
## FeatureSet- The User defined polygon which will act as a spatial filter on the TrackingGDB Staging Layer
## MANUFACTURER- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer name
## MANUFACTURELOTNO- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Lot number value
## MANUFACTUREDATE- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Date
## MATERIAL- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Material value
## MANUFACTUREMODEL- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacturer Model value
## DIAMETER- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Diameter value
## WALLTHICKNESS- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Wall thickness value
## DIAMETER2- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Diameter 2 value
## WALLTHICKNESS2- Name of the EnterpriseGDB Enterprise layer field to store the ASTM barcode Manufacture Wall thichness 2 value
###################################################################

# ###########################
# Gas Service Point
# ###########################
arcpy.AddMessage("Appending GasServicePoint")
AppendSelectedRecords(Staking_GasServicePoint, Enterprise_GasServicePoint, Feature_Set, "", "", "", "","", "","","","")
arcpy.AddMessage(" Completed Appending GasServicePoint")
arcpy.AddMessage(" ")

# ############################
# # Gas Main Pipe
# ############################
arcpy.AddMessage("Appending GasMainPipe")
AppendSelectedRecords(Staking_GasMainPipe, Enterprise_GasMainPipe, Feature_Set, "MANUFACTURER", "MANUFACTURELOTNO", "MANUFACTUREDATE", "PIPEGRADE", "PIPESPECIFICATION", "NOMINALDIAMETER","WALLTHICKNESS","","")
arcpy.AddMessage(" Completed Appending GasMainPipe")
arcpy.AddMessage(" ")


# ############################
# # Gas Dimension
# ############################
arcpy.AddMessage("Appending Gas Dimension")
AppendSelectedRecords(Staking_GasDimension, Enterprise_GasDimension, Feature_Set, "", "", "", "","","","","","")
arcpy.AddMessage(" Completed Appending Gas Dimension")
arcpy.AddMessage(" ")

# ############################
# # Gas Anode
# ############################
arcpy.AddMessage("Appending Gas Anode")
AppendSelectedRecords(Staking_GasAnode, Enterprise_GasAnode, Feature_Set,"","","","","","","","","")
arcpy.AddMessage(" Completed Gas Anode")
arcpy.AddMessage(" ")


# ############################
# # Gas Valve
# ############################
arcpy.AddMessage("Appending Gas Valve")
AppendSelectedRecords(Staking_GasValve, Enterprise_GasValve, Feature_Set, "MANUFACTURER", "MANUFACTURELOTNO", "MANUFACTUREDATE", "MATERIAL", "MANUFACTUREMODEL","DIAMETER","","","")
arcpy.AddMessage(" Completed Appending Gas Valve")
arcpy.AddMessage(" ")


# ############################
# # Gas CP Test Point
# ############################
arcpy.AddMessage("Appending CP Test Point")
AppendSelectedRecords(Staking_GasCPTestPoint, Enterprise_CPTestPoint, Feature_Set,"MANUFACTURER","","","","MANUFACTUREMODEL","","","","")
arcpy.AddMessage(" Completed Appending CP Test Point")
arcpy.AddMessage(" ")

# ############################
# # Gas Flow Control Device
# ############################
arcpy.AddMessage("Appending Gas Flow Control Device")
AppendSelectedRecords(Staking_GasFlowControlDevice, Enterprise_GasFlowControlDevice, Feature_Set, "MANUFACTURER", "MANUFACTURELOTNO", "MANUFACTUREDATE", "", "MANUFACTUREMODEL","DIAMETER","","","")
arcpy.AddMessage(" Completed Appending Gas Flow Control Device")
arcpy.AddMessage(" ")

# ############################
# # Gas Fitting
# ############################
arcpy.AddMessage("Appending Gas Fitting")
AppendSelectedRecords(Staking_GasFitting, Enterprise_GasFitting, Feature_Set, "MANUFACTURER", "MANUFACTURERLOTNO", "MANUFACTUREDATE", "", "MANUFACTUREMODEL","DIAMETER","","","")
arcpy.AddMessage(" Completed Appending Gas Fitting")
arcpy.AddMessage(" ")

# ############################
# # Gas Service Valve
# ############################
arcpy.AddMessage("Appending Gas Service Valve")
AppendSelectedRecords(Staking_GasServiceValve, Enterprise_GasServiceValve, Feature_Set, "MANUFACTURER", "MANUFACTURERLOTNO", "MANUFACTUREDATE", "", "MANUFACTUREMODEL","DIAMETER","","","")
arcpy.AddMessage(" Completed Appending Gas Service Valve")
arcpy.AddMessage(" ")

# ############################
# # Gas Locating Point
# ############################
arcpy.AddMessage("Appending Gas Locating Point")
AppendSelectedRecords(Staking_GasLocatingPoint, Enterprise_GasLocatingPoint, Feature_Set, "MANUFACTURER", "MANUFACTURERLOTNO", "MANUFACTUREDATE", "", "MANUFACTUREMODEL","DIAMETER","","","")
arcpy.AddMessage(" Completed Appending Gas Locating Point")
arcpy.AddMessage(" ")

# ############################
# # Gas Main Connector
# ############################
arcpy.AddMessage("Appending Gas Main Connector")
AppendSelectedRecords(Staking_GasMainConnector, Enterprise_GasMainConnector, Feature_Set, "MANUFACTURER","MANUFACTURELOTNO","","","","","","","")
arcpy.AddMessage(" Completed Appending Gas Main Connector")
arcpy.AddMessage(" ")

# ############################
# # Gas Service Pipe
# ############################
arcpy.AddMessage("Appending Gas Service Pipe")
AppendSelectedRecords(Staking_GasServicePipe, Enterprise_GasServicePipe, Feature_Set,"MANUFACTURER", "MANUFACTURELOTNO", "MANUFACTUREDATE", "PIPEGRADE", "PIPESPECIFICATION", "NOMINALDIAMETER","WALLTHICKNESS","","")
arcpy.AddMessage(" Completed Gas Service Pipe")
arcpy.AddMessage(" ")

# ############################
# # Test Point
# ############################
# arcpy.AddMessage("Appending Test Point")
# AppendSelectedRecords(StagingTestPoint, Enterprise_TestPoint, Feature_Set,"","","","","","","","","")
# arcpy.AddMessage(" Completed Appending Test Point")
# arcpy.AddMessage(" ")

# ############################
# # Anode
# ############################
# arcpy.AddMessage("Appending Anode")
# AppendSelectedRecords(StagingAnode, Enterprise_Anode, Feature_Set,"MANUFACTURER","MANUFACTURELOTNO","MANUFACTUREDATE","MATERIAL","MANUFACTUREMODEL","","","","")
# arcpy.AddMessage(" Completed Appending Anode")
# arcpy.AddMessage(" ")

# ############################
# # Rectifier
# ############################
# arcpy.AddMessage("Appending Rectifier")
# AppendSelectedRecords(StagingRectifier, Enterprise_Rectifier, Feature_Set,"MANUFACTURER","","","","MANUFACTUREMODEL","","","","")
# arcpy.AddMessage(" Completed Appending Rectifier")
# arcpy.AddMessage(" ")

# ############################
# # Project Location
# ############################
# arcpy.AddMessage("Appending Project Location")
# AppendSelectedRecords(StagingProjectLocation, Enterprise_ProjectLocation, Feature_Set,"","","","","","","","","")
# arcpy.AddMessage(" Completed Appending Project Location")
# arcpy.AddMessage(" ")

Thanks,

Brian

Version history
Last update:
‎12-06-2016 04:41 PM
Updated by:
Contributors