| | |
| | | using CmsQueryExtensions.Entitys; |
| | | using CMS.Unit.RuntimeValue.Abstractions; |
| | | using CMS.Extensions.Variable; |
| | | using CMS.Plugin.TraceManagement.Abstractions.Models.Traces; |
| | | using CMS.Plugin.ProcessManagement.Abstractions; |
| | | using KissUtil.Extensions; |
| | | using CMS.Plugin.TraceManagement.Abstractions; |
| | | using CMS.Plugin.ProductManagement.Abstractions.Models; |
| | | using CMS.Plugin.MaterialManagement.Abstractions; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.Application.Implements; |
| | | |
| | |
| | | //3、写入 分拣变量 |
| | | |
| | | VariableService _variableService = _serviceProvider.GetRequiredService<VariableService>(); |
| | | var _workSectionManager = _serviceProvider.GetRequiredService<IWorkSectionManager>(); |
| | | var _workStationManager = _serviceProvider.GetRequiredService<IWorkStationManager>(); |
| | | var traceProvider = _serviceProvider.GetRequiredService<ITraceProvider>(); |
| | | var materialProvider = _serviceProvider.GetRequiredService<IMaterialProvider>(); |
| | | var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>(); |
| | | |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | |
| | | { "分拣人", myCurrentUser.UserAccount } |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | | //根据工序名获取工序对象 |
| | | var workSection = await _workSectionManager.GetByNameAsync("分拣工序"); |
| | | var workStation = await _workStationManager.GetByNameAsync("分拣工位"); |
| | | //写入追溯报表 |
| | | var finishTime = DateTime.Now; |
| | | TraceModel traceModel = new TraceModel() |
| | | { |
| | | SerialNumber = input.PipeSpecCode, |
| | | WorkSectionId = workSection.Id, |
| | | WorkSectionName = workSection.Name, |
| | | WorkStationName = workStation.Name, |
| | | |
| | | FinishTime = finishTime, |
| | | IsQualified = true, |
| | | UnqualifiedReason = "", |
| | | ProductModel = "", |
| | | ProductName = "", |
| | | |
| | | }; |
| | | traceModel.Params = new List<TraceParamModel>(); |
| | | foreach (var item in workSection.ProcessParameters) |
| | | { |
| | | var value = "ssss"; |
| | | traceModel.Params.Add(new TraceParamModel() |
| | | { |
| | | Key = item.Key, |
| | | Value = value.SafeString() |
| | | }); |
| | | } |
| | | //物料参数列表 |
| | | var firstWorkPlans = await workPlanAppService.GetListByFilterAsync(x => x.PipeSpecCode == input.PipeSpecCode); |
| | | |
| | | var firstWorkPlan = await workPlanAppService.GetSingleByFilterAsync(x => x.PipeSpecCode == input.PipeSpecCode); |
| | | var rawPipe_DataIdentifier = await materialProvider.FindByNameAsync("分拣原料管标识"); |
| | | var rawPipe_MaterialMode = await materialProvider.FindByNameAsync("分拣原料管型号"); |
| | | List<TraceMaterialModel> _MaterialParams = new List<TraceMaterialModel>(); |
| | | foreach (var item in workSection.MaterialParameters) |
| | | { |
| | | 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 |
| | | |
| | | }); |
| | | } |
| | | 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) |
| | | { |
| | | 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); |
| | | |
| | | var response = new MesOrderResponse |
| | | { |
| | | Code = "000000", |
| | | Code = "200", |
| | | Data = "", |
| | | Fail = false, |
| | | Mesg = "处理成功", |
| | | Success = true, |
| | | Message = "处理成功", |
| | | Time = DateTime.UtcNow |
| | | }; |
| | | return response; |
| | |
| | | { |
| | | Code = "000000", |
| | | Data = orderModels, |
| | | Fail = false, |
| | | Mesg = "处理成功", |
| | | Success = true, |
| | | Message = "处理成功", |
| | | Time = DateTime.UtcNow |
| | | }; |
| | | return response; |
| | |
| | | // 返回结果 |
| | | var response = new MesOrderResponse |
| | | { |
| | | Code = "000000", |
| | | Fail = false, |
| | | Mesg = "叫料成功", |
| | | Success = true, |
| | | Code = "200", |
| | | Message = "叫料成功", |
| | | Time = DateTime.UtcNow |
| | | }; |
| | | return response; |