-- 清空报价单相关
TRUNCATE TABLE ecw_offer;
TRUNCATE TABLE ecw_offer_log;
TRUNCATE TABLE ecw_offer_prod;
TRUNCATE TABLE ecw_offer_approval;
TRUNCATE TABLE ecw_offer_transport;
-- 清空订单相关
TRUNCATE TABLE ecw_order;
TRUNCATE TABLE ecw_order_item;
TRUNCATE TABLE ecw_order_time;
TRUNCATE TABLE ecw_order_split;
TRUNCATE TABLE ecw_order_mutual;
TRUNCATE TABLE ecw_order_pickup;
TRUNCATE TABLE ecw_order_approval;
TRUNCATE TABLE ecw_order_guanlian;
TRUNCATE TABLE ecw_order_location;
TRUNCATE TABLE ecw_order_consignee;
TRUNCATE TABLE ecw_order_consignor;
TRUNCATE TABLE ecw_order_departure;
TRUNCATE TABLE ecw_order_exception;
TRUNCATE TABLE ecw_order_objective;
TRUNCATE TABLE ecw_order_number_log;
TRUNCATE TABLE ecw_order_split_item;
TRUNCATE TABLE ecw_order_special_need;
TRUNCATE TABLE ecw_order_warehouse_in;
TRUNCATE TABLE ecw_order_cargo_control;
TRUNCATE TABLE ecw_order_fee_application;
TRUNCATE TABLE ecw_order_exception_result;
TRUNCATE TABLE ecw_order_warehouse_adjust;
TRUNCATE TABLE ecw_order_warehouse_picture;
TRUNCATE TABLE ecw_order_cargo_control_pick;
TRUNCATE TABLE ecw_order_warehouse_approval;
TRUNCATE TABLE ecw_order_label;
TRUNCATE TABLE ecw_merge;

-- 清理优惠信息相关
TRUNCATE TABLE ecw_coupon;
TRUNCATE TABLE ecw_coupon_line;
TRUNCATE TABLE ecw_coupon_prod;
TRUNCATE TABLE ecw_coupon_content;
TRUNCATE TABLE ecw_coupon_customer;
TRUNCATE TABLE ecw_coupon_use_record;


-- 线路脏数据，清理线路、路线价格
truncate table ecw_warehouse_line;
truncate table ecw_product_price;
truncate table ecw_product_price_step;
truncate table ecw_product_price_special;
-- truncate table ecw_product;
-- truncate table ecw_product_attr;
-- truncate table ecw_product_type;

-- 清理出货
truncate table ecw_box;
truncate table ecw_box_abnormal;
truncate table ecw_box_agent;
truncate table ecw_box_approval;
truncate table ecw_box_arrival;
truncate table ecw_box_arrival_air;
truncate table ecw_box_barge;
truncate table ecw_box_book_air;
truncate table ecw_box_book_sea;
truncate table ecw_box_cabinet;
truncate table ecw_box_cabinet_unload;
truncate table ecw_box_cabinet_unload_abnormal;
truncate table ecw_box_checkout_air;
truncate table ecw_box_clearance;
truncate table ecw_box_clearance_doc;
truncate table ecw_box_cost;
truncate table ecw_box_customs;
truncate table ecw_box_customs_extra_cost;
truncate table ecw_box_lading_bill;
truncate table ecw_box_lading_copy;
truncate table ecw_box_load_info;
truncate table ecw_box_number_record;
truncate table ecw_box_op_log;
truncate table ecw_box_preload_goods;
truncate table ecw_box_preload_section;
truncate table ecw_box_settlement;
truncate table ecw_box_ship_config;
truncate table ecw_box_shipping;
truncate table ecw_box_takeoff;
truncate table ecw_box_trailer;
truncate table ecw_box_tally;
truncate table ecw_make_bill_of_lading;


-- 清理客户，客户联系人
TRUNCATE TABLE ecw_customer;
TRUNCATE TABLE ecw_customer_contacts;
-- 清理客户佣金
TRUNCATE TABLE ecw_customer_commission;
TRUNCATE TABLE ecw_customer_commission_info;
-- 清理客户投诉
TRUNCATE TABLE ecw_customer_complaint;
-- 清理客户跟进
TRUNCATE TABLE ecw_customer_follow;
-- 清理客户线路
TRUNCATE TABLE ecw_customer_line;
-- 清理客户级别日志
TRUNCATE TABLE ecw_customer_level_log;
-- 清理客户信用日志
TRUNCATE TABLE ecw_customer_credit_log;


-- 清理用户相关
TRUNCATE TABLE member_user;
TRUNCATE TABLE member_user_card_auth;
TRUNCATE TABLE member_user_enterprise_auth;
TRUNCATE TABLE member_user_operation_log;

-- 清理品牌信息
TRUNCATE TABLE ecw_product_brank;
-- 清理品牌与商标关联表
TRUNCATE TABLE ecw_product_brand_trademark_rel;
-- 清理商品与商品分类多对多关联表
TRUNCATE TABLE ecw_product_brand_trademark_cateogry_rel;
-- 清理商品品牌-客户授权表
TRUNCATE TABLE ecw_product_brand_empower;
-- 清理商品品牌-未授权的收费模式表
TRUNCATE TABLE ecw_product_brand_unauth_empower;

-- 清理预定舱
truncate table ecw_future_box;

-- 清理站内信
TRUNCATE TABLE ecw_internal_message;
TRUNCATE TABLE ecw_internal_message_to;

-- 清理财务相关
TRUNCATE TABLE ecw_receipt;
TRUNCATE TABLE ecw_receipt_account;
TRUNCATE TABLE ecw_receipt_item;
TRUNCATE TABLE ecw_receivable;
TRUNCATE TABLE ecw_receivable_discount;

TRUNCATE TABLE ecw_payable;
TRUNCATE TABLE ecw_payment;

-- 清理工作流
TRUNCATE TABLE bpm_process_copy;
TRUNCATE TABLE bpm_process_instance_ext;
TRUNCATE TABLE bpm_task_ext;


truncate table act_hi_actinst;
truncate table act_hi_attachment;
truncate table act_hi_comment;
truncate table act_hi_detail;
truncate table act_hi_entitylink;
truncate table act_hi_identitylink;
truncate table act_hi_procinst;
truncate table act_hi_taskinst;
truncate table act_hi_varinst;
truncate table act_hi_tsk_log;


truncate table act_ru_actinst;
truncate table act_ru_deadletter_job;
truncate table act_ru_entitylink;
truncate table act_ru_event_subscr;

truncate table act_ru_external_job;
truncate table act_ru_history_job;
truncate table act_ru_identitylink;
truncate table act_ru_job;
truncate table act_ru_suspended_job;
truncate table act_ru_timer_job;
truncate table act_ru_variable;
SET foreign_key_checks = 0;
truncate table act_ru_execution;
truncate table act_ru_task;
SET foreign_key_checks = 1;

-- 清理业绩
TRUNCATE TABLE ecw_target_log;
TRUNCATE TABLE ecw_dept_target;

-- 通知、咨询、建议
TRUNCATE TABLE system_notice;
TRUNCATE TABLE system_sms_log;
TRUNCATE TABLE system_operate_log;
TRUNCATE TABLE system_mail_log;
TRUNCATE TABLE system_login_log;
TRUNCATE TABLE infra_job_log;
TRUNCATE TABLE ecw_message;
TRUNCATE TABLE ecw_message_leave;

--清理供应商
TRUNCATE TABLE ecw_supplier;
TRUNCATE TABLE ecw_supplier_bank;
TRUNCATE TABLE ecw_supplier_contacts;
