123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- 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;
- }
- }
- }
- }
- }
|