| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PC_0101_1_2.cs
- * 2.功能描述:操作时间及备注录入
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2015/09/25 1.00 新建
- *******************************************************************************/
- using System;
- using System.Windows.Forms;
- using System.Data;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- public partial class F_PC_0101_1_2 : FormBase
- {
- #region 成员变量
- // 实例窗体
- //private F_PC_0101 _fpc0101;
- private DataTable _dtBindSource = null;
- //模具状态
- private int _GMouldStatus = 0;
- #endregion
- #region 构造函数
- //public F_PC_0101_1_2(F_PC_0101 fpc0101, string titleStr)
- //{
- // InitializeComponent();
- // this._titleStr = titleStr;
- // this._fpc0101 = fpc0101;
- // this._fpc0101.SetTimeOrRemarks(null, "");
- // this.Text = _titleStr;
- // this.btnSave.Text = ButtonText.BTN_SAVE;
- //}
- //public F_PC_0101_1_2(DataTable dtBindSource, string titleStr)
- //{
- // InitializeComponent();
- // _dtBindSource = dtBindSource;
- // this.Text = titleStr;
- // this.btnSave.Text = ButtonText.BTN_SAVE;
- // this.btnCancel.Text = ButtonText.BTN_CLOSE;
- // this.txtGroutingLineCode.Text = dtBindSource.Rows[0]["GroutingLineCode"].ToString();
- //}
- public F_PC_0101_1_2(DataTable dtBindSource, string titleStr, int GMouldStatus)
- {
- InitializeComponent();
- _dtBindSource = dtBindSource;
- this.Text = titleStr;
- this._GMouldStatus = GMouldStatus;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- if (GMouldStatus != 6)
- {
- this.txtGroutingLineCode.Text = dtBindSource.Rows[0]["GroutingLineCode"].ToString();
- }
- if (GMouldStatus == 0 || GMouldStatus == 1)
- {
- this.btnDelete.Visible = true;
- this.dgvGroutingLineDetail.AllowUserToDeleteRows = true;
- }
- }
- public int GroutingLineID
- {
- get;
- set;
- }
- public string GroutingLineCode
- {
- get
- {
- return this.txtGroutingLineCode.Text;
- }
- set
- {
- this.txtGroutingLineCode.Text = value;
- }
- }
- public DateTime LineOPTimeStamp
- {
- get;
- set;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- DataTable dtName = this.dgvGroutingLineDetail.DataSource as DataTable;
- dtName.AcceptChanges();
- if (dtName.Rows.Count == 0)
- {
- MessageBox.Show("没有选择任何数据", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- dtName.TableName = "GMouldRecord";
- if (this.pnlMouldStatus.Visible)
- {
- if (!dtName.Columns.Contains("MouldStatus"))
- {
- dtName.Columns.Add("MouldStatus", typeof(int));
- dtName.Columns.Add("ScrapReason", typeof(int));
- dtName.Columns.Add("ScrapResponsibility");
- }
- int ms = (this.rabMouldStatus1.Checked ? 1 : (this.rabMouldStatus3.Checked ? 3 : 4));
- foreach (DataRow item in dtName.Rows)
- {
- // 非条码模具
- if (item["MouldID"] + "" == "")
- {
- continue;
- }
- item["MouldStatus"] = ms;
- if (ms == 4)
- {
- item["ScrapReason"] = this.ftcScrapReason.SelectedValue;
- item["ScrapResponsibility"] = this.txtScrapResponsibility.Text;
- }
- }
- }
- int returnRow = 0;
- if (this._GMouldStatus == 0)
- {
- // 停用
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.StopGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 1)
- {
- // 启用
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.StartGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 2)
- {
- // 维修
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.RepairStartGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 3)
- {
- //维修结束
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.RepairEndGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 4)
- {
- //换模
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.ChangeGMouldStartGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 5)
- {
- //变产
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.UpdateLineStartGroutingLineDetail(dtName);
- }));
- }
- else if (this._GMouldStatus == 6)
- {
- //整线变产
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.UpdateAllLineStartGroutingLineDetail(dtName, this.GroutingLineID, this.LineOPTimeStamp);
- }));
- }
- else if (this._GMouldStatus == 7)
- {
- // 卸模
- returnRow = (int)DoAsync(new BaseAsyncMethod(() =>
- {
- return PCModuleProxy.Service.UnloadGroutingLineDetail(dtName);
- }));
- }
- if (returnRow > 0)
- {
- //成功
- MessageBox.Show(this.Text + "成功", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.DialogResult = DialogResult.OK;
- }
- else if (returnRow == -500)
- {
- MessageBox.Show("数据已经被修改,请重新编辑", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.DialogResult = DialogResult.No;
- }
- else
- {
- //失败
- MessageBox.Show(this.Text + "失败", this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.DialogResult = DialogResult.No;
- }
- }
- 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 F_PC_0101_1_2_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- DateTime accountDate = CommonModuleProxy.Service.GetAccountDate();
- this.txtDateStart.Value = accountDate;
- this.dgvGroutingLineDetail.DataSource = _dtBindSource;
- // 设置可输入单元格的颜色
- this.dgvGroutingLineDetail.IsSetInputColumnsColor = true;
- if (this._GMouldStatus == 4 || this._GMouldStatus == 5 || this._GMouldStatus == 6 || this._GMouldStatus == 7)
- {
- DataRow[] dr = _dtBindSource.Select("MouldID is not null");
- if (dr != null && dr.Length > 0)
- {
- this.pnlMouldStatus.Visible = true;
- ClientRequestEntity creLoad = new ClientRequestEntity();
- creLoad.NameSpace = "FPC1004";
- creLoad.Name = "GetFPC1004LoadData";
- creLoad.Properties["MouldOperationType"] = (int)Constant.MouldOperationType.OnLineToScrap;
- ServiceResultEntity sreLoad = PCModuleProxyNew.Service.HandleRequest(creLoad);
- this.ftcScrapReason.ValueMember = "dictionaryid";
- this.ftcScrapReason.DisplayMember = "dictionaryvalue";
- this.ftcScrapReason.DataSource = sreLoad.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 btnCancel_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自适应
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvGroutingLineDetail.AutoResizeColumns();
- }
- /// <summary>
- /// 条码模具去向(报废)
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void rabMouldStatus4_CheckedChanged(object sender, EventArgs e)
- {
- this.pnlScrap.Visible = this.rabMouldStatus4.Checked;
- }
- #endregion
- private void btnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvGroutingLineDetail.CurrentRow == null)
- {
- return;
- }
- try
- {
- this.dgvGroutingLineDetail.Rows.Remove(this.dgvGroutingLineDetail.CurrentRow);
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|