|
|
@@ -192,38 +192,64 @@ namespace UAS_MES_Tools
|
|
|
PlaySound("OK");
|
|
|
Datas.FirstDisplayedScrollingRowIndex = Datas.Rows.Count - 1;
|
|
|
|
|
|
- if (ChangeDetail())
|
|
|
- {
|
|
|
- SN.Text = "";
|
|
|
- BoxNo.Text = "";
|
|
|
- dCount.Text = "0";
|
|
|
- Datas.Rows.Clear();
|
|
|
- BoxNo.Focus();
|
|
|
- BoxNo.SelectAll();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ int typeNum = ChangeDetail(row);
|
|
|
+ if (typeNum == 1)
|
|
|
+ {
|
|
|
+ SN.Focus();
|
|
|
+ SN.SelectAll();
|
|
|
+ }
|
|
|
+ else if (typeNum == 2)
|
|
|
+ {
|
|
|
+ SN.Text = "";
|
|
|
+ //BoxNo.Text = "";
|
|
|
+ dCount.Text = "0";
|
|
|
+ Datas.Rows.Clear();
|
|
|
+ BoxNo.Focus();
|
|
|
+ BoxNo.SelectAll();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ MessageBox.Show(ex.Message, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
+ return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private bool ChangeDetail()
|
|
|
+ private int ChangeDetail(DataGridViewRow row)
|
|
|
{
|
|
|
int inputSum = Convert.ToInt32(dCount.Text);
|
|
|
dCount.Text = (inputSum + 1).ToString();
|
|
|
-
|
|
|
- if(Convert.ToInt32(dCount.Text) == Convert.ToInt32(dSum.Text))
|
|
|
+ int insertCount = ConnectDB.ExecuteInsert($@"INSERT INTO g_packing_sncheck (work_order,part_no,sn,outbox_no,
|
|
|
+ count,update_time,update_name,check_id,rule_name,rule_value,capacity)
|
|
|
+ VALUES ( '', '', '{row.Cells[0].Value}', '{row.Cells[1].Value}',
|
|
|
+ '{row.Cells[2].Value}',sysdate,'{_UserName}',packcheckid_seq.NEXTVAL,'{dRules.Text.Trim()}','{curRule}','{dSum.Text}' )");
|
|
|
+ if (Convert.ToInt32(dCount.Text) < Convert.ToInt32(dSum.Text))
|
|
|
{
|
|
|
- foreach (DataGridViewRow item in Datas.Rows)
|
|
|
- {
|
|
|
- int insertCount = ConnectDB.ExecuteInsert($@"INSERT INTO g_packing_sncheck (work_order,part_no,sn,outbox_no,
|
|
|
- count,update_time,update_name,check_id,rule_name,rule_value)
|
|
|
- VALUES ( '', '', '{item.Cells[0].Value}', '{item.Cells[1].Value}',
|
|
|
- '{item.Cells[2].Value}',sysdate,'{_UserName}',packcheckid_seq.NEXTVAL,'{dRules.Text.Trim()}','{curRule}' )");
|
|
|
- }
|
|
|
- return true;
|
|
|
+ return 1;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- return false;
|
|
|
+ return 2;
|
|
|
}
|
|
|
+
|
|
|
+ //if(Convert.ToInt32(dCount.Text) == Convert.ToInt32(dSum.Text))
|
|
|
+ //{
|
|
|
+ // foreach (DataGridViewRow item in Datas.Rows)
|
|
|
+ // {
|
|
|
+ // int insertCount = ConnectDB.ExecuteInsert($@"INSERT INTO g_packing_sncheck (work_order,part_no,sn,outbox_no,
|
|
|
+ // count,update_time,update_name,check_id,rule_name,rule_value)
|
|
|
+ // VALUES ( '', '', '{item.Cells[0].Value}', '{item.Cells[1].Value}',
|
|
|
+ // '{item.Cells[2].Value}',sysdate,'{_UserName}',packcheckid_seq.NEXTVAL,'{dRules.Text.Trim()}','{curRule}' )");
|
|
|
+ // }
|
|
|
+ // return true;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // return false;
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private void BoxNo_KeyDown(object sender, KeyEventArgs e)
|