예제 #1
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;
                    }
                }
                ShelfCode.Clear();

                DataTable dtShelf = cellDal.GetShelf();
                for (int i = 0; i < dtShelf.Rows.Count; i++)
                {
                    ShelfCode.Add(i + 1, dtShelf.Rows[i]["SHELF_CODE"].ToString());
                }

                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();

                cellTable         = cellDal.GetCell();
                bsMain.DataSource = cellTable;

                pnlProgress.Visible = false;
                btnRefresh.Enabled  = true;
                btnChart.Enabled    = true;
            }
            catch (Exception exp)
            {
                THOKUtil.ShowInfo("读入数据失败,原因:" + exp.Message);
            }
        }
예제 #2
0
        //确认
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string getRFID = "";

            if (dgvMain.SelectedRows.Count != 0)
            {
                string bb_area_type = dgvMain.Rows[0].Cells["bb_area_type"].Value.ToString();

                if (bb_area_type == "0")                    //0:主储存区,1:零件烟区,2:零条烟区
                {
                    getRFID = ScanningRFID(bb_area_type);   //读取RFID

                    if (getRFID == null)
                    {
                        THOKUtil.ShowError("操作失败!");
                        this.VisibleWailt(false);
                        return;
                    }
                }
                else if (bb_area_type == "1")
                {
                    getRFID = "";
                }
                else
                {
                    THOKUtil.ShowError("浪潮给的<bb_area_type>是:" + bb_area_type + ",注释 0:主储存区,1:零件烟区,2:零条烟区");
                    this.VisibleWailt(false);
                    return;
                }
                try
                {
                    this.VisibleWailt(true);

                    DataSet ds = GenerateEmptyTables();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        DataRow detailRow = ds.Tables["DETAIL"].NewRow();
                        //主表信息
                        detailRow["bb_result_info"]      = "0";
                        detailRow["bb_type"]             = BillString;
                        detailRow["bb_order_id"]         = row.Cells["bb_order_id"].Value.ToString();
                        detailRow["bb_pda_device_id"]    = Environment.MachineName;
                        detailRow["bb_confirmor_name"]   = Environment.MachineName;
                        detailRow["bb_confirm_date"]     = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                        detailRow["bb_corporation_id"]   = row.Cells["bb_corporation_id"].Value.ToString();
                        detailRow["bb_corporation_name"] = row.Cells["bb_corporation_name"].Value.ToString();
                        //细表信息
                        detailRow["bb_detail_id"]       = row.Cells["bb_detail_id"].Value.ToString();
                        detailRow["bb_operate_type"]    = row.Cells["bb_operate_type"].Value.ToString();
                        detailRow["bb_pallet_move_flg"] = row.Cells["bb_pallet_move_flg"].Value.ToString();
                        detailRow["bb_cargo_no"]        = row.Cells["bb_cargo_no"].Value.ToString();
                        if (BillTypes == "1")
                        {
                            detailRow["bb_pallet_no"] = getRFID;//此标签改为RFID传入值
                        }
                        else
                        {
                            detailRow["bb_pallet_no"] = row.Cells["bb_pallet_no"].Value.ToString();
                        }
                        detailRow["bb_brand_id"]      = row.Cells["bb_brand_id"].Value.ToString();
                        detailRow["bb_brand_name"]    = row.Cells["bb_brand_name"].Value.ToString();
                        detailRow["bb_handle_num"]    = Convert.ToDecimal(row.Cells["bb_handle_num"].Value.ToString());
                        detailRow["bb_inventory_num"] = Convert.ToDecimal(row.Cells["bb_inventory_num"].Value.ToString());
                        detailRow["bb_unit"]          = row.Cells["bb_unit"].Value.ToString();
                        detailRow["bb_operator_name"] = Environment.UserName;
                        detailRow["bb_operate_date"]  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                        ConfirmDialog confirmForm = new ConfirmDialog(BillTypes, row.Cells["bb_cargo_no"].Value.ToString(), row.Cells["bb_cargo_no"].Value.ToString(), row.Cells["bb_operate_type"].Value.ToString(), row.Cells["bb_brand_name"].Value.ToString());
                        confirmForm.Piece = Convert.ToInt32(row.Cells["bb_handle_num"].Value.ToString());
                        confirmForm.Bar   = 0;
                        if (confirmForm.ShowDialog() == DialogResult.OK)
                        {
                            if (BillTypes == "2")
                            {
                                detailRow["bb_inventory_num"] = confirmForm.Piece;
                            }

                            ds.Tables["DETAIL"].Rows.Add(detailRow);

                            try
                            {
                                if (BillTypes == "1")
                                {
                                    wave.confirmData(ds.Tables["DETAIL"], BillTypes);
                                }
                                else
                                {
                                    if (getRFID == detailRow["bb_pallet_no"].ToString() || detailRow["bb_pallet_no"].ToString() == "" || detailRow["bb_pallet_no"].ToString() == null)
                                    {
                                        try
                                        {
                                            wave.confirmData(ds.Tables["DETAIL"], BillTypes);
                                            THOKUtil.ShowInfo("操作完成");
                                            this.RefreshData();
                                        }
                                        catch (Exception ex)
                                        {
                                            THOKUtil.ShowError("操作失败!Catch:" + ex.Message);
                                            this.VisibleWailt(false);
                                            return;
                                        }
                                    }
                                    else
                                    {
                                        THOKUtil.ShowError("RFID不匹配!请选择正确的货位,重新出库!");
                                        this.VisibleWailt(false);
                                        return;
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                THOKUtil.ShowError("执行浪潮confirmData失败!原因:" + ex.Message);
                                this.VisibleWailt(false);
                                return;
                            }
                        }
                        else
                        {
                            this.VisibleWailt(false);
                            return;
                        }
                    }
                    this.VisibleWailt(false);
                }
                catch (Exception ex)
                {
                    THOKUtil.ShowError("执行失败,原因:" + ex.Message);
                    this.VisibleWailt(false);
                    return;
                }
            }
            else
            {
                THOKUtil.ShowInfo("当前操作失败!原因:没有选择数据,请选择!");
                this.VisibleWailt(false);
                return;
            }
        }
예제 #3
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);
            }
        }