我有一个使用Rfid的老php系统。我们有一个转换Rfid代码的sql查询。我将PHP系统改为odoo11这里是SQL查询
UPDATE members set member_id=100000*floor(fob_id/65536)+(fob_id%65536)
它基本上是fob id乘以100000再除以65536 但后来他们发现,如果离岸价以7或9结尾,我想是计算错误了,所以地板部分总是四舍五入,除以它们后,剩余部分加上百分比。(我想是这样的)
如何在Python中获得与上述查询相同的结果(pythonversion3.5)
这是我的密码
@api.onchange('barcode2')
def _onchange_barcode2(self):
self.barcode = (self.barcode2)
a = (self.barcode2) * 100000
fob = (math.floor(a)) /65536 +(self.barcode2)%65536
self.memberid = fob
我有一个rfid号码0005225306,这应该是07947962,但与上述代码我得到8021146。你知道吗
我使用的%运算符正确吗?如果我在使用MySQLUPDATE members set member_id=100000*floor(fob_id/65536)+(fob_id%65536)
的旧PHP系统中输入0005225306,它将给出正确的值07947962。你知道吗
知道为什么我的python代码没有得到相同的值吗?你知道吗
我不知道你的
barcode*
字段和它们的数据类型,但是在解析它们时会很在意。这些计算的顺序很重要:相关问题 更多 >
编程相关推荐