清理备件导入+仓库数据-乌干达.txt 985 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. # 注意乌干达111项目有两个仓库600ed97e159c0d0e23ad26bc和600ed9ae159c0d0e23ad26c1,
  2. # 注意:有两个仓库都要删除的,备件信息删除语句只能在最后一个仓库里面执行
  3. set @remark = '乌干达111项目';
  4. set @storeId = '600ed97e159c0d0e23ad26bc';
  5. #清除bom数据
  6. DELETE
  7. FROM
  8. t_sb_model_spare_bom
  9. WHERE
  10. spare_id IN ( SELECT id FROM t_spare_part_info WHERE remark = @remark );
  11. #清楚出入库和领用数据
  12. DELETE
  13. FROM
  14. t_out_store_form
  15. WHERE
  16. store_id in( @storeId);
  17. DELETE
  18. FROM
  19. t_out_store_detail
  20. WHERE
  21. store_id in( @storeId);
  22. DELETE
  23. FROM
  24. t_in_store_form
  25. WHERE
  26. store_id in( @storeId);
  27. DELETE
  28. FROM
  29. t_in_store_detail
  30. WHERE
  31. store_id in( @storeId);
  32. DELETE
  33. FROM
  34. t_spare_pick_form
  35. WHERE
  36. store_id in( @storeId);
  37. DELETE
  38. FROM
  39. t_spare_pick_form
  40. WHERE
  41. store_id in( @storeId);
  42. # 清除仓库库存数据
  43. DELETE
  44. FROM
  45. t_spare_store
  46. WHERE
  47. store_id in( @storeId);
  48. # 清除备件数据
  49. DELETE
  50. FROM
  51. t_spare_part_info
  52. WHERE
  53. remark = @remark