Commit 630b1c2a authored by xiao-hesheng's avatar xiao-hesheng
Browse files

流程五脚本提交

parent 3929fb48
......@@ -323,9 +323,8 @@ class delData(object):
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
# 批次
sql = "delete from mcms_hos_batch where branch_id='%s'" % branch_id
sql = "delete from mcms_hos_batch where branch_id='%s';" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
# 库存
......@@ -465,7 +464,170 @@ class delData(object):
print('业务数据,包括采购,出入库,结算等数据删除成功')
cursor.close()
def Delete_business_Data_current_branch(self,type=1,branch_id='branch_id'):
# 删除业务数据,包括采购,出入库,结算等
connection = pymysql.connect(host="10.17.65.108", user="root", password="Cmic.2023",
database="spd3_herp_test2",
charset="utf8")
cursor = connection.cursor()
if type==1:
branch_id = FileUtils().r_info8('b2_herp3_bs', "院区新增", 'message')['branch_id']
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='%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='%s';" % branch_id
# sql4 = "delete from cabinet_epc_info where branch_id=%s" % branch_id
# cursor.execute(sql1)
# cursor.execute(sql2)
# cursor.execute(sql3)
# cursor.execute("commit;")
# 批次
sql = "delete from mcms_hos_batch where branch_id='%s';" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
# 库存
sql1 = "delete from mcms_stockpile where branch_id='%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='%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='%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= '%s';" % branch_id
cursor.execute(sql)
cursor.execute("commit;")
sql = "delete from mcms_purchase where branch_id= '%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='%s');" % branch_id
sql1 = "delete from mcms_pick where branch_id= '%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='%s');" % branch_id
sql2 = "delete from hdi_distr where branch_id='%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='%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='%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='%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute(sql4)
cursor.execute(sql5)
cursor.execute(sql6)
cursor.execute("commit;")
# 手术通知单
sql1 = "delete from mcms_operation_apply where branch_id='%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='%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='%s';" % branch_id
sql2 = "delete from mcms_out_balance_detail where prov_name like '%国药集团公司_____';"
sql3 = "delete from mcms_out_un_balance where branch_id='%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='%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='%s');" % branch_id
sql2 = "delete from mcms_dept_buy where branch_id='%s';" % branch_id
sql3 = "delete from mcms_dept_buy_car where branch_id='%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='%s';" % branch_id
sql2 = "delete from portal_chart where branch_id='%s';" % branch_id
sql3 = "delete from portal_worklist where branch_id='%s';" % branch_id
cursor.execute(sql1)
cursor.execute(sql2)
cursor.execute(sql3)
cursor.execute("commit;")
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",
......
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