예제 #1
0
        private void ConfirmMethod(DataGridViewRow row, BillDetail billDetail, IList<BillDetail> billDetails, string rfidID)
        {
            if (row.Cells["StatusName"].Value.ToString() == "������")
            {
                billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                billDetail.Operator = Environment.MachineName;
                billDetail.StorageRfid = rfidID;//����rfid
                billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                operateStorageName = row.Cells["Storage"].Value.ToString();
                targetStorageName = row.Cells["TargetStorage"].Value.ToString();
                operateName = row.Cells["BillTypeName"].Value.ToString();
                operateProductName = row.Cells["ProductName"].Value.ToString();
                operatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                operateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
            }

            ConfirmDialog confirmForm = new ConfirmDialog(BillTypes, operateStorageName, targetStorageName, operateName, operateProductName);
            confirmForm.Piece = operatePieceQuantity;
            confirmForm.Item = operateBarQuantity;
            if (confirmForm.ShowDialog() == DialogResult.OK)
            {
                DisplayPlWailt();

                if (BillTypes == "4")
                {
                    billDetail.OperatePieceQuantity = confirmForm.Piece;
                    billDetail.OperateBarQuantity = confirmForm.Item;
                }

                //todo RFID ȷ�ϣ���RFID ��¼��

                billDetails.Add(billDetail);
                BillDetail[] tmp = new BillDetail[billDetails.Count];
                billDetails.CopyTo(tmp, 0);

                Task task = new Task(url);
                task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                {
                    if (!isSuccess)
                        MessageBox.Show(msg);
                    RefreshData();
                });
                task.Execute(tmp, UseTag);
            }
        }
