|
@@ -0,0 +1,84 @@
|
|
|
+from django import http
|
|
|
+from django.shortcuts import render
|
|
|
+
|
|
|
+
|
|
|
+from django.views import View
|
|
|
+from django.db import connection
|
|
|
+import datetime
|
|
|
+
|
|
|
+class InvoiceView(View):
|
|
|
+ def get(self,request):
|
|
|
+ a='A000002'
|
|
|
+ with connection.cursor() as cursor:
|
|
|
+ cursor.execute("INSERT INTO CUST(CUS_NO,[NAME])VALUES ('QQ12345',%s)",[a])
|
|
|
+ cursor.execute("UPDATE PRDT SET NAME='呜呜呜呜' where prd_no = %s", [a])
|
|
|
+ cursor.execute("select * from prdt where prd_no = %s", [a])
|
|
|
+ row = cursor.fetchall()
|
|
|
+ print(row)
|
|
|
+ context={
|
|
|
+ 'a':123
|
|
|
+ }
|
|
|
+ return http.JsonResponse(context)
|
|
|
+ def post(self,request):
|
|
|
+
|
|
|
+ ZL_NO = request.POST.get("ZL_NO")
|
|
|
+ LZ_DD = request.POST.get("LZ_DD")
|
|
|
+ INV_NO = request.POST.get("INV_NO")
|
|
|
+ INV_DD = request.POST.get("INV_DD")
|
|
|
+ ZHANG_ID = request.POST.get("ZHANG_ID")
|
|
|
+ TAX_ID = request.POST.get("TAX_ID")
|
|
|
+ AMT = request.POST.get("AMT")
|
|
|
+ CUS_NO = request.POST.get("CUS_NO")
|
|
|
+ CUS_NO_NAME = request.POST.get("CUS_NO_NAME")
|
|
|
+ UNI_NO_PAY = request.POST.get("UNI_NO_PAY")
|
|
|
+ SAL_ADR = request.POST.get("SAL_ADR")
|
|
|
+ SAL_TEL = request.POST.get("SAL_TEL")
|
|
|
+ USR = request.POST.get("USR")
|
|
|
+ USR_NAME = request.POST.get("USR_NAME")
|
|
|
+ print(ZL_NO)
|
|
|
+ print(LZ_DD)
|
|
|
+ print(INV_NO)
|
|
|
+ print(INV_DD)
|
|
|
+ print(ZHANG_ID)
|
|
|
+ print(TAX_ID)
|
|
|
+ print(AMT)
|
|
|
+ print(CUS_NO)
|
|
|
+ print(CUS_NO_NAME)
|
|
|
+ print(UNI_NO_PAY)
|
|
|
+ print(SAL_ADR)
|
|
|
+ print(SAL_TEL)
|
|
|
+ print(USR)
|
|
|
+ print(USR)
|
|
|
+ a = 'QQ12345'
|
|
|
+ with connection.cursor() as cursor:
|
|
|
+
|
|
|
+
|
|
|
+ row_ZL_NO = cursor.execute("SELECT COUNT(*) FROM MF_LZ1 WHERE LZ_NO=%s", [ZL_NO]).fetchall()[0][0]
|
|
|
+ if row_ZL_NO > 0:
|
|
|
+ return http.HttpResponseForbidden('单号重复')
|
|
|
+
|
|
|
+ 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])VALUES (%s,%s)", [CUS_NO,CUS_NO_NAME])
|
|
|
+
|
|
|
+
|
|
|
+ row_usr = cursor.execute("SELECT COUNT(*) FROM SALM WHERE SAL_NO=%s",[USR]).fetchall()[0][0]
|
|
|
+ if row_usr==0:
|
|
|
+ cursor.execute("INSERT INTO SALM(SAL_NO,[NAME])VALUES (%s,%s)", [USR,USR])
|
|
|
+
|
|
|
+
|
|
|
+ if int(ZHANG_ID) == 3:
|
|
|
+
|
|
|
+ cursor.execute("""INSERT INTO MF_PSS(PS_ID,PS_NO,PS_DD,CUS_NO,ZHANG_ID,USR,CHK_MAN,CLS_DATE,SYS_DATE,AMT,CUR_ID,EXC_RTO,LZ_CLS_ID,CLSLZ,TAX_ID)
|
|
|
+ VALUES('PC',%s,%s,%s,3,%s,%s,%s,%s,%s,
|
|
|
+ 'RMB',1,'F','F',1)""", ['PC'+ZL_NO[2::], datetime.datetime.strptime(LZ_DD,'%Y-%m-%d'),CUS_NO,USR,USR,datetime.datetime.strptime(LZ_DD,'%Y-%m-%d'),
|
|
|
+ datetime.datetime.strptime(LZ_DD, '%Y-%m-%d'),AMT])
|
|
|
+
|
|
|
+ cursor.execute("""INSERT INTO TF_PSS(PS_ID,PS_NO,PS_DD,WH,PRD_NO,QTY,UP,AMT,AMTN_NET,TAX_RTO,ITM,UNIT,CSTN_SAL)
|
|
|
+ VALUES('PC',%s,%s,'0000','AQ001',1,1,%s,%s,5,1,1,%s)""", ['PC'+ZL_NO[2::], datetime.datetime.strptime(LZ_DD, '%Y-%m-%d'),AMT,AMT,AMT])
|
|
|
+ context = {
|
|
|
+ 'a': 'POST提交'
|
|
|
+ }
|
|
|
+ return http.JsonResponse(context)
|
|
|
+
|
|
|
+
|