feat: add material status validation tool

Add MaterialStatusValidator tool to check material status and match materials to be deleted:
- Add get_all_materials_to_delete() function to fetch all materials from database
- Add utils/material_status_validator.py with MaterialStatusValidator class
- Add validate_material_status.py script to run the validation
- Delete obsolete materialDelete.py file

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka_Company
2026-02-05 10:11:13 +08:00
parent a78afe383f
commit c6b97443e5
4 changed files with 254 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
"""
物料状态校验脚本
校验订单中的物料状态,匹配待删除物料
"""
import os
import sys
# 添加项目根目录到 sys.path
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if project_root not in sys.path:
sys.path.insert(0, project_root)
from utils.material_status_validator import MaterialStatusValidator
def main():
"""主函数"""
# 创建校验器实例
validator = MaterialStatusValidator(
username="BLDpengqiangqiang",
password="Cqbld123456.",
headless=True,
verbose=True
)
# 设置文件路径
production_id_file = "D:/python/playwrite/ProductionID.txt"
output_file = "D:/python/playwrite/data/物料状态校验结果.xlsx"
# 执行校验
print("=" * 60)
print("物料状态校验工具")
print("=" * 60)
# 方式1: 从头开始(提取数据 + 校验)
validator.validate(production_id_file, output_file=output_file)
# 方式2: 如果已经有Excel文件可以直接校验
# excel_file = "D:/python/playwrite/data/离散备料计划维护_合并.xlsx"
# validator.validate_from_existing_excel(excel_file, output_file=output_file)
print("\n" + "=" * 60)
print("校验完成!")
print("=" * 60)
if __name__ == "__main__":
main()