| | |
| | | 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 = "短管装配"; |
| | | } |
| | | //item.Key |
| | | TraceParamModel traceParamModel = new TraceParamModel() |
| | | { |
| | | Key = item.Key, |
| | | Value = _value |
| | | }; |
| | | traceModel.Params.Add(traceParamModel); |
| | | }; |
| | | |
| | | traceModel.MaterialParams = _MaterialParams; |
| | | |
| | | await traceProvider.CreateTraceAsync(traceModel); |