清理备件导入+仓库数据-姆比亚.txt 756 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. set @remark = '姆比亚';
  2. set @storeId = '60004e10159c0d5c6a472da6';
  3. #清除bom数据
  4. DELETE
  5. FROM
  6. t_sb_model_spare_bom
  7. WHERE
  8. spare_id IN ( SELECT id FROM t_spare_part_info WHERE remark = @remark );
  9. #清楚出入库和领用数据
  10. DELETE
  11. FROM
  12. t_out_store_form
  13. WHERE
  14. store_id = @storeId;
  15. DELETE
  16. FROM
  17. t_out_store_detail
  18. WHERE
  19. store_id = @storeId;
  20. DELETE
  21. FROM
  22. t_in_store_form
  23. WHERE
  24. store_id = @storeId;
  25. DELETE
  26. FROM
  27. t_in_store_detail
  28. WHERE
  29. store_id = @storeId;
  30. DELETE
  31. FROM
  32. t_spare_pick_form
  33. WHERE
  34. store_id = @storeId;
  35. DELETE
  36. FROM
  37. t_spare_pick_form
  38. WHERE
  39. store_id = @storeId;
  40. # 清除仓库库存数据
  41. DELETE
  42. FROM
  43. t_spare_store
  44. WHERE
  45. store_id = @storeId;
  46. # 清除备件数据
  47. DELETE
  48. FROM
  49. t_spare_part_info
  50. WHERE
  51. remark = @remark