diff --git a/LSL2/STPROC/WORK_ORDER_SERVICES.txt b/LSL2/STPROC/WORK_ORDER_SERVICES.txt index 4c71484..c4e9750 100644 --- a/LSL2/STPROC/WORK_ORDER_SERVICES.txt +++ b/LSL2/STPROC/WORK_ORDER_SERVICES.txt @@ -2066,7 +2066,7 @@ end service Service UpdateOpenWorkOrderData() - + hSysLists = Database_Services('GetTableHandle', 'SYSLISTS') Lock hSysLists, ServiceKeyID then @@ -2175,25 +2175,66 @@ Service UpdateWorkOrderData(WONo) For CassNo = 1 to MAX_NUM_CASS$ WOMatKey = WONo:'*':CassNo If RowExists('WO_MAT', WOMatKey) then - 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 - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Adding WOMatKey to column.' - Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) - NewWOLogWOMatKeys<0, -1> = WOMatKey - end + 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') + 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 + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'WOMatKey ':WOMatKey:' not found in WO_LOG record. Adding WOMatKey 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.' + 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 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.' + 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 If OrigWOLogWOMatKeys NE NewWOLogWOMatKeys then - LogData<1> = OConv(Datetime(), 'DT/^S') - LogData<4> = 'WOMatKeys missing from work order. Posting transaction to update WO_MAT_KEY column.' + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'WOMatKeys column out of date. Posting transaction to update WO_MAT_KEY column.' Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) NewWOLogWOMatKeys = SRP_Array('SortRows', NewWOLogWOMatKeys, 'AR2', 'LIST', @VM, '*') Transaction_Services('PostWriteFieldTransaction', 'WO_LOG', WONo, WO_LOG_WO_MAT_KEY$, NewWOLogWOMatKeys) If Error_Services('HasError') then ErrorMsg = Error_Services('GetMessage') + end else + LogData<1> = OConv(Datetime(), 'DT/^S') + LogData<4> = 'WOMatKeys column accurate. Nothing to update.' + Logging_Services('AppendLog', objVerifyWOMatKeysLog, LogData, @RM, @FM) end end else ErrorMsg = 'Error in ':Service:' service. ':Error_Services('GetMessage')