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; namespace Core.LZMes.Client.UIM { public partial class UIM010202 : FrmBase { public UIM010202() { InitializeComponent(); } public override void ToolBar_Click(object sender, string ToolbarKey) { switch (ToolbarKey) { case "Query": this.DoQuery(); break; case "Save": this.DoSave(); break; } } /// /// 查询待入库钢卷 /// private void DoQuery() { try { this.dataSet2.Tables[0].Clear(); // string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : ""; // string toprocuctedTime = ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : ""; string coilNo = textBox9.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010202"; ccp.MethodName = "queryCoilsInTblStock"; ccp.ServerParams = new object[] { coilNo }; ccp.SourceDataTable = this.dataSet2.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); textBox1.Text = ""; } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void DoQueryBuffer() { try { this.dataSet1.Tables[0].Clear(); // string procuctedTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : ""; // string toprocuctedTime = ultraDateTimeEditor3.Value != null ? ultraDateTimeEditor3.DateTime.ToString("yyyyMMdd") : ""; string coilNo = textBox9.Text.Trim(); CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010202"; ccp.MethodName = "queryCoilsInTblbuffer"; ccp.ServerParams = new object[] {}; ccp.SourceDataTable = this.dataSet1.Tables[0]; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); //统计钢卷数量,钢卷总重量 int coilCount = (int)dataSet1.Tables[0].Compute("count(COIL_NO)", ""); double coilWgtSum = 0; foreach (DataRow dr in dataSet1.Tables[0].Rows) { double tmpWgt = 0; try { tmpWgt = double.Parse(dr["WEIGHT"].ToString()); } catch (Exception e) { } coilWgtSum += tmpWgt; } this.textBox3.Text = coilCount.ToString(); this.textBox2.Text = (coilWgtSum / 1000).ToString(); textBox1.Text = ""; } catch (Exception EX) { MessageBox.Show(EX.ToString()); } } private void ultraGrid1_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { if (e.Cell.Column.Key == "CHK") { if (!Convert.ToBoolean(e.Cell.Value)) { for (int i = 0; i < ultraGrid1.Rows.Count; i++) { ultraGrid1.Rows[i].Cells["CHK"].Value = false; } e.Cell.Value = true; textBox1.Text = e.Cell.Row.Cells["COIL_NO"].Value.ToString(); yardControl1.Layer = "A"; yardControl1.Stock = "2"; yardControl1.Focus(); } else { e.Cell.Value = false; textBox1.Text = ""; } } } /// /// 成品库钢卷入库 /// private void DoSave() { bool flag = false; for (int i = 0; i < ultraGrid1.Rows.Count; i++) { if(Convert.ToBoolean(ultraGrid1.Rows[i].Cells["CHK"].Value)) { flag = true; break; } } if(!flag) { MessageBox.Show("请选择需要入库的钢卷!"); return; } string yardAddr = yardControl1.GetYardFlagZJ();//垛位 if (string.IsNullOrEmpty(yardAddr)) { MessageBox.Show("请选择需要入库的垛位!"); yardControl1.Focus(); return; } string entryShift = UserInfo.GetUserOrder();//入库班次 string entryGroup = UserInfo.GetUserGroup();//入库班组 string entryDtime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMddHHmmss");//入库时间 string reg_id = UserInfo.GetUserID();//操作人 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010202"; ccp.MethodName = "saveCoilYard"; ccp.ServerParams = new object[] { textBox1.Text.Trim(), yardAddr, entryShift, entryGroup, entryDtime, reg_id }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); if (0 == ccp.ReturnCode) { MessageBox.Show("入库成功!"); } DoQuery(); } private void button1_Click(object sender, EventArgs e) { string coilno; Infragistics.Win.UltraWinGrid.RowsCollection rs = this.ultraGrid2.Rows; if (rs.Count < 1) { MessageBox.Show("请先查询出数据!"); return; } coilno = rs[0].Cells["COIL_NO"].Value.ToString(); string outShift = UserInfo.GetUserOrder();//出库班次 string outGroup = UserInfo.GetUserGroup();//出库班组 string outDtime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss");//出库时间 string reg_id = UserInfo.GetUserID();//操作人 CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "UIM.UIM010202"; ccp.MethodName = "saveCoilHc"; ccp.ServerParams = new object[] { coilno, outShift, outGroup, outDtime, reg_id }; ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal); } private void button2_Click(object sender, EventArgs e) { DoQueryBuffer(); } private void button3_Click(object sender, EventArgs e) { DoSave(); } } }