Ejemplo n.º 1
0
        /// <summary>
        /// DataGridView委托赋值函数
        /// </summary>
        /// <param name="view"></param>
        /// <param name="info"></param>
        private void SetDataGridViewTag(DataGridView view, APIClient.Tag tag, APIClient.MerchandiseInfoShow info, string status)
        {
            if (view.InvokeRequired)
            {
                setDataGridViewTag setThis = new setDataGridViewTag(SetDataGridViewTag);

                view.Invoke(setThis, view, tag, info, status);
            }
            else
            {
                view.ColumnCount     = 7;
                view.Columns[0].Name = "ID";
                view.Columns[1].Name = "店内码";
                view.Columns[2].Name = "条形码";
                view.Columns[3].Name = "名称";
                view.Columns[4].Name = "EPC";
                view.Columns[5].Name = "TID";
                view.Columns[6].Name = "状态";
                //view.Columns[7].Name = "操作";

                string[] row = new string[]
                {
                    tag.merchandiseID,
                    info.Code,
                    info.Barcode,
                    info.Name,
                    tag.EPC,
                    tag.TID,
                    status,
                };
                //view.Rows.Clear();
                view.Rows.Add(row);

                DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
                view.Columns.Add(btn);
                btn.HeaderText = "操作";
                if (status == "添加成功")
                {
                    btn.Text = "点击可添加或删除";
                }
                else if (status == "删除成功")
                {
                    btn.Text = "点击可添加或删除";
                }
                else
                {
                    btn.Text = "查看左侧错误提示";
                }
                btn.Name = "btn";
                btn.UseColumnTextForButtonValue = true;
            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (lastinfo.ID == null)
            {
                return;
            }

            if (lasttag.strEPC == "")
            {
                return;
            }

            APIClient.Tag tag = new APIClient.Tag();
            tag.EPC           = TextBoxMethod.RemoveSpaceFromString(lasttag.strEPC.Trim('\0'));
            tag.TID           = TextBoxMethod.RemoveSpaceFromString(lasttag.strPC.Trim('\0'));
            tag.merchandiseID = lastinfo.ID;

            string status = string.Empty;

            if (client.CreateTagInStock(tag, out status))
            {
                stopInventory();
                SetDataGridViewTag(dataGridView2, tag, lastinfo, status);
            }
            else
            {
                stopInventory();
                SetDataGridViewTag(dataGridView2, tag, lastinfo, status);
            }

            System.Threading.Thread.Sleep(200);

            //clear all for next time
            lastinfo = new APIClient.MerchandiseInfoShow();
            lasttag  = new RXInventoryTag();
            SetDataText(richTextBox1, string.Empty);
            SetDataText(richTextBox2, string.Empty);
            SetDataText(richTextBox3, string.Empty);
        }
Ejemplo n.º 3
0
        private void dataGridView2_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex + 1 == dataGridView2.RowCount)
            {
                return;
            }

            if (e.ColumnIndex == 7)
            {
                string msg = dataGridView2.Rows[e.RowIndex].Cells[6].Value.ToString();

                APIClient.Tag tag = new APIClient.Tag();
                tag.EPC           = dataGridView2.Rows[e.RowIndex].Cells[4].Value.ToString();
                tag.TID           = dataGridView2.Rows[e.RowIndex].Cells[5].Value.ToString();
                tag.merchandiseID = dataGridView2.Rows[e.RowIndex].Cells[0].Value.ToString();

                string status = string.Empty;

                if (msg == "添加成功")
                {
                    if (CancelAddTag(tag, out status))
                    {
                        dataGridView2.Rows[e.RowIndex].Cells[6].Value = status;
                        dataGridView2.Rows[e.RowIndex].Cells[7].Value = "点击可再次添加";
                    }
                }
                if (msg == "删除成功")
                {
                    if (RetryAddTag(tag, out status))
                    {
                        dataGridView2.Rows[e.RowIndex].Cells[6].Value = status;
                        dataGridView2.Rows[e.RowIndex].Cells[7].Value = "点击可撤销添加";
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private bool CancelAddTag(APIClient.Tag tag, out string status)
 {
     return(client.DeleteTagInStock(tag, out status));
 }
Ejemplo n.º 5
0
 private bool RetryAddTag(APIClient.Tag tag, out string status)
 {
     //string status = string.Empty;
     return(client.CreateTagInStock(tag, out status));
 }