Commit 0e3b9222 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

新增带量采购目录脚本

parent 46b88d96
# -*- encoding=utf8 -*-
from common.db.sql.sql_get_info import sql_get_info
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_a1_期初录入_新增_低值,id2301,id2301-1,sit,on
内网:a_a1_期初录入_新增_低值
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b4_herp3_InitStock"
"""
场景:a_a1_期初录入_新增_低值
用例名称:a_a1_期初录入_新增_低值
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_mcmsInitStock_insert_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
#从文件中获取库房名称,写脚本时用已经存在的库房,方便编写脚本和调试脚本
stock_name=commonFuc().get_business_data(module,'stock_name')
#============================================
#从基础数据模块写入的库房名称中获取(暂时注释)
# branch_name = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_name"]
# stock_name=branch_name+'中心库房'
#=============================================
#通过数据库获取库房id和库区id===============
stockId=sql_get_info().get_mcms_stock_info(stock_name)
areaCode=sql_get_info().get_mcms_stock_shelf_info(stockId)
stockId = stockId.replace("'", "")
areaCode=areaCode.replace("'","")
# 通过数据库获取库房id和库区id===============
# # 请求体
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
request_body = commonFuc().get_business_data(module, "payload", stockId,areaCode,hospitalId, branchId)
print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and len(data) >= 1 :
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
# 返回的单号写入文件
print(type(data), data)
list_a = []
list_b = []
list_c = []
list_a.append(data)
list_b.append(data)
list_c.append(data)
# print('list_a', len(list_a), list_a)
info = (list_a, list_b, list_c)
titlename = ('list_a', 'list_b', 'list_c')
# 将产品信息写入到文件中
FileUtils().w_info8(info, module, '期初单号低值', titlename, 'message')
test1()
# -*- encoding=utf8 -*-
from common.db.sql.sql_get_info import sql_get_info
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_a2_期初录入_新增_高值,id2301,id2301-2,sit,on
内网:a_a2_期初录入_新增_高值
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b4_herp3_InitStock"
"""
场景:a_a2_期初录入_新增_高值
用例名称:a_a2_期初录入_新增_高值
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_mcmsInitStock_insert_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
#从文件中获取库房名称,写脚本时用已经存在的库房,方便编写脚本和调试脚本
stock_name=commonFuc().get_business_data(module,'stock_name')
#============================================
#从基础数据模块写入的库房名称中获取(暂时注释)
# branch_name = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_name"]
# stock_name=branch_name+'中心库房'
#=============================================
#通过数据库获取库房id和库区id===============
stockId=sql_get_info().get_mcms_stock_info(stock_name)
areaCode=sql_get_info().get_mcms_stock_shelf_info(stockId)
stockId = stockId.replace("'", "")
areaCode=areaCode.replace("'","")
# 通过数据库获取库房id和库区id===============
# # 请求体
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
request_body = commonFuc().get_business_data(module, "payload_1", stockId,areaCode,hospitalId, branchId)
print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and len(data) >= 1 :
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
# 返回的单号写入文件
print(type(data), data)
list_a = []
list_b = []
list_c = []
list_a.append(data)
list_b.append(data)
list_c.append(data)
# print('list_a', len(list_a), list_a)
info = (list_a, list_b, list_c)
titlename = ('list_a', 'list_b', 'list_c')
# 将产品信息写入到文件中
FileUtils().w_info8(info, module, '期初单号高值', titlename, 'message')
test1()
# -*- encoding=utf8 -*-
from common.db.sql.sql_get_info import sql_get_info
from common.fileUtls import FileUtils
from common.timeUtils import timeUtils
__author__ = "xiaohesheng"
"""
case_tag:api,herp-web,a_a3_期初录入_新增_试剂,id2301,id2301-3,sit,on
内网:a_a3_期初录入_新增_试剂
"""
from common.common_func import commonFuc
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from airtest.core.api import using
import sys
def test1():
module = "b4_herp3_InitStock"
"""
场景:a_a3_期初录入_新增_试剂
用例名称:a_a3_期初录入_新增_试剂
输入:无
输出:"rtn_msg": {"code": 0, "msg": null, "data": true}
"""
# 内网登录
username = commonFuc().get_business_data(module, "username")
# print('医院名称',username)
password = commonFuc().get_business_data(module, "password")
# print(username, password,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
# 获取token和projectCode
token, projectCode, uxid, corpId, info = login_system(username, password).get_token()
# print( token,projectCode,uxid,corpId,info)
#
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "herpService_mcmsInitStock_insert_url")
print(url)
# 获取请求头信息
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
print('headers', headers)
# # #获取日期
# date1=timeUtils().get_time_hms(2)
# date2=timeUtils().get_time_add(-1)
# print(date1,date2)
#从文件中获取库房名称,写脚本时用已经存在的库房,方便编写脚本和调试脚本
stock_name=commonFuc().get_business_data(module,'stock_name')
#============================================
#从基础数据模块写入的库房名称中获取(暂时注释)
# branch_name = FileUtils().r_info('b2_herp3_bs', '院区新增')["branch_name"]
# stock_name=branch_name+'中心库房'
#=============================================
#通过数据库获取库房id和库区id===============
stockId=sql_get_info().get_mcms_stock_info(stock_name)
areaCode=sql_get_info().get_mcms_stock_shelf_info(stockId)
stockId = stockId.replace("'", "")
areaCode=areaCode.replace("'","")
# 通过数据库获取库房id和库区id===============
# # 请求体
hospitalId = commonFuc().get_business_data(module, "hospitalId")
branchId = commonFuc().get_business_data(module, "branchId")
request_body = commonFuc().get_business_data(module, "payload_2", stockId,areaCode,hospitalId, branchId)
print('request_body',request_body)
# 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('result', result)
# 断言
code = commonFuc().analysis_json('code', result)
data = commonFuc().analysis_json('data', result)
if code == 0 and len(data) >= 1 :
commonFuc().check_text_exist(0, result)
else:
commonFuc().check_text_exist('error', result)
# 返回的单号写入文件
print(type(data), data)
list_a = []
list_b = []
list_c = []
list_a.append(data)
list_b.append(data)
list_c.append(data)
# print('list_a', len(list_a), list_a)
info = (list_a, list_b, list_c)
titlename = ('list_a', 'list_b', 'list_c')
# 将产品信息写入到文件中
FileUtils().w_info8(info, module, '期初单号试剂', titlename, 'message')
test1()
......@@ -15,7 +15,19 @@ class delData(object):
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
print('院区数据已删除成功')
print('内网院区数据已删除成功')
cursor.close()
#删除融合外网的院区信息
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_platform_test2",
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
# sql = "DELETE from mcms_branch_info where id = '%s';" % id
sql = "DELETE from mcms_branch_info where name like '%东土城路院区_____';"
print(sql)
cursor.execute(sql)
cursor.execute("commit;")
print('外网院区数据已删除成功')
cursor.close()
def Delete_goods_change_info(self):
......
# -*- encoding=utf8 -*-
import pymysql
class sql_get_info(object):
def get_mcms_stock_info(self,stock_name="东土城院区中心库房"):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除新增的院区数据,减少垃圾数据的产生,保证脚本下次还可以正常运行,接口脚本每次都使用新增数据
# sql = "DELETE from mcms_branch_info where id = '%s';" % id
sql = "select id from mcms_stock_info where stock_name = '%s';"%stock_name
print(sql)
cursor.execute(sql)
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace('(', '')
new_str1 = new_str1.replace(')', '')
new_str1 = new_str1.replace(',', '')
print(new_str1)
cursor.close()
return new_str1
def get_mcms_stock_shelf_info(self,stock_id):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 删除产品信息修改数据
sql = "select shelf_code from mcms_stock_shelf where stock_id=%s and stock_type=0 and shelf_no='001';"%stock_id
print(sql)
cursor.execute(sql)
results = cursor.fetchone()
str1 = str(results)
new_str1 = str1.replace('(', '')
new_str1 = new_str1.replace(')', '')
new_str1 = new_str1.replace(',', '')
print(new_str1)
cursor.close()
return new_str1
# stock_id=sql_get_info().get_mcms_stock_info()
#
# sql_get_info().get_mcms_stock_shelf_info(stock_id)
"herpService_mcmsInitStock_insert_url": "/api/herpService/mcmsInitStock/insertInitStock"
data1: "10,20,60"
data2: "00001986,一次性医药包-低值,一次性医药包"
data3: "abcxxedd,1234456,',!@#$%,select,where 1=1"
data4: "国药集团,浙江医疗器材,有限公司"
data5: "00001,19,86,一次性,医药,包-低值,包"
data6: "20,50,100,200"
data7: "0,1,2,10,30"
data8: "YND,YBC,HDI"
data9: "16,10,20,25,40,60,66,67"
data10: "1,2,3,4,5"
data11: "0,30,40"
businessMode: "10,20,30"
status: "0,1,2,3,4,5"
closeStatus: "0,1"
status2: "10,20,30,40"
status3: "10,20,30,70"
"username": "xhs1009"
"password": "1qaz!QAZ"
"X-APP-CODE": "herp.pc"
"branchId": "h0347-2011"
"hospitalId": "h0347"
stock_name: "东土城院区中心库房"
json_contentType: "application/json"
json_headers: {
"Content-Type": "%s"
}
json_headers2: {
"Content-Type": "%s",
"token": "%s",
"X-APP-CODE":"%s"
}
"payload": {"stockId":"%s","areaCode":"%s","purMode":"10","hosId":"%s","branchId":"%s"}
"payload_1": {"stockId":"%s","areaCode":"%s","purMode":"20","hosId":"%s","branchId":"%s"}
"payload_2": {"stockId":"%s","areaCode":"%s","purMode":"60","hosId":"%s","branchId":"%s"}
checkDict2: {"code": 0,'msg': None,'data':1}
......@@ -56,7 +56,7 @@
<tr width="600">
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>1</td>
<td class='details-col-elapsed'>0分2</td>
<td class='details-col-elapsed'>0分7</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -72,9 +72,9 @@
</tr>
<tr width="600">
<td class="details-col-elapsed"><a href='../log/f0_院区单元包设置_查询产品信息/log.html' target='_blank'>f0_院区单元包设置_查询产品信息</a></td>
<td class="details-col-elapsed"><a href='../log/a_a3_期初录入_新增_试剂/log.html' target='_blank'>a_a3_期初录入_新增_试剂</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">2.032</td>
<td class="details-col-elapsed">7.183</td>
<td class="details-col-elapsed">xiaohesheng</td>
</tr>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment