我们知道通常销售是整个公司业务的开始,那业务员想随时知道公司销售单的进度情况,就需要与各个部门联系分析就造成几个问题。第一:协调 第二:准确性 第三及时性
那就自己写一个综合查询的页面吧:
先上图:
项目中常用到GridPanel,单击(双击)一行数据后展示一些数据,打开新页面……这些功能都可以实现。
前台:
<SelectionModel> <ext:RowSelectionModel runat="server" /> </SelectionModel> <DirectEvents> <Click OnEvent="SubmitSelection"> <ExtraParams> <ext:Parameter Name="Values" Value="Ext.encode(#{GridPanelOrder}.getRowsValues({selectedOnly:true}))" Mode="Raw" /> </ExtraParams> <EventMask ShowMask="true" Msg="数据正在生成,请稍候..." MinDelay="1500"/> </Click> </DirectEvents>
后端:
protected void SubmitSelection(object sender, DirectEventArgs e) { string json = e.ExtraParams["Values"]; List<Orders> OrdersList = JSON.Deserialize<List<Orders>>(json); string doctype =string.Empty; string docnumber =string.Empty ; string line = string.Empty; string item = string.Empty; foreach (Orders odr in OrdersList) { doctype = odr.TD001; docnumber = odr.TD002; line = odr.TD003; item = odr.TD004; } IntegrateQuery IQ = new IntegrateQuery(); IQ.Company = company; IQ.Doctype = doctype.Trim(); IQ.Docnumber = docnumber.Trim(); IQ.Line = line.Trim(); IQ.Item = item.Trim(); this.StoreWorkOder.DataSource = IQ.QueryWorkOders(); this.StoreWorkOder.DataBind(); this.StoreWorkOderDetail.DataSource = IQ.QueryWorkOrdersDetail(); this.StoreWorkOderDetail.DataBind(); 。。。。。 }
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Text; using TX.DataAccess; namespace TX.InterService { /// <summary> /// IntegrateQuery 的摘要说明 /// </summary> public class IntegrateQuery { public IntegrateQuery() { // // TODO: 在此处添加构造函数逻辑 // } public DataTable QueryOrders() { StringBuilder sb = new StringBuilder(); sb.Append("SELECT TD001,TD002,TD003,convert(char(10),cast(TC003 as datetime),120) TC003,TC004,MA002,MV002,TD004,TD005,TD006,TD008,TD009,TD010\n"); sb.Append("FROM COPTC LEFT JOIN COPTD ON TC001=TD001 AND TC002=TD002\n "); sb.Append("INNER JOIN COPMA ON TC004=MA001\n "); sb.Append("INNER JOIN CMSMV ON TC006=MV001\n "); sb.Append("WHERE TD016='N' AND TD021='Y'\n "); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString() ) ; } public DataTable QueryWorkOders() { StringBuilder sb = new StringBuilder(); sb.Append("Select TA001,TA002,TA003,TA009,TA010,TA012,TA014,TA015,TA016,TA017,TA018,MC002,MD002 from COPTD inner join MOCTA ON TD001=TA026 AND TD002=TA027 AND TD003=TA028\n"); sb.Append("INNER JOIN CMSMC ON TA020=MC001\n"); sb.Append("INNER JOIN CMSMD ON TA021=MD001\n"); sb.Append("where TA026='" + _doctype + "' and TA027='" + _docnumber + "' AND TA028='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryWorkOrdersDetail() { StringBuilder sb = new StringBuilder(); sb.Append("Select TB003,TB012,TB013,TB004,TB005,(TB004-TB005) TB45,TB007,MC002,\n"); sb.Append("case when TB011='1' then '直接材料' when TB011='2' then '间接材料' when TB011='3' then '供应商供料' when TB011='3' then '不发料' else '客户供料' end as TB011\n"); sb.Append("from COPTD inner join MOCTA ON TD001=TA026 AND TD002=TA027 AND TD003=TA028\n"); sb.Append("inner join MOCTB ON TA001=TB001 AND TA002=TB002\n"); sb.Append("INNER JOIN INVMB ON TB003=MB001 INNER JOIN CMSMC ON TB009=MC001\n"); sb.Append("where TA026='" + _doctype + "' and TA027='" + _docnumber + "' AND TA028='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryPurchaseOrder() { StringBuilder sb = new StringBuilder(); sb.Append("Select b.TD001,b.TD002,b.TD003,b.TD012,b.TD004,b.TD005,b.TD006,MC002,b.TD008,b.TD009,b.TD015,(b.TD008-b.TD015) as TD085 ,d.MA002\n"); sb.Append("FROM COPTD a inner join PURTD b ON a.TD001=b.TD013 AND a.TD002=b.TD021 AND a.TD003=b.TD023\n"); sb.Append("INNER join PURTC c ON b.TD001=c.TC001 and b.TD002=c.TC002 \n"); sb.Append("INNER join PURMA d ON d.MA001=c.TC004 \n"); sb.Append("INNER JOIN CMSMC ON b.TD007=MC001\n"); sb.Append("WHERE a.TD001='" + _doctype + "' and a.TD002='" + _docnumber + "' AND a.TD003='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryGetMaterial() { StringBuilder sb = new StringBuilder(); sb.Append("Select TE001,TE002,TE003,TC003,TE004,TE017,TE018,TE005,TE006,MC002,TE009,TE010,TE011,TE012\n"); sb.Append("from COPTD inner join MOCTA ON TD001=TA026 AND TD002=TA027 AND TD003=TA028\n"); sb.Append("INNER JOIN MOCTE ON TA001=TE011 AND TA002=TE012 \n"); sb.Append("inner join MOCTC ON TC001=TE001 AND TC002=TE002 \n"); sb.Append("INNER JOIN CMSMC ON TE008=MC001\n"); sb.Append("WHERE TD001='" + _doctype + "' and TD002='" + _docnumber + "' AND TD003='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryInwarehouse() { StringBuilder sb = new StringBuilder(); sb.Append("Select TG001,TG002,TG003,TF003,TG004,TG005,TG007,MC002,TG009,TG011,TG012,TG013,\n"); sb.Append("case when TG016='1' then '待验' when TG016='Y' then '检验合格' when TG016='N' then '检验不合格' else '免检' END AS TG016,ME002\n"); sb.Append("From COPTD INNER join MOCTA ON TD001=TA026 AND TD002=TA027 AND TD003=TA028\n"); sb.Append("INNER JOIN MOCTG ON TA001=TG014 AND TA002=TG015 \n"); sb.Append("INNER join MOCTF ON TG001=TF001 AND TG002=TF002\n"); sb.Append("INNER JOIN CMSMC ON TG010=MC001\n"); sb.Append("INNER join CMSME ON TF016 =ME001\n"); sb.Append("WHERE TD001='" + _doctype + "' and TD002='" + _docnumber + "' AND TD003='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QuerySalesOrder() { StringBuilder sb = new StringBuilder(); sb.Append("Select TH001,TH002,TH003,TG003,TH004,TH005,TH006,MC002,TH008,TH009,TH010\n"); sb.Append("from COPTD INNER join COPTH ON TD001=TH014 AND TD002=TH015 AND TD003=TH016\n"); sb.Append("INNER JOIN CMSMC ON TH007=MC001\n"); sb.Append(" INNER JOIN COPTG ON TH001=TG001 AND TH002=TG002\n"); sb.Append("WHERE TD001='" + _doctype + "' and TD002='" + _docnumber + "' AND TD003='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryBackSalesOrder() { StringBuilder sb = new StringBuilder(); sb.Append("Select TJ001,TJ002,TJ003,TI003,TJ004,TJ005,TJ006,MC002,TJ008,TJ007\n"); sb.Append("from COPTD INNER join COPTJ ON TD001=TJ018 AND TD002=TJ019 AND TD003=TJ020\n"); sb.Append("INNER JOIN CMSMC ON TJ013=MC001\n"); sb.Append("INNER JOIN COPTI ON TJ001=TI001 AND TJ002=TI002\n"); sb.Append("WHERE TD001='" + _doctype + "' and TD002='" + _docnumber + "' AND TD003='" + _line + "'\n"); DABaseAccess db = new DABaseAccess(_company); return db.Query(sb.ToString()); } public DataTable QueryBom() { SqlParameter[] parms = new SqlParameter[1]; parms[0] = new SqlParameter("@ITEMNO", SqlDbType.VarChar, 80); parms[0].Value = _item; DABaseAccess db = new DABaseAccess(_company); return db.GetTableByStore("UP_BOM_EXPAND", parms); } private string _company = string.Empty; private string _doctype =string.Empty; private string _docnumber =string.Empty ; private string _line = string.Empty; private string _item = string.Empty; private string _workodertype = string.Empty; private string _workoderdoc = string.Empty; public string Company { set { _company = value; } get { return _company; } } public string Doctype { set { _doctype = value; } get { return _doctype; } } public string Docnumber { set { _docnumber = value; } get { return _docnumber; } } public string Line { set { _line = value; } get { return _line ; } } public string Workodertype { set { _workodertype = value; } get { return _workodertype; } } public string Workoderdoc { set { _workoderdoc = value; } get { return _workoderdoc; } } public string Item { set { _item = value; } get { return _item; } } } }