| | |
| | | using SyntacticSugar.constant; |
| | | using System.Web; |
| | | using WebAPI.Controllers.SCGL.日计划管理; |
| | | using WebAPI.WebBLL.JCJM.GYZL; |
| | | using WebAPI.WebBLL.JCJM.IMPL; |
| | | //using WebAPI.WebBLL.JCJM.GYZL; |
| | | //using WebAPI.WebBLL.JCJM.IMPL; |
| | | using System.IO; |
| | | namespace WebAPI.Controllers |
| | | { |
| | |
| | | |
| | | private json objJsonResult = new json(); |
| | | SQLHelper.ClsCN oCN = new SQLHelper.ClsCN(); |
| | | private Gy_CustomerService customerService = new Gy_CustomerImpl(); |
| | | //private Gy_CustomerService customerService = new Gy_CustomerImpl(); |
| | | DataSet ds; |
| | | |
| | | #region 返回客户列表 |
| | |
| | | } |
| | | #endregion |
| | | |
| | | #region 客户分页列表 |
| | | [Route("Gy_Customer/page")] |
| | | [HttpGet] |
| | | public json Gy_CustomerPage(string sWhere, string user, int page, int size, string Organization) |
| | | { |
| | | DataSet ds; |
| | | json res = new json(); |
| | | try |
| | | { |
| | | List<object> columnNameList = new List<object>(); |
| | | //判断权限 |
| | | if (!DBUtility.ClsPub.Security_Log_second("Crm_CustomerFileList", 1, false, user)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "无查看权限!"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | //客户制定 |
| | | string sErr = ""; |
| | | if (oSystemParameter.ShowBill(ref sErr)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName != "乔一") |
| | | { |
| | | sWhere += ("and 组织名称 = '" + Organization + "'"); |
| | | } |
| | | } |
| | | |
| | | |
| | | sWhere = sWhere.Replace("'", "''"); |
| | | if (sWhere == null || sWhere.Equals("")) |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_CustomerList " + page + "," + size + ",''", "h_p_Gy_CustomerList"); |
| | | } |
| | | else |
| | | { |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_CustomerList " + page + "," + size + ",'" + sWhere + "'", "h_p_Gy_CustomerList"); |
| | | } |
| | | |
| | | //添加列名 |
| | | foreach (DataColumn col in ds.Tables[0].Columns) |
| | | { |
| | | Type dataType = col.DataType; |
| | | string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}"; |
| | | columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//获取到DataColumn列对象的列名 |
| | | } |
| | | |
| | | res.code = CodeConstant.SUCCEED; |
| | | res.count = int.Parse(ds.Tables[1].Rows[0]["count"].ToString()); |
| | | res.Message = "Sucess!"; |
| | | res.list = columnNameList; |
| | | res.data = ds.Tables[0]; |
| | | return res; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | res.code = CodeConstant.FAIL; |
| | | res.count = CountConstant.FAIL; |
| | | res.Message = "Exception!" + e.ToString(); |
| | | res.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 客户子表[关联用户] 查询 |
| | | /// <summary> |
| | | /// 返回客户子表[关联用户]列表 |
| | |
| | | c.HTaxNum 税务登记号,c.HTaxRate 增值税率,c.HEnglishName 英文名称,c.HEngLishAddress 英文地址,c.HCountry 国家,c.HCusStatus 客户状态 |
| | | ,c.HStopflag 禁用标志,c.HRemark 备注,c.HAreaID 地区ID,a.HName 地区名称,c.HCurID 默认货币ID,r.HName 默认货币, |
| | | c.HSSID 结算方式ID,s.HName 结算方式,c.HCusTypeID 客户分类ID,t.HName 客户分类 from Gy_Customer c |
| | | left join Gy_AreaSet a on c.HAreaID=a.HItemID |
| | | left join Gy_Currency r on c.HCurID=r.HItemID |
| | | left join Gy_SettleStyle s on c.HSSID=s.HItemID |
| | | left join Gy_CusType t on c.HCusTypeID=t.HItemID |
| | | where c.HItemID='" + HInterID + "'"); |
| | | ds = oCN.RunProcReturn(sql, "Gy_Customer"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = ""; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 客户列表修改按钮方法添加审核人 |
| | | /// <summary> |
| | | /// 客户列表修改按钮方法 |
| | | ///参数:string sql。 |
| | | ///返回值:object。 |
| | | /// </summary> |
| | | [Route("Gy_Customer/xg_extendCheckEmp")] |
| | | [HttpGet] |
| | | public object xg_extendCheckEmp(long HInterID) |
| | | { |
| | | try |
| | | { |
| | | string sql = string.Format(@"select c.HItemID,c.HNumber 客户代码,c.HName 客户名称,c.HHelpCode 助记码,c.HShortName 简称,c.HAddress 地址,c.HLinkMan 联系人,c.HLinkPhone 联系电话 |
| | | ,c.HMobilePhone 手机,c.HFax 传真,c.HPostalCode 邮编,c.HEmail 电子邮件,c.HCorMan 法人代表,c.HBank 开户银行,c.HBankAccount 银行账号,c.HMateOutEmp 领用人, |
| | | c.HTaxNum 税务登记号,c.HTaxRate 增值税率,c.HEnglishName 英文名称,c.HEngLishAddress 英文地址,c.HCountry 国家,c.HCusStatus 客户状态 |
| | | ,c.HStopflag 禁用标志,c.HRemark 备注,c.HAreaID 地区ID,a.HName 地区名称,c.HCurID 默认货币ID,r.HName 默认货币, |
| | | c.HSSID 结算方式ID,s.HName 结算方式,c.HCusTypeID 客户分类ID,t.HName 客户分类, c.HCheckEmp 审核人 from Gy_Customer c |
| | | left join Gy_AreaSet a on c.HAreaID=a.HItemID |
| | | left join Gy_Currency r on c.HCurID=r.HItemID |
| | | left join Gy_SettleStyle s on c.HSSID=s.HItemID |
| | |
| | | ",HEmpID,HCreditDate,HCreditRatingDate,HMaxCreditRatingDate" + |
| | | ",HMonthUseQty,HForecastCreditRating,HCreditLevelID,HCountAccrualRating" + |
| | | ",HSubsidyAccrualRating,HCreditRating,HMaxCreditRating" + |
| | | ",HCusTypeID) " + |
| | | ",HCusTypeID,HERPItemID,HUseOrgID,HCreateOrgID) " + |
| | | " Values('" + lsmain[0].HItemID + "','" + lsmain[0].HNumber + "','" + lsmain[0].HName + "','" + lsmain[0].HHelpCode + "','" + lsmain[0].HShortNumber + "'," + lsmain[0].HParentID + |
| | | ", " + lsmain[0].HLevel + ",0,'" + lsmain[0].HStopFlag + "','" + lsmain[0].HRemark + "'" + |
| | | ",'" + lsmain[0].HShortName + "','" + lsmain[0].HAddress + "','" + lsmain[0].HLinkMan + "','" + lsmain[0].HLinkPhone + "','" + lsmain[0].HMobilePhone + "'" + |
| | |
| | | "," + lsmain[0].HEmpID + "," + lsmain[0].HCreditDate + "," + lsmain[0].HCreditRatingDate + "," + lsmain[0].HMaxCreditRatingDate + |
| | | "," + lsmain[0].HMonthUseQty + "," + lsmain[0].HForecastCreditRating + "," + lsmain[0].HCreditLevelID + "," + lsmain[0].HCountAccrualRating + |
| | | "," + lsmain[0].HSubsidyAccrualRating + "," + lsmain[0].HCreditRating + "," + lsmain[0].HMaxCreditRating + |
| | | ", " + lsmain[0].HCusTypeID + ")"); |
| | | ", " + lsmain[0].HCusTypeID + "," + lsmain[0].HItemID + ",'" + lsmain[0].HUSEORGID + "','" + lsmain[0].HCREATEORGID + "')"); |
| | | //主表_客户 |
| | | oCN.RunProc("Insert into Gy_Customer " + |
| | | " (HItemID,HNumber,HName,HHelpCode,HShortNumber,HParentID" + |
| | |
| | | ",HEmpID,HCreditDate,HCreditRatingDate,HMaxCreditRatingDate" + |
| | | ",HMonthUseQty,HForecastCreditRating,HCreditLevelID,HCountAccrualRating" + |
| | | ",HSubsidyAccrualRating,HCreditRating,HMaxCreditRating" + |
| | | ",HCusTypeID,HERPItemID) " + |
| | | ",HCusTypeID,HERPItemID,HUseOrgID,HCreateOrgID) " + |
| | | " Values('" + lsmain[0].HItemID + "','" + lsmain[0].HNumber + "','" + lsmain[0].HName + "','" + lsmain[0].HHelpCode + "','" + lsmain[0].HShortNumber + "'," + lsmain[0].HParentID + |
| | | ", " + lsmain[0].HLevel + ",0,'" + lsmain[0].HStopFlag + "','" + lsmain[0].HRemark + "'" + |
| | | ",'" + lsmain[0].HShortName + "','" + lsmain[0].HAddress + "','" + lsmain[0].HLinkMan + "','" + lsmain[0].HLinkPhone + "','" + lsmain[0].HMobilePhone + "'" + |
| | |
| | | "," + lsmain[0].HEmpID + "," + lsmain[0].HCreditDate + "," + lsmain[0].HCreditRatingDate + "," + lsmain[0].HMaxCreditRatingDate + |
| | | "," + lsmain[0].HMonthUseQty + "," + lsmain[0].HForecastCreditRating + "," + lsmain[0].HCreditLevelID + "," + lsmain[0].HCountAccrualRating + |
| | | "," + lsmain[0].HSubsidyAccrualRating + "," + lsmain[0].HCreditRating + "," + lsmain[0].HMaxCreditRating + |
| | | ", " + lsmain[0].HCusTypeID + "," + lsmain[0].HItemID + ")"); |
| | | ", " + lsmain[0].HCusTypeID + "," + lsmain[0].HItemID + ",'" + lsmain[0].HUSEORGID + "','" + lsmain[0].HCREATEORGID + "')"); |
| | | sql = "set identity_insert gy_Customer off"; |
| | | oCN.RunProc(sql); |
| | | //客户_交货地点 |
| | |
| | | #region [同步基础资料] |
| | | [Route("Gy_Customer/Gy_CustomerViewApi")] |
| | | [HttpGet] |
| | | public json Gy_CustomerViewApi(string Number, string Type) |
| | | public json Gy_CustomerViewApi(string Number, string Type, string HUseOrgID) |
| | | { |
| | | string sql = string.Empty; |
| | | string sReturn = ""; |
| | |
| | | else |
| | | { |
| | | #region [公有云模式,调用WEBAPI的方式进行更新] |
| | | // 使用查询的WEBAPI 无法满足按照 使用组织更新数据的要求,改为使用单据查询 |
| | | var json = new |
| | | // { |
| | | // CreateOrgId = HUseOrgID, |
| | | // Number = Number, |
| | | // Id = "" |
| | | // }; |
| | | { |
| | | CreateOrgId = 0, |
| | | Number = Number, |
| | | Id = "" |
| | | FormId = "BD_Customer", |
| | | FieldKeys = "FMASTERID,FNUMBER,FNAME,FFORBIDDERID,FCREATEDATE,FCREATEORGID,FUSEORGID", |
| | | FilterString = $@"FNumber='{Number}' AND FUseOrgID={HUseOrgID}", |
| | | OrderString = "", |
| | | TopRowCount = 0, |
| | | StartRow = 0, |
| | | Limit = 0 |
| | | }; |
| | | #region [金蝶部分] |
| | | //登录金蝶 |
| | | var loginRet = InvokeHelper.Login(); |
| | | |
| | | #region [金蝶部分] |
| | | //登录金蝶 |
| | | var loginRet = InvokeHelper.Login(); |
| | | var isSuccess = JObject.Parse(loginRet)["LoginResultType"].Value<int>(); |
| | | //判断是否登录成功 |
| | | if (isSuccess < 0) |
| | |
| | | return objJsonResult; |
| | | } |
| | | //查看 获取数据 |
| | | var _result = InvokeHelper.View("BD_Customer", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JObject.Parse(_result); |
| | | // var _result = InvokeHelper.View("BD_Customer", JsonConvert.SerializeObject(json)); |
| | | var _result = InvokeHelper.Query("BD_Customer", JsonConvert.SerializeObject(json)); |
| | | var _saveObj = JArray.Parse(_result); |
| | | //判断数据是否获取成功 |
| | | if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | // if (_saveObj["Result"]["ResponseStatus"]["IsSuccess"].ToString().ToUpper() != "TRUE") |
| | | // { |
| | | // objJsonResult.code = "0"; |
| | | // objJsonResult.count = 0; |
| | | // objJsonResult.Message = "金蝶客户同步失败jsonRoot:" + _result; |
| | | // objJsonResult.data = null; |
| | | // return objJsonResult; |
| | | // } |
| | | if (_saveObj.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "金蝶客户同步失败jsonRoot:" + _result; |
| | | objJsonResult.Message = "金蝶客户同步失败,使用组织对应的客户代码不存在"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | |
| | | |
| | | #region [表数据赋值] |
| | | var jsonData = new |
| | | // { |
| | | // HItemID = _saveObj["Result"]["Result"]["Id"], |
| | | // HERPItemID = _saveObj["Result"]["Result"]["Id"], |
| | | // HNumber = _saveObj["Result"]["Result"]["Number"], |
| | | // HName = _saveObj["Result"]["Result"]["Name"][0]["Value"], |
| | | // HShortNumber = _saveObj["Result"]["Result"]["Number"], |
| | | // HParentID = 0, |
| | | // HLevel = 1, |
| | | // HEndFlag = 1, |
| | | // HStopflag = _saveObj["Result"]["Result"]["ForbidStatus"].ToString() == "A" ? 0 : 1, |
| | | // HRemark = "CLD-ERP导入", |
| | | // HUseFlag = "已使用", |
| | | // HMakeTime = _saveObj["Result"]["Result"]["CreateDate"], |
| | | // HCREATEORGID = _saveObj["Result"]["Result"]["CreateOrgId_Id"], |
| | | // HUSEORGID = _saveObj["Result"]["Result"]["UseOrgId_Id"], |
| | | // }; |
| | | { |
| | | HItemID = _saveObj["Result"]["Result"]["Id"], |
| | | HERPItemID = _saveObj["Result"]["Result"]["Id"], |
| | | HNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HName = _saveObj["Result"]["Result"]["Name"][0]["Value"], |
| | | HShortNumber = _saveObj["Result"]["Result"]["Number"], |
| | | HItemID = _saveObj[0][0], |
| | | HERPItemID = _saveObj[0][0], |
| | | HNumber = _saveObj[0][1], |
| | | HName = _saveObj[0][2], |
| | | HShortNumber = _saveObj[0][1], |
| | | HParentID = 0, |
| | | HLevel = 1, |
| | | HEndFlag = 1, |
| | | HStopflag = _saveObj["Result"]["Result"]["ForbidStatus"].ToString() == "A" ? 0 : 1, |
| | | HStopflag = _saveObj[0][3].ToString() == "A" ? 0 : 1, |
| | | HRemark = "CLD-ERP导入", |
| | | HUseFlag = "已使用", |
| | | HMakeTime = _saveObj["Result"]["Result"]["CreateDate"], |
| | | HCREATEORGID = _saveObj["Result"]["Result"]["CreateOrgId_Id"], |
| | | HUSEORGID = _saveObj["Result"]["Result"]["UseOrgId_Id"], |
| | | HMakeTime = _saveObj[0][4], |
| | | HCREATEORGID = _saveObj[0][5], |
| | | HUSEORGID = _saveObj[0][6], |
| | | }; |
| | | #endregion |
| | | |
| | | LogService.Write("jsonData: " + jsonData); |
| | | // 删除主表对应数据 |
| | | sql = $"delete from Gy_Customer where HItemID = " + jsonData.HItemID + " and HNumber = '" + Number + "'"; |
| | | oCN.RunProc(sql); |
| | |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | // #region 客户分类属性结构 根据组织分类 |
| | | [Route("Gy_BadReason/Gy_CusTypeTreeListByOrganization")] |
| | | [HttpGet] |
| | | public object Gy_CusTypeTreeListByOrganization() |
| | | { |
| | | try |
| | | { |
| | | string sql1 = string.Format("select hitemid,hnumber,hname,hparentid from Xt_ORGANIZATIONS where hstopflag != 1 order by hnumber"); |
| | | |
| | | ds = oCN.RunProcReturn(sql1, "Xt_ORGANIZATIONS"); |
| | | |
| | | List <TreeModel> treeModels = new List<TreeModel>(); |
| | | TreeModel first = new TreeModel(); |
| | | first.title = "使用组织"; |
| | | first.id = "0"; |
| | | treeModels.Add(first); |
| | | |
| | | foreach (DataRow row in ds.Tables[0].Rows) |
| | | { |
| | | int HParentID = (int)row["hparentid"]; |
| | | int HItemID = (int)row["hitemid"]; |
| | | //if(HParentID == 0 || HItemID == HParentID) // 父节点为0或者自引用的设置为一级几点 |
| | | //{ |
| | | TreeModel tree = new TreeModel(); |
| | | tree.id = row["hitemid"].ToString(); |
| | | tree.title = row["hname"].ToString(); |
| | | treeModels[0].children.Add(tree); |
| | | |
| | | //} |
| | | } |
| | | //getTreeByHItemID(ds.Tables[0], treeModels); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucess!"; |
| | | objJsonResult.data = Newtonsoft.Json.JsonConvert.SerializeObject(treeModels); |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exception!" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | // #endregion |
| | | |
| | | #region 根据父id和等级获得树状图递归 |
| | | |
| | | [Route("Gy_BadReason/Gy_CusTypeTreeListByLevel")] |
| | |
| | | #endregion |
| | | |
| | | #region 客户列表 文件上传 |
| | | [Route("Gy_Customer/Gy_Process_Excel")] |
| | | [HttpPost] |
| | | public json Gy_Department_Excel() |
| | | { |
| | | json res = new json(); |
| | | try |
| | | { |
| | | //获取文件名称 |
| | | var file = HttpContext.Current.Request.Files[0]; |
| | | //获取文件物理路径 |
| | | string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); |
| | | //保存文件 |
| | | file.SaveAs(ExcelPath); |
| | | //[Route("Gy_Customer/Gy_Process_Excel")] |
| | | //[HttpPost] |
| | | //public json Gy_Department_Excel() |
| | | //{ |
| | | // json res = new json(); |
| | | // try |
| | | // { |
| | | // //获取文件名称 |
| | | // var file = HttpContext.Current.Request.Files[0]; |
| | | // //获取文件物理路径 |
| | | // string ExcelPath = HttpContext.Current.Server.MapPath("~/" + file.FileName); |
| | | // //保存文件 |
| | | // file.SaveAs(ExcelPath); |
| | | |
| | | NpoiHelper np = new NpoiHelper(); |
| | | DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0"); |
| | | //删除文件 |
| | | File.Delete(ExcelPath); |
| | | DataTable provisional = customerService.UploadExcel(ExcelDs); |
| | | // NpoiHelper np = new NpoiHelper(); |
| | | // DataSet ExcelDs = np.ReadExcel(ExcelPath, 1, 1, "0"); |
| | | // //删除文件 |
| | | // File.Delete(ExcelPath); |
| | | // DataTable provisional = customerService.UploadExcel(ExcelDs); |
| | | |
| | | res.code = CodeConstant.SUCCEED; |
| | | res.count = CountConstant.SUCCEED; |
| | | res.Message = "上传成功"; |
| | | res.data = provisional; |
| | | return res; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | res.code = "0"; |
| | | res.count = 0; |
| | | res.Message = "Exception!" + e.ToString(); |
| | | res.data = null; |
| | | return res; |
| | | } |
| | | } |
| | | // res.code = CodeConstant.SUCCEED; |
| | | // res.count = CountConstant.SUCCEED; |
| | | // res.Message = "上传成功"; |
| | | // res.data = provisional; |
| | | // return res; |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // res.code = "0"; |
| | | // res.count = 0; |
| | | // res.Message = "Exception!" + e.ToString(); |
| | | // res.data = null; |
| | | // return res; |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 判断当前职员是否存在 |
| | |
| | | /// <param name="HEmpNumber"></param> |
| | | /// <param name="HEmpName"></param> |
| | | /// <returns></returns> |
| | | private bool JudgeEmp(string HEmpNumber, string HEmpName) |
| | | { |
| | | if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName)) |
| | | { |
| | | DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee"); |
| | | return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false; |
| | | } |
| | | return false; |
| | | } |
| | | //private bool JudgeEmp(string HEmpNumber, string HEmpName) |
| | | //{ |
| | | // if (!String.IsNullOrEmpty(HEmpNumber) && !String.IsNullOrEmpty(HEmpName)) |
| | | // { |
| | | // DataSet emp = oCN.RunProcReturn("select * from Gy_Employee where HNumber = '" + HEmpNumber + "' and HName = '" + HEmpName + "'", "Gy_Employee"); |
| | | // return emp.Tables[0].Rows.Count <= EmptyConstant.EMPTY ? true : false; |
| | | // } |
| | | // return false; |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 判断列 |
| | |
| | | |
| | | #endregion |
| | | |
| | | public void getTreeByHItemID(DataTable dt, List<TreeModel> tree) |
| | | { |
| | | for (int m = 0; m < tree.Count; m++) |
| | | { |
| | | tree[m].children = new List<TreeModel>(); |
| | | for (int i = 0; i < dt.Rows.Count; i++)//第一次循环,得到所有根节点的子集 |
| | | { |
| | | var HParentID = dt.Rows[i]["hparentid"].ToString(); |
| | | var HItemID = dt.Rows[i]["hitemid"].ToString(); |
| | | if (HParentID == tree[m].id && HParentID != HItemID) |
| | | { |
| | | TreeModel tbjson = new TreeModel(); |
| | | tbjson.id = dt.Rows[i]["hitemid"].ToString(); |
| | | tbjson.title = dt.Rows[i]["hname"].ToString(); |
| | | tree[m].children.Add(tbjson); |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < tree[m].children.Count; i++) |
| | | { |
| | | getTreeByHItemID(dt, tree[m].children);//再次用子集去循环,拿出子集的子集 |
| | | } |
| | | } |
| | | } |
| | | |
| | | #region 递归函数 |
| | | /// <summary> |
| | | /// 递归函数 |