From bd1897f6f62db0dfc74d0f05c9698677f83d3d86 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 11 Apr 2024 11:29:21 +0800 Subject: [PATCH] feat: correct_material_cate --- apps/mtm/correct.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 apps/mtm/correct.py diff --git a/apps/mtm/correct.py b/apps/mtm/correct.py new file mode 100644 index 00000000..d668c086 --- /dev/null +++ b/apps/mtm/correct.py @@ -0,0 +1,18 @@ +from .models import Material + +def correct_material_cate(): + """ + 矫正物料分类/ 光子的棒管 + """ + for m in Material.objects.all(): + cate = '' + if '混料' in m.name: + cate = '混料' + elif '棒管' in m.name: + cate = '棒管' + elif '棒' in m.name: + cate = '棒' + elif '管' in m.name: + cate = '管' + if cate: + Material.objects.filter(id=m.id).update(cate=cate) \ No newline at end of file