From 81a16fd37e853d3d3e9d8623cf6b3600cefd239e Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 9 Sep 2025 11:23:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A5=E6=AE=B5=E6=9C=AA=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=8F=AD=E6=AC=A1=E6=8F=90=E9=86=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/mtm/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/mtm/models.py b/apps/mtm/models.py index a4bb4b7f..a82dcdb3 100644 --- a/apps/mtm/models.py +++ b/apps/mtm/models.py @@ -188,6 +188,8 @@ class Mgroup(CommonBModel): w_s_time = timezone.localtime(w_s_time) shifts = Shift.objects.filter(rule=self.shift_rule).order_by('sort') + if not shifts: + raise ParseError(f"工段{self.name}未配置班次") # 处理跨天班次的情况 for shift in shifts: # 如果开始时间小于结束时间,表示班次在同一天内 @@ -202,7 +204,7 @@ class Mgroup(CommonBModel): # 如果当前时间在结束时间之前,属于前一天 else: return (w_s_time - timedelta(days=1)).date(), shift - return w_s_time.date(), None + # return w_s_time.date(), None class TeamMember(BaseModel):