| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PM_0302.cs
- * 2.功能描述:新建标准、坯库计件
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 王鑫 2014/09/23 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.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.Controls.FormCommon;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PMModuleService;
- using Dongke.IBOSS.PRD.WCF.Proxys.SystemModuleService;
- using Dongke.WinForm.Utilities;
- namespace Dongke.IBOSS.PRD.Client.PMModule
- {
- /// <summary>
- /// 新建标准、坯库计件
- /// </summary>
- public partial class F_PM_0302 : FormBase
- {
- #region 成员变量
- // 工序ID
- private int _procedureID;
- // 工序实体类
- ProcedureEntity _procedureDataEntity;
- // 生产数据实体类
- List<ProductionDataEntity> _productionDataEntity = new List<ProductionDataEntity>();
- // 数据源Table
- private DataTable _dataSourceTable = null;
- // 添加行数据源
- private DataTable _collectType = null;
- // 生产工号
- private int _userID = -1;
- // 生产编号
- private string _userCode;
- // 生产名称
- private string _userName;
- // 是否有商标
- private int? _isLogo = null;
- // 是否有商标编码
- private string _isLogoCode = "";
- // 是否有商标名称
- private string _isLogoName = "";
- // 1.产成品交接是否限制同商标
- private string _isEnable_S_PM_011 = "0";
- // 2.产成品交接是否限制同型号
- private string _isEnable_S_PM_012 = "0";
- // 3.产成品交接是否限制每板装板数量(必须先启用限制同型号);
- private string _isEnable_S_PM_013 = "0";
- // 最大限制数量
- private int _maxPlateLimitNum = 0;
- // 最大限制数量新
- private int _maxPlateLimitNumNew = 0;
- // 产品型号
- private string _goodsID = null;
- private string _goodsCode = null;
- private string _goodsModelForCheck = null;
- // 商标ID
- private string _logoID = null;
- private string _logoName = null;
- #endregion
- #region 属性
- /// <summary>
- /// 绑定GridView数据源
- /// </summary>
- public DataTable DataSourceTable
- {
- set
- {
- _dataSourceTable = value;
- }
- get
- {
- if (_dataSourceTable == null)
- {
- _dataSourceTable = new DataTable();
- _dataSourceTable.Columns.Add("BarCode");
- _dataSourceTable.Columns.Add("GoodsCode");
- _dataSourceTable.Columns.Add("GoodsName");
- _dataSourceTable.Columns.Add("ProductionLineCode");
- _dataSourceTable.Columns.Add("ProcedureModel");
- _dataSourceTable.Columns.Add("ModelType");
- _dataSourceTable.Columns.Add("PieceType");
- _dataSourceTable.Columns.Add("IsReworked");
- _dataSourceTable.Columns.Add("IsPublicBody");
- _dataSourceTable.Columns.Add("OrganizationName");
- _dataSourceTable.Columns.Add("Remarks");
- _dataSourceTable.Columns.Add("UserCode");
- _dataSourceTable.Columns.Add("UserID");
- _dataSourceTable.Columns.Add("BarCodeUserCode");
- _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");
- _dataSourceTable.Columns.Add("BanMa", typeof(string));
- return _dataSourceTable;
- }
- else
- {
- return _dataSourceTable;
- }
- }
- }
- /// <summary>
- /// 提交数据源
- /// </summary>
- public DataTable DataSourceCollectTypeTable
- {
- set
- {
- _collectType = value;
- }
- get
- {
- if (_collectType == null)
- {
- _collectType = new DataTable();
- _collectType.TableName = "collectType";
- _collectType.Columns.Add("BarCode");
- //_collectType.Columns.Add("IsPublicBody");
- _collectType.Columns.Add("UserID");
- _collectType.Columns.Add("UserCode");
- _collectType.Columns.Add("UserName");
- _collectType.Columns.Add("LogoID");
- _collectType.Columns.Add("BanMa", typeof(string));
- return _collectType;
- }
- else
- {
- return _collectType;
- }
- }
- }
- /// <summary>
- /// 生产工号
- /// </summary>
- public int UserID
- {
- set
- {
- _userID = value;
- }
- get
- {
- return _userID;
- }
- }
- /// <summary>
- /// 生产编号
- /// </summary>
- public string UserCode
- {
- set
- {
- _userCode = value;
- }
- get
- {
- return _userCode;
- }
- }
- /// <summary>
- /// 用户名称
- /// </summary>
- public string UserName
- {
- set
- {
- _userName = value;
- }
- get
- {
- return _userName;
- }
- }
- #endregion
- #region 构造函数
- public F_PM_0302()
- {
- InitializeComponent();
- }
- public F_PM_0302(int procedureID, string fromTitle)
- {
- InitializeComponent();
- this._procedureID = procedureID;
- this.Text = 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;
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体关闭事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void btnClose_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 txtBarcode_KeyPress(object sender, KeyPressEventArgs e)
- {
- try
- {
- if (this.txtBarcode.ReadOnly)
- {
- return;
- }
- if ((int)e.KeyChar == 13) // 按了回车键
- {
- if (this.txtUserCode.Text.Trim() == string.Empty)
- {
- this.txtUserCode.Focus();
- this.txtBarcode.Text = string.Empty;
- return;
- }
- if (this.txtBarcode.Text.Trim() == string.Empty)
- {
- this.txtBarcode.Focus();
- return;
- }
- DataRow[] drRows = this.DataSourceTable.Select("BarCode='" + this.txtBarcode.Text.Trim() + "'");
- if (drRows.Length == Constant.INT_IS_ZERO)
- {
- // 限制装板数量 add by chenxy 2018-02-27 begin
- if (string.IsNullOrEmpty(txtBanMa.Text))
- {
- if (this._maxPlateLimitNum > 0 && this.DataSourceTable.Rows.Count > this._maxPlateLimitNum)
- {
- MessageBox.Show("超过最大装板数量【" + this._maxPlateLimitNum + "】",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- }
- }
- else
- {
- if (this._maxPlateLimitNumNew > 0 && this.DataSourceTable.Rows.Count > this._maxPlateLimitNumNew)
- {
- MessageBox.Show("超过最大装板数量【" + this._maxPlateLimitNumNew + "】",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- }
- }
- // 限制装板数量 add by chenxy 2018-02-27 end
- if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
- {
- // 校验条码 获取校验条码信
- DataSet dsCheckBarcode = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.CheckBarcode(this._procedureID, this.txtBarcode.Text.Trim());
- }));
- if (dsCheckBarcode != null && dsCheckBarcode.Tables[0].Rows.Count > Constant.INT_IS_ZERO)
- {
- if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString() != string.Empty)
- {
- // 表示有错误
- //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);
- //this.txtBarcode.Focus();
- //this.txtBarcode.SelectAll();
- //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
- {
- ////是否弹出贴标窗口
- //if (this._isLogo != 0)
- //{
- // F_PM_2118 frm2118 = new F_PM_2118(Convert.ToInt32(this._isLogo));
- // frm2118.ShowDialog();
- // // if (frm2118.DialogResult == DialogResult.OK)
- // //{
- // this._isLogo = frm2118.LogoID;
- // this._isLogoCode = frm2118.LogoCode;
- // this._isLogoName = frm2118.LogoName;
- // //}
- //}
- //else
- //{
- 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();
- }
- // //看看之前工序有没有设置商标
- //}
- // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量) add by chenxy 2018-02-27 begin
- // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量)
- if (this._procedureDataEntity.NodeType == 3)
- {
- // 第一个条码 获取系统参数
- if (this.DataSourceTable.Rows.Count == 0)
- {
- this._logoID = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString();
- this._logoName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()].ToString();
- this._goodsID = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()].ToString();
- this._goodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
- this._goodsModelForCheck = dsCheckBarcode.Tables[0].Rows[0]["goodsModelForCheck"].ToString();
- ClientRequestEntity cre = new ClientRequestEntity();
- cre.NameSpace = "FinishedLoadingCar";
- cre.Name = "GetSetting";
- cre.Properties["GoodsID"] = this._goodsID;
- ServiceResultEntity sre = PMModuleProxyNew.Service.HandleRequest(cre);
- if (sre.Status == Constant.ServiceResultStatus.Success)
- {
- foreach (DataRow item in sre.Data.Tables[0].Rows)
- {
- if (item["settingcode"].ToString() == "S_PM_011")
- {
- this._isEnable_S_PM_011 = item["settingvalue"].ToString();
- }
- else if (item["settingcode"].ToString() == "S_PM_012")
- {
- this._isEnable_S_PM_012 = item["settingvalue"].ToString();
- }
- else if (item["settingcode"].ToString() == "S_PM_013")
- {
- this._isEnable_S_PM_013 = item["settingvalue"].ToString();
- }
- }
- }
- // 设置装板数量
- if (this._isEnable_S_PM_013 == "1" && this._isEnable_S_PM_012 == "1" && !string.IsNullOrEmpty(dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNum"]+""))
- {
- this._maxPlateLimitNum = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNum"]);
- this._maxPlateLimitNumNew = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0]["PlateLimitNumNew"]);
- }
- else
- {
- this._maxPlateLimitNum = 0;
- this._maxPlateLimitNumNew = 0;
- }
- }
- // 后续条码
- else
- {
- #region 启用限制同商标
- if (this._isEnable_S_PM_011 == "1")
- {
- if (dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoID.ToString()].ToString()
- != this._logoID)
- {
- MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的商标【"
- + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()]
- + "】与此批次商标【" + this._logoName + "】不同,不能进行该操作。",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- }
- }
- #endregion
- #region 启用限制同型号
- if (this._isEnable_S_PM_012 == "1")
- {
- if (dsCheckBarcode.Tables[0].Rows[0]["goodsModelForCheck"].ToString()
- != this._goodsModelForCheck)
- {
- MessageBox.Show("此产品【" + this.txtBarcode.Text.Trim() + "】的型号【"
- + dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]
- + "】与此批次型号【" + this._goodsCode + "】不同,不能进行该操作。 ",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- }
- }
- #endregion
- }
- }
- // 集中采集的结束工序(包装装板)验证参数(商标、型号、数量) add by chenxy 2018-02-27 end
- int PublicNormal = (int)Constant.PublicBodyFlag.No;
- // 生产数据实体
- ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
- procedureDataEntity.Barcode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()].ToString();// txtBarcode.Text.Trim(); // 产品条码
- procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString().ToUpper();// 集中采集批次号
- procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
- procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
- procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
- procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
- procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
- procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
- procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
- procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
- procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
- procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
- procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
- procedureDataEntity.IsPublicBody = PublicNormal;
- procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
- procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
- procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
- procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
- procedureDataEntity.UserID = UserID;
- procedureDataEntity.UserCode = UserCode;
- procedureDataEntity.UserName = UserName;
- procedureDataEntity.ValueFlag = 1;
- procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
- //procedureDataEntity.LogoID = this._isLogo;
- if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint) // 单点采集 直接保存
- {
- this.CollectTypeTwo(procedureDataEntity, dsCheckBarcode);
- }
- else
- {
- this.CollectTypeOne(procedureDataEntity, Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode, dsCheckBarcode); // 集中采集
- }
- this.txtBarcode.Text = string.Empty;
- this.txtBarcode.Focus();
- }
- }
- }
- else
- {
- //单点采集
- int PublicNormal = (int)Constant.PublicBodyFlag.No;
- // 生产数据实体
- ProductionDataEntity procedureDataEntity = new ProductionDataEntity();
- procedureDataEntity.Barcode = txtBarcode.Text.Trim(); // 产品条码
- procedureDataEntity.CentralizedBatchNo = System.Guid.NewGuid().ToString().ToUpper();// 集中采集批次号
- procedureDataEntity.ProductionLineID = this._procedureDataEntity.ProductionLineID;// 生产线ID
- procedureDataEntity.ProductionLineCode = this._procedureDataEntity.ProductionlineCode;// 生产编码
- procedureDataEntity.ProductionLineName = this._procedureDataEntity.ProductionlineName;// 生产名称
- procedureDataEntity.CompleteProcedureID = this._procedureID;// 工序ID
- procedureDataEntity.ProcedureCode = this._procedureDataEntity.ProcedureCode;// 工序编码
- procedureDataEntity.ProcedureName = this._procedureDataEntity.ProcedureName;// 工序名称
- procedureDataEntity.ProcedureModel = Convert.ToInt32(this._procedureDataEntity.ProcedureModel);// 工序模型
- procedureDataEntity.ModelType = this._procedureDataEntity.ModelType;// 工序模型类别
- procedureDataEntity.PieceType = Convert.ToInt32(this._procedureDataEntity.PieceType);// 计件模式
- procedureDataEntity.IsReworked = Convert.ToInt32(this._procedureDataEntity.IsSpecialRework); // 是否是返工
- procedureDataEntity.NodeType = Convert.ToInt32(this._procedureDataEntity.NodeType); // 工序结点类型
- procedureDataEntity.IsPublicBody = PublicNormal;
- procedureDataEntity.OrganizationID = this._procedureDataEntity.OrganizationID; // 组织机构
- //procedureDataEntity.GoodsID = Convert.ToInt32(dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsID.ToString()]);
- //procedureDataEntity.GoodsCode = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()].ToString();
- //procedureDataEntity.GoodsName = dsCheckBarcode.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()].ToString();
- procedureDataEntity.UserID = UserID;
- procedureDataEntity.UserCode = UserCode;
- procedureDataEntity.UserName = UserName;
- procedureDataEntity.ValueFlag = 1;
- procedureDataEntity.Remarks = this._procedureDataEntity.Remarks;
- procedureDataEntity.LogoID = this._isLogo;
- #region 单点采集
- // 添加行就可以 并保存
- // 保存到数据库
- DataSourceCollectTypeTable.Rows.Clear();
- DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
- drCollectType["BarCode"] = procedureDataEntity.Barcode;
- //drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- drCollectType["UserID"] = UserID;
- drCollectType["UserCode"] = UserCode;
- drCollectType["UserName"] = UserName;
- DataSourceCollectTypeTable.Rows.Add(drCollectType);
- DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
- }
- ));
- if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
- {
- // 提示信息
- MessageBox.Show(Messages.MSG_PM_W012,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- else
- {
- if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
- {
- this.txtBarcode.Text = "";
- // 单点采集成功后不需要提示
- // 提示信息
- //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- if (returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()].ToString() == "0")
- {
- // 表示有错误
- MessageBox.Show(string.Format(returnString.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(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_missFlag.ToString()])
- , returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString());
- frmscmn020.ShowDialog();
- }
- this.txtBarcode.Focus();
- this.txtBarcode.SelectAll();
- return;
- //// 提示信息
- //MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- //return;
- }
- }
- DataRow dr = this.DataSourceTable.NewRow();
- dr["BarCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_barcode.ToString()];// procedureDataEntity.Barcode;
- dr["GoodsCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsCode.ToString()]; //procedureDataEntity.GoodsCode;
- dr["GoodsName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_goodsName.ToString()];// procedureDataEntity.GoodsName;
- dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
- dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
- dr["ModelType"] = procedureDataEntity.ModelType;
- dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
- : "同工种策略";
- dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
- //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
- dr["OrganizationName"] = string.Empty;
- dr["Remarks"] = procedureDataEntity.Remarks;
- dr["UserCode"] = this.txtUserCode.Text.Trim();
- dr["BarCodeUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
- dr["MouldCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_mouldCode.ToString()];
- dr["GroutingUserCode"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];
- dr["GroutingNum"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingNum.ToString()];
- dr["IsPublicBody"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- dr["GroutingDate"] = Convert.ToDateTime(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
- dr["LogoID"] = this._isLogo;
- // dr["LogoCodeName"] = this._isLogoCode + "[" + this._isLogoName + "]";
- dr["LogoCodeName"] = returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoName.ToString()] + "[" + returnString.Rows[0][Constant.BarCodeResultTableColumns.out_logoCode.ToString()] + "]";
- 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
- #region 打印条码
- if (this._procedureDataEntity.BarCodePrintCopies > 0)
- {
- bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
- procedureDataEntity.Barcode,
- this._procedureDataEntity.BarCodePrintCopies,
- this);
- }
- #endregion
- }
- }
- 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 F_PM_0302_Load(object sender, EventArgs e)
- {
- try
- {
- this.dgvProduction.AutoGenerateColumns = false;
- this.dgvProduction.DataSource = DataSourceTable;
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- // 获取工序明细数据
- ProcedureEntity procedureDataEntity = (ProcedureEntity)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.GetProcedureDataEntityByID(this._procedureID);
- }));
- this._procedureDataEntity = procedureDataEntity;
- // 设置控件禁用或启用
- SetControlEnable();
- //// 是否有商标
- //int logoid = (int)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return PMModuleProxy.Service.GetLogoID(this._procedureID);
- //}));
- //this._isLogo = logoid;
-
- }
- 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 tsbtnDelete_Click(object sender, EventArgs e)
- {
- if (this.dgvProduction.CurrentCell != null)
- {
- 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.DataSourceTable.AcceptChanges();
- // 限制装板数量 add by chenxy 2018-02-27 begin
- if (string.IsNullOrEmpty(txtBanMa.Text.Trim()))
- {
- if (this._maxPlateLimitNum > 0 && this.DataSourceTable.Rows.Count != this._maxPlateLimitNum)
- {
- MessageBox.Show("未达到装板数量【" + this._maxPlateLimitNum + "】",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- else
- {
- if (this._maxPlateLimitNumNew > 0 && this.DataSourceTable.Rows.Count != this._maxPlateLimitNumNew)
- {
- MessageBox.Show("未达到装板数量【" + this._maxPlateLimitNumNew + "】",
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- // 限制装板数量 add by chenxy 2018-02-27 end
- this.DataSourceCollectTypeTable.Clear();
- if (this.DataSourceTable.Rows.Count > Constant.INT_IS_ZERO)
- {
- foreach (DataRow drproductionData in this.DataSourceTable.Rows)
- {
- DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
- drCollectType["BarCode"] = drproductionData["BarCode"];
- // drCollectType["IsPublicBody"] = drproductionData["IsPublicBody"].ToString() != "1" ? 0 : 1;
- drCollectType["UserID"] = UserID;
- drCollectType["UserCode"] = UserCode;
- drCollectType["UserName"] = UserName;
- drCollectType["LogoID"] = drproductionData["LogoID"];
- drCollectType["BanMa"] = txtBanMa.Text.Trim();
- DataSourceCollectTypeTable.Rows.Add(drCollectType);
- }
- DataTable returnRow = (DataTable)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
- }));
- if (returnRow.Rows.Count <= Constant.INT_IS_ZERO)
- {
- // 提示信息
- MessageBox.Show(Messages.MSG_PM_W012,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- if (string.IsNullOrEmpty(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
- {
- // 提示信息
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- // 提示信息
- MessageBox.Show(string.Format(returnRow.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- txtBanMa.Text = "";
- this.txtBarcode.Text = "";
- this._productionDataEntity.Clear();
- this.DataSourceTable.Rows.Clear();
- if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
- {
- this.txtUserCode.Text = "";
- this.txtUserCode.Focus();
- this.txtUserCode.ReadOnly = false;
- }
- else
- {
- this.txtBarcode.Focus();
- }
- this._maxPlateLimitNum = 0;
- this._maxPlateLimitNumNew = 0;
- this._logoID = null;
- this._logoName = null;
- this._goodsID = null;
- this._goodsCode = null;
- this._goodsModelForCheck = null;
- #region 打印条码
- if (this._procedureDataEntity.BarCodePrintCopies > 0)
- {
- foreach (DataRow item in DataSourceCollectTypeTable.Rows)
- {
- bool result = Dongke.IBOSS.PRD.Client.Controls.F_MST_012006.PrintBarcode(
- item["Barcode"].ToString(),
- this._procedureDataEntity.BarCodePrintCopies,
- this);
- }
- }
- #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 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 (MsgCheckProcedureUser.ErrMsg != null)
- {
- MessageBox.Show(MsgCheckProcedureUser.ErrMsg,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.txtUserCode.SelectAll();
- e.Cancel = true;
- return;
- }
- if (UserID != -Constant.INT_IS_ONE)
- {
- if (MsgCheckProcedureUser.UserID != UserID)
- {
- btnSave_Click(sender, e);
- }
- }
- UserID = Convert.ToInt32(MsgCheckProcedureUser.UserID);
- UserCode = MsgCheckProcedureUser.UserCode;
- UserName = MsgCheckProcedureUser.UserName;
- this.txtUserCode.ReadOnly = 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 tsbtnAdaptive_Click(object sender, EventArgs e)
- {
- this.dgvProduction.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 窗体关闭时事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void F_PM_0302_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)
- {
- 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.txtBarcode.Focus();
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 设置控件禁用或启用
- /// </summary>
- private void SetControlEnable()
- {
- if (this._procedureDataEntity != null)
- {
- this.txtCollectType.Text = this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.SinglePoint ? "单点采集" : "集中采集";
- if (this._procedureDataEntity.CollectType == (int)Constant.ProcedureCollectType.Togather)
- {
- this.txtUserCode.Enabled = true;
- this.tsbtnDelete.Visible = true;
- this.tsbtnDelete.Enabled = true;
- this.btnSave.Visible = true;
- this.txtUserCode.Focus();
- }
- else
- {
- this.txtUserCode.Enabled = true;
- this.txtUserCode.ReadOnly = true;
- this.dgvProduction.ReadOnly = true;
- this.txtBarcode.Focus();
- // 此工号是否能生产工序
- 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;
- }
- }
- UserID = checkProcedureUser.UserID;
- UserCode = checkProcedureUser.UserCode;
- UserName = checkProcedureUser.UserName;
- }
- this.txtUserCode.Text = UserCode;
- }
- }
- /// <summary>
- /// 单点采集模式
- /// </summary>
- /// <param name="procedureDataEntity"></param>
- private void CollectTypeTwo(ProductionDataEntity procedureDataEntity, DataSet dsGroutingProduct)
- {
- try
- {
- //// 由产品条码获取注浆信息
- //DataSet dsGroutingProduct = (DataSet)DoAsync(new BaseAsyncMethod(() =>
- //{
- // return PMModuleProxy.Service.GetGroutingProducttByBarCode(procedureDataEntity.Barcode);
- //}));
- #region 单点采集
- // 添加行就可以 并保存
- // 保存到数据库
- DataSourceCollectTypeTable.Rows.Clear();
- DataRow drCollectType = DataSourceCollectTypeTable.NewRow();
- drCollectType["BarCode"] = procedureDataEntity.Barcode;
- drCollectType["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- drCollectType["UserID"] = UserID;
- drCollectType["UserCode"] = UserCode;
- drCollectType["UserName"] = UserName;
- DataSourceCollectTypeTable.Rows.Add(drCollectType);
- DataTable returnString = (DataTable)DoAsync(new BaseAsyncMethod(() =>
- {
- return PMModuleProxy.Service.AddWorkPiece(this._procedureID, DataSourceCollectTypeTable);
- }
- ));
- if (returnString.Rows.Count <= Constant.INT_IS_ZERO)
- {
- // 提示信息
- MessageBox.Show(Messages.MSG_PM_W012,
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- return;
- }
- else
- {
- if (string.IsNullOrEmpty(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()))//成功
- {
- // 单点采集成功后不需要提示
- // 提示信息
- //MessageBox.Show(string.Format(Messages.MSG_CMN_I001, "新增" + this.Text, "保存"),
- // this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- // 提示信息
- MessageBox.Show(string.Format(returnString.Rows[0][Constant.BarCodeResultTableColumns.out_errMsg.ToString()].ToString()),
- this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
- DataRow dr = this.DataSourceTable.NewRow();
- dr["BarCode"] = procedureDataEntity.Barcode;
- dr["GoodsCode"] = procedureDataEntity.GoodsCode;
- dr["GoodsName"] = procedureDataEntity.GoodsName;
- dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
- dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
- dr["ModelType"] = procedureDataEntity.ModelType;
- dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
- : "同工种策略";
- dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
- //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
- dr["OrganizationName"] = string.Empty;
- dr["Remarks"] = procedureDataEntity.Remarks;
- dr["UserCode"] = this.txtUserCode.Text.Trim();
- dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()]; //Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserCode;
- 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["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
- 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, string barCodeUserCode, 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["GoodsCode"] = procedureDataEntity.GoodsCode;
- dr["GoodsName"] = procedureDataEntity.GoodsName;
- dr["ProductionLineCode"] = procedureDataEntity.ProductionLineCode;
- dr["ProcedureModel"] = procedureDataEntity.ProcedureModel == (int)Constant.ProcedureModel.Piece ? "计数模型" : "检验模型";
- dr["ModelType"] = procedureDataEntity.ModelType;
- dr["PieceType"] = procedureDataEntity.PieceType == (int)Constant.ProcedurePieceType.NoPiece ? "不计件"
- : "同工种策略";
- dr["IsReworked"] = procedureDataEntity.IsReworked == (int)Constant.SpecialReworkFlag.Yes ? "是" : "否";
- //dr["IsPublicBody"] = procedureDataEntity.IsPublicBody;
- dr["OrganizationName"] = string.Empty;
- dr["Remarks"] = procedureDataEntity.Remarks;
- dr["UserCode"] = this.txtUserCode.Text.Trim();
- dr["UserID"] = procedureDataEntity.UserID;
- dr["BarCodeUserCode"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingUserCode.ToString()];// barCodeUserCode;
- 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["IsPublicBody"] = dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_ispublicbody.ToString()].ToString() != "1" ? 0 : 1;
- dr["GroutingDate"] = Convert.ToDateTime(dsGroutingProduct.Tables[0].Rows[0][Constant.BarCodeResultTableColumns.out_groutingdate.ToString()]);
- 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;
- }
- }
- #endregion
- }
- }
|