| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343 |
- /*******************************************************************************
- * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
- * 类的信息:
- * 1.程序名称:F_PC_0101.cs
- * 2.功能描述:成型线信息一览,以及对成型线模具的相关操作
- * 编辑履历:
- * 作者 日期 版本 修改内容
- * 庄天威 2014/09/13 1.00 新建
- *******************************************************************************/
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Text;
- using System.Windows.Forms;
- using Dongke.IBOSS.PRD.Basics.BaseResources;
- using Dongke.IBOSS.PRD.Basics.DockPanel;
- using Dongke.IBOSS.PRD.Client.CommonModule;
- using Dongke.IBOSS.PRD.Client.DataModels;
- using Dongke.IBOSS.PRD.WCF.DataModels;
- using Dongke.IBOSS.PRD.WCF.Proxys;
- using Dongke.IBOSS.PRD.WCF.Proxys.PCModuleService;
- namespace Dongke.IBOSS.PRD.Client.PCModule
- {
- /// <summary>
- /// 成型线信息一览,以及对成型线模具的相关操作
- /// </summary>
- public partial class F_PC_0101 : DockPanelBase
- {
- #region 成员变量
- //单例模式
- private static F_PC_0101 _instance;
- //选择的成型线实体
- private GroutingLineEntity _groutingLineEntity = new GroutingLineEntity();
- //成型线明细(模具)实体集合
- private List<GroutingLineDetailEntity> _detailList = new List<GroutingLineDetailEntity>();
- //范围权限
- private string _purview;
- //操作时间
- private DateTime? _startTime;
- //换产产品ID
- private int? _newGoodsId;
- //操作说明/备注
- private string _remarksOrRreason = "";
- #endregion
- #region 构造函数
- /// <summary>
- /// 成型线一览窗体构造
- /// </summary>
- public F_PC_0101()
- {
- InitializeComponent();
- this.Text = FormTitles.F_PC_0101;
- this.tsbtnRepairMould.Text = ButtonText.TSBTN_REPAIRMOULD;
- this.tsbtnRepairMouldEnd.Text = ButtonText.TSBTN_REPAIRMOULDEND;
- this.tsbtnChangeMould.Text = ButtonText.TSBTN_CHANGEMOULD;
- this.tsbtnChangeMouldEnd.Text = ButtonText.TSBTN_CHANGEMOULDEND;
- this.tsbtnDisable.Text = ButtonText.TSBTN_DISABLE;
- this.tsbtnChangeMouldAll.Text = ButtonText.TSBTN_CHANGEMOULDENDALL;
- this.tsbtnChangeMouldAllEnd.Text = ButtonText.TSBTN_CHANGEMOULDENDALLEND;
- this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
- this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
- this.btnSearch.Text = ButtonText.BTN_SEARCH;
- this.btnClearCondition.Text = ButtonText.BTN_CLEARCONDITION;
- }
- #endregion
- #region 单例模式
- /// <summary>
- /// 单例模式,防止重复创建窗体
- /// </summary>
- public static F_PC_0101 Instance
- {
- get
- {
- if (_instance == null)
- {
- _instance = new F_PC_0101();
- }
- return _instance;
- }
- }
- #endregion
- #region 事件
- /// <summary>
- /// 窗体加载
- /// </summary>
- private void F_PC_0101_Load(object sender, EventArgs e)
- {
- try
- {
- // 加载权限
- FormPermissionManager.FormPermissionControl(this.Name, this,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.UserRightData,
- Dongke.IBOSS.PRD.Client.DataModels.LogInUserInfo.CurrentUser.CurrentUserEntity.FunctionData);
- getPurview();
- }
- 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.dgvGroutingLineDetail.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
- }
- /// <summary>
- /// 关闭按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 获取数据
- /// </summary>
- private void btnSearch_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dkGrouting.GroutingLineID == null)
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.dkGrouting.Focus();
- return;
- }
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 窗体关闭
- /// </summary>
- private void F_PC_0101_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 清空条件
- /// </summary>
- private void btnClearCondition_Click(object sender, EventArgs e)
- {
- this.dkGrouting.GroutingLineID = null;
- this.dkGrouting.Text = null;
- this.dgvGroutingLineDetail.DataSource = null;
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = false;
- }
- /// <summary>
- /// 选择明细
- /// </summary>
- private void dgvGroutingLineDetail_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
- {
- try
- {
- if (e.RowIndex == -Constant.INT_IS_ONE || e.ColumnIndex == -Constant.INT_IS_ONE)
- {
- return;
- }
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- if (this.dkGrouting.GMouldStatus == Constant.INT_IS_THREE)
- {
- this.tsbtnRepairMould.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = false;
- this.tsbtnChangeMould.Enabled = false;
- this.tsbtnChangeMouldEnd.Enabled = false;
- this.tsbtnDisable.Enabled = false;
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = true;
- return;
- }
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
- {
- this.tsbtnRepairMould.Enabled = true;
- this.tsbtnChangeMould.Enabled = true;
- this.tsbtnChangeMouldEnd.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = false;
- this.tsbtnDisable.Enabled = true;
- }
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Repair))
- {
- this.tsbtnChangeMould.Enabled = true;
- this.tsbtnRepairMould.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = true;
- this.tsbtnChangeMouldEnd.Enabled = false;
- this.tsbtnDisable.Enabled = true;
- }
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Replac))
- {
- this.tsbtnRepairMould.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = false;
- this.tsbtnChangeMould.Enabled = false;
- this.tsbtnChangeMouldEnd.Enabled = true;
- this.tsbtnDisable.Enabled = true;
- }
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Disable))
- {
- this.tsbtnRepairMould.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = false;
- this.tsbtnChangeMould.Enabled = false;
- this.tsbtnChangeMouldEnd.Enabled = false;
- this.tsbtnDisable.Enabled = false;
- }
- if(detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Update))
- {
- this.tsbtnRepairMould.Enabled = false;
- this.tsbtnRepairMouldEnd.Enabled = false;
- this.tsbtnChangeMould.Enabled = false;
- this.tsbtnChangeMouldEnd.Enabled = false;
- this.tsbtnDisable.Enabled = false;
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- /// <summary>
- /// 窗体关闭
- /// </summary>
- private void GroutingLineInfo_FormClosed(object sender, FormClosedEventArgs e)
- {
- _instance = null;
- }
- /// <summary>
- /// 修模操作
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void tsbtnRepairMould_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- //修模处理
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Repair);
- GMouldRecordEntity recordEntity = new GMouldRecordEntity();
- recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- recordEntity.GOODSID = detailEntity.GOODSID;
- recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- recordEntity.MouldCode = detailEntity.MOULDCODE;
- recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Repair);
- if (_remarksOrRreason == string.Empty)
- {
- recordEntity.RREASON = "修模";
- }
- else
- {
- recordEntity.RREASON = _remarksOrRreason;
- }
- recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
- recordEntity.REMARKS = "";
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.RepAirDetail(detailEntity, recordEntity);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnRepairMouldEnd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "修模结束");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- //修模完成处理
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.RepAirDetailEnd(detailEntity, _startTime, _remarksOrRreason);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "修模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "修模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnChangeMould_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- //插入换修履历以及模具履历,并更新成型线明细的新编号,重置注浆次数,开始使用时间。以及换模中的状态
- if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition)
- {
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- GMouldRecordEntity recordEntity = new GMouldRecordEntity();
- recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- recordEntity.GOODSID = detailEntity.GOODSID;
- recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- recordEntity.MouldCode = detailEntity.MOULDCODE;
- recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- if (this._remarksOrRreason != string.Empty)
- {
- recordEntity.RREASON = _remarksOrRreason;
- }
- else
- {
- recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE;
- }
- recordEntity.REMARKS = recordEntity.RREASON;
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
- {
- recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac);
- }
- else
- {
- recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac);
- }
- recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
- GMouldHistoryEntity historyEntity = new GMouldHistoryEntity();
- historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- historyEntity.GOODSID = detailEntity.GOODSID;
- historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- historyEntity.MouldCode = detailEntity.MOULDCODE;
- historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE;
- historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime);
- historyEntity.REMARKS = recordEntity.RREASON;//"";
- //模具编号要更新
- detailEntity.MOULDCODE = Guid.NewGuid().ToString();
- detailEntity.GROUTINGCOUNT = 0;
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac);
- detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime);
- detailEntity.REMARKS = this._remarksOrRreason;
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.ChangeDetailPreposition(detailEntity, recordEntity, historyEntity);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else //只插入换修履历,并只更新成型线明细的状态(换模中)
- {
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- GMouldRecordEntity recordEntity = new GMouldRecordEntity();
- recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- recordEntity.GOODSID = detailEntity.GOODSID;
- recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- recordEntity.MouldCode = detailEntity.MOULDCODE;
- recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
- recordEntity.RREASON = Constant.BUTTON_TEXT_CHANGE;
- recordEntity.REMARKS = "";
- if (detailEntity.MOULDSTATUS == Convert.ToInt32(Constant.GMouldStatus.Normal))
- {
- recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.Replac);
- }
- else
- {
- recordEntity.RESUMETYPE = Convert.ToInt32(Constant.GMouldRecordType.RepairToReplac);
- }
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Replac);
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.ChangeDetailPostposition(detailEntity, recordEntity);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnChangeMouldEnd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "换模结束");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- if (Constant.NowUpdateMode == Constant.GroutingLineDetailUpdateMode.Preposition) //把明细修改回来即可
- {
- //换模结束处理
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
- detailEntity.REMARKS = this._remarksOrRreason;
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.ChangeDetailEndPreposition(detailEntity, _startTime, _remarksOrRreason);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else //插入模具履历,并更新成型线明细的模具编号,重置开始使用时间,注浆次数,以及把模具状态修改为正常
- {
- //换模结束处理
- GroutingLineDetailEntity detailEntity = this._detailList[Index];
- GMouldHistoryEntity historyEntity = new GMouldHistoryEntity();
- historyEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- historyEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- historyEntity.GOODSID = detailEntity.GOODSID;
- historyEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- historyEntity.MouldCode = detailEntity.MOULDCODE;
- historyEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- historyEntity.BEGINUSEDDATE = detailEntity.BEGINUSEDDATE;
- historyEntity.ENDUSEDDATE = Convert.ToDateTime(_startTime);
- historyEntity.REMARKS = "";
- detailEntity.MOULDCODE = Guid.NewGuid().ToString();
- detailEntity.GROUTINGCOUNT = 0;
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Normal);
- detailEntity.BEGINUSEDDATE = Convert.ToDateTime(_startTime);
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.ChangeDetailEndPostposition(detailEntity, historyEntity);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "换模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "换模结束"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnDisable_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- int Index = Convert.ToInt32(this.dgvGroutingLineDetail.SelectedRows[0].Index.ToString());
- GroutingLineDetailEntity detailEntity = _detailList[Index];
- GMouldRecordEntity recordEntity = new GMouldRecordEntity();
- recordEntity.GROUTINGLINEID = detailEntity.GROUTINGLINEID;
- recordEntity.GROUTINGLINEDETAILID = detailEntity.GROUTINGLINEDETAILID;
- recordEntity.GOODSID = detailEntity.GOODSID;
- recordEntity.GROUTINGMOULDCODE = detailEntity.GROUTINGMOULDCODE;
- recordEntity.MouldCode = detailEntity.MOULDCODE;
- recordEntity.GROUTINGCOUNT = detailEntity.GROUTINGCOUNT;
- recordEntity.BEGINDATE = Convert.ToDateTime(_startTime);
- recordEntity.RESUMETYPE = 0;
- recordEntity.RREASON = Constant.BUTTON_TEXT_STOP;
- recordEntity.REMARKS = "";
- if (detailEntity.MOULDSTATUS != Convert.ToInt32(Constant.GMouldStatus.Normal))
- {
- PCModuleProxy.Service.UpdateMouldRecordEndTime(recordEntity);
- }
- detailEntity.MOULDSTATUS = Convert.ToInt32(Constant.GMouldStatus.Disable);
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.StopDetail(detailEntity, recordEntity);
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "停用"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (MyReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "停用"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnChangeMouldAll_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dkGrouting.GroutingLineID != null)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- int AllReturn = Constant.INT_IS_ZERO;
- AllReturn = PCModuleProxy.Service.ChangeAllLine(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason);
- if (AllReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- //控件数据源重新绑定
- this.dkGrouting.DataSourseBind();
- //按钮可用性调整
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = true;
- //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3
- this.dkGrouting.GMouldStatus = 3;
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (AllReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnChangeMouldAllEnd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dkGrouting.GroutingLineID != null)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "整线换模结束");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- int AllReturn = Constant.INT_IS_ZERO;
- AllReturn = PCModuleProxy.Service.ChangeAllLineEnd(_groutingLineEntity, _detailList, _startTime, _remarksOrRreason);
- if (AllReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- //控件数据源重新绑定
- this.dkGrouting.DataSourseBind();
- //按钮可用性调整
- this.tsbtnChangeMouldAll.Enabled = true;
- this.tsbtnChangeMouldAllEnd.Enabled = false;
- //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1
- this.dkGrouting.GMouldStatus = 1;
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "整线换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (AllReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "整线换模"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 dkGrouting_MouldTypeValueChanged(object sender, Controls.SearchTextBox.dkGroutingLineSearchBox.TextChangeEventArgs e)
- {
- this.dgvGroutingLineDetail.DataSource = null;
- this._groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID;
- this._groutingLineEntity.OPTIMESTAMP = this.dkGrouting.OPTimeStamp;
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- }
- if (this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Normal))
- {
- this.tsbtnChangeMouldAll.Enabled = true;
- this.tsbtnChangeMouldAllEnd.Enabled = false;
- this.tsbtnUpdateLine.Enabled = true;
- this.tsbtnUpdateLineEnd.Enabled = false;
- }
- else if(this.dkGrouting.GMouldStatus == Convert.ToInt32(Constant.GMouldStatus.Update))
- {
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = false;
- this.tsbtnUpdateLine.Enabled = false;
- this.tsbtnUpdateLineEnd.Enabled = true;
- }
- else
- {
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = true;
- this.tsbtnUpdateLine.Enabled = false;
- this.tsbtnUpdateLineEnd.Enabled = false;
- }
- }
- #endregion
- #region 私有方法
- /// <summary>
- /// 将明细DataSet数据集转入集合中
- /// </summary>
- private void DataTableToListByDetail(DataSet dsDetail)
- {
- try
- {
- this._detailList.Clear();
- foreach (DataRow dr in dsDetail.Tables[0].Rows)
- {
- GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity();
- detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(dr[0]);
- detailEntity.GROUTINGLINEID = Convert.ToInt32(dr[1]);
- detailEntity.GROUTINGMOULDCODE = dr[2].ToString();
- detailEntity.MOULDCODE = dr[3].ToString();
- detailEntity.GOODSID = Convert.ToInt32(dr[4]);
- detailEntity.GROUTINGCOUNT = Convert.ToDecimal(dr[5]);
- detailEntity.MOULDSTATUS = Convert.ToInt32(dr[6]);
- detailEntity.BEGINUSEDDATE = Convert.ToDateTime(dr[7]);
- detailEntity.REMARKS = dr[8].ToString();
- detailEntity.ACCOUNTID = Convert.ToInt32(dr[9]);
- detailEntity.VALUEFLAG = Convert.ToInt32(dr[10]);
- detailEntity.CREATETIME = Convert.ToDateTime(dr[11]);
- detailEntity.CREATEUSERID = Convert.ToInt32(dr[12]);
- detailEntity.UPDATETIME = Convert.ToDateTime(dr[13]);
- detailEntity.UPDATEUSERID = Convert.ToInt32(dr[14]);
- detailEntity.OPTIMESTAMP = Convert.ToDateTime(dr[15]);
- this._detailList.Add(detailEntity);
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 根据选择成型线显示模具
- /// </summary>
- /// <returns></returns>
- private DataSet GetGroutingLineDetail()
- {
- return PCModuleProxy.Service.GetGroutingLineDetailByMainId(Convert.ToInt32(this.dkGrouting.GroutingLineID), null, 6);
- }
- /// <summary>
- /// 获取成型线权限
- /// </summary>
- protected void getPurview()
- {
- try
- {
- StringBuilder sbPurview = new StringBuilder();
- DataSet dsPurview = SystemModuleProxy.Service.GetUserPurview(6, LogInUserInfo.CurrentUser.UserID);
- if (dsPurview != null)
- {
- foreach (DataRow dr in dsPurview.Tables[0].Rows)
- {
- sbPurview.Append(dr[0].ToString() + ",");
- }
- if (sbPurview.Length != Constant.INT_IS_ZERO)
- {
- this._purview = sbPurview.ToString().Substring(0, sbPurview.Length - 1);
- }
- }
- this.dkGrouting.Purview = _purview;
- this.dkGrouting.IsEnablePurview = true;
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 将成型线明细DataSet数据集转入集合中
- /// </summary>
- private void DataTableToListByLineDetail(DataSet dsLineDetail)
- {
- try
- {
- this._detailList.Clear();
- foreach (DataRow drFor in dsLineDetail.Tables[0].Rows)
- {
- GroutingLineDetailEntity detailEntity = new GroutingLineDetailEntity();
- detailEntity.ACCOUNTID = Convert.ToInt32(drFor["ACCOUNTID"]);
- detailEntity.BEGINUSEDDATE = Convert.ToDateTime(drFor["BEGINUSEDDATE"]);
- detailEntity.CREATETIME = Convert.ToDateTime(drFor["CREATETIME"]);
- detailEntity.CREATEUSERID = Convert.ToInt32(drFor["CREATEUSERID"]);
- detailEntity.GOODSCODE = drFor["GOODSCODE"].ToString();
- detailEntity.GOODSID = Convert.ToInt32(drFor["GOODSID"]);
- detailEntity.GOODSNAME = drFor["GOODSNAME"].ToString();
- detailEntity.GROUTINGCOUNT = Convert.ToDecimal(drFor["GROUTINGCOUNT"]);
- detailEntity.GROUTINGLINECODE = drFor["GROUTINGLINECODE"].ToString();
- detailEntity.GROUTINGLINEDETAILID = Convert.ToInt32(drFor["GROUTINGLINEDETAILID"]);
- detailEntity.GROUTINGLINEID = Convert.ToInt32(drFor["GROUTINGLINEID"]);
- detailEntity.GROUTINGLINENAME = drFor["GROUTINGLINENAME"].ToString();
- detailEntity.GROUTINGMOULDCODE = drFor["GROUTINGMOULDCODE"].ToString();
- detailEntity.MOULDCODE = drFor["GroutingMouldCode"].ToString();
- detailEntity.MOULDSTATUS = Convert.ToInt32(drFor["GMouldStatus"]);
- detailEntity.OPTIMESTAMP = Convert.ToDateTime(drFor["OPTIMESTAMP"]);
- detailEntity.UPDATETIME = Convert.ToDateTime(drFor["UPDATETIME"]);
- detailEntity.UPDATEUSERID = Convert.ToInt32(drFor["UPDATEUSERID"]);
- detailEntity.VALUEFLAG = Convert.ToInt32(drFor["VALUEFLAG"]);
- this._detailList.Add(detailEntity);
- }
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 设置起始时间与备注
- /// </summary>
- /// <param name="startTime"></param>
- /// <param name="remarkStr"></param>
- public void SetTimeOrRemarks(DateTime? startTime, string remarkStr)
- {
- this._startTime = startTime;
- this._remarksOrRreason = remarkStr;
- }
- /// <summary>
- /// 成型线换产设置
- /// </summary>
- /// <param name="startTime"></param>
- /// <param name="remarkStr"></param>
- /// <param name="GoodsId"></param>
- public void SetTimeOrRemarksGoodsId(DateTime? startTime,string remarkStr,int? GoodsId)
- {
- this._startTime = startTime;
- this._remarksOrRreason = remarkStr;
- this._newGoodsId = GoodsId;
- }
- #endregion
- private void tsbtnUpdateLine_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dkGrouting.GroutingLineID != null)
- {
- F_PC_0106 frmFPC0106 = new F_PC_0106(_instance, "成型线换产");
- DialogResult dialogresult = frmFPC0106.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- int AllReturn = Constant.INT_IS_ZERO;
- _groutingLineEntity.REMARKS = _remarksOrRreason;
- _groutingLineEntity.GROUTINGLINEID = this.dkGrouting.GroutingLineID;//加这个为了变产结束在重复变产,造成成型线ID不对
- AllReturn = PCModuleProxy.Service.UpdateLine(_groutingLineEntity, _detailList);
- if (AllReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- //控件数据源重新绑定
- this.dkGrouting.DataSourseBind();
- //按钮可用性调整
- this.tsbtnUpdateLine.Enabled = false;
- this.tsbtnUpdateLineEnd.Enabled = true;
- this.tsbtnChangeMouldAll.Enabled = false;
- this.tsbtnChangeMouldAllEnd.Enabled = false;
- //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为3
- this.dkGrouting.GMouldStatus = 4;
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (AllReturn == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
- private void tsbtnUpdateLineEnd_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dkGrouting.GroutingLineID != null)
- {
- F_PC_0107 frmFPC0107 = new F_PC_0107(_instance, "成型线换产");
- DialogResult dialogresult = frmFPC0107.ShowDialog();
- if (dialogresult.Equals(DialogResult.OK))
- {
- int NewLineId = Constant.INT_IS_ZERO;
- _groutingLineEntity.REMARKS = _remarksOrRreason;
- NewLineId = PCModuleProxy.Service.UpdateLineEnd(_groutingLineEntity, _detailList, Convert.ToInt32(_newGoodsId));
- // modify wangx 2015/07/15
- this.dkGrouting.GroutingLineID = NewLineId;
- this.dkGrouting.DataSource = null;
- // modify wangx 2015/07/15 end
- if (NewLineId > Constant.INT_IS_ZERO)
- {
- this.dkGrouting.GroutingLineID = NewLineId;
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- //控件数据源重新绑定
- this.dkGrouting.DataSourseBind();
- //按钮可用性调整
- this.tsbtnUpdateLine.Enabled = true;
- this.tsbtnUpdateLineEnd.Enabled = false;
- //如果成功,目前选择的成型线状态需做改变,即是当前所选成型线的状态改为1
- this.dkGrouting.GMouldStatus = 1;
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "成型线换产"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else if (NewLineId == -500)
- {
- MessageBox.Show(Messages.MSG_CMN_W012, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- this.Close();
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "成型线换产"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W005, "成型线"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- 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 tsbtnStart_Click(object sender, EventArgs e)
- {
- try
- {
- if (this.dgvGroutingLineDetail.SelectedRows.Count != Constant.INT_IS_ZERO)
- {
- string GMouldStatus = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GMouldStatus"].Value.ToString();
- if(GMouldStatus!="0")
- {
- return;
- }
- string detailId = this.dgvGroutingLineDetail.SelectedRows[0].Cells["GroutingLineDetailID"].Value.ToString();
- //准备提交
- int MyReturn = (int)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return PCModuleProxy.Service.StartDetail(Convert.ToInt32(detailId));
- }));
- if (MyReturn > Constant.INT_IS_ZERO)
- {
- DataSet dsGroutingLineDetail = (DataSet)DoAsync(new Dongke.IBOSS.PRD.Basics.DockPanel.AsyncMethod(() =>
- {
- return GetGroutingLineDetail();
- }));
- if (dsGroutingLineDetail != null)
- {
- this.DataTableToListByLineDetail(dsGroutingLineDetail);
- if (dsGroutingLineDetail.Tables.Count != Constant.INT_IS_ZERO)
- {
- this.dgvGroutingLineDetail.AutoGenerateColumns = false;
- this.dgvGroutingLineDetail.DataSource = ((DataSet)dsGroutingLineDetail).Tables[0];
- this.dgvGroutingLineDetail.ReadOnly = true;
- }
- }
- MessageBox.Show(string.Format(Messages.MSG_CMN_I001, this.Text, "启用"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show(string.Format(Messages.MSG_CMN_W001, this.Text, "启用"), this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- else
- {
- MessageBox.Show(Messages.MSG_CMN_W020, this.Text,
- MessageBoxButtons.OK, MessageBoxIcon.Warning);
- }
- }
- catch (Exception ex)
- {
- // 对异常进行共通处理
- ExceptionManager.HandleEventException(this.ToString(),
- System.Reflection.MethodBase.GetCurrentMethod().Name, this.Text, ex);
- }
- }
-
- }
- }
|