/// <summary> /// 获取供应商信息对话框 /// </summary> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetProviderInfoDialog(string strType) { IProviderServer m_providerServer = ServerModuleFactory.GetServerModule <IProviderServer>(); IQueryable <View_Provider> queryResult; if (!m_providerServer.GetAllProvider(out queryResult, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return(null); } queryResult = from r in queryResult where r.是否在用 == true select r; switch (strType) { case "零件合格供应商": queryResult = from r in queryResult where r.零星采购供应商 == false select r; break; default: break; } System.Data.DataTable dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_Provider>(queryResult); FormQueryInfo form = new FormQueryInfo(dataTable); return(form); }
/// <summary> /// 获取供应商信息对话框 /// </summary> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetProviderInfoDialog() { IProviderServer m_providerServer = ServerModuleFactory.GetServerModule <IProviderServer>(); IQueryable <View_Provider> queryResult; DepotManagementDataContext ctx = CommentParameter.DepotDataContext; if (!m_providerServer.GetAllProvider(out queryResult, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return(null); } queryResult = from r in queryResult where r.是否在用 == true select r; if (!BasicInfo.ListRoles.Contains(CE_RoleEnum.采购账务管理员.ToString()) && BasicInfo.ListRoles.Contains(CE_RoleEnum.采购员.ToString())) { var varData = (from r in ctx.View_Provider join f in ctx.ProviderPrincipal on r.供应商编码 equals f.Provider where f.PrincipalWorkId == BasicInfo.LoginID && r.是否在用 == true select r).Distinct(); List <View_Provider> lstProvider = new List <View_Provider>(); foreach (var item in varData) { View_Provider lnqProvider = new View_Provider(); lnqProvider.供应商编码 = item.供应商编码; lnqProvider.供应商名称 = item.供应商名称; lnqProvider.简称 = item.简称; lnqProvider.拼音码 = item.拼音码; lnqProvider.零星采购供应商 = item.零星采购供应商; lnqProvider.是否在用 = item.是否在用; lnqProvider.五笔码 = item.五笔码; lstProvider.Add(lnqProvider); } queryResult = lstProvider.AsQueryable(); } System.Data.DataTable dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_Provider>(queryResult); FormQueryInfo form = new FormQueryInfo(dataTable); return(form); }
/// <summary> /// 获取库存中指定物品的供应商信息对话框 /// </summary> /// <param name="goodsID">物品ID</param> /// <param name="providerType">供应商类型</param> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetDistinctProviderInfoDialog(int goodsID, CE_ScrapProviderType providerType) { IProviderServer m_providerServer = ServerModuleFactory.GetServerModule <IProviderServer>(); IQueryable <View_Provider> queryResult; System.Data.DataTable dataTable = new DataTable(); switch (providerType) { case CE_ScrapProviderType.责任供应商: if (!m_providerServer.GetDistinctProvider(out queryResult, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return(null); } dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_Provider>(queryResult); break; case CE_ScrapProviderType.供应商: View_F_GoodsPlanCost viewGoods = UniversalFunction.GetGoodsInfo(goodsID); string strSql = " select distinct a.* from View_Provider as a inner join ( " + " select distinct GoodsID, Provider from S_InDepotDetailBill as a " + " union all select distinct GoodsID, Provider from S_Stock) as b " + " on a.供应商编码 = b.Provider inner join F_GoodsPlanCost as c on b.GoodsID = c.ID " + " where GoodsName = '" + viewGoods.物品名称 + "'"; dataTable = GlobalObject.DatabaseServer.QueryInfo(strSql); break; default: break; } FormQueryInfo form = new FormQueryInfo(dataTable); form.ShowColumns = new string[] { "供应商编码" }; return(form); }