using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsK3_Material_View:DBUtility.ClsGy_Base_View { // public Model.ClsK3_Material_Model omodel = new Model.ClsK3_Material_Model(); public List omodelList = new List(); SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public ClsK3_Material_View() { base.MvarReportTitle = "物料设置"; base.MvarItemKey = "h_v_K3_Material"; base.SQLName = "Select HItemID,Hnumber 物料代码,Hname 物料名称,HModel 规格型号,HPicNo 图号,HUnitNumber 单位代码,Hunitname 计量单位,HUnitID from h_v_K3_Material where hstopflag=0 Order by 物料代码 "; base.SQLList = "Select top 50 * from " + MvarItemKey + " "; //下拉SQL base.SQLNameForDown = " Select top 30 HItemID,HNumber 物料代码,HName 物料名称,HModel 规格型号,HUnitNumber 单位代码,HUnitName 计量单位,HUnitID from h_v_K3_Material "; //,HSubjoin 图号1,HSubjoin2 图号2,HColor 颜色 base.SQLOrderForDown = " Order by HNumber "; base.SQLWhereForDown = " where HStopflag=0 and HEndFlag<>0 "; //HlpInfoForBig base.sBillColName = "物料名称"; base.sBillColNumber = "物料代码"; base.sBillShowItem = " * "; base.sBillView = "h_v_K3_MaterialList"; base.sBillOrder = " order by 物料代码 desc "; } // public void Dispose() { GC.SuppressFinalize(this); } // //返回项目信息 public override bool GetInfoByID(Int64 sItemID) { DataSet DS ; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HItemID='" + sItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { return GetInfo(DS); } } catch (Exception e) { throw (e); } } //根据代码返回项目信息 public override bool GetInfoByNumber(string sNumber) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HNumber='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { return GetInfo(DS); } } catch (Exception e) { throw (e); } } //返回项目信息 public override bool GetInfo(DataSet DS) { try { omodel = new Model.ClsK3_Material_Model(); omodel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); omodel.HNumber = DS.Tables[0].Rows[0]["HNumber"].ToString().Trim(); omodel.HName = DS.Tables[0].Rows[0]["HName"].ToString().Trim(); omodel.HModel = DS.Tables[0].Rows[0]["HModel"].ToString().Trim(); omodel.HStopflag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HStopflag"]); omodel.HRemark = DS.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HhgNumber = DS.Tables[0].Rows[0]["HhgNumber"].ToString().Trim(); omodel.HBarCode = DS.Tables[0].Rows[0]["HBarCode"].ToString().Trim(); omodel.HPhaseFlag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HPhaseFlag"]); omodel.HUnitID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HUnitID"]); omodel.HQtyDecimal = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HQtyDecimal"]); omodel.HPriceDecimal = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HPriceDecimal"]); omodel.HProcID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HProcID"]); omodel.HBigPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HBigPackPrice"]); omodel.HColorMidPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HColorMidPackPrice"]); omodel.HWhiteMidPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWhiteMidPackPrice"]); omodel.HColorSmlPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HColorSmlPackPrice"]); omodel.HWhiteSmlPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWhiteSmlPackPrice"]); omodel.HPaperCardPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPaperCardPrice"]); omodel.HPlasticBagPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPlasticBagPrice"]); omodel.HPlasticCardPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPlasticCardPrice"]); omodel.HBatchManager = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HBatchManager"]); return true; } catch (Exception e) { throw (e); } } //帮助 public override bool RefreshView() { try {// Pub_Control.frmHlpInfo ofrm = new Pub_Control.frmHlpInfo(); // string sSQL = SQLName; //编辑ofrm ofrm.sTitle = MvarReportTitle; ofrm.sBill = "h_v_K3_Material_NoStopflag"; ofrm.txtFindInfo.Text = WherePart; ofrm.sOtherItem = ""; //编辑 ofrm.grdShow.RowTemplate.Height = 20; ofrm.ShowDialog(); //得到对应列 // if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { if (ofrm.grdShow.CurrentRow == null) { return false; } this.omodel.HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[0].Value); this.omodel.HNumber =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[1].Value); this.omodel.HName =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[2].Value); this.omodel.HModel =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[3].Value); this.omodel.HUnitID = DBUtility.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[6].Value.ToString()); this.omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[4].Value); this.omodel.HUnitName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[5].Value); } else { return false; } // ofrm.Dispose(); ofrm = null; // return true; } catch (Exception e) { throw (e); } } //帮助多项返回 public bool RefreshViewMul() { try {// Pub_Control.frmHlpInfo ofrm = new Pub_Control.frmHlpInfo(); // string sSQL = SQLName; //编辑ofrm ofrm.sTitle = MvarReportTitle; ofrm.sBill = "h_v_K3_Material_NoStopflag"; ofrm.txtFindInfo.Text = WherePart; ofrm.sOtherItem = ""; //编辑 ofrm.grdShow.RowTemplate.Height = 20; ofrm.ShowDialog(); //得到对应列 // if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { if (ofrm.grdShow.SelectedRows == null) { return false; } else { omodelList.Clear(); for (int r = 0; r < ofrm.grdShow.SelectedRows.Count; r++) { omodel = new Model.ClsK3_Material_Model(); this.omodel.HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[0].Value); this.omodel.HNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[1].Value); this.omodel.HName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[2].Value); this.omodel.HModel = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[3].Value); this.omodel.HUnitID = DBUtility.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[6].Value.ToString()); this.omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[4].Value); this.omodel.HUnitName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[5].Value); omodelList.Add(omodel); } } } else { return false; } // ofrm.Dispose(); ofrm = null; // return true; } catch (Exception e) { throw (e); } } } }