| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- using Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- 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.PlnSaleOrd.炼钢计划
- {
- public partial class FrmBaseDeviation : FrmBase
- {
- public FrmBaseDeviation()
- {
- InitializeComponent();
- }
- private void FrmBaseDeviation_Load(object sender, EventArgs e)
- {
- SteelHelper.InitPline(comPlineA, "A", this.ob);
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey.Trim())
- {
- case "Query":
- Query();
- break;
- case "Add":
- Add();
- break;
- case "Update":
- Update();
- break;
- case "Delete":
- Delete();
- break;
- case "Close":
- this.Close();
- break;
- default:
- break;
- }
- }
- /// <summary>
- /// 查询
- /// </summary>
- private void Query()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseDeviation.query", new object[] { }, ob);
- GridHelper.CopyDataToDatatable(dt, dataTable1, true);
- GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- private void Add()
- {
- string plineCode = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- if (plineCode.Equals(""))
- {
- MessageUtil.ShowWarning("请选择电炉产线!");
- return;
- }
- string plineName = comPlineA.Text;
- string planRoute = ComplanRoute.Text;
- if (planRoute.Equals(""))
- {
- MessageUtil.ShowWarning("请选择工艺路径!");
- return;
- }
- string proPoint = comProPoint.Text;
- if (proPoint.Equals(""))
- {
- MessageUtil.ShowWarning("请选择工序点!");
- return;
- }
- bool flag = ChcSpec(plineCode, planRoute, proPoint);
- if (flag)
- {
- MessageUtil.ShowWarning("电炉产线:" + plineName + "在工艺路径:" + planRoute + "下已经存在工序点:" + proPoint + ",不能新增!");
- return;
- }
- string txtdeviNo1 = txtDeviNo1.Value == null ? "0" : txtDeviNo1.Value.ToString();
- string txtdeviUn1 = txtDeviUn1.Value == null ? "0" : txtDeviUn1.Value.ToString();
- string txtdeviNo2 = txtDeviNo2.Value == null ? "0" : txtDeviNo2.Value.ToString();
- string txtdeviUn2 = txtDeviUn2.Value == null ? "0" : txtDeviUn2.Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("是否新增?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseDeviation.add", new string[] { plineCode, plineName,
- planRoute, proPoint, txtdeviNo1,
- txtdeviUn1, txtdeviNo2, txtdeviUn2, UserInfo.GetUserName()}, this.ob);
- MessageUtil.ShowTips("新增成功!");
- Query();
- if (ultraGrid1.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (ugr.Cells["PLINE_CODE"].Value.ToString().Equals(plineCode) && ugr.Cells["PLAN_ROUTE"].Value.ToString().Equals(planRoute) && ugr.Cells["PRO_POINT"].Value.ToString().Equals(proPoint))
- {
- ugr.Activate();
- }
- }
- }
- private void Delete()
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择要删除的记录!");
- return;
- }
- string PlineCodeB = ugr.Cells["PLINE_CODE"].Text.Trim();
- string PlineNameB = ugr.Cells["PLINE_NAME"].Text.Trim();
- string planRoute = ugr.Cells["PLAN_ROUTE"].Text.Trim();
- string proPoint = ugr.Cells["PRO_POINT"].Text.Trim();
- if (MessageUtil.ShowYesNoAndQuestion("是否删除电炉:" + PlineNameB + "工艺路径:" + planRoute + "下的工序点:" + proPoint + "基础数据?(此删除不可恢复)") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseDeviation.delete", new string[] { PlineCodeB, planRoute, proPoint }, this.ob);
- MessageUtil.ShowTips("删除成功!");
- Query();
- }
- private void Update()
- {
- string plineCode = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- if (plineCode.Equals(""))
- {
- MessageUtil.ShowWarning("请选择电炉产线!");
- return;
- }
- string plineName = comPlineA.Text;
- string planRoute = ComplanRoute.Text;
- if (planRoute.Equals(""))
- {
- MessageUtil.ShowWarning("请选择工艺路径!");
- return;
- }
- string proPoint = comProPoint.Text;
- if (proPoint.Equals(""))
- {
- MessageUtil.ShowWarning("请选择工序点!");
- return;
- }
- bool flag = ChcSpec(plineCode, planRoute, proPoint);
- if (!flag)
- {
- MessageUtil.ShowWarning("电炉产线:" + plineName + "在工艺路径:" + planRoute + "下已经存在工序点:" + proPoint + ",不能修改!");
- return;
- }
- string txtdeviNo1 = txtDeviNo1.Value == null ? "0" : txtDeviNo1.Value.ToString();
- string txtdeviUn1 = txtDeviUn1.Value == null ? "0" : txtDeviUn1.Value.ToString();
- string txtdeviNo2 = txtDeviNo2.Value == null ? "0" : txtDeviNo2.Value.ToString();
- string txtdeviUn2 = txtDeviUn2.Value == null ? "0" : txtDeviUn2.Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseDeviation.update", new string[] { plineCode, planRoute, proPoint, txtdeviNo1,
- txtdeviUn1, txtdeviNo2, txtdeviUn2, UserInfo.GetUserName()}, this.ob);
- MessageUtil.ShowTips("修改成功!");
- Query();
- if (ultraGrid1.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGrid1.Rows)
- {
- if (ugr.Cells["PLINE_CODE"].Value.ToString().Equals(plineCode) && ugr.Cells["PLAN_ROUTE"].Value.ToString().Equals(planRoute) && ugr.Cells["PRO_POINT"].Value.ToString().Equals(proPoint))
- {
- ugr.Activate();
- }
- }
- }
- bool ChcSpec(string plineCode, string planRoute, string comProPoint)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseDeviation.checkPline", new string[] { plineCode, planRoute, comProPoint }, this.ob);
- if (dt == null || dt.Rows.Count == 0)
- {
- return false;
- }
- else
- {
- if (dt.Rows[0][0].ToString().Equals("1"))
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGrid1.ActiveRow;
- if (ugr == null) return;
- comPlineA.Value = ugr.Cells["PLINE_CODE"].Value.ToString();
- ComplanRoute.Text = ugr.Cells["PLAN_ROUTE"].Value.ToString();
- comProPoint.Text = ugr.Cells["PRO_POINT"].Value.ToString();
- txtDeviNo1.Value = ugr.Cells["DEVIATION_NO1"].Value.ToString();
- txtDeviUn1.Value = ugr.Cells["DEVIATION_UN1"].Value.ToString();
- txtDeviNo2.Value = ugr.Cells["DEVIATION_NO2"].Value.ToString();
- txtDeviUn2.Value = ugr.Cells["DEVIATION_NU2"].Value.ToString();
- }
- private void comProPoint_ValueChanged(object sender, EventArgs e)
- {
- //string plineCode = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- //string plineName = comPlineA.Text;
- //string planRoute = ComplanRoute.Text;
- //string proPoint = comProPoint.Text;
- //if (plineName.Equals("一炼钢电炉"))
- //{
- // if (planRoute.Equals("ELC"))
- // {
- // if (proPoint.Equals("LF"))
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- // else
- // {
- // txtDeviNo1.Enabled = false;
- // txtDeviUn1.Enabled = false;
- // txtDeviNo2.Enabled = false;
- // txtDeviUn2.Enabled = false;
- // }
- // }
- // else
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- //}
- //else if (plineName.Equals("二炼钢电炉"))
- //{
- // if (planRoute.Equals("ELC"))
- // {
- // if (proPoint.Equals("LF"))
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- // else
- // {
- // txtDeviNo1.Enabled = false;
- // txtDeviUn1.Enabled = false;
- // txtDeviNo2.Enabled = false;
- // txtDeviUn2.Enabled = false;
- // }
- // }
- // else
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- //}
- //else if (plineName.Equals("三炼钢电炉"))
- //{
- // if (planRoute.Equals("ELC"))
- // {
- // if (proPoint.Equals("LF"))
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- // else
- // {
- // txtDeviNo1.Enabled = false;
- // txtDeviUn1.Enabled = false;
- // txtDeviNo2.Enabled = false;
- // txtDeviUn2.Enabled = false;
- // }
- // }
- // else
- // {
- // txtDeviNo1.Enabled = true;
- // txtDeviUn1.Enabled = true;
- // txtDeviNo2.Enabled = true;
- // txtDeviUn2.Enabled = true;
- // }
- //}
- }
- }
- }
|