Permalink
Browse files

ændret i methods.py sorting_script robot sqlhandler og measure

  • Loading branch information...
1 parent 2e21b43 commit 18ab9db0f27b7f311bd20f623a20190d80ff6847 Salizer committed May 31, 2012
@@ -3,6 +3,8 @@
import ControlSystem
clr.AddReference("System.Data")
import System.Data.SqlClient
+clr.AddReference("SqlInteraction")
+import SqlInteraction
# coordinates movement function
def moveByCoordinates(x,y,z):
@@ -139,6 +141,18 @@ def insertBox(position_id,length,width,depth,weight):
print "box inserted succesfully"
return True
+def getPositionIDFromMeasurements(volume,weight):
+ volumeDifference = 2
+ weightDifference = 1
+ command = _sqlhandler.makeCommand("SELECT PositionID FROM BoxInfo WHERE Volume <= "+str(volume+volumeDifference).replace(',','.')+"AND Volume >="+str(volume-volumeDifference).replace(',','.')+"AND Weight <= "+str(weight+weightDifference).replace(',','.')+"AND Weight >="+str(weight-weightDifference).replace(',','.'))
+ reader = _sqlhandler.runQuery(command, 'read')
+ list = reader.readRow()
+ reader.close()
+ if (len(list) != 0):
+ return list[0]
+ else:
+ return -1
+
def removeBox(box_id):
try:
command = _sqlhandler.makeCommand("DELETE FROM BoxInfo WHERE BoxID = "+str(boxid))
@@ -502,6 +502,7 @@ public bool moveToCubePosition(string vectorname,int _iCubeID)
else
return false;
}
+
#endregion
#region Axis movements
@@ -80,7 +80,7 @@ public SqlCommand makeCommand(string _commandText)
command.CommandTimeout = Connection.TimeOut;
command.CommandType = CommandType.Text;
command.CommandText = _commandText;
-
+
return command;
}
View
Binary file not shown.

0 comments on commit 18ab9db

Please sign in to comment.