| | |
| | | Plc1.WriteSingleAddress(1514, 1, out _); |
| | | ConfigAOI1.basketcode = barcode; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"获取到栏具码为{barcode}"); |
| | | |
| | | mysqlhelper.NewBasketcode(barcode); |
| | | RerefreshBasketcode(); |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | [ProcessMethod("ImageCheck", "GetMatrix", "获取矩阵", InvokeType.TestInvoke)] |
| | | public ResponseMessage GetMatrix(IOperationConfig config, IDevice invokeDevice, IDevice sourceDevice) |
| | | { |
| | | ResponseMessage msg = new ResponseMessage(); |
| | | if (config is IImageCheckOperationConfig opConfig) |
| | | { |
| | | var tool = GetHalconTool(null, "", opConfig.AlgorithemPath); |
| | | var ret = tool.RunProcedure(null, new Dictionary<string, HalconDotNet.HObject>() { { "INPUT_Image", opConfig.ImageSet.HImage } }, new List<string>() { "OUTPUT_Results" }, null); |
| | | |
| | | |
| | | if (ret == null) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"脚本{opConfig.AlgorithemPath}运行异常,返回值为null"); |
| | | } |
| | | else if (!ret.Item1) |
| | | { |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Exception, $"脚本{opConfig.AlgorithemPath}运行异常,{ret.Item4}"); |
| | | } |
| | | else |
| | | { |
| | | List<double> datas = ret.Item2["OUTPUT_Results"].HTupleToDouble(); |
| | | opConfig.Products[0].Centermatrix = datas; |
| | | LogAsync(DateTime.Now, EnumHelper.LogLevel.Action, $"产品{opConfig.Products[0].PID}矩阵获取为 {string.Join(',', datas)}"); |
| | | } |
| | | } |
| | | return msg; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |