| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- using HslCommunication.Profinet.Knx;
- using System;
- using System.Data;
- using System.Drawing;
- 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_ActiveSN : Form
- {
- DataHelper dh;
- LogStringBuilder sql = new LogStringBuilder();
- DataTable Dbfind;
- public Special_ActiveSN()
- {
- InitializeComponent();
- }
- private void Special_BoxSplit_Load(object sender, EventArgs e)
- {
- dh = SystemInf.dh;
- }
- string ms_id = "";
- private void SaveRepairInf_Click(object sender, EventArgs e)
- {
- if (ms_id == "") { OperateResult.AppendText(">>请先获取SN\n"); return; }
- DataTable dt = (DataTable)dh.ExecuteSql("select ms_sncode,ms_makecode,ms_outboxcode,nvl(ms_isactive,0)ms_isactive,ms_status,ms_id,ms_paststep,ms_craftcode,ms_prodcode,ms_checkno from makeserial where ms_sncode='" + SN.Text + "' order by ms_id desc", "select");
- string ms_makecode = dt.Rows[0]["ms_makecode"].ToString();
- string ms_sncode = dt.Rows[0]["ms_sncode"].ToString();
- string ms_outboxcode = dt.Rows[0]["ms_outboxcode"].ToString();
- if (ms_outboxcode != "")
- {
- OperateResult.AppendText(">>序列号已经装箱" + ms_outboxcode + "\n"); return;
- }
- dh.ExecuteSql("update makeserial set MS_ISACTIVE=-1 where ms_id='" + ms_id + "'", "update");
- LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode, User.UserLineCode, User.UserSourceCode, "SN激活", "SN激活成功", ms_sncode, "");
- OperateResult.AppendText(">>" + SN.Text + "激活成功\n");
- //cr_code.Text = "";
- //cd_stepcode.Text = "";
- SN.Text = "";
- ms_id = "";
- }
- private void SN_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- DataTable dt = (DataTable)dh.ExecuteSql("select nvl(ms_isactive,0)ms_isactive,ms_status,ms_id,ms_paststep,ms_craftcode,ms_prodcode,ms_checkno from makeserial where ms_sncode='" + SN.Text + "' order by ms_id desc", "select");
- ms_id = "";
- if (dt.Rows.Count == 0) { OperateResult.AppendText(">>" + SN.Text + "不存在\n", System.Drawing.Color.Red, SN); return; }
- ms_id = dt.Rows[0]["ms_id"].ToString();
- string ms_isactive = dt.Rows[0]["ms_isactive"].ToString();
- string ms_status = dt.Rows[0]["ms_status"].ToString();
- if (ms_isactive == "-1") { OperateResult.AppendText(">>" + SN.Text + "已激活\n", System.Drawing.Color.Red, SN); return; }
- if (ms_status == "3") { OperateResult.AppendText(">>" + SN.Text + "处于待维修状态,不允许激活\n", System.Drawing.Color.Red, SN); return; }
- }
- }
- }
- }
|