Support water distribution

This commit is contained in:
WQY\qiong
2023-04-30 14:04:07 +08:00
parent 45296960e7
commit e30c81a891
6 changed files with 618 additions and 50 deletions

View File

@@ -32,7 +32,7 @@ from .s31_scada_element import set_scada_element, add_scada_element, delete_scad
from .batch_api_cs import rewrite_batch_api
def execute_add_command(name: str, cs: ChangeSet) -> ChangeSet:
def _execute_add_command(name: str, cs: ChangeSet) -> ChangeSet:
type = cs.operations[0]['type']
if type == s1_title:
@@ -109,7 +109,7 @@ def execute_add_command(name: str, cs: ChangeSet) -> ChangeSet:
return ChangeSet()
def execute_update_command(name: str, cs: ChangeSet) -> ChangeSet:
def _execute_update_command(name: str, cs: ChangeSet) -> ChangeSet:
type = cs.operations[0]['type']
if type == s1_title:
@@ -186,7 +186,7 @@ def execute_update_command(name: str, cs: ChangeSet) -> ChangeSet:
return ChangeSet()
def execute_delete_command(name: str, cs: ChangeSet) -> ChangeSet:
def _execute_delete_command(name: str, cs: ChangeSet) -> ChangeSet:
type = cs.operations[0]['type']
if type == s1_title:
@@ -277,11 +277,11 @@ def execute_batch_commands(name: str, cs: ChangeSet) -> ChangeSet:
todo = op
operation = op['operation']
if operation == API_ADD:
result.merge(execute_add_command(name, ChangeSet(op)))
result.merge(_execute_add_command(name, ChangeSet(op)))
elif operation == API_UPDATE:
result.merge(execute_update_command(name, ChangeSet(op)))
result.merge(_execute_update_command(name, ChangeSet(op)))
elif operation == API_DELETE:
result.merge(execute_delete_command(name, ChangeSet(op)))
result.merge(_execute_delete_command(name, ChangeSet(op)))
except:
print(f'ERROR: Fail to execute {todo}')
@@ -305,11 +305,11 @@ def execute_batch_command(name: str, cs: ChangeSet) -> ChangeSet:
todo = op
operation = op['operation']
if operation == API_ADD:
result.merge(execute_add_command(name, ChangeSet(op)))
result.merge(_execute_add_command(name, ChangeSet(op)))
elif operation == API_UPDATE:
result.merge(execute_update_command(name, ChangeSet(op)))
result.merge(_execute_update_command(name, ChangeSet(op)))
elif operation == API_DELETE:
result.merge(execute_delete_command(name, ChangeSet(op)))
result.merge(_execute_delete_command(name, ChangeSet(op)))
except:
print(f'ERROR: Fail to execute {todo}')