| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293 |
- 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.Control;
- using Core.Mes.Client.Comm.Format;
- using Core.Mes.Client.Comm.Tool;
- using Core.StlMes.Client.LgResMgt.Mcms.entity;
- using CoreFS.CA06;
- namespace Core.StlMes.Client.LgResMgt.Mcms
- {
- public partial class FrmCarEff : FrmBase
- {
- public FrmCarEff()
- {
- InitializeComponent();
- }
- protected override void OnLoad(EventArgs e)
- {
- base.OnLoad(e);
- EntityHelper.ShowGridCaption<CmmCarEffEntity>(ugData.DisplayLayout.Bands[0]);
- DoQuery();
- }
-
-
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "DoQuery":
- DoQuery();
- break;
- case "DoUpdate":
- DoUpdate();
- break;
- case "DoAdd":
- DoAdd();
- break;
- case "DoDelete":
- DoDelete();
- break;
- case "DoRecover":
- DoRecover();
- break;
- case "Export":
- GridHelper.ulGridToExcel(ugData, "内倒车辆");
- break;
- case "DoClose":
- Close();
- break;
- }
- }
- private void DoRecover()
- {
- if (ugData.ActiveRow == null)
- {
- MessageBox.Show("请选择需要还原的车辆数据");
- return;
- };
- CmmCarEffEntity data = ugData.ActiveRow.ListObject as CmmCarEffEntity;
- CmmCarEffEntity data1 = new CmmCarEffEntity()
- {
- CarNo = data.CarNo,
- UpdateName = this.UserInfo.GetUserName()
- };
- var ccp = new CoreClientParam
- {
- ServerName = "com.steering.Mcms.CarEffServer",
- MethodName = "DoRecover",
- ServerParams = new object[]
- {
- JSONFormat.Format(data1),
-
- }
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.ToString2().Contains("成功"))
- {
- MessageBox.Show("成功还原车辆" + data.CarNo);
- DoQuery();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void DoDelete()
- {
- if (ugData.ActiveRow == null)
- {
- MessageBox.Show("请选择需要作废的车辆数据");
- return;
- };
- CmmCarEffEntity data = ugData.ActiveRow.ListObject as CmmCarEffEntity;
- CmmCarEffEntity data1 = new CmmCarEffEntity()
- {
- CarNo = data.CarNo,
- DeleteName = this.UserInfo.GetUserName()
- };
- var ccp = new CoreClientParam
- {
- ServerName = "com.steering.Mcms.CarEffServer",
- MethodName = "DoDelete",
- ServerParams = new object[]
- {
- JSONFormat.Format(data1),
-
- }
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.ToString2().Contains("成功"))
- {
- MessageBox.Show("成功作废车辆" + data.CarNo);
- DoQuery();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void DoUpdate()
- {
- if (String.IsNullOrWhiteSpace(uteCarNoEdit.Text))
- {
- MessageBox.Show("车牌号不能为空!");
- return;
- }
- if (String.IsNullOrWhiteSpace(uneTimeEff.Text))
- {
- MessageBox.Show("车牌皮重时效不能为空!");
- return;
- }
- CmmCarEffEntity data = new CmmCarEffEntity()
- {
- CarNo = uteCarNoEdit.Text,
- UpdateName = this.UserInfo.GetUserName(),
- TimeEff = decimal.Parse(uneTimeEff.Value.ToString3()),
- Id = uteId.Text
- };
- var ccp = new CoreClientParam
- {
- ServerName = "com.steering.Mcms.CarEffServer",
- MethodName = "DoUpdate",
- ServerParams = new object[]
- {
- JSONFormat.Format(data),
-
- }
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.ToString2().Contains("成功"))
- {
- MessageBox.Show("成功更新车辆" + data.CarNo);
- DoQuery();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
- private void DoAdd()
- {
- if (String.IsNullOrWhiteSpace(uteCarNoEdit.Text))
- {
- MessageBox.Show("车牌号不能为空!");
- return;
- }
- if (String.IsNullOrWhiteSpace(uneTimeEff.Text))
- {
- MessageBox.Show("车牌皮重时效不能为空!");
- return;
- }
- CmmCarEffEntity data = new CmmCarEffEntity()
- {
- CarNo = uteCarNoEdit.Text,
- CreateName = this.UserInfo.GetUserName(),
- TimeEff = decimal.Parse(uneTimeEff.Value.ToString3())
- };
-
- var ccp = new CoreClientParam
- {
- ServerName = "com.steering.Mcms.CarEffServer",
- MethodName = "DoAdd",
- ServerParams = new object[]
- {
- JSONFormat.Format(data),
-
- }
- };
- ccp = ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- if (ccp.ReturnCode != -1)
- {
- if (ccp.ReturnInfo.ToString2().Contains("成功"))
- {
- MessageBox.Show("成功新增车辆" + data.CarNo);
- DoQuery();
- }
- else
- {
- MessageUtil.ShowTips(ccp.ReturnInfo);
- }
- }
- }
-
- private void DoQuery()
- {
- var dic = new Dictionary<string, object>();
- dic.Add("carNo", uteCarNo.Text);
- if (chkValidflag.Checked)
- {
- dic.Add("validflag", new List<string>() {"1", "0"});
- }
- else
- {
- dic.Add("validflag", new List<string>() { "1" });
- }
- cmmCarEffEntityBindingSource.DataSource = EntityHelper.GetData<CmmCarEffEntity>(
- "com.steering.Mcms.CarEffServer.doQuery",
- new object[] { dic },
- ob);
- Comm.RefreshAndAutoSize(ugData);
- }
- private void ugData_AfterRowActivate(object sender, EventArgs e)
- {
- if(ugData.ActiveRow==null) return;
- CmmCarEffEntity data = ugData.ActiveRow.ListObject as CmmCarEffEntity;
- uteCarNoEdit.Text = data.CarNo;
- uneTimeEff.Value = data.TimeEff;
- uteId.Text = data.Id;
- }
- private void ugData_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
- {
- CmmCarEffEntity data = e.Row.ListObject as CmmCarEffEntity;
- if (data != null)
- {
- if(data.Validflag=="0") e.Row.Cells["Validflag"].Appearance.BackColor= Color.Red;
- }
- }
-
-
- }
- }
|