diff --git a/ImportService/TrackingDataImport.vbs b/ImportService/TrackingDataImport.vbs index 44e2c00..11db8d9 100644 --- a/ImportService/TrackingDataImport.vbs +++ b/ImportService/TrackingDataImport.vbs @@ -48,6 +48,7 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S Function createTrackingInfoForKit(KitID) Dim KitRs:set KitRs = oConn.Execute("Select * from Kit Where ID =" & KitID & ";") Dim InkjetRs:Set InkjetRs = oConn.Execute("Select * from InkjetRecords Where KitID =" & KitID & ";") +Dim JurisRs:set JurisRs = oConn.Execute("Select Right(IMB_Digits,9) as IMBZip FROM Jurisdiction Where JCode ='" & KitRs("Jcode") & "';"):Dim Jcode:Jcode = JurisRs("IMBZip"):JurisRs.Close Dim SerialNumberStart:SerialNumberStart = GetSetting("SerialNumberStart") Dim serialOffset:serialOffset = GetSetting("SerialOffset") Dim serialStart:serialStart = CLng(GetSetting("SerialNumberStart")) + CLng(GetSetting("SerialOffset")) @@ -61,17 +62,21 @@ While Not InkjetRs.EOF If Step = 1 Then oConn.Execute("INSERT INTO KitLabels (KitID,OutboundSerial,OutboundIMBDigits) " &_ "VALUES(" & KitID & ",'" & serialStart & "','" & KitRs("OutBoundSTID").Value & serialStart & "000000000" & "');") - Set KitLabelRs = oConn.Execute("SELECT TOP 1 [ID] FROM KitLabels ORDER BY ID DESC") - KitLabelID = KitLabelRs("ID").Value - oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";") - serialStart = serialStart + 1 + Else - ' oConn.Execute("INSERT INTO KitLabels (KitID,OutboundSerial,InBoundSerial,OutbondIMBDigitds,InBoundIMBDigits) " &_ - ' "VALUES(" & KitID & ",' & ") + oConn.Execute "INSERT INTO KitLabels (KitID,OutboundSerial,InBoundSerial,OutboundIMBDigits,InBoundIMBDigits) " &_ + "VALUES(" & KitID & ",'" & serialStart & "','" & serialStart + 1 & "','" & KitRs("OutBoundSTID").Value & serialStart & "000000000" & "','" & KitRs("InboundSTID").Value & serialStart + 1 & Jcode & "');" End If + Set KitLabelRs = oConn.Execute("SELECT TOP 1 [ID] FROM KitLabels ORDER BY ID DESC"):KitLabelID = KitLabelRs("ID").Value + + oConn.Execute("UPDATE InkjetRecords Set [KitLabelID]=" & KitLabelID & " WHERE ID=" & InkjetRs("ID") & ";") + Counter = Counter + Step + serialStart = serialStart + Step + InkjetRs.MoveNext Wend - + oConn.Execute("UPDATE Settings Set [Value]='" & serialOffset + Counter & "' WHERE [Name] = 'SerialOffset';") + oConn.Execute("UPDATE Kit Set [Status]='Ready For Export', LabelsPrinted=#" & Now() & "# WHERE [ID] =" & KitID &";") End Function