|
|
@@ -6,6 +6,8 @@ using System.Data;
|
|
|
using System.Drawing;
|
|
|
using System.Drawing.Printing;
|
|
|
using System.Linq;
|
|
|
+using System.Media;
|
|
|
+using System.Threading;
|
|
|
using System.Windows.Forms;
|
|
|
using static System.Runtime.CompilerServices.RuntimeHelpers;
|
|
|
|
|
|
@@ -110,6 +112,10 @@ namespace UAS_BARCODEIO
|
|
|
"where bi_inoutno='" + pi_inoutno.Text + "' group by pr_orispeccode,pr_brand) on pd_prodcode=bi_prodcode left join product on pr_code=pd_prodcode order by pr_code";
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
BaseUtil.FillDgvWithDataTable(Prodiodetail, dt);
|
|
|
+ if (Prodiodetail.Rows.Count > SelectIndex)
|
|
|
+ {
|
|
|
+ Prodiodetail.Rows[SelectIndex].Selected = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void Barcode_KeyDown(object sender, KeyEventArgs e)
|
|
|
@@ -120,6 +126,7 @@ namespace UAS_BARCODEIO
|
|
|
" on es_id=esd_esid where es_custcode='" + es_custcode.Text + "'", "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("无条码解析规则");
|
|
|
return;
|
|
|
}
|
|
|
@@ -128,6 +135,7 @@ namespace UAS_BARCODEIO
|
|
|
//分割后的字符串数组需要大于设置的参数解析
|
|
|
if (str.Length < dt.Rows.Count)
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("解析参数与解析规则不匹配");
|
|
|
return;
|
|
|
}
|
|
|
@@ -149,6 +157,9 @@ namespace UAS_BARCODEIO
|
|
|
case "QTY":
|
|
|
INQTY.Text = str[int.Parse(index) - 1];
|
|
|
break;
|
|
|
+ case "SCCODE":
|
|
|
+ SCCODE.Text = str[int.Parse(index) - 1];
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
@@ -157,12 +168,14 @@ namespace UAS_BARCODEIO
|
|
|
string outqty;
|
|
|
string lotno;
|
|
|
string spec;
|
|
|
- LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text,LOTNO.Text, out madedate, out outqty, out lotno,out spec);
|
|
|
+ LogicHandler.GetWeekData(DC.Text, INQTY.Text, es_custcode.Text.ToUpper(), pr_orispeccode3.Text, LOTNO.Text, out madedate, out outqty, out lotno, out spec);
|
|
|
DC.Text = madedate;
|
|
|
INQTY.Text = outqty;
|
|
|
LOTNO.Text = lotno;
|
|
|
pr_orispeccode3.Text = spec;
|
|
|
Barcode.Clear();
|
|
|
+ GenBarCode.PerformClick();
|
|
|
+ Play("OK");
|
|
|
}
|
|
|
}
|
|
|
bool AutoSized = false;
|
|
|
@@ -219,11 +232,13 @@ namespace UAS_BARCODEIO
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
if (dt.Rows.Count == 0)
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("物料不在对应入库单中" + pi_inoutno.Text);
|
|
|
return;
|
|
|
}
|
|
|
if (pr_orispeccode2.Text != pr_orispeccode3.Text)
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("解析型号和单据型号不对应");
|
|
|
return;
|
|
|
}
|
|
|
@@ -237,11 +252,13 @@ namespace UAS_BARCODEIO
|
|
|
int NowInqty = int.Parse(INQTY.Text);
|
|
|
if (!int.TryParse(ZXBZ.Text, out Minpackage))
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("最小包装数错误,料号" + PR_CODE.Text);
|
|
|
return;
|
|
|
}
|
|
|
if (int.Parse(INQTY.Text) > pdinqty - barqty)
|
|
|
{
|
|
|
+ Play("NG");
|
|
|
MessageBox.Show("物料采集后超出入库单数量" + PR_CODE.Text);
|
|
|
return;
|
|
|
}
|
|
|
@@ -258,6 +275,7 @@ namespace UAS_BARCODEIO
|
|
|
List<string> bi_barcode = new List<string>();
|
|
|
List<string> bi_vendbarcode = new List<string>();
|
|
|
List<string> bi_madedate = new List<string>();
|
|
|
+ List<string> bi_sccode = new List<string>();
|
|
|
for (int i = 0; i < barcount; i++)
|
|
|
{
|
|
|
string barcode = "";
|
|
|
@@ -286,12 +304,13 @@ namespace UAS_BARCODEIO
|
|
|
bi_barcode.Add(barcode);
|
|
|
bi_vendbarcode.Add(LOTNO.Text);
|
|
|
bi_madedate.Add(DC.Text);
|
|
|
+ bi_sccode.Add(SCCODE.Text);
|
|
|
}
|
|
|
sql = "insert into barcodeio(BI_ID, BI_BARCODE, BI_PIID, BI_PICLASS, BI_INOUTNO, BI_PDNO, BI_PDID, BI_PRODCODE, BI_INQTY,bi_vendbarcode, " +
|
|
|
- "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
|
|
|
- "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate,'" + outboxcode + "' " +
|
|
|
+ "BI_MADEDATE, BI_PRODID, BI_STATUS, BI_ORDERCODE, BI_INMAN, BI_INDATE,BI_OUTBOXCODE,bi_sccode)select barcodeio_seq.nextval,:bi_barcode,'" + pi_id + "'," +
|
|
|
+ "'" + pd_piclass + "','" + pi_inoutno.Text + "',0,0,'" + PR_CODE.Text + "',:bi_inqty,:bi_vendbarcode,to_date(:bi_madedate,'yyyy-mm-dd'),pr_id,0,'','管理员',sysdate,'" + outboxcode + "',:bi_sccode " +
|
|
|
" from product where pr_code='" + PR_CODE.Text + "'";
|
|
|
- dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray());
|
|
|
+ dh.BatchInsert(sql, new string[] { "bi_inqty", "bi_barcode", "bi_vendbarcode", "bi_madedate" , "bi_sccode" }, bi_barcode.ToArray(), bi_inqty.ToArray(), bi_vendbarcode.ToArray(), bi_madedate.ToArray(),bi_sccode.ToArray());
|
|
|
LoadGridData();
|
|
|
LoadBarcodeioData(PR_CODE.Text);
|
|
|
}
|
|
|
@@ -365,7 +384,7 @@ namespace UAS_BARCODEIO
|
|
|
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ int SelectIndex = 0;
|
|
|
private void Prodiodetail_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
|
{
|
|
|
if (Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString() != "")
|
|
|
@@ -376,6 +395,7 @@ namespace UAS_BARCODEIO
|
|
|
PR_CODE.Text = Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString();
|
|
|
pr_orispeccode2.Text = Prodiodetail.Rows[e.RowIndex].Cells["pr_orispeccode1"].Value.ToString();
|
|
|
LoadBarcodeioData(Prodiodetail.Rows[e.RowIndex].Cells["pd_prodcode"].Value.ToString());
|
|
|
+ SelectIndex = e.RowIndex;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -471,5 +491,42 @@ namespace UAS_BARCODEIO
|
|
|
}
|
|
|
LoadBarcodeioData(PR_CODE.Text);
|
|
|
}
|
|
|
+ Thread thread;
|
|
|
+ string FileName = "";
|
|
|
+ public void Play(string Type)
|
|
|
+ {
|
|
|
+ if (Type == "OK")
|
|
|
+ {
|
|
|
+ FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\8378.wav";
|
|
|
+ thread.Start();
|
|
|
+ thread = new Thread(PlaySound);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FileName = System.Windows.Forms.Application.StartupPath + @"\Resources\Sound\5185.wav";
|
|
|
+ thread.Start();
|
|
|
+ thread = new Thread(PlaySound);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void PlaySound()
|
|
|
+ {
|
|
|
+ //要加载COM组件:Microsoft speech object Library
|
|
|
+ if (!System.IO.File.Exists(FileName))
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ try
|
|
|
+ {
|
|
|
+ SoundPlayer player = new SoundPlayer();
|
|
|
+ player.SoundLocation = FileName;
|
|
|
+ player.Load();
|
|
|
+ player.Play();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ MessageBox.Show(e.Message);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|