invoice_dh.py 999 B

1234567891011121314151617181920212223
  1. from django import http
  2. from utils.examine_ood import examine_ood
  3. def invoice_dh(ZHANG_ID,ZL_NO,BIL_NO,BLI_NAME):
  4. if int(ZHANG_ID) != 1 and int(ZHANG_ID) != 2:
  5. return http.HttpResponseForbidden('立账方式只能是1(开票),2(不开票)')
  6. # 判断进货单号是存在
  7. if int(ZHANG_ID) == 1:
  8. row_ZL_NO = examine_ood('MF_PSS', 'PS_NO', 'PC' + ZL_NO[2::],BIL_NO,BLI_NAME)
  9. if row_ZL_NO == 0:
  10. return http.HttpResponseForbidden('进货单号不存在')
  11. # 判断开票单号是否存在
  12. if int(ZHANG_ID) == 2:
  13. row_ZL_NO = examine_ood('MF_LZ1', 'LZ_NO', ZL_NO,BIL_NO,BLI_NAME)
  14. if row_ZL_NO == 0:
  15. return http.HttpResponseForbidden('开票单号不存在')
  16. # 判断是否产生后续单据
  17. row_ZL_NO = examine_ood('TC_MON', 'ARP_NO', 'AP'+ZL_NO[2::],BIL_NO,BLI_NAME)
  18. print(row_ZL_NO)
  19. if row_ZL_NO > 0:
  20. return http.HttpResponseForbidden('开票单或进货单已产生后续收付款单')