123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- 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.Make
- {
- public partial class Make_CollectLcd : Form
- {
- DataHelper dh;
- AutoSizeFormClass asc = new AutoSizeFormClass();
- LogStringBuilder sql = new LogStringBuilder();
- DataTable dt;
- //当前序列号记录
- string sn_code;
- //制造单号
- string macode;
- //采集网标号
- string net_code;
- //网标查询条件ms_id
- string oMsID;
- //判断是否输入网标
- Boolean isnetcode = false;
- //打印计数
- int printcount = 0;
- int ma_unlimitin;
- DataTable Dbfind;
- public Make_CollectLcd()
- {
- InitializeComponent();
- }
- private void Make_CollectNetCode_Load(object sender, EventArgs e)
- {
- //设置锁定工单
- LockMakeCode.GetMakeCodeCtl(ma_code);
- ma_code.SetLockCheckBox(LockMakeCode);
- asc.controllInitializeSize(this);
- //工单号放大镜配置
- ma_code.TableName = "make left join product on ma_prodcode=pr_code";
- ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,pr_detail # 产品名称";
- ma_code.FormName = Name;
- ma_code.SetValueField = new string[] { "ma_code", "pr_code", "pr_detail" };
- ma_code.Condition = "ma_statuscode='STARTED'";
- ma_code.DbChange += Ma_code_DbChange;
- sncode.Focus();
- dh = SystemInf.dh;
- }
- private void Ma_code_DbChange(object sender, EventArgs e)
- {
- Dbfind = ma_code.ReturnData;
- BaseUtil.SetFormValue(this.Controls, Dbfind);
- }
- private void sncode_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- if (ma_code.Text == "")
- {
- OperateResult.AppendText(">>工单号不可为空\n", Color.Red);
- return ;
- }
- if (!checkBox1.Checked && dh.CheckExist("lcdcheck", "lc_sncode = '" + sncode.Text + "' and lc_status = 0"))
- {
- OperateResult.AppendText(">>SN:"+sncode.Text+"已存在良品检验记录\n", Color.Red,sncode);
- return;
- }
- String status = radioButton1.Checked ? "0" : "-1";
- String statuscode = radioButton1.Checked ? "良品" : "不良";
- dh.ExecuteSql(" insert into lcdcheck(LC_ID,LC_SNCODE,LC_STATUS,LC_INDATE,LC_INMAN,LC_MAKECODE) values" +
- " (lcdcheck_seq.nextval,'" + sncode.Text+"','"+ status + "',sysdate,'"+User.UserCode+"','"+ma_code.Text+"') ", "insert");
- OperateResult.AppendText(">>SN:" + sncode.Text + "全捡采集"+ statuscode + "成功\n", Color.Green, sncode);
- }
- }
- private void Make_CollectNetCode_SizeChanged(object sender, EventArgs e)
- {
- asc.controlAutoSize(this);
- }
- private void Make_CollectNetCode_Activated(object sender, EventArgs e)
- {
- sncode.Focus();
- }
- /// <summary>
- /// 检验长度或者前缀是否合法
- /// </summary>
- /// <param name="checkbox"></param>
- /// <param name="c"></param>
- /// <param name="info"></param>
- private bool checkLengthOrPre(int psr_length, string psr_prefix, string TSNorSN)
- {
- //则判断输入转换前的序列号长度是否合法,不合法则提示
- if (sncode.Text.Trim().Length != psr_length && psr_length != 0)
- {
- //序列号校验错误,长度错误
- OperateResult.AppendText("<<" + TSNorSN + ":" + sncode.Text + "校验错误,长度错误\n", Color.Red, sncode);
- OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black);
- return false;
- }
- string[] pres = psr_prefix.Split('|');
- bool f = false;
- for (int i = 0; i < pres.Length; i++)
- {
- if (pres[i] == "" ? true : sncode.Text.StartsWith(pres[i]))
- {
- //满足其中一条即可
- f = true;
- break;
- }
- }
- //则判断输入转换前的序列号前缀是否合法,不合法则提示
- if (!f)
- {
- //序列号校验错误,前缀错误
- OperateResult.AppendText("<<" + TSNorSN + ":" + sncode.Text + "校验错误,前缀错误\n", Color.Red, sncode);
- OperateResult.AppendText(">>请重新输入" + TSNorSN + "\n", Color.Black);
- return false;
- }
- return true;
- }
- private void radioButton1_CheckedChanged(object sender, EventArgs e)
- {
- sncode.Focus();
- sncode.SelectAll();
- }
- private void checkBox1_CheckedChanged(object sender, EventArgs e)
- {
- sncode.Focus();
- sncode.SelectAll();
- }
- }
- }
|