pre cutover push
This commit is contained in:
@ -1,10 +1,21 @@
|
||||
Compile function WO_MAT_Services(@Service, @Params)
|
||||
#pragma precomp SRP_PreCompiler
|
||||
|
||||
Declare function Database_Services, Error_Services, SRP_Json
|
||||
Declare subroutine Error_Services, SRP_Json
|
||||
Declare function Database_Services, Error_Services, SRP_Json, SRP_Com, Environment_Services, Logging_Services
|
||||
Declare subroutine Error_Services, SRP_Json, SRP_Com, Wo_Mat_Services, Database_Services, Logging_Services
|
||||
|
||||
$insert LOGICAL
|
||||
$Insert APP_INSERTS
|
||||
$insert WO_MAT_EQUATES
|
||||
$Insert SERVICE_SETUP
|
||||
|
||||
LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_Mat\InvActionsSyncUp'
|
||||
LogDate = Oconv(Date(), 'D4/')
|
||||
LogTime = Oconv(Time(), 'MTS')
|
||||
LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' InvActionsSyncUpLog.csv'
|
||||
Headers = 'Logging DTM' : @FM : 'WOMatKey' : @FM : 'Missing Signature' : @FM : 'Missing Signature Dtm' : @FM : 'Message'
|
||||
objSyncLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, ',', Headers, '', False$, False$)
|
||||
LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM
|
||||
|
||||
GoToService
|
||||
|
||||
@ -19,10 +30,12 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
IF WOMatKey NE '' then
|
||||
If Record EQ '' then Record = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
|
||||
If Error_Services('NoError') then
|
||||
@DICT = Database_Services('GetTableHandle', 'DICT.WO_MAT')
|
||||
@ID = WOMatKey
|
||||
@RECORD = Record
|
||||
@DICT = Database_Services('GetTableHandle', 'DICT.WO_MAT')
|
||||
@ID = WOMatKey
|
||||
@RECORD = Record
|
||||
objJSON = ''
|
||||
If SRP_JSON(objJSON, 'New', 'Object') then
|
||||
objWOMat = ''
|
||||
If SRP_JSON(objWOMat, 'New', 'Object') then
|
||||
SRP_JSON(objWOMat, 'SetValue', 'KeyId', @ID)
|
||||
SRP_JSON(objWOMat, 'SetValue', 'WoNo', {WO_NO})
|
||||
@ -51,6 +64,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
SRP_JSON(objWOMat, 'SetValue', 'SapMuQty', {SAP_MU_QTY})
|
||||
SRP_JSON(objWOMat, 'SetValue', 'SapRawScrapQty', {SAP_RAW_SCRAP_QTY})
|
||||
SRP_JSON(objWOMat, 'SetValue', 'SapScrapQty', {SAP_CONFIRM_SCRAP})
|
||||
objInvActions = ''
|
||||
If SRP_JSON(objInvActions, 'New', 'Array') then
|
||||
InventoryActions = {INV_DTM}
|
||||
If InventoryActions NE '' then
|
||||
@ -65,6 +79,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
InvUserId = {INV_USER}<1, vPos>
|
||||
InvTag = {INV_TAG}<1, vPos>
|
||||
InvToolId = {INV_TOOL_ID}<1, vPos>
|
||||
objInvAction = ''
|
||||
If SRP_JSON(objInvAction, 'New', 'Object') then
|
||||
SRP_JSON(objInvAction, 'SetValue', 'InvTimestamp', Oconv(InvTimeStamp, 'DT'))
|
||||
SRP_JSON(objInvAction, 'SetValue', 'InvWhCd', InvWhCd)
|
||||
@ -85,6 +100,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
SRP_JSON(objWOMat, 'Set', 'InventoryActions', objInvActions)
|
||||
SRP_JSON(objInvActions, 'Release')
|
||||
end
|
||||
objSlots = ''
|
||||
If SRP_JSON(objSlots, 'New', 'Array') then
|
||||
SlotCount = 25
|
||||
for Slot = 1 to SlotCount
|
||||
@ -95,6 +111,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
MovedToSlot = {SLOT_MOVED_TO}<1, Slot>
|
||||
MuWaferId = {SLOT_REP_WAFER_ID}<1, Slot>
|
||||
MovedFromSlot = {SLOT_MOVED_FROM}<1, Slot>
|
||||
objSlot = ''
|
||||
If SRP_JSON(objSlot, 'New', 'Object') then
|
||||
SRP_JSON(objSlot, 'SetValue', 'SlotNo', SlotNo)
|
||||
SRP_JSON(objSlot, 'SetValue', 'WaferId', WaferId)
|
||||
@ -110,6 +127,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
SRP_JSON(objWOMat, 'Set', 'Slots', objSlots)
|
||||
SRP_JSON(objSlots, 'Release')
|
||||
end
|
||||
objNCRs = ''
|
||||
If SRP_JSON(objNCRs, 'New', 'Array') then
|
||||
NCRs = {NCR_KEYS}
|
||||
if DCount(NCRs, @VM) GT 0 then
|
||||
@ -121,6 +139,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
NcrStage = {NCR_LOSS_STAGE}<1, nPos>
|
||||
NcrLossDesc = {NCR_LOSS_DESC}<1, nPos>
|
||||
NcrLossComment = {NCR_LOSS_COMMENT}<1, nPos>
|
||||
objNCR = ''
|
||||
If SRP_JSON(objNCR, 'New', 'Object') then
|
||||
SRP_JSON(objNCR, 'SetValue', 'NcrId', NcrId)
|
||||
SRP_JSON(objNCR, 'SetValue', 'NcrStatus', NcrStatus)
|
||||
@ -140,6 +159,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
end else
|
||||
SRP_JSON(objWOMat, 'SetValue', 'NCRs', '')
|
||||
end
|
||||
objHolds = ''
|
||||
If SRP_JSON(objHolds, 'New', 'Array') then
|
||||
HoldDtms = {HOLD_START_DTM}
|
||||
if DCount(HoldDtms, @VM) GT 0 then
|
||||
@ -152,6 +172,7 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
OffHoldReason = {HOLD_STOP_REASON}<1, hPos>
|
||||
HoldEntity = {HOLD_ENTITY}<1, hPos>
|
||||
HoldEntityId = {HOLD_ENTITY_ID}<1, hPos>
|
||||
objHold = ''
|
||||
If SRP_JSON(objHold, 'New', 'Object') then
|
||||
SRP_JSON(objHold, 'SetValue', 'OnHoldDtm', OnHoldDtm)
|
||||
SRP_JSON(objHold, 'SetValue', 'HoldUser', HoldUser)
|
||||
@ -165,8 +186,6 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
SRP_JSON(objHold, 'Release')
|
||||
end
|
||||
Next HoldDtm
|
||||
|
||||
|
||||
SRP_JSON(objWOMat, 'Set', 'Holds', objHolds)
|
||||
SRP_JSON(objHolds, 'Release')
|
||||
end else
|
||||
@ -179,10 +198,11 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
end
|
||||
If itemURL NE '' then
|
||||
// The itemURL was passed in so add HAL+JSON properties.
|
||||
|
||||
// Create the _links property and then all link objects needed for this resource.
|
||||
objLinks = ''
|
||||
If SRP_JSON(objLinks, 'New', 'Object') then
|
||||
// Create a self link.
|
||||
objLink = ''
|
||||
If SRP_JSON(objLink, 'New', 'Object') then
|
||||
SRP_JSON(objLink, 'SetValue', 'href', ItemURL, 'String')
|
||||
SRP_JSON(objLink, 'SetValue', 'title', 'Self', 'String')
|
||||
@ -210,3 +230,149 @@ Service ConvertRecordToJSON(WOMatKey, Record, ItemURL)
|
||||
End Service
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
// GetWaferMap
|
||||
//
|
||||
// Returns a @VM delimited array of boolean values, which represents which slots are filled.
|
||||
// Note: The response is in the slot order 25, 24, ..., 2, 1.
|
||||
//----------------------------------------------------------------------------------------------------------------------
|
||||
Service GetWaferMap(WOMatKey)
|
||||
|
||||
WaferMap = ''
|
||||
ErrorMsg = ''
|
||||
If WOMatKey NE '' then
|
||||
If RowExists('WO_MAT', WOMatKey) then
|
||||
ReactType = Xlate('WO_MAT', WOMatKey, 'REACTOR_TYPE', 'X')
|
||||
If ReactType NE 'EPP' then
|
||||
SlotWaferIDs = Xlate('WO_MAT', WOMatKey, 'SLOT_WAFER_ID', 'X')
|
||||
WaferMap = ''
|
||||
For SlotIndex = 1 to 25
|
||||
SlotWaferID = SlotWaferIDs<0, SlotIndex>
|
||||
WaferMap = Insert(WaferMap, 0, 1, 0, (SlotWaferID NE '') )
|
||||
Next SlotIndex
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. EpiPro is not supported by this service. Use WM_OUT_SERVICES instead.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. WO_MAT record ':WOMatKey:' does not exist.'
|
||||
end
|
||||
end else
|
||||
ErrorMsg = 'Error in ':Service:' service. Null WOMatKey passed in.'
|
||||
end
|
||||
|
||||
If ErrorMsg EQ '' then
|
||||
Response = WaferMap
|
||||
end else
|
||||
Error_Services('Add', ErrorMsg)
|
||||
Response = False$
|
||||
end
|
||||
|
||||
end service
|
||||
|
||||
Service CheckInvActionsSignatureSync()
|
||||
hSysLists = Database_Services('GetTableHandle', 'SYSLISTS')
|
||||
Lock hSysLists, ServiceKeyID then
|
||||
Script = "SELECT WO_MAT_SIG_PROFILE.WO_NO, WO_MAT_SIG_PROFILE.CASS_NO,WO_MAT_SIG_PROFILE.CASS_ID_SAP, WO_MAT_SIG_PROFILE.SIG_DTM, WO_MAT_SIG_PROFILE.SIGNATURE, WMSP.SIG_PROFILE FROM WO_MAT_SIG_PROFILE "
|
||||
Script := "Left JOIN WO_MAT_SIG_PROFILE_AUDIT WMSP ON WO_MAT_SIG_PROFILE.WO_NO = WMSP.WO_NO AND WO_MAT_SIG_PROFILE.CASS_NO = WMSP.CASS_NO AND WO_MAT_SIG_PROFILE.SIG_PROFILE = WMSP.SIG_PROFILE "
|
||||
Script := "WHERE SIG_DTM != '' AND (WMSP.SIG_PROFILE IS NULL OR WMSP.SIG_PROFILE = '') AND WO_MAT_SIG_PROFILE.SIG_DTM > DATEADD(day, -1, GETDATE()) AND WO_MAT_SIG_PROFILE.SIGNATURE != 'AUTO_FQA' AND WO_MAT_SIG_PROFILE.SIGNATURE IS NOT NULL order by WO_NO desc"
|
||||
Connection = ''
|
||||
RecordSetResult = ''
|
||||
If SRP_Com(Connection, "CREATE", "ADODB.Connection") then
|
||||
ConnectionString = Environment_Services('GetSQLScrapeConnectionString')
|
||||
If SRP_Com(Connection, "CALL", "Open", ConnectionString) EQ "" then
|
||||
RecordSetResult = SRP_Com(Connection, "CALL", "Execute", Script)
|
||||
Records = SRP_Com(RecordSetResult, "CALL", "GetString", 2, -1, @VM, @FM)
|
||||
SRP_Com(RecordSetResult, "RELEASE")
|
||||
end else
|
||||
Ans = 'Unable to open connection to SQL server. SQL connection error: ':SRP_Com(Connection, "ERROR")
|
||||
end
|
||||
SRP_Com(Connection, "CALL", "Close")
|
||||
SRP_Com(Connection, "RELEASE")
|
||||
end else
|
||||
Ans = "Unable to create ADO connection."
|
||||
end
|
||||
if Records then
|
||||
for each WOMatRecord in Records using @FM
|
||||
WO = WOMatRecord<1,1>
|
||||
CassNo = WOMatRecord<1,2>
|
||||
WOMatKey = WO : '*' : CassNo
|
||||
WO_MAT_SERVICES('SyncWOMatInvActionsAndSigProfile', WoMatKey)
|
||||
Next WOMatRecord
|
||||
end
|
||||
Unlock hSysLists, ServiceKeyID else Null
|
||||
end
|
||||
end service
|
||||
|
||||
Service SyncWOMatInvActionsAndSigProfile(WOMatKey)
|
||||
If RowExists('WO_MAT', WOMatKey) then
|
||||
OrigWOMatRec = Database_Services('ReadDataRow', 'WO_MAT', WOMatKey)
|
||||
WOMatRec = OrigWOMatRec
|
||||
SigProfile = WOMatRec<WO_MAT_SIG_PROFILE$>
|
||||
Sigs = WOMatRec<WO_MAT_SIGNATURE$>
|
||||
SigDtms = WOMatRec<WO_MAT_SIG_DTM$>
|
||||
OrigInvActions = WOMatRec<WO_MAT_INV_ACTION$>
|
||||
For each Stage in SigProfile using @VM setting vPos
|
||||
if SigDtms<0, vPos> NE '' then
|
||||
Locate Stage in OrigInvActions using @VM setting dummy else
|
||||
// Stage missing from material log
|
||||
InvDtms = WOMatRec<WO_MAT_INV_DTM$>
|
||||
StageSigDtm = SigDtms<0, vPos>
|
||||
Done = False$
|
||||
For each InvDtm in InvDtms using @VM setting Pos
|
||||
If InvDtm _GTX StageSigDtm then Done = True$
|
||||
Until Done
|
||||
Next InvDtm
|
||||
// Insert stage into material log
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_WH$,Pos,0,'CR')
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_LOCATION$,Pos,0,'FE')
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_ACTION$,Pos,0,Stage)
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_DTM$,Pos,0,StageSigDtm)
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_USER$,Pos,0,Sigs<0, vPos>)
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TAG$,Pos,0,'')
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TOOL_ID$,Pos,0,'')
|
||||
WOMatRec = INSERT(WOMatRec,WO_MAT_INV_SCAN_ENTRY$,Pos,0,0)
|
||||
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = WOMatKey
|
||||
LogData<3> = Stage
|
||||
LogData<4> = StageSigDtm
|
||||
LogData<5> = 'Adding To Record.'
|
||||
Logging_Services('AppendLog', objSyncLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
Next Stage
|
||||
If WOMatRec NE OrigWOMatRec then
|
||||
Database_Services('WriteDataRow', 'WO_MAT', WOMatKey, WOMatRec, True$, False$, True$)
|
||||
If Error_Services('NoError') then
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = WOMatKey
|
||||
LogData<3> = ''
|
||||
LogData<4> = ''
|
||||
LogData<5> = 'Successfully Wrote WO_Mat Record'
|
||||
Logging_Services('AppendLog', objSyncLog, LogData, @RM, @FM)
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = WOMatKey
|
||||
LogData<3> = ''
|
||||
LogData<4> = ''
|
||||
LogData<5> = 'Error writing WO_MAT record.'
|
||||
Logging_Services('AppendLog', objSyncLog, LogData, @RM, @FM)
|
||||
end
|
||||
end
|
||||
end else
|
||||
LogData = ''
|
||||
LogData<1> = LoggingDtm
|
||||
LogData<2> = WOMatKey
|
||||
LogData<3> = ''
|
||||
LogData<4> = ''
|
||||
LogData<5> = 'WO_MAT record did not exist in OpenInsight.'
|
||||
Logging_Services('AppendLog', objSyncLog, LogData, @RM, @FM)
|
||||
end
|
||||
end service
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user