This commit is contained in:
2025-11-17 00:05:40 +08:00
parent f860c5a216
commit e3ecd0550f
55 changed files with 3204 additions and 528 deletions

View File

@ -20,11 +20,46 @@ class ArtifactBll:
def get_artifact_task(self) -> List[ArtifactInfoModel]:
"""获取官片任务数据"""
return self.dal.get_top_artifact(5, "ArtifactID asc")
return self.dal.get_top_artifact(5, "ID desc")
def update_artifact_task(self, artifact_id: str, status: int) -> bool:
"""更新管片任务状态"""
return self.dal.update_artifact(artifact_id, {"Status": status})
def finish_artifact_task(self, artifact_id: str,beton_volume) -> bool:
"""完成管片任务"""
return self.dal.update_artifact(artifact_id, {"Status": 3,"BetonVolume":beton_volume,"EndTime":datetime.now()})
def insert_artifact_task(self,model:ArtifactInfoModel) -> bool:
"""插入管片任务"""
if self.dal.exists_by_id(model.ArtifactID):
return False
return self.dal.insert_artifact({
"ArtifactID": model.ArtifactID,
"ArtifactActionID": model.ArtifactActionID,
"ArtifactIDVice1": model.ArtifactIDVice1,
"ProduceRingNumber": model.ProduceRingNumber,
"MouldCode": model.MouldCode,
"SkeletonID": model.SkeletonID,
"RingTypeCode": model.RingTypeCode,
"SizeSpecification": model.SizeSpecification,
"BuriedDepth": model.BuriedDepth,
"BlockNumber": model.BlockNumber,
"BetonVolume": model.BetonVolume,
"BetonTaskID": model.BetonTaskID,
"HoleRingMarking": model.HoleRingMarking,
"GroutingPipeMarking": model.GroutingPipeMarking,
"PolypropyleneFiberMarking": model.PolypropyleneFiberMarking,
"PStatus":1,
"Status": 2,
"Source": model.Source,
"BeginTime": model.BeginTime,
"OptTime": datetime.now(),
})
def get_artifacting_task(self) -> ArtifactInfoModel:
"""获取正在进行的片任务数据"""
"""获取正在进行的片任务数据"""
loc_item= self.dal.get_top_artifact(1,"","Status=2")
if loc_item:
return loc_item[0]

View File

@ -42,7 +42,7 @@ class ArtifactDal(BaseDal):
print(f"获取所有构件任务失败: {e}")
return []
def get_top_artifact(self, top: int,desc:str="ArtifactID asc",where:str="1=1") -> List[ArtifactInfoModel]:
def get_top_artifact(self, top: int,desc:str="ID desc",where:str="1=1") -> List[ArtifactInfoModel]:
"""获取top条数数据根据ArtifactID升序"""
try:
# 确保top为正整数
@ -59,6 +59,8 @@ class ArtifactDal(BaseDal):
# 保证row的变量和模板变量一致
artifact = ArtifactInfoModel()
artifact.ArtifactID=row["ArtifactID"]
artifact.ArtifactActionID=row["ArtifactActionID"]
artifact.ArtifactIDVice1=row["ArtifactIDVice1"]
artifact.ProduceRingNumber=row["ProduceRingNumber"]
artifact.MouldCode=row["MouldCode"]
artifact.SkeletonID=row["SkeletonID"]
@ -68,6 +70,9 @@ class ArtifactDal(BaseDal):
artifact.BlockNumber=row["BlockNumber"]
artifact.BetonVolume=row["BetonVolume"]
artifact.BetonTaskID=row["BetonTaskID"]
artifact.HoleRingMarking=row["HoleRingMarking"]
artifact.GapRingMarking=row["GroutingPipeMarking"]
artifact.PolypropyleneFiberMarking=row["PolypropyleneFiberMarking"]
artifact.Status=row["Status"]
artifact.BeginTime=row["BeginTime"]
artifacts.append(artifact)
@ -78,6 +83,21 @@ class ArtifactDal(BaseDal):
return []
def exists_by_id(self, artifact_id: int) -> bool:
"""根据构件ID获取构件任务"""
try:
sql = "SELECT count(1) FROM ArtifactTask WHERE ArtifactID = ?"
results = self.db_dao.execute_read(sql, (artifact_id,))
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获取构件任务"""
try:
@ -108,7 +128,7 @@ class ArtifactDal(BaseDal):
"""更新构件任务记录"""
try:
# 构建WHERE条件
where_condition = {"ArtifactID": artifact_id}
where_condition = f"ArtifactID='{artifact_id}'"
# 使用update方法更新数据
affected_rows = self.db_dao.update("ArtifactTask", update_data, where_condition)
return affected_rows > 0