implemented support for BatchConv SAP interface

This commit is contained in:
Infineon\StieberD
2024-09-30 13:10:50 -07:00
parent fdb12f206a
commit 95be15df83
16 changed files with 12030 additions and 3698 deletions

View File

@ -68,7 +68,7 @@ EQU CRLF$ TO \0D0A\
Equ Comma$ to ','
Declare function Database_Services, obj_NCR, obj_SAP, EpiPro_Services, obj_WO_Log, obj_WO_Mat, SRP_Array
Declare function Environment_Services, Logging_Services
Declare function Environment_Services, Logging_Services, MemberOf
Declare subroutine Error_Services, Database_Services, obj_NCR, obj_SAP, SAP_Services, Work_Order_Services
Declare subroutine Material_Services, Logging_Services, obj_Notes
@ -133,12 +133,13 @@ return
WFR_STATUS:
WMOKey = @ID
WfrStatus = ''
WMOSlots = Xlate('WM_OUT', WMOKey, 'RDS', 'X')
WMOZoneProfile = Xlate('WM_OUT', WMOKey, WM_OUT_ZONE$, 'X')
WMORDSTestKeys = XLATE('WM_OUT', WMOKey, 'CASS_RDS_MET_KEYS', 'X')
for each RDSNo in WMOSlots using @VM setting sPos
For each RDSNo in WMOSlots using @VM setting sPos
Result = ''
IF RDSNo NE '' then
@ -147,7 +148,7 @@ WFR_STATUS:
//Get the RDS_Test for this slot.
//Find the right RDS Test Key
ThisSlotRDSTestKeys = ''
for each RDSTestKey in WMORDSTestKeys using @VM
For each RDSTestKey in WMORDSTestKeys using @VM
RDSTestRec = Database_Services('ReadDataRow', 'RDS_TEST', RDSTestKey)
If RDSTestRec<RDS_TEST_ZONE$> EQ SlotZone AND RDSTestRec<RDS_TEST_RDS_NO$> EQ RDSNo then
ThisSlotRDSTestKeys<1, -1> = RDSTestKey
@ -156,31 +157,34 @@ WFR_STATUS:
IF ThisSlotRDSTestKeys NE '' then
RDSTestDataEntered = XLATE('RDS_TEST', ThisSlotRDSTestKeys, 'MET_ENTERED', 'X')
If RDSTestDataEntered NE '' then
Locate False$ in RDSTestDataEntered using @VM setting iPos then Result = 'ULMET' else
MetOutOfSpec = Sum(Xlate('RDS_TEST', ThisSlotRDSTestKeys, 'OUT_OF_SPEC', 'X'))
If MetOutOfSpec then
//Check for an NCR
SlotNcr = Xlate('WM_OUT', WMOKey, 'WM_OUT_SLOT_NCR', 'X')<1, sPos>
If SlotNcr NE '' then
MetOutOfSpec = False$
Locate False$ in RDSTestDataEntered using @VM setting iPos then
Result = 'ULMET'
end else
MetOutOfSpec = Sum(Xlate('RDS_TEST', ThisSlotRDSTestKeys, 'OUT_OF_SPEC', 'X'))
If MetOutOfSpec then
//Check for an NCR
SlotNcr = Xlate('WM_OUT', WMOKey, 'WM_OUT_SLOT_NCR', 'X')<1, sPos>
If SlotNcr NE '' then
MetOutOfSpec = False$
end
end
If MetOutOfSpec then
Result = 'SPEC'
end else
Result = 'ULOAD'
end
end
If MetOutOfSpec then
Result = 'SPEC'
end else
Result = 'ULOAD'
end
end
end else
Result = 'ULMET'
end
end else
Result = 'ULMET'
end
end else
Result = 'ULOAD'
Result = 'ULOAD'
end
end
end
WfrStatus<1, sPos> = Result
Next RDSNo
ActionFlow = WfrStatus
WfrStatus<1, sPos> = Result
Next RDSNo
ActionFlow = WfrStatus
Return
// ----- MFS calls -----------------------------------------------------------------------------------------------------
@ -200,9 +204,6 @@ READ_RECORD:
// OrigFileError = 100 : @FM : KeyID
// Status = 0
// Record = ''
* LockOwner = Record<WM_OUT_LOCKED_BY$>
* If LockOwner EQ '' then Record<WM_OUT_LOCKED_BY$> = @User4
return
READONLY_RECORD_PRE:
@ -263,11 +264,37 @@ WRITE_RECORD_PRE:
SaveRecord = Record
end
NewMUFlag = Record<WM_OUT_MAKEUP_BOX$>
OrigMUFlag = OrigRecord<WM_OUT_MAKEUP_BOX$>
If NewMUFlag NE OrigMUFlag then
SAPBatchNo = WOMatRec<WO_MAT_SAP_BATCH_NO$>
SAPTXDtm = WOMatRec<WO_MAT_SAP_TX_DTM$>
AwaitingBatchNo = ( (SAPTXDtm NE '') and (SAPBatchNo EQ '') )
FullBoxReject = (SAPBatchNo[-1, 1] = 'R')
Begin Case
Case AwaitingBatchNo
Error_Services('Add', 'Cassette ineligible to be converted as it is awaiting a batch number from SAP.')
OrigFileError = 104:': Cassette ineligible to be converted as it is awaiting a batch number from SAP.'
Status = 0
Record = ''
ActionFlow = ACTION_STOP$
Case FullBoxReject
Error_Services('Add', 'Cassette ineligible to be converted as it is a full box reject.')
OrigFileError = 104:': Cassette ineligible to be converted as it is a full box reject.'
Status = 0
Record = ''
ActionFlow = ACTION_STOP$
Case Otherwise$
Null
End Case
end
return
WRITE_RECORD:
WONo = {WO_NO}
SAPBatchNo = {SAP_BATCH_NO}
WMOKey = Name
CassNo = Field(WMOKey, '*', 3)
@ -288,18 +315,26 @@ WRITE_RECORD:
// Check MAKEUP_BOX flag. If False$ -> True$, then send CASS_COMP SAP transaction
MakeupBox = Record<WM_OUT_MAKEUP_BOX$>
MakeupBoxOrig = OrigRecord<WM_OUT_MAKEUP_BOX$>
If ( (MakeupBox EQ True$) and (MakeupBoxOrig NE True$) ) then
// Log this event
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Name
LogData<3> = @User4
LogData<4> = MakeupBox
LogData<5> = {WO_MAT_KEY}
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
// Send CASS_COMP SAP transaction
SAP_Services('AddCassCompTransaction', {WO_MAT_KEY})
end
Begin Case
Case ( (MakeupBox EQ True$) and ( (MakeupBoxOrig EQ False$) or (MakeupBoxOrig EQ '') ) and (SAPBatchNo EQ '') )
// Intial WIP to MU conversion -> Send CASS_COMP SAP transaction to get a batch number.
// Log this event
LogData = ''
LogData<1> = LoggingDTM
LogData<2> = Name
LogData<3> = @User4
LogData<4> = MakeupBox
LogData<5> = {WO_MAT_KEY}
Logging_Services('AppendLog', objLog, LogData, @RM, @FM)
SAP_Services('AddCassCompTransaction', {WO_MAT_KEY})
Case ( (MakeupBox EQ True$) and ( (MakeupBoxOrig EQ False$) or (MakeupBoxOrig EQ '') ) and (SAPBatchNo NE '') )
// Converting finished goods cassette into MU cassette -> Send BATCH_CONV transaction to SAP.
SAP_Services('AddBatchConvTransaction', {WO_MAT_KEY})
Case ( ( (MakeupBox EQ False$) or (MakeupBox EQ '') ) and (MakeupBoxOrig EQ True$) and (SAPBatchNo NE '') )
// Converting MU cassette into finished goods cassette -> Send BATCH_CONV transaction to SAP.
SAP_Services('AddBatchConvTransaction', {WO_MAT_KEY})
End Case
WOMatKey = {WO_MAT_KEY}
If MakeupBox then
@ -457,88 +492,11 @@ WRITE_RECORD:
return
DELETE_RECORD_PRE:
// Log which user and computer station attempted to delete the record
* LogData = ''
* LogData<1> = LoggingDTM
* LogData<2> = Name
* LogData<3> = @User4
* Logging_Services('AppendLog', objDeleteLog, LogData, @RM, @FM)
*
* // Send an LSL message to FI admins to alert them
* Recipients = Xlate('SEC_GROUPS', 'OI_ADMIN', 'USER', 'X')
* SentFrom = 'SYSTEM'
* Subject = 'WM_OUT Delete Attempt'
* Message = 'An attempt to delete WM_OUT record ':Name:' was made by ':@User4:'.'
* AttachWindow = ''
* AttachKey = ''
* SendToGroup = ''
*
* Parms = Recipients:@RM:SentFrom:@RM:Subject:@RM:Message:@RM:AttachWindow:@RM:AttachKey:@RM:SendToGroup
* obj_Notes('Create',Parms)
// Stop the system from deleting the record
* ActionFlow = ACTION_STOP$
return
DELETE_RECORD:
* WorkOrderNo = {WO_NO}
* CassNo = {WO_MAT_CASS_NO}
* WoMatKey = WorkOrderNo : '*' : CassNo
* WoMatRec = Database_Services('ReadDataRow', 'WO_MAT', WoMatKey)
* WMIKey = WoMatRec<WO_MAT_WMI_KEY$>
* WMOKey = WoMatRec<WO_MAT_WMO_KEY$>
* If WMIKey NE '' then
* WMIRec = Database_Services('ReadDataRow', 'WM_IN', WMIKey)
* Database_Services('WriteDataRow', 'WM_IN', WMIKey, WMIRec, True$, True$, False$)
* end
* If WMOKey NE '' then
* WMORec = Database_Services('ReadDataRow', 'WM_OUT', WMOKey)
* Database_Services('WriteDataRow', 'WM_OUT', WMOKey, WMORec, True$, True$, False$)
* end
* // If scrap after FQA and if not shipped -> send to SAP
* SAPOrderNO = XLATE('WO_LOG', WorkOrderNo, WO_LOG_PROD_ORD_NO$, 'X')
* IF SAPOrderNo NE '' THEN
* FQASig = ''
* FQADate = ''
* ReactorType = XLATE('WO_LOG', WorkOrderNo, 'REACT_TYPE', 'X')
*
* IF (ReactorType = 'EPP') OR (ReactorType = 'EpiPro') THEN
* StatusStage = '1MO_QA'
* FQASig = WoMatRec<WO_MAT_SIGNATURE$>
* FQADate = WoMatRec<WO_MAT_SIG_DTM$>
* WMOutKey = Xlate('WO_MAT', WoMatKey, 'WMO_KEY', 'X')
* CassStatus = Xlate('WM_OUT', WMOutKey, 'CURR_STATUS', 'X')
*
* END ELSE
* // Non-EpiPro
* StatusStage = '1QA'
* SigProfile = WoMatRec<WO_MAT_SIG_PROFILE$>
* Signatures = WoMatRec<WO_MAT_SIGNATURE$>
* SigDTMS = WoMatRec<WO_MAT_SIG_DTM$>
* LOCATE StatusStage IN SigProfile USING @VM SETTING Pos THEN
* FQASig = Signatures<1, Pos>
* FQADate = SigDTMS<1, Pos>
* end
* RDSNo = Xlate('WO_MAT', WoMatKey, 'RDS_NO', 'X')
* CassStatus = Xlate('RDS', RDSNo, 'CURR_STATUS', 'X')
* END
*
* If (FQASig NE '') and (FQADate NE '') and (CassStatus NE 'SHIP') and (CassStatus NE 'COMP') then
* // Add transaction
* NCRNo = @ID
* TransQty = Sum(obj_NCR('RejQty',NCRNo:@RM:Record))
* TransQty = TransQty * '-1'
*
* IF TransQty NE 0 THEN
* obj_SAP('AddTransaction','SCRAP_IN':@RM:WorkOrderNo:@RM:CassNo:@RM:TransQty)
* end
* end
* end
return
@ -587,5 +545,3 @@ Restore_System_Variables:
@FILE.ERROR = OrigFileError
return