| | |
| | | /// 是否需要临时存储数据库提交操作,待需要的时候再提交 |
| | | /// </summary> |
| | | public bool NeedTemporaryStoreDBCommitAction { get; set; } = false; |
| | | protected List<Action> DBCommitList { get; set; } = new(); |
| | | protected Dictionary<string, List<Action>> DBCommitList { get; set; } = new(); |
| | | protected List<Position> NodeCommitList { get; set; } = new(); |
| | | protected Dictionary<string, OperInfo> OperInfoDic { get; set; } = new(); |
| | | protected OperInfo CurOperInfo { get; set; } |
| | |
| | | protected void SaveStepsCommitActionToDB() |
| | | { |
| | | //保存工步的数据库提交操作到提交操作列表 |
| | | var commitList = new List<Action>(); |
| | | foreach (var step in Steps.OrderBy(q => q.Sequence)) |
| | | { |
| | | DBCommitList.Add(step.DBSubmitAction); |
| | | commitList.Add(step.DBSubmitAction); |
| | | } |
| | | DBCommitList.Add(CurSN, commitList); |
| | | //如果不需要临时存储数据库提交操作,则把提交操作列表提交到数据库 |
| | | if (!NeedTemporaryStoreDBCommitAction) |
| | | { |
| | |
| | | var dbTran = GetCommitDB().UseTran(() => |
| | | { |
| | | //在同一个事务中保存所有工步的数据 |
| | | foreach (var action in DBCommitList) |
| | | foreach (var wipSn in DBCommitList.Keys) |
| | | { |
| | | action.Invoke(); |
| | | foreach (var action in DBCommitList[wipSn]) |
| | | { |
| | | action.Invoke(); |
| | | } |
| | | } |
| | | }); |
| | | if (dbTran.IsSuccess) |