from django.db import connection

def customer_data(CUS_NO,CUS_NO_NAME,OBJ_ID,DATE,RTO_TAX):
    """
    :param CUS_NO: 客户/厂商编码是的
    :param CUS_NO_NAME: 客户/厂商名称
    :param OBJ_ID: 客户厂商类别（1：客户，2：厂商）
    :param TAX_RTO: 税率
    :return:
    """
    with connection.cursor() as cursor:
        row_cus_no = cursor.execute("SELECT COUNT(*) FROM CUST WHERE CUS_NO=%s", [CUS_NO]).fetchall()[0][0]
        if row_cus_no == 0:
            cursor.execute("""
            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
,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,
CHK_KD,CHK_ZHANG_ID2,CHK_TYPE_MINXF,CHK_CK,CNT_MAN2
)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')
            """,[str(CUS_NO),str(CUS_NO_NAME),str(OBJ_ID),'ADMIN','ADMIN',str(DATE),str(DATE)])
    return "ok"
