public void initdata() { String sql = "select sum(ceil(h.taskquantity/36)) as sl,h.regioncode as czxx,h.packagedesc " + "FROM highspeed.T_PRODUCE_TASK h " + "group by h.regioncode,h.packagedesc order by h.regioncode,h.packagedesc"; OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String sl = "", czxx = "", packagedesc = ""; while (myread != null && myread.Read()) { sl = myread["sl"].ToString().Trim(); czxx = myread["czxx"].ToString().Trim(); packagedesc = myread["packagedesc"].ToString().Trim(); int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = czxx; this.task_data.Rows[index].Cells[1].Value = sl; this.task_data.Rows[index].Cells[2].Value = packagedesc; } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
/// <summary> /// 绑定DataGridView1 /// </summary> /// <param name="sql">要查询的sql</param> private void Bind(string sql) { OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String cigarettecode = "", tasknum = "", regioncode = "", cigarename = "", quantity = "", taskquantity = ""; while (myread != null && myread.Read()) { cigarettecode = myread["cigarettecode"].ToString().Trim(); cigarename = myread["cigarettename"].ToString().Trim(); quantity = myread["replenishqty"].ToString().Trim(); tasknum = myread["tasknum"].ToString().Trim(); regioncode = myread["regioncode"].ToString().Trim(); int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = cigarettecode; this.task_data.Rows[index].Cells[1].Value = cigarename; this.task_data.Rows[index].Cells[2].Value = quantity; this.task_data.Rows[index].Cells[3].Value = tasknum; this.task_data.Rows[index].Cells[4].Value = regioncode; } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
/// <summary> /// 绑定DataGridView1 /// </summary> /// <param name="sql">要查询的sql</param> private void Bind(string sql) { OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String machineseq = "", cusname = "", cigarename = "", pokenum = "", sortnum = "", regioncode = ""; while (myread != null && myread.Read()) { machineseq = myread["machineseq"].ToString().Trim(); cusname = myread["customername"].ToString().Trim(); cigarename = myread["cigarettename"].ToString().Trim(); pokenum = myread["pokenum"].ToString().Trim(); sortnum = myread["sortnum"].ToString().Trim(); regioncode = myread["regioncode"].ToString().Trim(); int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = machineseq; this.task_data.Rows[index].Cells[1].Value = cusname; this.task_data.Rows[index].Cells[2].Value = cigarename; this.task_data.Rows[index].Cells[3].Value = pokenum; this.task_data.Rows[index].Cells[4].Value = sortnum; this.task_data.Rows[index].Cells[5].Value = regioncode; } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
/// <summary> /// 获取格式表 /// DataColumns,则以其为准,否则,以DataColumns为准 /// </summary> /// <returns>格式表</returns> public IEnumerable <DataField> GetColumns() { List <DataField> dataColumns = new List <DataField>();; if (DataFetcher.IsNotNull()) { var schemaTable = DataFetcher.Value.GetDataSchema(); var fields = DataPublic.GetDataFieldsByTable(schemaTable); dataColumns.AddRange(fields); } if (DataColumns.IsNotNullOrEmpty()) { foreach (DataField dataColumn in DataColumns) { var foundColumn = dataColumns.Where(p => p.Name == dataColumn.Name).FirstOrDefault(); if (foundColumn != null) { dataColumns.Remove(foundColumn); } dataColumns.Add(dataColumn); } } return(dataColumns); }
/// <summary> /// 绑定DataGridView1 /// </summary> /// <param name="sql">要查询的sql</param> private void Bind(string sql) { OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String machineseq = "", cusname = "", cigarename = "", sortseq = "", quantity = "", taskquantity = "", chezu, tasknum; while (myread != null && myread.Read()) { machineseq = myread["machineseq"].ToString().Trim(); cusname = myread["customername"].ToString().Trim(); cigarename = myread["cigarettename"].ToString().Trim(); quantity = myread["quantity"].ToString().Trim(); tasknum = myread["tasknum"].ToString().Trim(); chezu = myread["regioncode"].ToString().Trim(); sortseq = myread["sortseq"].ToString().Trim(); int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = machineseq; this.task_data.Rows[index].Cells[1].Value = cusname; this.task_data.Rows[index].Cells[2].Value = cigarename; this.task_data.Rows[index].Cells[3].Value = quantity; this.task_data.Rows[index].Cells[4].Value = tasknum; this.task_data.Rows[index].Cells[5].Value = chezu + "/" + sortseq; } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
private void seek() { String strsql = "SELECT tmp.* from(select rownum as num,t.* from (select id ,cigarettename,cigarettecode,mantissa,machineseq from t_produce_sorttrough where state=0 and cigarettetype=10" + " order by to_number(machineseq))t)tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by tmp.num"; //MessageBox.Show(strsql); int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM t_produce_sorttrough where state=0 and cigarettetype=10").ToString()); Bind(strsql); pager1.RecordCount = total; this.pager1.InitPageInfo(); }
private void seek() { String strsql = "SELECT tmp.* FROM" + "(SELECT rownum as num,batchcode,starttime,endtime,decode(state,'0','关闭','1','正常')AS status FROM T_UN_BATCH ORDER BY batchcode DESC)tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + "order by tmp.batchcode desc"; int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM T_UN_BATCH").ToString()); Bind(strsql); pager1.RecordCount = total; this.pager1.InitPageInfo(); }
public void initdata() { String sql = "SELECT rownum as seq ,total.*,finish.finishcuscount,finish.finishqty,round(finishqty/qty*100,2)AS percent FROM " + "(SELECT o.regioncode,COUNT(o.billcode) AS cuscount,SUM(o.taskquantity)AS qty FROM t_produce_task o GROUP BY o.regioncode)total left outer join " + "(SELECT o.regioncode,COUNT(o.billcode) AS finishcuscount,SUM(o.taskquantity)AS finishqty FROM t_produce_task o WHERE state='30' GROUP BY o.regioncode)finish " + "on total.regioncode=finish.regioncode ORDER BY total.regioncode"; OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String regioncode = "", cuscount = "", qty = "", finishcuscount = "", finishqty = "", percent = "", seq = ""; while (myread != null && myread.Read()) { seq = myread["seq"].ToString().Trim(); regioncode = myread["regioncode"].ToString().Trim(); cuscount = myread["cuscount"].ToString().Trim(); qty = myread["qty"].ToString().Trim(); finishcuscount = myread["finishcuscount"].ToString().Trim(); if (finishcuscount == "") { finishcuscount = "0"; } finishqty = myread["finishqty"].ToString().Trim(); if (finishqty == "") { finishqty = "0"; } percent = myread["percent"].ToString().Trim(); if (finishqty == "0") { percent = "0"; } int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = seq; this.task_data.Rows[index].Cells[1].Value = regioncode; this.task_data.Rows[index].Cells[2].Value = regioncode; this.task_data.Rows[index].Cells[3].Value = finishcuscount + "/" + cuscount; this.task_data.Rows[index].Cells[4].Value = finishqty + "/" + qty; this.task_data.Rows[index].Cells[5].Value = percent + "%"; } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
private void seek() { String strsql = "SELECT cigarettecode,cigarettename,sl from(select t.* ,rownum num from(select cigarettecode,cigarettename,sum(pokenum)sl from t_produce_poke p,t_produce_sorttrough s " + "where p.troughnum=s.troughnum and p.machineseq in(43,44,45)group by cigarettecode,cigarettename order by sl desc)t" + " )tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by tmp.num"; //MessageBox.Show(strsql); int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM t_produce_poke p ,t_produce_sorttrough s where p.machineseq in(43,44,45) and p.troughnum=s.troughnum group by cigarettecode,cigarettename").ToString()); this. Bind(strsql); pager1.RecordCount = total; this.pager1.InitPageInfo(); }
/// <summary> /// 绑定DataGridView1 /// </summary> /// <param name="sql">要查询的sql</param> private void Bind(string sql) { OracleDataReader myread = DataPublic.ReadDb(sql); task_data.Rows.Clear(); try { String tasknum = "", cusname = "", cigarename = "", quantity = "", taskquantity = ""; while (myread != null && myread.Read()) { tasknum = myread["tasknum"].ToString().Trim(); cusname = myread["customername"].ToString().Trim(); cigarename = myread["cigarettename"].ToString().Trim(); quantity = myread["quantity"].ToString().Trim(); taskquantity = myread["taskquantity"].ToString().Trim(); int index = this.task_data.Rows.Add(); this.task_data.Rows[index].Cells[0].Value = tasknum; this.task_data.Rows[index].Cells[1].Value = cusname; this.task_data.Rows[index].Cells[2].Value = cigarename; this.task_data.Rows[index].Cells[3].Value = quantity; this.task_data.Rows[index].Cells[4].Value = taskquantity; } //MessageBox.Show(sFun.getCzcode("950")); /*int indexj=0; * for (int i = 0; i < task_data.RowCount;i++ ) * { * if(this.task_data.Rows[i].Cells[0].Value.ToString()=="0204") * { * indexj=i; * break; * } * } * for (int i = 0; i < 10;i++ ) * { * double per=double.Parse(this.task_data.Rows[indexj].Cells[5].Value.ToString()); * per = per + i; * this.task_data.Rows[indexj].Cells[5].Value = per; * } */ } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
private DataField[] GetParameters() { if (Filter.IsNull()) { return(null); } List <DataField> dataFields = new List <Data.DataField>(); var parameters = DataPublic.FindParameters(Filter); foreach (var parameter in parameters) { var dataField = new DataField(parameter); dataFields.Add(dataField); } return(dataFields.ToArray()); }
/// <summary> /// 根据对象填充属性字段 /// </summary> /// <param name="groupItem">组项目</param> /// <param name="objType">对象类型</param> private void RetrieveFields(LayoutControlGroup groupItem) { this.DataLayoutControl.CloseControl(); this.DataLayoutControl.SuspendLayout(); EditControls.Clear(); this.DataLayoutControl.Clear(true, true); var controller = Controller as DataParametersEditController; if (DataParameters == null) { return; } foreach (var dataParameter in DataParameters) { Control editControl = CreateEditControl(dataParameter); LayoutControlItem layoutControlItem = null; layoutControlItem = groupItem.AddItem(); layoutControlItem.TextLocation = DevExpress.Utils.Locations.Left; layoutControlItem.Control = editControl; var parameterName = DataPublic.GetParameterName(dataParameter.Name); layoutControlItem.Name = parameterName; layoutControlItem.Text = parameterName; layoutControlItem.CustomizationFormText = dataParameter.Name; if (editControl is BaseObjectEditControl) { layoutControlItem.TextVisible = false; } else { layoutControlItem.TextVisible = true; } } this.DataLayoutControl.Refresh(); this.DataLayoutControl.SetDefaultLayout(); /// 读取布局数据 if (controller.LayoutData.IsNotNull()) { this.DataLayoutControl.SetLayoutData(controller.LayoutData); } this.DataLayoutControl.ResumeLayout(); }
private void seek() { String wherecause = ""; if (comboBox1.SelectedIndex == 0) { wherecause = "and troughtype=10 and CIGARETTETYPE=20"; } else { wherecause = "and troughtype=20"; } String strsql = "SELECT tmp.* from(select rownum as num,t.* from (select cigarettename,cigarettecode,mantissa,machineseq,THRESHOLD,BOXCOUNT,clearup,maintissaless from t_produce_sorttrough where state=10 " + wherecause + " order by to_number(machineseq))t)tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by tmp.num"; //MessageBox.Show(strsql); int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM t_produce_sorttrough where state=10 " + wherecause).ToString()); Bind(strsql); pager1.RecordCount = total; this.pager1.InitPageInfo(); }
private void seek() { // string linenum = this.box_sortline.SelectedValue+""; string types = this.box_condition.SelectedValue + ""; string keywd = this.txt_keywd.Text.Trim(); String tmp = ""; if (types != null && types != "" && keywd != null && keywd != "") { tmp = " and " + types + " like'%" + keywd + "%'"; } String strsql = "SELECT tmp.* FROM (select rownum as num,t.* from(select id,linenum,machineseq,troughdesc,'单独道'as troughtype" + ",actcount,cigarettecode,state,cigarettename,decode(cigarettetype,'10','混合','20','正常','异型')as cigarettetype,replenishline,transportationline,decode(state,'0','正常','1','禁用')as status " + "from t_produce_sorttrough t where cigarettetype='30'" + tmp + " ORDER BY machineseq)t)tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by tmp.num"; //MessageBox.Show(strsql); int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM t_produce_sorttrough where 1=1 and cigarettetype='30'" + tmp).ToString()); Bind(strsql); pager1.RecordCount = total; this.pager1.InitPageInfo(); }
public void init() { //初始化分拣线选择下拉框 String sSql1 = "select min(tasknum) num from t_produce_task"; String sSql2 = "select max(tasknum) num from t_produce_task"; OracleDataReader myread = DataPublic.ReadDb(sSql1); try { if (myread != null && myread.Read()) { textBox1.Text = myread["num"].ToString(); } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } myread = DataPublic.ReadDb(sSql2); try { if (myread != null && myread.Read()) { textBox2.Text = myread["num"].ToString(); } } finally { if (myread != null) { myread.Close(); myread.Dispose(); } } }
/// <summary> /// 获取格式表 /// DataColumns,则以其为准,否则,以DataColumns为准 /// </summary> /// <returns>格式表</returns> public DataTable GetSchemaTable() { DataTable schemaTable = null; if (DataFetcher.IsNotNull()) { schemaTable = DataFetcher.Value.GetDataSchema(); } else { schemaTable = new DataTable(); } // 根据DataColumn填充DataChema var columnSchemaTable = DataPublic.GetTableByDataItems(DataColumns); if (columnSchemaTable != null) { schemaTable.Merge(columnSchemaTable); } schemaTable.TableName = TableName; return(schemaTable); }
private void seek()//显示通道信息 { // string linenum = this.box_sortline.SelectedValue+""; string types = this.box_condition.SelectedValue + ""; string keywd = this.txt_keywd.Text.Trim(); int type = cbtype.SelectedIndex; int ctype = cbctype.SelectedIndex; if (ctype == 1) { ctype = 20; } else if (ctype == 2) { ctype = 30; } else if (ctype == 3) { ctype = 40; } if (type == 0) { type = 10; } else if (type == 1) { type = 20; } else if (type == 2) { type = 30; } else if (type == 3) { type = 40; } String tmp = ""; if (types != null && types != "" && keywd != null && keywd != "") { tmp = " and " + types + " like'%" + keywd + "%'"; } if (type != 0) { tmp += "and troughtype=" + type; } if (ctype != 0) { tmp += "and cigarettetype=" + ctype; } String strsql = "SELECT tmp.* FROM (select rownum as num, troughnum,id,machineseq," + "cigarettecode,cigarettename,state,troughtype as type,cigarettetype as ctype,decode(cigarettetype,'10','混合','20','标准','30','异型','异型混合')as cigarettetype,decode(state,'10','正常','0','禁用')as status, " + "decode(troughtype,10,'分拣',20,'重力式货架',30,'皮带机',40,'分拣出口')as troughtypes,groupno from t_produce_sorttrough t where 1=1 " + tmp + " )tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by to_number(tmp.troughnum)"; String temps = tmp + " ORDER BY troughnum)tmp where tmp.num>" + (pager1.CurrentPageIndex - 1) * pager1.PageSize + " and tmp.num<=" + pager1.CurrentPageIndex * pager1.PageSize + " order by to_number(tmp.troughnum)"; //MessageBox.Show(strsql); int total = int.Parse(DataPublic.ExecuteScalar("SELECT count(*) FROM t_produce_sorttrough where 1=1 " + tmp).ToString()); Console.WriteLine(strsql); //Db.Open(); Bind(strsql); // Db.Close(); pager1.RecordCount = total; this.pager1.InitPageInfo(); }