12345678910111213141516171819 |
- from django.db import connection
- # 用于判断进货开票单是否存在
- def examine_ood(TB,TYPE,OOD,BIL_NO,BLI_NAME):
- """
- :param TB: 表名
- :param TYPE: 字段名
- :param OOD: 单号
- :param BIL_NO: 单据id
- :param BLI_NAME: 单据id值
- :return:
- """
- sql = "SELECT COUNT(*) FROM %s WHERE %s='%s' AND %s='%s'" % (TB, TYPE, OOD,BIL_NO,BLI_NAME)
- with connection.cursor() as cursor:
- # 判断单号是否重复
- row_ZL_NO = cursor.execute(sql).fetchall()[0][0]
- return row_ZL_NO
|