using Core.Mes.Client.Comm.Server; using CoreFS.CA06; 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; namespace Core.StlMes.Client.ZGMil.NodeResultQuery { public partial class ColNoChanges : FrmBase { private OpeBase ob; public OpeBase Ob { get { return ob; } set { ob = value; } } private string node = ""; private string colno = ""; private string HeatNo = "";//炉号 private string proPlanId = null;//轧管订单编号 private string gxPlanNo = null;//工序排产序号 private string PlineCode = "";//产线 private string StrColNofrom = ""; private string StrColNoto = ""; private int Num = 0;//调整支数 private int Num1 = 0;//可调整支数 private int Num2 = 0; private int Num3 = 0; private int TsNum = 0; public ColNoChanges() { //InitializeComponent(); } public ColNoChanges(OpeBase ob, string Node, string heatno, string plinecode, string ProPlanId, string GxPlanNo) { InitializeComponent(); this.Ob = ob; this.HeatNo = heatno; this.PlineCode = plinecode; this.proPlanId = ProPlanId; this.gxPlanNo = GxPlanNo; this.node = Node.Substring(0, 1); this.colno = Node.Substring(1, 1); this.ColNofrom.Items.Add("1#"); this.ColNofrom.Items.Add("2#"); this.ColNoTo.Items.Add("1#"); this.ColNoTo.Items.Add("2#"); if (this.PlineCode.Equals("C010")) { this.ColNofrom.Items.Add("3#"); this.ColNoTo.Items.Add("3#"); } this.ColNofrom.Text = "1#"; this.ColNoTo.Text = "2#"; RefreshAll(); } /// /// 刷新界面或初始化 /// public void RefreshAll() { DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "1","1" }, this.ob); if (dt1.Rows.Count > 0) { //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore; if (!string.IsNullOrEmpty(dt1.Rows[0]["counts"].ToString())) { this.Num1 = int.Parse(dt1.Rows[0]["counts"].ToString()); } } else { this.Num1 = 0; } DataTable dt2 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "2", "2" }, this.ob); if (dt2.Rows.Count > 0) { //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore; this.Num2 = int.Parse(dt2.Rows[0]["counts"].ToString()); } else { this.Num2 = 0; } if (PlineCode.Equals("C010"))//168机组三个台子 { DataTable dt3 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetCount", new object[] { HeatNo, node, "3","3" }, this.ob); if (dt3.Rows.Count > 0) { //ScrapNumBefore = int.Parse(dt.Rows[0]["counts"].ToString()) - ScrapNumBefore; this.Num3 = int.Parse(dt3.Rows[0]["counts"].ToString()); } else { this.Num3 = 0; } } this.TxtNum1.Value = Num1.ToString(); this.TxtNum1.Enabled = false; this.TxtNum2.Value = Num2.ToString(); this.TxtNum2.Enabled = false; this.TxtNum3.Value = Num3.ToString(); this.TxtNum3.Enabled = false; } /// /// 是否要插入下线实绩表 /// /// public bool isInsert() { bool result = true; string pro = ""; if (node.Equals("0")) { pro = "JZ"; } if (node.Equals("1")) { pro = "TS"; } DataTable dt = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.isInsertOfflineResult", new object[] { HeatNo, pro, proPlanId, gxPlanNo }, this.ob); if (dt.Rows.Count > 0) { result = false; } return result; } /// /// 确认 /// /// /// private void BtnOk_Click(object sender, EventArgs e) { if (!isInsert()) { //MessageBox.Show("炉号:【" + HeatNo + "】已进行下线操作,不允许进行子管分配调整", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); //return; } if (ColNofrom.Text.Equals("1#")) { Num = int.Parse(this.TxtNumFrom.Value.ToString()); if (Num > Num1) { MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } //做个判断 探伤工序是否有那么多可调整支数 //DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetTsNum", new object[] { HeatNo, "1" }, this.ob); //if (dt1.Rows.Count > 0) //{ // TsNum = int.Parse(dt1.Rows[0]["counts"].ToString()); //} //else //{ // TsNum = 0; //} //if (Num > TsNum) //{ // MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; //} } if (ColNofrom.Text.Equals("2#")) { Num = int.Parse(this.TxtNumFrom.Value.ToString()); if (Num > Num2) { MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } if (ColNofrom.Text.Equals("3#")) { Num = int.Parse(this.TxtNumFrom.Value.ToString()); if (Num > Num3) { MessageBox.Show("您输入的支数过大,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } } StrColNofrom = this.ColNofrom.Text.ToString().Substring(0, 1); StrColNoto = this.ColNoTo.Text.ToString().Substring(0, 1); //if (node.Equals("0"))//2016-03-23注释 //{ // int testnum = 0; // DataTable dt1 = ServerHelper.GetData("com.steering.mes.zgmil.coup.FrmOffLine.GetTestingChangeNum", new object[] { HeatNo, StrColNofrom }, this.ob); // if (dt1.Rows.Count > 0) // { // testnum = Convert.ToInt16(dt1.Rows[0]["counts"].ToString()); // } // if (testnum < Num) // { // MessageBox.Show("探伤工序" + StrColNofrom + "#台只有" + testnum + "支子管可调整,请确认后重新进行子管分台操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); // return; // } //} if (StrColNofrom.Equals(StrColNoto)) { MessageBox.Show("调整的子管来源台号和去向台号一致,请确认后重新操作", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } int count = ServerHelper.SetData("com.steering.mes.zgmil.coup.FrmOffLine.ColNoChanges", new object[] { HeatNo,this.node ,Num, StrColNofrom, StrColNoto }, this.ob); if (count > 0) { //MessageBox.Show("子管换台调整成功", "提示:", MessageBoxButtons.OK, MessageBoxIcon.Information); } RefreshAll(); } private void ColNoChanges_FormClosed(object sender, FormClosedEventArgs e) { this.DialogResult = DialogResult.OK; } } }