| | |
| | | using CMS.Plugin.PipeLineLems.Domain.CallMaterialOrder; |
| | | using System.Collections.Generic; |
| | | using CMS.Framework.AspNetCore.Users; |
| | | using NPOI.SS.Formula.Functions; |
| | | |
| | | namespace CMS.Plugin.PipeLineLems.ProjectService |
| | | { |
| | |
| | | |
| | | _logger.LogInformation($"{changed.Name} 变量值发生变化,旧值{oldValue}=新值{newValue},TraceId={traceId}"); |
| | | |
| | | if (changed.Name == "请求生成打码产品码信号" && changed.New?.Value.SafeString().ToBool() == true) |
| | | if (changed.Name == "请求生成打码产品码信号") |
| | | { |
| | | |
| | | // TODO: 处理变量值变化 |
| | |
| | | (4)并发管理: 如果业务层并发量大,必须优化代码设计和实施,以减少在高并发情况下的系统资源消耗,防止系统性能问题。 |
| | | (5)代码安全: 安装并使用 CMS.CodeAnalysis 分析器来分析 IVariableDataCache.TagChanged 的使用情况。该工具能在使用不当时提供编译错误,帮助您提高代码质量。*/ |
| | | |
| | | _ = Task.Run(async () => |
| | | if (changed.New?.Value.SafeString().ToBool() == true) |
| | | { |
| | | await HanlderForPringBarCodeByCreateProductAsync(); |
| | | // 例1:同步处理 |
| | | //await ProcessAsync(); |
| | | _ = Task.Run(async () => |
| | | { |
| | | await HanlderForPringBarCodeByCreateProductAsync(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | |
| | | // 例2:调用外部API |
| | | //await ExecuteExternalApiAsync(); |
| | | }); |
| | | _ = Task.Run(async () => |
| | | { |
| | | await HanlderForPringBarCodeByCreateProductWhenFalseAsync(); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | if (changed.Name == "打码进站信号" && changed.New?.Value.SafeString().ToBool() == true) |
| | |
| | | } |
| | | |
| | | |
| | | if (changed.Name == "请求生成切割产品码信号" && changed.New?.Value.SafeString().ToBool() == true) |
| | | if (changed.Name == "请求生成切割产品码信号") |
| | | { |
| | | |
| | | // TODO: 处理变量值变化 |
| | |
| | | (4)并发管理: 如果业务层并发量大,必须优化代码设计和实施,以减少在高并发情况下的系统资源消耗,防止系统性能问题。 |
| | | (5)代码安全: 安装并使用 CMS.CodeAnalysis 分析器来分析 IVariableDataCache.TagChanged 的使用情况。该工具能在使用不当时提供编译错误,帮助您提高代码质量。*/ |
| | | |
| | | _ = Task.Run(async () => |
| | | if (changed.New?.Value.SafeString().ToBool() == true) |
| | | { |
| | | await HanlderForCutByCreateProductAsync(); |
| | | // 例1:同步处理 |
| | | //await ProcessAsync(); |
| | | |
| | | // 例2:调用外部API |
| | | //await ExecuteExternalApiAsync(); |
| | | }); |
| | | _ = Task.Run(async () => |
| | | { |
| | | await HanlderForCutByCreateProductAsync(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | _ = Task.Run(async () => |
| | | { |
| | | await HanlderForCutByCreateProductWhenFlaseAsync(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | //根据原料标识寻找 作业计划 |
| | | var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); |
| | | var workPlanList = await workPlanAppService.GetListByFilterAsync(x => x.DataIdentifier == callMaterialOrder.DataIdentifier); |
| | | if (workPlanList?.Count == 0) return;//结束 |
| | | |
| | | ////TODO:暂时生成产品ID |
| | |
| | | pipeSpecCode3 = new_workPlanList[i].PipeSpecCode; |
| | | } |
| | | } |
| | | |
| | | Dictionary<string, object?> keyValuePairs = new Dictionary<string, object?> |
| | | { |
| | | { "打码工件1",code1}, |
| | |
| | | { "打码管段编码", new_workPlanList.First().PipeSpecCode }, |
| | | { "打码管段名称", new_workPlanList.First().PipeSectionName }, |
| | | { "打码原料管型号", new_workPlanList.First().MaterialMode }, |
| | | { "打码原料标识", new_workPlanList.First().DataIdentifier } |
| | | { "打码原料标识", new_workPlanList.First().DataIdentifier }, |
| | | { "打码原料管批次", callMaterialOrder.MaterialBatch },//批次 |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | |
| | | |
| | | |
| | | //根据原料标识寻找 作业计划 |
| | | var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); |
| | | var workPlanList = await workPlanAppService.GetListByFilterAsync(x => x.DataIdentifier == callMaterialOrder.DataIdentifier); |
| | | if (workPlanList?.Count == 0) return;//结束 |
| | | |
| | | //TODO:暂时生成产品ID |
| | |
| | | Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> |
| | | { |
| | | { "打码_ProductID", productID}, |
| | | { "CMS反馈请求生成打码产品码信号结果", true}, |
| | | }; |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs_productID); |
| | | |
| | | |
| | | //更新为生产中 |
| | | foreach (var item in workPlanList) |
| | | var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "切割").ToList(); |
| | | foreach (var item in new_workPlanList) |
| | | { |
| | | item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.生产中; |
| | | } |
| | | await workPlanRepository.UpdateManyAsync(workPlanList); |
| | | await workPlanRepository.UpdateManyAsync(new_workPlanList); |
| | | |
| | | |
| | | uow.CompleteAsync(); |
| | |
| | | throw; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求生成打码产品码信号(值为false的时候) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private async Task HanlderForPringBarCodeByCreateProductWhenFalseAsync() |
| | | { |
| | | Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> |
| | | { |
| | | { "CMS反馈请求生成打码产品码信号结果", false}, |
| | | }; |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs_productID); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | |
| | | //根据原料标识寻找 作业计划 |
| | | var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); |
| | | var workPlanList = await workPlanAppService.GetListByFilterAsync(x => x.DataIdentifier == callMaterialOrder.DataIdentifier); |
| | | if (workPlanList?.Count == 0) return;//结束 |
| | | |
| | | ////TODO:暂时生成产品ID |
| | |
| | | { "切割管段编码", new_workPlanList.First().PipeSpecCode }, |
| | | { "切割管段名称", new_workPlanList.First().PipeSectionName }, |
| | | { "切割原料管型号", new_workPlanList.First().MaterialMode }, |
| | | { "切割原料标识", new_workPlanList.First().DataIdentifier } |
| | | { "切割原料标识", new_workPlanList.First().DataIdentifier }, |
| | | { "切割原料管批次", callMaterialOrder.MaterialBatch },//批次 |
| | | }; |
| | | _variableService.WriteValueAsync(keyValuePairs); |
| | | |
| | |
| | | |
| | | |
| | | //根据原料标识寻找 作业计划 |
| | | var workPlanList = await workPlanAppService.FindByDataIdentifierAsync(callMaterialOrder.DataIdentifier); |
| | | var workPlanList = await workPlanAppService.GetListByFilterAsync(x => x.DataIdentifier == callMaterialOrder.DataIdentifier); |
| | | if (workPlanList?.Count == 0) return;//结束 |
| | | |
| | | //TODO:暂时生成产品ID |
| | |
| | | Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> |
| | | { |
| | | { "切割_ProductID", productID}, |
| | | { "CMS反馈请求生成切割产品码信号结果", true}, |
| | | }; |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs_productID); |
| | | |
| | | var new_workPlanList = workPlanList.Where(x => x.ProcessRouteNumber == "装配").ToList(); |
| | | //更新为生产中 |
| | | foreach (var item in workPlanList) |
| | | foreach (var item in new_workPlanList) |
| | | { |
| | | item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.生产中; |
| | | item.Remark = "更新生产中"; |
| | | } |
| | | await workPlanRepository.UpdateManyAsync(workPlanList); |
| | | await workPlanRepository.UpdateManyAsync(new_workPlanList); |
| | | |
| | | |
| | | var new_workPlanList_printCode = workPlanList.Where(x => x.ProcessRouteNumber == "切割").ToList(); |
| | | foreach (var item in new_workPlanList_printCode) |
| | | { |
| | | item.WorkPlanStatus = Domain.Shared.Enums.WorkPlanStatusEnum.已完成; |
| | | item.Remark = "更新已完成"; |
| | | } |
| | | await workPlanRepository.UpdateManyAsync(new_workPlanList_printCode); |
| | | |
| | | |
| | | uow.CompleteAsync(); |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 请求生成切割产品码信号(值为false的时候) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | private async Task HanlderForCutByCreateProductWhenFlaseAsync() |
| | | { |
| | | |
| | | Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?> |
| | | { |
| | | { "CMS反馈请求生成切割产品码信号结果", false}, |
| | | }; |
| | | var ret = _variableService.WriteValueAsync(keyValuePairs_productID); |
| | | } |
| | | } |
| | | } |