/// <summary> /// 生产菜单 /// </summary> public void BuildMenu() { DataRow[] rowArray1 = null; DataRow[] rowArray2 = null; string groupNo; string groupName; string menuID; MenuStrip mainMenu = new MenuStrip(); try { LogedInUser curUser = ClientSession.GetInstance().CurrentUser; string clientType = UserConfigXml.GetConfigInfo("ClientType", "type"); DataTable dt = new DataTable(); //根据配置文件,离线或在线生成用户菜单 if (ClientConfiguration.IsOfflineLogin) { //离线生成菜单 //dt = LoginUserOfflineBLL.GetInstance("ClientDB").GetMenuOffline(curUser.UserInfo.Id, clientType); } else { //在线生成菜单 //dt = ProxyFactory.UserProxy.GetMenu(curUser.UserInfo.Id, clientType); } dt = LoginUserOfflineBLL.GetInstance("ClientDB").GetMenuOffline(curUser.UserInfo.Id, clientType); if (dt.Rows.Count != 0) { rowArray1 = dt.Select("father='0'"); for (int i = 0; i < rowArray1.Length; i++) { //创建一个父菜单项 RibbonPage newPage = new RibbonPage(); //给菜单赋Text值。也就是在界面上看到的值。 newPage.Text = rowArray1[i]["name"].ToString().Trim(); menuID = rowArray1[i]["id"].ToString().Trim(); rowArray2 = dt.Select("father = '" + menuID + "'"); if (rowArray2.Length > 0) { CreateSubMenu(newPage, menuID, dt); } ribbon.Pages.Add(newPage); } } } catch (Exception ex) { throw ex; } }
//end add private void formSelf_load(object sender, EventArgs e) { //"导出基础信息"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24 //如果为1就是进销存对接接口 string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if ("1".Equals(clientPlat)) { tsmExpBaseInfo.Visible = true; } else { tsmExpBaseInfo.Visible = false; } login.Hide(); //modified by sunhl //Emedchina.TradeAssistant.Client.OrderStat frm = new Emedchina.TradeAssistant.Client.OrderStat(); //this.LoadFormToPanel(frm); string className = FileControl.readLog(); userStatusLable.Text = string.Format("当前用户:{0} ", ClientSession.GetInstance().CurrentUser.UserInfo.Name); //emptyStatusLabel.Width = GetEmptyLabelWidth(); emptyStatusLabel.Text = GetEmptyLableText(); this.Text = Application.ProductName; //下载更新的页面 FormShowDialog(new SyncForm()); //默认首页 //自动导航到上次关闭系统时的页面 if (!string.IsNullOrEmpty(ClientConfiguration.ResumeFlg) && ClientConfiguration.ResumeFlg.Equals("1")) { if (!string.IsNullOrEmpty(className)) { showLastState(className); } } }
/// <summary> ///数据同步业务逻辑层 /// </summary> //public int SyncTable(string buyerId, string tablename) //{ // string syncTime; // int rows; // ClientSyncDataDAO dao = ClientSyncDataDAO.GetInstance(Constant.ACCESSDBALIAS); // syncTime = dao.GetLastSyncTime(tablename, buyerId); // DataSet ds = ProxyFactory.SyncDataProxy.GetIncrementSyncData(tablename, buyerId, syncTime); // rows = Convert.ToInt32(ds.Tables[0].Rows.Count); // dao.IncrementSyncTableEx(ds); // return rows; //} /// <summary> /// 获得同步表的列表 /// </summary> /// <returns></returns> public static ArrayList GetTableParameter() { ArrayList results = new ArrayList(); try { string clientType = UserConfigXml.GetConfigInfo("ClientType", "type"); XmlNodeList node = UtilXml.GetNodeList(); foreach (XmlNode nd in node) { string temp = UtilXml.GetSyncText(nd.Attributes[0].Value.ToString(), "parameter"); temp = nd.Attributes[0].Value.ToString() + "," + temp; results.Add(temp); } } catch (Exception e) { throw e; } return(results); }
private void CustomConfig_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ClientConfiguration.ResumeFlg) && ClientConfiguration.ResumeFlg.Equals("1")) { this.chbState.Checked = true; } else { this.chbState.Checked = false; } //增加配置项("进销存"企业对接功能),shangfu 2007-8-31 //如果为1就是进销存对接接口 string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if ("1".Equals(clientPlat)) { this.ckbHisState.Checked = true; } else { this.ckbHisState.Checked = false; } }
/// <summary> /// 订单导出 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnExpOrder_Click(object sender, EventArgs e) { int iCount = 0; string sOrderID = string.Empty; //订单ID string sOrgID = base.CurrentUserOrgId; //卖方机构ID if (this.dgvSalerOrderList.CurrentRow == null) { MessageBox.Show("请选择订单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (this.dgvSalerOrderList.CurrentRow.Cells["order_id"].Value != null) { sOrderID = this.dgvSalerOrderList.CurrentRow.Cells["order_id"].Value.ToString(); } //JudgeCropDataList(sOrderID, sOrgID); //判断是否有未匹配的数据 //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24 //如果为1就是进销存对接接口 string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if (IfHasNotMapData(sOrderID, sOrgID) && !clientPlat.Equals("1")) { MessageBox.Show("存在未匹配数据,导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { //DataTable mapdt = ProxyFactory.ErpSendRemote.GetOrderExpData(orderid); DataTable mapdt = GpoSendBLL.GetInstance().GetOrderExpData(sOrderID, base.CurrentUserOrgId, clientPlat); DataTable dt = new DataTable(); //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-29 if ("1".Equals(clientPlat)) { if (mapdt == null || mapdt.Rows.Count == 0) { return; } dt = mapdt.DefaultView.ToTable().Copy(); if (dt.Rows.Count == 0) { MessageBox.Show("导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } else { if (mapdt == null || mapdt.Rows.Count == 0) { return; } mapdt.DefaultView.RowFilter = " productid is not null"; dt = mapdt.DefaultView.ToTable().Copy(); mapdt.DefaultView.RowFilter = " productid is null"; } iCount = mapdt.DefaultView.Count; IList result = new ArrayList(); foreach (DataColumn dc in dt.Columns) { string newColName = getMapColName(dc.ColumnName.ToUpper()); if (!string.IsNullOrEmpty(newColName)) { dc.ColumnName = newColName; } else { result.Add(dc.ColumnName); } } for (int i = 0; i < result.Count; i++) { dt.Columns.Remove(result[i].ToString()); } string str = ""; /****************************************************************** * * 修改时间:2007-3-21 * 修改人:ningbo * 修改原因: * 新增代码:EmedFunc.GetLocalPersonCfgPath()+"GpoOrderExport.xml" * ******************************************************************/ string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "DBType"); this.saveFileDialog1.FilterIndex = 1; saveFileDialog1.Title = "保存文件为"; saveFileDialog1.InitialDirectory = Application.StartupPath; saveFileDialog1.RestoreDirectory = true; saveFileDialog1.FileName = "ORD" + dgvSalerOrderList.CurrentRow.Cells["ORDER_CODE"].Value.ToString(); if (strCurrentDB.Equals("EXCEL")) { this.saveFileDialog1.Filter = "Excel文档(*.xls)|*.xls"; if (saveFileDialog1.ShowDialog() != DialogResult.Cancel) { str = saveFileDialog1.FileName; bool flg = FileOperation.ExportExcelFile(dt, str); if (flg) { string mess = ""; if (iCount > 0) { mess = "有" + iCount.ToString() + "条数据未被导出"; } MessageBox.Show("导出完毕!" + mess, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } } //导出订单到SQLServer else if (strCurrentDB.Equals("SQLSERVER")) { bool flag = false; try { //获得SQLServer服务数据 string server = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "ServerName"); string database = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "DataBase"); string user = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "User"); string password = SecretUtil.DeSecret(FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB"), "Password")); //获得表明 string tableName = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"/GpoOrderExport.xml", "Config/DestDB/DestTable"), "TableName"); //导出操作 flag = GpoSendDao.ExportErpToMSS(tableName, GetConString(server, database, user, password), dt); } catch { flag = false; } if (flag) { string mess = ""; if (iCount > 0) { mess = "有" + iCount.ToString() + "条数据未被导出"; } MessageBox.Show("导出完毕!" + mess, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { MessageBox.Show("导出失败!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/// <summary> /// 浏览按钮的操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBrowse_Click(object sender, EventArgs e) { /****************************************************************** * * 修改时间:2007-3-21 * 修改人:ningbo * 修改原因: * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml" * ******************************************************************/ string strCurrentDB = FileOperation.GetNodeValue(FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/SourceDB"), "DBType"); if (string.IsNullOrEmpty(strCurrentDB)) { MessageBox.Show("没有进行字段匹配,无法导入!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //选择待导入的文件 string str = ""; if (strCurrentDB.CompareTo("EXCEL") == 0) { openFileDialog1.Filter = "Excel文档(*.xls)|*.xls"; } //openFileDialog1.Filter = "DBF文档(*.dbf)|*.dbf|Excel文档(*.xls)|*.xls"; openFileDialog1.FilterIndex = 1; openFileDialog1.Title = "打开文件"; openFileDialog1.InitialDirectory = Application.StartupPath; openFileDialog1.RestoreDirectory = true; openFileDialog1.FileName = ""; openFileDialog1.ShowDialog(); try { str = openFileDialog1.FileName; if (!string.IsNullOrEmpty(str)) { this.txtImportFilePath.Text = str; ClientConfiguration.HisPath = str; if (strCurrentDB.CompareTo("EXCEL") == 0) { ClientConfiguration.ConnectionString = " Provider = Microsoft.Jet.OLEDB.4.0 ; Data Source = " + str + ";Extended Properties=Excel 8.0"; } //ClientConfiguration.ConnectionString = ClientConfiguration.ConnectionString.Replace(ClientConfiguration.HisPath, str); ClientConfiguration.Save(); //ClientConfiguration.Reload(); /****************************************************************** * * 修改时间:2007-3-21 * 修改人:ningbo * 修改原因: * 新增代码:EmedFunc.GetLocalPersonCfgPath() + "GpoOrderSend.xml" * ******************************************************************/ //string sql = FileOperation.GetNodeObject(EmedFunc.GetLocalPersonCfgPath() + @"\GpoOrderSend.xml", "Config/Sqls/Sql").InnerText; //DataTable dt = GpoSendDao.GetInstance().GetErpSend(sql); DataTable dt = GetImportTable(); this.bindingSource1.DataSource = null; this.bindingSource1.DataSource = dt; //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24 //如果为1就是进销存对接接口 string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if (clientPlat.Equals("1")) { //dtImp = dt.Clone(); RetOrderItem(out count); } else { setErpSendMapData(out count); } int matchRowsCount = 0; foreach (DataGridViewRow dgvr in dgvErpSend.Rows) { if (dgvr.Cells["type"].Value == "0") { matchRowsCount++; } } if (matchRowsCount > 0) { btnImport.Enabled = true; } else { //btnImport.Enabled = false; } if (count > 0) { lbmess.Text = "有" + count.ToString() + "个产品编码(显示为红色)对应多条数据,请选择一条!"; if (dgvErpSend.RowCount > 0) { lbmess.Visible = true; } else { lbmess.Visible = false; } } } } catch (Exception) { this.bindingSource1.DataSource = null; MessageBox.Show("不是有效的数据文件!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 导入按钮的操作 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnImport_Click(object sender, EventArgs e) { if (this.bindingSource1.DataSource == null) { return; } //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-24 //如果为1就是进销存对接接口 int iCount = 0; string clientPlat = UserConfigXml.GetConfigInfo("ClientPlat", "type"); if (clientPlat.Equals("1")) { RetOrderItem(out iCount); } else { DataTable dtNotMapProd = GetImportTable(); DataTable dtNotMapEnterprise = new DataTable(); dtNotMapEnterprise = GpoSendBLL.GetInstance().GetNotMapData(ref dtNotMapProd, base.CurrentUserOrgId); if (dtNotMapProd.Rows.Count > 0) { DataColumn dc = new DataColumn("IsMap"); dc.DataType = System.Type.GetType("System.String"); dc.DefaultValue = "未匹配"; dtNotMapProd.Columns.Add(dc); ProductMapAuto productmapauto = new ProductMapAuto(dtNotMapProd); productmapauto.ShowDialog(); } if (dtNotMapEnterprise.Rows.Count > 0) { DataColumn dc = new DataColumn("IsMap"); dc.DataType = System.Type.GetType("System.String"); dc.DefaultValue = "未匹配"; dtNotMapEnterprise.Columns.Add(dc); EnterpriseMapAuto enterprisemapauto = new EnterpriseMapAuto(dtNotMapEnterprise); enterprisemapauto.ShowDialog(); } setErpSendMapData(out iCount); } IList result = new ArrayList(); foreach (DataGridViewRow dgvr in dgvErpSend.Rows) { //"导出采购订单"判断业务流程("进销存"企业对接功能),shangfu 2007-8-28 //如果为1就是进销存对接接口 if (clientPlat.Equals("1")) { if (dgvr.Cells["ordItemId"].Value == null || dgvr.Cells["ordItemId"].Value.ToString() == "") { continue; } } else { if (dgvr.Cells["PRODUCT_CODE"].Value == null || dgvr.Cells["PRODUCT_CODE"].Value.ToString() == "") { continue; } } if ("0".Equals(dgvr.Cells["type"].Value.ToString())) { setOrderItem(dgvr, result); } } SalerOrderItemList frm = new SalerOrderItemList(OrderId, Flag, result); frm.ShowDialog(); this.Close(); }