| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902 |
- /*******************************************************************************
- * Copyright(c) 2015 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_3601.cs
- * 2.功能描述:首件登记
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 秦祺 2024/9/11 1.00 新建
- *******************************************************************************/
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using System;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Windows.Forms;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- public partial class F_PM_3601 : DKDockPanelBase
- {
- #region 成员变量
- // 窗体的单例模式
- private static F_PM_3601 _instance;
- private int _registerID = 0;
- #endregion
- #region 构造函数
- public F_PM_3601()
- {
- InitializeComponent();
- // 窗体显示的Title
- this.Text = "首件登记";
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- this.gbxCondition.Text = Constant.LABEL_QUERY_CONDITIONS;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PM_3601 Instance
- {
- get
- {
- if (_instance == null || _instance.IsDisposed)
- {
- _instance = new F_PM_3601();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件处理
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_3601_Load(object sender, EventArgs e)
- {
- try
- {
- //时间控件
- this.dtpCreatetimebegin.Value = DateTime.Now.Date;
- this.dtpCreatetimeend.Value = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
- //不自动添加列
- dgvRegister.AutoGenerateColumns = false;
- dgvBarcode.AutoGenerateColumns = false;
- dgvRegisterDetail.AutoGenerateColumns = false;
- #region 车间
- DataTable dtWorkShop = new DataTable();
- dtWorkShop.Columns.Add("WorkShopID");
- dtWorkShop.Columns.Add("WorkShopNames");
- DataRow drWorkShop = dtWorkShop.NewRow();
- drWorkShop["WorkShopID"] = DBNull.Value;
- drWorkShop["WorkShopNames"] = Constant.CBO_SELECT_EMPTY_NAME;
- dtWorkShop.Rows.Add(drWorkShop);
- drWorkShop = dtWorkShop.NewRow();
- drWorkShop["WorkShopID"] = 1;
- drWorkShop["WorkShopNames"] = "1";
- dtWorkShop.Rows.Add(drWorkShop);
- drWorkShop = dtWorkShop.NewRow();
- drWorkShop["WorkShopID"] = 2;
- drWorkShop["WorkShopNames"] = "2";
- dtWorkShop.Rows.Add(drWorkShop);
- drWorkShop = dtWorkShop.NewRow();
- drWorkShop["WorkShopID"] = 3;
- drWorkShop["WorkShopNames"] = "3";
- dtWorkShop.Rows.Add(drWorkShop);
- cmbWORKSHOP.DisplayMember = "WorkShopID";
- cmbWORKSHOP.ValueMember = "WorkShopNames";
- cmbWORKSHOP.DataSource = dtWorkShop;
- #endregion
- #region 状态
- DataTable dtStatus = new DataTable();
- dtStatus.Columns.Add("Status");
- dtStatus.Columns.Add("StatusName");
- DataRow drStatus = dtStatus.NewRow();
- drStatus["Status"] = DBNull.Value;
- drStatus["StatusName"] = Constant.CBO_SELECT_EMPTY_NAME;
- dtStatus.Rows.Add(drStatus);
- drStatus = dtStatus.NewRow();
- drStatus["Status"] = 0;
- drStatus["StatusName"] = "未登记";
- dtStatus.Rows.Add(drStatus);
- drStatus = dtStatus.NewRow();
- drStatus["Status"] = 1;
- drStatus["StatusName"] = "检测中";
- dtStatus.Rows.Add(drStatus);
- drStatus = dtStatus.NewRow();
- drStatus["Status"] = 2;
- drStatus["StatusName"] = "待研发部检验";
- dtStatus.Rows.Add(drStatus);
- drStatus = dtStatus.NewRow();
- drStatus["Status"] = 3;
- drStatus["StatusName"] = "待签名";
- dtStatus.Rows.Add(drStatus);
- drStatus = dtStatus.NewRow();
- drStatus["Status"] = 4;
- drStatus["StatusName"] = "已完结";
- dtStatus.Rows.Add(drStatus);
- cmbStuts.DisplayMember = "StatusName";
- cmbStuts.ValueMember = "Status";
- cmbStuts.DataSource = dtStatus;
- #endregion
-
- #region 首件检验产品类型
- // 获取产品类型
- ServiceResultEntity sreType = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC025");
- }
- );
- if (sreType.Data == null)
- {
- return;
- }
- if (sreType.Data != null && sreType.Data.Tables[0].Rows.Count > 0)
- {
- // 设置空选项
- DataRow dataRow = sreType.Data.Tables[0].NewRow();
- dataRow["DictionaryID"] = DBNull.Value;
- dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
- dataRow["DisplayNo"] = 0;
- sreType.Data.Tables[0].Rows.InsertAt(dataRow, 0);
- this.cmbFIRGOODSTYPE.DisplayMember = "DictionaryValue";
- this.cmbFIRGOODSTYPE.ValueMember = "DictionaryID";
- this.cmbFIRGOODSTYPE.DataSource = sreType.Data.Tables[0];
- }
- #endregion
- #region 首件检验检验依据
- // 获取检验依据
- ServiceResultEntity sreType1 = DoAsync<ServiceResultEntity>(() =>
- {
- return ReportModuleProxy.Service.GetRptDictionaryData(0, "TPC026");
- }
- );
- if (sreType1.Data == null)
- {
- return;
- }
- if (sreType1.Data != null && sreType1.Data.Tables[0].Rows.Count > 0)
- {
- // 设置空选项
- DataRow dataRow = sreType1.Data.Tables[0].NewRow();
- dataRow["DictionaryID"] = DBNull.Value;
- dataRow["DictionaryValue"] = Constant.CBO_SELECT_EMPTY_NAME;
- dataRow["DisplayNo"] = 0;
- sreType1.Data.Tables[0].Rows.InsertAt(dataRow, 0);
- this.cmbFIRBASIS.DisplayMember = "DictionaryValue";
- this.cmbFIRBASIS.ValueMember = "DictionaryID";
- this.cmbFIRBASIS.DataSource = sreType1.Data.Tables[0];
- }
- #endregion
- }
- 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_PM_3601_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <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 btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- #region 总单
- this.btnSearch.Focus();
- //数据清空
- this.dgvRegister.DataSource = null;
- this.dgvRegisterDetail.DataSource = null;
- this.dgvBarcode.DataSource = null;
- _registerID = 0;
- //图片清空
- this.pictureBox1.Image = Properties.Resources.bg;
- this.pictureBox2.Image = Properties.Resources.bg;
- this.pictureBox3.Image = Properties.Resources.bg;
- this.pictureBox4.Image = Properties.Resources.bg;
- this.pictureBox5.Image = Properties.Resources.bg;
- this.pictureBox6.Image = Properties.Resources.bg;
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3601";
- cre.Name = "GetRegisterData";
- cre.Properties["REGISTERNO"] = this.txtRegisterNo.Text;
- if (string.IsNullOrWhiteSpace(this.cmbWORKSHOP.Text))
- {
- cre.Properties["WORKSHOP"] = "";
- }
- else
- {
- cre.Properties["WORKSHOP"] = Convert.ToInt32(this.cmbWORKSHOP.SelectedValue);
- }
- if (string.IsNullOrWhiteSpace(this.cmbFIRGOODSTYPE.Text))
- {
- cre.Properties["FIRGOODSTYPE"] = "";
- }
- else
- {
- cre.Properties["FIRGOODSTYPE"] = Convert.ToInt32(this.cmbFIRGOODSTYPE.SelectedValue);
- }
- if (string.IsNullOrWhiteSpace(this.cmbFIRBASIS.Text))
- {
- cre.Properties["FIRBASIS"] = "";
- }
- else
- {
- cre.Properties["FIRBASIS"] = Convert.ToInt32(this.cmbFIRBASIS.SelectedValue);
- }
- if (string.IsNullOrWhiteSpace(this.cmbStuts.Text))
- {
- cre.Properties["STATUS"] = "";
- }
- else
- {
- cre.Properties["STATUS"] = Convert.ToInt32(this.cmbStuts.SelectedValue);
- }
- cre.Properties["GOODSCODE"] = this.txtGoodsCode.Text;
- cre.Properties["CREATETIMEBEGIN"] = this.dtpCreatetimebegin.Value;
- cre.Properties["CREATETIMEEND"] = this.dtpCreatetimeend.Value;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
-
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
- {
-
- dgvRegister.DataSource = sre.Data.Tables[0];
- this.dgvRegister.Rows[0].Selected = true;
- }
- else
- {
- // 提示未查找到数据
- MessageBox.Show(Messages.MSG_CMN_I002, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- DataTable dt = new DataTable();
- DataTable dtd = new DataTable();
- if (dgvRegister.DataSource != null)
- {
- dt = ((DataTable)dgvRegister.DataSource).Clone();
- }
- dgvRegister.DataSource = dt;
- if (dgvRegisterDetail.DataSource != null)
- {
- dtd = ((DataTable)dgvRegisterDetail.DataSource).Clone();
- }
- dgvRegisterDetail.DataSource = dtd;
- //图片清空
- this.pictureBox1.Image = Properties.Resources.bg;
- this.pictureBox2.Image = Properties.Resources.bg;
- this.pictureBox3.Image = Properties.Resources.bg;
- this.pictureBox4.Image = Properties.Resources.bg;
- this.pictureBox5.Image = Properties.Resources.bg;
- this.pictureBox6.Image = Properties.Resources.bg;
- return;
- }
- }
- #endregion
- #region 明细
- //dgvRegister_SelectionChanged(null, null);
- #endregion
- }
- 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 dgvRegister_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvRegister.CurrentRow != null)
- {
- int registerID = Convert.ToInt32(this.dgvRegister.CurrentRow.Cells["REGISTERID"].Value.ToString());
-
- if (_registerID != registerID)
- {
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3601";
- cre.Name = "GetRegisterDetail";
- cre.Properties["REGISTERID"] = registerID;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
- {
- dgvBarcode.DataSource = sre.Data.Tables[0];
- this.dgvBarcode.Rows[0].Selected = true;
- }
- else
- {
- //清空
- if (dgvBarcode.DataSource != null)
- {
- dgvBarcode.DataSource = ((DataTable)dgvBarcode.DataSource).Clone();
- }
- else
- {
- dgvBarcode.DataSource = null;
- }
- }
- if (sre.Data.Tables.Count > 1 && sre.Data.Tables[1] != null && sre.Data.Tables[1].Rows.Count > 0)
- {
- DataTable imageTable = sre.Data.Tables[1];
- //加载品管签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["PGSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataPG = (byte[])(imageTable.Rows[0]["PGSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream = new MemoryStream(binaryDataPG))
- {
- if (pictureBox1.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox1.Image = Image.FromStream(stream);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("品管签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox1.Image = Properties.Resources.bg;
- }
- //加载成检签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["CJSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataCJ = (byte[])(imageTable.Rows[0]["CJSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream1 = new MemoryStream(binaryDataCJ))
- {
- if (pictureBox2.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox2.Image = Image.FromStream(stream1);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("成检签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox2.Image = Properties.Resources.bg;
- }
- //加载生控签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["SKSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataSK = (byte[])(imageTable.Rows[0]["SKSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream2 = new MemoryStream(binaryDataSK))
- {
- if (pictureBox3.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox3.Image = Image.FromStream(stream2);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("生控签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox3.Image = Properties.Resources.bg;
- }
- //加载研发签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["YFSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataYF = (byte[])(imageTable.Rows[0]["YFSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream1 = new MemoryStream(binaryDataYF))
- {
- if (pictureBox4.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox4.Image = Image.FromStream(stream1);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("研发签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox4.Image = Properties.Resources.bg;
- }
- //加载工艺签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["GYSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataGY = (byte[])(imageTable.Rows[0]["GYSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream1 = new MemoryStream(binaryDataGY))
- {
- if (pictureBox5.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox5.Image = Image.FromStream(stream1);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("工艺签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox5.Image = Properties.Resources.bg;
- }
- //加载项目组签名
- if (!string.IsNullOrEmpty(imageTable.Rows[0]["XMZSIGNATURE"].ToString()))
- {
- // 读取二进制数据
- byte[] binaryDataXMZ = (byte[])(imageTable.Rows[0]["XMZSIGNATURE"]);
- // 解码为图像对象
- try
- {
- using (MemoryStream stream1 = new MemoryStream(binaryDataXMZ))
- {
- if (pictureBox6.Image != null)
- {
- // 其他操作
- // 显示图像在PictureBox中
- pictureBox6.Image = Image.FromStream(stream1);
- }
- }
- }
- catch (ArgumentException ex)
- {
- // 处理异常,例如记录日志或显示用户友好的错误消息
- MessageBox.Show("项目组签名加载失败: " + ex.Message);
- }
- }
- else
- {
- //图片清空
- this.pictureBox6.Image = Properties.Resources.bg;
- }
- }
- }
- }
- _registerID = registerID;
-
- }
- }
- 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)
- {
- try
- {
- this.txtGoodsCode.Text = "";
- this.txtRegisterNo.Text = "";
- this.cmbFIRBASIS.SelectedIndex = Constant.INT_IS_ZERO;
- this.cmbFIRGOODSTYPE.SelectedIndex = Constant.INT_IS_ZERO;
- this.cmbWORKSHOP.SelectedIndex = Constant.INT_IS_ZERO;
- }
- 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 tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- try
- {
- this.dgvRegister.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvBarcode.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- this.dgvRegisterDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- 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 btnFirAdd_Click(object sender, EventArgs e)
- {
- try
- {
- F_PM_3602 firEdit = new F_PM_3602(Constant.FormMode.Add, 0);
- firEdit.ShowDialog();
- }
- 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 btnFirEdit_Click(object sender, EventArgs e)
- {
- try
- {
- DataGridViewRow currentRow = this.dgvRegister.CurrentRow;
- if (currentRow != null)
- // 获取相应节点数据
- {
- int status = Convert.ToInt32(currentRow.Cells["STATUSID"].Value);
- //判断状态(0:未登记(可编辑总单,没有明细)
- //1:部分检测中(不可编辑总单,点击条码)
- //2:待研发部检验(不可编辑总单,点击条码)
- //3:待签名(不可编辑)
- //4:已完结(不可编辑))
- if (status == 0)
- {
- F_PM_3602 frmPM3602 = new F_PM_3602(Constant.FormMode.Edit, Convert.ToInt32(currentRow.Cells["REGISTERID"].Value));
- DialogResult dialogresult = frmPM3602.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- // 刷新窗口数据
- btnSearch_Click(sender, e);
- }
- }
- else if(status == 1 || status == 2)
- {
- if (this.dgvBarcode.CurrentRow == null)
- {
- MessageBox.Show("当前登记单状态不允许编辑总单,选择条码后可编辑检验结果!",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- DataGridViewRow barRow = this.dgvBarcode.CurrentRow;
- int registerid = Convert.ToInt32(currentRow.Cells["REGISTERID"].Value);
- int barid = Convert.ToInt32(barRow.Cells["BARID"].Value);
- F_PM_3602 frmPM3602 = new F_PM_3602(Constant.FormMode.Edit, registerid, barid);
- DialogResult dialogresult = frmPM3602.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- // 刷新窗口数据
- btnSearch_Click(sender, e);
- }
- }
- else if(status == 3 || status == 4)
- {
- MessageBox.Show("当前登记单状态不允许编辑",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
-
- }
- }
- 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 dgvBarcode_SelectionChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvRegister.CurrentRow != null && this.dgvBarcode.CurrentRow != null)
- {
- int registerID = Convert.ToInt32(this.dgvRegister.CurrentRow.Cells["REGISTERID"].Value.ToString());
- int barID = Convert.ToInt32(this.dgvBarcode.CurrentRow.Cells["BARID"].Value.ToString());
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3601";
- cre.Name = "GetItemDetail";
- cre.Properties["REGISTERID"] = registerID;
- cre.Properties["BARID"] = barID;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- if (sre.Data.Tables[0] != null && sre.Data.Tables[0].Rows.Count > 0)
- {
- dgvRegisterDetail.DataSource = sre.Data.Tables[0];
- this.dgvRegisterDetail.Rows[0].Selected = true;
- this.dgvRegisterDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- else
- {
- if (dgvRegisterDetail.DataSource != null )
- {
- dgvRegisterDetail.DataSource = ((DataTable)dgvRegisterDetail.DataSource).Clone();
- }
- else
- {
- dgvRegisterDetail.DataSource = null;
- }
- }
- }
- }
- }
- 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>
- /// <remarks>李士越</remarks>
- private void del_button_Click(object sender, EventArgs e)
- {
- try
- {
- int statusid = Convert.ToInt32(this.dgvRegister.CurrentRow.Cells["STATUSID"].Value.ToString());
- if (statusid != 0)
- {
- MessageBox.Show("当前登记单状态不允许删除",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1);
- return;
- }
- int registerid = Convert.ToInt32(this.dgvRegister.CurrentRow.Cells["REGISTERID"].Value.ToString());
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3601";
- cre.Name = "DelInfo";
- cre.Properties["REGISTERID"] = registerid;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- });
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show("当前登记单状态删除成功",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
- }
- // 刷新窗口数据
- btnSearch_Click(sender, e);
- }
- 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>
- /// <remarks>李士越</remarks>
- private void ShowTest_Click(object sender, EventArgs e)
- {
- try
- {
- //获取选中的BARCODE
- if (this.dgvRegister.CurrentRow != null && this.dgvBarcode.CurrentRow != null)
- {
- string barID = this.dgvBarcode.CurrentRow.Cells["BARCODE"].Value.ToString();
- //查找型式检验数据
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_3601";
- cre.Name = "ShowTest";
- cre.Properties["barCode"] = barID;
- ServiceResultEntity sre = DoAsync<ServiceResultEntity>(() => PMModuleProxyNew.Service.HandleRequest(cre));
- //无数据
- if (sre.Data.Tables[0].Rows.Count == 0)
- {
- // 提示信息
- MessageBox.Show("未查询到数据",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- //构造查看形式检验结果页面
- F_PM_3603 firEdit = new F_PM_3603(Constant.FormMode.Display, sre.Data.Tables[0]);
- firEdit.ShowDialog();
- }
- //没选中 提示选择条码
- else
- {
- MessageBox.Show("请选择条码",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- this.btnSearch.Enabled = true;
- this.btnClearCondition.Enabled = true;
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- #endregion
- #region 私有方法
- #endregion
- }
- }
|