| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- 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 CoreFS.CA06;
- using System.Collections;
- namespace Core.LZMes.Client.UIK
- {
- public partial class UIK050010 : FrmBase
- {
- public UIK050010()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey)
- {
- switch (ToolbarKey)
- {
- case "Query":
- this.DoQuery();
- break;
- case "Insert":
- this.DoInsert();
- break;
- case"Update":
- this.DoUpdate();
- break;
- }
- }
- private void UIK050010_Load(object sender, EventArgs e)
- {
-
- }
- private void DoQuery()
- {
- try
- {
- string zgNum = "";
- string zgAr = "";
- string beginTime = "";
- string endTime = "";
- bool flag = false;
- CoreClientParam ccp = new CoreClientParam();
- CoreClientParam ccp2 = new CoreClientParam();
- //if (this.zgNumber.Text == "" && this.zgArea.Text == "" && this.ultraCheckEditor1.Checked == false)
- //{
- // MessageBox.Show("请选择查询条件!");
- //}
- //else
- //{
- if (this.ultraCheckEditor1.Checked)
- {
- this.dataSet1.Tables[0].Clear();
- this.dataSet2.Tables[0].Clear();
- this.zgArea.Clear();
- this.zgNumber.Clear();
- this.ultraCheckEditor1.Checked = false;
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoQueryShang";
- ccp.ServerParams = new object[] { zgNum, zgAr, flag ,beginTime,endTime};
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoQueryXia";
- ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("暂无记录!");
- }
- return;
- }
- else
- {
- flag = true;
- if (this.zgArea.Text == "" || this.zgNumber.Text == "")
- {
- if (this.zgNumber.Text == "")
- {
- this.dataSet1.Tables[0].Clear();
- this.dataSet2.Tables[0].Clear();
- zgAr = this.zgArea.Text;
- beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
- endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
- this.zgArea.Clear();
- this.zgNumber.Clear();
- this.ultraCheckEditor1.Checked = false;
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoQueryShang";
- ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoQueryXia";
- ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("该区域的记录不存在!");
- }
- return;
- }
- if (this.zgArea.Text == "")
- {
- this.dataSet1.Tables[0].Clear();
- this.dataSet2.Tables[0].Clear();
- zgNum = this.zgNumber.Text;
- beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
- endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
- this.zgArea.Clear();
- this.zgNumber.Clear();
- this.ultraCheckEditor1.Checked = false;
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoQueryShang";
- ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoQueryXia";
- ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("该换辊计划号记录不存在,请查证后查询!");
- }
- return;
- }
- }
- if (this.zgArea.Text == "" && this.zgNumber.Text == "")
- {
- beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
- endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
- this.zgArea.Clear();
- this.zgNumber.Clear();
- this.ultraCheckEditor1.Checked = false;
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoQueryShang";
- ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoQueryXia";
- ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- DataRowCollection drc2 = this.dataSet1.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("记录不存在,请查证后查询!");
- }
- return;
- }
- else
- {
- this.dataSet1.Tables[0].Clear();
- this.dataSet2.Tables[0].Clear();
- zgNum = this.zgNumber.Text;
- zgAr = this.zgArea.Text;
- beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
- endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
- this.zgArea.Clear();
- this.zgNumber.Clear();
- this.ultraCheckEditor1.Checked = false;
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoQueryShang";
- ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoQueryXia";
- ccp2.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
- ccp2.SourceDataTable = this.dataSet2.Tables[0];
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("记录不存在,请查证后查询!");
- }
- return;
- }
- }
- }
- // }
- catch (Exception Ex)
- {
- MessageBox.Show(Ex.ToString());
- }
- }
- private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
- {
- try
- {
- if (this.ultraCheckEditor1.Checked)
- {
- this.zgNumber.Enabled = false;
- this.zgArea.Enabled = false;
- }
- if (!this.ultraCheckEditor1.Checked)
- {
- this.zgNumber.Enabled = true;
- this.zgArea.Enabled = true;
- }
- }
- catch (Exception Ex)
- {
- MessageBox.Show(Ex.ToString());
- }
- }
- private void DoInsert()
- {
- try
- {
- if (this.ultraTextSand_id.Text == "" || this.ultraTextReg_id.Text == "")
- {
- MessageBox.Show("机架号和操作人必填!");
- }
- else
- {
- string sand_Id = this.ultraTextSand_id.Text;
- string roll_Type = this.ultraComboRollType.Text;
- string roll_Area = this.ultraComboArea.Text;
-
- string roll_Id_up = this.ultraTextRoll_id_up.Text;
- string roll_Id_lo = this.ultraTextRoll_id_lo.Text;
- string reg_Id = this.ultraTextReg_id.Text;
- string reg_Dtime = System.DateTime.Now.ToString();
- string updia = this.ultraTextUpdia.Text;
- string lodia = this.ultraTextLodia.Text;
- string xiatu = this.ultraTextXiaTu.Text;
- string shangtu = this.ultraTextShangTu.Text;
- string sshap = this.ultraTextSshap.Text;
- string xshap = this.ultraTextXshap.Text;
- string scai = this.ultraComboScai.Text;
- string xcai = this.ultraComboXcai.Text;
- if (scai == "光辊") { scai = "1"; }
- if (scai == "毛辊") { scai = "2"; }
- if (xcai == "光辊") { xcai = "1"; }
- if (xcai == "毛辊") { xcai = "2"; }
- System.DateTime dtt = System.DateTime.Now;
- string spec_No = (string.Format("{0:yyyyMMddHHmmss}", dtt)).Substring(8, 6);
- string number = reg_Dtime;
- DataTable dt = new DataTable();
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoSelect";
- ccp2.ServerParams = new object[] { reg_Dtime };
- ccp2.SourceDataTable = dt;
- this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
- if (dt.Rows.Count > 0)
- {
- MessageBox.Show("换辊计划已存在,请查证后填写!");
- this.ultraTextSand_id.Clear();
- this.ultraComboArea.Clear();
- this.ultraComboRollType.Clear();
- this.ultraTextRoll_id_up.Clear();
- this.ultraTextRoll_id_lo.Clear();
- this.ultraTextReg_id.Clear();
- this.ultraTextUpdia.Clear();
- this.ultraTextLodia.Clear();
- this.ultraTextXiaTu.Clear();
- this.ultraTextShangTu.Clear();
- this.ultraTextSshap.Clear();
- this.ultraTextXshap.Clear();
- this.ultraComboScai.Clear();
- this.ultraComboXcai.Clear();
- }
- else
- {
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "PlanAdd";
- ccp.ServerParams = new object[] { sand_Id, roll_Type, roll_Area, spec_No, roll_Id_up, roll_Id_lo, reg_Id, reg_Dtime, updia, lodia, shangtu, xiatu, sshap, xshap, scai, xcai };
- ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- //if (0 != ccp.ReturnCode) return;
- if (0 != ccp.ReturnCode)
- {
- MessageBox.Show("添加失败");
- }
- else
- {
- MessageBox.Show("添加成功");
- this.ultraTextSand_id.Clear();
- this.ultraComboArea.Clear();
- this.ultraComboRollType.Clear();
-
- this.ultraTextRoll_id_up.Clear();
- this.ultraTextRoll_id_lo.Clear();
- this.ultraTextReg_id.Clear();
- this.ultraTextUpdia.Clear();
- this.ultraTextLodia.Clear();
- this.ultraTextXiaTu.Clear();
- this.ultraTextShangTu.Clear();
- this.ultraTextSshap.Clear();
- this.ultraTextXshap.Clear();
- this.ultraComboScai.Clear();
- this.ultraComboXcai.Clear();
- }
- }
- }
- }
- catch (Exception Ex)
- {
- MessageBox.Show(Ex.ToString());
- }
- }
-
- private void DoUpdate()
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid1.ActiveRow;
- if (ugr.Cells["SELECT_ITEM"].Text.ToString() == "True")
- {
- if (ugr.Cells["MEG_FLAG"].Value.ToString() == "是")
- {
- MessageBox.Show("该计划已下发!");
- ugr.Cells["SELECT_ITEM"].Value = false;
- }
- else
- {
- string reg_Dtime,number, roll_type, roll_id_up, roll_id_lo, up_shape, lo_shape, area, stand_id, up_diameter, lo_diameter, lo_crown, up_crown, up_pro, lo_pro;
- //long spec_no, area, stand_id, up_diameter, lo_diameter, lo_crown, up_crown, up_pro, lo_pro;
- //DateTime r_dt;
- string uid = "Core.LZMes.Client.UIK.UIK050010";
- reg_Dtime = ugr.Cells["REG_DTIME"].Value.ToString();
-
- DataTable dt = new DataTable();
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK05.UIK050010";
- ccp.MethodName = "DoSelect";
- ccp.ServerParams = new object[] { reg_Dtime };
- ccp.SourceDataTable = dt;
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
-
- foreach (DataRow dr in dt.Rows)
- {
- number = dr["SPEC_NO"].ToString();
- area = dr["ROLL_AREA"].ToString();
- stand_id = dr["STAND_ID"].ToString();
- roll_type = dr["ROLL_TYPE"].ToString();
- roll_id_up = dr["ROLL_ID_UP"].ToString();
- roll_id_lo = dr["ROLL_ID_LO"].ToString();
- up_diameter = dr["ROLL_DIAMETER_UP"].ToString();
- lo_diameter = dr["ROLL_DIAMETER_LO"].ToString();
- lo_crown = dr["ROLL_CROWN_LO"].ToString();
- up_crown = dr["ROLL_CROWN_UP"].ToString();
- up_shape = dr["ROLL_SHAPE_UP"].ToString();
- lo_shape = dr["ROLL_SHAPE_LO"].ToString();
- up_pro = dr["ROLL_PROPERTY_CLASS"].ToString();
- lo_pro = dr["ROLL_PROPERTY_CLASS_LO"].ToString();//1为光辊,2为毛辊
- CoreClientParam ccp2 = new CoreClientParam();
- ccp2.ServerName = "UIK.UIK05.UIK050010";
- ccp2.MethodName = "DoSend";
- ccp2.ServerParams = new object[] { number, reg_Dtime, area, stand_id, roll_type, roll_id_up, roll_id_lo, up_diameter, lo_diameter, lo_crown, up_crown, up_shape, lo_shape, up_pro, lo_pro, uid };
- ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- if (0 != ccp2.ReturnCode)
- {
- MessageBox.Show("下发失败!");
- }
- else
- {
- MessageBox.Show("下发成功!");
- CoreClientParam ccp3 = new CoreClientParam();
- ccp3.ServerName = "UIK.UIK05.UIK050010";
- ccp3.MethodName = "DoUpdate";
- ccp3.ServerParams = new object[] { reg_Dtime };
- ccp3 = this.ExecuteNonQuery(ccp3, CoreInvokeType.Internal);
- if (0 != ccp3.ReturnCode)
- {
- MessageBox.Show("下发计划修改失败!");
- }
- else
- {
- MessageBox.Show("下发计划已修改成功!");
- }
- }
-
- }
-
- }
- }
- else
- {
- MessageBox.Show("请选择下发行!");
- }
- }
-
-
- //private void A()
- //{
- // Infragistics.Win.UltraWinGrid.UltraGridRow ugr=this.ultraGrid1.ActiveRow;
- // foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.ultraGrid1.Rows)
- // {
- // if (row.Cells["SELECTITEM"].Value.ToString() == "true")
- // {
- // }
- // }
- //}
- //在cellchangde事件中去控制 只选中一行 不能选择多行
- }
- }
|