| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_MST_0503.cs
- * 2.功能描述:配置或撤销产品工序配置
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 陈晓野 2017/07/11 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.WinForm.Controls;
- namespace Dongke.IBOSS.PRD.Client.SystemModule
- {
- /// <summary>
- /// 配置或撤销产品工序配置
- /// </summary>
- public partial class F_MST_0503 : FormBase
- {
- #region 成员变量
- // 1:配置到工序;2:从工序撤销
- private int _formStatus;
- #endregion
- #region 构造函数
- /// <summary>
- /// 配置或撤销产品工序配置
- /// </summary>
- /// <param name="formStatus">1:配置到工序;2:从工序撤销</param>
- /// <param name="goods">产品列表</param>
- public F_MST_0503(int formStatus, DataTable goods)
- {
- InitializeComponent();
- this.dgvGoods.AutoGenerateColumns = false;
- if (goods.Columns.Contains("Sel"))
- {
- goods.Columns.Remove("Sel");
- }
- goods.Columns.Add("Sel", typeof(int));
- this.dgvGoods.DataSource = goods;
- this._formStatus = formStatus;
- this.Text = (_formStatus == 1 ? "配置" : "撤销") + "产品工序";
- }
- #endregion
- #region 事件
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, System.EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, System.EventArgs e)
- {
- this.dgvGoods.AutoResizeColumns();
- }
- /// <summary>
- /// 画面加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_MST_0503_Load(object sender, System.EventArgs e)
- {
- try
- {
- foreach (DataGridViewColumn item in this.dgvGoods.Columns)
- {
- if ("Sel" != item.Name)
- {
- item.ReadOnly = true;
- }
- }
- this.dgvGoods.IsSetInputColumnsColor = true;
- }
- 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 tsbtnAllCheck_Click(object sender, System.EventArgs e)
- {
- try
- {
- this.dgvGoods.CommitEdit(DataGridViewDataErrorContexts.Commit);
- foreach (DataGridViewRow item in dgvGoods.Rows)
- {
- DataRowView row = item.DataBoundItem as DataRowView;
- if (row != null)
- {
- row["Sel"] = 1;
- row.EndEdit();
- }
- }
- }
- 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 tsbtnUnCheck_Click(object sender, System.EventArgs e)
- {
- try
- {
- this.dgvGoods.CommitEdit(DataGridViewDataErrorContexts.Commit);
- foreach (DataGridViewRow item in dgvGoods.Rows)
- {
- DataRowView row = item.DataBoundItem as DataRowView;
- if (row != null)
- {
- int c = int.Parse(row["Sel"].ToString());
- row["Sel"] = (c == 1 ? 0 : 1);
- row.EndEdit();
- }
- }
- }
- 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 tsbtnNoCheck_Click(object sender, System.EventArgs e)
- {
- try
- {
- this.dgvGoods.CommitEdit(DataGridViewDataErrorContexts.Commit);
- foreach (DataGridViewRow item in dgvGoods.Rows)
- {
- DataRowView row = item.DataBoundItem as DataRowView;
- if (row != null)
- {
- row["Sel"] = 0;
- row.EndEdit();
- }
- }
- }
- 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 tsbtnSave_Click(object sender, EventArgs e)
- {
- try
- {
- this.dgvGoods.CommitEdit(DataGridViewDataErrorContexts.Commit);
- this.dgvGoods.EndEdit();
- DataTable goods = this.dgvGoods.DataSource as DataTable;
- List<string> goodsIDList = new List<string>();
- foreach (DataRow item in goods.Rows)
- {
- item.EndEdit();
- if ("1" == item["Sel"].ToString())
- {
- goodsIDList.Add(item["GoodsID"].ToString());
- }
- }
- if (goodsIDList.Count == 0)
- {
- MessageBox.Show("没有选择任何产品", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (dkproductionLineSearchBox.ProductionLineID== null ||
- string.IsNullOrWhiteSpace(this.dkProcedureSearchBox.ProcedureIDS))
- {
- DialogResult dr = MessageBox.Show("确定设置全部生产线或工序?", this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
- if (dr != DialogResult.OK)
- {
- return;
- }
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "MST05";
- cre.Name = "SetGoodsToProcedure";
- cre.Properties["Type"] = _formStatus;
- cre.Properties["GoodsIDs"] = string.Join(",", goodsIDList);
- cre.Properties["ProductionLineID"] = this.dkproductionLineSearchBox.ProductionLineID;
- cre.Properties["ProcedureIDs"] = this.dkProcedureSearchBox.ProcedureIDS;
- ServiceResultEntity sre = CommonModuleProxy.Service.DoRequest(cre);
- if (sre.Status == Basics.BaseResources.Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "产品工序", (_formStatus == 1 ? "配置" : "撤销")),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, "产品工序", (_formStatus == 1 ? "配置" : "撤销")),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- #endregion
- }
- }
|