private void Save() { this._theItem.Iteration = PLItem.UpdateItemIterationDirectly(this._theItem, ClientData.LogonUser.Oid, true, ClientData.UserGlobalOption, false); if (BizItemHandlerEvent.Instance.D_AfterIterationUpdated != null) { BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this._theItem)); } }
private static void LogOff() { try { PLUser.Logoff(ClientData.LogonUser.Oid, PLMProductName.TiModeler.ToString(), ClientData.Session); UIMessage.Instance.UninitilizeMessage(); BizOperationHelper.ClearLocalTempFiles(); } catch { } }
private void btnOK_Click(object sender, EventArgs e) { if (this.readOnly) { base.DialogResult = DialogResult.Cancel; base.Close(); } else if (this.pro.UpdateData(false)) { this.Item = this.pro.Item; if (this.pro.Item.Master.ClassName == "PPCRDTEMPLATE") { CLCardTemplate template = new CLCardTemplate(this.uOid, false, false, this.Item) { HasCover = this.chkCover.Checked, HasMainPage = this.chkMainPage.Checked, HasNextPage = this.chkNextPage.Checked }; try { template.CheckProperties(); } catch (Exception exception) { if (MessageBox.Show(exception.Message + "\n现在改正这些错误吗?选择“否”,将在下次提醒您更正该模板中的错误。", "PPM提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { return; } } Cursor current = Cursor.Current; Cursor.Current = Cursors.WaitCursor; try { if (this.updateDirectely) { template.Item.Iteration = PLItem.UpdateItemIterationDirectly(template.Item, this.uOid, false); } else { template.Item.Iteration = PLItem.UpdateItemIteration(template.Item.Iteration, this.uOid, false); } } catch (Exception exception2) { MessageBox.Show("更新模板属性失败!\n" + exception2.Message, "PPC - FrmBrowse", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } finally { Cursor.Current = current; } BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(template.Item)); } base.DialogResult = DialogResult.OK; base.Close(); } }
public bool SaveTemplate() { Cursor current = Cursor.Current; Cursor.Current = Cursors.WaitCursor; bool flag = true; if (!this.m_tp.IsSaved && !this.m_tp.ReadOnly) { try { try { this.m_tp.CheckProperties(); flag = this.ValidateMidBindCells(); } catch (Exception exception) { if (MessageBox.Show(exception.Message + "\n现在改正这些错误吗?选择“否”,将在下次提醒您更正该模板中的错误。", "PPM提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { flag = false; } } if (flag) { this.m_tp.SetNullBlob(); this.m_tp.Item.Iteration = PLItem.UpdateItemIteration(this.m_tp.Item.Iteration, this.m_tp.UserOid, false); this.PrepareTemplateText(); this.m_tp.UpdateBlobs(); this.UpdateHeadMainItem(); this.m_tp.IsSaved = true; this.m_tp.IsNew = false; foreach (Form form in ClientData.mainForm.MdiChildren) { if (form is FrmBrowse) { BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this.m_tp.Item)); goto Label_015D; } } } } catch (Exception exception2) { flag = false; this.m_tp.IsSaved = false; MessageBox.Show("保存失败!\n" + exception2.Message, "TiModeler - FrmModeling", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } Label_015D: Cursor.Current = current; return(flag); }
private void UpdateHeadMainItem() { try { if (this.m_tp.HasMainPage) { string latestHeadMainInfo = this.GetLatestHeadMainInfo(); if (latestHeadMainInfo != this.m_tp.Item.Revision.ReleaseDesc) { this.m_tp.Item.Revision.ReleaseDesc = latestHeadMainInfo; PLCardTemplate.RemAgent.UpdateReleaseDesc(this.m_tp.Item.RevOid, this.m_tp.Item.Revision.ReleaseDesc, ClientData.LogonUser.Oid); BizItemHandlerEvent.Instance.D_AfterMasterUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this.m_tp.Item)); } } } catch (Exception exception) { throw new Exception("更新模板的“头对象:主对象”失败。" + exception.Message); } }
private void btnClose_Click(object sender, EventArgs e) { bool flag = false; if (this._isChg) { int num; int num2; int num3; PlArchivManage.CheckPrintItem(this._theItem, out num, out num2, out num3); if (num2 > 0) { if (MessageBox.Show("是否保存当前的打印状态设置后退出 ?", "未保存", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { this.Save(); } } else if (num <= 0) { if (num3 > 0) { switch (MessageBox.Show("是:将取消打印!\r\n否:仅保存修改! ", "取消打印", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: PlArchivManage.CancelPrint(this._theItem, ""); this.Save(); break; case DialogResult.No: this.Save(); break; } } } else { switch (MessageBox.Show("是: 将结束打印,不再允许更改!\r\n否:仅保存修改! ", "完成打印", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { case DialogResult.Yes: { StringBuilder builder; PlArchivManage.EndPrint(this._theItem, "", false); this.Save(); ArrayList lstItems = new ArrayList(); lstItems.Add(this._theItem); PlArchivManage.Agent.CheckTsdRight(lstItems, "EndPrint", out builder, "托晒"); if (builder.Length <= 0) { PlArchivManage.Agent.PrintOrSentTsd(ClientData.LogonUser.Oid, this._theItem, "EndPrint", out builder); if (builder.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("完成打印失败,检测到下列错误:\r\n\t" + builder.ToString(), 0, true); return; } flag = true; break; } FrmArchivManage.frmMian.DisplayTextInRichtBox("完成打印失败,检测到下列错误:\r\n\t" + builder.ToString(), 0, true); return; } case DialogResult.No: this.Save(); break; } } } this._theItem = PLItem.Agent.GetBizItem(this._theItem.MasterOid, 0, 0, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem; try { if (flag) { PlArchivManage.CommitWorkItem(this._theItem); } } catch (Exception exception) { FrmArchivManage.frmMian.DisplayTextInRichtBox("打印完成,但提交流程失败:" + this._theItem.Id + exception.ToString(), 2, true); } if (BizItemHandlerEvent.Instance.D_AfterIterationUpdated != null) { BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(this._theItem)); } DelegatesOfAm.Instance.D_AfterPrintTabClose(this._theItem.Id); }
private void D_TOSENT_TSD_Click(object sender, EventArgs e) { ArrayList lstItems = new ArrayList(); foreach (ListViewItem item in this.lvwTSD.SelectedItems) { DEBusinessItem tag = item.Tag as DEBusinessItem; if (((tag.State == ItemState.CheckOut) && (tag.Holder == ClientData.LogonUser.Oid)) || (tag.State == ItemState.CheckIn)) { lstItems.Add(tag); } } if (lstItems.Count == 0) { MessageBox.Show("没有能够回收的托晒单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } else { StringBuilder builder; ArrayList list2 = PlArchivManage.Agent.CheckTsdRight(lstItems, "ToSent", out builder, "托晒"); if (list2.Count == 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("没有数据可以发送回收:\r\n" + builder.ToString(), 0, true); } else { if (builder.Length > 0) { DialogResult result = MessageBox.Show("发现数据错误,见详细信息中的内容,是否继续?", "发送托晒单直接回收错误", MessageBoxButtons.YesNo, MessageBoxIcon.Question); FrmArchivManage.frmMian.DisplayTextInRichtBox("下列数据无法 直接回收:\r\n" + builder.ToString(), 0, result == DialogResult.No); if (result != DialogResult.Yes) { return; } } StringBuilder builder2 = new StringBuilder(); StringBuilder builder3 = new StringBuilder(); for (int i = 0; i < list2.Count; i++) { StringBuilder builder4; DEBusinessItem item3 = list2[i] as DEBusinessItem; PlArchivManage.Agent.PrintOrSentTsd(ClientData.LogonUser.Oid, item3, "ToSent", out builder4); if (builder4.Length > 0) { builder.Append(builder4.ToString()); } else { item3 = PLItem.Agent.GetBizItem(item3.MasterOid, 0, 0, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem; try { PlArchivManage.CommitWorkItem(item3); } catch (Exception exception) { builder3.Append("\t" + item3.Id + ":" + exception.Message + "\r\n\t " + exception.ToString()); } if (BizItemHandlerEvent.Instance.D_AfterReleased != null) { BizItemHandlerEvent.Instance.D_AfterReleased(BizOperationHelper.ConvertPLMBizItemDelegateParam(item3)); } builder2.Append("\t" + item3.Id); } } if (builder.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单直接回收没有成功\r\n" + builder.ToString(), 0, true); } if (builder2.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单直接回收成功\r\n" + builder2.ToString(), 1, true); } if (builder3.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单已发送回收,但提交流程失败\r\n" + builder3.ToString(), 2, true); } } } }
private void D_TOPRINT_TSD_Click(object sender, EventArgs e) { ArrayList lstItems = new ArrayList(); foreach (ListViewItem item in this.lvwTSD.SelectedItems) { DEBusinessItem tag = item.Tag as DEBusinessItem; if ((tag.State == ItemState.CheckOut) && (tag.Holder == ClientData.LogonUser.Oid)) { PLItem.Agent.CheckIn(tag.MasterOid, tag.ClassName, ClientData.LogonUser.Oid, ""); lstItems.Add(tag); } if (tag.State == ItemState.CheckIn) { lstItems.Add(tag); } } if (lstItems.Count == 0) { MessageBox.Show("没有能够打印的托晒单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.None); } else { StringBuilder builder; ArrayList list2 = PlArchivManage.Agent.CheckTsdRight(lstItems, "ToPrint", out builder, "托晒"); if (list2.Count == 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("没有数据可以发送打印:\r\n" + builder.ToString(), 0, true); } else { if (builder.Length > 0) { DialogResult result = MessageBox.Show("发现数据错误,见详细信息中的内容,是否继续?", "发送打印错误", MessageBoxButtons.YesNo, MessageBoxIcon.Question); FrmArchivManage.frmMian.DisplayTextInRichtBox("下列数据无法 发送打印:\r\n" + builder.ToString(), 0, result == DialogResult.No); if (result != DialogResult.Yes) { return; } } StringBuilder builder2 = new StringBuilder(); for (int i = 0; i < list2.Count; i++) { StringBuilder builder3; DEBusinessItem item3 = list2[i] as DEBusinessItem; PlArchivManage.Agent.PrintOrSentTsd(ClientData.LogonUser.Oid, item3, "ToPrint", out builder3); if (builder3.Length > 0) { builder.Append(builder3.ToString()); } else { item3 = PLItem.Agent.GetBizItem(item3.MasterOid, 0, 0, ClientData.UserGlobalOption.CurView, ClientData.LogonUser.Oid, BizItemMode.BizItem) as DEBusinessItem; string attrValue = (item3.Iteration.GetAttrValue("SM") == null) ? "" : item3.Iteration.GetAttrValue("SM").ToString(); attrValue = attrValue + " " + ClientData.LogonUser.Name + ":发送打印"; item3.Iteration.SetAttrValue("SM", attrValue); item3.Iteration = PLItem.UpdateItemIterationDirectly(item3, ClientData.LogonUser.Oid, true, ClientData.UserGlobalOption, false); if (BizItemHandlerEvent.Instance.D_AfterIterationUpdated != null) { BizItemHandlerEvent.Instance.D_AfterIterationUpdated(BizOperationHelper.ConvertPLMBizItemDelegateParam(item3)); } builder2.Append("\t" + item3.Id); } } if (builder.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单发送打印没有成功\r\n" + builder.ToString(), 0, true); } if (builder2.Length > 0) { FrmArchivManage.frmMian.DisplayTextInRichtBox("下列托晒单发送打印成功\r\n" + builder2.ToString(), 1, true); } } } }