예제 #1
0
        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);
        }
예제 #2
0
 private void btnPrintEnd_Click(object sender, EventArgs e)
 {
     if (this.lvwPrintBom.SelectedItems.Count != 0)
     {
         ListViewItem current;
         ArrayList    list       = new ArrayList();
         ArrayList    list2      = new ArrayList();
         IEnumerator  enumerator = this.lvwPrintBom.SelectedItems.GetEnumerator();
         while (enumerator.MoveNext())
         {
             current = (ListViewItem)enumerator.Current;
             DERelationBizItem tag = current.Tag as DERelationBizItem;
             if (!(this.GetRelItemStatus(tag) == "已打印"))
             {
                 list.Add(tag);
                 list2.Add(current);
             }
         }
         if (list.Count != 0)
         {
             if (list.Count == 1)
             {
                 current          = list2[0] as ListViewItem;
                 current.Selected = true;
             }
             bool isSameReason = false;
             for (int i = 0; i < list.Count; i++)
             {
                 bool flag2;
                 DERelationBizItem relItem = list[i] as DERelationBizItem;
                 if (i < (list.Count - 1))
                 {
                     flag2 = false;
                 }
                 else
                 {
                     flag2 = true;
                 }
                 if (!isSameReason)
                 {
                     FrmInputRemark remark = new FrmInputRemark(relItem.Id + "完成打印", true, flag2);
                     DialogResult   result = remark.ShowDialog();
                     isSameReason = remark.IsSameReason;
                     string strMarkup = remark.StrMarkup;
                     if (isSameReason)
                     {
                         if (result != DialogResult.OK)
                         {
                             int count = list.Count - i;
                             list.RemoveRange(i, count);
                         }
                         else
                         {
                             for (int j = i; j < list.Count; j++)
                             {
                                 DERelationBizItem item4 = list[j] as DERelationBizItem;
                                 PlArchivManage.EndPrint(item4, strMarkup);
                                 PlArchivManage.UpdatePrintLvwRelValues(this.lvwPrintBom, this.lstOrder, item4);
                                 this._isChg = true;
                             }
                         }
                         break;
                     }
                     if (result != DialogResult.OK)
                     {
                         list.RemoveAt(i);
                         i--;
                     }
                     else
                     {
                         PlArchivManage.EndPrint(relItem, strMarkup);
                         PlArchivManage.UpdatePrintLvwRelValues(this.lvwPrintBom, this.lstOrder, relItem);
                         this._isChg = true;
                     }
                 }
             }
             this.RefreshFormByDocId();
         }
     }
 }