diff --git a/LSL2/STPROC/COMM_WO_REC.txt b/LSL2/STPROC/COMM_WO_REC.txt index 989aa99..408f438 100644 --- a/LSL2/STPROC/COMM_WO_REC.txt +++ b/LSL2/STPROC/COMM_WO_REC.txt @@ -8,7 +8,7 @@ COMPILE FUNCTION Comm_WO_Rec(Instruction, Parm1,Parm2) DECLARE SUBROUTINE Set_Property, Set_Status, ErrMsg, Set_Property, obj_AppWindow, obj_Notes, Print_RX_Voucher, obj_Tables DECLARE SUBROUTINE Btree.Extract, Send_Event, Security_Err_Msg, Forward_Event, End_Window, obj_WO_Log, obj_WO_Mat -DECLARE SUBROUTINE Logging_Services, Post_Event, Work_Order_Services, Error_Services, Database_Services +DECLARE SUBROUTINE Logging_Services, Post_Event, Work_Order_Services, Error_Services, Database_Services, Service_Services DECLARE FUNCTION Get_Property, Get_Status, Popup, Send_Message, Msg, Security_Check, Dialog_Box, RowExists, obj_Prod_Spec DECLARE FUNCTION obj_Schedule, Dialog_Box, obj_WO_Log, obj_Order_Det, FindWindow,ShowWindow, obj_Tables, obj_WO_Mat, MemberOf DECLARE FUNCTION Logging_Services, Environment_Services, Work_Order_Services, Error_Services, Service_Services @@ -647,6 +647,8 @@ Scan: end Logging_Services('AppendLog', objReceiveLog, LogData, @RM, @FM) + Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderData':SD$:WONo) + Post_Event(@Window, 'READ') end @@ -931,4 +933,3 @@ AddLeftover: RETURN - diff --git a/LSL2/STPROC/WORK_ORDER_SERVICES.txt b/LSL2/STPROC/WORK_ORDER_SERVICES.txt index c4e9750..3f6c233 100644 --- a/LSL2/STPROC/WORK_ORDER_SERVICES.txt +++ b/LSL2/STPROC/WORK_ORDER_SERVICES.txt @@ -61,7 +61,7 @@ Declare subroutine obj_WO_Mat, obj_Post_Log Declare function SRP_Array, Work_Order_Services, Memory_Services, Database_Services, SRP_Sort_Array, SRP_JSON Declare function Company_Services, obj_Prod_Spec, Schedule_Services, obj_WO_Log, obj_WO_Step, Memberof, Datetime Declare function Environment_Services, Logging_Services, Hold_Services, Signature_Services, Lot_Services -Declare function SRP_Datetime, RTI_CreateGUID, RDS_Services +Declare function SRP_Datetime, RTI_CreateGUID, RDS_Services, UCase LogPath = Environment_Services('GetApplicationRootPath') : '\LogFiles\WO_LOG' LogDate = Oconv(Date(), 'D4/') @@ -2100,16 +2100,35 @@ Service UpdateOpenWorkOrderData() Extract_Si_Keys('WO_LOG', 'CLOSE_DATE', '', OpenWoLogKeys) If Not(Get_Status(ErrCode)) then If OpenWoLogKeys NE '' then - For each OpenWoLogKey in OpenWoLogKeys using @VM - Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderData':SD$:OpenWOLogKey) - If Error_Services('HasError') then - LogData<1> = OConv(Datetime(), 'DT/^S') - ErrorMsg = Error_Services('GetMessage') - LogData<4> = ErrorMsg - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - MonaStatus = 'critical' - end - Next OpenWoLogKey + OpenWoLogKeys = SRP_Array('SortSimpleList', OpenWoLogKeys, 'AscendingNumbers', @VM) + LastOpenWoUpdated = '' + ServiceKey = UCase(Service) + If RowExists('APP_INFO', ServiceKey) then + LastOpenWoUpdated = Database_Services('ReadDataRow', 'APP_INFO', ServiceKey) + end + If (LastOpenWoUpdated NE '') then + Locate LastOpenWoUpdated in OpenWoLogKeys using @VM setting vPos then + vPos += 1 + end else + vPos = 1 + end + end else + vPos = 1 + end + NextOpenWoLogKey = OpenWoLogKeys<0, vPos> + Database_Services('WriteDataRow', 'APP_INFO', ServiceKey, NextOpenWoLogKey, True$, False$, False$) + + If NextOpenWoLogKey NE '' then + Service_Services('PostProcedure', 'WORK_ORDER_SERVICES', 'UpdateWorkOrderData':SD$:NextOpenWoLogKey) + end + + If Error_Services('HasError') then + LogData<1> = OConv(Datetime(), 'DT/^S') + ErrorMsg = Error_Services('GetMessage') + LogData<4> = ErrorMsg + Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) + MonaStatus = 'critical' + end end else LogData<1> = OConv(Datetime(), 'DT/^S') LogData<4> = 'No open work orders to update.' @@ -2136,7 +2155,7 @@ end service Service UpdateWorkOrderData(WONo) - + hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') Lock hSysLists, ServiceKeyID:'*':WONo then @@ -2175,52 +2194,34 @@ Service UpdateWorkOrderData(WONo) For CassNo = 1 to MAX_NUM_CASS$ WOMatKey = WONo:'*':CassNo If RowExists('WO_MAT', WOMatKey) then - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' exists...' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - Voided = Xlate('WO_MAT', WOMatKey, 'VOID', 'X') + RDSNo = Xlate('WO_MAT', WOMatKey, 'RDS_NO', 'X') + If (RDSNo NE '') then + RDS_Services('VerifyWOLogRDSKeyIndex', RDSNo) + RDS_Services('VerifyWOMatRDSNoIndex', RDSNo) + RDS_Services('VerifyWOStepRDSKeyIndex', RDSNo) + end + Voided = Xlate('WO_MAT', WOMatKey, 'VOID', 'X') If Not(Voided) then - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' not voided. Checking if it needs to be added to column...' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - Locate WOMatKey in OrigWOLogWOMatKeys using @VM setting vPos then - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' found in WO_LOG record. Nothing to update.' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - end else + Locate WOMatKey in OrigWOLogWOMatKeys using @VM setting vPos else LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Adding WOMatKey to column.' + LogData<4> = 'WOMatKey ':WOMatKey:' exists and was not found in WO_LOG record. Adding to column.' Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) NewWOLogWOMatKeys<0, -1> = WOMatKey end end else - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' has been voided...' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) Locate WOMatKey in NewWOLogWOMatKeys using @VM setting vPos then LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' found in WO_LOG record. Removing from column.' + LogData<4> = 'WOMatKey ':WOMatKey:' is voided and was found in WO_LOG record. Removing from column.' Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) NewWOLogWOMatKeys = Delete(NewWOLogWOMatKeys, 0, vPos, 0) - end else - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Nothing to update.' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - end - end + end + end end else - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' does not exist. Checking if WOMatKey ':WOMatKey:' needs to be removed from column...' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) Locate WOMatKey in NewWOLogWOMatKeys using @VM setting vPos then LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' found in WO_LOG record. Removing from column.' + LogData<4> = 'WOMatKey ':WOMatKey:' does not exist and was found in WO_LOG record. Removing from column.' Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) NewWOLogWOMatKeys = Delete(NewWOLogWOMatKeys, 0, vPos, 0) - end else - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Nothing to update.' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) end end Next CassNo