| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_1301.cs
- * 2.功能描述:员工工位
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 付斌 2020/11/06 1.00 新建
- *******************************************************************************/
- using System;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.SystemModule
- {
- /// <summary>
- /// 员工工位
- /// </summary>
- public partial class F_MST_1301 : DockPanelBase
- {
- #region 成员变量
- private static F_MST_1301 _instance; // 单例模式
- #endregion
- #region 构造函数
- public F_MST_1301()
- {
- InitializeComponent();
- this.Text = FormTitles.F_MST_1301;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_MST_1301 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_MST_1301();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_1301_Load(object sender, EventArgs e)
- {
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- this.dgvWorkStation.AutoGenerateColumns = false;
- this.dgvUser.AutoGenerateColumns = false;
- }
- /// <summary>
- /// 搜索按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- dgvWorkStation.DataSource = null;
- dgvUser.DataSource = null;
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "GetWorkStation";
- cre.Properties["workstationname"] = txtWorkStationName.Text.Trim();
- cre.Properties["remarks"] = txtRemarks.Text.Trim();
- // 异步处理
- this.btnSearch.Enabled = false;
- this.btnClearCondition.Enabled = false;
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(
- () => { return SystemModuleProxy.Service.DoRequest(cre); });
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- if (sre.Data.Tables[0].Rows.Count == 0)
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- dgvWorkStation.DataSource = sre.Data.Tables[0];
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 清空按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.txtWorkStationName.Clear();
- this.txtRemarks.Clear();
- }
- /// <summary>
- /// 工位工号配置按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAddUser_Click(object sender, EventArgs e)
- {
- try
- {
- if (dgvWorkStation.CurrentRow == null || dgvUser.DataSource == null)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W007, "未选择任何工位"),
- Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- F_MST_1302 frm = new F_MST_1302();
- frm.drWorkStation = (this.dgvWorkStation.CurrentRow.DataBoundItem as DataRowView).Row;
- frm.dtWorkStationUser = (dgvUser.DataSource as DataTable).Copy();
- DialogResult drs = frm.ShowDialog();
- if (drs == DialogResult.OK)
- {
- btnSearch_Click(null, null);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 自适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvUser.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 关闭按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 工位行切换事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWorkStation_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (dgvWorkStation.CurrentCell != null)
- {
- int workstationid = Convert.ToInt32(dgvWorkStation.CurrentRow.Cells["WorkStationID"].Value.ToString());
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_MST_1301";
- cre.Name = "GetWorkStationUser";
- cre.Properties["workstationid"] = workstationid;
- // 异步处理
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(
- () => { return SystemModuleProxy.Service.DoRequest(cre); });
- this.dgvUser.DataSource = sre.Data.Tables[0];
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 单元格双击事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void dgvWorkStation_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
- {
- tsbtnAddUser_Click(null, null);
- }
- /// <summary>
- /// 释放窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_1301_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- #endregion
- }
- }
|