This commit is contained in:
2025-12-28 17:20:02 +08:00
parent b8b9679bc8
commit cddb7531ab
23 changed files with 2138 additions and 198 deletions

View File

@ -16,7 +16,7 @@ class BaseDal:
def __init__(self) -> None:
"""初始化数据访问层,创建数据库连接"""
# 假设数据库文件在db目录下
self.db_dao = SQLiteHandler.get_instance("db/three.db", max_readers=50, busy_timeout=4000)
self.db_dao = SQLiteHandler.get_instance("../db/three.db", max_readers=50, busy_timeout=4000)
class ArtifactDal(BaseDal):
def __init__(self):
@ -97,6 +97,21 @@ class ArtifactDal(BaseDal):
except Exception as e:
print(f"根据ID获取构件任务失败: {e}")
return False
def exists_by_module_code(self, module_code: str) -> bool:
"""根据模具编号获取构件任务"""
try:
sql = "SELECT count(1) FROM ArtifactTask WHERE MouldCode = ? and OptTime>?"
results = self.db_dao.execute_read(sql, (module_code,datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)))
rows = list(results)
if rows[0][0] == 1:
return True
return False
except Exception as e:
print(f"根据ID获取构件任务失败: {e}")
return False
def get_by_id(self, artifact_id: int) -> Optional[ArtifactInfoModel]:
"""根据构件ID获取构件任务"""