using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Stone.Common; using Stone.Entity; using Stone.WinBiz.JISAdmin; namespace Stone.WinModule.JISAdmin.ReOrder { public partial class frmEdiPrintReOrderPackingList : Stone.WinModule.frmBase { public frmEdiPrintReOrderPackingList() { InitializeComponent(); } private void frmEdiPrintReOrderPackingList_Load(object sender, EventArgs e) { this.cbFields.SelectedIndex = 0; this.timer1.Interval = Convert.ToInt32(MyAppconfig.ReadValue("EDI显示刷新时间")) * 1000; this.timer1.Enabled = true; } private void btnQuery_Click(object sender, EventArgs e) { try { string PackageGroupName = ""; if (rbType1.Checked) PackageGroupName = rbType1.Text; if (rbType2.Checked) PackageGroupName = rbType2.Text; if (rbType3.Checked) PackageGroupName = rbType3.Text; if (rbType4.Checked) PackageGroupName = rbType4.Text; if (rbType5.Checked) PackageGroupName = rbType5.Text; string Fields = this.cbFields.SelectedItem.ToString(); string value = this.txtKey.Text.Trim(); string d1 = MyDateTime.Format(this.dateTimePicker1.Value, MyDateTimeType.Date) + " 00:00:00"; string d2 = MyDateTime.Format(this.dateTimePicker2.Value, MyDateTimeType.Date) + " 23:59:59"; string strWhere = "[PackageGroupName]='{4}' and [IsPrintAssemble]=1 and [IsPrintPackingList]={0} and [SwetTime]>='{1}' and [SwetTime]<='{2}' {3}"; object[] obj = new object[10]; obj[0] = rbPrint1.Checked ? "1" : "0"; obj[1] = d1; obj[2] = d2; obj[3] = " and " + Fields + "='" + value + "'"; obj[4] = PackageGroupName; if (value == "") obj[3] = ""; strWhere = string.Format(strWhere, obj); Entity_t_JIS_Seq5000_ReOrder t_JIS_Seq5000_ReOrder = new Entity_t_JIS_Seq5000_ReOrder(); this.dgrdView1.DataSource = t_JIS_Seq5000_ReOrder.GetData("", strWhere, "SwetTime,SequenceNumber asc").Tables[0]; MyGridViewStyle.SetDataGridRowNumber(this.dgrdView1); MyGridViewStyle.SetDataGridMenuCommon(this.dgrdView1); MyGridViewStyle.GetGridViewState(this.dgrdView1, "ReOrderJIS装箱单"); this.dgrdView1.Columns["ID"].Visible = false; this.dgrdView1.Columns["SequenceNumber"].HeaderText = "EINSTEIN Seq"; this.lblState.Text = "记录:" + this.dgrdView1.Rows.Count.ToString(); } catch (Exception ex) { this.lblShow.Text = ex.Message; } } private void btnRePrint_Click(object sender, EventArgs e) { try { if (MyMessageBox.ShowQuestion("请选择一条已经打印数据,是否要补打?")) { string PackingListNumber = this.dgrdView1.SelectedRows[0].Cells["PackingListNumber"].Value.ToString(); Entity_t_JIS_Seq5000_ReOrder t_JIS_Seq5000_ReOrder = new Entity_t_JIS_Seq5000_ReOrder(); DataSet dsData = t_JIS_Seq5000_ReOrder.GetData("", "[PackingListNumber]='" + PackingListNumber + "'", "[SwetTime], [SequenceNumber] ASC"); if (dsData.Tables[0].Rows.Count == 0) throw new Exception(PackingListNumber + " 单据中没有可打印的数据!"); string PackageGroupName = dsData.Tables[0].Rows[0]["PackingListNumber"].ToString(); string PagerNumber = dsData.Tables[0].Rows[0]["PagerNumber"].ToString(); F_JIS5000_Print_ReOrder.PrintPackingList(dsData, PackingListNumber, PackageGroupName, PagerNumber); } } catch (Exception ex) { MyMessageBox.ShowErrorMessage(ex.Message); } } private void btnSet_Click(object sender, EventArgs e) { MyGridViewStyle.Show(this.dgrdView1, "ReOrderJIS装箱单"); } private void btnOutPut_Click(object sender, EventArgs e) { try { Stone.Common.MyExport.ShowExport(this.dgrdView1); } catch (Exception ex) { MyMessageBox.ShowInfoMessage(ex.Message); } } private void chkAuto_CheckedChanged(object sender, EventArgs e) { AutoUpdate(); } private void AutoUpdate() { if (chkAuto.Checked) { this.lblShow.Text = "自动刷新中..."; this.Update(); btnQuery_Click(new object(), new EventArgs()); this.lblShow.Text = DateTime.Now.ToString() + " 自动刷新完成,下次刷新 " + Convert.ToString(this.timer1.Interval / 1000) + " 秒以后"; } else { this.lblShow.Text = "自动刷新关闭"; } } private void timer1_Tick(object sender, EventArgs e) { AutoUpdate(); } private void frmEdiPrintReOrderPackingList_FormClosing(object sender, FormClosingEventArgs e) { try { MyGridViewStyle.SaveGridViewState(this.dgrdView1, "ReOrderJIS装箱单"); } catch { } } } }