| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338 |
- 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 Infragistics.Win.UltraWinEditors;
- namespace Core.LZMes.Client.UIK
- {
- public partial class UIK080020 : FrmBase
- {
- public UIK080020()
- {
- InitializeComponent();
- }
- public override void ToolBar_Click(object sender, string ToolbarKey) //选择菜单
- {
- switch (ToolbarKey)
- {
- case "Query": //查询
- this.doQuery();
- break;
- case "Out": //出库
- this.doOut();
- break;
- case "Back": //回退
- this.doBack();
- break;
- case "Update": //修改
- this.DoUpdate();
- break;
- case "Exit": //退出
- this.doExit();
- break;
- }
- }
- private void doQuery() //废钢卷查询
- {
- try
- {
- this.dataSet1.Tables[0].Clear();
-
- string startTime = null == this.ultraDateTimeEditor1.Value ? "" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddhh24miss");//入库开始时间
- string endTime = null == this.ultraDateTimeEditor2.Value ? "" : this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddhh24miss");//入库结束时间
- string coilNo = this.textBox1.Text;//钢卷号
- string specStlGrd = this.textBox2.Text;//牌号
- string coilWthMin = this.textBox3.Text;//宽度最小值
- string coilWthMax = this.textBox4.Text;//宽度最大值
- string coilThkMin = this.textBox5.Text;//厚度最小值
- string coilThkMax = this.textBox6.Text;//厚度最大值
- string curLoadLoc = this.textBox7.Text;//垛位
- string ordNo = this.textBox8.Text;//订单号
- string ordSeq = "";// this.textBox12.Text;//合同号
- string ordFl = -1 == this.ultraComboEditor1.SelectedIndex ? "" : this.ultraComboEditor1.Value.ToString();//订单区分
- string devlmtDate = null == this.ultraDateTimeEditor3.Value ? "" : this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMddhh24miss");//交货期
- string progCd = -1 == this.ultraComboEditor2.SelectedIndex ? "" : this.ultraComboEditor2.Value.ToString();//进程状态
- string smpSendTime = null == this.ultraDateTimeEditor4.Value ? "" : this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMddhh24miss");//送样时间
- string prodnmCd = -1 == this.ultraComboEditor3.SelectedIndex ? "" : this.ultraComboEditor3.Value.ToString();//产品类型
- string[] queryParams = new string[] { startTime, endTime, specStlGrd, coilWthMin, coilWthMax,
- coilThkMin, coilThkMax, curLoadLoc, coilNo, ordNo, ordSeq, ordFl, devlmtDate, progCd, smpSendTime,
- prodnmCd};
- List<string[]> list = new List<String[]>();
- list.Add(queryParams);
- CoreClientParam ccp = new CoreClientParam();
- ccp.ServerName = "UIK.UIK08.UIK080020";
- ccp.MethodName = "doQuery";
- ccp.ServerParams = new object[] { list };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
- if (drc1.Count <= 0)
- {
- MessageBox.Show("无查询记录!");
- return;
- }
-
- //统计钢卷数量,钢卷总重量
- /* int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
- double coilWgtSum = 0;
- foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid2.Rows)
- {
- double actWgt = 0;
- try
- {
- Color color = Color.SandyBrown;
- string status = ugr.Cells["checkBox"].Value.ToString().Trim();
- if ("合格".Equals(status))
- {
- color = Color.White;
- }
- else if ("不合格".Equals(status))
- {
- color = Color.FromArgb(255, 128, 128);
- }
- ugr.Appearance.BackColor = color;
- actWgt = double.Parse(ugr.Cells["checkBox"].Value.ToString().Trim());
- }
- catch (Exception e)
- {
- }
- coilWgtSum += actWgt;
- }
- this.textBox10.Text = coilCount.ToString();
- this.textBox9.Text = (coilWgtSum / 1000).ToString();*/
- DataRowCollection drs = this.dataSet1.Tables[0].Rows;
- int coilCount = 0;
- double wgtCount = 0;
- int drsSize = drs.Count;
- coilCount = drsSize;
- for (int i = 0; i < drsSize; i++)
- {
- wgtCount += double.Parse(drs[i]["ACT_WGT"].ToString());
- }
- this.textBox10.Text = coilCount.ToString();
- this.textBox9.Text = (wgtCount/1000).ToString();
- }
-
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- }
-
- private void UIK080020_Load(object sender, EventArgs e)
- {
- this.ultraDateTimeEditor1.Value = "";
- this.ultraDateTimeEditor2.Value = "";
- this.ultraDateTimeEditor3.Value = "";
- this.ultraDateTimeEditor4.Value = "";
- // this.checkBox.Checked = false;
- }
- private void doOut() //废钢卷出库
- {
- try
- {
- this.ultraGrid2.UpdateData();
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- bool flag = false;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- if (ultraGrid2.Rows[i].Cells["checkBox"].Value.ToString().ToUpper() == "TRUE")
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- MessageBox.Show("请选择需要出库的废钢卷!");
- }
- else
- {
- DataRow[] selectedRows = this.dataSet1.Tables[0].Select("checkBox ='True'");
- CoreClientParam ccp = new CoreClientParam();
- for (int i = 0; i < selectedRows.Length; i++)
- {
- string oldsamplno = selectedRows[i]["OLD_SAMPL_NO"].ToString(); //取所选行的钢卷号
- string curloadloc = selectedRows[i]["CUR_LOAD_LOC"].ToString(); //取所选行的垛位号
- string regID = this.UserInfo.GetUserID();//出库人
- string trnfShift = this.UserInfo.GetUserOrder();//出库班次
- string trnfGroup = this.UserInfo.GetUserGroup();//出库班组
- ccp.ServerName = "UIK.UIK08.UIK080020";
- ccp.MethodName = "doOut";
- ccp.ServerParams = new object[] { oldsamplno,curloadloc, regID, trnfShift, trnfGroup };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
- /* DataRow dr = this.dataSet1.Tables[0].NewRow();
- this.dataSet1.Tables[0].Rows.Add(dr);
- this.dataSet1.Tables[0].AcceptChanges();*/
- }
- if (0 != ccp.ReturnCode)
- {
- MessageBox.Show("出库操作失败!");
- }
- else
- {
- MessageBox.Show("出库操作成功!");
- }
- }
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- this.doQuery();
- }
- private void doBack() //废钢卷回退
- {
- try
- {
- this.ultraGrid2.UpdateData();
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- CoreClientParam ccp = new CoreClientParam();
- bool flag = false;
- for (int i = 0; i < ultraGrid2.Rows.Count; i++)
- {
- if (ultraGrid2.Rows[i].Cells["checkBox"].Value.ToString().ToUpper() == "TRUE")
- {
- flag = true;
- break;
- }
- }
- if (!flag)
- {
- MessageBox.Show("请选择需要回退的废钢卷!");
- }
- else
- {
-
- DataRow[] selectedRows = this.dataSet1.Tables[0].Select("checkBox ='True'");
- string oldsamplno = "", curloadloc = "", regID, trnfShift, trnfGroup;
- for (int i = 0; i < selectedRows.Length; i++)
- {
- oldsamplno = selectedRows[i]["OLD_SAMPL_NO"].ToString(); //取所选行的钢卷号
- curloadloc = selectedRows[i]["BEF_LOAD_LOC"].ToString(); //取所选行的垛位号
- regID = this.UserInfo.GetUserID();//操作人
- trnfShift = this.UserInfo.GetUserOrder();//操作班次
- trnfGroup = this.UserInfo.GetUserGroup();//操作班组
- ccp.ServerName = "UIK.UIK08.UIK080020";
- ccp.MethodName = "doBack";
- ccp.ServerParams = new object[] { oldsamplno, curloadloc, regID, trnfShift, trnfGroup };
- ccp.SourceDataTable = this.dataSet1.Tables[0];
- this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
- // if (ccp.ReturnCode == -1)
- if (0 != ccp.ReturnCode)
- {
- MessageBox.Show("回退失败!");
- return;
- }
- else
- {
- MessageBox.Show("回退成功!");
- }
- /* DataRow dr = this.dataSet1.Tables[0].NewRow();
- dr.ItemArray = new object[] { oldsamplno, curloadloc, regID, trnfShift, trnfGroup };
- this.dataSet1.Tables[0].Rows.Add(dr);
- this.dataSet1.Tables[0].AcceptChanges();*/
- }
-
- }
- }
- catch (Exception EX)
- {
- MessageBox.Show(EX.ToString());
- }
- this.doQuery();
- }
- private void DoUpdate() //修改废钢卷状态信息
- {
-
- try
- {
- Infragistics.Win.UltraWinGrid.UltraGridRow ugr = this.ultraGrid2.ActiveRow;
- CoreClientParam ccp2 = new CoreClientParam();
- string oldsamplno, curloadloc, coilstat;
-
- if (ugr.Cells["checkBox"].Text.ToString() == "True")
- {
-
- oldsamplno = ugr.Cells["OLD_SAMPL_NO"].Text.ToString();
- curloadloc = ugr.Cells["CUR_LOAD_LOC"].Text.ToString();
- coilstat = ugr.Cells["COIL_STAT"].Text.ToString();
- ccp2.ServerName = "UIK.UIK08.UIK080020";
- ccp2.MethodName = "DoUpdate";
- ccp2.ServerParams = new object[] { oldsamplno, curloadloc, coilstat };
- ccp2 = this.ExecuteNonQuery(ccp2, CoreInvokeType.Internal);
- this.ultraGrid2.Update();
-
- if (MessageBox.Show("您确认要修改?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
- {
- if (0 != ccp2.ReturnCode)
- {
- MessageBox.Show("修改失败!");
- }
- else
- {
- MessageBox.Show("修改成功!");
- }
- }
- }
- else
- {
- MessageBox.Show("请选择修改行!");
- }
- }
- catch (Exception Ex)
- {
- MessageBox.Show(Ex.ToString());
- }
- this.doQuery();
- }
- public void doExit()
- {
- DialogResult dr = MessageBox.Show("确定退出系统吗?", "提示", MessageBoxButtons.OKCancel);
- if (dr == DialogResult.OK)
- {
- this.Dispose();
- }
- else
- {
- return;
- }
- }
-
- }
- }
|