コード例 #1
0
ファイル: Pivas_setBatch.cs プロジェクト: ewin66/wholePivas
        public void ShowSetBatch(bool tf, string LabelNo, string Teamter, string BatchRules, BatchInfo bi, string pcode, string batchstr, bool refresh)
        {
            try
            {
                this.refresh = refresh;
                //this.pivas = pivas;
                Off = false;
                //鼠标相对于屏幕的坐标
                Rectangle s = Screen.PrimaryScreen.WorkingArea;
                if (Control.MousePosition.Y + this.Height < s.Height)
                {
                    this.Location = new Point(Control.MousePosition.X, Control.MousePosition.Y);
                }
                else
                {
                    this.Location = new Point(Control.MousePosition.X, Control.MousePosition.Y - this.Height);
                }
                Panel_Batch.Tag = LabelNo;
                Fpanel_set.Controls.Clear();
                Team = Teamter;
                if (batchstr.Contains("L"))
                {
                    Label_L.BackColor = Color.Gold;
                    //Label_L.BackgroundImage = (Image)PivasBatchMX.Properties.Resources.ResourceManager.GetObject("K_L");
                    Label_L.Visible = true;
                }
                else
                {
                    Label_L.Visible = false;
                }
                if (batchstr.Contains("K"))
                {
                    Label_K.BackgroundImage = (Image)PivasBatchMX.Properties.Resources.ResourceManager.GetObject("K_L");
                }
                if (batchstr.Contains("#"))
                {
                    Label_.BackgroundImage = (Image)PivasBatchMX.Properties.Resources.ResourceManager.GetObject("K_L");
                }
                Pcode        = pcode;
                BatchTags    = batchstr;
                this.bi      = bi;
                this.LabelNo = LabelNo;
                DataSet ds = DB.GetPIVAsDB(select.DOrder());
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    if ((ds.Tables[0].Rows.Count % 6) == 0)
                    {
                        Fpanel_set.Height = (ds.Tables[0].Rows.Count / 6) * 33;
                    }
                    else
                    {
                        Fpanel_set.Height = (ds.Tables[0].Rows.Count / 6 + 1) * 33;
                    }
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        SetBatch Set = new SetBatch(bi, pcode, refresh);
                        Set.batchInfo(ds.Tables[0].Rows[i]["OrderID"].ToString(), LabelNo, batchstr, Team, false);
                        Set.ChangeTextVal    += new DelegateChangeText(NewMethod);
                        Set.get_Reason       += new SetBatch.getReason(getReason);
                        Set.get_ReasonDetail += new SetBatch.GetReasonDetail(GetReasonDetail);
                        Fpanel_set.Controls.Add(Set);
                    }
                    Label_BatchRule.Text = BatchRules;
                }



                X   = this.Location.X;
                Y   = this.Location.Y;
                Off = true;
            }
            catch (Exception ex)
            {
                File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10010:" + ex.Message + "    " + DateTime.Now.ToString() + "\r\n");
            }
        }
コード例 #2
0
        public void sert(string Groupno)
        {
            try
            {
                OFF = false;
                //鼠标相对于屏幕的坐标
                this.Groupno = Groupno;
                Rectangle s = Screen.PrimaryScreen.WorkingArea;
                int       x = 0;
                int       y = 0;
                if (Control.MousePosition.X + this.Width < s.Width)
                {
                    x = Control.MousePosition.X;
                }
                else
                {
                    x = Control.MousePosition.X - this.Width;
                }
                if (Control.MousePosition.Y + this.Height < s.Height)
                {
                    y = Control.MousePosition.Y;
                }
                else
                {
                    y = Control.MousePosition.Y - this.Height;
                }
                this.Location = new Point(x, y);

                DataSet ds = db.GetPIVAsDB(sql.INFO(Groupno, pvb.datetime.ToString("yyyyMMdd")));
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    //根据瓶签号排序
                    DataTable dd = ds.Tables[0];
                    DataView  dw = dd.DefaultView;
                    dw.Sort = " labelNo ";


                    Dgv_Info.DataSource = dw;

                    //显示已打印未打印
                    for (int i = 0; i < Dgv_Info.Rows.Count; i++)
                    {
                        if (Dgv_Info.Rows[i].Cells["IVstatus"].Value.ToString().Trim().Equals("1"))
                        {
                            Dgv_Info.Rows[i].Cells[1].Tag = "1";

                            Dgv_Info["图片列", i].Value = PivasBatch.Properties.Resources.打印1;
                            enbaled = false;
                        }
                        else
                        {
                            Dgv_Info.Rows[i].Cells[1].Tag = "0";
                            enbaled = true;
                        }
                    }
                }

                Dgv_Info.Columns[1].Width = 5;
                Dgv_Info.Columns["StatasString"].Width = 50;
                Dgv_Info.Columns["FreqName"].Width     = 100;
                Dgv_Info.Columns["labelNo"].Width      = 120;
                Dgv_Info.Columns["IVstatus"].Visible   = false;
                Dgv_Info.Columns["BatchSaved"].Visible = false;
                Batch = Dgv_Info.Rows[0].Cells["batch"].Value.ToString().Trim();
                DataSet dds = db.GetPIVAsDB(sql.DOrder());
                //加载批次
                for (int i = 0; i < Fpanel_set.Controls.Count; i++)
                {
                    string labeltext = ((Label)(Fpanel_set.Controls[i])).Text.Trim();
                    if (dds.Tables[0].Select(" OrderID='" + labeltext + "'").Length <= 0)
                    {
                        Fpanel_set.Controls.Remove(Fpanel_set.Controls[i]);
                        i--;
                    }
                }
                Label_BorderShow();
                X   = this.Location.X;
                y   = this.Location.Y;
                OFF = true;
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }