using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using Core.Mes.ClientFrameWork; using Core.Mes.IBaseInterface; using System.Data; namespace Core.XgMes.Client.JGKC.RollManager { public partial class FrmJBCB : Mes.ClientFrameWork.FrmBase { public FrmJBCB() { InitializeComponent(); } private void gb_Plan_AfterRowActivate(object sender, EventArgs e) { if (this.gb_Plan.ActiveRow == null) return; if (gb_Plan.ActiveRow != null) { this.txt_old_bh.Text = gb_Plan.ActiveRow.Cells["COIL_NO_ID"].Value.ToString(); this.txt_old_Count.Text = gb_Plan.ActiveRow.Cells["ZSLAB_NUM"].Value.ToString(); this.txt_old_WEIGHT.Text = gb_Plan.ActiveRow.Cells["ZSLAB_WEIGHT"].Value.ToString(); this.txt_old_XJZL.Text = gb_Plan.ActiveRow.Cells["XJJL_WEIGHT"].Value.ToString(); txt_Length.Text = gb_Plan.ActiveRow.Cells["ZSLAB_LENGTH"].Value.ToString(); txt_Ply.Text = gb_Plan.ActiveRow.Cells["ZSLAB_PLY"].Value.ToString(); txt_Width.Text = gb_Plan.ActiveRow.Cells["ZSLAB_WIDTH"].Value.ToString(); this.txt_nes_bh.Text = gb_Plan.ActiveRow.Cells["COIL_NO_ID"].Value.ToString(); } } private void doQuery() { string where = " "; if (chk_CollectTime.Checked) { if (ultSJ.Value.ToString() == "0") { where += " AND TO_CHAR(A.CREATETIME,'YYYY-MM-DD') >='" + Convert.ToDateTime(this.dte_BeginTime.Value).ToString("yyyy-MM-dd") + "' " + " AND TO_CHAR(A.CREATETIME,'YYYY-MM-DD') <='" + Convert.ToDateTime(this.dte_EndTime.Value).ToString("yyyy-MM-dd") + "' "; } else { where += " AND TO_CHAR(A.TIME_,'YYYY-MM-DD') >='" + Convert.ToDateTime(this.dte_BeginTime.Value).ToString("yyyy-MM-dd") + "' " + " AND TO_CHAR(A.TIME_,'YYYY-MM-DD') <='" + Convert.ToDateTime(this.dte_EndTime.Value).ToString("yyyy-MM-dd") + "' "; } } if (chk_RollHao.Checked) { where += " AND A.COIL_NO_ID LIKE '" + txt_RollHao .Text.Trim().ToString()+ "%'"; } string strOut = ""; DataSet ds = new DataSet(); if (ultSJ.Value.ToString() == "0") { ds = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.TurnoffManage", "Turn_CB_Query", new object[] { where }, out strOut); this.gb_Plan.DataSource = ds; this.gb_Plan.UpdateData(); Comm.SetGridSumArea(this.gb_Plan); } else { ds = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.TurnoffManage", "Turn_CB_JL", new object[] { where }, out strOut); this.ultraGrid2.DataSource = ds; this.ultraGrid2.UpdateData(); Comm.SetGridSumArea(this.ultraGrid2); } } private void doAdd() { if (!Check_CB()) { return; } try { string strOut = ""; ArrayList Other = new ArrayList(); Other.Add(this.txt_old_bh.Text.ToString().Trim());//原包号 Other.Add(this.txt_old_Count.Value.ToString().Trim());//原数量 Other.Add(this.txt_old_WEIGHT.Value.ToString().Trim());//原理论重量 Other.Add(this.txt_old_XJZL.Value.ToString().Trim());//原小件计量 Other.Add(this.txt_nes_bh.Value.ToString());//新包号 Other.Add(this.txt_new_count.Value.ToString());//新数量 Other.Add(this.txt_new_lz.Value.ToString());//新理论重量 Other.Add(this.txt_new_bz.Value.ToString());//新计量重量 Other.Add(this.txt_Remark.Text.ToString());//备注 Other.Add(Core.Mes.ClientFrameWork.ClientCommon._UserInfo.UserName); object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("BJZWJBStuff", "Core.XgMes.Server.JGKC.RollManager.ProduceManage", "UnPack_Add", new object[] { Other }, out strOut); if (obj != null && obj.ToString() == "1") { this.doQuery(); Comm.SetGridSumArea(this.gb_Plan); } else { MessageBox.Show(strOut, "警告", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private bool Check_CB() { if (this.txt_nes_bh.Text.Trim().Length == 0) { MessageBox.Show("新包号不能为空!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return false; } if (this.txt_new_count.Text.Trim().Length == 0) { MessageBox.Show("拆包数量不能为空!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return false; } if (Convert.ToDecimal(this.txt_new_count.Text.Trim()) > Convert.ToDecimal(this.txt_old_Count.Text.Trim())) { MessageBox.Show("拆包数量不能大于原始包号的数量!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return false; } if (this.txt_old_bh.Text.Trim()==txt_nes_bh.Text.Trim()) { MessageBox.Show("新包号不能与原包号一致!", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return false; } return true; } private void chk_RollHao_CheckedChanged(object sender, EventArgs e) { txt_RollHao.Enabled = chk_RollHao.Checked; } private void FrmJBCB_Load(object sender, EventArgs e) { ultSJ.Value = "0"; dte_BeginTime.Value=DateTime.Now; dte_EndTime.Value = DateTime.Now; } private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "query": doQuery(); break; case "cbadd": doAdd(); break; case "cbjl": doQuery(); break; } } private void txt_nes_bh_Enter(object sender, EventArgs e) { try { if (sender.GetType().ToString() == "Infragistics.Win.UltraWinEditors.UltraTextEditor") { ((Infragistics.Win.UltraWinEditors.UltraTextEditor)sender).SelectAll(); } if (sender.GetType().ToString() == "Infragistics.Win.UltraWinEditors.UltraNumericEditor") { ((Infragistics.Win.UltraWinEditors.UltraNumericEditor)sender).SelectAll(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void txt_nes_bh_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyData == Keys.Return) { if (((System.Windows.Forms.Control)sender).Name == "txt_new_count") { if (Comm.ObjToInt(this.txt_new_count.Value) == 0) { MessageBox.Show("数量不能为空", "提示", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information); return; } this.txt_new_lz.Value = ((Comm.ObjToInt(this.txt_Width.Value) * Comm.ObjToDouble(this.txt_Ply.Value) * Comm.ObjToInt(this.txt_Length.Value) * Comm.ObjToInt(this.txt_new_count.Value)) * 0.00000785); } System.Windows.Forms.SendKeys.Send("{TAB}"); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } } }