| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299 |
- using Core.Mes.Client.Comm.Control;
- 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.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 FrmBaseMandrelSpec : FrmBase
- {
- private string id = "";
- public FrmBaseMandrelSpec()
- {
- InitializeComponent();
- }
- private void FrmBaseMandrelSpec_Load(object sender, EventArgs e)
- {
- BaseHelper.NitializeDropDownBox(txtDimater, "com.steering.pss.plnsaleord.processOrder.FrmBaseMandrelSpec.initDimater",new Object[]{}, "DIAMETER_MANDREL", "MANDREL_ID", false, ob);
- PlanHelper.InitDropPline("D", "", txtPline1, this.ob);
- PlanHelper.InitDropPline("D", "", txtPline2, this.ob);
- BaseHelper.setOtherColumnReadOnly(entityGridMandrel, null);
- BaseHelper.InitCellPosition(entityGridMandrel, new string[] { "MinD", "MaxD", "MinH", "MaxH", "DiameterMandrel", "PassName" });
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- base.ToolBar_Click(sender, ToolbarKey);
- switch (ToolbarKey)
- {
- case "Query"://查询
- Query();
- break;
- case "Add"://新增
- Add();
- break;
- case "Update"://修改 q
- Update();
- break;
- case "Delete"://删除
- Delete();
- break;
- case "Close"://关闭
- this.Close();
- break;
- case "Export": //导出
- GridHelper.ulGridToExcel(entityGridMandrel, "芯棒产线适用规格信息");
- break;
- default:
- break;
- }
- }
- private void Query()
- {
- string plineCode = "";
- if (chcPline.Checked && txtPline1.Value != null)
- { plineCode = txtPline1.Value.ToString(); }
- List<ComBaseMandrelSpecEntity> listSource = EntityHelper.GetData<ComBaseMandrelSpecEntity>
- ("com.steering.pss.plnsaleord.processOrder.FrmBaseMandrelSpec.query", new object[] { plineCode }, ob);
- comBaseMandrelSpecEntityBindingSource.DataSource = listSource;
- if (!id.Equals("") && entityGridMandrel.Rows.Count > 0)
- {
- foreach (UltraGridRow ugr in entityGridMandrel.Rows)
- {
- if (ugr.Cells["RelationId"].Text.Equals(id))
- {
- ugr.Activate();
- break;
- }
- }
- }
- id = "";
- }
- private bool CheckParams()
- {
- if (txtPline2.Value == null)
- {
- MessageUtil.ShowWarning("请选择产线!",txtPline2);
- return false;
- }
- if (txtPassModel.Value == null)
- {
- MessageUtil.ShowWarning("请选择孔型!", txtPassModel);
- return false;
- }
- if (txtDimater.Value == null)
- {
- MessageUtil.ShowWarning("请选择芯棒直径!", txtDimater);
- return false;
- }
- if (txtMinD == null || txtMinD.Value.ToString().Length == 0)
- {
- MessageUtil.ShowWarning("请输入外径最小值!", txtMinD);
- return false;
- }
- if (txtMaxD == null || txtMaxD.Value.ToString().Length == 0)
- {
- MessageUtil.ShowWarning("请输入外径最大值!", txtMaxD);
- return false;
- }
- if (txtMinH == null || txtMinH.Value.ToString().Length == 0)
- {
- MessageUtil.ShowWarning("请输入壁厚最小值!", txtMinH);
- return false;
- }
- if (txtMaxH == null || txtMaxH.Value.ToString().Length == 0)
- {
- MessageUtil.ShowWarning("请输入壁厚最大值!", txtMaxH);
- return false;
- }
- double minD = Convert.ToDouble(txtMinD.Value.ToString());
- double maxD = Convert.ToDouble(txtMaxD.Value.ToString());
- if (minD > maxD)
- {
- MessageUtil.ShowWarning("外径最小值不能大于外径最大值!", txtMinD);
- return false;
- }
- double minH = Convert.ToDouble(txtMinH.Value.ToString());
- double maxH = Convert.ToDouble(txtMaxH.Value.ToString());
- if (minH > maxH)
- {
- MessageUtil.ShowWarning("壁厚最小值不能大于壁厚最大值!", txtMinH);
- return false;
- }
- return true;
- }
- private void Add()
- {
- if (!CheckParams())
- {
- return;
- }
- ComBaseMandrelSpecEntity entity = new ComBaseMandrelSpecEntity();
- string plineCode = txtPline2.Value.ToString();
- string plineName = txtPline2.Text.Trim();
- string passCode = txtPassModel.Value.ToString();
- string passName = txtPassModel.Text.Trim();
- string dimaterId = txtDimater.Value.ToString();
- string dimater = txtDimater.Text;
- string memo = txtMemo.Text.Trim();
- string minD = txtMinD.Value.ToString();
- string maxD = txtMaxD.Value.ToString();
- string minH = txtMinH.Value.ToString();
- string maxH = txtMaxH.Value.ToString();
- entity.CreateName = UserInfo.GetUserName();
- entity.DiameterMandrel =(decimal?)Convert.ToDouble( dimater);
- entity.MandrelId = dimaterId;
- entity.MaxD = (decimal?)Convert.ToDouble(maxD);
- entity.MinD = (decimal?)Convert.ToDouble(minD);
- entity.MaxH = (decimal?)Convert.ToDouble(maxH);
- entity.MinH = (decimal?)Convert.ToDouble(minH);
- entity.PlineCode = plineCode;
- entity.PlineName = plineName;
- entity.PassCode = passCode;
- entity.PassName = passName;
- entity.Memo = memo;
- if (MessageUtil.ShowYesNoAndQuestion("是否新增?") == DialogResult.No)
- {
- return;
- }
- string jsonStr = JSONFormat.Format(entity);
- int count = ServerHelper.SetData("com.steering.pss.plnsaleord.processOrder.FrmBaseMandrelSpec.add", new object[] { jsonStr }, ob);
- if (count == 0) { MessageUtil.ShowTips("服务端处理失败!"); return; }
- else
- {
- MessageUtil.ShowWarning("新增成功!", entityGridMandrel);
- Query();
- }
- }
- private void Update()
- {
- UltraGridRow ugr = entityGridMandrel.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择要修改的记录!", entityGridMandrel);
- return;
- }
- if (!CheckParams())
- {
- return;
- }
- ComBaseMandrelSpecEntity entity = (ComBaseMandrelSpecEntity)ugr.ListObject;
- string plineCode = txtPline2.Value.ToString();
- string plineName = txtPline2.Text.Trim();
- string passCode = txtPassModel.Value.ToString();
- string passName = txtPassModel.Text.Trim();
- string dimaterId = txtDimater.Value.ToString();
- string dimater = txtDimater.Text;
- string memo = txtMemo.Text.Trim();
- string minD = txtMinD.Value.ToString();
- string maxD = txtMaxD.Value.ToString();
- string minH = txtMinH.Value.ToString();
- string maxH = txtMaxH.Value.ToString();
- entity.UpdateName = UserInfo.GetUserName();
- entity.DiameterMandrel = (decimal?)Convert.ToDouble(dimater);
- entity.MandrelId = dimaterId;
- entity.MaxD = (decimal?)Convert.ToDouble(maxD);
- entity.MinD = (decimal?)Convert.ToDouble(minD);
- entity.MaxH = (decimal?)Convert.ToDouble(maxH);
- entity.MinH = (decimal?)Convert.ToDouble(minH);
- entity.PlineCode = plineCode;
- entity.PlineName = plineName;
- entity.PassCode = passCode;
- entity.PassName = passName;
- entity.Memo = memo;
- if (MessageUtil.ShowYesNoAndQuestion("是否修改?") == DialogResult.No)
- {
- return;
- }
- id = entity.MandrelId;
- string jsonStr = JSONFormat.Format(entity);
- int count = ServerHelper.SetData("com.steering.pss.plnsaleord.processOrder.FrmBaseMandrelSpec.update", new object[] { jsonStr }, ob);
- if (count == 0) { MessageUtil.ShowTips("服务端处理失败!"); return; }
- else
- {
- MessageUtil.ShowWarning("修改成功!", entityGridMandrel);
- Query();
- }
- }
- private void Delete()
- {
- UltraGridRow ugr = entityGridMandrel.ActiveRow;
- if (ugr == null)
- {
- MessageUtil.ShowWarning("请选择要删除的记录!", entityGridMandrel);
- return;
- }
- if (!CheckParams()) { return; }
- ComBaseMandrelSpecEntity entity = (ComBaseMandrelSpecEntity)ugr.ListObject;
- string jsonStr = JSONFormat.Format(entity);
- if (MessageUtil.ShowYesNoAndQuestion("是否删除?") == DialogResult.No)
- {
- return;
- }
- int count = ServerHelper.SetData("com.steering.pss.plnsaleord.processOrder.FrmBaseMandrelSpec.delete", new object[] { jsonStr }, ob);
- if (count == 0) { MessageUtil.ShowTips("服务端处理失败!"); return; }
- else
- {
- MessageUtil.ShowWarning("删除成功!", entityGridMandrel);
- Query();
- }
- }
- private void txtPline2_ValueChanged(object sender, EventArgs e)
- {
- if (txtPline2.Value == null)
- {
- txtPassModel.Clear();
- return;
- }
- BaseHelper.NitializeDropDownBox(txtPassModel, "com.steering.pss.plnsaleord.processOrder.FrmPlnPassmodel.initPassModel", new Object[] { txtPline2.Value.ToString() }, "PASS_NAME", "PASS_CODE", false, ob);
- }
- private void chcPline_CheckedChanged(object sender, EventArgs e)
- {
- if (chcPline.Checked) { txtPline1.ReadOnly = false; } else { txtPline1.ReadOnly = true; }
- }
- private void entityGridMandrel_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow ugr = entityGridMandrel.ActiveRow;
- if (ugr == null)
- {
- return;
- }
- ComBaseMandrelSpecEntity entity = (ComBaseMandrelSpecEntity)ugr.ListObject;
- txtPline2.Value = entity.PlineCode;
- txtPassModel.Value = entity.PassCode;
- txtDimater.Value = entity.MandrelId;
- txtMemo.Value = entity.Memo;
- txtMinD.Value = entity.MinD;
- txtMinH.Value = entity.MinH;
- txtMaxD.Value = entity.MaxD;
- txtMaxH.Value = entity.MaxH;
- }
- }
- }
|