From b532ba8806996246ab7a0896bf34b884c47dee7e Mon Sep 17 00:00:00 2001
From: xiaojiao <xiaojiao@kaokeziliao.com>
Date: 星期二, 14 四月 2026 14:06:25 +0800
Subject: [PATCH] 试生产版本
---
项目代码/打印机/WindowsFormsApp6/WindowsFormsApp6/Form1.cs | 59 ++++++++++++++++++++++++++++++++++++++++-------------------
1 files changed, 40 insertions(+), 19 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\346\211\223\345\215\260\346\234\272/WindowsFormsApp6/WindowsFormsApp6/Form1.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\346\211\223\345\215\260\346\234\272/WindowsFormsApp6/WindowsFormsApp6/Form1.cs"
index 4527be1..73b9560 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\346\211\223\345\215\260\346\234\272/WindowsFormsApp6/WindowsFormsApp6/Form1.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\346\211\223\345\215\260\346\234\272/WindowsFormsApp6/WindowsFormsApp6/Form1.cs"
@@ -28,6 +28,23 @@
InitializeComponent();
// 鏂板杩欒锛氳缃瓻PPlus鐨勮鍙瘉涓婁笅鏂�
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
+ try
+ {
+ // 璇诲彇鏂囦欢鎵�鏈夎
+ string[] lines = System.IO.File.ReadAllLines("D:\\鎵撳嵃鏈鸿溅鍨嬭酱鎵垮搧鐗屼笅鎷夋鏂囦欢澶筡\杞﹀瀷.txt");
+ string[] lines2 = System.IO.File.ReadAllLines("D:\\鎵撳嵃鏈鸿溅鍨嬭酱鎵垮搧鐗屼笅鎷夋鏂囦欢澶筡\杞存壙鍨嬪彿.txt");
+ string[] lines3 = System.IO.File.ReadAllLines("D:\\鎵撳嵃鏈鸿溅鍨嬭酱鎵垮搧鐗屼笅鎷夋鏂囦欢澶筡\杞存壙鍝佺墝.txt");
+
+ // 娣诲姞鍒颁笅鎷夋
+ this.comboBox3.Items.AddRange(lines2);
+ this.comboBox2.Items.AddRange(lines);
+ this.comboBox4.Items.AddRange(lines3);
+ }
+ catch (Exception ex)
+ {
+ // 璇诲彇澶辫触鏃舵彁绀�
+ MessageBox.Show("璇诲彇鏂囦欢澶辫触锛�" + ex.Message);
+ }
}
private void btn_print_Click(object sender, EventArgs e)
@@ -41,7 +58,7 @@
// MessageBox.Show("璇疯緭鍏ユ墦鍗版暟鎹�", "鎻愮ず", MessageBoxButtons.OKCancel);
// return;
//}
- Dictionary<string,string> printData = GetInputTxtData();
+ Dictionary<string, string> printData = GetInputTxtData();
//if (printData.Count == 0)
//{
@@ -49,12 +66,21 @@
// return;
//}
+
if (isInputError)
{
MessageBox.Show("杈撳叆鏁版嵁鏈夎鎴栬�呬笉瀹屾暣,璇峰厛妫�鏌ュ悗鍐嶆墦鍗�", "鎻愮ず", MessageBoxButtons.OK);
return;
}
+ // 杩欓噷鍋氫笅鎷夋鐨勭粦瀹�
+ if (comboBox1.Text == "" || comboBox2.Text == ""
+ || comboBox3.Text == "" || comboBox4.Text == ""
+ || textBox1.Text.Trim() == "" || textBox3.Text.Trim() == "")
+ {
+ MessageBox.Show("杈撳叆鏁版嵁鏈夎鎴栬�呬笉瀹屾暣,璇峰厛妫�鏌ュ悗鍐嶆墦鍗�", "鎻愮ず", MessageBoxButtons.OK);
+ return;
+ }
//string MFile = ReportPath + "\\FRX\\wl.frx";//FastReport璁捐鍚庣殑鏂囦欢淇濆瓨鐨勮矾寰勩��
// 鏇挎崲鍘熸潵鐨� string MFile = ReportPath + "\\FRX\\wl.frx";
string MFile = Path.Combine(ReportPath, "FRX", "wl.frx");
@@ -138,12 +164,13 @@
string Row = "{";
Row += "'杞存壙鏉$爜':"+$"'{Txt_barcode1.Text}',";
- Row += "'杞﹀瀷':"+$"'{Txt_barcode2.Text}',";
- Row += "'杞存壙鍨嬪彿':"+$"'{Txt_barcode3.Text}',";
- Row += "'鍘傚':"+$"'{Txt_barcode4.Text}',";
+ Row += "'杞﹀瀷':"+$"'{comboBox2.Text}',";
+ Row += "'杞存壙鍨嬪彿':"+$"'{comboBox3.Text}',";
+ Row += "'杞存壙鍝佺墝':"+$"'{comboBox4.Text}',";
Row += "'杞存壙绫诲埆':"+$"'{comboBox1.Text}',";
- Row += "'杞存壙鍗曞彿':"+$"'{Txt_barcode6.Text}',";
-
+ Row += "'杞存壙鎵规鍙�':"+$"'{textBox1.Text}',";
+ Row += "'杞存壙閲嶉噺':" + $"'{textBox2.Text}',";
+ Row += "'鏃ユ湡':" + $"'{textBox3.Text}',";
Row += "}";
partCode.Add(Txt_barcode1.Text, Row);
@@ -167,11 +194,6 @@
{
errorProvider1.SetError(textBox, ""); // 娓呴櫎閿欒鎻愮ず
isInputError = false;
- }
-
- if (comboBox1.Text == "")
- {
- isInputError = true;
}
}
@@ -264,11 +286,13 @@
{
//杞藉叆鏃朵负姣忎釜杈撳叆妗� 璁㈤槄鏂囨湰鏍¢獙浜嬩欢
Txt_barcode1.Validating += new CancelEventHandler(Validaltetion);
- Txt_barcode2.Validating += new CancelEventHandler(Validaltetion);
- Txt_barcode3.Validating += new CancelEventHandler(Validaltetion);
- Txt_barcode4.Validating += new CancelEventHandler(Validaltetion);
+ //Txt_barcode2.Validating += new CancelEventHandler(Validaltetion);
+ //Txt_barcode3.Validating += new CancelEventHandler(Validaltetion);
+ //Txt_barcode4.Validating += new CancelEventHandler(Validaltetion);
+ textBox1.Validating += new CancelEventHandler(Validaltetion);
+ textBox2.Validating += new CancelEventHandler(Validaltetion);
//Txt_barcode5.Validating += new CancelEventHandler(ValidateTextBox);
- Txt_barcode6.Validating += new CancelEventHandler(Validaltetion);
+ //Txt_barcode6.Validating += new CancelEventHandler(Validaltetion);
//Txt_barcode7.Validating += new CancelEventHandler(ValidateTextBox);
//Txt_barcode8.Validating += new CancelEventHandler(ValidateTextBox);
//Txt_barcode9.Validating += new CancelEventHandler(ValidateTextBox);
@@ -518,10 +542,7 @@
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
- if(comboBox1.Text != "")
- {
- isInputError = false;
- }
+
}
private void groupBox2_Enter(object sender, EventArgs e)
--
Gitblit v1.9.3