| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- 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();
- }
- /// <summary>
- /// 刷新界面或初始化
- /// </summary>
- 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;
- }
- /// <summary>
- /// 是否要插入下线实绩表
- /// </summary>
- /// <returns></returns>
- 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;
- }
- /// <summary>
- /// 确认
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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;
- }
- }
- }
|