Commit 72244564 authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程十脚本编写

parent d515a1a6
......@@ -4,6 +4,7 @@ import traceback
from air_case.b1_herp3_login.登录内网系统.登录内网系统 import login_system
from air_case.public1.public1.public1 import *
from common.db.sql.sql_del_branch_info import delData
from common.fileUtls import FileUtils
from common.run_cmd_script import execute_command
......@@ -17,8 +18,10 @@ case_tag:api,spd_core1,a_b3流程十请领业务流_二级库向边仓,id2302,id
核心业务流:a_b3流程十请领业务流_二级库向边仓
python runner_test.py tag id2302-13 debug mdm3
"""
def SERACH_goods_id(GoodsId):
module='b5_spd3_core_business_flow'
module = 'b5_spd3_core_business_flow'
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
username = info['username1']
......@@ -31,14 +34,18 @@ def SERACH_goods_id(GoodsId):
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "herpService_mcmsBranchGoodsInfo_page_url")
dept1=FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_mcmsBranchGoodsInfo_page_url")
dept1 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
# hosGoodsId = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
# GoodsId = hosGoodsId.replace(get_hosid(), '')
request_body = commonFuc().get_business_data(module, "payload53", GoodsId,get_hosid(),get_branch_id(),dept1)
request_body = commonFuc().get_business_data(module, "payload53", GoodsId, get_hosid(), get_branch_id(), dept1)
result = commonFuc().http_post(url, request_body, headers)
branchGoodsId=commonFuc().analysis_json('id',commonFuc().analysis_json('data',commonFuc().analysis_json('data',result)))
branchGoodsId = commonFuc().analysis_json('id', commonFuc().analysis_json('data', commonFuc().analysis_json('data',
result)))
return branchGoodsId
def goods_move():
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
......@@ -49,25 +56,26 @@ def goods_move():
token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束
module = "b2_herp3_bs"
#g0_请领出库渠道设置_转移产品到边仓
url=commonFuc().get_api_add_port_url()+commonFuc().get_business_data(module, "updateSettleType_url")
# g0_请领出库渠道设置_转移产品到边仓
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module, "updateSettleType_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"))
commonFuc().get_business_data(module, "X-APP-CODE"))
for i in range(1, 4):
info = FileUtils().r_info8('b5_spd3_core_business_flow', "产品审核信息", 'message%s' % i)
hosGoodsId = info['hosGoodsId']
GoodsId = hosGoodsId.replace(get_hosid(), '')
branchGoodsId = SERACH_goods_id(GoodsId)
# #请求体
request_body = commonFuc().get_business_data(module, "payload47", branchGoodsId,hosGoodsId,get_branch_id())
request_body = commonFuc().get_business_data(module, "payload47", branchGoodsId, hosGoodsId, get_branch_id())
print(request_body)
# # # 发送请求
result = commonFuc().http_post(url, request_body, headers)
print('goods_move,result', result)
def second_dept_Request(hosGoodsId, type):
module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始
......@@ -158,6 +166,8 @@ def second_dept_Request(hosGoodsId, type):
result = commonFuc().http_post(url, request_body, headers)
print('添加到请领车,result', result)
# 添加到请领车=============================================
def BuyCarSubmit():
module = "b5_spd3_core_business_flow"
# # 登录获取用户id等信息,使用创建的用户登录===========开始
......@@ -217,46 +227,68 @@ def BuyCarSubmit():
result = commonFuc().http_post(url, request_body, headers)
print('创建领车交易,result', result)
currentTaskList = commonFuc().analysis_json('currentTaskList', commonFuc().analysis_json('data', result))
def add_logic_stock():
module = "b5_spd3_core_business_flow"
#登录集中管控平台
def add_logic_stock():
delData().Delete_yb_logic_stock()
module = "b5_spd3_core_business_flow"
# 登录集中管控平台
token, projectCode, uxid, corpId, info = login_platform()
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #添加云仓===============================================
url = commonFuc().get_api_add_port_url() + commonFuc().get_business_data(module,
"herpService_buy_queryBuyCarPage_url")
print('请领车查询=================', url)
deptid2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
deptname2 = FileUtils().r_info8("b2_herp3_bs", "所有科室name", 'message6')['deptid2']
areaCode = get_stockAreaId_new(deptid2, deptname2, 2)
request_body = commonFuc().get_business_data(module, "payload43", areaCode, get_hosid(), deptid2)
url = commonFuc().get_api_url() + commonFuc().get_business_data(module,
"platformService_basic_logic_save_url")
print('添加云仓=================', url)
print('请领车查询', 'request_body', request_body)
request_body = commonFuc().get_business_data(module, "payload54", get_hosid(), get_branch_id(), get_branch_id(),
uxid, uxid, get_in_userid(), get_hosid(), uxid, uxid)
print('添加云仓', 'request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('请领车查询,result', result)
try:
#科室必须同步到外网,集中管控平台创建边仓才能选择到用户,"deptType":"0"
print('添加云仓,result', result)
def cloud_stock_opeartion():
print('云仓处理')
# 云仓登录
token, projectCode, uxid, corpId, info =login_logic_stock()
module = "b5_spd3_core_business_flow"
headers = commonFuc().get_business_data(module, "json_headers2",
commonFuc().get_business_data(module, "json_contentType"), token,
commonFuc().get_business_data(module, "X-APP-CODE"))
# #云仓处理查看单据===============================================
url = commonFuc().get_api_url() + commonFuc().get_business_data(module,
"platformService_basic_logic_save_url")
print('云仓处理查看单据=================', url)
request_body = commonFuc().get_business_data(module, "payload54", get_hosid(), get_branch_id(), get_branch_id(),
uxid, uxid, get_in_userid(), get_hosid(), uxid, uxid)
print('云仓处理查看单据', 'request_body', request_body)
result = commonFuc().http_post(url, request_body, headers)
print('云仓处理查看单据,result', result)
try:
set_dept_lead() # 设置二级科室负责人
# 科室必须同步到外网,集中管控平台创建边仓才能选择到用户,"deptType":"0"
add_logic_stock()
# token, projectCode, uxid, corpId, info =login_logic_stock()
# print(token, projectCode, uxid, corpId, info)
#设置产品出库渠道为边仓
# 设置产品出库渠道为边仓
goods_move()
updateUserLoginDefaultRange(get_listUserMgrRangePage(2)) # 设置登录账号默认权限是二级库
# # 低值
# # # 低值
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId'], 1)
# # 高值
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId'], 2)
# # 试剂
second_dept_Request(FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId'], 3)
BuyCarSubmit() # 请领车提交
# for i in range(6): # 三个单据共审批6次
# approval_center()
for i in range(6): # 三个单据共审批6次
approval_center()
commonFuc().check_text_exist_result_text('succees', 'succees')
except:
commonFuc().check_text_exist_result_text('error', '1')
......@@ -2476,6 +2476,9 @@ def login_platform():
def login_logic_stock():
module = "b5_spd3_core_business_flow"
from air_case.mdm_login.登录外网系统.登录云仓 import login_system
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
username = info['username1']
# 登录
username = commonFuc().get_business_data(module, "username2")
password = commonFuc().get_business_data(module, "password")
......@@ -2514,4 +2517,14 @@ def branch_add():
name=commonFuc().analysis_json('name',commonFuc().analysis_json('data',result))
# print(id1,name,'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
return id1,name
\ No newline at end of file
return id1,name
def get_in_userid():
# # 登录获取用户id等信息,使用创建的用户登录===========开始
info = FileUtils().r_info8('b2_herp3_bs', "用户名信息", 'message3')
username = info['username1']
password = commonFuc().get_business_data("b2_herp3_bs", "password")
print('username,password', username, password)
# # 获取token和projectCode
token, projectCode, uxid, corpId, info = login(username, password, 2)
# 登录获取用户id等信息,使用创建的用户登录============结束
return uxid
......@@ -437,7 +437,29 @@ class delData(object):
print('业务数据,包括采购,出入库,结算等数据删除成功')
cursor.close()
def Delete_yb_logic_stock(self):
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_platform_test2",
charset="utf8")
cursor = connection.cursor()
sql1 = "delete from yb_logic_stock where logic_name like '%自动化测试_____';"
print(sql1)
cursor.execute(sql1)
cursor.execute("commit;")
print('外网边仓删除成功')
cursor.close()
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id']
sql1 = "delete FROM yb_direct WHERE branch_id ='%s';"%branch_id
print(sql1)
cursor.execute(sql1)
cursor.execute("commit;")
print('内网边仓删除成功')
cursor.close()
# delData().Delete_branch_by_id()
# delData().Delete_goods_change_info()
# delData().Delete_sys_config()
......@@ -449,4 +471,5 @@ class delData(object):
# delData().Del_supply_relation()
# delData().Delete_business_Data()
# delData().Del_reporter_data()
\ No newline at end of file
# delData().Del_reporter_data()
# delData().Delete_yb_logic_stock()
\ No newline at end of file
......@@ -54,8 +54,10 @@
"mcmsInvoice_getById_url": "/api/herpService/mcmsInvoice/getById/"
"herpService_BuyPick_updateStatus_url": "/api/herpService/BuyPick/updateStatus?pickId="
"herpService_mcmsBranchGoodsInfo_page_url": "/api/herpService/basic/mcmsBranchGoodsInfo/page"
"platformService_basic_logic_save_url": "/api/platformService/basic/logic/save"
"username": "xhs1009"
"username2": "test001"
"password": "1qaz!QAZ"
"password1": "a123456!"
"X-APP-CODE": "herp.pc"
......@@ -129,4 +131,4 @@ json_headers2: {
"payload52": {"batchList":[{"id":"%s","lastModified":null,"version":null,"createTime":"%s","createUser":null,"lastModifiedUser":null,"snCode":"%s","hosId":"%s","branchId":null,"stockId":"%s","areaCode":"%s","areaName":"%s","shelfCode":"%s","codeType":"%s","tagType":"%s","hosGoodsId":"%s","mdmGoodsCode":"%s","goodsCode":"%s","goodsDi":"%s","barName":"%s","batchCode":"%s","expdtDate":"%s","productDate":"%s","mfrCode":null,"mfrCodeSee":null,"pkgCode":"%s","pkgCodeSee":"%s","ssccCode":"%s","extInfo":null,"outId":null,"tbStatus":"%s","goodsCodeDi":null,"barcodeId":null,"ext":{"distrDetailId":"%s","distrBillId":"%s","certificateCode":"","purBillId":"%s","pkgDefQty":"%s","pkgDefId":"%s","pkgDefName":"%s"},"sourceDetailId":null,"purMode":"%s","purModes":null,"price":null,"pid":null,"goodsMfrsName":"%s","mfrsName":null,"goodsSpec":"%s","unit":"%s","goodsName":"%s","pkgDefId":"%s","pkgDefQty":"%s","purDetailId":null,"pkgDefName":"%s","printNum":0,"deptId":null,"deptName":null,"billId":null,"taskId":null,"made":"%s","provId":null,"provName":null,"subProvId":null,"subProvName":null,"provHosGoodsId":null,"sourceType":null,"taskDate":null,"sourceOrderNo":null,"taskType":null,"detailId":null,"branchGoodsPkgDefList":null,"unitName":null,"areaCodeList":null,"diType":null,"mdmGoodsSpecCode":null,"hosGoodsCode":"%s","supplyId":null,"inSettlement":null,"spdGoodsCode":null,"codeKind":null,"brand":null,"miCode":null,"transferRatio":1,"miDjmc":null,"tbStatusList":null,"purModeText":null,"stockName":null,"tbStatusText":null,"pkgType":null,"bottleId":null,"pkgStatus":null,"qty":null,"packUnit":null,"minSaleQty":null,"rfidFlag":null,"mfrCodeFlag":null,"scanStatus":null,"scanId":null,"multiChargeFlag":null,"useFrequency":null,"chargeUnit":null,"lockStatus":null,"remark":null}],"sourceId":"%s","sourceType":"KS","sourceVersion":"3","remark":"","reviewAll":0}
"payload50_2": {"areaCode":"%s","hdiList":[{"id":"%s","lastModified":null,"version":null,"createTime":"%s","createUser":null,"lastModifiedUser":null,"snCode":"%s","hosId":"%s","branchId":null,"stockId":"%s","areaCode":"%s","areaName":"%s","shelfCode":"%s","codeType":"%s","tagType":"%s","hosGoodsId":"%s","mdmGoodsCode":"%s","goodsCode":"%s","goodsDi":"%s","barName":"%s","batchCode":"%s","expdtDate":"%s","productDate":"%s","mfrCode":null,"mfrCodeSee":null,"pkgCode":"%s","pkgCodeSee":"%s","ssccCode":"%s","extInfo":null,"outId":null,"tbStatus":"%s","goodsCodeDi":null,"barcodeId":null,"ext":{"distrDetailId":"%s","distrBillId":"%s","certificateCode":"","purBillId":"%s","pkgDefQty":"%s","multiChargeFlag":0,"useFrequency":1},"sourceDetailId":null,"purMode":"%s","purModes":null,"price":null,"pid":null,"goodsMfrsName":"%s","mfrsName":null,"goodsSpec":"%s","unit":"%s","goodsName":"%s","pkgDefId":null,"pkgDefQty":null,"purDetailId":null,"pkgDefName":null,"printNum":"%s","deptId":null,"deptName":null,"billId":null,"taskId":null,"made":"%s","provId":null,"provName":null,"subProvId":null,"subProvName":null,"provHosGoodsId":null,"sourceType":null,"taskDate":null,"sourceOrderNo":null,"taskType":null,"detailId":null,"branchGoodsPkgDefList":null,"unitName":null,"areaCodeList":null,"diType":null,"mdmGoodsSpecCode":null,"hosGoodsCode":"%s","supplyId":null,"inSettlement":null,"spdGoodsCode":null,"codeKind":null,"brand":null,"miCode":null,"transferRatio":1,"miDjmc":null,"tbStatusList":null,"purModeText":null,"stockName":null,"tbStatusText":null,"pkgType":null,"bottleId":null,"pkgStatus":null,"qty":null,"packUnit":null,"minSaleQty":null,"rfidFlag":null,"mfrCodeFlag":null,"scanStatus":null,"scanId":null,"multiChargeFlag":null,"useFrequency":null,"chargeUnit":null,"lockStatus":null,"remark":null}],"id":"%s","areaName":"%s","stockName":"%s"}
"payload53": {"queryObject":{"goodsName":"%s","goodsMfrsName":"","purModes":[],"hosId":"%s","branchId":"%s","goodsSpec":"","importGrantRule":2,"deptId":"%s"},"pageNum":1,"pageSize":50}
"payload54": {"logicInfo":{"logicName":"自动化测试12345","simpleName":"自动","stockId":"ST2023122800001","hosId":"%s","mgrMode":"0","purBranchId":"%s","leader":"自动化测试","phone":"自动化测试","tbStatus":1,"delFlag":0,"branchIds":["%s"],"createUser":"%s","lastModifiedUser":"%s"},"mgrRange":{"userId":"%s","corpId":"%s","mgrRangeName":"自动化测试12345","mgrRangeKind":2,"defaultFlag":1,"projectCode":"warehouse","createUser":"%s","lastModifiedUser":"%s","extStr1":"3.0实体仓"}}
......@@ -35,7 +35,7 @@
tempFlag: 0
grantWay: 2
deptGoodsStatus:
codingType:
codingType: 0
purModeText: 检验试剂
goodsGeneralName: 检测试剂
provName: 国药集团公司p0t4h
......
......@@ -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分30</td>
<td class='details-col-elapsed'>0分54</td>
<td class="details-col-elapsed">100.0%</td>
</tr>
</table>
......@@ -74,7 +74,7 @@
<tr width="600">
<td class="details-col-elapsed"><a href='../log/a_b3流程十请领业务流_二级库向边仓/log.html' target='_blank'>a_b3流程十请领业务流_二级库向边仓</a></td>
<td class="success">成功</td>
<td class="details-col-elapsed">30.031</td>
<td class="details-col-elapsed">54.132</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