From 111fae25722710296a2ed9dce65dced57bb79419 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期二, 25 三月 2025 08:43:25 +0800
Subject: [PATCH] 20250324 修改供应商名字不能重复 外协供应商对应 完成

---
 CY_ECommercePlatform/CY.IDAL/OA/IOA_SuppliersDAL.cs                         |    2 
 CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx.cs |   10 +-
 CY_ECommercePlatform/CY.SQLDAL/OA/OA_SuppliersDAL.cs                        |   35 ++++++++
 CY_ECommercePlatform/CY.WebForm/Pages/procurement/SuppliersEdit.aspx.cs     |  149 +++++++++++++++++++++++++++++++++++++
 CY_ECommercePlatform/CY.BLL/OA/OA_SuppliersBLL.cs                           |   11 ++
 5 files changed, 201 insertions(+), 6 deletions(-)

diff --git a/CY_ECommercePlatform/CY.BLL/OA/OA_SuppliersBLL.cs b/CY_ECommercePlatform/CY.BLL/OA/OA_SuppliersBLL.cs
index 9d54e30..ee66d61 100644
--- a/CY_ECommercePlatform/CY.BLL/OA/OA_SuppliersBLL.cs
+++ b/CY_ECommercePlatform/CY.BLL/OA/OA_SuppliersBLL.cs
@@ -83,5 +83,16 @@
       {
           return suppliersDAL.getSupplierTable(FirmId);
       }
+
+        /// <summary>
+        /// 鑾峰彇table绫诲瀷鐨勬墍鏈変緵搴斿晢
+        /// </summary>
+        /// <param name="FirmId"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.OA_Suppliers> getSupplierByFirmId(Guid FirmId,string Name)
+        {
+            return suppliersDAL.getSupplierByFirmId(FirmId, Name);
+        }
+
     }
 }
diff --git a/CY_ECommercePlatform/CY.IDAL/OA/IOA_SuppliersDAL.cs b/CY_ECommercePlatform/CY.IDAL/OA/IOA_SuppliersDAL.cs
index 3cf1e61..c27802e 100644
--- a/CY_ECommercePlatform/CY.IDAL/OA/IOA_SuppliersDAL.cs
+++ b/CY_ECommercePlatform/CY.IDAL/OA/IOA_SuppliersDAL.cs
@@ -17,5 +17,7 @@
         IEnumerable<Model.OA_Suppliers> getAllSuppliers(Pagination pa, Guid FirsmId, string CooperativeStateId, string SuppliersLevelId, string SuppliersTypeId, string SuppliersName, string BusinessScope);
         OA_Suppliers getSingleSupplier(string Keyid);
         DataTable getSupplierTable(Guid FirmId);
+
+        IEnumerable<Model.OA_Suppliers> getSupplierByFirmId(Guid FirmId, string Name);
     }
 }
diff --git a/CY_ECommercePlatform/CY.SQLDAL/OA/OA_SuppliersDAL.cs b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_SuppliersDAL.cs
index e8a0d05..1ab3933 100644
--- a/CY_ECommercePlatform/CY.SQLDAL/OA/OA_SuppliersDAL.cs
+++ b/CY_ECommercePlatform/CY.SQLDAL/OA/OA_SuppliersDAL.cs
@@ -252,6 +252,41 @@
 
 
         /// <summary>
+        /// 杩斿洖table绫诲瀷鐨勬墍鏈夊垪琛�
+        /// </summary>
+        /// <param name="FirmId"></param>
+        /// <returns></returns>
+        public IEnumerable<Model.OA_Suppliers> getSupplierByFirmId(Guid FirmId, string Name)
+        {
+            try
+            {
+                if (FirmId == null || FirmId == Guid.Empty)
+                    return null;//閿欒鏁版嵁杩斾細绌� 
+
+                string condition = " FirmId='" + FirmId + "' ";
+
+                if (!string.IsNullOrEmpty(Name))
+                {
+                    condition += " and [Name]='" + Name + "' ";
+                }
+
+
+                IList<Model.OA_Suppliers> result = _dataBase.SelectModel<Model.OA_Suppliers>("*", "OA_Suppliers", condition) as IList<Model.OA_Suppliers>;//鎵ц鏌ヨ
+
+                return result;//杩斿洖缁撴灉
+            }
+            catch (Exception ex)
+            {
+                throw ex;
+            }
+
+        }
+
+
+        
+
+
+        /// <summary>
         /// 鑾峰彇鍗曚釜渚涘簲鍟�
         /// </summary>
         /// <param name="Keyid"></param>
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx.cs
index c02b213..c95197e 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/business/Waixiefukuanshenqing.aspx.cs
@@ -98,12 +98,12 @@
                         this.txtSupplierName.Value = corporateClients.OutVendorName;
                         this.selSuppliersss.Value = corporateClients.Keyid.ToString(); 
 
