examine_ood.py 538 B

12345678910111213141516171819
  1. from django.db import connection
  2. # 用于判断进货开票单是否存在
  3. def examine_ood(TB,TYPE,OOD,BIL_NO,BLI_NAME):
  4. """
  5. :param TB: 表名
  6. :param TYPE: 字段名
  7. :param OOD: 单号
  8. :param BIL_NO: 单据id
  9. :param BLI_NAME: 单据id值
  10. :return:
  11. """
  12. sql = "SELECT COUNT(*) FROM %s WHERE %s='%s' AND %s='%s'" % (TB, TYPE, OOD,BIL_NO,BLI_NAME)
  13. with connection.cursor() as cursor:
  14. # 判断单号是否重复
  15. row_ZL_NO = cursor.execute(sql).fetchall()[0][0]
  16. return row_ZL_NO