cust_data.py 1.1 KB

1234567891011121314151617181920
  1. from django.db import connection
  2. def customer_data(CUS_NO,CUS_NO_NAME,OBJ_ID,DATE,RTO_TAX):
  3. """
  4. :param CUS_NO: 客户/厂商编码是的
  5. :param CUS_NO_NAME: 客户/厂商名称
  6. :param OBJ_ID: 客户厂商类别(1:客户,2:厂商)
  7. :param TAX_RTO: 税率
  8. :return:
  9. """
  10. with connection.cursor() as cursor:
  11. row_cus_no = cursor.execute("SELECT COUNT(*) FROM CUST WHERE CUS_NO=%s", [CUS_NO]).fetchall()[0][0]
  12. if row_cus_no == 0:
  13. cursor.execute("""
  14. INSERT INTO CUST(CUS_NO,[NAME],OBJ_ID,USR1,CHK_MAN,CLS_DATE,SYS_DATE,DEP,CLS_MTH,CLS_DD,MM_END,CHK_DD,CRD_ID,ID1_TAX
  15. ,CLS2,CUS_LEVEL,CHK_CRD,SO_CRD,CHK_FAX,CHK_CUS_IDX,CY_ID,CHK_INCLUDE,CHK_IRP,CHK_PAY1,PAY_FLAG,CHK_PAY2,CHK_PAY3,CHK_QK,CHK_IRP2,CHK_BARCODE,DATEFLAG_FQSK,
  16. CHK_KD,CHK_ZHANG_ID2,CHK_TYPE_MINXF,CHK_CK,CNT_MAN2
  17. )VALUES (%s,%s,%s,%s,%s,%s,%s,'00000000',1,2,30,30,1,1,1,'F',1,'F','F',1,'F','F','F','F',1,'F','F','1','F',1,1,'F','T',1,'T','APP')
  18. """,[str(CUS_NO),str(CUS_NO_NAME),str(OBJ_ID),'ADMIN','ADMIN',str(DATE),str(DATE)])
  19. return "ok"