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_LabelMachine.Entity; using UAS_LabelMachine.PublicMethod; namespace UAS_LabelMachine { public partial class 贴标角度设置 : Form { DataHelper dh = SystemInf.dh; string custcode; public 贴标角度设置(string CustCode) { custcode = CustCode; InitializeComponent(); } bool IninLoad = true; private void 附件内容打印_Load(object sender, EventArgs e) { Machine.Text = SystemInf.Machine; DataTable dt = (DataTable)dh.ExecuteSql("select * from PRINTXY where px_custcode='" + custcode + "' and px_machine='" + SystemInf.Machine + "'", "select"); if (dt.Rows.Count == 0) { dt = (DataTable)dh.ExecuteSql("select * from PRINTXY where px_custcode='" + custcode + "'", "select"); } if (dt.Rows.Count > 0) { X.Text = dt.Rows[0]["px_x"].ToString(); Y.Text = dt.Rows[0]["px_y"].ToString(); angle.Text = dt.Rows[0]["px_angle"].ToString(); switch (dt.Rows[0]["px_type"].ToString().ToUpper()) { case "TOP": Top.Checked = true; break; case "COVER": Cover.Checked = true; break; case "LEFT": Left.Checked = true; break; case "RIGHT": Right.Checked = true; break; case "BOTTOM": Bottom.Checked = true; break; default: break; } } IninLoad = false; } private void Confirm_Click(object sender, EventArgs e) { string Type = ""; if (Bottom.Checked) { Type = "Bottom"; } if (Top.Checked) { Type = "Top"; } if (Left.Checked) { Type = "Left"; } if (Right.Checked) { Type = "Right"; } if (Cover.Checked) { Type = "Cover"; } if (angle.Text == "" || X.Text == "" || Y.Text == "") { MessageBox.Show("参数必须都填写"); return; } if (dh.CheckExist("PRINTXY", "px_custcode='" + custcode + "' and px_machine='" + SystemInf.Machine + "'")) { dh.ExecuteSql("update PRINTXY set px_x='" + X.Text + "',px_y='" + Y.Text + "',px_angle='" + angle.Text + "',px_type='" + Type + "',px_machine='" + Machine.Text + "' where px_custcode='" + custcode + "' and px_machine='" + Machine.Text + "'", "update"); } else { dh.ExecuteSql("insert into PRINTXY (px_x,px_y,px_angle,px_custcode,px_type,px_machine)values('" + X.Text + "','" + Y.Text + "','" + angle.Text + "','" + custcode + "','" + Type + "','" + Machine.Text + "')", "insert"); } LogManager.DoCommandLog(custcode, User.UserCode, "保持贴标角度成功", "成功"); MessageBox.Show("保存成功"); Close(); } private void Button_CheckedChanged(object sender, EventArgs e) { if (!IninLoad) { RadioButton rad = (RadioButton)sender; switch (rad.Name.ToUpper()) { case "TOP": angle.Text = "0"; X.Text = "0"; Y.Text = "0"; break; case "COVER": angle.Text = "0"; X.Text = "0"; Y.Text = "0"; break; case "LEFT": angle.Text = "270"; X.Text = "0"; Y.Text = "-88"; break; case "RIGHT": angle.Text = "90"; X.Text = "0"; Y.Text = "-88"; break; case "BOTTOM": angle.Text = "0"; X.Text = "4"; Y.Text = "-88"; break; default: break; } } } } }