Esempio n. 1
0
        private void BtnSelectCard_Click(object sender, EventArgs e)
        {
            #region 创建流转卡标签
            if (equipmentId == 0)
            {
                throw new Exception("请先选择设备!");
            }
            if (operationId == 0)
            {
                throw new Exception("请先选择工序!");
            }

            FmMOExcuteCard frm = new FmMOExcuteCard(equipmentId, operationId);
            if (frm.ShowDialog() == DialogResult.OK)
            {
                foreach (string cardNo in frm.cardList)
                {
                    bool bExist = false;
                    foreach (SuperTabItem item in tabControl.Tabs)
                    {
                        if (item.Tag != null && item.Tag.ToString() == cardNo)
                        {
                            bExist = true;
                            break;
                        }
                    }

                    if (bExist)
                    {
                        continue;
                    }

                    MCardControl control = new MCardControl(cardNo, equipmentId);
                    control.CloseParentTab = CloseTab;

                    var tab = NewPage(control);

                    control.Settime = new MCardControl.SetTimeDelegate(
                        new Action <decimal>(seconds =>
                    {
                        if (seconds < 0)
                        {
                            tab.PredefinedColor = eTabItemColor.Red;
                            tab.Text            = cardNo + " [超时]";
                            return;
                        }

                        var min     = Math.Floor(seconds / 60);
                        var hours   = Math.Floor(min / 60);
                        var leftSec = seconds % 60;
                        var str     = " [" + hours.ToString() + "小时 " + min.ToString() + "分" + leftSec.ToString() + "秒]";

                        tab.Text = cardNo + str;
                    })
                        );
                }
            }
            #endregion
        }
Esempio n. 2
0
        private void OpenCard()
        {
            #region 打开已已开工,未完工卡

            List <string> wheres = new List <string>()
            {
                "operationId = " + operationId,
                "isnull(bComplete,0) = 0",
                "isnull(bClosed,0) = 0",
                "(iStatus > 0 and iStatus < 5 or MotypeId in (select MotypeId from motypecontrol where bOrderOff = 1)) "
            };

            if (equipmentId != 0)
            {
                wheres.Add("EQId = " + equipmentId);
            }


            var ls = new MCardDAL().GetCardDetails(wheres.ToArray());

            ls.ForEach(x =>
            {
                MCardControl control   = new MCardControl(x.CardNo, equipmentId);
                control.CloseParentTab = CloseTab;

                var tab = NewPage(control);

                control.Settime = new MCardControl.SetTimeDelegate(
                    new Action <decimal>(seconds =>
                {
                    if (seconds < 0)
                    {
                        tab.PredefinedColor = eTabItemColor.Red;
                        tab.Text            = x.CardNo + " [超时]";
                        return;
                    }

                    var min     = Math.Floor(seconds / 60);
                    var hours   = Math.Floor(min / 60);
                    var leftSec = seconds % 60;
                    var str     = " [" + hours.ToString() + "小时 " + min.ToString() + "分" + leftSec.ToString() + "秒]";

                    tab.Text = x.CardNo + str;
                })
                    );
            });
            #endregion
        }