| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- 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 Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.PlnSaleOrd.BaseMethod;
- using Core.StlMes.Client.PlnSaleOrd.炼钢计划.entity;
- using CoreFS.CA06;
- using Infragistics.Win;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.PlnSaleOrd.炼钢计划
- {
- public partial class FrmBaseLzSpecCut : FrmBase
- {
- public FrmBaseLzSpecCut()
- {
- InitializeComponent();
- }
- private void FrmBaseLzSpecCut_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<PlnBaseLzSpecCutEntity>(ultraGridSpecCut.DisplayLayout.Bands[0]);
- BaseHelper.setOtherColumnReadOnly(ultraGridSpecCut, new string[] { "" });
- BaseHelper.InitCellPosition(ultraGridSpecCut, new string[] { "DiameterLz", "CutLenBegin", "CutLenEndUnch", "CutLenEndCh" });
- InitDownList();
- }
- private void InitDownList()
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.InitSpec", new string[] { "B" }, this.ob);
- comSpec.DropDownListWidth = -1;
- comSpec.DropDownStyle = DropDownStyle.DropDownList;
- comSpec.DataSource = dt;
- comSpec.DisplayMember = "SPEC_NAME";
- comSpec.ValueMember = "SPEC_NAME";
- }
- 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;
- default:
- break;
- }
- }
- private void Query()
- {
- List<PlnBaseLzSpecCutEntity> listSource = EntityHelper.GetData<PlnBaseLzSpecCutEntity>
- ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.query", new object[] { }, this.ob);
- plnBaseLzSpecCutEntityBindingSource.DataSource = listSource;
- }
- private void Add()
- {
- string dimater = comSpec.Text.Trim();
- if (dimater.Equals("")) { MessageUtil.ShowWarning("请选择连铸坯直径!"); return; }
- string cutBegin = numCutBegin.Value == null ? "0" : numCutBegin.Value.ToString();
- string unCutEnd = numUnCutEnd.Value == null ? "0" : numUnCutEnd.Value.ToString();
- string cutEnd = numCutEnd.Value == null ? "0" : numCutEnd.Value.ToString();
- bool flag = ChcSpec(dimater);
- if (flag)
- {
- MessageUtil.ShowWarning("连铸坯直径"+dimater+"已经存在,不能新增!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否新增?")==DialogResult.No){
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.add", new string[] { dimater, cutBegin, unCutEnd, cutEnd,UserInfo.GetUserName() }, this.ob);
- MessageUtil.ShowTips("新增成功!");
- Query();
- if (ultraGridSpecCut.Rows.Count>0)
- foreach(UltraGridRow ugr in ultraGridSpecCut.Rows){
- if (ugr.Cells["DiameterLz"].Value.ToString().Equals(dimater))
- {
- ugr.Activate();
- }
- }
- }
- private void Delete()
- {
- UltraGridRow ugr = ultraGridSpecCut.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择要删除的记录!");
- return;
- }
- string dimater=ugr.Cells["DiameterLz"].Text.Trim();
- if (MessageUtil.ShowYesNoAndQuestion("是否删除连铸坯直径" + dimater + "基础数据?(此删除不可恢复)") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.delete", new string[] { dimater }, this.ob);
- MessageUtil.ShowTips("删除成功!");
- Query();
- }
- private void Update()
- {
- string dimater = comSpec.Text.Trim();
- if (dimater.Equals("")) { MessageUtil.ShowWarning("请选择连铸坯直径!"); return; }
- string cutBegin = numCutBegin.Value == null ? "0" : numCutBegin.Value.ToString();
- string unCutEnd = numUnCutEnd.Value == null ? "0" : numUnCutEnd.Value.ToString();
- string cutEnd = numCutEnd.Value == null ? "0" : numCutEnd.Value.ToString();
- bool flag = ChcSpec(dimater);
- if (!flag)
- {
- MessageUtil.ShowWarning("连铸坯直径" + dimater + "不存在,不能修改!");
- return;
- }
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.update", new string[] { dimater, cutBegin, unCutEnd, cutEnd, UserInfo.GetUserName() }, this.ob);
- MessageUtil.ShowTips("修改成功!");
- Query();
- if (ultraGridSpecCut.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGridSpecCut.Rows)
- {
- if (ugr.Cells["DiameterLz"].Value.ToString().Equals(dimater))
- {
- ugr.Activate();
- }
- }
- }
- bool ChcSpec(string dimater)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmBaseLzSpecCut.checkSpec", new string[] { dimater }, 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 ultraGridSpecCut_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridSpecCut.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- PlnBaseLzSpecCutEntity entity = (PlnBaseLzSpecCutEntity)ugr.ListObject;
- comSpec.Value = entity.DiameterLz.ToString();
- numCutBegin.Value = entity.CutLenBegin;
- numCutEnd.Value = entity.CutLenEndCh;
- numUnCutEnd.Value = entity.CutLenEndUnch;
- }
- }
- }
|