| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.YdmBcPipeManage.Entity;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- 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;
- namespace Core.StlMes.Client.YdmBcPipeManage
- {
- public partial class FrmBaseCrane : FrmBase
- {
- public FrmBaseCrane()
- {
- InitializeComponent();
- }
- private void FrmBaseCrane_Load(object sender, EventArgs e)
- {
- EntityHelper.ShowGridCaption<YdmBsMaxwgtEntity>(ultraGrid1.DisplayLayout.Bands[0]);
- }
- /// <summary>
- /// 重写基类方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="ToolbarKey"></param>
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- doQuery();
- break;
- case "Add":
- doAdd();
- break;
- case "Update":
- doUpdate();
- break;
- case"Delete":
- deleteData();
- break;
- case "Close":
- close();
- break;
- }
- }
-
- /// <summary>
- /// 查询
- /// </summary>
- private void doQuery()
- {
- string storageNo = "";
- if (this.userChk.Checked && this.txtStorageNo.Text != "")
- {
- storageNo = this.txtStorageNo.Text.Trim();
- }
- ArrayList parmList = new ArrayList();
- parmList.Add(storageNo);
- List<YdmBsMaxwgtEntity> listSource = EntityHelper.GetData<YdmBsMaxwgtEntity>("com.steering.ydm.bc.FrmBaseCrane.doQuery", new object[] { parmList }, ob);
- ydmBsMaxwgtEntityBindingSource.DataSource = listSource;
- }
- /// <summary>
- /// 新增
- /// </summary>
- private void doAdd()
- {
- ArrayList parmList = new ArrayList();
- if(this.chkStorageNo.Text == "")
- {
- MessageUtil.ShowTips("请选中对应的库区信息!");
- return;
- }
- if (this.uComUnload.Text == "")
- {
- MessageUtil.ShowTips("请选中对应的装卸点信息!");
- return;
- }
- if (this.txtMaxWgt.Text.Trim() == "")
- {
- MessageUtil.ShowTips("吊装最大载重不能为空!");
- return;
- }
- else
- {
- if (!StringUtil.IsFloat(this.txtMaxWgt.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入正确的载重数!");
- return;
- }
- }
- YdmBsMaxwgtEntity ydmBsWt = new YdmBsMaxwgtEntity();
- ydmBsWt.StorageNo = this.chkStorageNo.Tag.ToString2();
- ydmBsWt.StorageName = this.chkStorageNo.Text.ToString2();
- ydmBsWt.UnloadingCode = this.uComUnload.Value.ToString2();
- ydmBsWt.UnloadingDesc = this.uComUnload.Text.ToString2();
- ydmBsWt.MaxWgt = this.txtMaxWgt.Text.Trim();
- ydmBsWt.CreateName = this.UserInfo.GetUserName();
- string ydmBsEntity = JSONFormat.Format(ydmBsWt);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmBaseCrane";
- ccp.MethodName = "doAdd";
- ccp.ServerParams = new object[] { ydmBsEntity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("新增成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 修改
- /// </summary>
- private void doUpdate()
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- YdmBsMaxwgtEntity ydmBsEntity = (YdmBsMaxwgtEntity)uRow.ListObject;
- if (this.txtMaxWgt.Text.Trim() == "")
- {
- MessageUtil.ShowTips("吊装最大载重不能为空!");
- return;
- }
- else
- {
- if (!StringUtil.IsFloat(this.txtMaxWgt.Text.Trim()))
- {
- MessageUtil.ShowTips("请输入正确的载重数!");
- return;
- }
- }
- ydmBsEntity.MaxWgt = this.txtMaxWgt.Text.Trim();
- ydmBsEntity.UpdateName = this.UserInfo.GetUserName();
- string ydmBsTity = JSONFormat.Format(ydmBsEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmBaseCrane";
- ccp.MethodName = "doUpdate";
- ccp.ServerParams = new object[] { ydmBsTity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("修改成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- private void deleteData()
- {
- this.ultraGrid1.UpdateData();
- UltraGridRow uRow = this.ultraGrid1.ActiveRow;
- if (uRow == null) return;
- YdmBsMaxwgtEntity ydmBsEntity = (YdmBsMaxwgtEntity)uRow.ListObject;
- string ydmBsTity = JSONFormat.Format(ydmBsEntity);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "com.steering.ydm.bc.FrmBaseCrane";
- ccp.MethodName = "deleteData";
- ccp.ServerParams = new object[] { ydmBsTity };
- ccp = ob.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.Equals("删除成功!"))
- {
- doQuery();
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void close()
- {
- this.close();
- }
- private void userChk_CheckedChanged(object sender, EventArgs e)
- {
- this.txtStorageNo.Enabled = this.userChk.Checked;
- }
- private void chkStorageNo_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmSupervisonInfo.doQueryStorageNo",
- new object[] { }, ob);
- dt.Columns["STORAGE_NAME"].Caption = "库区";
- BaseInfoPopup baseInfo = new BaseInfoPopup(dt, "STORAGE_NAME", "STORAGE_NO");
- baseInfo.Shown += new EventHandler((a, b) =>
- {
- var actRow = baseInfo.UltraGrid1.Rows.AsQueryable().Where(
- c => c.GetValue("STORAGE_NO") == this.chkStorageNo.Tag.ToString2()).FirstOrDefault();
- if (actRow != null) actRow.Activate();
- });
- if (baseInfo.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- chkStorageNo.Tag = baseInfo.ChoicedRow.GetValue("STORAGE_NO");
- chkStorageNo.Text = baseInfo.ChoicedRow.GetValue("STORAGE_NAME");
- }
- }
- private void chkStorageNo_ValueChanged(object sender, EventArgs e)
- {
- DataTable dt = ServerHelper.GetData("com.steering.ydm.bc.FrmBaseCrane.doQueryUnLoad", new object[] {this.chkStorageNo.Tag.ToString2() }, this.ob);
- if (dt.Rows.Count > 0)
- {
- uComUnload.DataSource = dt;
- uComUnload.DisplayMember = "UNLOADING_DESC";
- uComUnload.ValueMember = "UNLOADING_CODE";
- }
- }
- private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
- {
- UltraGridRow row = this.ultraGrid1.ActiveRow;
- this.chkStorageNo.Tag = row.Cells["StorageNo"].Text;
- this.chkStorageNo.Text = row.Cells["StorageName"].Text;
- this.uComUnload.Value = row.Cells["UnloadingCode"].Text;
- this.uComUnload.Text = row.Cells["UnloadingDesc"].Text;
- this.txtMaxWgt.Text = row.Cells["MaxWgt"].Text;
-
- }
-
- }
- }
|