Esempio n. 1
0
 private void printPBCodeBtn_Click(object sender, EventArgs e)
 {
     if (mainTab.SelectedIndex == 0)
     {
         if (dgv_temp.SelectedRows != null && dgv_temp.SelectedRows.Count > 0)
         {
             string     barCode   = Convert.ToString(dgv_temp.SelectedRows[0].Cells["tset_code"].Value);
             string     setName   = Convert.ToString(dgv_temp.SelectedRows[0].Cells["tca_name"].Value);
             SortedList parameter = new SortedList();
             parameter.Add("P013", setName);
             if (!string.IsNullOrEmpty(barCode))
             {
                 BarCodeHelper.PrintBarCode(barCode, parameter);
             }
         }
     }
     else if (mainTab.SelectedIndex == 2)
     {
         if (dgv_base.SelectedRows != null && dgv_base.SelectedRows.Count > 0)
         {
             string     barCode   = Convert.ToString(dgv_base.SelectedRows[0].Cells["BCU_code"].Value);
             string     setName   = Convert.ToString(dgv_base.SelectedRows[0].Cells["ca_name"].Value);
             SortedList parameter = new SortedList();
             parameter.Add("P013", setName);
             if (!string.IsNullOrEmpty(barCode))
             {
                 BarCodeHelper.PrintBarCode(barCode, parameter);
             }
         }
     }
 }
        private void but_print_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv_01.CurrentRow == null)
                {
                    MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("selectPrintData", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                int ii = dgv_01.Rows.Count;
                for (int i = 0; i < ii; i++)
                {
                    if (dgv_01.Rows[i].Cells["select"].Value != null && (bool)dgv_01.Rows[i].Cells["select"].Value == true)
                    {
                        string barCode = dgv_01.Rows[i].Cells["bar_code"].Value != null ?
                                         dgv_01.Rows[i].Cells["bar_code"].Value.ToString() : string.Empty;
                        string codeName = dgv_01.Rows[i].Cells["ca_name"].Value != null ?
                                          dgv_01.Rows[i].Cells["ca_name"].Value.ToString() : string.Empty;
                        SortedList parameters = new SortedList();
                        parameters.Add("BarcodeValue", barCode);
                        parameters.Add("P013", codeName);

                        string printResult = BarCodeHelper.PrintBarCode(barCode, parameters);
                    }
                }
                //获得当前选择行数据
                //string barCode = dgv_01.CurrentRow.Cells["bar_code"].Value != null ?
                //	dgv_01.CurrentRow.Cells["bar_code"].Value.ToString() : string.Empty;
                //string codeName = dgv_01.CurrentRow.Cells["ca_name"].Value != null ?
                //	dgv_01.CurrentRow.Cells["ca_name"].Value.ToString() : string.Empty;

                //if (!string.IsNullOrEmpty(barCode))
                //{
                //	SortedList parameters = new SortedList();
                //	parameters.Add("BarcodeValue", barCode);
                //	parameters.Add("Value", codeName);

                //	string printResult = BarCodeHelper.PrintBarCode(barCode, parameters);
                //	if (!string.IsNullOrEmpty(printResult))
                //		MessageBox.Show(printResult, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //}
                //else
                //{
                //	MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("invalidatecode", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 打印BCU生产条码
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void tsm_bcuprint_Click(object sender, EventArgs e)
 {
     if (dgv_01.CurrentRow != null)
     {
         DataGridViewRow row      = dgv_01.CurrentRow;
         string          bcc_code = Convert.ToString(row.Cells["set_code"].Value);
         if (!string.IsNullOrEmpty(bcc_code))
         {
             CnasRemotCall RemoteClient = new CnasRemotCall();
             SortedList    condition    = new SortedList();
             condition.Add(1, bcc_code);
             string    testSql = RemoteClient.RemotInterface.CheckSelectData("HCS-work-set-sec006", condition);
             DataTable data    = RemoteClient.RemotInterface.SelectData("HCS-work-set-sec006", condition);
             if (data != null && data.Rows.Count > 0)
             {
                 SortedList sl_par01    = new SortedList();
                 string     BCUCode     = Convert.ToString(data.Rows[0]["BCU_code"]);
                 string     confirmName = Convert.ToString(data.Rows[0]["confirmName"]);
                 string     userName    = Convert.ToString(data.Rows[0]["userName"]);
                 DateTime   createDate  = DateTime.Now;
                 DateTime.TryParse(data.Rows[0]["generateDate"].ToString(), out createDate);
                 int expireDuration = 7;
                 int.TryParse(data.Rows[0]["expiration"].ToString(), out expireDuration);
                 sl_par01.Add("BarcodeValue", BCUCode);
                 sl_par01.Add("P014", BCUCode);
                 sl_par01.Add("P017", createDate.ToString("yyyy-MM-dd"));
                 sl_par01.Add("P018", createDate.AddDays(expireDuration).ToString("yyyy-MM-dd"));
                 sl_par01.Add("P019", userName);
                 sl_par01.Add("P020", confirmName);
                 sl_par01.Add("P013", Convert.ToString(data.Rows[0]["set_name"]));
                 sl_par01.Add("P016", Convert.ToString(data.Rows[0]["locationName"]));
                 string printResult = BarCodeHelper.PrintBarCode(BCUCode, sl_par01);
                 if (!string.IsNullOrEmpty(printResult))
                 {
                     MessageBox.Show(printResult, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
             else
             {
                 MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("notfindBCU", EnumPromptMessage.warning),
                                 "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
Esempio n. 4
0
        private void but_print_Click(object sender, EventArgs e)
        {
            string str_barcode = Interaction.InputBox("请输入条码字符串", "条码打印", "", 400, 300);

            if (str_barcode.Length == 13)
            {
                string str_bcx = str_barcode.Substring(0, 3);
                if (sl_bctype[str_bcx] != null)
                {
                    SortedList sltmp = new SortedList();
                    sltmp.Add("BarcodeValue", str_barcode);
                    string printResult = BarCodeHelper.PrintBarCode(str_barcode, sltmp);
                    if (!string.IsNullOrEmpty(printResult))
                    {
                        MessageBox.Show(printResult, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 依据datagrid打印
        /// </summary>
        private void OnPrintButtonClick()
        {
            if (!string.IsNullOrEmpty(ValidateData()))
            {
                return;
            }
            if (dataGrid.RowCount <= 0)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("nothavedata", EnumPromptMessage.warning), "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            DataRow[] arrayDR02     = CnasBaseData.SystemBaseData.Select("type_code='HCS_barcode_type' and key_code='BCU'");
            string    strbarcodexml = arrayDR02[0]["other_code"].ToString().Trim();

            try
            {
                foreach (DataGridViewRow item in dataGrid.Rows)
                {
                    SortedList parameters = new SortedList();
                    string     bcuCode    = item.Cells["pbCodeCol"].Value != null ? item.Cells["pbCodeCol"].Value.ToString() : string.Empty;
                    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", packUserTxt.Text.Trim());
                    parameters.Add("P020", cfmUserTxt.Text.Trim());
                    parameters.Add("P013", Convert.ToString(item.Cells["setNameCol"].Value.ToString()));
                    parameters.Add("P016", Convert.ToString(item.Cells["useLocationCol"].Value.ToString()));
                    string printResult = BarCodeHelper.PrintBarCode(bcuCode, parameters);
                    if (!string.IsNullOrEmpty(printResult))
                    {
                        MessageBox.Show(printResult, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 6
0
        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");
                }
            }
        }
Esempio n. 7
0
        private void but_print_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgv_01.SelectedRows.Count == 0)
                {
                    MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("selectPrintData", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }
                //获得当前选择行数据
                string barCode = dgv_01.CurrentRow.Cells["u_barcode"].Value != null ?
                                 dgv_01.CurrentRow.Cells["u_barcode"].Value.ToString() : string.Empty;
                string codeName = dgv_01.CurrentRow.Cells["u_uname"].Value != null ?
                                  dgv_01.CurrentRow.Cells["u_uname"].Value.ToString() : string.Empty;

                if (!string.IsNullOrEmpty(barCode))
                {
                    SortedList parameters = new SortedList();
                    parameters.Add("BarcodeValue", barCode);
                    parameters.Add("Value", codeName);

                    string printResult = BarCodeHelper.PrintBarCode(barCode, parameters);
                    if (!string.IsNullOrEmpty(printResult))
                    {
                        MessageBox.Show(printResult, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("invalidatecode", EnumPromptMessage.warning), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("unknowerror", EnumPromptMessage.error, new string[] { ex.Message }), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }