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

流程十脚本编写

parent 067b7b76
......@@ -1989,12 +1989,18 @@ def check_accept_order():
settlement = 'settlement'
recTemperature = 'recTemperature'
recHumidity = 'recHumidity'
hosGoodsId = 'hosGoodsId'
distrQty = 'distrQty'
distrPkgQty = 'distrPkgQty'
for i in list_a:
for j in i:
viewId = j["viewId"]
settlement = j["settlement"]
recTemperature = j['recTemperature']
recHumidity = j['recHumidity']
hosGoodsId = j['hosGoodsId']
distrQty = j['distrQty']
distrPkgQty = j['distrPkgQty']
break
# ==============================查看订单详情==================
# ========设置验收全部合格
......@@ -2029,13 +2035,21 @@ def check_accept_order():
provName = sourceOrgName
createUser = uxid
sourceNo = sourceId
checkQty = distrQty
checkPkgQty = distrPkgQty
time.sleep(6)
# request_body = commonFuc().get_business_data(module, "payload3", billMode, branch_id, deptId, deptName, hos_id,
# provId, provName, recOrgId, recOrgName, sourceId, sourceVersion,
# sourceType, tbStatus, createUser, sourceNo, viewId, viewId, settlement,
# recTemperature, recHumidity)
request_body = commonFuc().get_business_data(module, "payload3", billMode, branch_id, deptId, deptName, hos_id,
provId, provName, recOrgId, recOrgName, sourceId, sourceVersion,
sourceType, tbStatus, createUser, sourceNo, viewId, viewId, settlement,
recTemperature, recHumidity)
sourceType, tbStatus, createUser, sourceNo, viewId, hosGoodsId, viewId,
settlement,
checkQty, distrPkgQty, checkPkgQty, recTemperature, recHumidity)
print('request_body', '提交验收单', request_body)
print('request_body', 'c', request_body)
# 发送请求
while True:
time.sleep(3)
......
......@@ -462,21 +462,169 @@ class delData(object):
cursor.execute("commit;")
print('内网边仓删除成功')
cursor.close()
def get_branch_id(self):
# 获取院区数据
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023", database="spd3_herp_test2",
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
# 获取库区version
sql = "select id from mcms_branch_info;"
print(sql)
branch_id = "select id from mcms_branch_info"
hosGoodsId1 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message1')['hosGoodsId']
hosGoodsId2 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message2')['hosGoodsId']
hosGoodsId3 = FileUtils().r_info8("b5_spd3_core_business_flow", "产品审核信息", 'message3')['hosGoodsId']
# 条码
sql1 = "delete from mcms_pkg where branch_id not in'%s';" % branch_id
sql2 = "delete from mcms_pkg_batch where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from hdi_barcode where branch_id not in'%s';" % branch_id
# sql4 = "delete from cabinet_epc_info where branch_id not in%s" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 批次
sql = "delete from mcms_hos_batch where branch_id not in'%s'" % branch_id
cursor.execute(sql)
results = cursor.fetchall()
for row in results:
print("id:", row[0])
cursor.execute("commit;")
# 库存
sql1 = "delete from mcms_stockpile where branch_id not in'%s';" % branch_id
sql2 = "delete from mcms_stockpile_taking where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from mcms_stockpile_flow where branch_id not in'%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 采购
sql = "delete from mcms_purchase_detail where order_no in(select order_no from mcms_purchase where branch_id not in'%s');" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
sql = "delete from mcms_pur_plan_detail where prov_name like '%国药集团公司_____';"
cursor.execute(sql)
cursor.execute("commit;")
sql = "delete from mcms_pur_plan where branch_id not in '%s';" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
sql = "delete from mcms_purchase where branch_id not in '%s';" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
dept1 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid1']
dept2 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid2']
dept3 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid3']
dept4 = FileUtils().r_info8("b2_herp3_bs", "所有科室id", 'message6')['deptid4']
# 拣货单
sql4 = "delete from mcms_pick_detail where pid in(select id from mcms_pick where branch_id not in'%s');" % branch_id
sql1 = "delete from mcms_pick where branch_id not in '%s';" % branch_id
sql2 = "delete from mcms_pick_gen where dept_id in('%s','%s','%s','%s')" % (dept1, dept2, dept3, dept4)
sql3 = "delete from mcms_pick_batch where hos_goods_id in('%s','%s','%s')" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
cursor.execute(sql4)
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 验收单
sql1 = "delete from mcms_check where branch_id ='%s';" % branch_id
sql2 = "delete from mcms_check_batch where hos_goods_id in('%s','%s','%s')" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute("commit;")
# 配送单
sql1 = "delete from hdi_distr_barcode where pid in(select id FROM hdi_distr where branch_id not in'%s');" % branch_id
sql2 = "delete from hdi_distr where branch_id not in'%s';" % branch_id
sql3 = "delete from hdi_distr_detail where hos_goods_id in('%s','%s','%s')" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 单据
sql1 = "delete from mcms_psi where target_branch_id not in'%s';" % branch_id
sql6 = "delete from mcms_psi where target_dept_name like '%国药集团公司_____';"
sql2 = "delete from mcms_psi_batch where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from mcms_psi_dept where target_branch_id not in'%s';" % branch_id
sql4 = "delete from mcms_psi_dept_batch where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql5 = "delete from his_order where branch_id not in'%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute(sql5)
cursor.execute(sql6)
cursor.execute("commit;")
# print(new_str1)
print(results)
# 手术通知单
sql1 = "delete from mcms_operation_apply where branch_id not in'%s';" % branch_id
sql2 = "delete from mcms_operation_apply_list where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
sql3 = "delete from mcms_operation_notice where branch_id not in'%s';" % branch_id
sql4 = "delete from mcms_operation_notice_list where hos_goods_id in('%s','%s','%s');" % (
hosGoodsId1, hosGoodsId2, hosGoodsId3)
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute("commit;")
# 结算
sql1 = "delete from mcms_out_balance where branch_id not in'%s';" % branch_id
sql2 = "delete from mcms_out_balance_detail where prov_name like '%国药集团公司_____';"
sql3 = "delete from mcms_out_un_balance where branch_id not in'%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 发票
sql1 = "delete from mcms_invoice where prov_name like '%国药集团公司_____';"
sql2 = "delete from mcms_invoice_comment where pid in(select invoice_id from mcms_invoice_ext_detail where pid in(select id from mcms_invoice_ext where prov_name like '%国药集团公司_____'));"
sql3 = "delete from mcms_invoice_ext_detail where pid in(select id from mcms_invoice_ext where prov_name like '%国药集团公司_____');"
sql4 = "delete from mcms_invoice_ext where prov_name like '%国药集团公司_____';"
sql5 = "delete from mcms_invoice_detail where branch_id not in'%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute(sql5)
cursor.execute("commit;")
# 退货
sql1 = "delete from yb_return_batch where pid in(select id from yb_return where prov_name like '%国药集团公司_____');"
sql2 = "delete from yb_return where prov_name like '%国药集团公司_____';"
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute("commit;")
# 请领单
sql1 = "delete from mcms_dept_buy_detail where pid in (select id from mcms_dept_buy where branch_id not in'%s');" % branch_id
sql2 = "delete from mcms_dept_buy where branch_id not in'%s';" % branch_id
sql3 = "delete from mcms_dept_buy_car where branch_id not in'%s';" % branch_id
sql4 = "delete from mcms_dept_patient where id ='自动化测试';"
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute("commit;")
# 报表
sql1 = "delete from portal_card where branch_id not in'%s';" % branch_id
sql2 = "delete from portal_chart where branch_id not in'%s';" % branch_id
sql3 = "delete from portal_worklist where branch_id not in'%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
print('业务数据,包括采购,出入库,结算等数据删除成功')
cursor.close()
# return new_str1
# delData().Delete_branch_by_id()
......
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