using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using Pub_Class; namespace SCM { public partial class Gy_SourceBillList_Touch : Form { public Gy_SourceBillList_Touch() { InitializeComponent(); } //定义 public const Int16 HTagCol = 0; public const Int16 HSnoCol = 1; public const Int16 HMainIDCol = 2; public const Int16 HSubIDCol = 3; public const Int16 HMaterNumberCol = 4; public const Int16 HMaterNameCol = 5; public const Int16 HMaterModelCol = 6; public const Int16 HUnitNameCol = 7; public const Int16 HBatchNoCol = 8; public const Int16 HQtyCol = 9; public const Int16 HRelationQtyCol = 10; public frmBillQueryCondition_Base frmCondition; const string ModCaption = "源单列表"; ClsGridViewSum oSumGrid = new ClsGridViewSum(); public Int32 iTopRow = 0;//画横线 SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1(); // #region 固定代码 //清空界面 public void Sub_ClearBill() { cmbHSourceBillType.Items.Clear(); // cmbHSourceBillType.Items.Add("生产订单"); cmbHSourceBillType.Items.Add("生产汇报单"); cmbHSourceBillType.Items.Add("收料通知单"); cmbHSourceBillType.SelectedIndex = 0; // txtHSourceBillNo.Text = ""; initGrid(); txtHSourceBillNo.Focus(); } private void Gy_SourceBillList_Touch_Load(object sender, EventArgs e) { //设置动态URL oWeb.Url = SCM.ClsPub1.WEBSURL; // frmCondition = new frmBillQueryCondition_Base(); this.Text = ModCaption; //lblCaption.Text = ModCaption; oSumGrid.ogrdMain = grdMain; //初始化 new oSumGrid.oGridsum = grdSum; initGrid(); cmbHSourceBillType.SelectedIndex = 0; } //时间控件 private void timer1_Tick(object sender, EventArgs e) { timer1.Enabled=false; Sub_ClearBill(); } private void timer2_Tick(object sender, EventArgs e) { timer2.Enabled = false; } private void grdMain_Paint(object sender, PaintEventArgs e) { GraphicsGrid(); } private void GraphicsGrid() { //画底线 DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain); //画横线 //DBUtility.Xt_BaseBillFun.GraphicsRowGrid(grdMain, iTopRow, iTopRow + 50, Fun_GetCol("hmainid")); } private Int32 Fun_GetCol(string sCol) { return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain); } //保存列宽 private void bclk_Click(object sender, EventArgs e) { DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name); } //默认列宽 private void mrlk_Click(object sender, EventArgs e) { DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name); } #endregion #region 窗体处理方法 //初始化GRID private void initGrid() { grdMain.RowCount = 0; grdMain.ColumnCount = 11; //总列数 ClsPub1.initGridFst(grdMain, this.Name); // grdMain.Columns[HSnoCol].HeaderText = "序号"; grdMain.Columns[HMaterNumberCol].HeaderText = "物料代码"; grdMain.Columns[HMaterNameCol].HeaderText = "物料名称"; grdMain.Columns[HMaterModelCol].HeaderText = "规格型号"; grdMain.Columns[HUnitNameCol].HeaderText = "计量单位"; grdMain.Columns[HBatchNoCol].HeaderText = "批次"; grdMain.Columns[HQtyCol].HeaderText = "数量"; grdMain.Columns[HRelationQtyCol].HeaderText = "未关联数量"; // grdMain.Columns[HTagCol].Visible = false; grdMain.Columns[HMainIDCol].Visible = false; grdMain.Columns[HSubIDCol].Visible = false; // string sAllowCol = HTagCol.ToString(); string sTotalCol = HTagCol.ToString(); //格式化网格 ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid); grdMain.RowTemplate.Height = 60; grdMain.RowTemplate.MinimumHeight = 60; grdMain.RowsDefaultCellStyle.Font = new Font("宋体", 22); } #endregion #region 返回源单信息 //返回源单信息 private void txtHSourceBillNo_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Return) { initGrid(); Display(); txtHSourceBillNo.Focus(); txtHSourceBillNo.SelectAll(); } } private void Display() { string HSourceBillNo = ""; //源单单号 string HSourceBillType = ""; //源单类型 HSourceBillNo = txtHSourceBillNo.Text.Trim(); HSourceBillType = cmbHSourceBillType.Text; if (HSourceBillNo == "") { MessageBox.Show("源单单号不能为空!"); return; } //得到信息 DataSet DS = oWeb.getDataSetBySQL("exec h_p_SourceBillList_Touch '" + HSourceBillType + "','" + HSourceBillNo + "'", "h_p_SourceBillList_Touch", ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) { MessageBox.Show("没有找到相关源单信息!" + DBUtility.ClsPub.sExeReturnInfo); return; } //写入信息 for (int i = 0; i < DS.Tables[0].Rows.Count; i++) { Sub_WriteInForm(DS.Tables[0], i); } } //根据TABLE写入界面 private void Sub_WriteInForm(DataTable oTable, int i) { if (i >= grdMain.RowCount - 1) grdMain.Rows.Add(); grdMain.Rows[i].Cells[HSnoCol].Value = ClsPub.isStrNull(i + 1); grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[i]["hmainid"].ToString(); grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[i]["hsubid"].ToString(); grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[i]["物料代码"].ToString(); grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[i]["物料名称"].ToString(); grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[i]["规格型号"].ToString(); grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[i]["计量单位"].ToString(); grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[i]["批次"].ToString(); grdMain.Rows[i].Cells[HQtyCol].Value = oTable.Rows[i]["数量"].ToString(); grdMain.Rows[i].Cells[HRelationQtyCol].Value = oTable.Rows[i]["未关联数量"].ToString(); } #endregion //确定 private void btnOK_Click(object sender, EventArgs e) { } //退出 private void btnTC_Click(object sender, EventArgs e) { } //双击列表 private void grdMain_DoubleClick(object sender, EventArgs e) { } } }