diff --git a/LSL2/STPROC/COMM_DIALOG_WO_FIND.txt b/LSL2/STPROC/COMM_DIALOG_WO_FIND.txt index bce9a71..2aa152b 100644 --- a/LSL2/STPROC/COMM_DIALOG_WO_FIND.txt +++ b/LSL2/STPROC/COMM_DIALOG_WO_FIND.txt @@ -695,9 +695,15 @@ PerformQuery: end end - If ErrorMsg EQ '' then - WOKeys = SRP_Array('SortSimpleList', WOKeys, 'DescendingNumbers', @VM) - End_Dialog(@WINDOW,WOKeys) + If ErrorMsg EQ '' then + If WOKeys NE '' then + WOKeys = SRP_Array('SortSimpleList', WOKeys, 'DescendingNumbers', @VM) + End_Dialog(@WINDOW,WOKeys) + end else + Def = '' + Def = '*' + Msg(@Window, Def, 'OK', '', 'Query Results':@FM:'No work orders found') + end end else Msg(@Window, '', 'OK', '', 'Process Error':@FM:ErrorMsg) end diff --git a/LSL2/STPROC/DATABASE_SERVICES.txt b/LSL2/STPROC/DATABASE_SERVICES.txt index 6b226eb..eaea468 100644 --- a/LSL2/STPROC/DATABASE_SERVICES.txt +++ b/LSL2/STPROC/DATABASE_SERVICES.txt @@ -973,6 +973,7 @@ end service //---------------------------------------------------------------------------------------------------------------------- Service WriteDataColumn(TableName, KeyID, ColumnNo, Value, IgnoreSelfLock, IgnoreMFSRoutines, IgnoreAllLocks) + ErrorMsg = '' If TableName NE '' AND KeyID NE '' AND ColumnNo NE '' then If ( Num(ColumnNo) and (ColumnNo GT 0) ) then @@ -1009,7 +1010,13 @@ Service WriteDataColumn(TableName, KeyID, ColumnNo, Value, IgnoreSelfLock, Ignor end end If IgnoreAllLocks EQ False$ then + If Error_Services('HasError') then + ErrorMsg = Error_Services('GetMessage') + end Database_Services('ReleaseKeyIDLock', TableName, KeyID) + If ErrorMsg NE '' then + Error_Services('Add', ErrorMsg) + end end end else Error_Services('Add', 'Unable to lock ' : KeyID : ' for the ' : TableName : ' table in the ' : Service : ' service.') @@ -1109,4 +1116,3 @@ end service // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - diff --git a/LSL2/STPROC/NCR_ACTIONS.txt b/LSL2/STPROC/NCR_ACTIONS.txt index fc141ef..b1bc285 100644 --- a/LSL2/STPROC/NCR_ACTIONS.txt +++ b/LSL2/STPROC/NCR_ACTIONS.txt @@ -273,7 +273,8 @@ WRITE_RECORD: Next RDSNo If (OrgQty NE NewQty) then - Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateScrappedQty':SD$:WorkOrderNo) + ScrapAdj = NewQty - OrgQty + Work_Order_Services('AdjustScrappedQty', WorkOrderNo, ScrapAdj) end // On the write of the record, read then write associated WM_IN and WM_OUT records to trigger the WM_MFS. @@ -294,44 +295,41 @@ WRITE_RECORD: Database_Services('WriteDataRow', 'WM_OUT', WMOKey, WMORec, True$, True$, False$) end - SAPTestFlag = Xlate('APP_INFO', 'SAP_TEST_FLAG', 1, 'X') - If SAPTestFlag then - // If NCR created after cassette has received a batch number, then inform SAP of new quantities - SAPBatchNo = Xlate('WO_MAT', WOMatKey, 'SAP_BATCH_NO', 'X') - IF SAPBatchNo NE '' THEN - - IF (ReactorType = 'EPP') OR (ReactorType = 'EpiPro') THEN - WMOutKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X') - CassStatus = Xlate('WM_OUT', WMOutKey, 'CURR_STATUS', 'X') - - END ELSE - // Non-EpiPro - RDSNo = Xlate('WO_MAT', WoMatKey, 'RDS_NO', 'X') - CassStatus = Xlate('RDS', RDSNo, 'CURR_STATUS', 'X') - END - - // Add SAP transaction - IF OrigRecord = '' THEN - TransQty = NewQty - END ELSE - TransQty = NewQty - OrgQty - END - IF TransQty NE 0 THEN - obj_SAP('AddTransaction','SCRAP_IN':@RM:WorkOrderNo:@RM:CassNo:@RM:TransQty) - - If TransQty LT 0 then - // Log negative SAP scrap transaction to capture metrics to submit for SAP change request - LogData = '' - LogData<1> = LoggingDTM - LogData<2> = @User4 - LogData<3> = Name - LogData<4> = SAPBatchNo - LogData<5> = TransQty - Logging_Services('AppendLog', objSAPLog, LogData, @RM, @FM) - end - end - end - end + // If NCR created after cassette has received a batch number, then inform SAP of new quantities + SAPBatchNo = Xlate('WO_MAT', WOMatKey, 'SAP_BATCH_NO', 'X') + IF SAPBatchNo NE '' THEN + + IF (ReactorType = 'EPP') OR (ReactorType = 'EpiPro') THEN + WMOutKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X') + CassStatus = Xlate('WM_OUT', WMOutKey, 'CURR_STATUS', 'X') + + END ELSE + // Non-EpiPro + RDSNo = Xlate('WO_MAT', WoMatKey, 'RDS_NO', 'X') + CassStatus = Xlate('RDS', RDSNo, 'CURR_STATUS', 'X') + END + + // Add SAP transaction + IF OrigRecord = '' THEN + TransQty = NewQty + END ELSE + TransQty = NewQty - OrgQty + END + IF TransQty NE 0 THEN + obj_SAP('AddTransaction','SCRAP_IN':@RM:WorkOrderNo:@RM:CassNo:@RM:TransQty) + + If TransQty LT 0 then + // Log negative SAP scrap transaction to capture metrics to submit for SAP change request + LogData = '' + LogData<1> = LoggingDTM + LogData<2> = @User4 + LogData<3> = Name + LogData<4> = SAPBatchNo + LogData<5> = TransQty + Logging_Services('AppendLog', objSAPLog, LogData, @RM, @FM) + end + end + end OrigStatus = OrigRecord NewStatus = Record @@ -666,6 +664,7 @@ WRITE_RECORD: end end end + return DELETE_RECORD_PRE: @@ -746,11 +745,13 @@ DELETE_RECORD: Pass_To_SQL('WRITE', 'RDS', RDSNo) Next RDSNo - Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateScrappedQty':SD$:WorkOrderNo) + OrgQty = Sum(obj_NCR('RejQty',NCRNo:@RM:OrigRecord)) + NewQty = 0 + AdjustQty = NewQty - OrgQty + Work_Order_Services('AdjustScrappedQty', WorkOrderNo, AdjustQty) return - // ----- Internal Methods ---------------------------------------------------------------------------------------------- diff --git a/LSL2/STPROC/OBJ_RDS.txt b/LSL2/STPROC/OBJ_RDS.txt index 86e035d..6eb0a93 100644 --- a/LSL2/STPROC/OBJ_RDS.txt +++ b/LSL2/STPROC/OBJ_RDS.txt @@ -22,7 +22,7 @@ DECLARE FUNCTION Return_To_Fab_Services DECLARE FUNCTION Logging_Services, Environment_Services, Error_Services, Signature_Services, Lot_Services, Supplement_Services DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, obj_WO_Step, obj_RDS_Layer, obj_RDS_Test, obj_WM_In DECLARE SUBROUTINE Btree.Extract, RDS_React_Run, Environment_Services, Logging_Services, Error_Services, Send_Info -DECLARE SUBROUTINE SRP_Stopwatch, Database_Services, Lot_Services, Supplement_Services +DECLARE SUBROUTINE SRP_Stopwatch, Database_Services, Lot_Services, Supplement_Services, RDS_Services $INSERT MSG_EQUATES $INSERT WO_VERIFY_EQU @@ -375,6 +375,10 @@ Create: Result = '' END ELSE + RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo) + RDS_Services('VerifyWOMatRDSNoIndex', RDSNo) + RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo) + NewLotId = Lot_Services('CreateNewLot', 'RDS', '', WaferQty, SubPartNo, LotNo, SubVendCd, @User4, '', RDSNo) If Rds_Services('IsEpiPro', RDSNo) then @@ -1250,4 +1254,3 @@ CalcThickTarget: RETURN - diff --git a/LSL2/STPROC/OBJ_WM_IN.txt b/LSL2/STPROC/OBJ_WM_IN.txt index 1f6fc24..131ee91 100644 --- a/LSL2/STPROC/OBJ_WM_IN.txt +++ b/LSL2/STPROC/OBJ_WM_IN.txt @@ -20,7 +20,7 @@ DECLARE FUNCTION Get_Status, Msg, Utility, obj_Tables, NextKey, obj_WO_Verify, o DECLARE FUNCTION Database_Services, obj_RDS2, Logging_Services, Environment_Services, Error_Services DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, obj_WO_Step, obj_RDS_Layer, obj_RDS_Test, Update_Index DECLARE SUBROUTINE obj_Post_Log, obj_WO_Mat_Log,obj_WO_Wfr, Set_Property, Database_Services, Extract_SI_Keys -DECLARE SUBROUTINE Logging_Services, obj_Notes +DECLARE SUBROUTINE Logging_Services, obj_Notes, WM_In_Services $INSERT MSG_EQUATES $INSERT WO_LOG_EQU @@ -128,6 +128,9 @@ Create: LogData<7> = WaferQty Logging_Services('AppendLog', objLog, LogData, @RM, @FM) Done = True$ + WM_In_Services('VerifyWoStepWMIKeyIndex', WMInKey) + WM_In_Services('VerifyWOLogWMIKeyIndex', WMInKey) + WM_In_Services('VerifyWOMatWMIKeyIndex', WMInKey) end Until ( (NumAttempts EQ 10) or (Done EQ True$) ) Repeat @@ -940,6 +943,3 @@ RepProdTW: RETURN - - - diff --git a/LSL2/STPROC/OBJ_WM_OUT.txt b/LSL2/STPROC/OBJ_WM_OUT.txt index 53840e1..6cd61be 100644 --- a/LSL2/STPROC/OBJ_WM_OUT.txt +++ b/LSL2/STPROC/OBJ_WM_OUT.txt @@ -23,7 +23,7 @@ Declare Function Database_Services, SRP_Array, Return_To_Fab_Services Declare Subroutine Set_Status, Msg, obj_Tables, Send_Dyn, obj_WO_Step, obj_RDS_Layer, obj_RDS_Test, Btree.Extract Declare Subroutine Extract_SI_Keys, obj_WM_Out, obj_WO_Mat, obj_Post_Log, obj_WO_Mat_Log, ErrMsg, obj_WO_Wfr Declare Subroutine Logging_Services, Material_Services, Database_Services, Update_Index, Work_Order_Services -Declare Subroutine Service_Services, obj_Notes, Delay +Declare Subroutine Service_Services, obj_Notes, Delay, WM_Out_Services $Insert MSG_EQUATES $Insert APP_INSERTS @@ -40,7 +40,7 @@ $Insert CLEAN_INSP_EQUATES $Insert WMO_WFRS_EQUATES $Insert REACT_RUN_EQUATES -EQU NUM_RETRIES$ TO 50 +EQU NUM_RETRIES$ TO 60 ErrTitle = 'Error in Stored Procedure "obj_WM_Out"' ErrorMsg = '' @@ -115,13 +115,12 @@ Create: WONo = Parms[1,@RM] WOStep = Parms[COL2()+1,@RM] - NewCassNos = Parms[COL2()+1,@RM] + NewCassNo = Parms[COL2()+1,@RM] CassLoadQty = Parms[COL2()+1,@RM] - IF WONo = '' THEN ErrorMsg = 'Null Parameter "WONo" passed to routine. (':Method:')' IF WOStep = '' THEN ErrorMsg = 'Null Parameter "WOStep" passed to routine. (':Method:')' - IF NewCassNos = '' THEN ErrorMsg = 'Null Parameter "NewCassNos" passed to routine. (':Method:')' + IF NewCassNo = '' THEN ErrorMsg = 'Null Parameter "NewCassNo" passed to routine. (':Method:')' IF ErrorMsg NE '' THEN RETURN @@ -161,11 +160,8 @@ Create: WORec = XLATE('WO_LOG',WONo,'','X') InboundWaferQty = 0 - FOR I = 1 TO COUNT(NewCassNos,@VM) + (NewCassNos NE '') - NewCassNo = NewCassNos<1,I> - CassWfrQty = XLATE('WO_MAT',WONo:'*':NewCassNo,WO_MAT_WAFER_QTY$,'X') - InboundWaferQty += CassWfrQty - NEXT I + CassWfrQty = XLATE('WO_MAT',WONo:'*':NewCassNo,WO_MAT_WAFER_QTY$,'X') + InboundWaferQty += CassWfrQty WMOutKeys = XLATE('WO_STEP',WONo:'*':WOStep,WO_STEP_WM_OUT_KEYS$,'X') @@ -214,7 +210,7 @@ Create: OutOnlyCassIDs = '' ;* List of Outbound only Cassette IDs added 8/12/1011 JCH LOOP - UNTIL InboundWaferQty = 0 + UNTIL InboundWaferQty EQ 0 WMOutKey = WONo:'*':WOStep:'*':WMOCassNo WMOutRec = XLATE('WM_OUT',WMOutKey,'','X') ;* In case there is a partial box NewBoxFlag = '' @@ -250,7 +246,7 @@ Create: NumAttempts = 0 Loop NumAttempts += 1 - If NumAttempts GT 1 then Delay(NumAttempts) + If NumAttempts GT 1 then Delay(1) Database_Services('WriteDataRow', 'WM_OUT', WMOutKey, WMOutRec, True$, False$, False$) If Error_Services('HasError') then // Log the error @@ -272,6 +268,9 @@ Create: LogData<6> = WMOCassNo Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) Done = True$ + WM_Out_Services('VerifyWOLogWMOKeyIndex', WONo:'*':WOStep:'*':WMOCassNo) + WM_Out_Services('VerifyWOMatWMOKeyIndex', WONo:'*':WOStep:'*':WMOCassNo) + WM_Out_Services('VerifyWoStepWMOKeyIndex', WONo:'*':WOStep:'*':WMOCassNo) end Until ( (NumAttempts GT NUM_RETRIES$) or (Done EQ True$) ) Repeat @@ -1999,6 +1998,3 @@ ConvertCleanInsp: RETURN - - - diff --git a/LSL2/STPROC/OBJ_WO_LOG.txt b/LSL2/STPROC/OBJ_WO_LOG.txt index a9d65ed..f5dd28f 100644 --- a/LSL2/STPROC/OBJ_WO_LOG.txt +++ b/LSL2/STPROC/OBJ_WO_LOG.txt @@ -23,7 +23,7 @@ DECLARE SUBROUTINE Set_Status, Msg, obj_Tables, Send_Dyn, Btree.Extract, ErrMsg, DECLARE SUBROUTINE obj_Order_Change, obj_Vision, obj_Notes, obj_WM_In, obj_WM_Out, Msg, obj_WO_Mat, obj_Reprocess DECLARE SUBROUTINE obj_WO_Wfr, obj_WO_Step, Send_Info, obj_RDS2, obj_RDS, obj_Post_Log, obj_WO_Mat_Log, Sleepery DECLARE SUBROUTINE Environment_Services, Logging_Services, Error_Services, Database_Services, Update_Index -DECLARE SUBROUTINE Work_Order_Services, Delay, Transaction_Services +DECLARE SUBROUTINE Work_Order_Services, Delay, Transaction_Services, RDS_Services, WM_In_Services, WM_Out_Services $INSERT MSG_EQUATES $INSERT ORDER_EQU @@ -53,7 +53,7 @@ $INSERT LOGICAL $INSERT APPCOLORS $INSERT WM_IN_EQUATES -EQU NUM_RETRIES$ TO 50 +EQU NUM_RETRIES$ TO 60 EQU CRLF$ TO \0D0A\ EQU COMMA$ TO ',' @@ -103,7 +103,7 @@ BEGIN CASE CASE Method = 'OpenWONos' ; GOSUB OpenWONos CASE Method = 'ShipWONos' ; GOSUB ShipWONos CASE Method = 'WOStepStatus' ; GOSUB WOStepStatus - CASE Method = 'ReleaseCassettes' ; GOSUB ReleaseCassettes + CASE Method = 'ReleaseCassette' ; GOSUB ReleaseCassette CASE Method = 'RecallWO' ; GOSUB RecallWO CASE Method = 'ChangeLotNo' ; GOSUB ChangeLotNo CASE Method = 'ChangeCassQty' ; GOSUB ChangeCassQty @@ -967,11 +967,11 @@ RETURN * * * * * * * -ReleaseCassettes: +ReleaseCassette: * * * * * * * WONo = Parms[1,@RM] - CassNos = Parms[COL2()+1,@RM] + CassNo = Parms[COL2()+1,@RM] ReleaseUser = Parms[COL2()+1,@RM] RelDtm = Parms[COL2()+1,@RM] @@ -979,7 +979,7 @@ ReleaseCassettes: LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') LogData<2> = ReleaseUser LogData<3> = WONo - LogData<4> = 'WONo: ':WONo:' CassNos: ':CassNos:' ReleaseUser: ':ReleaseUser:' ||| Beginning ReleaseCassettes routine.' + LogData<4> = 'WONo: ':WONo:' CassNo: ':CassNo:' ReleaseUser: ':ReleaseUser:' ||| Beginning ReleaseCassette routine.' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) IF WONo = '' THEN ErrorMsg = 'Null parameter WONo passed to routine (':Method:').' @@ -1050,12 +1050,7 @@ ReleaseCassettes: OrdSummary = '' ;* Holds Order Detail Lot Numbers and Associated Order Item Numbers - CassCnt = COUNT(CassNos,@VM) + (CassNos NE '') - - WOMKeys = '' - FOR K = 1 TO CassCnt - WOMKeys<1,K> = WONo:'*':CassNos<1,K> - NEXT K + WOMKey = WONo:'*':CassNo WOMTableVar = Database_Services('GetTableHandle', 'WO_MAT') @@ -1065,7 +1060,7 @@ ReleaseCassettes: END LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' CassNos:':CassNos:' ||| Trace 1' + LogData<4> = 'WONo:':WONo:' CassNo:':CassNo:' ||| Trace 1' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) EpiPN = WORec @@ -1093,149 +1088,138 @@ ReleaseCassettes: // Log variables before obj_WM_Out('Create') LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' WMOLoadQty:':WMOLoadQty + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) IF ReactorType = 'EPP' THEN Send_Info('Creating WM_OUT records for WOStep ':WOStep:'...') - OutOnlyCassIDS = obj_WM_Out('Create',WONO:@RM:WOStep:@RM:CassNos:@RM:WMOLoadQty) + OutOnlyCassIDs = obj_WM_Out('Create',WONO:@RM:WOStep:@RM:CassNo:@RM:WMOLoadQty) END ELSE OutOnlyCassIDs = '' END StepRDSNos = '' - CassCnt = COUNT(CassNos,@VM) + (CassNos NE '') - // Log variables after obj_WM_Out('Create') LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2' + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - FOR N = 1 TO CassCnt + IF ReactorType EQ 'EPP' THEN - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.':N - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + CassWaferQty = XLATE('WO_MAT',WONo:'*':CassNo,WO_MAT_WAFER_QTY$,'X') + WMIKey = WONo:'*':WOStep:'*':CassNo + obj_WM_IN('Create',WONo:@RM:WOStep:@RM:CassNo:@RM:CassWaferQty) - CassNo = CassNos<1,N> + END ELSE - IF ReactorType EQ 'EPP' THEN + WOMatRec = XLATE('WO_MAT',WoNo:'*':CassNo,'','X') + RDSNoCheck = WOMatRec + If RDSNoCheck EQ '' then - CassWaferQty = XLATE('WO_MAT',WONo:'*':CassNo,WO_MAT_WAFER_QTY$,'X') - WMIKey = WONo:'*':WOStep:'*':CassNo - obj_WM_IN('Create',WONo:@RM:WOStep:@RM:CassNo:@RM:CassWaferQty) + CassLotNo = WOMatRec + CassWaferQty = WOMatRec + CassCustPartNo = WOMatRec + CassSubPartNo = WOMatRec + CassSubInvID = '' + CassOrderItem = WOMatRec + ReprocessedMat = WOMatRec + CassSubVendCd = WOMatRec - END ELSE + IF OrderNo = '' THEN + QuoteNo = '' + END ELSE + QuoteNo = XLATE('ORDER_DET',OrderNo:'*':CassOrderItem,ORDER_DET_QUOTE_NO$,'X') + END - WOMatRec = XLATE('WO_MAT',WoNo:'*':CassNo,'','X') - RDSNoCheck = WOMatRec - If RDSNoCheck EQ '' then + Parms = WONo:@RM + Parms := WOStep:@RM + Parms := LastStep:@RM + Parms := CassNo:@RM + Parms := QuoteNo:@RM + Parms := OrderNo:@RM + Parms := CassOrderItem:@RM + Parms := CustNo:@RM + Parms := PONo:@RM + Parms := ProcPSN:@RM + Parms := SubSupplyBy:@RM + Parms := SubPreClean:@RM + Parms := SubPostClean:@RM + Parms := PromiseDt:@RM + Parms := CassLotNo:@RM + Parms := CassCustPartNo:@RM + Parms := CassWaferQty:@RM + Parms := CassSubPartNo:@RM + Parms := '':@RM ;* QXJ Flag + Parms := CassSubVendCd + + IF ReactorType NE 'GAN' then - CassLotNo = WOMatRec - CassWaferQty = WOMatRec - CassCustPartNo = WOMatRec - CassSubPartNo = WOMatRec - CassSubInvID = '' - CassOrderItem = WOMatRec - ReprocessedMat = WOMatRec - CassSubVendCd = WOMatRec + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.1 - Start obj_RDS("Create")' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + Done = False$ + For AttemptIndex = 1 to NUM_RETRIES$ + If (AttemptIndex GT 1) then Delay(1) + NewRDSNo = obj_RDS('Create',Parms) + errCode = '' + Begin Case + Case Get_Status(errCode) + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.1.1 - Attempt ':AttemptIndex:'. Error calling obj_RDS("Create"). Error message: ':errCode + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + Case (NewRDSNo EQ 0) or (NewRDSNo EQ '') + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.1.1 - Attempt ':AttemptIndex:'. Error calling obj_RDS("Create"). Invalid RDSNo ':Quote(RDSNo):' returned.' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + Case RowExists('RDS', NewRDSNo) + Done = True$ + End Case + Until Done + Next AttemptIndex - IF OrderNo = '' THEN - QuoteNo = '' - END ELSE - QuoteNo = XLATE('ORDER_DET',OrderNo:'*':CassOrderItem,ORDER_DET_QUOTE_NO$,'X') - END + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.2 - End obj_RDS("Create")' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - Parms = WONo:@RM - Parms := WOStep:@RM - Parms := LastStep:@RM - Parms := CassNo:@RM - Parms := QuoteNo:@RM - Parms := OrderNo:@RM - Parms := CassOrderItem:@RM - Parms := CustNo:@RM - Parms := PONo:@RM - Parms := ProcPSN:@RM - Parms := SubSupplyBy:@RM - Parms := SubPreClean:@RM - Parms := SubPostClean:@RM - Parms := PromiseDt:@RM - Parms := CassLotNo:@RM - Parms := CassCustPartNo:@RM - Parms := CassWaferQty:@RM - Parms := CassSubPartNo:@RM - Parms := '':@RM ;* QXJ Flag - Parms := CassSubVendCd - - IF ReactorType NE 'GAN' then + If ( (NewRDSNo EQ 0) or (NewRDSNo EQ '') ) then - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.':N:'.1 - Start obj_RDS("Create")' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - Done = False$ - For AttemptIndex = 1 to NUM_RETRIES$ - If (AttemptIndex GT 1) then Delay(AttemptIndex) - NewRDSNo = obj_RDS('Create',Parms) - errCode = '' - Begin Case - Case Get_Status(errCode) - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.':N:'.1.1 - Attempt ':AttemptIndex:'. Error calling obj_RDS("Create"). Error message: ':errCode - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - Case (NewRDSNo EQ 0) or (NewRDSNo EQ '') - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.':N:'.1.1 - Attempt ':AttemptIndex:'. Error calling obj_RDS("Create"). Invalid RDSNo ':Quote(RDSNo):' returned.' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - Case RowExists('RDS', NewRDSNo) - Done = True$ - End Case - Until Done - Next AttemptIndex - - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 2.':N:'.2 - End obj_RDS("Create")' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - - If ( (NewRDSNo EQ 0) or (NewRDSNo EQ '') ) then - - ErrMsg(errCode) - ErrorMsg = "RDS '" : NewRDSNo : "' Create Failure - Check for missing data on Work Order" - If Error_Services('HasError') then - ErrMsg = Error_Services('GetMessage') - LogData = LoggingDTM : ',' : ReleaseUser : ',' : WONo : ',' : ErrMsg - Logging_Services('AppendLog', objLog, LogData, CRLF$, COMMA$, False$, '', LogData) - end - - RTParms = 'RDS' - FOR I = 1 TO COUNT(StepRdsNos,@VM) + (StepRdsNos NE '') - RdsNo = StepRdsNos<1,I> - RTParms = FieldStore(RTParms, @RM, 2, 1, RdsNo) - obj_Tables('DeleteRec',RTParms) - NEXT I - RETURN - END else - // No error creating RDS record -> add it to the batch list. - StepRDSNos<1,-1> = NewRDSNo + ErrMsg(errCode) + ErrorMsg = "RDS '" : NewRDSNo : "' Create Failure - Check for missing data on Work Order" + If Error_Services('HasError') then + ErrMsg = Error_Services('GetMessage') + LogData = LoggingDTM : ',' : ReleaseUser : ',' : WONo : ',' : ErrMsg + Logging_Services('AppendLog', objLog, LogData, CRLF$, COMMA$, False$, '', LogData) end - IF ReprocessedMat THEN - OrgRDSNo = CassLotNo - obj_Reprocess('FixUp',OrgRDSNo:@RM:NewRDSNo) - END - - END ;* End of check for GAN reactor - END ;* End of Check for existing RDS - END ;* End of check for EpiPRO reactor type - NEXT N + RTParms = 'RDS' + FOR I = 1 TO COUNT(StepRdsNos,@VM) + (StepRdsNos NE '') + RdsNo = StepRdsNos<1,I> + RTParms = FieldStore(RTParms, @RM, 2, 1, RdsNo) + obj_Tables('DeleteRec',RTParms) + NEXT I + RETURN + END else + // No error creating RDS record -> add it to the batch list. + StepRDSNos<1,-1> = NewRDSNo + end + + IF ReprocessedMat THEN + OrgRDSNo = CassLotNo + obj_Reprocess('FixUp',OrgRDSNo:@RM:NewRDSNo) + END + + END ;* End of check for GAN reactor + END ;* End of Check for existing RDS + END ;* End of check for EpiPRO reactor type NEXT WOStep LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3' + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) If RelDtm EQ '' then @@ -1251,95 +1235,91 @@ ReleaseCassettes: MaxShipQty = Xlate('WO_LOG', WONo, 'CUST_EPI_PART_SHIP_QTY', 'X') - FOR N = 1 TO CassCnt - WOMKey = WOMKeys<1,N> - CassNo = FIELD(WOMKey,'*',2) - // Keep trying to get the lock. Another process may be updating this record at the same time. - Done = False$ - For AttemptIndex = 1 to NUM_RETRIES$ + CassNo = FIELD(WOMKey,'*',2) + // Keep trying to get the lock. Another process may be updating this record at the same time. + Done = False$ + For AttemptIndex = 1 to NUM_RETRIES$ + + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + + If (AttemptIndex GT 1) then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_MAT', WOMKey, True$) + If HaveLock then LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - - If (AttemptIndex GT 1) then Delay(AttemptIndex) - HaveLock = Database_Services('GetKeyIDLock', 'WO_MAT', WOMKey) - If HaveLock then + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Have lock!' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + + WOMatRec = XLATE('WO_MAT',WOMKey,'','X') ;* We have the lock, so just get the record this way + + IF WOMatRec = '' THEN + WOMatRec = IConv(RelDTM,'DT') + WOMatRec = ReleaseUser + WOMatRec = PromiseDt - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Have lock!' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + IF SubPreClean = 'No' OR SubPreClean = '' THEN + WOMatRec = 'RTU' + END ELSE + WOMatRec = 'PREC' + END - WOMatRec = XLATE('WO_MAT',WOMKey,'','X') ;* We have the lock, so just get the record this way + WOMatRec = 'RTB' - IF WOMatRec = '' THEN - WOMatRec = IConv(RelDTM,'DT') - WOMatRec = ReleaseUser - WOMatRec = PromiseDt + thisInvDTM = ICONV(RelDTM,'DT') + + WHCd = 'SR' + LocCd = 'RB' + InvAction = 'REL' + ScanUserID = ReleaseUser + Tag = '' + ToolID = '' + + LOCATE thisInvDTM IN WOMatRec BY 'AR' USING @VM SETTING Pos ELSE - IF SubPreClean = 'No' OR SubPreClean = '' THEN - WOMatRec = 'RTU' - END ELSE - WOMatRec = 'PREC' - END + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_WH$,Pos,0,WHCd) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_LOCATION$,Pos,0,LocCd) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_ACTION$,Pos,0,InvAction) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_DTM$,Pos,0,thisInvDTM) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_USER$,Pos,0,ScanUserID) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TAG$,Pos,0,Tag) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TOOL_ID$,Pos,0,ToolID) + WOMatRec = INSERT(WOMatRec,WO_MAT_INV_SCAN_ENTRY$,Pos,0,False$) - WOMatRec = 'RTB' - - thisInvDTM = ICONV(RelDTM,'DT') - - WHCd = 'SR' - LocCd = 'RB' - InvAction = 'REL' - ScanUserID = ReleaseUser - Tag = '' - ToolID = '' - - LOCATE thisInvDTM IN WOMatRec BY 'AR' USING @VM SETTING Pos ELSE - - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_WH$,Pos,0,WHCd) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_LOCATION$,Pos,0,LocCd) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_ACTION$,Pos,0,InvAction) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_DTM$,Pos,0,thisInvDTM) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_USER$,Pos,0,ScanUserID) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TAG$,Pos,0,Tag) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_TOOL_ID$,Pos,0,ToolID) - WOMatRec = INSERT(WOMatRec,WO_MAT_INV_SCAN_ENTRY$,Pos,0,False$) - - END - - WOMatParms = 'WO_MAT':@RM:WOMKey:@RM:WOMTableVar:@RM:WOMatRec - obj_Tables('WriteRec',WOMatParms) ;* This writes and unlocks the WO_MAT records - - If Not(Get_Status(errCode)) then - Done = True$ - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Successfully updated WO_MAT record ':WOMKey:' with REL operation.' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - end else - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Failed to update WO_MAT record ':WOMKey:' with REL operation.' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - end - - IF ReactType = 'EPP' OR ReactType = 'GAN' THEN - obj_WO_Wfr('CassRel',WOMKey) ;* Added 3/17/2016 JCH for wafer history - END - END else + END + + WOMatParms = 'WO_MAT':@RM:WOMKey:@RM:WOMTableVar:@RM:WOMatRec + obj_Tables('WriteRec',WOMatParms) ;* This writes and unlocks the WO_MAT records + + If Not(Get_Status(errCode)) then + Done = True$ LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Error! REL_DTM is not null.' - Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Successfully updated WO_MAT record ':WOMKey:' with REL operation.' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) + end else + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Failed to update WO_MAT record ':WOMKey:' with REL operation.' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) end + + IF ReactType = 'EPP' OR ReactType = 'GAN' THEN + obj_WO_Wfr('CassRel',WOMKey) ;* Added 3/17/2016 JCH for wafer history + END + END else + LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 3.':AttemptIndex:' Error! REL_DTM is not null.' + Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) end - Until Done - Next AttemptIndex + end + Until Done + Next AttemptIndex - NEXT N - LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 4' + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 4' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) - OutOnlyCnt = COUNT(OutOnlyCassIDs,@VM) + (OutOnlyCassIDs NE '') + OutOnlyCnt = DCount(OutOnlyCassIDs, @VM) ExistingWOMatKeys = WORec NewWOMatKeys = ExistingWOMatKeys FOR I = 1 TO OutOnlyCnt @@ -1351,7 +1331,7 @@ ReleaseCassettes: NEXT I LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Trace 5' + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Trace 5' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) ReactNos = obj_Sched('GetReactNos',WONo) ; // 5/26/2-15 JCH Added schedule ReactNos and check for WO_START_DTM$ @@ -1401,12 +1381,12 @@ ReleaseCassettes: If ErrorMsg NE '' then LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Error Message: ':ErrorMsg + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Error Message: ':ErrorMsg Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) end LogData<1> = Oconv(Date(), 'D4/') : ' ' : Oconv(Time(), 'MTS') - LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNos:':CassNos:' CassCnt:':CassCnt:' WMOLoadQty:':WMOLoadQty:' ||| Ending ReleaseCassettes routine' + LogData<4> = 'WONo:':WONo:' WOStep:':WOStep:' CassNo:':CassNo:' WMOLoadQty:':WMOLoadQty:' ||| Ending ReleaseCassette routine' Logging_Services('AppendLog', objReleaseLog, LogData, @RM, @FM) RETURN @@ -2348,7 +2328,6 @@ Route: IF Get_Status(errCode) THEN RETURN - WOStepKeys = WOLogRec IF WOStepKeys NE '' THEN @@ -2386,7 +2365,6 @@ Route: DefWMOCassQtys = XLATE('CUST_EPI_PART',CustNo:'*':EpiPartNo,CUST_EPI_PART_WMO_LOAD_CNT$,'X') - WOStepKeys = '' DefWMOCassQty = '' @@ -2418,8 +2396,43 @@ Route: WOLogRec = EpiPN END - WOLogRec = ProdVerNo - WOLogRec = CustNo + WOLogRec = ProdVerNo + WOLogRec = CustNo + + WOQty = WOLogRec + If WOQty EQ '' then + WOQty = 0 + WOLogRec = WOQty + end + RxQty = WOLogRec + If RxQty EQ '' then + RxQty = 0 + WOLOgRec = RxQty + end + RelQty = WOLogRec + If RelQty EQ '' then + RelQty = 0 + WOLogRec = RelQty + end + UnRelQty = WOLogRec + If UnRelQty EQ '' then + UnRelQty = WOQty - RelQty + end + OpenQty = WOLogRec + If OpenQty EQ '' then + OpenQty = WOQty - RxQty + WOLogRec = OpenQty + end + ScrapQty = WOLogRec + If ScrapQty EQ '' then + ScrapQty = 0 + WOLogRec = ScrapQty + end + ShippedQty = WOLogRec + If ShippedQty EQ '' then + ShippedQty = 0 + WOLogRec = ShippedQty + end otParms = FIELDSTORE(otParms,@RM,4,0,WOLogRec) obj_Tables('WriteRec',otParms) diff --git a/LSL2/STPROC/OBJ_WO_MAT_QA.txt b/LSL2/STPROC/OBJ_WO_MAT_QA.txt index 097db74..80ab987 100644 --- a/LSL2/STPROC/OBJ_WO_MAT_QA.txt +++ b/LSL2/STPROC/OBJ_WO_MAT_QA.txt @@ -551,23 +551,32 @@ RemQAMet: IF WOMatQARec = '' THEN - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_PROFILE$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_PROP$,DelPos,0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_TOOL_CLASS$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STAGE$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MIN$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MAX$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SLOT$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_RECIPE$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_RECIPE_PATTERN$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SIG$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SIG_DTM$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STD_MAX$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STD_RESULT$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_WFR_QTY$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_WFR_TYPE$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_REACT_SCHED$, DelPos, 0) - WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SHIP_DOC$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_PROFILE$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_PROP$,DelPos,0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_TOOL_CLASS$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STAGE$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MIN$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MAX$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SLOT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_RECIPE$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_RECIPE_PATTERN$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SIG$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SIG_DTM$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STD_MAX$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_STD_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_WFR_QTY$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_WFR_TYPE$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_REACT_SCHED$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_SHIP_DOC$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_DATA_POINTS$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MIN_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_MAX_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_RANGE_PCT_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_EDGE_MEAN_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_5MM_PCT_RESULT$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_OUT_OF_SPEC$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_PHASE_MIN$, DelPos, 0) + WOMatQARec = DELETE(WOMatQARec, WO_MAT_QA_FAIL_REASON$, DelPos, 0) otParms = FIELDSTORE(otParms,@RM,4,0,WOMatQARec) obj_Tables('WriteRec',otParms) @@ -754,5 +763,3 @@ QAResults: RETURN - - diff --git a/LSL2/STPROC/RDS_ACTIONS.txt b/LSL2/STPROC/RDS_ACTIONS.txt index f1885d5..f439392 100644 --- a/LSL2/STPROC/RDS_ACTIONS.txt +++ b/LSL2/STPROC/RDS_ACTIONS.txt @@ -68,7 +68,7 @@ Declare function Tool_Parms_Services, Signature_Services, obj_WO_Mat_QA, Date Declare function Rds_Services, SRP_DateTime, SRP_Math, obj_WO_Mat, Lot_Services, SRP_Array Declare function Lot_Event_Services, GetTickCount, Work_Order_Services Declare subroutine Error_Services, Database_Services, Logging_Services, Service_Services, obj_WO_React -Declare Subroutine Mona_Services +Declare Subroutine Mona_Services, Work_Order_Services LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS' LogDate = Oconv(Date(), 'D4/') @@ -916,7 +916,12 @@ WRITE_RECORD: OrigPocketChar = OrigRecord NewPocketChar = Record If (OrigPocketChar NE NewPocketChar) then - Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateScrappedQty':SD$:WONo) + OrigScrapQty = Count(OrigPocketChar, 'TEST') + NewScrapQty = Count(NewPocketChar, 'TEST') + AdjustQty = NewScrapQty - OrigScrapQty + If AdjustQty NE 0 then + Work_Order_Services('AdjustScrappedQty', WONo, AdjustQty) + end end If {WO} NE '' then Service_Services('PostProcedure', 'RDS_SERVICES', 'VerifyWOLogRDSKeyIndex':SD$:Name) @@ -1018,3 +1023,4 @@ Restore_System_Variables: return + diff --git a/LSL2/STPROC/RDS_SERVICES.txt b/LSL2/STPROC/RDS_SERVICES.txt index bfc1c0e..ac97ab0 100644 --- a/LSL2/STPROC/RDS_SERVICES.txt +++ b/LSL2/STPROC/RDS_SERVICES.txt @@ -131,11 +131,13 @@ EQU NEW_EXIST$ To 0 ; * Reduce Mode 0 equ NEXT_CUR$ To 1 equ ADD_EXIST$ to 2 +Equ NUM_ATTEMPTS$ to 60 + AutoDisplayErrors = FALSE$ ; // Set this to True$ when debugging so all errors will automatically display. Declare subroutine SRP_Stopwatch, Error_Services, obj_Tables, Metrology_Services, obj_RDS_Test, SRP_JSON, Logging_Services Declare subroutine RTI_Set_Debugger, Database_Services, Btree.Extract, Extract_SI_Keys, Obj_WO_Mat, Obj_WO_Mat_Log -Declare subroutine Dialog_Box, Obj_Notes, RList, Set_Status, Errmsg, Obj_React_Status, Reactor_Services +Declare subroutine Dialog_Box, Obj_Notes, RList, Set_Status, Errmsg, Obj_React_Status, Reactor_Services, Delay Declare subroutine Rds_Services, Obj_Post_Log, Mona_Services, Transaction_Services, Reduce, Update_Index Declare function SRP_Sort_Array, Metrology_Services, obj_RDS_Test, obj_Test_Point_Map, Database_Services Declare function Work_Order_Services, SRP_JSON, Logging_Services, Environment_Services, SRP_Trim, Error_Services @@ -2259,10 +2261,9 @@ Service VerifyWOMatRDSNoIndex(RDSNo) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_MAT{RDS_NO} Log.csv' Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOMatKey':@FM:'Result' objVerifyRDSNoLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = RDSNo LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) @@ -2273,35 +2274,48 @@ Service VerifyWOMatRDSNoIndex(RDSNo) WOMatKey = Xlate('RDS', RDSNo, 'WO_MAT_KEY', 'X') If WOMatKey NE '' then WOMatRDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X') + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WOMatKey Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) If WOMatRDSNo EQ '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'RDSNo missing from WO_MAT record. Generating index transaction.' Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) // Add index transaction to update RDS_NO relational index (target WO_MAT table) IndexTransactionRow = 'WO_MAT*RDS_NO*AR':@FM:RDSNo:@FM:"":@FM:WOMatKey:@FM Open "!RDS" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo end else - ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo - end else - ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'Index ok. RDSNo not missing from WO_MAT record.' Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WO_MAT key for RDS ':RDSNo:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) end @@ -2309,10 +2323,12 @@ Service VerifyWOMatRDSNoIndex(RDSNo) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyRDSNoLog, LogData, @RM, @FM) @@ -2323,16 +2339,15 @@ end service Service VerifyWOStepRDSKeyIndex(RDSNo) - LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS' - LogDate = Oconv(Date(), 'D4/') - LogTime = Oconv(Time(), 'MTS') - LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_STEP{RDS_KEY} Log.csv' - Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result' + LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\RDS' + LogDate = Oconv(Date(), 'D4/') + LogTime = Oconv(Time(), 'MTS') + LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS WO_STEP{RDS_KEY} Log.csv' + Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result' objVerifyRDSKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = RDSNo LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) @@ -2343,35 +2358,48 @@ Service VerifyWOStepRDSKeyIndex(RDSNo) WOStepKey = Xlate('RDS', RDSNo, 'WO_STEP_KEY', 'X') If WOStepKey NE '' then WOStepRDSKeys = Xlate('WO_STEP', WOStepKey, 'RDS_KEY', 'X') + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WOStepKey Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) Locate RDSNo in WOStepRDSKeys using @VM setting vPos then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'Index ok. RDSNo not missing from WO_STEP record.' Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'RDSNo missing from WO_STEP record. Generating index transaction.' Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) // Add index transaction to update RDS_KEY relational index (target WO_STEP table) IndexTransactionRow = 'WO_STEP*RDS_KEY*AR':@FM:RDSNo:@FM:"":@FM:WOStepKey:@FM Open "!RDS" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo end else - ErrorMsg = 'Unable to write index transaction to !RDS. ':RDSNo + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo - end else - ErrorMsg = 'Unable to Lock !RDS to add index transaction. ':RDSNo - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !RDS to add index transaction. ':RDSNo end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WO_STEP key for RDS ':RDSNo:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) end @@ -2379,10 +2407,12 @@ Service VerifyWOStepRDSKeyIndex(RDSNo) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyRDSKeyLog, LogData, @RM, @FM) @@ -2399,10 +2429,9 @@ Service VerifyWOLogRDSKeyIndex(RDSNo) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !RDS RDS{WO} Log.csv' Headers = 'Logging DTM':@FM:'RDSNo':@FM:'WOStep':@FM:'Result' objVerifyRDSWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = RDSNo LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) @@ -2417,32 +2446,44 @@ Service VerifyWOLogRDSKeyIndex(RDSNo) LogData<3> = WONo Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) Locate RDSNo in WOLogRDSKeys using @VM setting vPos then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'Index ok. RDSNo not missing from Btree index.' Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'RDSNo missing from Btree index. Generating index transaction.' Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) // Add index transaction to update RDS_KEY relational index (target WO_STEP table) IndexTransactionRow = 'WO':@FM:RDSNo:@FM:"":@FM:WONo:@FM Open "!RDS" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !RDS. ':RDSNo + end + Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo end else - ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !RDS. ':RDSNo + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Unable to Lock !RDS to add index transaction. ':RDSNo + end end - Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo - end else - ErrorMsg = 'Error in ':Service:' service. Unable to Lock !RDS to add index transaction. ':RDSNo - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Error in ':Service:' service. Unable to Open !RDS to add index transaction. ':RDSNo end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WONo for RDS ':RDSNo:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) end @@ -2452,10 +2493,12 @@ Service VerifyWOLogRDSKeyIndex(RDSNo) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyRDSWoIndexLog, LogData, @RM, @FM) diff --git a/LSL2/STPROC/SCHEDULE_SERVICES.txt b/LSL2/STPROC/SCHEDULE_SERVICES.txt index e39a49f..62f826e 100644 --- a/LSL2/STPROC/SCHEDULE_SERVICES.txt +++ b/LSL2/STPROC/SCHEDULE_SERVICES.txt @@ -3719,6 +3719,226 @@ Service SendRefreshMessage() end service + +Service AdjustWorkOrderScheduleQty(WONo, ModifyQty) + + ErrorMsg = '' + Begin Case + Case (WONo EQ '') + ErrorMsg = 'Error in ':Service:' service. WONo cannot be null.' + Case (ModifyQty EQ '') + ErrorMsg = 'Error in ':Service:' service. ModifyQty cannot be null.' + End Case + + If (ErrorMsg EQ '') then + + WOQty = Xlate('WO_LOG', WONo, 'WO_QTY', 'X') + OrigQty = WOQty - ModifyQty + NewQty = WOQty + ModifyQty + + SchedDetNGKey = '' + + Begin Case + Case ModifyQty GT 0 + + LogData = '' + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<2> = 'WO_LOG_ACTIONS' + LogData<3> = 'Work order ':WONo:' quantity increased from ':OrigQty:' to ':NewQty:'.' + Schedule_Services('LogActivity', '', LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Searching for a scheduled event to increase the quantity.' + Schedule_Services('LogActivity', '', LogData, False$) + + // Search schedule for most recent event and increase that event quantity by the difference. + Query = 'SELECT SCHED_DET_NG WITH WO_NO EQ ':WONo:' BY-DSND STOP_DTM' + GoSub ClearCursors + Set_Status(0) + RList(Query, TARGET_ACTIVELIST$, '', '', False$) + errCode = '' + If Get_Status(errCode) then + + ErrorMsg = 'Error retrieving event list in WO_LOG_Actions. RList error code ':errCode:'.' + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = ErrorMsg + Schedule_Services('LogActivity', '', LogData, False$) + + Error_Services('Add', ErrorMsg) + + end else + + EOF = False$ + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Query successful. Number of keys found: ':@RecCount:'.' + Schedule_Services('LogActivity', '', LogData, False$) + + ReadNext SchedDetNGKey else EOF = True$ + If SchedDetNGKey NE '' then + EventRec = Database_Services('ReadDataRow', 'SCHED_DET_NG', SchedDetNGKey) + StopDTM = EventRec + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Work order record ':WONo:' quantity increased from ':OrigQty:' to ':NewQty:'.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Scheduled event ':SchedDetNGKey:' found.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + // Only modify the event if it is still running or is scheduled in the future. + If StopDTM GT Datetime() then + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' less than current DTM, so increasing event quantity.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + ReactNo = EventRec + WONo = EventRec + StartDTM = EventRec + Desc = EventRec + EventQty = EventRec + NewEventQty = EventQty + ModifyQty + Schedule_Services('ModifySchedEvent', SchedDetNGKey, ReactNo, WONo, StartDTM, StopDTM, Desc, NewEventQty) + // Adjust reactor events as needed. + Schedule_Services('AdjustScheduleEvents', ReactNo) + + end else + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' greater than current DTM.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event quantity not increased.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + end + end + end + GoSub ClearCursors + Case ModifyQty LT 0 + + LogData = '' + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<2> = 'WO_LOG_ACTIONS' + LogData<3> = 'Work order ':WONo:' quantity decreased from ':OrigQty:' to ':NewQty:'.' + Schedule_Services('LogActivity', '', LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Searching for a scheduled event to decrease the quantity.' + Schedule_Services('LogActivity', '', LogData, False$) + + // Search schedule for most recent events and decrease/delete those events as needed. + Query = 'SELECT SCHED_DET_NG WITH WO_NO EQ ':WONo:' BY-DSND STOP_DTM' + GoSub ClearCursors + Set_Status(0) + RList(Query, TARGET_ACTIVELIST$, '', '', False$) + errCode = '' + + If Get_Status(errCode) then + + ErrorMsg = 'Error retrieving event list in WO_LOG_Actions. RList error code ':errCode:'.' + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = ErrorMsg + Schedule_Services('LogActivity', '', LogData, False$) + + Error_Services('Add', ErrorMsg) + + end else + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Query successful. Number of keys found: ':@RecCount:'.' + Schedule_Services('LogActivity', '', LogData, False$) + + EOF = False$ + Done = False$ + UpdateReq = False$ + Loop + ReadNext SchedDetNGKey else EOF = True$ + Until EOF EQ True$ + If SchedDetNGKey NE '' then + EventRec = Database_Services('ReadDataRow', 'SCHED_DET_NG', SchedDetNGKey) + StopDTM = EventRec + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Work order record ':WONo:' quantity decreased from ':OrigQty:' to ':NewQty:'.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Scheduled event ':SchedDetNGKey:' found.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + // Only modify the event if it is still running or is scheduled in the future. + If StopDTM GT Datetime() then + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' less than current DTM, so decreasing event quantity.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + UpdateReq = True$ + ReactNo = EventRec + WONo = EventRec + StartDTM = EventRec + Desc = EventRec + EventQty = EventRec + If EventQty GT Abs(ModifyQty) then + + // This event has enough wafers, so just reduce the quantity. + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event quantity ':EventQty:' greater than quantity reduction ':ModifyQty:', so decreasing event quantity.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + Done = True$ + NewEventQty = EventQty + ModifyQty + Schedule_Services('ModifySchedEvent', SchedDetNGKey, ReactNo, WONo, StartDTM, StopDTM, Desc, NewEventQty) + + end else + + // This event has fewer wafers than are being removed. Delete this event and continue + // onto the next event. + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event quantity ':EventQty:' less than quantity reduction ':ModifyQty:', so canceling event.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + Schedule_Services('CancelScheduleEvent', SchedDetNGKey, True$) + ModifyQty += EventQty + + end + end else + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' greater than current DTM.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + LogData<1> = OConv(Datetime(), 'DT2/^H') + LogData<3> = 'Event quantity not decreased.' + Schedule_Services('LogActivity', EventRec, LogData, False$) + + end + end + Until Done EQ True$ + Repeat + If UpdateReq then + // Adjust reactor events as needed. + Schedule_Services('AdjustScheduleEvents', ReactNo) + end + end + GoSub ClearCursors + + Case Otherwise$ + Null + End Case + + end + + If ErrorMsg NE '' then Error_Services('Add', ErrorMsg) + +end service + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal GoSubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/LSL2/STPROC/TW_USE_ACTIONS.txt b/LSL2/STPROC/TW_USE_ACTIONS.txt index ec61b6d..566564b 100644 --- a/LSL2/STPROC/TW_USE_ACTIONS.txt +++ b/LSL2/STPROC/TW_USE_ACTIONS.txt @@ -155,17 +155,23 @@ WRITE_RECORD_PRE: return WRITE_RECORD: + OrigQty = OrigRecord - NewQty = Record + NewQty = Record OrigSig = OrigRecord - NewSig = OrigRecord + NewSig = OrigRecord - If OrigRecord EQ '' or OrigQty NE NewQty or OrigSig NE NewSig then + If ( (OrigRecord EQ '') or (OrigQty NE NewQty) or (OrigSig NE NewSig) ) then MetrologyID = Field(Name, '*', 1) RDSNo = Xlate('RDS_TEST', MetrologyID, RDS_TEST_RDS_NO$, 'X') - Service_Services('PostProcedure', 'RDS_SERVICES', 'AllTWUseSigned':SD$:RDSNo) end + + If (OrigQty NE NewQty) then + ScrapAdj = NewQty - OrigQty + Work_Order_Services('AdjustScrappedQty', {WO_NO}, ScrapAdj) + end + return DELETE_RECORD_PRE: @@ -180,6 +186,11 @@ DELETE_RECORD: LogData<3> = Name Logging_Services('AppendLog', objLog, LogData, @RM, @FM) + OrigQty = OrigRecord + NewQty = 0 + ScrapAdj = NewQty - OrigQty + Work_Order_Services('AdjustScrappedQty', {WO_NO}, ScrapAdj) + return @@ -228,3 +239,4 @@ Restore_System_Variables: @FILE.ERROR = OrigFileError return + diff --git a/LSL2/STPROC/WM_IN_SERVICES.txt b/LSL2/STPROC/WM_IN_SERVICES.txt index 67d758d..cf3f93c 100644 --- a/LSL2/STPROC/WM_IN_SERVICES.txt +++ b/LSL2/STPROC/WM_IN_SERVICES.txt @@ -60,6 +60,8 @@ $Insert CUST_EPI_PART_EQUATES $Insert QUOTE_SPEC_EQU $Insert WO_STEP_EQUATES +Equ NUM_ATTEMPTS$ to 60 + EQU PI$LEFT TO 1 EQU PI$TOP TO 2 EQU PI$RIGHT TO 3 @@ -77,7 +79,7 @@ EQU PS$PATTERN TO 11 Declare function PSN_Services, SRP_Rotate_Array, Datetime, Database_Services, Environment_Services, Logging_Services Declare function obj_Install, SRP_Json Declare subroutine Database_Services, Set_Status, obj_Wo_Mat_Log, Logging_Services, Extract_Si_Keys, Btree.Extract -Declare subroutine SRP_Json +Declare subroutine SRP_Json, Update_Index, Delay GoToService else Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.') @@ -218,19 +220,27 @@ Service VerifyWoStepWMIKeyIndex(WMIKey) // Add index transaction to update WM_IN_KEYS relational index (target WO_STEP table) IndexTransactionRow = 'WO_STEP*WM_IN_KEYS*AR':@FM:WMIKey:@FM:"":@FM:WOStepKey:@FM Open "!WM_IN" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWMIKeyLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey end else - ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey - end else - ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey end @@ -263,10 +273,9 @@ Service VerifyWOLogWMIKeyIndex(WMIKey) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_IN WM_IN{WO_NO} Log.csv' Headers = 'Logging DTM':@FM:'WMIKey':@FM:'WOStep':@FM:'Result' objVerifyWMIWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = WMIKey LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) @@ -278,32 +287,44 @@ Service VerifyWOLogWMIKeyIndex(WMIKey) If WONo NE '' then WOLogRDSKeys = '' Extract_Si_Keys('WM_IN', 'WO_NO', WONo, WOLogRDSKeys) + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WONo Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) Locate WMIKey in WOLogRDSKeys using @VM setting vPos else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WMIKey missing from Btree index. Generating index transaction.' Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) // Add index transaction to update WO_NO btree index IndexTransactionRow = 'WO_NO':@FM:WMIKey:@FM:"":@FM:WONo:@FM Open "!WM_IN" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_IN. ':WMIKey + end + Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_IN to add index transaction. ':WMIKey end else - ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_IN. ':WMIKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_IN to add index transaction. ':WMIKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_IN to add index transaction. ':WMIKey - end else - ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_IN to add index transaction. ':WMIKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_IN to add index transaction. ':WMIKey end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WONo for WM_IN ':WMIKey:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) end @@ -313,10 +334,12 @@ Service VerifyWOLogWMIKeyIndex(WMIKey) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyWMIWoIndexLog, LogData, @RM, @FM) @@ -333,10 +356,9 @@ Service VerifyWOMatWMIKeyIndex(WMIKey) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_IN WO_MAT{WMI_KEY} Log.csv' Headers = 'Logging DTM':@FM:'WMIKey':@FM:'WOMatKey':@FM:'Result' objVerifyWoMatWmiKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = WMIKey LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) @@ -347,32 +369,44 @@ Service VerifyWOMatWMIKeyIndex(WMIKey) WOMatKey = Field(WMIKey, '*', 1, 1):'*':Field(WMIKey, '*', 3, 1) If WOMatKey NE '' then WOMatWMIKey = Xlate('WO_MAT', WOMatKey, 'WMI_KEY', 'X') + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WOMatKey Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) If WOMatWMIKey EQ '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WMIKey missing from WO_MAT record. Generating index transaction.' Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) // Add index transaction to update WMI_KEY relational index (target WO_MAT table) IndexTransactionRow = 'WO_MAT*WMI_KEY*TOP':@FM:WMIKey:@FM:"":@FM:WOMatKey:@FM Open "!WM_IN" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey end else - ErrorMsg = 'Unable to write index transaction to !WM_IN. ':WMIKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey - end else - ErrorMsg = 'Unable to Lock !WM_IN to add index transaction. ':WMIKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !WM_IN to add index transaction. ':WMIKey end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WO_MAT key for WM_IN ':WMIKey:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) end @@ -380,10 +414,12 @@ Service VerifyWOMatWMIKeyIndex(WMIKey) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyWoMatWmiKeyLog, LogData, @RM, @FM) diff --git a/LSL2/STPROC/WM_OUT_SERVICES.txt b/LSL2/STPROC/WM_OUT_SERVICES.txt index d5582f5..1e35338 100644 --- a/LSL2/STPROC/WM_OUT_SERVICES.txt +++ b/LSL2/STPROC/WM_OUT_SERVICES.txt @@ -57,18 +57,20 @@ $Insert WO_MAT_EQUATES $Insert WO_LOG_EQUATES $Insert COMPANY_EQUATES $Insert RETURN_TO_FAB_LOTS_EQUATES -$INSERT PROD_SPEC_EQUATES -$INSERT WO_STEP_EQUATES -$INSERT EPI_PART_EQUATES -$INSERT CUST_EPI_PART_EQUATES -$INSERT PRS_STAGE_EQUATES -$insert UNIT_EQUATES +$Insert PROD_SPEC_EQUATES +$Insert WO_STEP_EQUATES +$Insert EPI_PART_EQUATES +$Insert CUST_EPI_PART_EQUATES +$Insert PRS_STAGE_EQUATES +$Insert UNIT_EQUATES + +Equ NUM_ATTEMPTS$ to 60 Declare function Database_Services, SRP_JSON, Error_Services, Clean_Insp_Services, WO_Mat_QA_Services Declare function PSN_Services, SRP_Rotate_Array, Datetime, Return_To_Fab_Services, Environment_Services Declare function Logging_Services Declare subroutine Database_Services, SRP_JSON, Error_Services, Extract_Si_Keys, Set_Status, obj_wo_mat_log -Declare subroutine Logging_Services, Btree.Extract +Declare subroutine Logging_Services, Btree.Extract, Update_Index, Delay GoToService else Error_Services('Set', Service : ' is not a valid service request within the ' : ServiceModule : ' services module.') @@ -458,10 +460,9 @@ Service VerifyWoStepWMOKeyIndex(WMOKey) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_STEP{WM_OUT_KEYS} Log.csv' Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result' objVerifyWMOKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = WMOKey LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) @@ -472,32 +473,44 @@ Service VerifyWoStepWMOKeyIndex(WMOKey) WOStepKey = Field(WMOKey, '*', 1, 2) If WOStepKey NE '' then WOStepWMOKeys = Xlate('WO_STEP', WOStepKey, 'WM_OUT_KEYS', 'X') + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WOStepKey Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) Locate WMOKey in WOStepWMOKeys using @VM setting vPos else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WMOKey missing from WO_STEP record. Generating index transaction.' Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) // Add index transaction to update WM_OUT_KEYS relational index (target WO_STEP table) IndexTransactionRow = 'WO_STEP*WM_OUT_KEYS*AR':@FM:WMOKey:@FM:"":@FM:WOStepKey:@FM Open "!WM_OUT" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey end else - ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey - end else - ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WO_STEP key for WM_OUT ':WMOKey:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) end @@ -505,10 +518,12 @@ Service VerifyWoStepWMOKeyIndex(WMOKey) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyWMOKeyLog, LogData, @RM, @FM) @@ -525,10 +540,9 @@ Service VerifyWOLogWMOKeyIndex(WMOKey) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WM_OUT{WO_NO} Log.csv' Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOStep':@FM:'Result' objVerifyWMOWoIndexLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = WMOKey LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) @@ -540,6 +554,7 @@ Service VerifyWOLogWMOKeyIndex(WMOKey) If WONo NE '' then WOLogRDSKeys = '' Extract_Si_Keys('WM_OUT', 'WO_NO', WONo, WOLogRDSKeys) + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<3> = WONo Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) Locate WMOKey in WOLogRDSKeys using @VM setting vPos else @@ -548,24 +563,34 @@ Service VerifyWOLogWMOKeyIndex(WMOKey) // Add index transaction to update WO_NO btree index IndexTransactionRow = 'WO_NO':@FM:WMOKey:@FM:"":@FM:WONo:@FM Open "!WM_OUT" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_OUT. ':WMOKey + end + Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey end else - ErrorMsg = 'Error in ':Service:' service. Unable to write index transaction to !WM_OUT. ':WMOKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_OUT to add index transaction. ':WMOKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey - end else - ErrorMsg = 'Error in ':Service:' service. Unable to Lock !WM_OUT to add index transaction. ':WMOKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Error in ':Service:' service. Unable to Open !WM_OUT to add index transaction. ':WMOKey end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WONo for WM_OUT ':WMOKey:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) end @@ -575,10 +600,12 @@ Service VerifyWOLogWMOKeyIndex(WMOKey) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyWMOWoIndexLog, LogData, @RM, @FM) @@ -595,10 +622,9 @@ Service VerifyWOMatWMOKeyIndex(WMOKey) LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' !WM_OUT WO_MAT{WMO_KEY} Log.csv' Headers = 'Logging DTM':@FM:'WMOKey':@FM:'WOMatKey':@FM:'Result' objVerifyWOMatWmoKeyLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$, COMMA$, Headers, '', False$, False$) - LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM LogData = '' - LogData<1> = LoggingDtm + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<2> = WMOKey LogData<4> = 'Begin ':Service Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) @@ -609,32 +635,44 @@ Service VerifyWOMatWMOKeyIndex(WMOKey) WOMatKey = Field(WMOKey, '*', 1, 1):'*':Field(WMOKey, '*', 3, 1) If WOMatKey NE '' then WOMatWMOKey = Xlate('WO_MAT', WOMatKey, 'WMO_KEY', 'X') - LogData<3> = WOMatKey + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<3> = WOMatKey Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) If WOMatWMOKey EQ '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WMOKey missing from WO_MAT record. Generating index transaction.' Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) // Add index transaction to update WMO_KEY relational index (target WO_MAT table) IndexTransactionRow = 'WO_MAT*WMO_KEY*TOP':@FM:WMOKey:@FM:"":@FM:WOMatKey:@FM Open "!WM_OUT" to BangTable then - Lock BangTable, 0 then - Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM - PendingTrans := IndexTransactionRow - Write PendingTrans on BangTable, 0 then - LogData<4> = 'Index transaction successfully added.' - Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + Lock BangTable, 0 then + Read PendingTrans from BangTable, 0 else PendingTrans = '0':@FM + PendingTrans := IndexTransactionRow + Write PendingTrans on BangTable, 0 then + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'Index transaction successfully added.' + Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) + Done = True$ + end else + ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey + end + Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey end else - ErrorMsg = 'Unable to write index transaction to !WM_OUT. ':WMOKey + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey + end end - Unlock BangTable, 0 else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey - end else - ErrorMsg = 'Unable to Lock !WM_OUT to add index transaction. ':WMOKey - end + Until Done or ErrorMsg + Next AttemptNo end else ErrorMsg = 'Unable to Open !WM_OUT to add index transaction. ':WMOKey end end end else + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'WO_MAT key for WM_OUT ':WMOKey:' is null. Nothing to update.' Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) end @@ -642,10 +680,12 @@ Service VerifyWOMatWMOKeyIndex(WMOKey) end If ErrorMsg NE '' then + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = ErrorMsg Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) end + LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'End ':Service Logging_Services('AppendLog', objVerifyWOMatWmoKeyLog, LogData, @RM, @FM) @@ -653,6 +693,7 @@ Service VerifyWOMatWMOKeyIndex(WMOKey) end service + Service GetWMOutKeys(WOLogId) ErrorMsg = '' diff --git a/LSL2/STPROC/WORK_ORDER_SERVICES.txt b/LSL2/STPROC/WORK_ORDER_SERVICES.txt index 141c37f..d612377 100644 --- a/LSL2/STPROC/WORK_ORDER_SERVICES.txt +++ b/LSL2/STPROC/WORK_ORDER_SERVICES.txt @@ -694,17 +694,27 @@ Service ReceiveCassette(WONo, ReceiveUser, LotNo, CassQty, SubPartNo, SubVendorC ErrCode = '' If Not(Get_Status(ErrCode)) then - WOMatKey = WONo:'*':CassNo - + WOMatKey = WONo:'*':CassNo + Locate WOMatKey in WOMatKeys by 'AR' using @VM setting NewPos else - WOMatKeys<0, CassNo> = WOMatKey - Transaction_Services('PostWriteFieldTransaction', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, WOMatKey, CassNo) - ErrCode = '' - If Get_Status(ErrCode) then - ErrorMsg = 'Error in ':Service:' service. Error message: ':ErrCode + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo, True$) + If HaveLock then + WOMatKeys = Database_Services('ReadDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$) + WOMatKeys<0, CassNo> = WOMatKey + Database_Services('WriteDataColumn', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, WOMatKeys, True$, False$, False$) + If Error_Services('NoError') then Done = True$ + end + Until Done + Next AttemptNo + If Not(Done) then + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + Transaction_Services('PostWriteFieldTransaction', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, WOMatKey, CassNo) + If Error_Services('HasError') then ErrorMsg = 'Error in ':Service:' service. Error message: ':Error_Services('GetMessage') end end - + If (ErrorMsg EQ '') then Recipients = '' SentFrom = ReceiveUser @@ -795,7 +805,7 @@ Service ReleaseCassette(WOMatKey, ReleaseUser, RelDtm) RelWONo = Field(WOMatKey, '*', 1, 1) RelCassNo = Field(WOMatKey, '*', 2, 1) Set_Status(0) - obj_WO_Log('ReleaseCassettes',RelWONo:@RM:RelCassNo:@RM:ReleaseUser:@RM:RelDtm) + obj_WO_Log('ReleaseCassette',RelWONo:@RM:RelCassNo:@RM:ReleaseUser:@RM:RelDtm) errCode = '' If Get_Status(errCode) then ErrorMsg = 'Error in ':Service:' service. Error code ':errCode:'.' @@ -830,7 +840,7 @@ end service Service ReceiveReleaseCassette(WONo, ReceiveUser, LotNo, CassQty, SubPartNo, SubVendorCode, RecDtm) - + WOMatKey = '' ErrorMsg = '' Begin Case @@ -1080,37 +1090,46 @@ Service UpdateReleasedQty(WONo) LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM RelQty = '' UnRelQty = '' - OrigRelQty = '' - OrigUnRelQty = '' ErrorMsg = '' If WONo NE '' then If RowExists('WO_LOG', WONo) then WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) - If Error_Services('NoError') then - RelQty = obj_WO_Log('RelQty', WONo:@RM:WORec) - WOQty = WORec + If Error_Services('NoError') then + OrigRelQty = WORec + OrigUnRelQty = WORec + RelQty = obj_WO_Log('RelQty', WONo:@RM:WORec) + WOQty = WORec If RelQty GT WOQty then UnRelQty = 0 end else UnRelQty = WOQty - RelQty end - Open 'WO_LOG' to hTable then - Read WORec from hTable, WONo then - OrigRelQty = WORec - OrigUnRelQty = WORec - If ( (OrigRelQty NE RelQty) or (OrigUnRelQty NE UnRelQty) ) then - WORec = RelQty - WORec = UnRelQty - Write WORec on hTable, WONo else - ErrorMsg = 'Error in ':Service:' service. Failed to write unreleased quantity ':UnRelQty - ErrorMsg := ' and/or UNREL_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR - end - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.' - end + If ( (OrigRelQty NE RelQty) or (OrigUnRelQty NE UnRelQty) ) then + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo) + If HaveLock then + WORec = RelQty + WORec = UnRelQty + Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$) + If Error_Services('NoError') then + // Note: WriteDataRow will have unlocked the record + Done = True$ + end else + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write released quantity ':RelQty + ErrorMsg := ' to the REL_QTY_STATIC field of WO_LOG record ':WONo:'. ' + ErrorMsg := 'Failed to write unreleased quantity ':UnRelQty:' to the UNREL_QTY_STATIC ' + ErrorMsg := 'field of the WO_LOG record ':WONo:'. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end + Until Done + Next AttemptNo + end end else ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' ErrorMsg := 'Error message: ':Error_Services('GetMessage') @@ -1132,7 +1151,7 @@ Service UpdateReleasedQty(WONo) Logging_Services('AppendLog', objUpRelLog, LogData, @RM, @FM) end else LogResult = 'Failed to update WO_LOG record ':WONo:' field REL_QTY_STATIC with released quantity ':RelQty - LogResult := ' or field UNREL_QTY_STATIC with unreleased quantity ':UnRelQty:'. Error message: ':ErrorMsg + LogResult := ' and field UNREL_QTY_STATIC with unreleased quantity ':UnRelQty:'. Error message: ':ErrorMsg LogData<3> = LogResult Logging_Services('AppendLog', objUpRelLog, LogData, @RM, @FM) Error_Services('Add', ErrorMsg) @@ -1168,8 +1187,9 @@ Service AdjustReleasedQty(WONo, AdjustQty) End Case If (ErrorMsg EQ '' ) then If RowExists('WO_LOG', WONo) then + Done = False$ For Attempt = 1 to NUM_ATTEMPTS$ - If Attempt GT 0 then Delay(Attempt) + If Attempt GT 1 then Delay(1) HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo, True$) If HaveLock then WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) @@ -1182,20 +1202,28 @@ Service AdjustReleasedQty(WONo, AdjustQty) WORec = RelQty WORec = UnRelQty Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$) - If Error_Services('HasError') then - ErrorMsg = 'Error in ':Service:' service. Failed to write ':RelQty:' on REL_QTY_STATIC ' - ErrorMsg := 'field and ':UnrelQty:' on UNREL_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := 'Error message: ':Error_Services('GetMessage') + If Error_Services('NoError') then + Done = True$ + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':RelQty:' on REL_QTY_STATIC ' + ErrorMsg := 'field and ':UnrelQty:' on UNREL_QTY_STATIC field of WO_LOG record ':WONo:'.' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end end end else - ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' - ErrorMsg := 'Error message: ':Error_Services('GetMessage') - end + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end end If ( Not(HaveLock) and (Attempt GE NUM_ATTEMPTS$) ) then ErrorMsg = 'Error in ':Service:' service. Failed to lock WO_LOG ':WoNo:' for update after ':Attempt:' attempts.' end - Until HaveLock or (ErrorMsg NE '') + Until Done Next Attempt end else ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.' @@ -1230,44 +1258,44 @@ Service UpdateReceivedQty(WONo) Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes' objUpRecLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$) LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM - RXQty = '' - OrigRXQty = '' + RxQty = '' + OpenQty = '' ErrorMsg = '' If WONo NE '' then If RowExists('WO_LOG', WONo) then WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) If Error_Services('NoError') then - WOQty = WORec - RXQty = obj_WO_Log('RxQty', WONo:@RM:WORec) - OpenQty = WOQty - RXQty - Open 'WO_LOG' to hTable then - ReadV OrigRXQty from hTable, WONo, WO_LOG_RX_QTY_STATIC$ then - If OrigRXQty NE RXQty then - WriteV RXQty on hTable, WONo, WO_LOG_RX_QTY_STATIC$ else - ErrorMsg = 'Error in ':Service:' service. Failed to write received quantity ':RXQty - ErrorMsg := ' to the RX_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Error reading RX_QTY_STATIC column from WO_LOG ':WONo:'.' - end - If ErrorMsg EQ '' then - ReadV OrigOpenQty from hTable, WONo, WO_LOG_OPEN_QTY_STATIC$ then - If OrigOpenQty NE OpenQty then - WriteV OpenQty on hTable, WONo, WO_LOG_OPEN_QTY_STATIC$ else + WOQty = WORec + OrigRxQty = WORec + OrigOpenQty = WORec + RxQty = obj_WO_Log('RxQty', WONo:@RM:WORec) + OpenQty = WOQty - RxQty + If ( (OrigRxQty NE RxQty) or (OrigOpenQty NE OpenQty) ) then + WORec = RxQty + WORec = OpenQty + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo) + If HaveLock then + Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$) + If Error_Services('NoError') then + // Note: WriteDataRow will have unlocked the record + Done = True$ + end else + If AttemptNo GE NUM_ATTEMPTS$ then ErrorMsg = 'Error in ':Service:' service. Failed to write received quantity ':RXQty - ErrorMsg := ' to the OPEN_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Error reading OPEN_QTY_STATIC column from WO_LOG ':WONo:'.' - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.' - end + ErrorMsg := ' to the RX_QTY_STATIC field of WO_LOG record ':WONo:'. ' + ErrorMsg := 'Failed to write open quantity ':OpenQty + ErrorMsg := ' to the OPEN_QTY_STATIC field of WO_LOG record ':WONo:'. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end + Until Done + Next AttemptNo + end end else ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' ErrorMsg := 'Error message: ':Error_Services('GetMessage') @@ -1283,12 +1311,15 @@ Service UpdateReceivedQty(WONo) LogData<1> = LoggingDtm LogData<2> = WONo If ErrorMsg EQ '' then - LogData<3> = 'Successfully updated WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RXQty:'.' + LogMsg = 'Successfully updated WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RxQty:'.' + LogMsg := 'Successfully updated WO_LOG record ':WONo:' field OPEN_QTY_STATIC with open quantity ':OpenQty:'.' + LogData<3> = LogMsg Logging_Services('AppendLog', objUpRecLog, LogData, @RM, @FM) end else - LogResult = 'Failed to update WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RXQty - LogResult := '. Error message: ':ErrorMsg - LogData<3> = LogResult + LogMsg = 'Failed to update WO_LOG record ':WONo:' field RX_QTY_STATIC with received quantity ':RxQty:'. ' + LogMsg := 'Failed to update WO_LOG record ':WONo:' field OPEN_QTY_STATIC with open quantity ':OpenQty:'. ' + LogMsg := 'Error message: ':ErrorMsg + LogData<3> = LogMsg Logging_Services('AppendLog', objUpRecLog, LogData, @RM, @FM) Error_Services('Add', ErrorMsg) end @@ -1322,8 +1353,9 @@ Service AdjustReceivedQty(WONo, AdjustQty) End Case If (ErrorMsg EQ '' ) then If RowExists('WO_LOG', WONo) then + Done = False$ For Attempt = 1 to NUM_ATTEMPTS$ - If Attempt GT 0 then Delay(Attempt) + If Attempt GT 1 then Delay(1) HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo, True$) If HaveLock then WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) @@ -1331,24 +1363,32 @@ Service AdjustReceivedQty(WONo, AdjustQty) WOQty = WORec OrigRxQty = WORec RxQty = OrigRxQty + AdjustQty - OpenQty = WOQty - RXQty + OpenQty = WOQty - RxQty WORec = RxQty WORec = OpenQty Database_Services('WriteDataRow', 'WO_LOG', WONo, WORec, True$, False$, False$) - If Error_Services('HasError') then - ErrorMsg = 'Error in ':Service:' service. Failed to write ':RxQty:' on RX_QTY_STATIC field ' - ErrorMsg := 'and ':OpenQty:' on OPEN_QTY_STATIC to WO_LOG ':WONo:'. Error message: ' - ErrorMsg := Error_Services('GetMessage') + If Error_Services('NoError') then + Done = True$ + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':RxQty:' on RX_QTY_STATIC field ' + ErrorMsg := 'and ':OpenQty:' on OPEN_QTY_STATIC to WO_LOG ':WONo:'. Error message: ' + ErrorMsg := Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end end end else - ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' - ErrorMsg := 'Error message: ':Error_Services('GetMessage') + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end end end If ( Not(HaveLock) and (Attempt GE NUM_ATTEMPTS$) ) then ErrorMsg = 'Error in ':Service:' service. Failed to lock WO_LOG ':WoNo:' for update after ':Attempt:' attempts.' end - Until HaveLock or (ErrorMsg NE '') + Until Done Next Attempt end else ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.' @@ -1374,6 +1414,170 @@ Service AdjustReceivedQty(WONo, AdjustQty) end service +Service AdjustScrappedQty(WONo, AdjustQty) + + LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG' + LogDate = Oconv(Date(), 'D4/') + LogTime = Oconv(Time(), 'MTS') + LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Adjust Scrapped Qty Log.csv' + Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes' + objAdjScrapLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$) + LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM + RXQty = '' + OrigRXQty = '' + ErrorMsg = '' + Begin Case + Case (WONo EQ '') + ErrorMsg = 'Error in ':Service:' service. Null WONo passed into service' + Case (AdjustQty EQ '') + ErrorMsg = 'Error in ':Service:' service. Null AdjustQty passed into service' + Case Not(Num(AdjustQty)) + ErrorMsg = 'Error in ':Service:' service. AdjustQty is not a number' + Case Index(AdjustQty, '.', 1) + ErrorMsg = 'Error in ':Service:' service. AdjustQty cannot be a decimal value' + Case Otherwise$ + Null + End Case + If (ErrorMsg EQ '' ) then + If RowExists('WO_LOG', WONo) then + Done = False$ + For Attempt = 1 to NUM_ATTEMPTS$ + If Attempt GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo, True$) + If HaveLock then + WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) + If Error_Services('NoError') then + OrigScrapQty = WORec + ScrapQty = OrigScrapQty + AdjustQty + Database_Services('WriteDataColumn', 'WO_LOG', WONo, WO_LOG_SCRAP_QTY_STATIC$, ScrapQty, True$, False$, False$) + If Error_Services('NoError') then + // Note: WriteDataColumn will release the lock + Done = True$ + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':ScrapQty:' on SCRAP_QTY_STATIC field. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end + If ( Not(HaveLock) and (Attempt GE NUM_ATTEMPTS$) ) then + ErrorMsg = 'Error in ':Service:' service. Failed to lock WO_LOG ':WoNo:' for update after ':Attempt:' attempts.' + end + Until Done + Next Attempt + end else + ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.' + end + end + + LogData = '' + LogData<1> = LoggingDtm + LogData<2> = WONo + If ErrorMsg EQ '' then + LogResult = 'Successfully adjusted WO_LOG ':WONo:' scrapped quantity by ':AdjustQty + LogResult := '. Updated WO_LOG record ':WONo:' field SCRAP_QTY_STATIC with scrap quantity ':ScrapQty:'.' + LogData<3> = LogResult + Logging_Services('AppendLog', objAdjScrapLog, LogData, @RM, @FM) + end else + LogResult = 'Failed to adjust WO_LOG ':WONo:' scrapped quantity by ':AdjustQty + LogData<3> = LogResult + Logging_Services('AppendLog', objAdjScrapLog, LogData, @RM, @FM) + Error_Services('Add', ErrorMsg) + end + +end service + + +Service AdjustShippedQty(WONo, AdjustQty) + + LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG' + LogDate = Oconv(Date(), 'D4/') + LogTime = Oconv(Time(), 'MTS') + LogFileName = LogDate[7, 4] : '-' : LogDate[1, 2] : '-' : LogDate[4, 2] : ' Adjust Shipped Qty Log.csv' + Headers = 'Logging DTM' : @FM : 'WONo' : @FM : 'Notes' + objAdjShipLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$) + LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM + RXQty = '' + OrigRXQty = '' + ErrorMsg = '' + Begin Case + Case (WONo EQ '') + ErrorMsg = 'Error in ':Service:' service. Null WONo passed into service' + Case (AdjustQty EQ '') + ErrorMsg = 'Error in ':Service:' service. Null AdjustQty passed into service' + Case Not(Num(AdjustQty)) + ErrorMsg = 'Error in ':Service:' service. AdjustQty is not a number' + Case Index(AdjustQty, '.', 1) + ErrorMsg = 'Error in ':Service:' service. AdjustQty cannot be a decimal value' + Case Otherwise$ + Null + End Case + If (ErrorMsg EQ '' ) then + If RowExists('WO_LOG', WONo) then + Done = False$ + For Attempt = 1 to NUM_ATTEMPTS$ + If Attempt GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo, True$) + If HaveLock then + WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) + If Error_Services('NoError') then + OrigShipQty = WORec + ShipQty = OrigShipQty + AdjustQty + Database_Services('WriteDataColumn', 'WO_LOG', WONo, WO_LOG_SHIP_QTY_STATIC$, ShipQty, True$, False$, False$) + If Error_Services('NoError') then + // Note: WriteDataColumn will release the lock + Done = True$ + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':ShipQty:' on SHIP_QTY_STATIC field. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end else + If Attempt GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end + If ( Not(HaveLock) and (Attempt GE NUM_ATTEMPTS$) ) then + ErrorMsg = 'Error in ':Service:' service. Failed to lock WO_LOG ':WoNo:' for update after ':Attempt:' attempts.' + end + Until Done + Next Attempt + end else + ErrorMsg = 'Error in ':Service:' service. ':WONo:' does not exist in the WO_LOG table.' + end + end + + LogData = '' + LogData<1> = LoggingDtm + LogData<2> = WONo + If ErrorMsg EQ '' then + LogResult = 'Successfully adjusted WO_LOG ':WONo:' shipped quantity by ':AdjustQty + LogResult := '. Updated WO_LOG record ':WONo:' field SHIP_QTY_STATIC with scrap quantity ':ShipQty:'.' + LogData<3> = LogResult + Logging_Services('AppendLog', objAdjShipLog, LogData, @RM, @FM) + end else + LogResult = 'Failed to adjust WO_LOG ':WONo:' shipped quantity by ':AdjustQty + LogData<3> = LogResult + Logging_Services('AppendLog', objAdjShipLog, LogData, @RM, @FM) + Error_Services('Add', ErrorMsg) + end + +end service + + Service UpdateShippedQty(WONo) LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG' @@ -1384,28 +1588,34 @@ Service UpdateShippedQty(WONo) objUpShipLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$) LoggingDTM = LogDate : ' ' : LogTime ; // Logging DTM ShipQty = '' - OrigShipQty = '' ErrorMsg = '' If WONo NE '' then If RowExists('WO_LOG', WONo) then WORec = Database_Services('ReadDataRow', 'WO_LOG', WONo) - If Error_Services('NoError') then - ShipQty = obj_WO_Log('ShipQty', WONo:@RM:WORec) - Open 'WO_LOG' to hTable then - ReadV OrigShipQty from hTable, WONo, WO_LOG_SHIP_QTY_STATIC$ then - If OrigShipQty NE ShipQty then - WriteV ShipQty on hTable, WONo, WO_LOG_SHIP_QTY_STATIC$ else - ErrorMsg = 'Error in ':Service:' service. Failed to write ':ShipQty - ErrorMsg := ' to the SHIP_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Error reading SHIP_QTY_STATIC column from WO_LOG ':WONo:'.' - end - end else - ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.' - end + If Error_Services('NoError') then + OrigShipQty = WORec + ShipQty = obj_WO_Log('ShipQty', WONo:@RM:WORec) + If OrigShipQty NE ShipQty then + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo) + If HaveLock then + Database_Services('WriteDataColumn', 'WO_LOG', WONo, WO_LOG_SHIP_QTY_STATIC$, ShipQty, True$, False$, False$) + If Error_Services('NoError') then + Done = True$ + end else + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':ShipQty + ErrorMsg := ' to the SHIP_QTY_STATIC field of WO_LOG record ':WONo:'. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + end + end + end + Until Done + Next AttemptNo + If Database_Services('IsKeyIDSelfLocked', 'WO_LOG', WONo) then Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end end else ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' ErrorMsg := 'Error message: ':Error_Services('GetMessage') @@ -1446,7 +1656,6 @@ Service UpdateScrappedQty(WONo) objUpScrapLog = Logging_Services('NewLog', LogPath, LogFileName, CRLF$,',', Headers, '', False$, False$) LoggingDTM = LogDate : ' ' : LogTime ScrapQty = '' - OrigScrapQty = '' ErrorMsg = '' If WONo NE '' then If RowExists('WO_LOG', WONo) then @@ -1458,21 +1667,29 @@ Service UpdateScrappedQty(WONo) end else ScrapQty = Sum(Xlate('WO_LOG', WONo, 'WO_MAT_SAP_CONFIRM_SCRAP', 'X')) end - Open 'WO_LOG' to hTable then - ReadV OrigScrapQty from hTable, WONo, WO_LOG_SCRAP_QTY_STATIC$ then - If OrigScrapQty NE ScrapQty then - WriteV ScrapQty on hTable, WONo, WO_LOG_SCRAP_QTY_STATIC$ else - ErrorMsg = 'Error in ':Service:' service. Failed to write ':ScrapQty - ErrorMsg := ' to the SCRAP_QTY_STATIC field of WO_LOG record ':WONo:'.' - ErrorMsg := '@FILE_ERROR: ':@FILE_ERROR - end - end - end else - ErrorMsg = 'Error in ':Service:' service. Error reading SCRAP_QTY_STATIC column from WO_LOG ':WONo:'.' - end - end else - ErrorMsg = 'Error in ':Service:' service. Failed to open the WO_LOG table.' - end + OrigScrapQty = WORec + If OrigScrapQty NE ScrapQty then + Done = False$ + For AttemptNo = 1 to NUM_ATTEMPTS$ + If AttemptNo GT 1 then Delay(1) + HaveLock = Database_Services('GetKeyIDLock', 'WO_LOG', WONo) + If HaveLock then + Database_Services('WriteDataColumn', 'WO_LOG', WONo, WO_LOG_SCRAP_QTY_STATIC$, ScrapQty, True$, False$, False$) + If Error_Services('NoError') then + // Note: WriteDataColumn will have unlocked the record + Done = True$ + end else + If AttemptNo GE NUM_ATTEMPTS$ then + ErrorMsg = 'Error in ':Service:' service. Failed to write ':ScrapQty + ErrorMsg := ' to the SCRAP_QTY_STATIC field of WO_LOG record ':WONo:'. ' + ErrorMsg := 'Error message: ':Error_Services('GetMessage') + Database_Services('ReleaseKeyIDLock', 'WO_LOG', WONo) + end + end + end + Until Done + Next AttemptNo + end end else ErrorMsg = 'Error in ':Service:' service. Failed to read record ':WONo:' from the WO_LOG table. ' ErrorMsg := 'Error message: ':Error_Services('GetMessage') @@ -1569,6 +1786,8 @@ Service ConvertRecordToJSON(WONo, Record, ItemURL) SRP_JSON(objChildCassette, 'SetValue', 'RelDtm', Date_Services('ConvertDateTimeToISO8601', WOMatRec)) SRP_JSON(objChildCassette, 'SetValue', 'RecUser', OConv(WOMatRec, '[XLATE_CONV,LSL_USERS*FIRST_LAST]')) SRP_JSON(objChildCassette, 'SetValue', 'RelUser', OConv(WOMatRec, '[XLATE_CONV,LSL_USERS*FIRST_LAST]' )) + SRP_JSON(objChildCassette, 'SetValue', 'WMInKey', WOMatRec) + SRP_JSON(objChildCassette, 'SetValue', 'WMOutKey', WOMatRec) SRP_JSON(objChildCassettes, 'Add', objChildCassette) SRP_JSON(objChildCassette, 'Release') end diff --git a/LSL2/STPROC/WO_LOG_ACTIONS.txt b/LSL2/STPROC/WO_LOG_ACTIONS.txt index 3a7d6e1..fbda33a 100644 --- a/LSL2/STPROC/WO_LOG_ACTIONS.txt +++ b/LSL2/STPROC/WO_LOG_ACTIONS.txt @@ -42,14 +42,15 @@ Function WO_LOG_Actions(Action, CalcColName, FSList, Handle, Name, FMC, Record, ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler -$insert APP_INSERTS -$insert FILE.SYSTEM.EQUATES -$insert ACTION_SETUP -$insert WO_MAT_EQUATES -$insert WO_LOG_EQUATES -$insert WO_STEP_EQUATES -$insert RLIST_EQUATES -$insert SCHED_DET_NG_EQUATES +$Insert APP_INSERTS +$Insert FILE.SYSTEM.EQUATES +$Insert ACTION_SETUP +$Insert WO_MAT_EQUATES +$Insert WO_LOG_EQUATES +$Insert WO_STEP_EQUATES +$Insert RLIST_EQUATES +$Insert SCHED_DET_NG_EQUATES +$Insert IFX_EQUATES Equ Comma$ to ',' @@ -57,7 +58,7 @@ Declare function Error_Services, Database_Services, Environment_Services, Logg Declare function GaN_Services, obj_WO_Log, SRP_Date Declare subroutine Error_Services, Database_Services, Environment_Services, Logging_Services, Obj_SAP Declare subroutine Logging_Services, Set_Status, Schedule_Services, Work_Order_Services, obj_Notes -Declare subroutine Schedule_Services +Declare subroutine Schedule_Services, Service_Services LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG' LogDate = Oconv(Date(), 'D4/') @@ -205,12 +206,12 @@ WRITE_RECORD_PRE: OrigQty = OrigRecord NewQty = Record + ModifyQty = NewQty - OrigQty OrigCassList = OrigRecord NewCassList = Record If ( (OrigQty NE NewQty) or (OrigCassList NE NewCassList) ) then - // Update released, unreleased, and received quantities - RelQty = obj_WO_Log('RelQty', Name:@RM:Record) - Record = RelQty + // Update unreleased, open (i.e., not received) quantities + RelQty = OrigRecord If RelQty GT NewQty then UnRelQty = 0 end else @@ -218,9 +219,14 @@ WRITE_RECORD_PRE: end Record = UnRelQty - RXQty = obj_WO_Log('RxQty', Name:@RM:Record) - Record = RXQty - SaveRecord = Record + RxQty = OrigRecord + If RxQty GT NewQty then + OpenQty = 0 + end else + OpenQty = NewQty - RxQty + end + Record = OpenQty + SaveRecord = Record end // Check if we need to auto-close the work order @@ -278,202 +284,7 @@ WRITE_RECORD: NewQty = Record ModifyQty = NewQty - OrigQty WONo = Name - SchedDetNGKey = '' - - Begin Case - Case ModifyQty GT 0 - - LogData = '' - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<2> = 'WO_LOG_ACTIONS' - LogData<3> = 'Work order ':WONo:' quantity increased from ':OrigQty:' to ':NewQty:'.' - Schedule_Services('LogActivity', '', LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Searching for a scheduled event to increase the quantity.' - Schedule_Services('LogActivity', '', LogData, False$) - - // Search schedule for most recent event and increase that event quantity by the difference. - Query = 'SELECT SCHED_DET_NG WITH WO_NO EQ ':WONo:' BY-DSND STOP_DTM' - GoSub ClearCursors - Set_Status(0) - RList(Query, TARGET_ACTIVELIST$, '', '', False$) - errCode = '' - If Get_Status(errCode) then - - ErrorMsg = 'Error retrieving event list in WO_LOG_Actions. RList error code ':errCode:'.' - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = ErrorMsg - Schedule_Services('LogActivity', '', LogData, False$) - - Error_Services('Add', ErrorMsg) - - end else - - EOF = False$ - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Query successful. Number of keys found: ':@RecCount:'.' - Schedule_Services('LogActivity', '', LogData, False$) - - ReadNext SchedDetNGKey else EOF = True$ - If SchedDetNGKey NE '' then - EventRec = Database_Services('ReadDataRow', 'SCHED_DET_NG', SchedDetNGKey) - StopDTM = EventRec - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Work order record ':WONo:' quantity increased from ':OrigQty:' to ':NewQty:'.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Scheduled event ':SchedDetNGKey:' found.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - // Only modify the event if it is still running or is scheduled in the future. - If StopDTM GT Datetime() then - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' less than current DTM, so increasing event quantity.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - ReactNo = EventRec - WONo = EventRec - StartDTM = EventRec - Desc = EventRec - EventQty = EventRec - NewEventQty = EventQty + ModifyQty - Schedule_Services('ModifySchedEvent', SchedDetNGKey, ReactNo, WONo, StartDTM, StopDTM, Desc, NewEventQty) - // Adjust reactor events as needed. - Schedule_Services('AdjustScheduleEvents', ReactNo) - - end else - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' greater than current DTM.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event quantity not increased.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - end - end - end - GoSub ClearCursors - Case ModifyQty LT 0 - - LogData = '' - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<2> = 'WO_LOG_ACTIONS' - LogData<3> = 'Work order ':WONo:' quantity decreased from ':OrigQty:' to ':NewQty:'.' - Schedule_Services('LogActivity', '', LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Searching for a scheduled event to decrease the quantity.' - Schedule_Services('LogActivity', '', LogData, False$) - - // Search schedule for most recent events and decrease/delete those events as needed. - Query = 'SELECT SCHED_DET_NG WITH WO_NO EQ ':WONo:' BY-DSND STOP_DTM' - GoSub ClearCursors - Set_Status(0) - RList(Query, TARGET_ACTIVELIST$, '', '', False$) - errCode = '' - - If Get_Status(errCode) then - - ErrorMsg = 'Error retrieving event list in WO_LOG_Actions. RList error code ':errCode:'.' - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = ErrorMsg - Schedule_Services('LogActivity', '', LogData, False$) - - Error_Services('Add', ErrorMsg) - - end else - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Query successful. Number of keys found: ':@RecCount:'.' - Schedule_Services('LogActivity', '', LogData, False$) - - EOF = False$ - Done = False$ - UpdateReq = False$ - Loop - ReadNext SchedDetNGKey else EOF = True$ - Until EOF EQ True$ - If SchedDetNGKey NE '' then - EventRec = Database_Services('ReadDataRow', 'SCHED_DET_NG', SchedDetNGKey) - StopDTM = EventRec - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Work order record ':WONo:' quantity decreased from ':OrigQty:' to ':NewQty:'.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Scheduled event ':SchedDetNGKey:' found.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - // Only modify the event if it is still running or is scheduled in the future. - If StopDTM GT Datetime() then - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' less than current DTM, so decreasing event quantity.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - UpdateReq = True$ - ReactNo = EventRec - WONo = EventRec - StartDTM = EventRec - Desc = EventRec - EventQty = EventRec - If EventQty GT Abs(ModifyQty) then - - // This event has enough wafers, so just reduce the quantity. - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event quantity ':EventQty:' greater than quantity reduction ':ModifyQty:', so decreasing event quantity.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - Done = True$ - NewEventQty = EventQty + ModifyQty - Schedule_Services('ModifySchedEvent', SchedDetNGKey, ReactNo, WONo, StartDTM, StopDTM, Desc, NewEventQty) - - end else - - // This event has fewer wafers than are being removed. Delete this event and continue - // onto the next event. - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event quantity ':EventQty:' less than quantity reduction ':ModifyQty:', so canceling event.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - Schedule_Services('CancelScheduleEvent', SchedDetNGKey, True$) - ModifyQty += EventQty - - end - end else - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event stop DTM ':OConv(StopDtm, 'DT2/^H'):' greater than current DTM.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - LogData<1> = OConv(Datetime(), 'DT2/^H') - LogData<3> = 'Event quantity not decreased.' - Schedule_Services('LogActivity', EventRec, LogData, False$) - - end - end - Until Done EQ True$ - Repeat - If UpdateReq then - // Adjust reactor events as needed. - Schedule_Services('AdjustScheduleEvents', ReactNo) - end - end - GoSub ClearCursors - - Case Otherwise$ - Null - End Case + If ModifyQty NE 0 then Service_Services('PostProcedure', 'SCHEDULE_SERVICES', 'AdjustWorkOrderScheduleQty':SD$:WONo:SD$:ModifyQty) return diff --git a/LSL2/STPROC/WO_MAT_ACTIONS.txt b/LSL2/STPROC/WO_MAT_ACTIONS.txt index 7fdd168..92a7fc8 100644 --- a/LSL2/STPROC/WO_MAT_ACTIONS.txt +++ b/LSL2/STPROC/WO_MAT_ACTIONS.txt @@ -44,16 +44,17 @@ Function WO_MAT_Actions(Action, CalcColName, FSList, Handle, Name, FMC, Record, ***********************************************************************************************************************/ -$insert APP_INSERTS -$insert FILE.SYSTEM.EQUATES -$insert DICT_EQUATES -$insert ACTION_SETUP -$insert WO_MAT_EQUATES -$insert WO_LOG_EQUATES -$insert WO_STEP_EQUATES -$insert MAKEUP_WAFERS_EQUATES -$insert RLIST_EQUATES -$insert IFX_EQUATES +$Insert APP_INSERTS +$Insert FILE.SYSTEM.EQUATES +$Insert DICT_EQUATES +$Insert ACTION_SETUP +$Insert WO_MAT_EQUATES +$Insert WO_LOG_EQUATES +$Insert WO_STEP_EQUATES +$Insert MAKEUP_WAFERS_EQUATES +$Insert WM_OUT_EQUATES +$Insert RLIST_EQUATES +$Insert IFX_EQUATES Equ Comma$ to ',' @@ -610,13 +611,17 @@ WRITE_RECORD: CassNo = Field(Name, '*', 2) WOMatKeyID = Name - OrigWfrQty = OrigRecord - NewWfrQty = Record - OrigRelDtm = OrigRecord - NewRelDtm = Record - OrigRecDtm = OrigRecord - NewRecDtm = Record - AdjustQty = NewWfrQty - OrigWfrQty + OrigWfrQty = OrigRecord + NewWfrQty = Record + OrigRelDtm = OrigRecord + NewRelDtm = Record + OrigRecDtm = OrigRecord + NewRecDtm = Record + OrigVoidFlag = OrigRecord + NewVoidFlag = Record + OrigShipNo = OrigRecord + NewShipNo = Record + AdjustQty = NewWfrQty - OrigWfrQty If ( (OrigWfrQty NE '' ) and (OrigWfrQty NE NewWfrQty) and (OrigRecDtm NE '' and NewRecDtm NE '') ) then // Cassette already received, but casssette quantity has changed. @@ -624,7 +629,7 @@ WRITE_RECORD: end If ( (OrigRecDtm EQ '') and (NewRecDtm NE '') ) then // Cassette was just received. Increment received quantity of work order by the entire cassette wafer count. - Work_Order_Services('AdjustReceivedQty', WONo, NewWfrQty) + If NewWfrQty NE 0 then Work_Order_Services('AdjustReceivedQty', WONo, NewWfrQty) end If ( (OrigWfrQty NE '') and (OrigWfrQty NE NewWfrQty) and ( (OrigRelDtm NE '') and (NewRelDtm NE '') ) ) then @@ -633,7 +638,47 @@ WRITE_RECORD: end If ( (OrigRelDtm EQ '') and (NewRelDtm NE '') ) then // Cassette was just released. Increment released quantity of work order by the entire cassette wafer count. - Work_Order_Services('AdjustReleasedQty', WONo, NewWfrQty) + If NewWfrQty NE 0 then Work_Order_Services('AdjustReleasedQty', WONo, NewWfrQty) + end + + If ( (OrigVoidFlag NE True$) and (NewVoidFlag EQ True$) ) then + If (NewWfrQty NE 0) then + If (NewRecDtm NE '') then Work_Order_Services('AdjustReceivedQty', WONo, Neg(NewWfrQty)) + If (NewRelDtm NE '') then Work_Order_Services('AdjustReleasedQty', WONo, Neg(NewWfrQty)) + end + end + + If ( (NewVoidFlag NE True$) and (OrigVoidFlag EQ True$) ) then + If (NewWfrQty NE 0) then + If (NewRecDtm NE '') then Work_Order_Services('AdjustReceivedQty', WONo, NewWfrQty) + If (NewRelDtm NE '') then Work_Order_Services('AdjustReleasedQty', WONo, NewWfrQty) + end + end + + If ( (OrigShipNo EQ '') and (NewShipNo NE '') ) then + ShipQty = 0 + WMOKey = Record + If (WMOKey NE '') then + CurrWfrCnt = Xlate('WM_OUT', WMOKey, 'WAFER_CNT', 'X') + ShipQty += CurrWfrCnt + end else + CurrWfrCnt = obj_WO_Mat('CurrWaferCnt',WOMatKeyID:@RM:Record) + ShipQty += CurrWfrCnt + end + If ShipQty NE 0 then Work_Order_Services('AdjustShippedQty', WONo, ShipQty) + end + + If ( (NewShipNo EQ '') and (OrigShipNo NE '') ) then + ShipQty = 0 + WMOKey = Record + If (WMOKey NE '') then + CurrWfrCnt = Xlate('WM_OUT', WMOKey, 'WAFER_CNT', 'X') + ShipQty += CurrWfrCnt + end else + CurrWfrCnt = obj_WO_Mat('CurrWaferCnt',WOMatKeyID:@RM:Record) + ShipQty += CurrWfrCnt + end + If (ShipQty NE 0) then Work_Order_Services('AdjustShippedQty', WONo, Neg(ShipQty)) end If {REACTOR_TYPE} NE 'EPP' then @@ -889,6 +934,35 @@ return DELETE_RECORD: + debug + WOMatKeyID = Name + WONo = Field(WOMatKeyID, '*', 1, 1) + OrigWfrQty = OrigRecord + OrigVoidFlag = OrigRecord + OrigShipNo = OrigRecord + OrigRelDtm = OrigRecord + OrigRecDtm = OrigRecord + + If (OrigVoidFlag NE True$) then + If (OrigWfrQty NE 0) then + If (OrigRecDtm NE '') then Work_Order_Services('AdjustReceivedQty', WONo, Neg(OrigWfrQty)) + If (OrigRelDtm NE '') then Work_Order_Services('AdjustReleasedQty', WONo, Neg(OrigWfrQty)) + end + end + + If (OrigShipNo NE '') then + ShipQty = 0 + WMOKey = OrigRecord + If (WMOKey NE '') then + CurrWfrCnt = Xlate('WM_OUT', WMOKey, 'WAFER_CNT', 'X') + ShipQty += CurrWfrCnt + end else + CurrWfrCnt = obj_WO_Mat('CurrWaferCnt',WOMatKeyID:@RM:OrigRecord) + ShipQty += CurrWfrCnt + end + If (ShipQty NE 0) then Work_Order_Services('AdjustShippedQty', WONo, Neg(ShipQty)) + end + return