| | |
| | | var materialProvider = _serviceProvider.GetRequiredService<IMaterialProvider>(); |
| | | var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); |
| | | |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "分拣托盘号","托盘1"}, |
| | | { "分拣方向", "短管装配"}, |
| | | { "分拣人", myCurrentUser.UserAccount } |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | //Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | // { |
| | | // { "分拣托盘号","托盘1"}, |
| | | // { "分拣方向", "短管装配"}, |
| | | // { "分拣人", myCurrentUser.UserAccount } |
| | | // }; |
| | | //_variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | | //根据工序名获取工序对象 |
| | | var workSection = await _workSectionManager.GetByNameAsync("分拣工序"); |
| | |
| | | var rawPipe_DataIdentifier = await materialProvider.FindByNameAsync("分拣原料管标识"); |
| | | var rawPipe_MaterialMode = await materialProvider.FindByNameAsync("分拣原料管型号"); |
| | | List<TraceMaterialModel> _MaterialParams = new List<TraceMaterialModel>(); |
| | | _MaterialParams.Add(new TraceMaterialModel() |
| | | foreach (var item in workSection.MaterialParameters) |
| | | { |
| | | Key = "分拣原料管标识", |
| | | Quantity = 1, |
| | | MaterialId = rawPipe_DataIdentifier.MaterialId, |
| | | MaterialDetailId = rawPipe_DataIdentifier.MaterialDetails.First().Id, |
| | | Value = firstWorkPlan.DataIdentifier, |
| | | if (item.Name == "分拣原料管型号") |
| | | { |
| | | _MaterialParams.Add(new TraceMaterialModel() |
| | | { |
| | | Key = item.Key, |
| | | Quantity = 1, |
| | | MaterialId = rawPipe_MaterialMode.MaterialId, |
| | | MaterialDetailId = rawPipe_MaterialMode.MaterialDetails.First().Id, |
| | | Value = firstWorkPlan.MaterialMode |
| | | |
| | | }); |
| | | _MaterialParams.Add(new TraceMaterialModel() |
| | | }); |
| | | } |
| | | if (item.Name == "分拣原料管标识") |
| | | { |
| | | _MaterialParams.Add(new TraceMaterialModel() |
| | | { |
| | | Key = item.Key, |
| | | Quantity = 1, |
| | | MaterialId = rawPipe_DataIdentifier.MaterialId, |
| | | MaterialDetailId = rawPipe_DataIdentifier.MaterialDetails.First().Id, |
| | | Value = firstWorkPlan.DataIdentifier, |
| | | |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | //配置过程参数(采集参数、配方参数) |
| | | traceModel.Params = new List<TraceParamModel>(); |
| | | foreach (var item in workSection.ProcessParameters) |
| | | { |
| | | Key = "分拣原料管型号", |
| | | Quantity = 1, |
| | | MaterialId = rawPipe_MaterialMode.MaterialId, |
| | | MaterialDetailId = rawPipe_MaterialMode.MaterialDetails.First().Id, |
| | | Value = firstWorkPlan.MaterialMode |
| | | }); |
| | | string _value = ""; |
| | | if (item.Name == "分拣方向") |
| | | { |
| | | _value = "短管装配"; |
| | | } |
| | | if (item.Name == "分拣托盘号") |
| | | { |
| | | _value = input.ContinerNo; |
| | | } |
| | | if (item.Name == "分拣人") |
| | | { |
| | | _value = myCurrentUser.UserAccount; |
| | | } |
| | | //item.Key |
| | | TraceParamModel traceParamModel = new TraceParamModel() |
| | | { |
| | | Key = item.Key, |
| | | Value = _value |
| | | }; |
| | | traceModel.Params.Add(traceParamModel); |
| | | }; |
| | | |
| | | traceModel.MaterialParams = _MaterialParams; |
| | | |
| | | await traceProvider.CreateTraceAsync(traceModel); |