Просмотр исходного кода

Getting outbound labels generated

pull/8/head
Daniel Covington 6 месяцев назад
Родитель
Сommit
f3b8012700
4 измененных файлов: 123 добавлений и 8 удалений
  1. +20
    -0
      Data/Migrations/Migration_14_Alter_Kit_Table_With_STIDS.asp
  2. +16
    -0
      Data/Migrations/Migration_15_Alter_InkJetRecords_Table_With_KitLabelID.asp
  3. +1
    -0
      Data/Migrations/migrate.asp
  4. +86
    -8
      ImportService/TrackingDataImport.vbs

+ 20
- 0
Data/Migrations/Migration_14_Alter_Kit_Table_With_STIDS.asp Просмотреть файл

@@ -0,0 +1,20 @@
<%
Class Migration_14_Alter_Kit_Table_With_STIDS
Public Migration

Public Sub Up
Migration.Do "ALTER TABLE [Kit] " &_
"ADD [OutboundSTID] VARCHAR(20);"
Migration.Do "ALTER TABLE [Kit] " &_
"ADD [InboundSTID] VARCHAR(20);"
End Sub
Public Sub Down
Migration.Do "ALTER TABLE [Kit] " &_
"DROP COLUMN [OutBoundSTID];"
Migration.Do "ALTER TABLE [Kit] " &_
"DROP COLUMN [InboundSTID];"
End Sub
End Class
Migrations.Add "Migration_14_Alter_Kit_Table_With_STIDS"
%>

+ 16
- 0
Data/Migrations/Migration_15_Alter_InkJetRecords_Table_With_KitLabelID.asp Просмотреть файл

@@ -0,0 +1,16 @@
<%
Class Migration_15_Alter_InkJetRecords_Table_With_KitLabelID
Public Migration

Public Sub Up
Migration.Do "ALTER TABLE [InkjetRecords] " &_
"ADD [KitLabelID] Long;"
End Sub
Public Sub Down
Migration.Do "ALTER TABLE [InkjetRecords] " &_
"DROP COLUMN [KitLabelID];"
End Sub
End Class
Migrations.Add "Migration_15_Alter_InkJetRecords_Table_With_KitLabelID"
%>

+ 1
- 0
Data/Migrations/migrate.asp Просмотреть файл

@@ -43,6 +43,7 @@ Migrations.Tracing = false
<!--#include file="Migration_12_Alter_Kit_Table_With_Type.asp"-->
<!--#include file="Migration_13_Alter_Kit_Table_With_File_Cass.asp"-->
<!--#include file="Migration_14_Alter_Kit_Table_With_STIDS.asp"-->
<!--#include file="Migration_15_Alter_InkJetRecords_Table_With_KitLabelID.asp"-->
<%
Sub HandleMigration
putl "<b>Starting Version: " & Migrations.Version & "</b>"


+ 86
- 8
ImportService/TrackingDataImport.vbs Просмотреть файл

@@ -29,16 +29,81 @@ Dim WorkingDirectory:WorkingDirectory = Replace(WScript.ScriptFullName,WScript.S

CheckForFiles
Dim KitID:KitID = CheckForJobsToCass()
If KitID > 0 Then
ExportMMCsv(KitID)
RunMailManager
ImportCass
End If
Dim KitID
' CheckForFiles
' KitID = CheckForJobsToCass()
' If KitID > 0 Then
' ExportMMCsv(KitID)
' RunMailManager
' ImportCass
' End If
oConn.Open(ConnectionString)
KitID = CheckForReadyToLabel()
If KitID > 0 Then
createTrackingInfoForKit(KitID)
End If
WScript.Quit

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 SerialNumberStart:SerialNumberStart = GetSetting("SerialNumberStart")
Dim serialOffset:serialOffset = GetSetting("SerialOffset")
Dim serialStart:serialStart = CLng(GetSetting("SerialNumberStart")) + CLng(GetSetting("SerialOffset"))
Dim Counter:Counter=0
Dim KitLabelID
Dim KitLabelRs
Dim Step : If KitRs("InboundSTID") <> "" Then : Step = 2 : Else Step = 1
serialStart = PadLeft(serialStart + CLng(Counter),9,"0")
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 & ",' & ")
End If
InkjetRs.MoveNext
Wend


End Function

Function GetSetting(settingName)

Dim rs:Set rs = oConn.Execute("Select Value From [Settings] Where [Name] = '" & settingName & "';")

If Not rs.EOF Then
GetSetting = rs(0).value
rs.Close
Else
SetSetting = 0
rs.Close
End If

End Function



Function CheckForReadyToLabel()

Dim rs : set rs = oConn.Execute("Select TOP 1 ID from Kit Where Status ='Ready to Assign Labels' ORDER BY ID DESC;")
If Not rs.EOF Then
Dim kitId : kitId = rs("ID").value
rs.Close
CheckForReadyToLabel = KitID
oConn.Execute("UPDATE Kit SET Status ='Applying Serial Numbers' WHERE ID =" & KitID & ";")
Else
CheckForReadyToLabel = 0
End If
End Function


Function CheckForFiles()
@@ -230,4 +295,17 @@ oConn.Open
CheckForJobsToCass = 0
End If
'oConn.Close
End Function

Public Function PadLeft(originalString,desiredLength,Char)
Dim padLength
padLength = desiredLength - Len(originalString)
If padLength > 0 Then
' Left pad the string with zeros
PadLeft = String(padLength, Char) & originalString
Else
' If the original string is already longer or equal to the desired length, no padding is needed
PadLeft = originalString
End If

End Function

Загрузка…
Отмена
Сохранить

Powered by TurnKey Linux.