From e4647b3bc4aca9690261df83f9055abdf8c17406 Mon Sep 17 00:00:00 2001 From: yxj <1qaz@123> Date: 星期四, 13 四月 2023 15:36:27 +0800 Subject: [PATCH] 1 --- WebAPI/Controllers/BaseSet/Gy_CustomerController.cs | 45 +++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 41 insertions(+), 4 deletions(-) diff --git a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs index b811a22..f362ec6 100644 --- a/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs +++ b/WebAPI/Controllers/BaseSet/Gy_CustomerController.cs @@ -42,7 +42,22 @@ objJsonResult.data = null; return objJsonResult; } - string sql1 = string.Format(@"select * from h_v_Gy_CustomerList where 缁勭粐鍚嶇О='" + Organization + "'"); + string sql1 = ""; + //瀹㈡埛鍒跺畾 + string sErr = ""; + if (oSystemParameter.ShowBill(ref sErr)) + { + if (oSystemParameter.omodel.WMS_CampanyName == "涔斾竴") + { + sql1 = string.Format(@"select * from h_v_Gy_CustomerList where 1=1"); + } + else + { + sql1 = string.Format(@"select * from h_v_Gy_CustomerList where 缁勭粐鍚嶇О='" + Organization + "'"); + } + } + + if (sWhere == null || sWhere.Equals("")) { ds = oCN.RunProcReturn(sql1 + sWhere + " order by 瀹㈡埛浠g爜 ", "h_v_Gy_CustomerList"); @@ -285,7 +300,7 @@ ",HEmpID,HCreditDate,HCreditRatingDate,HMaxCreditRatingDate" + ",HMonthUseQty,HForecastCreditRating,HCreditLevelID,HCountAccrualRating" + ",HSubsidyAccrualRating,HCreditRating,HMaxCreditRating" + - ",HCusTypeID) " + + ",HCusTypeID,HCREATEORGID,HUSEORGID) " + " Values('" + HNumber + "','" + HName + "','" + HHelpCode + "','" + HShortNumber + "'," + HParentID + ", " + HLevel + ",0,'" + HStopflag + "','" + HRemark + "'" + ",'" + HShortName + "','" + HAddress + "','" + HLinkMan + "','" + HLinkPhone + "','" + HMobilePhone + "'" + @@ -295,7 +310,7 @@ "," + HEmpID + "," + HCreditDate + "," + HCreditRatingDate + "," + HMaxCredRatingDate + "," + HMonthUseQty + "," + HForecastCreditRating + "," + HCreditLevelID + "," + HCountAccrualRating + "," + HSubsidyAccrualRating + "," + HCreditRating + "," + HMaxCreditRating + - ", " + HCusTypeID + ")"); + ", " + HCusTypeID + ","+ HCreateOrgID + ","+ HUseOrgID + ")"); //淇敼涓婄骇涓洪潪鏈骇浠g爜 oCN.RunProc("Update Gy_Customer set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo); oCN.Commit(); @@ -326,10 +341,12 @@ { var model = oMain["model"].ToString(); var custLocationModel = oMain["model"]["HCustLocationEntry"].ToString(); + var custContactModel = oMain["model"]["HCustContactEntry"].ToString(); //鍙嶅簭鍒楀寲 model = "[" + model + "]"; List<Customer> lsmain = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Customer>>(model); List<Model.ClsGy_CustLocation_Model> custLocationls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_CustLocation_Model>>(custLocationModel); + List<Model.ClsGy_COMMONCONTACT_Model> custContactls = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Model.ClsGy_COMMONCONTACT_Model>>(custContactModel); string sql = string.Empty; oCN.BeginTran(); sql = $"delete gy_Customer where HItemID = {lsmain[0].HItemID}"; @@ -379,10 +396,30 @@ } sql = "set identity_insert Gy_CustLocation off"; oCN.RunProc(sql); + + //瀹㈡埛_鏀惰揣鏂硅仈绯讳汉 + sql = $"delete Gy_COMMONCONTACT where HCUSTID = {lsmain[0].HItemID}"; + oCN.RunProc(sql); + sql = "set identity_insert Gy_COMMONCONTACT on"; + oCN.RunProc(sql); + foreach (var item in custContactls) + { + sql = $@"insert into Gy_COMMONCONTACT(HItemID,HCUSTID,HNumber,HName,HShortNumber,HParentID,HLevel,HEndFlag,HStopflag, + HRemark,HHelpCode,HUseFlag,HMakeTime,HMakeEmp,HCheckEmp,HCheckTime,HModifyEmp,HModifyTime,HStopEmp,HStopTime, + HUSEORGID,HCREATEORGID) + values({item.HItemID},{item.HCUSTID},'{item.HNumber}','{item.HName}','{item.HShortNumber}',{item.HParentID},{item.HLevel} + ,{Convert.ToString(item.HEndFlag ? 1 : 0)},{Convert.ToString(item.HStopflag ? 1 : 0) },'{item.HRemark}','{item.HHelpCode}','{item.HUseFlag}' + ,'{item.HMakeTime}','{item.HMakeEmp}','{item.HCheckEmp}','{item.HCheckTime}','{item.HModifyEmp}' + ,'{item.HModifyTime}','{item.HStopEmp}','{item.HStopTime}',{item.HUSEORGID},{item.HCREATEORGID})"; + oCN.RunProc(sql); + } + sql = "set identity_insert Gy_COMMONCONTACT off"; + oCN.RunProc(sql); + oCN.Commit(); objJsonResult.code = "1"; objJsonResult.count = 1; - objJsonResult.Message = "鏂板鍗曟嵁鎴愬姛锛�"; + objJsonResult.Message = "鏂板鍩虹璧勬枡鎴愬姛锛�"; //objJsonResult.data = null; return objJsonResult; } -- Gitblit v1.9.1