using System; using System.Collections.Generic; using System.Text; using SQLHelper; using DBUtility; using System.Data; namespace DAL { public class Cls_S_Xt_BaseBill1 { public string mvarReportTitle; public string mvarItemKey; public string ViewName = ""; public string sCondtion = ""; public string sOrderSql = ""; public string sKeyCol = ""; public string sShowItemSql = ""; //================================ public string mvarReportTitle2; public string mvarItemKey2; public string ViewName2 = ""; public string sCondtion2 = ""; public string sOrderSql2 = ""; public string sKeyCol2 = ""; public string sShowItemSql2 = ""; public frmHlpBillList1 oFrm; //public DAL.frmHlpBillList oFrm = new DAL.frmHlpBillList(); public List oBillSelectColl = new List(); public List oBillSelectColl2 = new List(); // public Cls_S_Xt_BaseBill1() { //--- } //显示数据 /// /// 显示数据 /// /// 主SQL /// 过滤条件 /// 排序条件 /// 不可重复列 /// public virtual bool Refresh(string sWhere) { string sErr = ""; int MainIDCol, SubIDCol, BillNoCol; string tSQL; ClsCN oCn = new ClsCN(); tSQL = sWhere + sCondtion + sOrderSql; try { oFrm = new frmHlpBillList1(); oFrm.sPrimaryCol = sKeyCol; oFrm.Text = mvarReportTitle; oFrm.lblCaption.Text = mvarReportTitle; oFrm.tSQL = tSQL; oFrm.ViewName = ViewName; oFrm.ShowDialog(); if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { //返回数据到集合中 oBillSelectColl.Clear(); MainIDCol = oFrm.Fun_GetCol("hmainid"); SubIDCol = oFrm.Fun_GetCol("hsubid"); BillNoCol = oFrm.Fun_GetCol("单据号"); //循环 选中行 for (int i = 0; i < oFrm.grdMain.SelectedRows.Count; i++) { BillSelect oSelect = new BillSelect(); oSelect.BillNo = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[BillNoCol].Value); oSelect.BillMainID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value); oSelect.BillSubID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[SubIDCol].Value); oSelect.BillTitle = mvarReportTitle; oSelect.BillType = mvarItemKey; oBillSelectColl.Add(oSelect); } } // if (oBillSelectColl.Count > 0) return true; else return false; } catch (Exception e) { sErr = e.Message; } return true; } //显示数据2 /// /// 显示数据2 /// /// 主SQL /// 过滤条件 /// 排序条件 /// 不可重复列 /// public virtual bool Refresh2(string sWhere) { string sErr = ""; int MainIDCol, SubIDCol, BillNoCol; string tSQL; ClsCN oCn = new ClsCN(); tSQL = sWhere + sCondtion2 + sOrderSql2; try { oFrm = new frmHlpBillList1(); oFrm.sPrimaryCol = sKeyCol2; oFrm.Text = mvarReportTitle2; oFrm.lblCaption.Text = mvarReportTitle2; oFrm.tSQL = tSQL; oFrm.ViewName = ViewName2; oFrm.ShowDialog(); if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { //返回数据到集合中 oBillSelectColl.Clear(); MainIDCol = oFrm.Fun_GetCol("hmainid"); SubIDCol = oFrm.Fun_GetCol("hsubid"); BillNoCol = oFrm.Fun_GetCol("单据号"); //循环 选中行 for (int i = 0; i < oFrm.grdMain.SelectedRows.Count; i++) { BillSelect oSelect = new BillSelect(); oSelect.BillNo = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[BillNoCol].Value); oSelect.BillMainID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value); oSelect.BillSubID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[SubIDCol].Value); oSelect.BillTitle = mvarReportTitle2; oSelect.BillType = mvarItemKey2; oBillSelectColl.Add(oSelect); } } // if (oBillSelectColl.Count > 0) return true; else return false; } catch (Exception e) { sErr = e.Message; } return true; } //显示数据3 /// /// 显示数据3 /// /// 主SQL /// 过滤条件 /// 排序条件 /// 不可重复列 /// public virtual bool Refresh_A3(string sWhere) { string sErr = ""; int MainIDCol, SubIDCol, BillNoCol; string tSQL; ClsCN oCn = new ClsCN(); tSQL = sWhere + sCondtion2 + sOrderSql2; try { oFrm = new frmHlpBillList1(); oFrm.sPrimaryCol = sKeyCol2; oFrm.Text = mvarReportTitle2; oFrm.lblCaption.Text = mvarReportTitle2; oFrm.tSQL = tSQL; oFrm.ViewName = ViewName2; oFrm.ShowDialog(); if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { //返回数据到集合中 oBillSelectColl2.Clear(); MainIDCol = oFrm.Fun_GetCol("hmainid"); SubIDCol = oFrm.Fun_GetCol("hsubid"); BillNoCol = oFrm.Fun_GetCol("单据号"); //循环 选中行 for (int i = 0; i < oFrm.grdMain.SelectedRows.Count; i++) { BillSelect_A3 oSelect = new BillSelect_A3(); oSelect.BillNo = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[BillNoCol].Value); oSelect.BillMainID = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value); oSelect.BillSubID = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[SubIDCol].Value); oSelect.BillTitle = mvarReportTitle2; oSelect.BillType = mvarItemKey2; oBillSelectColl2.Add(oSelect); } } // if (oBillSelectColl2.Count > 0) return true; else return false; } catch (Exception e) { sErr = e.Message; } return true; } //返回单据列表 /// /// 返回单据列表 /// /// 过滤条件 public DataSet DisSourceBillList(string sWhere) { try { ClsCN oCn = new ClsCN(); return oCn.RunProcReturn("select "+sShowItemSql+" from " + ViewName + " " + sWhere + sCondtion + sOrderSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo); } catch (Exception e) { DBUtility.ClsPub.sExeReturnInfo += "返回单据列表失败!" + e.Message; return null; } } //返回单据列表 /// /// 返回单据列表 /// /// 过滤条件 public DataSet DisSourceBillList2(string sWhere) { try { ClsCN oCn = new ClsCN(); return oCn.RunProcReturn("select " + sShowItemSql2 + " from " + ViewName2 + " " + sWhere + sCondtion2 + sOrderSql2, ViewName2, ref DBUtility.ClsPub.sExeReturnInfo); } catch (Exception e) { DBUtility.ClsPub.sExeReturnInfo += "返回单据列表失败!" + e.Message; return null; } } public virtual bool Refresh3(string sWhere) { string sErr = ""; int MainIDCol, SubIDCol, BillNoCol; string tSQL; ClsCN oCn = new ClsCN(); tSQL = sWhere + sCondtion + sOrderSql; try { oFrm = new frmHlpBillList1(); oFrm.sPrimaryCol = sKeyCol; oFrm.Text = mvarReportTitle; oFrm.lblCaption.Text = mvarReportTitle; oFrm.tSQL = tSQL; oFrm.ViewName = ViewName; oFrm.ShowDialog(); //返回数据到集合中 oBillSelectColl.Clear(); if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { MainIDCol = oFrm.Fun_GetCol("HMaterID"); //SubIDCol = oFrm.Fun_GetCol("hsubid"); //BillNoCol = oFrm.Fun_GetCol("单据号"); //循环 选中行 for (int i = 0; i < oFrm.grdMain.SelectedRows.Count; i++) { BillSelect oSelect = new BillSelect(); //oSelect.BillNo = ClsPub.isStrNull(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[BillNoCol].Value); oSelect.BillMainID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[MainIDCol].Value); //oSelect.BillSubID = ClsPub.isLong(oFrm.grdMain.Rows[oFrm.grdMain.SelectedRows[i].Index].Cells[SubIDCol].Value); oSelect.BillTitle = mvarReportTitle; oSelect.BillType = mvarItemKey; oBillSelectColl.Add(oSelect); } } // if (oBillSelectColl.Count > 0) return true; else return false; } catch (Exception e) { sErr = e.Message; } return true; } //根据源单号 模拟查询数据 /// /// 显示数据 /// /// 主SQL /// 过滤条件 /// 排序条件 /// 不可重复列 /// public virtual bool RefreshBySourceBillNo(string sWhere) { string sErr = ""; string tSQL; ClsCN oCn = new ClsCN(); tSQL = " select hmainid,hsubid,单据号 from " + ViewName + sWhere + sOrderSql; try { DataSet ds = oCn.RunProcReturn(tSQL, ViewName, ref DBUtility.ClsPub.sExeReturnInfo); if (ds == null || ds.Tables[0].Rows.Count == 0) { return false; } //返回数据到集合中 oBillSelectColl.Clear(); //循环 选中行 for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { BillSelect oSelect = new BillSelect(); oSelect.BillNo = ClsPub.isStrNull(ds.Tables[0].Rows[i]["单据号"]); oSelect.BillMainID = ClsPub.isLong(ds.Tables[0].Rows[i]["hmainid"]); oSelect.BillSubID = ClsPub.isLong(ds.Tables[0].Rows[i]["hsubid"]); oSelect.BillTitle = mvarReportTitle; oSelect.BillType = mvarItemKey; oBillSelectColl.Add(oSelect); } // if (oBillSelectColl.Count > 0) return true; else return false; } catch (Exception e) { sErr = e.Message; } return true; } } }