服务端的TigerApi 框架,基于.NET6 2024 版本
Cloud Zhang
2024-05-22 3686a620659f73b5ef20ff031f1316506432c6bc
导入验证修改
已修改1个文件
52 ■■■■■ 文件已修改
Tiger.Business/MES/SMT/Biz.SmtTool.cs 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tiger.Business/MES/SMT/Biz.SmtTool.cs
@@ -72,42 +72,52 @@
                    List<smtWoTableIn> currentList = new List<smtWoTableIn>();
                    if (paras.Count > 0)
                    {
                        var duplicateWo = paras.GroupBy(p => p.关联工单号)
                                         .Where(g => g.Count() > 1)
                                         .Select(g => g.Key)
                                         .ToList();
                        if (duplicateWo.Count() > 0)//存在重复数据
                        {
                            string WORK_ORDER = string.Empty;
                            foreach (var item in duplicateWo)
                            {
                                WORK_ORDER += item;
                            }
                            WORK_ORDER = WORK_ORDER.TrimEnd(';');
                            result.IsSuccessed = false;
                            result.Message = $"导入的物料中有重复数据:关联工单:{WORK_ORDER}";
                        }
                        else
                        //var duplicateWo = paras.GroupBy(p => p.关联工单号)
                        //                 .Where(g => g.Count() > 1)
                        //                 .Select(g => g.Key)
                        //                 .ToList();
                        //if (duplicateWo.Count() > 0)//存在重复数据
                        //{
                        //    string WORK_ORDER = string.Empty;
                        //    foreach (var item in duplicateWo)
                        //    {
                        //        WORK_ORDER += item;
                        //    }
                        //    WORK_ORDER = WORK_ORDER.TrimEnd(';');
                        //    result.IsSuccessed = false;
                        //    result.Message = $"导入的物料中有重复数据:关联工单:{WORK_ORDER}";
                        //}
                        //else
                        {
                            foreach (var item in paras)
                            {
                                item.处理方式 = "新增";
                                item.原因 = null;
                                if (item.关联工单号 == null)
                                if (item.关联工单号 == null|| item.关联工单号 == " ")
                                {
                                    item.处理方式 = "数据异常";
                                    item.原因 += "工单号空或不存在!";
                                }
                                if (item.产品编码 == null)
                                if (item.产品编码 == null || item.产品编码 == " ")
                                {
                                    item.处理方式 = "数据异常";
                                    item.原因 += $"产品编码为空!";
                                }
                                if (item.物料编码 == null || item.物料编码 == " ")
                                {
                                    item.处理方式 = "数据异常";
                                    item.原因 += $"物料编码为空!";
                                }
                                if (item.站位号 == null || item.站位号 == " ")
                                {
                                    item.处理方式 = "数据异常";
                                    item.原因 += $"站位号为空!";
                                }
                                currentList.Add(item);
                                if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.关联工单号))
                                if (await Db.Queryable<SMT_WO_TABLE>().AnyAsync(x => x.WORK_ORDER == item.关联工单号 && x.ITEM_CODE == item.物料编码 && x.SLOT_NO==item.站位号))
                                {
                                    item.处理方式 = "修改";
                                    item.原因 += $"工单{item.关联工单号}与数据库重复!";
                                    item.原因 += $"工单{item.关联工单号},物料编码{item.物料编码},站位号{item.站位号}与数据库重复!";
                                }
                            }
                            //for (int i = 0; i < item..Count; i++)
@@ -121,7 +131,7 @@
                }
                catch (Exception ex)
                {
                    result.CatchException(ex, $"验证导入发料计划排程异常");
                    result.CatchException(ex, $"验证导入工单料站表异常");
                }
                return result;
            }