| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223 |
- 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.UltraWinGrid;
- namespace Core.StlMes.Client.PlnSaleOrd.炼钢计划
- {
- public partial class FrmPlnBasePlineLz : FrmBase
- {
- public FrmPlnBasePlineLz()
- {
- InitializeComponent();
- }
- private void FrmPlnBasePlineLz_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<PlnBasePlineLzEntity>(ultraGridBaseLz.DisplayLayout.Bands[0]);
- BaseHelper.setOtherColumnReadOnly(ultraGridBaseLz, new string[] { "" });
- BaseHelper.InitCellPosition(ultraGridBaseLz, new string[] { "FlowNumMax", "ZbLeftWt", "FurnaceNumMax" });
- SteelHelper.InitPline(comPlineB, "B", this.ob);
- SteelHelper.InitPline(comPlineA, "A", this.ob);
- SteelHelper.InitProcess(comProcess, "B", 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;
- default:
- break;
- }
- }
- private void Query()
- {
- List<PlnBasePlineLzEntity> listSource = EntityHelper.GetData<PlnBasePlineLzEntity>
- ("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLz.query", new object[] { }, this.ob);
- plnBasePlineLzEntityBindingSource.DataSource = listSource;
- }
- private void Add()
- {
- string plineCode = comPlineB.Value == null ? "" : comPlineB.Value.ToString();
- if (plineCode.Equals(""))
- {
- MessageUtil.ShowWarning("请选择铸机产线!");
- return;
- }
- string plineName = comPlineB.Text;
- string plineCodeA = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- string plineNameA = comPlineA.Text;
- bool flag = ChcSpec(plineCode, plineCodeA);
- if (flag)
- {
- MessageUtil.ShowWarning("铸机产线:" + plineName + ",电炉产线:" + plineNameA + "已经存在,不能新增!");
- return;
- }
- string processCode = comProcess.Value == null ? "" : comProcess.Value.ToString();
- string processDesc = comProcess.Text;
- string zbLeftWgt = numZb.Value == null ? "0" : numZb.Value.ToString();
- string maxNum = numMaxnum.Value == null ? "0" : numMaxnum.Value.ToString();
- string maxFlow = numMaxFlow.Value == null ? "0" : numMaxFlow.Value.ToString();
- string defVer = "0";
- if (chkdefVer.Checked)
- {
- defVer = "1";
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否新增?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLz.add", new string[] { plineCode, plineName,
- plineCodeA, plineNameA, processCode,
- processDesc, zbLeftWgt, maxFlow,
- maxNum, UserInfo.GetUserName(),defVer}, this.ob);
- MessageUtil.ShowTips("新增成功!");
- Query();
- if (ultraGridBaseLz.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGridBaseLz.Rows)
- {
- if (ugr.Cells["PlineCode"].Value.ToString().Equals(plineCode))
- {
- ugr.Activate();
- }
- }
- }
- private void Delete()
- {
- UltraGridRow ugr = ultraGridBaseLz.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.FrmPlnBasePlineLz.delete", new string[] { PlineCodeB }, this.ob);
- MessageUtil.ShowTips("删除成功!");
- Query();
- }
- private void Update()
- {
- string plineCode = comPlineB.Value == null ? "" : comPlineB.Value.ToString();
- if (plineCode.Equals(""))
- {
- MessageUtil.ShowWarning("请选择铸机产线!");
- return;
- }
- string plineName = comPlineB.Text;
- string plineCodeA = comPlineA.Value == null ? "" : comPlineA.Value.ToString();
- string plineNameA = comPlineA.Text;
- bool flag = ChcSpec(plineCode, plineCodeA);
- if (!flag)
- {
- MessageUtil.ShowWarning("铸机产线:" + plineName + ",电炉产线:" + plineNameA + "不存在,不能修改!");
- return;
- }
- string processCode = comProcess.Value == null ? "" : comProcess.Value.ToString();
- string processDesc = comProcess.Text;
- string zbLeftWgt = numZb.Value == null ? "0" : numZb.Value.ToString();
- string maxNum = numMaxnum.Value == null ? "0" : numMaxnum.Value.ToString();
- string maxFlow = numMaxFlow.Value == null ? "0" : numMaxFlow.Value.ToString();
- string defVer = "0";
- if (chkdefVer.Checked)
- {
- defVer = "1";
- }
-
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- ServerHelper.SetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLz.update", new string[] { plineCode, plineName,
- plineCodeA, plineNameA, processCode,
- processDesc, zbLeftWgt, maxFlow,
- maxNum, UserInfo.GetUserName(),defVer }, this.ob);
- MessageUtil.ShowTips("修改成功!");
- Query();
- if (ultraGridBaseLz.Rows.Count > 0)
- foreach (UltraGridRow ugr in ultraGridBaseLz.Rows)
- {
- if (ugr.Cells["PlineCode"].Value.ToString().Equals(plineCode))
- {
- ugr.Activate();
- }
- }
- }
- bool ChcSpec(string plineCode, string plineCodeA)
- {
- DataTable dt = ServerHelper.GetData("com.steering.pss.plnsaleord.steelMarkingPlan.FrmPlnBasePlineLz.checkPline", new string[] { plineCode, plineCodeA }, 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 ultraGridBaseLz_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = ultraGridBaseLz.ActiveRow;
- if (ugr == null) { return; }
- PlnBasePlineLzEntity entity = (PlnBasePlineLzEntity)ugr.ListObject;
- comPlineA.Value = entity.PlineCodeA;
- comPlineB.Value = entity.PlineCode;
- comProcess.Value = entity.ProcessCode;
- numMaxFlow.Value = entity.FlowNumMax;
- numMaxnum.Value = entity.FurnaceNumMax;
- numZb.Value = entity.ZbLeftWt;
- if (entity.DefVal.Equals("是"))
- {
- chkdefVer.Checked = true;
- }
- else
- {
- chkdefVer.Checked = false;
- }
- }
- }
- }
|