| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
- using Core.StlMes.Client.PlnSaleOrd.炼钢计划;
- using Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinEditors;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.PlnSaleOrd
- {
- public partial class FrmPlnBasePlineLg : FrmBase
- {
- public FrmPlnBasePlineLg()
- {
- InitializeComponent();
- }
- private void FrmPlnBasePlineLg_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<PlnBasePlineLgEntity>(ultraGridBaseLg.DisplayLayout.Bands[0]);
- BaseHelper.setOtherColumnReadOnly(ultraGridBaseLg, new string[] { "" });
- BaseHelper.InitCellPosition(ultraGridBaseLg, new string[] { "EfMaxLife", "StdOutWt", "EfWtLeft", "StdWtEnd", "OutWtMax", "OutWtMin", "EfAgeNow" });
- SteelHelper.InitPline(comPlineA, "A", this.ob);
- SteelHelper.InitProcess(comProcess, "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;
- }
- }
- private void Query()
- {
- List<PlnBasePlineLgEntity> listSource = EntityHelper.GetData<PlnBasePlineLgEntity>
- ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLg.query", new object[] { }, ob);
- plnBasePlineLgEntityBindingSource.DataSource = listSource;
- }
- private void Add()
- {
- string plineCode = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- if (plineCode.Equals(""))
- {
- MessageUtil.ShowWarning("请选择电炉产线!");
- return;
- }
- string plineName = comPlineA.Text;
- bool flag = ChcSpec(plineCode);
- if (flag)
- {
- MessageUtil.ShowWarning("电炉产线:" + plineName + "已经存在,不能新增!");
- return;
- }
- string proceeCode = comProcess.Value == null ? "" : comProcess.Value.ToString();
- string processDesc = comProcess.Text;
- string schedulecode = txtCode.Text.Trim();
- string efMaxLife = txtMaxLife.Value == null ? "0" : txtMaxLife.Value.ToString();
- string efAgeNow = txtNowage.Value == null ? "0" : txtNowage.Value.ToString();
- string efWtLeft = txtLeft.Value == null ? "0" : txtLeft.Value.ToString();
- string stdOutWt = txtStandSteel.Value == null ? "0" : txtStandSteel.Value.ToString();
- string outWtMax = txtSteelMax.Value == null ? "0" : txtSteelMax.Value.ToString();
- string outWtMin = txtMinSteel.Value == null ? "0" : txtMinSteel.Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("是否新增?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLg.add", new string[] { plineCode, plineName,
- proceeCode, processDesc, efMaxLife,
- stdOutWt, efWtLeft, outWtMax, outWtMin,
- efAgeNow, UserInfo.GetUserName(), schedulecode}, this.ob);
- MessageUtil.ShowTips("新增成功!");
- Query();
- if (ultraGridBaseLg.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGridBaseLg.Rows)
- {
- if (ugr.Cells["PlineCode"].Value.ToString().Equals(plineCode))
- {
- ugr.Activate();
- }
- }
- }
- private void Delete()
- {
- UltraGridRow ugr = ultraGridBaseLg.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择要删除的记录!");
- return;
- }
- string PlineCodeB = ugr.Cells["PlineCode"].Text.Trim();
- string PlineNameB = ugr.Cells["PlineName"].Text.Trim();
- if (MessageUtil.ShowYesNoAndQuestion("是否删除电炉:" + PlineNameB + "基础数据?(此删除不可恢复)") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLg.delete", new string[] { PlineCodeB }, 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;
- bool flag = ChcSpec(plineCode);
- if (!flag)
- {
- MessageUtil.ShowWarning("电炉产线:" + plineName + "不存在,不能修改!");
- return;
- }
- string proceeCode = comProcess.Value == null ? "" : comProcess.Value.ToString();
- string processDesc = comProcess.Text;
- string schedulecode = txtCode.Text.Trim();
- string efMaxLife = txtMaxLife.Value == null ? "0" : txtMaxLife.Value.ToString();
- string efAgeNow = txtNowage.Value == null ? "0" : txtNowage.Value.ToString();
- string efWtLeft = txtLeft.Value == null ? "0" : txtLeft.Value.ToString();
- string stdOutWt = txtStandSteel.Value == null ? "0" : txtStandSteel.Value.ToString();
- string outWtMax = txtSteelMax.Value == null ? "0" : txtSteelMax.Value.ToString();
- string outWtMin = txtMinSteel.Value == null ? "0" : txtMinSteel.Value.ToString();
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLg.update", new string[] { plineCode, plineName,
- proceeCode, processDesc, efMaxLife,
- stdOutWt, efWtLeft, outWtMax, outWtMin,
- efAgeNow, UserInfo.GetUserName(), schedulecode }, this.ob);
- MessageUtil.ShowTips("修改成功!");
- Query();
- if (ultraGridBaseLg.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGridBaseLg.Rows)
- {
- if (ugr.Cells["PlineCode"].Value.ToString().Equals(plineCode))
- {
- ugr.Activate();
- }
- }
- }
- bool ChcSpec(string plineCode)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLg.checkPline", new string[] { plineCode }, 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 ultraGridBaseLg_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridBaseLg.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- PlnBasePlineLgEntity entity = (PlnBasePlineLgEntity)ugr.ListObject;
- comPlineA.Value = entity.PlineCode;
- comProcess.Value = entity.ProcessCode;
- txtCode.Value = entity.ScheduleCode;
- txtMaxLife.Value = entity.EfMaxLife;
- txtNowage.Value = entity.EfAgeNow;
- txtLeft.Value = entity.EfWtLeft;
- txtStandSteel.Value = entity.StdOutWt;
- txtSteelMax.Value = entity.OutWtMax;
- txtMinSteel.Value = entity.OutWtMin;
-
- }
- }
- }
|