/// <summary> /// 自增编码-单据 /// </summary> /// <param name="CompanyCode"></param> /// <param name="Module"></param> /// <returns></returns> public static string GetTableKeyForPU(string CompanyCode, string Module) { ADOSys_Config_Refer instance = new ADOSys_Config_Refer(); SqlParameter x1 = new SqlParameter("@CompanyCode", SqlDbType.VarChar, 20); x1.Value = CompanyCode == null ? "" : CompanyCode; SqlParameter x2 = new SqlParameter("@ModuleCode", SqlDbType.VarChar, 20); x2.Value = Module; SqlParameter x3 = new SqlParameter("@GeneralType", SqlDbType.VarChar, 20); x3.Value = ""; SqlParameter x4 = new SqlParameter("@code", SqlDbType.VarChar, 20); x4.Direction = ParameterDirection.Output; SqlParameter[] param = new SqlParameter[] { x1, x2, x3, x4 }; IDbDataParameter[] parames = param as IDbDataParameter[]; DataTable dt = instance.idb.RunProcReturnDatatable("qx_sp_compcode", parames); return(dt.Rows[0][0].ToString()); }
/// <summary> /// 获取自增编码 /// </summary> /// <param name="Module"></param> /// <returns></returns> public static string GetTableKey(string Module) { ADOSys_Config_Refer instance = new ADOSys_Config_Refer(); SqlParameter x1 = new SqlParameter("@sTable", SqlDbType.NChar, 40); x1.Value = Module.Trim(); SqlParameter[] param = new SqlParameter[] { x1 }; IDbDataParameter[] parames = param as IDbDataParameter[]; DataTable dt = instance.idb.RunProcReturnDatatable("findnewid", parames); return(dt.Rows[0][0].ToString()); }
/// <summary> /// 获取特殊自增编码,根据Sys_DictModule中存在的配置为特殊编码 /// </summary> /// <param name="CompanyCode">公司编码</param> /// <param name="Module">模块名称:MMType 为物料类别编码</param> /// <param name="GeneralType">如果有父级时,传入子级编码</param> /// <param name="Code">传出编码</param> /// <returns></returns> public static string GetTableKey(string CompanyCode, string Module, string GeneralType, string Code) { ADOSys_Config_Refer instance = new ADOSys_Config_Refer(); ADOSys_DictModule DictModule = new ADOSys_DictModule(); var DModuleList = DictModule.GetListByWhere(" AND ModuleCode='" + Module + "' "); SqlParameter x1 = new SqlParameter("@CompanyCode", SqlDbType.VarChar, 20); x1.Value = CompanyCode; SqlParameter x2 = new SqlParameter("@ModuleCode", SqlDbType.VarChar, 20); x2.Value = Module; SqlParameter x3 = new SqlParameter("@GeneralType", SqlDbType.VarChar, 20); x3.Value = GeneralType; SqlParameter x4 = new SqlParameter("@code", SqlDbType.VarChar, 20); x4.Direction = ParameterDirection.Output; SqlParameter x5 = new SqlParameter("@sTable", SqlDbType.NChar, 40); x5.Value = Module.Trim(); DataTable dt = new DataTable(); if (DModuleList.Count > 0) { SqlParameter[] param = new SqlParameter[] { x1, x2, x3, x4 }; IDbDataParameter[] parames = param as IDbDataParameter[]; dt = instance.idb.RunProcReturnDatatable("qx_sp_compcode", parames); } else { SqlParameter[] param = new SqlParameter[] { x5 }; IDbDataParameter[] parames = param as IDbDataParameter[]; dt = instance.idb.RunProcReturnDatatable("findnewid", parames); } return(dt.Rows[0][0].ToString()); }
/// <summary> /// 执行存储过程 /// </summary> /// <param name="procName"></param> /// <returns></returns> public static DataTable RunProc(string procName) { ADOSys_Config_Refer instance = new ADOSys_Config_Refer(); return(instance.idb.RunProcReturnDatatable(procName)); }
/// <summary> /// 执行存储过程 /// </summary> /// <param name="procName"></param> /// <param name="para"></param> /// <returns></returns> public static DataTable RunProc(string procName, IDbDataParameter[] para) { ADOSys_Config_Refer instance = new ADOSys_Config_Refer(); return(instance.idb.RunProcReturnDatatable(procName, para)); }
public static string ReferControlEx( this HtmlHelper helper, string ModuleName, string NameSpace, bool Multiselect) { string str = string.Empty; ADOSys_Config_Refer ReferInstance = new ADOSys_Config_Refer(); ADOSys_Config_Field_Refer DListInstance = new ADOSys_Config_Field_Refer(); if (string.IsNullOrEmpty(ModuleName) || string.IsNullOrEmpty(NameSpace)) { return string.Empty; } Sys_Config_Refer MRefer = ReferInstance.GetListByWhere(" AND R_ModuleName='" + ModuleName + "'")[0]; List<Sys_Config_Field_Refer> D_List = DListInstance.GetListByWhere(" AND D_ModuleName='" + ModuleName + "'"); #region JqGrid Html 列表显示部分 string html = @" <div class='Comm_Ref' id='{ModuleName}{M_NameSpace}' style='display:none'> {ToolBar} <div id='{M_NameSpace}search'> </div> <table id='{M_NameSpace}grid'' class='scroll' cellpadding='0' cellspacing='0'> </table> <div id='{M_NameSpace}pager' class='scroll' style='text-align: center;'> </div> <div style='float:right;padding-top:20px'> <span> <input id='btnok_{M_NameSpace}' type='button' value='确定'/> <input type='button' value='关闭' onclick='{M_NameSpace}Close()'/> </span> </div> </div>"; #endregion #region JqGrid Js部分 string js_header = @"<script type='text/javascript'>"; string js_footer = @"</script>"; string jsBody = @" var {M_NameSpace}_{ModuleName}_GridControl = { setupGrid: function(grid, pager, search, dataurl) { grid.jqGrid({ url: dataurl, mtype: 'post', rowNum: 10, rowList: [10,20,50], pager: pager, sortorder: 'asc', viewrecords: true, multiselect: {MultiSelect}, //多选时出现checkbox width: '{M_Width}', height: '{M_Height}', autowidth: false, rownumbers: true, gridview: true, footerrow: false, colNames: [{M_ColNames_list}], colModel: [{M_ColModel_List}], gridComplete: function() { var ids = grid.jqGrid('getDataIDs'); for (var i = 0; i < ids.length; i++) { var cl = ids[i]; var ret = grid.jqGrid('getRowData', cl); var operation=''; {M_GridComplete} grid.jqGrid('setRowData', ids[i], { Edit: operation }); } }, userDataOnFooter: true }) }, Init: function(dataurl, targetPreFix) { var gridobj = targetPreFix + 'grid'; var pagerobj = targetPreFix + 'pager'; var searchobj = targetPreFix + 'search'; {M_NameSpace}_{ModuleName}_GridControl.setupGrid($('#' + gridobj), $('#' + pagerobj), $('#' + searchobj), dataurl); $('#' + gridobj).navGrid('#'+pagerobj, { refresh: false, edit: false, add: false, del: false, search:false,multipleSearch:false }); } } "; #endregion string btnMJs = @" $('#btnok_{M_NameSpace}').click(function(){ var grid = $('#{M_NameSpace}grid'); var curids = grid.getGridParam('selarrrow'); //获取选择行的id if(curids!=''){ var ids=new Array(); var selectRows=new Array(); //selectRows.length=0; ids=curids.toString().split(','); for(var i=0;i<ids.length;i++){ var data = grid.getRowData(ids[i]); //获取行号为curid的数据 if(data!=null){ selectRows.push(data); } } {M_NameSpace}callback(selectRows); $('#{ModuleName}{M_NameSpace}').dialog('close'); } }); "; string btnSJs = @" $('#btnok_{M_NameSpace}').click(function(){ var grid = $('#{M_NameSpace}grid'); var curid = grid.getGridParam('selrow'); //获取选择行的id var data = grid.getRowData(curid); //获取行号为curid的数据 if(curid==null) return; {M_NameSpace}callback(data); $('#{ModuleName}{M_NameSpace}').dialog('close'); }); "; //0131 YSW #region JqGrid调用部分 string callJs = @" <script type='text/javascript'> var {M_NameSpace}callback; $(document).ready(function() { {M_NameSpace}_{ModuleName}_GridControl.Init('{M_URL}','{M_NameSpace}'); //初始化层 $('#{ModuleName}{M_NameSpace}').dialog({ autoOpen: false, width: {Width}, height: {Height},title:'{M_Title}' }); //$('#{M_NameSpace}grid').jqGrid('filterGrid','#{M_NameSpace}grid', { multipleSearch:true } ); {BtnJs} }); function {ModuleName}{M_NameSpace}OpenRefer(callback){ $('#{ModuleName}{M_NameSpace}').dialog('open'); {M_NameSpace}callback=callback; } function {ModuleName}{M_NameSpace}OpenReferWithFilter(_filter,callback){ var _url={filterUrl}; var refGrid=$('#{M_NameSpace}grid'); refGrid.setGridParam({ url: _url }); refGrid.trigger('reloadGrid'); $('#{ModuleName}{M_NameSpace}').dialog('open'); {M_NameSpace}callback=callback; } function {M_NameSpace}Close(){ $('#{ModuleName}{M_NameSpace}').dialog('close'); } function {M_NameSpace}ToolBarSearch(){ $('#{M_NameSpace}grid').jqGrid('searchGrid', { multipleSearch:true } ); } </script> "; #endregion #region 生成列头 string strColNames = string.Empty; D_List = D_List.OrderBy(o => o.D_Order).ToList(); for (int i = 0; i < D_List.Count; i++) { if (i != (D_List.Count - 1)) { strColNames += "'" + D_List[i].D_Name.Trim() + "'" + ","; } else { strColNames += "'" + D_List[i].D_Name.Trim() + "'"; } } #endregion #region 生成列详细配置 StringBuilder header = new StringBuilder(); string header_template = @"{ name: '{D_Index}',width:100,index: '{D_Index}', align: 'center', {D_Hidden} searchoptions:{ sopt: ['eq', 'ne', 'cn'] } }"; string header_template_fix = ","; for (var m = 0; m < D_List.Count; m++) { string tmpFix = m != (D_List.Count - 1) ? header_template_fix : ""; header.AppendLine(header_template .Replace("{D_Name}", D_List[m].D_Name.Trim()) .Replace("{D_Index}", D_List[m].D_Index.Trim()) .Replace("{D_Hidden}", !string.IsNullOrEmpty(D_List[m].D_Hidden) ? "hidden:" + D_List[m].D_Hidden + "," : "") + tmpFix); } #endregion str += html; str += js_header + jsBody + js_footer; str += callJs; string url = string.Empty; string filter = string.Empty; if (!string.IsNullOrEmpty(MRefer.R_Url)) { url = MRefer.R_Url; filter = "'" + MRefer.R_Url + "?filter='+_filter"; } else { url = string.Format("/Sys_Config_Refer/GetData/?name={0}&m={1}&n={2}", MRefer.R_TableName, MRefer.R_ModuleName, MRefer.R_NameSpace); filter = "'/Sys_Config_Refer/GetData/?name=" + MRefer.R_TableName + "&m=" + MRefer.R_ModuleName + "&n=" + MRefer.R_NameSpace + "&filter='+_filter"; } string tool = string.Empty; if (string.IsNullOrEmpty(MRefer.R_Tool)) { tool = ""; } else { tool = MRefer.R_Tool; } str = str .Replace("{BtnJs}", Multiselect ? btnMJs : btnSJs) .Replace("{ModuleName}", ModuleName) .Replace("{M_NameSpace}", NameSpace) .Replace("{Width}", MRefer.R_Width.ToString()) .Replace("{Height}", MRefer.R_Height.ToString()) .Replace("{M_Width}", (MRefer.R_Width * 0.93).ToString()) .Replace("{M_Height}", (MRefer.R_Height * 0.4).ToString()) .Replace("{M_Title}", MRefer.R_Title) .Replace("{M_ColNames_list}", strColNames) .Replace("{M_ColModel_List}", header.ToString()) .Replace("{M_GridComplete}", "") .Replace("{M_URL}", url) .Replace("{filterUrl}", filter) .Replace("{Width}", "") .Replace("{Height}", "") .Replace("{Table}", MRefer.R_TableName) .Replace("{MultiSelect}", Multiselect ? "true" : "false") //.Replace("{ToolBar}", helper.Common_ToolBarForListPage(ModuleName, "", //"'add':'hidden','edit':'hidden','del':'hidden','import':'hidden','export':'hidden',view:'hidden'")); .Replace("{ToolBar}", helper.GenToolbarNoPermissionHelper(ModuleName,NameSpace, tool)); return str; }