schangxiang@126.com
2025-05-21 0e42f871905f207658d822fcbe29aeb57b2156af
PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs
@@ -37,7 +37,6 @@
        private readonly ILogger<PipeLineLemsProjectService> _logger;
        private readonly IVariableDataCache _variableDataCache;
        /// <summary>
        /// 变量服务
        /// </summary>
@@ -96,6 +95,7 @@
                { "装配完工信号", "装配完工信号(描述)" },
                { "焊接完工信号", "焊接完工信号(描述)" },
                { "法兰冲码完工信号", "法兰冲码完工信号(描述)" },
            };
            // 创建通道监听
@@ -296,6 +296,24 @@
                        _ = Task.Run(async () =>
                        {
                            await HanlderFor完工信号WhenFalseAsync("焊接");
                        });
                    }
                }
                if (changed.Name == "法兰冲码完工信号")
                {
                    if (changed.New?.Value.SafeString().ToBool() == true)
                    {
                        _ = Task.Run(async () =>
                        {
                            await HanlderFor法兰冲码完工信号Async();
                        });
                    }
                    else
                    {
                        _ = Task.Run(async () =>
                        {
                            await HanlderFor完工信号WhenFalseAsync("法兰冲码");
                        });
                    }
                }
@@ -892,12 +910,12 @@
                    {
                        UserAccount = userName.Content.Value.SafeString().ToString()
                    };
                    sharedService.CompleteAssemblyProcess(_serviceProvider, new Application.Contracts.Dtos.WorkPlan.CompleteAssemblyProcessInput() { PipeSpecCode = myPipeSpecCode, ProcessName = "装配工序" }, myCurrentUser);
                    await sharedService.CompleteAssemblyProcess(_serviceProvider, new Application.Contracts.Dtos.WorkPlan.CompleteAssemblyProcessInput() { PipeSpecCode = myPipeSpecCode, ProcessName = "装配工序" }, myCurrentUser);
                }
                catch (Exception)
                catch (Exception ex)
                {
                    _logger.LogException(ex, LogLevel.Error);
                }
            }
        }
@@ -934,12 +952,53 @@
                    {
                        UserAccount = userName.Content.Value.SafeString().ToString()
                    };
                    sharedService.CompleteAssemblyProcess(_serviceProvider, new Application.Contracts.Dtos.WorkPlan.CompleteAssemblyProcessInput() { PipeSpecCode = myPipeSpecCode, ProcessName = "焊接工序" }, myCurrentUser);
                    await sharedService.CompleteAssemblyProcess(_serviceProvider, new Application.Contracts.Dtos.WorkPlan.CompleteAssemblyProcessInput() { PipeSpecCode = myPipeSpecCode, ProcessName = "焊接工序" }, myCurrentUser);
                }
                catch (Exception)
                catch (Exception ex)
                {
                    _logger.LogException(ex, LogLevel.Error);
                }
            }
        }
        /// <summary>
        /// 法兰冲码完工信号=true时
        /// </summary>
        /// <returns></returns>
        private async Task HanlderFor法兰冲码完工信号Async()
        {
            var txt = "法兰冲码";
            var workPlanAppService = _serviceProvider.GetRequiredService<IWorkPlanAppService>();
            var workPlanRepository = _serviceProvider.GetRequiredService<IWorkPlanRepository>();
            var callMaterialOrderAppService = _serviceProvider.GetRequiredService<ICallMaterialOrderAppService>();
            var pipeSpecCode = await _variableService.ReadValueAsync($"{txt}管段编码");
            if (string.IsNullOrEmpty(pipeSpecCode?.Content?.Value.SafeString().ToString()))
            {
            }
            else
            {
                var myPipeSpecCode = pipeSpecCode.Content.Value.SafeString().ToString();
                CallMaterialOrder callMaterialOrder = null;
                try
                {
                    var sharedService = _serviceProvider.GetRequiredService<SharedService>();
                    var userName = await _variableService.ReadValueAsync($"{txt}人");
                    MyCurrentUser myCurrentUser = new MyCurrentUser()
                    {
                        UserAccount = userName.Content.Value.SafeString().ToString()
                    };
                    await sharedService.SendFlangeCode_CompleteAssemblyProcess(_serviceProvider, new Application.Contracts.Dtos.WorkPlan.CompleteAssemblyProcessInput()
                    { PipeSpecCode = myPipeSpecCode, ProcessName = $"{txt}工序" }, myCurrentUser);
                }
                catch (Exception ex)
                {
                    _logger.LogException(ex, LogLevel.Error);
                }
            }
        }