123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using UAS_MES_NEW.DataOperate;
- using UAS_MES_NEW.Entity;
- using UAS_MES_NEW.PublicMethod;
- namespace UAS_MES_NEW.Special
- {
- public partial class Special_Collertion : Form
- {
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- AutoSizeFormClass asc = new AutoSizeFormClass();
- DataTable Dbfind;
- DataTable dt;
- List<String> sb = new List<string>();
- public Special_Collertion()
- {
- InitializeComponent();
- }
- private void Special_BoxSplit_Load(object sender, EventArgs e)
- {
-
- dh = SystemInf.dh;
- asc.controllInitializeSize(this);
- }
- private void Cd_stepcode_DbChange(object sender, EventArgs e)
- {
- BaseUtil.SetFormValue(this.Controls, Dbfind);
- }
- private void ReSN(string sncode)
- {
- sql.Clear();
- sql.Append("insert into RETURNSN select RETURNSN_seq.nextval,ms_sncode,ms_makecode,ms_prodcode,sysdate from makeserial where ms_sncode = '" + sncode + "'");
- dh.ExecuteSql(sql.GetString(), "insert");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "返工采集", "返工采集", sncode, "");
- }
- private void Split_Click(object sender, EventArgs e)
- {
- string Delete = MessageBox.Show(this.ParentForm, "是否确认返工采集?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
- if (Delete == "Yes")
- {
- if (serBtn.Checked)
- {
- for (int i = 0; i < sb.Count; i++)
- {
- ReSN(sb[i].ToString());
- OperatResult.AppendText("SN:" + sb[i].ToString()+ "采集完成\n", Color.Green);
- }
- WeighRecord.Clear();
- sb.Clear();
- num.Text = WeighRecord.Items.Count + "";
- }
- else if(bigboxBtn.Checked)
- {
- for (int i = 0; i < sb.Count; i++)
- {
- DataTable dt2 = (DataTable)dh.ExecuteSql("select ms_sncode from makeserial where ms_outboxcode = '" + sb[i].ToString() + "'", "select");
- for (int k = 0; k < dt2.Rows.Count; k++)
- {
- ReSN(dt2.Rows[k]["ms_sncode"].ToString());
- }
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "返工采集", "返工采集", sb[i].ToString(), "");
- OperatResult.AppendText("卡通箱:" + sb[i].ToString() + "采集完成\n", Color.Green);
- }
- WeighRecord.Clear();
- sb.Clear();
- num.Text = WeighRecord.Items.Count + "";
- }
- }
- }
- private void bigboxBtn_Click(object sender, EventArgs e)
- {
- if (((RadioButton)sender).Checked == true)
- {
- if (WeighRecord.Items.Count > 0)
- {
- string logout_confirm = MessageBox.Show(this.ParentForm, "是否更换采集项(已录入信息会清空)?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
- if (logout_confirm == "Yes")
- {
- WeighRecord.Items.Clear();
- sb.Clear();
- ms_makecode.Text = "";
- ms_prodcode.Text = "";
- }
- else
- {
- serBtn.Checked = bigboxBtn.Checked;
- bigboxBtn.Checked = !serBtn.Checked;
- }
- }
- if (((RadioButton)sender).Name == "serBtn")
- {
- input.Focus();
- OperatResult.AppendText("请输入序列号进行采集\n", Color.Black, input);
- }
- else if (((RadioButton)sender).Name == "bigboxBtn")
- {
- input.Focus();
- OperatResult.AppendText("请输入箱号进行采集\n", Color.Black, input);
- }
- }
- }
- private void input_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- if (serBtn.Checked)
- {
- dt = (DataTable)dh.ExecuteSql("select ms_makecode,ms_prodcode,ms_sncode,ms_craftcode cr_code,ms_status,ms_outboxcode from makeserial where ms_sncode = '" + input.Text + "'", "select");
- if (dt.Rows.Count > 0)
- {
- //if (ms_makecode.Text != "" && dt.Rows[0]["ms_makecode"].ToString() != ms_makecode.Text)
- //{
- // OperatResult.AppendText("SN:" + input.Text + "所属工单" + dt.Rows[0]["ms_makecode"].ToString() + "与当前工单" + ms_makecode.Text + "不一致\n", Color.Red, input);
- // return;
- //}
- if (dt.Rows[0]["ms_status"].ToString() == "3")
- {
- OperatResult.AppendText("SN:" + input.Text + "为不良品,不允许采集\n", Color.Red, input);
- return;
- }
- if (dt.Rows[0]["ms_outboxcode"].ToString() != "")
- {
- OperatResult.AppendText("SN:" + input.Text + "已装箱" + dt.Rows[0]["ms_outboxcode"].ToString() + ",不允许采集\n", Color.Red, input);
- return;
- }
- BaseUtil.SetFormValue(this.Controls, dt);
- if (sb.Contains(dt.Rows[0]["ms_sncode"].ToString()))
- {
- OperatResult.AppendText("SN:" + input.Text + "已采集\n", Color.Red, input);
- return;
- }
- WeighRecord.Items.Add(dt.Rows[0]["ms_sncode"].ToString());
- sb.Add(dt.Rows[0]["ms_sncode"].ToString());
- OperatResult.AppendText("SN:" + input.Text + "采集\n", Color.Green, input);
- num.Text = WeighRecord.Items.Count+"";
- }
- else
- {
- OperatResult.AppendText("SN:" + input.Text + "不存在\n", Color.Red, input);
- return;
- }
- }
- else if (bigboxBtn.Checked)
- {
- dt = (DataTable)dh.ExecuteSql("select pa_makecode ms_makecode,pa_prodcode ms_prodcode,pa_outboxcode,pa_mothercode,ma_craftcode cr_code from package left join make on pa_makecode = ma_code where pa_outboxcode = '"+input.Text+"' and pa_type = '1'", "select");
- if (dt.Rows.Count > 0)
- {
- //if (ms_makecode.Text != "" && dt.Rows[0]["ms_makecode"].ToString() != ms_makecode.Text)
- //{
- // OperatResult.AppendText("SN:" + input.Text + "所属工单" + dt.Rows[0]["ms_makecode"].ToString() + "与当前工单" + ms_makecode.Text + "不一致\n", Color.Red, input);
- // return;
- //}
- if (dt.Rows[0]["pa_mothercode"].ToString() != "")
- {
- OperatResult.AppendText("卡通箱:" + input.Text + "已装栈板" + dt.Rows[0]["pa_mothercode"].ToString() + ",不允许采集\n", Color.Red, input);
- return;
- }
- BaseUtil.SetFormValue(this.Controls, dt);
- if (sb.Contains(dt.Rows[0]["pa_outboxcode"].ToString()))
- {
- OperatResult.AppendText("卡通箱:" + input.Text + "已采集\n", Color.Red, input);
- return;
- }
- WeighRecord.Items.Add(dt.Rows[0]["pa_outboxcode"].ToString());
- sb.Add(dt.Rows[0]["pa_outboxcode"].ToString());
- OperatResult.AppendText("卡通箱:" + input.Text + "采集\n", Color.Green, input);
- num.Text = WeighRecord.Items.Count + "";
- }
- else
- {
- OperatResult.AppendText("卡通箱:" + input.Text + "不存在\n", Color.Red, input);
- return;
- }
- }
- }
- }
- private void 数据清空_Click(object sender, EventArgs e)
- {
- BaseUtil.CleanControls(this.Controls);
- WeighRecord.Items.Clear();
- sb.Clear();
- num.Text = WeighRecord.Items.Count + "";
- }
- }
- }
|