//确认 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; } }
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); } }
//ȷ�� 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; } }
//确认 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); } }
//ȷ�� 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); } }
private void btnNext_Click(object sender, EventArgs e) { if (dataGrid1.DataSource != null) { string bb_area_type = dataGrid1[dataGrid1.CurrentRowIndex, 18].ToString(); //0:��������,1:�������,2:�������� if (bb_area_type == "0") { DataSet ds = GenerateEmptyTables(); DataRow detailRow = ds.Tables["DETAIL"].NewRow(); //������Ϣ detailRow["bb_result_info"] = "0"; detailRow["bb_type"] = billString; detailRow["bb_order_id"] = dataGrid1[dataGrid1.CurrentRowIndex, 2].ToString(); detailRow["bb_pda_device_id"] = "PDA"; detailRow["bb_confirmor_name"] = "PDA"; detailRow["bb_confirm_date"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); detailRow["bb_corporation_id"] = dataGrid1[dataGrid1.CurrentRowIndex, 6].ToString(); detailRow["bb_corporation_name"] = dataGrid1[dataGrid1.CurrentRowIndex, 7].ToString(); //ϸ����Ϣ detailRow["bb_detail_id"] = dataGrid1[dataGrid1.CurrentRowIndex, 8].ToString(); detailRow["bb_operate_type"] = dataGrid1[dataGrid1.CurrentRowIndex,9].ToString(); detailRow["bb_pallet_move_flg"] = dataGrid1[dataGrid1.CurrentRowIndex, 10].ToString(); detailRow["bb_cargo_no"] = dataGrid1[dataGrid1.CurrentRowIndex, 11].ToString(); if (billType == "1") { detailRow["bb_pallet_no"] = "getRFID()";//�˱�ǩ��ΪRFID����ֵ } else { detailRow["bb_pallet_no"] = dataGrid1[dataGrid1.CurrentRowIndex, 12].ToString(); } detailRow["bb_brand_id"] = dataGrid1[dataGrid1.CurrentRowIndex, 13].ToString(); detailRow["bb_brand_name"] = dataGrid1[dataGrid1.CurrentRowIndex, 14].ToString(); detailRow["bb_handle_num"] = Convert.ToDecimal(dataGrid1[dataGrid1.CurrentRowIndex, 15].ToString()); detailRow["bb_inventory_num"] = Convert.ToDecimal(dataGrid1[dataGrid1.CurrentRowIndex, 16].ToString()); detailRow["bb_unit"] = dataGrid1[dataGrid1.CurrentRowIndex, 17].ToString(); detailRow["bb_operator_name"] = "PDA"; detailRow["bb_operate_date"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ConfirmDialog confirmForm = new ConfirmDialog(billType, dataGrid1[dataGrid1.CurrentRowIndex, 11].ToString(), dataGrid1[dataGrid1.CurrentRowIndex, 11].ToString(), dataGrid1[dataGrid1.CurrentRowIndex, 9].ToString(), dataGrid1[dataGrid1.CurrentRowIndex, 14].ToString()); confirmForm.Piece = Convert.ToInt32(dataGrid1[dataGrid1.CurrentRowIndex, 15].ToString()); confirmForm.Bar = 0; if (confirmForm.ShowDialog() == DialogResult.OK) { if (billType == "2") { detailRow["bb_inventory_num"] = confirmForm.Piece; } ds.Tables["DETAIL"].Rows.Add(detailRow); try { if (billType == "1") { waveData.confirmData(ds.Tables["DETAIL"], billType); } else { if (detailRow["bb_pallet_no"].ToString() == "" || detailRow["bb_pallet_no"].ToString() == null) { try { waveData.confirmData(ds.Tables["DETAIL"], billType); MessageBox.Show("�������"); this.RefreshData(); } catch (Exception ex) { MessageBox.Show("����ʧ�ܣ�Catch��" + ex.Message); return; } } else { MessageBox.Show("RFID��ƥ�䣡��ѡ����ȷ�Ļ�λ�����³��⣡"); return; } } } catch (Exception ex) { MessageBox.Show("ִ���˳�confirmDataʧ�ܣ�ԭ��" + ex.Message); return; } } } } }