Trouble with IDs

Hello,

I am getting strange results with the following code:

  def self.process_product(supplier_productid)
    local_product = Product.find(:first, :conditions => ["supplierid =
9 and supplier_productid = :id", {:id => supplier_productid}])

    if local_product
      local_product.update_attributes(attributes)

      begin
        supplier_stock = SupplierStock.find(local_product.productid)
      rescue Exception => e
        puts e.to_s
        supplier_stock = SupplierStock.new(
          :id => local_product.productid,
          :yesterday_stock => stock || -999,
          :current_stock => stock || -999
        )
### supplier_stock[:productid] = local_product.productid
        supplier_stock.save
      else
        supplier_stock.yesterday_stock = supplier_stock.current_stock
        supplier_stock.current_stock = stock
        supplier_stock.save
      end
    else
      ...

The database information: