public virtual void AddSets() { DataGridView setDataGrid = CnasUtilityTools.FindControl <DataGridView>(this, "setDataGrid"); if (setDataGrid != null) { HCSWF_set_choose chooseDialog = new HCSWF_set_choose(PdCode); chooseDialog.ShowDialog(); if (chooseDialog.SelectItems != null) { setDataGrid.ClearSelection(); for (int i = 0; i < chooseDialog.SelectItems.Count; i++) { DataRow item = chooseDialog.SelectItems[i] as DataRow; bool isExist = false; foreach (DataGridViewRow row in setDataGrid.Rows) { if (setDataGrid.Columns.Contains("setBarCodeCol") && row.Cells["setBarCodeCol"] != null && row.Cells["setBarCodeCol"].Value != null && item["bar_code"] != null && row.Cells["setBarCodeCol"].Value.ToString() == item["bar_code"].ToString()) { isExist = true; row.Selected = isExist; break; } } if (!isExist) { int rowIndex = DataConverter.ConvertSetData(setDataGrid, item); setDataGrid.Rows[rowIndex].Selected = true; string bccCode = setDataGrid.Rows[rowIndex].Cells["setBarCodeCol"].Value.ToString(); string bcuCode = string.Empty; if (item.Table.Columns.Contains("bcuCode") && !(item["bcuCode"] is DBNull)) { bcuCode = item["bcuCode"].ToString(); } string key = string.IsNullOrEmpty(bcuCode) ? bccCode : CnasUtilityTools.ConcatTwoString(bcuCode, bccCode); if (!ScanBarCodes.ContainsKey(key)) { ScanBarCodes.Add(key, key.Substring(0, 3)); } } } TextBox setNumTxt = CnasUtilityTools.FindControl <TextBox>(this, "setNumTxt"); if (setNumTxt != null) { setNumTxt.Text = setDataGrid.RowCount.ToString(); } } } else { MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindSetGrid", EnumPromptMessage.error), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void PrintBCUCode() { if (WorkflowServer != null) { SortedList parameters = new SortedList(); if (string.IsNullOrEmpty(_bcuCode)) { _bcuCode = WorkflowServer.Get_BCU_Code(PdCode, Convert.ToString(setNameTxt.Tag)); } DateTime createDate = DateTime.Now; parameters.Add("BarcodeValue", _bcuCode); parameters.Add("P014", _bcuCode); parameters.Add("P017", _createDate.ToString("yyyy-MM-dd")); parameters.Add("P018", _createDate.AddDays(_expirationTime).ToString("yyyy-MM-dd")); parameters.Add("P019", userNameTxt.Text.Trim()); parameters.Add("P020", txtConfirmName.Text.Trim()); parameters.Add("P013", Convert.ToString(setNameTxt.Text)); parameters.Add("P016", Convert.ToString(useLocationTxt.Text)); string printResult = BarCodeHelper.PrintBarCode(_bcuCode, parameters); if (!string.IsNullOrEmpty(printResult)) { MessageBox.Show(printResult, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { _isPrintedBCU = true; } string key = CnasUtilityTools.ConcatTwoString(_bcuCode, Convert.ToString(setNameTxt.Tag)); if (ScanBarCodes.ContainsKey(Convert.ToString(setNameTxt.Tag))) { ScanBarCodes.Remove(Convert.ToString(setNameTxt.Tag)); } if (!ScanBarCodes.ContainsKey(key)) { ScanBarCodes.Add(key, "BCU"); } } }
public void AddOrders() { DataGridView setDataGrid = CnasUtilityTools.FindControl <DataGridView>(this, "setDataGrid"); if (setDataGrid != null) { HCSWF_order_choose orderChoose = new HCSWF_order_choose(PdCode); orderChoose.ShowDialog(); if (orderChoose.SelectItems != null) { setDataGrid.ClearSelection(); for (int i = 0; i < orderChoose.SelectItems.Count; i++) { DataRow item = orderChoose.SelectItems[i] as DataRow; bool isExist = false; foreach (DataGridViewRow row in setDataGrid.Rows) { if (row.Cells["setBarCodeCol"].Value != null && item["bar_code"] != null && row.Cells["setBarCodeCol"].Value.ToString() == item["bar_code"].ToString()) { isExist = true; row.Selected = isExist; break; } } if (!isExist) { int rowIndex = setDataGrid.Rows.Add(); if (item.Table.Columns.Contains("id") && setDataGrid.Columns.Contains("setIdCol")) { setDataGrid.Rows[rowIndex].Cells["setIdCol"].Value = item["id"]; } if (item.Table.Columns.Contains("bar_code") && setDataGrid.Columns.Contains("setBarCodeCol")) { setDataGrid.Rows[rowIndex].Cells["setBarCodeCol"].Value = item["bar_code"]; } if (item.Table.Columns.Contains("ca_name") && setDataGrid.Columns.Contains("setNameCol")) { setDataGrid.Rows[rowIndex].Cells["setNameCol"].Value = item["ca_name"]; } if (item.Table.Columns.Contains("order_type") && setDataGrid.Columns.Contains("setTypeCol")) { setDataGrid.Rows[rowIndex].Cells["setTypeCol"].Value = item["order_type"]; } if (item.Table.Columns.Contains("pa_priorty") && setDataGrid.Columns.Contains("setPriortyCol")) { setDataGrid.Rows[rowIndex].Cells["setPriortyCol"].Value = item["pa_priorty"]; } if (item.Table.Columns.Contains("location_name") && setDataGrid.Columns.Contains("setUseLoCol")) { setDataGrid.Rows[rowIndex].Cells["setUseLoCol"].Value = item["location_name"]; } setDataGrid.Rows[rowIndex].Tag = item; setDataGrid.Rows[rowIndex].Selected = true; string bccCode = setDataGrid.Rows[rowIndex].Cells["setBarCodeCol"].Value.ToString(); string bcuCode = string.Empty; if (item.Table.Columns.Contains("bcuCode") && !(item["bcuCode"] is DBNull)) { bcuCode = item["bcuCode"].ToString(); } string key = string.IsNullOrEmpty(bcuCode) ? bccCode : CnasUtilityTools.ConcatTwoString(bcuCode, bccCode); if (!ScanBarCodes.ContainsKey(key)) { ScanBarCodes.Add(key, key.Substring(0, 3)); } } } TextBox setNumTxt = CnasUtilityTools.FindControl <TextBox>(this, "setNumTxt"); if (setNumTxt != null) { setNumTxt.Text = setDataGrid.RowCount.ToString(); } } } }