| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_0504.cs
- * 2.功能描述:新建装窑车漏扫计件
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * chenxy 2019/12/10 1.00 设计窗体布局
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseControls;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.Library;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls.FormCommon;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 新建装窑车计件
- /// </summary>
- public partial class F_PM_0504 : FormBase
- {
- #region 成员变量
- // 工序ID
- private int _procedureID;
- //窗体名称
- private string _fromTitle;
- // 工序实体类
- ProcedureEntity _procedureDataEntity;
- // 生产数据实体类
- List<ProductionDataEntity> _productionDataEntity = new List<ProductionDataEntity>();
- // 数据源Table
- private DataTable _dataSourceTable = null;
- // 添加行数据源
- private DataTable _collectType = null;
- // 当前操作实体
- ProductionDataEntity _productionEntity = new ProductionDataEntity();
- // 配置文件的全路径
- private string _iniFilePath = LocalPath.RootPath + Constant.INI_FILE_NAME;
- //窑车最大装载数
- private int MaxGoodsNum = 0;
- // 是否有商标
- private int? _isLogo = null;
- // 是否有商标编码
- private string _isLogoCode = "";
- // 是否有商标名称
- private string _isLogoName = "";
- private DataSet _KilntInfo = null;
- #endregion
- #region 构造函数
- /// <summary>
- /// 构造函数
- /// </summary>
- public F_PM_0504()
- {
- InitializeComponent();
- }
- /// <summary>
- /// 构造函数
- /// </summary>
- /// <param name="procedureID">工序编号</param>
- /// <param name="fromTitle">窗体名称</param>
- public F_PM_0504(int procedureID, string fromTitle)
- {
- InitializeComponent();
- this._procedureID = procedureID;
- this._fromTitle = fromTitle;
- this.SetFromTitleInfo();
- }
- #endregion
- #region 属性
- /// <summary>
- /// 绑定GridView数据源
- /// </summary>
- public DataTable DataSourceTable
- {
- set
- {
- _dataSourceTable = value;
- }
- get
- {
- if (_dataSourceTable == null)
- {
- _dataSourceTable = new DataTable("Table1");
- _dataSourceTable.Columns.Add("BarCode");
- _dataSourceTable.Columns.Add("GoodsID");
- _dataSourceTable.Columns.Add("GoodsCode");
- _dataSourceTable.Columns.Add("GoodsName");
- _dataSourceTable.Columns.Add("UserID");
- _dataSourceTable.Columns.Add("UserCode");
- _dataSourceTable.Columns.Add("UserName");
- _dataSourceTable.Columns.Add("KilnID");
- _dataSourceTable.Columns.Add("KilnCode");
- _dataSourceTable.Columns.Add("KilnName");
- _dataSourceTable.Columns.Add("KilnCarID");
- _dataSourceTable.Columns.Add("KilnCarCode");
- _dataSourceTable.Columns.Add("KilnCarName");
- _dataSourceTable.Columns.Add("KilnCarPosition", typeof(decimal));
- _dataSourceTable.Columns.Add("IsSave");//是否保存,为了的在此车上有此产品时显示出来(1不保存,只是查看)
- _dataSourceTable.Columns.Add("Status");//登车状态,只是查看
- _dataSourceTable.Columns.Add("IsPublicBody");
- _dataSourceTable.Columns.Add("MouldCode");
- _dataSourceTable.Columns.Add("GroutingUserCode");
- _dataSourceTable.Columns.Add("GroutingNum");
- _dataSourceTable.Columns.Add("GroutingDate", typeof(DateTime));
- _dataSourceTable.Columns.Add("LogoID");
- _dataSourceTable.Columns.Add("LogoCodeName");
- return _dataSourceTable;
- }
- else
- {
- return _dataSourceTable;
- }
- }
- }
- /// <summary>
- /// 添加行数据源
- /// </summary>
- public DataTable DataSourceCollectTypeTable
- {
- set
- {
- _collectType = value;
- }
- get
- {
- if (_collectType == null)
- {
- _collectType = new DataTable("Table2");
- _collectType.Columns.Add("BarCode");
- _collectType.Columns.Add("GoodsID");
- _collectType.Columns.Add("GoodsCode");
- _collectType.Columns.Add("GoodsName");
- _collectType.Columns.Add("UserID");
- _collectType.Columns.Add("UserCode");
- _collectType.Columns.Add("UserName");
- _collectType.Columns.Add("KilnID");
- _collectType.Columns.Add("KilnCode");
- _collectType.Columns.Add("KilnName");
- _collectType.Columns.Add("KilnCarID");
- _collectType.Columns.Add("KilnCarCode");
- _collectType.Columns.Add("KilnCarName");
- _collectType.Columns.Add("KilnCarPosition", typeof(decimal));
- return _collectType;
- }
- else
- {
- return _collectType;
- }
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_0504_Load(object sender, EventArgs e)
- {
- try
- {
- dtpFiredDate.Value = DateTime.Now.Date;
- //string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
- // Constant.INI_KEY_KILN_CODE, this._iniFilePath);
- string getKiln = Utility.ReadIniFile(Constant.INI_SECTION_SETTINGS,
- Constant.INI_KEY_KILN_CODE, LocalPath.LocalINIFilePath);
- _KilntInfo = SystemModuleProxy.Service.GetAllKilntInfo();
- if (getKiln != string.Empty)
- {
- this.txtKiln.Text = getKiln;
- if (this.txtKiln.Text.Trim() != "")
- {
- //DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return SystemModuleProxy.Service.GetAllKilntInfo();
- //}));
- DataSet dsResultAccount = _KilntInfo;
- if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
- {
- DataView dv = dsResultAccount.Tables[0].DefaultView;
- dv.RowFilter = "ValueFlag=1 and KilnCode='" + this.txtKiln.Text.Trim() + "'";
- DataTable dt = dv.ToTable();
- if (dt.Rows.Count == 0)
- {
- // 提示信息
- //MessageBox.Show("不存在此窑炉编号",
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtKiln.SelectAll();
- this.txtKiln.Focus();
- //return;
- _productionEntity.KilnID = null;
- _productionEntity.KilnCode = null;
- }
- else
- {
- _productionEntity.KilnID = Convert.ToInt32(dt.Rows[0]["KilnID"]);
- _productionEntity.KilnCode = this.txtKiln.Text.Trim();
- }
- }
- }
- this.txtKilnCarCode.Focus();
- }
- else
- {
- this.txtKiln.Focus();
- }
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- DataTable tKilnCarInfo = GetMSTKilnCarPositionInfo();
- this.cmbKilnCarPosition.DataSource = tKilnCarInfo;
- this.cmbKilnCarPosition.DisplayMember = "DictionaryValue";
- this.cmbKilnCarPosition.ValueMember = "DictionaryID";
- this._productionEntity.UserID = Constant.INT_IS_NEGATIE_ONE;
- this._productionEntity.KilnCarID = Constant.INT_IS_NEGATIE_ONE;
- this.dgvProduction.DataSource = DataSourceTable;
- this.KilnCarPosition.DisplayMember = "DictionaryValue";
- this.KilnCarPosition.ValueMember = "DictionaryID";
- this.KilnCarPosition.DataSource = tKilnCarInfo.Copy();
- this.dgvProduction.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.CellSelect;
- // 获取工序明细数据
- //ProcedureEntity procedureDataEntity = (ProcedureEntity)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return PMModuleProxy.Service.GetProcedureDataEntityByID(this._procedureID);
- //}));
- ProcedureEntity procedureDataEntity = PMModuleProxy.Service.GetProcedureDataEntityByID(this._procedureID);
- this._procedureDataEntity = procedureDataEntity;
- // 设置控件禁用或启用
- SetControlEnable();
- //this.txtUserCode.Focus();
- }
- 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 tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 自动适应列宽
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvProduction.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 条形码按键事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (this.txtBarcode.ReadOnly)
- {
- return;
- }
- if (!this.txtFiredBatchNo.ReadOnly)
- {
- e.Handled = true;
- txtBarcode.Clear();
- // 提示信息
- MessageBox.Show("请输入窑车烧成批次号",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtFiredBatchNo.Focus();
- return;
- }
- if ((int)e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE) // 按了回车键
- {
- //if (this.txtUserCode.Text.Trim() == string.Empty)
- //{
- // this.txtUserCode.Focus();
- // this.txtBarcode.Text = string.Empty;
- // return;
- //}
- //if (this.txtKilnCarCode.Text.Trim() == string.Empty)
- //{
- // this.txtKilnCarCode.Focus();
- // this.txtBarcode.Text = string.Empty;
- // return;
- //}
- //if (this.txtBarcode.Text.Trim() == string.Empty)
- //{
- // this.txtBarcode.SelectAll();
- // this.txtBarcode.Focus();
- // return;
- //}
- DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + this.txtBarcode.Text.Trim() + "'");
- if (drRows.Length == Constant.INT_IS_ZERO)
- {
- // 校验条码 获取校验条码信
- DataSet dsCheckBarcode = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.CheckBarcode(this._procedureID, this.txtBarcode.Text.Trim());
- }));
- if (dsCheckBarcode != null && dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows.Count > Constant.INT_IS_ZERO)
- {
- if (dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]
- [Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString() != string.Empty)
- {
- // 表示有错误
- //MessageBox.Show(string.Format(dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]
- // [Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(),
- // this.txtBarcode.Text.Trim(), "产品条码"),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //this.txtBarcode.SelectAll();
- //this.txtBarcode.Focus();
- //return;
- if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()].ToString() == "0")
- {
- // 表示有错误
- MessageBox.Show(string.Format(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString(), this.txtBarcode.Text.Trim(), "产品条码"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- else
- {
- S_CMN_020 frmscmn020 = new S_CMN_020(Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()])
- , dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString());
- frmscmn020.ShowDialog();
- }
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- }
- else
- {
- this.DataSourceTable.AcceptChanges();
- if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
- {
- if (this.MaxGoodsNum > 0 && this.DataSourceTable.Rows.Count >= this.MaxGoodsNum)
- {
- // 提示信息
- MessageBox.Show("超出登车产品最大装载数量" + this.MaxGoodsNum.ToString(),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString() != "")
- {
- this._isLogo = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()]);
- this._isLogoCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoCode.ToString()].ToString();
- this._isLogoName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()].ToString();
- }
- // 生产数据实体
- ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
- procedureDataEntity.Barcode = this.txtBarcode.Text.Trim(); // 产品条码
- procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]
- [Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
- procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]
- [Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
- procedureDataEntity.GoodsName = dsCheckBarcode.Tables[Constant.INT_IS_ZERO].Rows[Constant.INT_IS_ZERO]
- [Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
- procedureDataEntity.UserID = this._productionEntity.UserID;
- procedureDataEntity.UserCode = this._productionEntity.UserCode;
- procedureDataEntity.UserName = this._productionEntity.UserName;
- procedureDataEntity.KilnID = this._productionEntity.KilnID;
- procedureDataEntity.KilnCode = this._productionEntity.KilnCode;
- procedureDataEntity.KilnName = this._productionEntity.KilnName;
- procedureDataEntity.KilnCarID = this._productionEntity.KilnCarID;
- procedureDataEntity.KilnCarCode = this._productionEntity.KilnCarCode;
- procedureDataEntity.KilnCarName = this._productionEntity.KilnCarName;
- procedureDataEntity.KilnCarPosition = Convert.ToInt32(this.cmbKilnCarPosition.SelectedValue);
- procedureDataEntity.ValueFlag = Constant.ValueFlag.Effective.GetHashCode();
- procedureDataEntity.LogoID = this._isLogo;
- //if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Point) // 单点采集 直接保存
- //{
- // this.CollectTypeTwo(procedureDataEntity);
- //}
- //else
- //{
- this.CollectTypeOne(procedureDataEntity, dsCheckBarcode); // 集中采集
- //}
- this.txtBarcode.Text = string.Empty;
- this.txtBarcode.Focus();
- }
- }
- }
- else
- {
- this.txtBarcode.Text = "";
- }
- }
- }
- 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 txtUserCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- try
- {
- if (txtUserCode.Text.Trim() == string.Empty) // 如果未添加数据,则此项获取焦点
- {
- this.txtUserCode.IsMustInput = true;
- this.txtUserCode.SelectAll();
- e.Cancel = true;
- return;
- }
- else if (!this.txtUserCode.ReadOnly)
- {
- SUserEntity userEntity = new SUserEntity();
- userEntity.UserCode = this.txtUserCode.Text.Trim();
- // 是否存在此用户编码的生产工号
- CheckProcedureUserResult MsgCheckProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.CheckProcedureUser(this._procedureID, this.txtUserCode.Text.Trim());
- }));
- if (MsgCheckProcedureUser != null)
- {
- if (!string.IsNullOrEmpty(MsgCheckProcedureUser.ErrMsg))
- {
- MessageBox.Show(MsgCheckProcedureUser.ErrMsg,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtUserCode.SelectAll();
- e.Cancel = true;
- return;
- }
- // 有此生产工号
- if (this._productionEntity.UserID != -Constant.INT_IS_ONE)
- {
- if (MsgCheckProcedureUser.UserID != this._productionEntity.UserID)
- {
- this.SaveDataInfo();
- }
- }
- this._productionEntity.UserID = MsgCheckProcedureUser.UserID;
- this._productionEntity.UserCode = MsgCheckProcedureUser.UserCode;
- this._productionEntity.UserName = MsgCheckProcedureUser.UserName;
- this.txtUserCode.ReadOnly = true;
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void txtKiln_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- try
- {
- if (string.IsNullOrWhiteSpace(this.txtKiln.Text) ||
- this.txtKiln.ReadOnly)
- {
- return;
- }
- //DataSet dsResultAccount = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return SystemModuleProxy.Service.GetAllKilntInfo();
- //}));
- //DataSet dsResultAccount = SystemModuleProxy.Service.GetAllKilntInfo();
- DataSet dsResultAccount = _KilntInfo;
- if (dsResultAccount != null && dsResultAccount.Tables[0].Rows.Count > 0)
- {
- DataView dv = dsResultAccount.Tables[0].DefaultView;
- dv.RowFilter = "ValueFlag=1 and KilnCode='" + this.txtKiln.Text.Trim() + "'";
- DataTable dt = dv.ToTable();
- if (dt.Rows.Count == 0)
- {
- _productionEntity.KilnID = null;
- _productionEntity.KilnCode = null;
- e.Cancel = true;
- this.txtKiln.SelectAll();
- // 提示信息
- MessageBox.Show("不存在此窑炉编号",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- else
- {
- _productionEntity.KilnID = Convert.ToInt32(dt.Rows[0]["KilnID"]);
- _productionEntity.KilnCode = this.txtKiln.Text.Trim();
- }
- // 保存业务系统配置
- Utility.WriteIniFile(Constant.INI_SECTION_SETTINGS, Constant.INI_KEY_KILN_CODE,
- this.txtKiln.Text.Trim(), this._iniFilePath);
- // 验证烧成批次
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCode) ||
- this._productionEntity.KilnID == null ||
- this._productionEntity.KilnID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCarCode) ||
- this._productionEntity.KilnCarID == null ||
- this._productionEntity.KilnCarID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- return;
- }
- this.CheckFiredBatchNo();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void txtKiln_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if ((int)e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE) // 按了回车键
- {
- this.txtKilnCarCode.Focus();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void txtKilnCarCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if ((int)e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE) // 按了回车键
- {
- this.dtpFiredDate.Focus();
- }
- }
- 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 txtKilnCarCode_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- try
- {
- if (string.IsNullOrWhiteSpace(this.txtKilnCarCode.Text) ||
- this.txtKilnCarCode.ReadOnly)
- {
- return;
- }
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_0504";
- cre.Name = "CheckKilnCar";
- cre.Properties["kilncarcode"] = this.txtKiln.Text.Trim() + this.txtKilnCarCode.Text.Trim();
- cre.Properties["procedureID"] = this._procedureID;
- ServiceResultEntity sre = PMModuleProxyNew.Service.HandleRequest(cre);
- this._productionEntity.KilnCarID = null;
- this._productionEntity.KilnCarCode = null;
- if (sre == null)
- {
- this.txtKilnCarCode.SelectAll();
- e.Cancel = true;
- MessageBox.Show("此窑车不存在",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- this.txtKilnCarCode.SelectAll();
- e.Cancel = true;
- MessageBox.Show(sre.Message,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- this._productionEntity.KilnCarID = Convert.ToInt32(sre.Result);
- this._productionEntity.KilnCarCode = this.txtKiln.Text.Trim() + this.txtKilnCarCode.Text.Trim();
- //this.txtKilnCarCode.ReadOnly = true;
- //this.txtKiln.ReadOnly = true;
- // 验证烧成批次
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCode) ||
- this._productionEntity.KilnID == null ||
- this._productionEntity.KilnID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCarCode) ||
- this._productionEntity.KilnCarID == null ||
- this._productionEntity.KilnCarID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- return;
- }
- this.CheckFiredBatchNo();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void dtpFiredDate_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- // 验证烧成批次
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCode) ||
- this._productionEntity.KilnID == null ||
- this._productionEntity.KilnID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCarCode) ||
- this._productionEntity.KilnCarID == null ||
- this._productionEntity.KilnCarID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- return;
- }
- this.CheckFiredBatchNo();
- }
- /// <summary>
- /// 删除按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvProduction.CurrentCell != null)
- {
- if (this.dgvProduction.Rows[this.dgvProduction.CurrentCell.RowIndex].Cells["Status"].Value.ToString() != "己登车")
- {
- this.DataSourceTable.Rows[this.dgvProduction.CurrentCell.RowIndex].Delete();
- }
- }
- }
- /// <summary>
- /// 保存按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnSave_Click(object sender, EventArgs e)
- {
- try
- {
- this.SaveDataInfo();
- }
- 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_0504_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (this.btnSave.Visible)
- {
- try
- {
- this.DataSourceTable.AcceptChanges();
- this.DataSourceCollectTypeTable.Clear();
- if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
- {
- if (DataSourceTable.Select("IsSave<>1").Length > 0)
- {
- DialogResult result = MessageBox.Show(Messages.MSG_CMN_Q001, this.Text,
- MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- // 保存数据
- btnSave_Click(sender, e);
- }
- else if (result == DialogResult.Cancel)
- {
- e.Cancel = 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 txtUserCode_MouseClick(object sender, MouseEventArgs e)
- {
- if (this.txtUserCode.Text.Trim() != string.Empty)
- {
- this.txtUserCode.SelectAll();
- }
- }
- /// <summary>
- /// 生产工号回车事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void txtUserCode_KeyPress(object sender, KeyPressEventArgs e)
- {
- //if ((int)e.KeyChar == 13) // 按了回车键
- //{
- // this.txtKilnCarCode.Focus();
- //}
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 设置窗体按钮的文本信息
- /// </summary>
- private void SetFromTitleInfo()
- {
- this.Text = "漏扫补件【" + this._fromTitle + "】";
- this.tsbtnDelete.Text = ButtonText.TSBTN_DELETE;
- //自动适应列宽
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- //关闭
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSave.Text = ButtonText.BTN_SAVE;
- this.btnCancel.Text = ButtonText.BTN_CLOSE;
- }
- /// <summary>
- /// 设置控件禁用或启用
- /// </summary>
- private void SetControlEnable()
- {
- if (this._procedureDataEntity != null)
- {
- //if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
- //{
- // this.txtUserCode.Enabled = true;
- // this.tsbtnDelete.Visible = true;
- // this.tsbtnDelete.Enabled = true;
- // this.btnSave.Visible = true;
- //}
- //else
- {
- this.tsbtnDelete.Visible = true;
- this.tsbtnDelete.Enabled = true;
- this.txtUserCode.Enabled = true;
- this.txtUserCode.ReadOnly = true;
- this._productionEntity.UserID = Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserID;
- this._productionEntity.UserCode = Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
- this._productionEntity.UserName = Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserName;
- this.txtUserCode.Text = this._productionEntity.UserCode;
- this.btnSave.Visible = true;
- // 此工号是否能生产工序
- CheckProcedureUserResult checkProcedureUser = (CheckProcedureUserResult)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.CheckProcedureUser(this._procedureID,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode);
- }));
- if (checkProcedureUser != null)
- {
- if (!string.IsNullOrEmpty(checkProcedureUser.ErrMsg))
- {
- // 此工号不允许生产工序
- MessageBox.Show(checkProcedureUser.ErrMsg,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- return;
- }
- }
- }
- }
- }
- /// <summary>
- /// 获取窑车位置字典表数据
- /// </summary>
- /// <returns></returns>
- public DataTable GetMSTKilnCarPositionInfo()
- {
- DataTable dtDicInfo = (DataTable)DoAsync(new BaseAsyncMethod(() =>
- {
- return CommonModuleProxy.Service.GetDataDictionaryByType(Constant.TPC_TPC003);
- }));
- return dtDicInfo;
- }
- /// <summary>
- /// 单点采集模式
- /// </summary>
- /// <param name="procedureDataEntity"></param>
- private void CollectTypeTwo(ProductionDataEntity procedureDataEntity)
- {
- try
- {
- #region 单点采集
- // 添加行就可以 并保存
- // 保存到数据库
- DataSourceCollectTypeTable.Rows.Clear();
- DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
- drCollectType["BarCode"] = procedureDataEntity.Barcode;
- drCollectType["GoodsID"] = procedureDataEntity.GoodsID;
- drCollectType["GoodsCode"] = procedureDataEntity.GoodsCode;
- drCollectType["GoodsName"] = procedureDataEntity.GoodsName;
- drCollectType["UserID"] = procedureDataEntity.UserID;
- drCollectType["UserCode"] = procedureDataEntity.UserCode;
- drCollectType["UserName"] = procedureDataEntity.UserName;
- drCollectType["KilnID"] = procedureDataEntity.KilnID;
- drCollectType["KilnCode"] = procedureDataEntity.KilnCode;
- drCollectType["KilnName"] = procedureDataEntity.KilnName;
- drCollectType["KilnCarID"] = procedureDataEntity.KilnCarID;
- drCollectType["KilnCarCode"] = procedureDataEntity.KilnCarCode;
- drCollectType["KilnCarName"] = procedureDataEntity.KilnCarName;
- drCollectType["KilnCarPosition"] = procedureDataEntity.KilnCarPosition;
- DataSourceCollectTypeTable.Rows.Add(drCollectType);
- DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
- }
- ));
- DataRow dr = this.DataSourceTable.NewRow();
- dr["BarCode"] = procedureDataEntity.Barcode;
- dr["GoodsID"] = procedureDataEntity.GoodsID;
- dr["GoodsCode"] = procedureDataEntity.GoodsCode;
- dr["GoodsName"] = procedureDataEntity.GoodsName;
- dr["UserID"] = procedureDataEntity.UserID;
- dr["UserCode"] = procedureDataEntity.UserCode;
- dr["UserName"] = procedureDataEntity.UserName;
- dr["KilnID"] = procedureDataEntity.KilnID;
- dr["KilnCode"] = procedureDataEntity.KilnCode;
- dr["KilnName"] = procedureDataEntity.KilnName;
- dr["KilnCarID"] = procedureDataEntity.KilnCarID;
- dr["KilnCarCode"] = procedureDataEntity.KilnCarCode;
- dr["KilnCarName"] = procedureDataEntity.KilnCarName;
- dr["KilnCarPosition"] = procedureDataEntity.KilnCarPosition;
- this.DataSourceTable.Rows.Add(dr);
- this.dgvProduction.CurrentCell = null;
- this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
- this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
- #endregion
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- ///集中采集模式
- /// </summary>
- /// <param name="procedureDataEntity"></param>
- private void CollectTypeOne(ProductionDataEntity procedureDataEntity,DataSet dsGroutingProduct)
- {
- try
- {
- #region 集中采集
- DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + procedureDataEntity.Barcode + "'");
- if (drRows.Length > Constant.INT_IS_ZERO)
- {
- this.txtBarcode.Text = "";
- return;
- }
- // 由产品条码获取注浆信息
- //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
- //}));
- DataRow dr = this.DataSourceTable.NewRow();
- dr["BarCode"] = procedureDataEntity.Barcode;
- dr["GoodsID"] = procedureDataEntity.GoodsID;
- dr["GoodsCode"] = procedureDataEntity.GoodsCode;
- dr["GoodsName"] = procedureDataEntity.GoodsName;
- dr["UserID"] = procedureDataEntity.UserID;
- dr["UserCode"] = procedureDataEntity.UserCode;
- dr["UserName"] = procedureDataEntity.UserName;
- dr["KilnID"] = procedureDataEntity.KilnID;
- dr["KilnCode"] = procedureDataEntity.KilnCode;
- dr["KilnName"] = procedureDataEntity.KilnName;
- dr["KilnCarID"] = procedureDataEntity.KilnCarID;
- dr["KilnCarCode"] = procedureDataEntity.KilnCarCode;
- dr["KilnCarName"] = procedureDataEntity.KilnCarName;
- dr["KilnCarPosition"] = procedureDataEntity.KilnCarPosition;
- dr["MouldCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
- dr["GroutingUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
- dr["GroutingNum"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
- dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
- dr["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- dr["LogoID"] = procedureDataEntity.LogoID;
- dr["LogoCodeName"] = this._isLogoName + "[" + this._isLogoCode + "]";
- this.DataSourceTable.Rows.Add(dr);
- this.dgvProduction.CurrentCell = null;
- this.dgvProduction.Rows[dgvProduction.RowCount - 1].Selected = true;
- this.dgvProduction.CurrentCell = this.dgvProduction.Rows[dgvProduction.RowCount - 1].Cells[0];
- #endregion
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 保存数据到数据库
- /// </summary>
- private void SaveDataInfo()
- {
- this.DataSourceTable.AcceptChanges();
- this.DataSourceCollectTypeTable = null;
- if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
- {
- //if (this.MaxGoodsNum > 0 && this.DataSourceTable.Rows.Count > this.MaxGoodsNum)
- //{
- // // 提示信息
- // MessageBox.Show("超出登车产品最大装载数量" + this.MaxGoodsNum.ToString(),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- // return;
- //}
- foreach (DataRow drproductionData in this.DataSourceTable.Rows)
- {
- if (drproductionData["IsSave"].ToString() != "1")
- {
- DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
- drCollectType["BarCode"] = drproductionData["BarCode"];
- //drCollectType["GoodsID"] = drproductionData["GoodsID"];
- //drCollectType["GoodsCode"] = drproductionData["GoodsCode"];
- //drCollectType["GoodsName"] = drproductionData["GoodsName"];
- //drCollectType["UserID"] = drproductionData["UserID"];
- //drCollectType["UserCode"] = drproductionData["UserCode"];
- //drCollectType["UserName"] = drproductionData["UserName"];
- //drCollectType["KilnID"] = drproductionData["KilnID"];
- //drCollectType["KilnCode"] = drproductionData["KilnCode"];
- //drCollectType["KilnName"] = drproductionData["KilnName"];
- //drCollectType["KilnCarID"] = drproductionData["KilnCarID"];
- //drCollectType["KilnCarCode"] = drproductionData["KilnCarCode"];
- //drCollectType["KilnCarName"] = drproductionData["KilnCarName"];
- drCollectType["KilnCarPosition"] = drproductionData["KilnCarPosition"];
- DataSourceCollectTypeTable.Rows.Add(drCollectType);
- }
- }
- if (DataSourceCollectTypeTable.Rows.Count == 0)
- {
- // 提示信息
- MessageBox.Show("以上产品已经登车",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- string KilnCarBatchNo = string.Format("{0}#{1}#{2}#{3}",
- this._productionEntity.KilnCode,
- this._productionEntity.KilnCarCode,
- this.dtpFiredDate.Value.Value.ToString("yyyyMMdd"),
- this.txtFiredBatchNo.DataValue.Value.ToString("000"));
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_0504";
- cre.Name = "SetKilnCarMissing";
- cre.Properties["KilnID"] = this._productionEntity.KilnID.Value;
- cre.Properties["KilnCarID"] = this._productionEntity.KilnCarID.Value;
- cre.Properties["FiredDate"] = this.dtpFiredDate.Value.Value;
- cre.Properties["KilnCarBatchNo"] = KilnCarBatchNo;
- cre.Properties["ProcedureID"] = this._procedureID;
- cre.Properties["ModelType"] = this._procedureDataEntity.ModelType;
- cre.Data = new DataSet();
- cre.Data.Tables.Add(DataSourceCollectTypeTable);
- ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxyNew.Service.HandleRequest(cre);
- }));
- if (sre == null)
- {
- // 提示信息
- MessageBox.Show("操作失败",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (sre.Status != Constant.ServiceResultStatus.Success)
- {
- MessageBox.Show(sre.Message,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- // 提示信息
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- this.txtBarcode.Clear();
- this._productionDataEntity.Clear();
- this.DataSourceTable.Rows.Clear();
- this.txtKilnCarCode.Clear();
- this.txtFiredBatchNo.Clear();
- this._productionEntity = new ProductionDataEntity();
- this.txtKilnCarCode.ReadOnly = false;
- this.txtKiln.ReadOnly = false;
- this.dtpFiredDate.Enabled = true;
- this.txtFiredBatchNo.ReadOnly = false;
- }
- }
- #endregion
- private void btnOk_Click(object sender, EventArgs e)
- {
- this.btnOk.Focus();
- if (this.txtFiredBatchNo.ReadOnly)
- {
- return;
- }
- try
- {
- btnOk.Tag = 1;
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCode) ||
- this._productionEntity.KilnID == null ||
- this._productionEntity.KilnID == -1)
- {
- MessageBox.Show("没有输入窑炉", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtKiln.Focus();
- return;
- }
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCarCode) ||
- this._productionEntity.KilnCarID == null ||
- this._productionEntity.KilnCarID == -1)
- {
- MessageBox.Show("没有输入窑车", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtKilnCarCode.Focus();
- return;
- }
- if (string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- MessageBox.Show("没有输入烧成批次", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtFiredBatchNo.Focus();
- return;
- }
- this.CheckFiredBatchNo();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- finally
- {
- btnOk.Tag = null;
- btnOk.Enabled = true;
- }
- }
- private void CheckFiredBatchNo()
- {
- string KilnCarBatchNo = string.Format("{0}#{1}#{2}#{3}",
- this._productionEntity.KilnCode,
- this._productionEntity.KilnCarCode,
- this.dtpFiredDate.Value.Value.ToString("yyyyMMdd"),
- this.txtFiredBatchNo.DataValue.Value.ToString("000"));
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "F_PM_0504";
- cre.Name = "CheckKilnCarBatchNo";
- cre.Properties["KilnID"] = this._productionEntity.KilnID.Value;
- cre.Properties["KilnCarID"] = this._productionEntity.KilnCarID.Value;
- cre.Properties["FiredDate"] = this.dtpFiredDate.Value.Value;
- cre.Properties["KilnCarBatchNo"] = KilnCarBatchNo;
- cre.Properties["ProcedureID"] = this._procedureID;
- cre.Properties["ModelType"] = this._procedureDataEntity.ModelType;
- //ServiceResultEntity sre = (ServiceResultEntity)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return PMModuleProxyNew.Service.HandleRequest(cre);
- //}));
- ServiceResultEntity sre = PMModuleProxyNew.Service.HandleRequest(cre);
- if (sre == null)
- {
- MessageBox.Show("此窑车烧成批次不存在",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- if (sre.Status == Constant.ServiceResultStatus.Other)
- {
- MessageBox.Show(sre.Message,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- this.txtKilnCarCode.ReadOnly = true;
- this.txtKiln.ReadOnly = true;
- this.txtFiredBatchNo.ReadOnly = true;
- this.dtpFiredDate.Enabled = false;
- }
- private void txtFiredBatchNo_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if ((int)e.KeyChar == Constant.SYSTEM_KEYBOARD_ENTER_VALUE) // 按了回车键
- {
- this.btnOk.Focus();
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void txtFiredBatchNo_Validating(object sender, System.ComponentModel.CancelEventArgs e)
- {
- try
- {
- if (this.txtFiredBatchNo.ReadOnly || string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- return;
- }
- // 验证烧成批次
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCode) ||
- this._productionEntity.KilnID == null ||
- this._productionEntity.KilnID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this._productionEntity.KilnCarCode) ||
- this._productionEntity.KilnCarID == null ||
- this._productionEntity.KilnCarID == -1)
- {
- return;
- }
- if (string.IsNullOrWhiteSpace(this.txtFiredBatchNo.Text))
- {
- return;
- }
- this.CheckFiredBatchNo();
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- }
- }
|