diff --git a/北京北汽/Models/ScpEntity/TA_VENDER.cs b/北京北汽/Models/ScpEntity/TA_VENDER.cs index 3df6b41..e59b763 100644 --- a/北京北汽/Models/ScpEntity/TA_VENDER.cs +++ b/北京北汽/Models/ScpEntity/TA_VENDER.cs @@ -79,5 +79,8 @@ namespace CK.SCP.Models.ScpEntity public string FactoryName => ScpCache.GetFactoryNameByCode(Site); public string SubSite { get; set; } + + [NotMapped] + public string FactoryNameForView { get; set; } } } diff --git a/北京北汽/SCP/Business/PageBase.cs b/北京北汽/SCP/Business/PageBase.cs index 8ba1820..f3b2786 100644 --- a/北京北汽/SCP/Business/PageBase.cs +++ b/北京北汽/SCP/Business/PageBase.cs @@ -1945,5 +1945,24 @@ namespace SCP } #endregion + /// + /// 导入文件时判断文件是否存在 + /// + /// 导入的零件号集合 + /// + public static List CheckPartCode(List list) + { + List partCodeList = new List(); + foreach (var item in list) + { + int count = 0; + count = SCPDB.TA_PART.Count(a => a.PartCode == item); + if (count == 0) + { + partCodeList.Add(item); + } + } + return partCodeList; + } } } \ No newline at end of file diff --git a/北京北汽/SCP/Views/BasicData/Price.aspx.cs b/北京北汽/SCP/Views/BasicData/Price.aspx.cs index 7a5a34a..8b4d70f 100644 --- a/北京北汽/SCP/Views/BasicData/Price.aspx.cs +++ b/北京北汽/SCP/Views/BasicData/Price.aspx.cs @@ -254,8 +254,19 @@ namespace SCP.BasicData } var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList(); - - + List partCodeList = list.Select(a => a.零件编码).ToList(); + if (partCodeList.Count == 0) + { + Alert.Show("未填写零件编码!"); + return; + } + List list1 = new List(); + list1 = CheckPartCode(partCodeList); + if (list1 != new List() ) + { + Alert.Show(string.Format( "导入文件中有不存在的零件,如{0}", list1.FirstOrDefault())); + return; + } var ret = SCP_PO_CONTROLLER.EXCEL_PRICE_MOD(list, CurrentUser.Name,CurrentUser.RoleList); if (ret.State == ReturnStatus.Succeed && ret.Result == true) { diff --git a/北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs b/北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs index 7dda4a7..265886e 100644 --- a/北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs +++ b/北京北汽/SCP/Views/BasicData/PriceUpdate.aspx.cs @@ -192,7 +192,19 @@ namespace SCP.BasicData } var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList(); - + List partCodeList = list.Select(a => a.零件编码).ToList(); + if (partCodeList.Count == 0) + { + Alert.Show("未填写零件编码!"); + return; + } + List list1 = new List(); + list1 = CheckPartCode(partCodeList); + if (list1 != new List()) + { + Alert.Show(string.Format("导入文件中有不存在的零件,如{0}", list1.FirstOrDefault())); + return; + } var ret = SCP_PO_CONTROLLER.EXCEL_PRICE_MOD1(list, CurrentUser.Name, CurrentUser.RoleList); if (ret.State == ReturnStatus.Succeed && ret.Result == true) diff --git a/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx b/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx index 41a06b2..d94935e 100644 --- a/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx +++ b/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx @@ -80,9 +80,7 @@ - - - + diff --git a/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx.cs b/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx.cs index f6a3c67..b4a38b9 100644 --- a/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx.cs +++ b/北京北汽/SCP/Views/BasicData/SCP_VenderUser.aspx.cs @@ -50,7 +50,22 @@ namespace SCP.Views.BasicData if (lsFacID != null && lsFacID.Count > 0) { _list = _list.Where(p => lsFacID.Contains(p.Site)).ToList(); + if (_list.Count() > 0) + { + foreach (var item in _list) + { + if ((item.Site == "BJBMPT") && (!string.IsNullOrEmpty(item.SubSite))) + { + item.FactoryNameForView = DB.TA_FACTORY.FirstOrDefault(a => a.ErpDomain == item.Site && a.ErpSite == item.SubSite).FactoryName; + } + else + { + item.FactoryNameForView = DB.TA_FACTORY.FirstOrDefault(a => a.ErpDomain == item.Site).FactoryName; + } + } + } } + lsVenders = _list; var list = Sort(_list.AsQueryable(), Grid_Vender); @@ -163,7 +178,7 @@ namespace SCP.Views.BasicData } } } - + foreach (TA_VENDER vender in lsVenders) { if (lsCheckVenderID.Count == 0) diff --git a/北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs b/北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs index 1e2f629..b5cc295 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs +++ b/北京北汽/SCP/Views/PlanData/SCP_PO.aspx.cs @@ -211,6 +211,19 @@ namespace SCP.PlanData } var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList(); + List partCodeList = list.Select(a => a.零件号).ToList(); + if (partCodeList.Count == 0) + { + Alert.Show("未填写零件编码!"); + return; + } + List list1 = new List(); + list1 = CheckPartCode(partCodeList); + if (list1 != new List()) + { + Alert.Show(string.Format("导入文件中有不存在的零件,如{0}", list1.FirstOrDefault())); + return; + } var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]); if (checkret.State == ReturnStatus.Failed && checkret.Result == false) { diff --git a/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx b/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx index 811c03d..cfed777 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx +++ b/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx @@ -94,7 +94,7 @@ - + diff --git a/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs b/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs index 4adae6b..5e08574 100644 --- a/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs +++ b/北京北汽/SCP/Views/PlanData/SCP_PO_CQ.aspx.cs @@ -210,6 +210,19 @@ namespace SCP.Views.PlanData } var list = ConvertHelper.ToList(ExcelHelper.RemoveEmpty(_dt)).ToList(); + List partCodeList = list.Select(a => a.零件号).ToList(); + if (partCodeList.Count == 0) + { + Alert.Show("未填写零件编码!"); + return; + } + List list1 = new List(); + list1 = CheckPartCode(partCodeList); + if (list1 != new List()) + { + Alert.Show(string.Format("导入文件中有不存在的零件,如{0}", list1.FirstOrDefault())); + return; + } var checkret = SCP_PO_CONTROLLER.Check_EXCEL_PO_MOD_CQ(list, p_modtype, CurrentUser.FactoryList[0], CurrentUser.SubSiteList[0]); if (checkret.State == ReturnStatus.Failed && checkret.Result == false) {