schangxiang@126.com
2025-05-15 1dbd9b02ebdeca70f55eb444bb0f597ec9a2dfb8
增加 CMS反馈请求生成切割产品码信号结果
已修改2个文件
85 ■■■■ 文件已修改
PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs 75 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PipeLineLems/server/src/CMS.Plugin.PipeLineLems.Application/Implements/SharedService.cs
@@ -34,12 +34,20 @@
public class SharedService : CMSPluginAppService
{
    /// <summary>
    /// 分拣功能
    /// </summary>
    /// <param name="_serviceProvider"></param>
    /// <param name="input"></param>
    /// <param name="myCurrentUser"></param>
    /// <returns></returns>
    public async Task<MesOrderResponse> CommonPick(IServiceProvider _serviceProvider, PickInput input, MyCurrentUser myCurrentUser)
    {
        //1、记录分拣记录表
        //2、更新作业计划表的状态 =已分拣
        //3、写入 分拣变量
        //4、写入追溯报表
        //5、物料组盘
        VariableService _variableService = _serviceProvider.GetRequiredService<VariableService>();
        var _workSectionManager = _serviceProvider.GetRequiredService<IWorkSectionManager>();
PipeLineLems/server/src/CMS.Plugin.PipeLineLems/ProjectService/PipeLineLemsProjectService.cs
@@ -21,6 +21,7 @@
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
{
@@ -146,7 +147,7 @@
                _logger.LogInformation($"{changed.Name} 变量值发生变化,旧值{oldValue}=新值{newValue},TraceId={traceId}");
                if (changed.Name == "请求生成打码产品码信号" && changed.New?.Value.SafeString().ToBool() == true)
                if (changed.Name == "请求生成打码产品码信号")
                {
                    // TODO: 处理变量值变化
@@ -159,15 +160,21 @@
                        (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)
@@ -221,7 +228,7 @@
                }
                if (changed.Name == "请求生成切割产品码信号" && changed.New?.Value.SafeString().ToBool() == true)
                if (changed.Name == "请求生成切割产品码信号")
                {
                    // TODO: 处理变量值变化
@@ -234,15 +241,20 @@
                        (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();
                        });
                    }
                }
            }
        }
@@ -447,6 +459,7 @@
                    Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?>
                    {
                        { "打码_ProductID", productID},
                        { "CMS反馈请求生成打码产品码信号结果", true},
                    };
                    var ret = _variableService.WriteValueAsync(keyValuePairs_productID);
@@ -468,6 +481,19 @@
                    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);
        }
@@ -704,6 +730,7 @@
                    Dictionary<string, object?> keyValuePairs_productID = new Dictionary<string, object?>
                    {
                        { "切割_ProductID", productID},
                        { "CMS反馈请求生成切割产品码信号结果", true},
                    };
                    var ret = _variableService.WriteValueAsync(keyValuePairs_productID);
@@ -734,5 +761,19 @@
                }
            }
        }
        /// <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);
        }
    }
}