cardStorageOut.py
3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#coding=utf-8
# @Time : 2021/5/20 17:41
# @Author : Ljq
# @File : cardStorageOut.py
# @Software: PyCharm
"""
卡片出库接口
"""
import requests
import json
import re
import time
from commons.scripts import dealContentType as dCT
def cardAddOut(cardHost=None,webHeaders=None,**kwargs):
"""
卡片出库接口
:param cardHost:
:param webHeaders:
:param kwargs:
:return:
"""
url = cardHost+"/cardStorage/addOut.action"
webHeaders["Content-Type"] = "application/json; charset=UTF-8"
data={"applyUserName":"沈阳长歌","applyUserId":"230","applyUserCode":"scgy","amount":"1","cardNos":"210520174412"}
data = dict(data,**kwargs)
# print("data---->",data)
res = requests.post(url=url,headers=webHeaders,data=json.dumps(data))
return res
def getOutPage(cardHost=None,webHeaders=None,**kwargs):
"""
出库列表查询
:param cardHost:
:param webHeaders:
:param kwargs:{"rows":"10","page":"1","sort":"apply_time","order":"desc","cardNo":"210524144001","applyUserName":"长歌","applyUserId":"93","startDate":"2021-05-24 00:00:00","endDate":"2021-05-24 23:59:59"}
:return:
"""
url = cardHost+"/cardStorage/outPage.action"
webHeaders["Content-Type"] = "application/x-www-form-urlencoded"
data = {"rows": "10", "page": "1", "sort": "apply_time", "order": "desc"}
data = dict(data,**kwargs)
# print("data---->",data)
res = requests.post(url=url, headers=webHeaders, data=data)
return res
def getCardType(cardHost=None,webHeaders=None,**kwargs):
"""
获取卡片类别
:param cardHost:
:param webHeaders:
:param kwargs:
:return:
"""
url = cardHost+"/provider/getLookupList.action"
webHeaders = dCT.urlCode(webHeaders)
data = {'provider':'cardTypeProvider','queryParams':'{"emptyText":"-- 请选择 --"}'}
res = requests.post(url=url,headers=webHeaders,data=data)
return res
def getCardFace(cardHost=None,webHeaders=None,**kwargs):
"""
获取卡面信息
:param cardHost:
:param webHeaders:
:param kwargs:
:return:
"""
url = cardHost + "/provider/getLookupList.action"
webHeaders = dCT.urlCode(webHeaders)
data = {'provider':'cardFaceProvider','queryParams':'{emptyText:"-- 请选择 --"}'}
res = requests.post(url=url, headers=webHeaders, data=data)
return res
def checkCardForOut(cardHost=None,webHeaders=None,**kwargs):
"""
检验当前卡片选择的卡面是否正确
:param cardHost:
:param webHeaders:
:param kwargs:
:return:
"""
url = cardHost+"/cardStorage/checkCardForOut.action"
webHeaders= dCT.urlCode(webHeaders)
data = {"cardNo":"","cardType":"10","cardFace":""}
data=dict(data,**kwargs)
res = requests.get(url=url,headers=webHeaders,params=data)
return res
def getUserInfo(cardHost=None,webHeaders=None,**kwargs):
url = cardHost+"/user/listByKeyword.action"
webHeaders=dCT.urlCode(webHeaders)
data={"name":"scgy","keyword":"scgy"}
data=dict(data,**kwargs)
res = requests.post(url=url,headers=webHeaders,data=data)
return res
def getOutListDetail(cardHost=None,webHeaders=None,id=None):
url = cardHost+"/cardStorage/outDetail.html"
webHeaders = dCT.urlCode(webHeaders)
data = {"id":str(id)}
res = requests.get(url=url,headers=webHeaders,params=data)
return res
def getOutCardDetail(cardHost=None,webHeaders=None,**kwargs):
listRes = getOutPage(cardHost=cardHost, webHeaders=webHeaders,**kwargs)
firstId = listRes.json()["rows"][0]["id"]
# 查询出库详情
resDetail = getOutListDetail(cardHost=cardHost, webHeaders=webHeaders, id=firstId)
outCardDetail = re.findall("<ul><li>(.*?)</li></ul>", resDetail.text)
return sorted(outCardDetail)