-                     var sss =   _OA_SuppliersBLL.getSupplierTable(CurrentUser.MemberId).Select("Name = '"+ corporateClients.OutVendorName + "'");
-                        if (sss.Length > 0)
+                     var sss =   _OA_SuppliersBLL.getSupplierByFirmId(CurrentUser.MemberId, corporateClients.OutVendorName.Trim()).ToList();
+                        if (sss.Count > 0)
                         {
-                            this.txtHuming.Value = sss[0]["Huming"].ToString();
-                            this.txtBank.Value = sss[0]["Bank"].ToString();
-                            this.txtAccountID.Value = sss[0]["AccountID"].ToString();
+                            this.txtHuming.Value = sss[0].Huming;//  ["Huming"].ToString();
+                            this.txtBank.Value = sss[0].Bank; //["Bank"].ToString();
+                            this.txtAccountID.Value = sss[0].AccountID;//["AccountID"].ToString();
                         }
                     }
 
diff --git a/CY_ECommercePlatform/CY.WebForm/Pages/procurement/SuppliersEdit.aspx.cs b/CY_ECommercePlatform/CY.WebForm/Pages/procurement/SuppliersEdit.aspx.cs
index fbe26e9..00f3b7f 100644
--- a/CY_ECommercePlatform/CY.WebForm/Pages/procurement/SuppliersEdit.aspx.cs
+++ b/CY_ECommercePlatform/CY.WebForm/Pages/procurement/SuppliersEdit.aspx.cs
@@ -23,6 +23,7 @@
         OA_SuppliersBLL _OA_SuppliersBLL = null;
         OA_BrandBLL _OA_BrandBLL = null;
         OA_SuppliersOtherQualificationBLL _OA_SuppliersOtherQualificationBLL = null;
+        OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null;
         public string[] Fileds;
 
         public SuppliersEdit()
@@ -32,6 +33,7 @@
             _Sys_DictionaryBLL = new Sys_DictionaryBLL();
             supplier = new OA_Suppliers();
             _OA_SuppliersBLL = new OA_SuppliersBLL();
+            bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL();
 
         }
 