예제 #2
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            try
            {
                if (bsMain.Filter.Trim().Length != 0)
                {
                    DialogResult result = MessageBox.Show("���¶���������ѡ��'��(Y)',�������������ѡ��'��(N)'", "ѯ��", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                    switch (result)
                    {
                        case DialogResult.No:
                            DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn.RemoveFilter(dgvMain);
                            return;
                        case DialogResult.Cancel:
                            return;
                    }
                }

                btnRefresh.Enabled = false;
                btnChart.Enabled = false;

                pnlProgress.Top = (pnlMain.Height - pnlProgress.Height) / 3;
                pnlProgress.Left = (pnlMain.Width - pnlProgress.Width) / 2;
                pnlProgress.Visible = true;
                Application.DoEvents();
                url = configUtil.GetConfig("URL")["URL"];
                Task task = new Task(url);
                try
                {
                    task.Getshelf();
                    task.GetShelf += new Task.GetShelfEventHandler(delegate(bool isSuccess, string msg, ShelfInfo[] shelfInfo)
                    {
                        if (shelfInfo != null)
                        {
                            //bsMain.DataSource = shelfInfo;
                            cellTable = new DataTable();
                            cellTable.Columns.Add("ShelfCode");
                            cellTable.Columns.Add("ShelfName");
                            cellTable.Columns.Add("CellCode");
                            cellTable.Columns.Add("CellName");
                            cellTable.Columns.Add("ProductCode");
                            cellTable.Columns.Add("ProductName");
                            cellTable.Columns.Add("QuantityTiao", typeof(decimal));
                            cellTable.Columns.Add("QuantityJian", typeof(decimal));
                            cellTable.Columns.Add("WareCode");
                            cellTable.Columns.Add("WareName");
                            cellTable.Columns.Add("IsActive");
                            cellTable.Columns.Add("RowNum");
                            cellTable.Columns.Add("ColNum");
                            cellTable.Columns.Add("Shelf");
                            foreach (ShelfInfo shelf in shelfInfo)
                            {
                                this.ShelfInfo = shelf;
                                DataRow dr = cellTable.NewRow();
                                dr["ShelfCode"] = shelf.ShelfCode;
                                dr["ShelfName"] = shelf.ShelfName;
                                dr["CellCode"] = shelf.CellCode;
                                dr["CellName"] = shelf.CellName;
                                dr["ProductCode"] = shelf.ProductCode;
                                dr["ProductName"] = shelf.ProductName;
                                dr["QuantityTiao"] = shelf.QuantityTiao;
                                dr["QuantityJian"] = shelf.QuantityJian;
                                dr["WareCode"] = shelf.WareCode;
                                dr["WareName"] = shelf.WareName;
                                dr["IsActive"] = shelf.IsActive;
                                dr["RowNum"] = shelf.RowNum;
                                dr["ColNum"] = shelf.ColNum;
                                dr["Shelf"] = shelf.Shelf;
                                cellTable.Rows.Add(dr);
                            }
                            if (cellTable.Rows.Count > 0)
                            {
                                btnChart.Enabled = true;
                                pnlProgress.Visible = false;
                                btnRefresh.Enabled = true;
                            }
                            bsMain.DataSource = cellTable;
                        }
                        else
                        {
                            bsMain.DataSource = null;
                        }
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("��ȡ����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception exp)
            {
                THOKUtil.ShowInfo("��������ʧ�ܣ�ԭ��" + exp.Message);
            }
        }
예제 #3
0
        //ȡ������
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                sp.Stop();
                if (dgvMain.SelectedRows.Count != 0)
                {
                    DisplayPlWailt();
                    rRfid.CloseCom();
                    IList<BillDetail> billDetails = new List<BillDetail>();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        BillDetail billDetail = new BillDetail();
                        billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                        billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                        billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                        billDetail.Operator = Environment.MachineName;
                        billDetails.Add(billDetail);
                    }
                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.CancelCompleted += new Task.CancelCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Cancel(tmp, UseTag);
                    RfidCode = "";
                }
                else
                    MessageBox.Show("��ѡ��Ҫȡ���IJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ȡ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #4
0
        //��ѯ
        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                sp.Stop();
                Task task = new Task(url);
                task.GetBillMasterCompleted += new Task.GetBillMasterCompletedEventHandler(delegate(bool isSuccess, string msg, BillMaster[] billMasters)
                {
                    ClosePlWailt();
                    if (billMasters != null)
                    {
                        switch (billMasters.Length)
                        {
                            case 0:
                                billNo = "";
                                break;
                            case 1:
                                billNo = billMasters[0].BillNo;
                                break;
                            default:
                                SelectDialog selectDialog = new SelectDialog(billMasters);
                                if (selectDialog.ShowDialog() == DialogResult.OK)
                                {
                                    billNo = selectDialog.SelectedBillID;
                                }
                                break;
                        }

                        List<BillMaster> listBill = new List<Interface.Model.BillMaster>();
                        int f = 0;
                        for (int i = 0; i < billMasters.Length; i++)
                        {
                            if (billNo.Contains(billMasters[i].BillNo))
                            {
                                f++;
                                listBill.Add(billMasters[i]);
                            }
                        }
                        BillMasters = new BillMaster[f];
                        listBill.CopyTo(BillMasters, 0);
                    }
                    if (!isSuccess)
                        MessageBox.Show(msg);
                    RefreshData();
                });

                task.SearchBillMaster(BillTypes);
                DisplayPlWailt();
            }
            catch (Exception ex)
            {
                MessageBox.Show("��ȡ����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #5
0
        //����ȷ��
        private void btnBatConfirm_Click(object sender, EventArgs e)
        {
            sp.Stop();
            if (!UseRfid.Equals("0"))
            {
                MessageBox.Show("ʹ��RFID�޷�������ɣ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("��ǰ����������ȷ��ѡ������������������", "��ʾ",
                MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                if (dgvMain.SelectedRows.Count != 0)
                {
                    DisplayPlWailt();
                    IList<BillDetail> billDetails = new List<BillDetail>();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        BillDetail billDetail = new BillDetail();
                        billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                        billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                        billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                        billDetail.Operator = Environment.MachineName;

                        billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                        billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                        billDetails.Add(billDetail);
                    }
                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Execute(tmp, UseTag);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ִ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #6
0
 private void btnBcCompose_Click(object sender, EventArgs e)
 {
     btnBcCompose.Enabled = false;
     if (!isBcCompose && BillTypes == "3" && BillMasters != null)
     {
         Task task = new Task(url.Replace("Task", "StockMoveBill/GeneratePalletTag"));
         task.BcComposeCompleted += new Task.BcComposeEventHandler(delegate(bool isSuccess, string msg)
         {
             dgvMain.Columns["PalletTag"].Visible = true;
             if (!isSuccess)
                 MessageBox.Show(msg);
             RefreshData();
             btnBcCompose.Enabled = true;
             isBcCompose = true;
         });
         task.BcCompose(billNo);
     }
     else
     {
         dgvMain.Columns["PalletTag"].Visible = false;
         RefreshData();
         btnBcCompose.Enabled = true;
         isBcCompose = false;
     }
 }
예제 #7
0
        private void ApplyPublicMethod()
        {
            try
            {
                string storageRfide = "";
                if (dgvMain.SelectedRows.Count > 1 && !UseRfid.Equals("0"))
                {
                    MessageBox.Show("��ǰ����ֻ�������һ������", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                foreach (DataGridViewRow row in dgvMain.Rows)
                {
                    if (row.Cells["Status"].Value.ToString().Equals("1") && !UseRfid.Equals("0"))
                    {
                        MessageBox.Show("ʹ��RFID,ֻ������һ�����ݡ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                if (dgvMain.SelectedRows.Count != 0)
                {
                    DisplayPlWailt();
                    IList<BillDetail> billDetails = new List<BillDetail>();

                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        BillDetail billDetail = new BillDetail();
                        billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                        billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                        billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                        billDetail.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                        billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                        billDetail.Operator = Environment.MachineName;
                        billDetails.Add(billDetail);
                        if (!UseRfid.Equals("0"))
                        {
                            storageRfide = row.Cells["StorageRfid"].Value.ToString();
                        }
                    }

                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.ApplyCompleted += new Task.ApplyCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Apply(tmp, UseTag);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //if (!RfidCode.Equals(storageRfide))
                //    MessageBox.Show("��ȡ��rfid��Ϣ�������������Ϣ��һ�£�����������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshData();
            }
        }
예제 #8
0
 //����
 private void btnApply_Click(object sender, EventArgs e)
 {
     sp.Stop();
     string errString = string.Empty;
     List<string> listRfid = new List<string>();
     string productRfid = "";
     decimal quantityRfid = 0;
     try
     {
         if (UseRfid == "0")
         {
             ApplyPublicMethod();
         }
         else
         {
             if (BillTypes == "1")
             {
                 while (listRfid.Count == 0 || listRfid == null)
                 {
                     DisplayPlWailt();
                     listRfid = rRfid.ReadTrayRfid(port, 115200, out errString);
                     Application.DoEvents();
                 }
                 RfidCode = RfidCode = listRfid[0].ToString();
                 Task task = new Task(url);
                 task.SearchRfidInfo(RfidCode);
                 task.GetRfidInfoCompleted += new Task.GetRfidInfoCompletedEventHandler(delegate(bool isSuccess, string msg, BillDetail[] billDetails)
                 {
                     if (billDetails != null && billDetails.Length != 0)
                     {
                         productRfid = billDetails[0].ProductCode;
                         quantityRfid = billDetails[0].PieceQuantity;
                     }
                     ApplyPublicMethod(UseRfid, RfidCode, productRfid, quantityRfid);
                 });
             }
             else
             {
                 ApplyPublicMethod();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("�������" + ex.Message + " ,����:" + errString);
         RefreshData();
     }
 }
예제 #9
0
        public void ApplyPublicMethod(string uRfid, string rfidId, string rfidProductCode, decimal rfidQuantity)
        {
            try
            {
                errInfo = "";
                bool isRfid = true;
                RfidCode = rfidId;
                decimal rfidQty = Convert.ToInt32(rfidQuantity);
                if (dgvMain.SelectedRows.Count != 0)
                {
                    foreach (DataGridViewRow row in dgvMain.Rows)
                    {
                        if (row.Cells["Status"].Value.ToString().Equals("1") && !uRfid.Equals("0"))
                        {
                            MessageBox.Show("ʹ��RFID,ֻ������һ�����ݡ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    DisplayPlWailt();
                    IList<BillDetail> billDetails = new List<BillDetail>();

                    switch (uRfid)
                    {
                        case "0":
                            foreach (DataGridViewRow row in dgvMain.SelectedRows)
                            {
                                BillDetail billDetail = new BillDetail();
                                billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                                billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                                billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                                billDetail.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                billDetail.Operator = Environment.MachineName;
                                billDetails.Add(billDetail);
                            }
                            isRfid = false;
                            break;
                        case "1":
                            foreach (DataGridViewRow row in dgvMain.SelectedRows)
                            {
                                if (rfidProductCode.Equals(row.Cells["ProductCode"].Value.ToString())
                                && rfidQty == Convert.ToInt32(row.Cells["PieceQuantity"].Value)
                                && row.Cells["Status"].Value.ToString().Equals("0"))
                                {
                                    BillDetail billDetail = new BillDetail();
                                    billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                                    billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                                    billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                                    billDetail.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                    billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                    billDetail.Operator = Environment.MachineName;
                                    billDetails.Add(billDetail);
                                    isRfid = false;
                                    break;
                                }
                            }
                            break;
                        case "2":
                            foreach (DataGridViewRow row in dgvMain.Rows)
                            {
                                //�жϾ��̺��������ȡ���Ƿ�һ��������״̬�ų��Ѿ�����Ļ�λ��
                                if (rfidProductCode.Equals(row.Cells["ProductCode"].Value.ToString())
                                    && rfidQty == Convert.ToInt32(row.Cells["PieceQuantity"].Value)
                                    && row.Cells["Status"].Value.ToString().Equals("0"))
                                {
                                    BillDetail billDetail = new BillDetail();
                                    billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                                    billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                                    billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                                    billDetail.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                    billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                    billDetail.Operator = Environment.MachineName;
                                    billDetails.Add(billDetail);
                                    isRfid = false;
                                    break;
                                }
                            }
                            break;
                        default:
                            errInfo = "��鿴ʹ��RFID���ò����Ƿ���ȷ��";
                            break;
                    }

                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.ApplyCompleted += new Task.ApplyCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            errInfo += "  " + msg;
                        RefreshData();
                    });
                    task.Apply(tmp, UseTag);

                    if (isRfid)
                        MessageBox.Show("����ʧ�ܣ�ԭ�򣺵�ǰ���̾��̺���������ҵ���ݲ�ƥ����� ��������:  " + errInfo, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #10
0
        //ˢ������
        private void RefreshData()
        {
            if (BillMasters == null)
            {
                dgvMain.DataSource = null;
                return;
            }
            sslBillID.Text = "���ݺţ�" + billNo + "                              ";
            sslOperator.Text = "����Ա��" + Environment.MachineName;

            Task task = new Task(url);
            task.GetBillDetailCompleted += new Task.GetBillDetailCompletedEventHandler(delegate(bool isSuccess, string msg, BillDetail[] billDetails)
            {
                InTask = false;

                if (billDetails != null && billDetails.Length != 0)
                {
                    dgvMain.AutoGenerateColumns = false;
                    dgvMain.DataSource = billDetails;

                    foreach (BillDetail billDetail in billDetails)
                    {
                        storageName = billDetail.StorageName;
                        targetStorageName = billDetail.TargetStorageName;
                        if (billDetail.Status == "1")
                        {
                            InTask = true;
                            btnCancel.Enabled = true;
                            btnConfirm.Enabled = true;
                            btnBatConfirm.Enabled = true;
                        }
                        else
                        {
                            btnApply.Enabled = true;
                        }
                    }
                }
                else
                {
                    dgvMain.DataSource = null;
                    isAppyInt = 0;
                }
                ClosePlWailt();
                dgvMain.ClearSelection();
                task.Getshelf();
                task.GetShelf += new Task.GetShelfEventHandler(delegate(bool isSuccesss, string msgs, ShelfInfo[] shelfInfo)
                {
                    if (shelfInfo != null)
                    {
                        cellTable = new DataTable();
                        cellTable.Columns.Add("ShelfCode");
                        cellTable.Columns.Add("ShelfName");
                        cellTable.Columns.Add("CellCode");
                        cellTable.Columns.Add("CellName");
                        cellTable.Columns.Add("ProductCode");
                        cellTable.Columns.Add("ProductName");
                        cellTable.Columns.Add("QuantityTiao", typeof(decimal));
                        cellTable.Columns.Add("QuantityJian", typeof(decimal));
                        cellTable.Columns.Add("WareCode");
                        cellTable.Columns.Add("WareName");
                        cellTable.Columns.Add("IsActive");
                        cellTable.Columns.Add("RowNum");
                        cellTable.Columns.Add("ColNum");
                        cellTable.Columns.Add("Shelf");
                        foreach (ShelfInfo shelf in shelfInfo)
                        {
                            this.ShelfInfo = shelf;
                            DataRow dr = cellTable.NewRow();
                            dr["ShelfCode"] = shelf.ShelfCode;
                            dr["ShelfName"] = shelf.ShelfName;
                            dr["CellCode"] = shelf.CellCode;
                            dr["CellName"] = shelf.CellName;
                            dr["ProductCode"] = shelf.ProductCode;
                            dr["ProductName"] = shelf.ProductName;
                            dr["QuantityTiao"] = shelf.QuantityTiao;
                            dr["QuantityJian"] = shelf.QuantityJian;
                            dr["WareCode"] = shelf.WareCode;
                            dr["WareName"] = shelf.WareName;
                            dr["IsActive"] = shelf.IsActive;
                            dr["RowNum"] = shelf.RowNum;
                            dr["ColNum"] = shelf.ColNum;
                            dr["Shelf"] = shelf.Shelf;
                            cellTable.Rows.Add(dr);
                        }
                        if (cellTable.Rows.Count > 0)
                        {
                            btnChart.Enabled = true;
                        }
                    }
                });
            });
            task.SearchBillDetail(BillMasters, RfidReadProductCode, OperateType, OperateAreas, Environment.MachineName);
            DisplayPlWailt();
        }
예제 #11
0
        //ˢ������
        private void RefreshData()
        {
            if (BillMaster == null)
            {
                dgvMain.DataSource = null;
                return;
            }
            sslBillID.Text = "���ݺţ�" + BillMaster.BillNo + "                              ";
            sslOperator.Text = "����Ա��" + Environment.MachineName;

            Task task = new Task(url);
            task.GetBillDetailCompleted += new Task.GetBillDetailCompletedEventHandler(delegate(bool isSuccess, string msg, BillDetail[] billDetails)
            {
                InTask = false;
                if (billDetails != null && billDetails.Length != 0)
                {
                    dgvMain.AutoGenerateColumns = false;
                    dgvMain.DataSource = billDetails;
                    foreach (BillDetail billDetail in billDetails)
                    {
                        if (billDetail.Status == "1")
                        {
                            InTask = true;
                            btnCancel.Enabled = true;
                            btnConfirm.Enabled = true;
                            btnBatConfirm.Enabled = true;
                        }
                        else
                        {
                            btnApply.Enabled = true;
                        }
                    }
                }
                else
                {
                    dgvMain.DataSource = null;
                }
                ClosePlWailt();
            });
            task.SearchBillDetail(new BillMaster[] { this.BillMaster }, RfidReadProductCode, OperateType, OperateAreas, Environment.MachineName);
            DisplayPlWailt();
        }
예제 #12
0
 //��ѯ
 private void btnSearch_Click(object sender, EventArgs e)
 {
     try
     {
         string billNo = string.Empty;
         Task task = new Task(url);
         task.GetBillMasterCompleted += new Task.GetBillMasterCompletedEventHandler(delegate(bool isSuccess, string msg, BillMaster[] billMasters)
         {
             ClosePlWailt();
             if (billMasters != null)
             {
                 switch (billMasters.Length)
                 {
                     case 0:
                         billNo = "";
                         break;
                     case 1:
                         billNo = billMasters[0].BillNo;
                         break;
                     default:
                         SelectDialog selectDialog = new SelectDialog(billMasters);
                         if (selectDialog.ShowDialog() == DialogResult.OK)
                         {
                             billNo = selectDialog.SelectedBillID;
                         }
                         break;
                 }
                 foreach (BillMaster billMaster in billMasters)
                 {
                     if (billNo == billMaster.BillNo)
                     {
                         this.BillMaster = billMaster;
                     }
                 }
             }
             if (!isSuccess)
                 MessageBox.Show(msg);
             RefreshData();
         });
         task.SearchBillMaster(BillTypes);
         DisplayPlWailt();
     }
     catch (Exception ex)
     {
         MessageBox.Show("��ȡ����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #13
0
        //ȷ��
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvMain.SelectedRows.Count > 1)
                {
                    MessageBox.Show("��ǰ����ֻ�������һ������", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (dgvMain.SelectedRows.Count == 1)
                {
                    IList<BillDetail> billDetails = new List<BillDetail>();
                    BillDetail billDetail = new BillDetail();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        if (row.Cells["StatusName"].Value.ToString() == "������")
                        {
                            billDetail.BillNo = row.Cells["BillNo"].Value.ToString();
                            billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                            billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                            billDetail.Operator = Environment.MachineName;

                            billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                            billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                            operateStorageName = row.Cells["Storage"].Value.ToString();
                            targetStorageName = row.Cells["TargetStorage"].Value.ToString();
                            operateName = row.Cells["BillTypeName"].Value.ToString();
                            operateProductName = row.Cells["ProductName"].Value.ToString();
                            operatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                            operateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                        }
                    }

                    ConfirmDialog confirmForm = new ConfirmDialog(BillTypes, operateStorageName, targetStorageName, operateName, operateProductName);
                    confirmForm.Piece = operatePieceQuantity;
                    confirmForm.Item = operateBarQuantity;

                    if (confirmForm.ShowDialog() == DialogResult.OK)
                    {
                        DisplayPlWailt();

                        if (BillTypes == "4")
                        {
                            billDetail.OperatePieceQuantity = confirmForm.Piece;
                            billDetail.OperateBarQuantity = confirmForm.Item;
                        }

                        //todo RFID ȷ�ϣ���RFID ��¼��

                        billDetails.Add(billDetail);
                        BillDetail[] tmp = new BillDetail[billDetails.Count];
                        billDetails.CopyTo(tmp, 0);

                        Task task = new Task(url);
                        task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                        {
                            if (!isSuccess)
                                MessageBox.Show(msg);
                            RefreshData();
                        });
                        task.Execute(tmp, UseTag);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ִ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }