using NPOI.SS.Formula.Functions; using System; using System.Data; using System.Drawing; 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_BoxLotRelease : Form { DataHelper dh; AutoSizeFormClass asc = new AutoSizeFormClass(); LogStringBuilder sql = new LogStringBuilder(); DataTable dt; public Make_BoxLotRelease() { InitializeComponent(); } private void Make_CollectNetCode_Load(object sender, EventArgs e) { asc.controllInitializeSize(this); sncode.Focus(); dh = SystemInf.dh; ma_code.TableName = "make left join product on ma_prodcode=pr_code"; ma_code.SelectField = "ma_code # 工单号,pr_code # 产品编号,pr_detail # 产品名称,ma_craftcode # 途程编号,ma_wccode # 工作中心"; ma_code.FormName = Name; ma_code.SetValueField = new string[] { "ma_code", "pr_code", "pr_detail", "ma_craftcode", "ma_wccode" }; ma_code.Condition = "ma_statuscode='STARTED'"; ma_code.DbChange += Ma_code_DbChange; } DataTable Dbfind; 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; } sql.Clear(); sql.Append("select cd_id,nvl(CD_IFPACK,0)CD_IFPACK from craft left join craftdetail on cd_crid=cr_id where cr_code='" + ma_craftcode.Text + "' "); sql.Append("and cr_prodcode='" + pr_code.Text + "' and nvl(CD_IFPACK,0)<>0 and cd_stepcode='" + User.CurrentStepCode + "'"); dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select"); if (dt.Rows.Count == 0) { OperateResult.AppendText(">>只允许包装工序解绑箱号,请切换资源编号\n", Color.Red); return; } string makecode = dh.getFieldDataByCondition("makeserial", "ms_makecode", "ms_boxcode='" + sncode.Text + "'").ToString(); if (makecode == "") { OperateResult.AppendText(">>工装篮" + sncode.Text + "未绑定产品\n", Color.Red); return; } dh.ExecuteSql("update makeserial set ms_boxcode='' where ms_boxcode='" + sncode.Text + "'", "update"); OperateResult.AppendText(">>绑定工装篮" + sncode.Text + "解绑成功\n", Color.Green); sncode.Text = ""; } } private void Make_CollectNetCode_SizeChanged(object sender, EventArgs e) { asc.controlAutoSize(this); } private void Make_CollectNetCode_Activated(object sender, EventArgs e) { sncode.Focus(); } } }