@@ -128,6 +130,151 @@
             if (Request["Keyid"].ToInt32() > 0)
             {
                 supplier = _OA_SuppliersBLL.getSingleSupplier(Request["Keyid"].ToString2());
+
+                var sss = _OA_SuppliersBLL.getSupplierByFirmId(CurrentUser.MemberId, this.txtName.Value.Trim()).ToList();
+                if (sss.Count > 0)
+                {
+                    if(sss.Count(x => x.Keyid != supplier.Keyid) > 0)
+                    {
+                        JavaScript.MessageBox("宸叉湁鍚屽悕渚涘簲鍟嗭紒", this);
+                        return;
+                    }
+                }
+            }
+            else
+            {
+                var sss = _OA_SuppliersBLL.getSupplierByFirmId(CurrentUser.MemberId, this.txtName.Value.Trim()).ToList();
+                if (sss.Count > 0)
+                {
+                    JavaScript.MessageBox("宸叉湁鍚屽悕渚涘簲鍟嗭紒", this);
+                    return;
+                }
+                var suptypeid = this.selSuppliersTypeId.Value.ToInt32();
+               var sys_Dictionary  = _Sys_DictionaryBLL.GetDataByType("渚涘簲鍟嗙被鍒� ").Where(x=>x.Keyid == suptypeid).FirstOrDefault();
+                if (sys_Dictionary!=null && sys_Dictionary.Name == "澶栧崗鍔犲伐")
+                {
+                    Pagination pa = new Pagination();
+                    pa.PageSize = 500;
+                    pa.PageIndex = 1;
+                    //鏌ヨ鏄惁鏈夊悓鍚嶇殑澶栧崗
+                    var ss = bll_OA_CorporateClientsBLL.SelectModelPage(pa, CurrentUser.MemberId, "").Where(x=>x.OutVendorName == this.txtName.Value.Trim()).ToList();
+                    if (ss.Count == 0)
+                    {
+                        //鏂板澶栧崗鍘傚晢
+                        OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients();
+                        OA_CustomerCommunications m_OA_CustomerCommunications = new OA_CustomerCommunications();
+                        EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers();
+                        EC_MemberBasic m_EC_MemberBasic = new EC_MemberBasic();
+                        Guid NewGuid = Guid.NewGuid();
+                        #region 鍒濆鍚堜綔瀹㈡埛鍩虹淇℃伅
+                        m_OA_CorporateClients.CompanyName = CurrentUser.Name;
+                        m_OA_CorporateClients.CustomerIndustriesId = 0;
+                        m_OA_CorporateClients.CustomerTypeId = 0;
+                        m_OA_CorporateClients.SourcesInfoId = 0;
+                        m_OA_CorporateClients.DegreeImportanId = 0;
+                        m_OA_CorporateClients.AccountManagerId = 0;
+                        m_OA_CorporateClients.BusinessManagerId = 0;
+
+                        m_OA_CorporateClients.CreditId = 0;
+                        m_OA_CorporateClients.LoginPhone = "";
+                        m_OA_CorporateClients.CorporateWebsite = "";
+                        m_OA_CorporateClients.BusinessAnalysisId = 0;
+                        m_OA_CorporateClients.IsLoginCorporateWeb = false;
+                        m_OA_CorporateClients.Credit = 0;
+                        m_OA_CorporateClients.Bank = "";
+                        m_OA_CorporateClients.TaxID = "";
+                        m_OA_CorporateClients.AccountID = "";
+                        m_OA_CorporateClients.OrderCount = 0;
+                        m_OA_CorporateClients.OrderMoney = 0;
+
+                        m_OA_CorporateClients.Prepayments = 0;
+                        m_OA_CorporateClients.IsOutsourcing = true;
+                        m_OA_CorporateClients.OutVendorName = this.txtName.Value.Trim();
+                        m_OA_CorporateClients.IsPriority = false;
+                        m_OA_CorporateClients.CumulativePrepayments = 0;
+                        m_OA_CorporateClients.LastUpdateTime = DateTime.Now;
+                        m_OA_CorporateClients.Operator = CurrentUser.ShortName;
+                        m_OA_CorporateClients.Remark = "";
+                        m_OA_CorporateClients.OutRate = 1;
+                        m_OA_CorporateClients.LoginPwd = "";
+
+                        #endregion
+
+                        #region 鍒濆鍚堜綔瀹㈡埛閫氳淇℃伅
+                        m_OA_CustomerCommunications.Province = CurrentUser.Province;
+                        m_OA_CustomerCommunications.City = CurrentUser.City;
+                        m_OA_CustomerCommunications.County = CurrentUser.County;
+                        m_OA_CustomerCommunications.DetailedAddress = CurrentMemberExtend.DetailedAddress;
+                        m_OA_CustomerCommunications.CompanyPhone = CurrentMemberExtend.PhoneNum;
+                        m_OA_CustomerCommunications.Postcode = CurrentMemberExtend.Postcode;
+                        m_OA_CustomerCommunications.Mobile = CurrentMemberExtend.MobileNum;
+                        m_OA_CustomerCommunications.Fax = CurrentMemberExtend.Fax;
+                        m_OA_CustomerCommunications.Email = CurrentMemberExtend.Email;
+                        m_OA_CustomerCommunications.QQ = CurrentMemberExtend.QQ;
+                        m_OA_CustomerCommunications.LegalRepresentative = "";
+                        m_OA_CustomerCommunications.LegalMobile = "";
+                        m_OA_CustomerCommunications.LegalQQ = "";
+                        m_OA_CustomerCommunications.BusinessManagers = "";
+                        m_OA_CustomerCommunications.ManagersMobile = "";
+                        m_OA_CustomerCommunications.ManagersQQ = "";
+                        m_OA_CustomerCommunications.FinancialOfficers = "";
+                        m_OA_CustomerCommunications.OfficersMobile = "";
+                        m_OA_CustomerCommunications.OfficersQQ = "";
+                        m_OA_CustomerCommunications.Remark = "";
+                        m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now;
+                        m_OA_CustomerCommunications.Operator = CurrentUser.ShortName;
+                        #endregion
+
+                        #region 鍒濆鍚堜綔瀹㈡埛鏀惰揣鍦板潃
+                        m_EC_AcceptWayByCustomers.AcceptTypeId = 0;
+                        m_EC_AcceptWayByCustomers.InvoiceDemand = "";
+                        m_EC_AcceptWayByCustomers.Remark = "";
+                        m_EC_AcceptWayByCustomers.LastUpdateTime = DateTime.Now;
+                        m_EC_AcceptWayByCustomers.Operator = CurrentUser.ShortName;
+
+                        m_EC_AcceptWayByCustomers.City = "";
+                        m_EC_AcceptWayByCustomers.Accepter = "";
+                        m_EC_AcceptWayByCustomers.AccepterPhone = "";
+                        m_EC_AcceptWayByCustomers.AppointCourierCompany = "";
+                        m_EC_AcceptWayByCustomers.AccepterAddress = "";
+                        m_EC_AcceptWayByCustomers.AccepterPhoneNum = "";
+                        m_EC_AcceptWayByCustomers.AcceptContacts = "";
+                        m_EC_AcceptWayByCustomers.FetchAddress = "";
+                        m_EC_AcceptWayByCustomers.FetchPhoneNum = "";
+                        m_EC_AcceptWayByCustomers.FetchContacts = "";
+
+                        #endregion
+
+                        m_OA_CorporateClients.Keyid = NewGuid;
+                        m_OA_CorporateClients.CreateTime = DateTime.Now;
+                        m_OA_CorporateClients.MemberId = CurrentUser.MemberId;
+                        m_OA_CorporateClients.FirmId = NewGuid;
+                        m_OA_CorporateClients.InquiryId = AdminAccount.MemberId;
+                        m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(m_OA_CorporateClients.FirmId) + 1;
+
+                        m_OA_CustomerCommunications.Keyid = NewGuid;
+                        m_EC_AcceptWayByCustomers.TargetId = NewGuid;
+                        m_OA_CorporateClients.Paytime = 0;
+                        m_OA_CorporateClients.Paydays = 0;
+                        m_OA_CorporateClients.Biddingcompany = 0;
+                        m_OA_CorporateClients.Contracttype = 0;
+                        m_OA_CorporateClients.Contractmoney = 0;
+                        m_OA_CorporateClients.Jigoudaima = "";
+                        m_OA_CorporateClients.Piaoju = 0;
+                        m_OA_CorporateClients.Kaipiaoziliao = "";
+                        m_OA_CorporateClients.Expiretype = 0;
+                        m_OA_CorporateClients.Shifouwanjie = 2;
+                        m_OA_CorporateClients.Note = "";
+                        bool result = bll_OA_CorporateClientsBLL.InsertModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers);//娣诲姞淇℃伅
+                        if (!result)
+                        {
+                            JavaScript.MessageBox("娣诲姞澶辫触", this);
+                            return;
+                        }
+                         
+                            
+                    }
+                }
             }
 
 
@@ -221,7 +368,7 @@
             supplier.LegalRepresentative = this.txtLegalRepresentative.Value;
             supplier.ManagersMobile = this.txtManagersMobile.Value;
             supplier.ManagersQQ = this.txtManagersQQ.Value;
-            supplier.Name = this.txtName.Value;
+            supplier.Name = this.txtName.Value.Trim();
             supplier.OfficersMobile = this.txtOfficersMobile.Value;
             supplier.OfficersQQ = this.txtOfficersQQ.Value;
             if (!string.IsNullOrEmpty(this.txtHuming.Value))

--
Gitblit v1.9.1