/// <summary> /// i_TypeNo ���� i_SetTableNo �ױ�� i_TableNo ����� /// strUnit ��λ /// strSequence ����������е�λ�� /// strUnitCount ������嵥Ԫ��λ�� /// </summary> /// <param name="i_TypeNo"></param> /// <param name="i_SetTableNo"></param> /// <param name="i_TableNo"></param> /// <param name="strUnit"></param> /// <param name="strSequence"></param> /// <param name="strUnitCount"></param> public SortedList gsoutinterface(int i_TypeNo, int i_SetTableNo, int i_TableNo, string strUnit) { //���ɱ��� //��λ m_B0110 = strUnit; //������ string strtmp = " select MainObject from r200 where typeno = " + i_TypeNo + " and settableno = " + i_SetTableNo + " and tableno = " + i_TableNo; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); DataTable dt = getsql.gsQuerySql(strtmp, "R200"); if (dt == null || dt.Rows.Count == 0) { m_strMainObject = "AA01"; } else { m_strMainObject = dt.Rows[0]["MainObject"].ToString(); } if (m_strMainObject == "") { m_strMainObject = "AA01"; } //�ж��������Ƿ��е�λ string strSQLtmp = "SELECT * FROM gs_property WHERE infoid= '" + m_strMainObject + "' AND infofield = 'ab0110' "; dt = getsql.gsQuerySql(strSQLtmp, "gs_property"); if (dt == null || dt.Rows.Count == 0) { m_B0110 = "-1"; } //���ɱ��� StatResult(i_TypeNo, i_SetTableNo, i_TableNo, true); //ȡ�����е����е�ͳ�ƽ�� dealData RptR_C = new dealData(); SqlDataReader objRCReader; objRCReader = RptR_C.getRC_R(i_TypeNo, i_SetTableNo, i_TableNo); int row = 7; int col = 3; int col1 = 0; int rowLen = 5; int collen = 15; SortedList sortmp = new SortedList(); //ȡ����λ�� while (objRCReader.Read()) { if (objRCReader["serialtype"].ToString() == "1") { row = (int)objRCReader["startrow"]; rowLen = (int)objRCReader["icount"]; } else { col1 = (int)objRCReader["startcol"]; collen = (int)objRCReader["icount"]; } } if (collen == 0) { collen = 1; } if (rowLen == 0) { rowLen = 1; } objRCReader = null; //���ϼ����ͱ���� row = row + 2; col1 = col1 + 2; dealData addData = new dealData(); SqlDataReader objAssReader; //��д�������� objAssReader = addData.getRApp(i_TypeNo, i_SetTableNo, i_TableNo, m_B0110, "T" + i_TypeNo.ToString() + "_" + i_SetTableNo.ToString() + "_" + i_TableNo.ToString(), "1"); if (objAssReader != null) { while (objAssReader.Read()) { col = col1; for (int i = col; i <= collen + col - 1; i++) { sortmp.Add(row + "_" + i, objAssReader["C" + (i - col + 1).ToString()]); } row = row + 1; } } objAssReader = null; //��Ԫ���� dealData RptUnit = new dealData(); SqlDataReader objUnitReader; objUnitReader = RptUnit.getUnitResult(i_TypeNo, i_SetTableNo, i_TableNo, m_B0110, "1"); while (objUnitReader.Read()) { sortmp.Add(objUnitReader["row"].ToString() + "_" + objUnitReader["col"].ToString(), objUnitReader["svalue"]); } return sortmp; }
public void gsoutinterface(int i_TypeNo, int i_SetTableNo, int i_TableNo, out string strSequence, out string strUnitCount) { //ȡ�����е����е�ͳ�ƽ�� dealData RptR_C = new dealData(); SqlDataReader objRCReader; objRCReader = RptR_C.getRC_R(i_TypeNo, i_SetTableNo, i_TableNo); int row = 7; //int col = 3; int col1 = 0; int rowLen = 5; int collen = 15; strSequence = ""; strUnitCount = ""; //ȡ����λ�� while (objRCReader.Read()) { if (objRCReader["serialtype"].ToString() == "1") { row = (int)objRCReader["startrow"]; rowLen = (int)objRCReader["icount"]; } else { col1 = (int)objRCReader["startcol"]; collen = (int)objRCReader["icount"]; } } if (collen == 0) { collen = 1; } if (rowLen == 0) { rowLen = 1; } objRCReader = null; //���ϼ����ͱ���� row = row + 2; col1 = col1 + 2; for (int i = row; i < row + rowLen; i++) { for (int j = col1; j < col1 + collen; j++) { strSequence += i + "," + j + ";"; } } if (strSequence.Length > 1) { strSequence = strSequence.Substring(0, strSequence.Length - 1); } //��Ԫ���� DataAccess.Data.GetSql RptUnit = new DataAccess.Data.GetSql(); string strSql = " select * from r201 where serialno > 2 and typeno =" + i_TypeNo + " and settableno = " + i_SetTableNo + " and tableno = " + i_TableNo; DataTable dt = RptUnit.gsQuerySql(strSql, "R201"); if (dt != null && dt.Rows.Count != 0) { for (int k = 0; k < dt.Rows.Count; k++) { if (dt.Rows[k]["startrow"].ToString() == "0" || dt.Rows[k]["startcol"].ToString() == "0") { continue; } else { strUnitCount += dt.Rows[k]["startrow"].ToString() + "," + dt.Rows[k]["startcol"].ToString() + ";"; } } } //���� strSql = " select * from eg01 where typeno =" + i_TypeNo + " and settbl = " + i_SetTableNo + " and tablno = " + i_TableNo; dt = RptUnit.gsQuerySql(strSql, "eg01"); if (dt != null && dt.Rows.Count != 0) { for (int l = 0; l < dt.Rows.Count; l++) { if (dt.Rows[l]["startr"].ToString() == "0" || dt.Rows[l]["startc"].ToString() == "0") { continue; } else { strUnitCount += dt.Rows[l]["startr"].ToString() + "," + dt.Rows[l]["startc"].ToString() + ";"; } } } if (strUnitCount.Length > 1) { strUnitCount = strUnitCount.Substring(0, strUnitCount.Length - 1); } }
//���ɺϲ����SQL��� public string GetSQl(out string strWhere) { strWhere = ""; try { dealData RptR_C = new dealData(); SqlDataReader objRCReader; dealData Rpt4 = new dealData(); SqlDataReader objRPT4Reader; objRCReader = RptR_C.getRC_R(m_TypeNo, m_SetTableNo, m_TableNo); Sequence First = new Sequence(-1, -1, 1, 1, "#"); Sequence Second = new Sequence(-1, -1, 1, 1, "#"); Sequence Result = new Sequence(-1, -1, 1, 1, "#"); string RowExpr = "";//�������ı��ʽ string ColExpr = "";//�������ı��ʽ string RowItem = "";//���������� string ColItem = "";//���������� string RowChineseItem = "";//�е�����������ϵ string ColChineseItem = "";//�е�����������ϵ string ResultItem = "";//���Ľ�������� string ResultExpr = "";//���Ľ���ı��ʽ string ResultChinese = "";//����ĺ������� int sequenceRow = -1; int sequenceCol = -1; int getcount1 = 0; int getcount2 = 0; string[] strTempwl; char[] a; a = "~".ToCharArray(); int i = 1; if (m_strMainObject == "") { string strtmp = " select MainObject from r200 where typeno = " + m_TypeNo + " and settableno = " + m_SetTableNo + " and tableno = " + m_TableNo; DataAccess.Data.GetSql getsql = new DataAccess.Data.GetSql(); DataTable dt = getsql.gsQuerySql(strtmp, "R200"); if (dt == null || dt.Rows.Count == 0) { m_strMainObject = "AA01"; } else { m_strMainObject = dt.Rows[0]["MainObject"].ToString(); } } //������������ while (objRCReader.Read()) { if (i == 1) { if ((int)(objRCReader["icount"]) != 0) { First.STARTROW = (int)(objRCReader["startrow"]) + 2; First.ENDROW = (int)(objRCReader["startrow"]) + 2 + (int)(objRCReader["icount"]) - 1; First.STARTCOL = (int)(objRCReader["startcol"]) + 2; First.ENDCOL = (int)(objRCReader["startcol"]) + 2 + (int)(objRCReader["icount"]) - 1; First.SEQUENCETYPE = objRCReader["serialtype"].ToString(); } } else { if ((int)(objRCReader["icount"]) != 0) { Second.STARTROW = (int)(objRCReader["startrow"]) + 2; Second.ENDROW = (int)(objRCReader["startrow"]) + 2 + (int)(objRCReader["icount"]) - 1; Second.STARTCOL = (int)(objRCReader["startcol"]) + 2; Second.ENDCOL = (int)(objRCReader["startcol"]) + 2 + (int)(objRCReader["icount"]) - 1; Second.SEQUENCETYPE = objRCReader["serialtype"].ToString(); } } i++; } objRCReader.Close(); objRCReader = null; bool blnTemp; blnTemp = true; if (Second.STARTROW != -1 && First.STARTROW != -1) { blnTemp = true; } else if (Second.STARTROW == -1 && First.STARTROW != -1) { Result = First; blnTemp = false; } else if (First.STARTROW == -1 && Second.STARTROW != -1) { Result = Second; blnTemp = false; } else { sequenceRow = -1; sequenceCol = -1; } //return ""; if (blnTemp == false)//һ�л�һ�� { //Result.STARTROW = First.STARTROW; //Result.ENDROW = First.ENDROW; //Result.STARTCOL = First.STARTCOL; //Result.ENDCOL = First.ENDCOL; //Result.SEQUENCETYPE = First.SEQUENCETYPE; sequenceRow = m_row - Result.STARTROW; sequenceCol = m_col - Result.STARTCOL; if (Result.SEQUENCETYPE == "1") { if (sequenceCol != 0) { sequenceCol = -1; } } else { if (sequenceRow != 0) { sequenceRow = -1; } } } else if (First.STARTROW == Second.STARTROW && First.STARTCOL == Second.STARTCOL)//��ά���� { Result.STARTROW = First.STARTROW; if (First.SEQUENCETYPE == "1") { Result.ENDROW = First.ENDROW; } else { Result.ENDROW = Second.ENDROW; } Result.STARTCOL = First.STARTCOL; if (First.SEQUENCETYPE == "2") { Result.ENDCOL = First.ENDCOL; } else { Result.ENDCOL = Second.ENDCOL; } Result.SEQUENCETYPE = "1&2"; sequenceRow = m_row - Result.STARTROW; sequenceCol = m_col - Result.STARTCOL; if (m_row > Result.ENDROW || m_col > Result.ENDCOL) { sequenceRow = -1; sequenceCol = -1; } } else//������û�д��� { Result.SEQUENCETYPE = "1|2"; } //�ҳ����ڵ����е�λ�� //if (First.SEQUENCETYPE == "1" && m_row - First.STARTROW >= 0 && m_row <= First.ENDROW) //{ // sequenceRow = m_row - First.STARTROW; //} //if (First.SEQUENCETYPE == "2" && m_col - First.STARTCOL >= 0 && m_col <= First.ENDCOL) //{ // sequenceCol = m_col - First.STARTCOL; //} //if (Second.SEQUENCETYPE == "1" && m_row - Second.STARTROW >= 0 && m_row <= Second.ENDROW) //{ // sequenceRow = m_row - Second.STARTROW; //} //if (Second.SEQUENCETYPE == "2" && m_col - Second.STARTCOL >= 0 && m_col <= Second.ENDCOL) //{ // sequenceCol = m_col - Second.STARTCOL; //} bool nullSequenceRow = false; bool nullSequenceCol = false; if (sequenceRow > -1 && sequenceCol > -1)//�������� { if (sequenceRow > -1) { dealData Rpt1 = new dealData(); SqlDataReader objRPT1Reader; objRPT1Reader = Rpt1.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, sequenceRow, "1"); while (objRPT1Reader.Read()) { if (objRPT1Reader["sequenceType"].ToString() == "4") { return ""; } else { RowExpr = objRPT1Reader["baseexpr"].ToString(); RowItem = objRPT1Reader["baseitem"].ToString(); RowChineseItem = objRPT1Reader["chineseitem"].ToString(); if (RowItem == null || RowItem == "") { nullSequenceRow = true; } } } objRPT1Reader.Close(); //----------------------------------------- dealData Rpt2 = new dealData(); SqlDataReader objRPT2Reader; objRPT2Reader = Rpt2.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, sequenceCol, "2"); while (objRPT2Reader.Read()) { if (objRPT2Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT2Reader["baseexpr"].ToString(); ColItem = objRPT2Reader["baseitem"].ToString(); ColChineseItem = objRPT2Reader["chineseitem"].ToString(); if (ColItem == null || ColItem == "") { nullSequenceCol = true; } } } objRPT2Reader.Close(); //�������ڷָ�� if (RowItem != "") { strTempwl = RowItem.ToString().Split(a); getcount1 = strTempwl.Length; } if (ColItem != "") { strTempwl = ColItem.ToString().Split(a); getcount2 = strTempwl.Length; } //string ResultItem = "";//���Ľ�������� //string ResultExpr = "";//���Ľ���ı��ʽ //string ResultChinese = "";//����ĺ������� if (getcount1 == 0 && getcount2 == 0 && nullSequenceRow == false && nullSequenceCol == false) {//���뵥Ԫ���� //getUnitCondition objRPT4Reader = Rpt4.getUnitCondition(m_TypeNo, m_SetTableNo, m_TableNo, "2", m_row, m_col); while (objRPT4Reader.Read()) { if (objRPT4Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT4Reader["baseexpr"].ToString(); ColItem = objRPT4Reader["baseitem"].ToString(); ColChineseItem = objRPT4Reader["chineseitem"].ToString(); } } objRPT4Reader.Close(); if (ColExpr != "") { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; } else { return ""; } } else if (getcount1 == 0 && getcount2 != 0) { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; } else if (getcount1 != 0 && getcount2 == 0) { ResultItem = RowItem; ResultExpr = RowExpr; ResultChinese = RowChineseItem; } else { if (ColItem == "") { ColExpr = ""; } if (RowItem == "") { RowExpr = ""; } ResultExpr = gs_Comexpress(getcount1, getcount2, RowExpr, ColExpr); ResultItem = RowItem + "~" + ColItem; ResultChinese = RowChineseItem + "~" + ColChineseItem; } getcount1 = getcount2 + getcount1; } } else {//��Ԫ���� objRPT4Reader = Rpt4.getUnitCondition(m_TypeNo, m_SetTableNo, m_TableNo, "3", m_row, m_col); while (objRPT4Reader.Read()) { ColExpr = objRPT4Reader["baseexpr"].ToString(); ColItem = objRPT4Reader["baseitem"].ToString(); ColChineseItem = objRPT4Reader["chineseitem"].ToString(); } objRPT4Reader.Close(); if (ColExpr != "") { ResultItem = ColItem; ResultExpr = ColExpr; ResultChinese = ColChineseItem; strTempwl = ResultItem.ToString().Split(a); getcount1 = strTempwl.Length; } else { return ""; } } //����ȫ������ dealData Rpt3 = new dealData(); SqlDataReader objRPT3Reader; objRPT3Reader = Rpt3.getOneCondition(m_TypeNo, m_SetTableNo, m_TableNo, -1, "0"); while (objRPT3Reader.Read()) { if (objRPT3Reader["sequenceType"].ToString() == "4") { return ""; } else { ColExpr = objRPT3Reader["baseexpr"].ToString(); ColItem = objRPT3Reader["baseitem"].ToString(); ColChineseItem = objRPT3Reader["chineseitem"].ToString(); } } objRPT3Reader.Close(); if (ColItem != "") { if (ColItem == "") { ColExpr = ""; } if (ResultItem == "") { ResultExpr = ""; } strTempwl = ColItem.ToString().Split(a); getcount2 = strTempwl.Length; ResultExpr = gs_Comexpress(getcount1, getcount2, ResultExpr, ColExpr); if (ResultItem != "" && ResultItem != "~") { ResultItem = ResultItem + "~" + ColItem; } else { ResultItem = ColItem; } if (ResultChinese != "" && ResultChinese != "~") { ResultChinese = ResultChinese + "~" + ColChineseItem; } else { ResultChinese = ColChineseItem; } getcount1 = getcount1 + getcount2; } //�����ⲿ���� if (m_Item != null && this.m_Item != "") { strTempwl = m_Item.ToString().Split(a); getcount2 = strTempwl.Length; ResultExpr = gs_Comexpress(getcount1, getcount2, ResultExpr, m_Expr); ResultItem = ResultItem + "~" + m_Item; //ResultChinese = ResultChinese + "~" + ColChineseItem; //getcount1 = getcount1 + getcount2; } //if(ResultItem!="") //{ QueryDeal dealCondition = new QueryDeal(m_strMainObject, ResultExpr, ResultItem, ""); string strCondition = dealCondition.QueryResult(); if (strCondition != "" && m_AB0110 != "-1") { if (m_AB0110 != "" && m_AB0110 != "0") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = strCondition + " and " + m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = strCondition + " and " + m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } else { if (m_AB0110 != "" && m_AB0110 != "0") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } } } m_strFLD = dealCondition.FLD; Datastat RptLoad = new Datastat(); RptLoad.MainObject = m_strMainObject; RptLoad.StatResult(m_TypeNo, m_SetTableNo, m_TableNo, false); string strTBL; string strFLD; string strASS; strTBL = RptLoad.TBL; strFLD = RptLoad.FLD; strASS = RptLoad.ASS; dealData dealRequery = new dealData(); if (strCondition == "") { if (m_AB0110 != "-1" && m_AB0110 != "0" && m_AB0110 != "") { if (m_strMainObject.ToUpper() != "AB01") { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' and " + m_strMainObject + ".ab0110 like '" + m_AB0110 + "%'"; } else { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' and " + m_strMainObject + ".ab0110 = '" + m_AB0110 + "'"; } } else { strCondition = "select " + m_strMainObject + ".ZA0100 from " + m_strMainObject + " where " + m_strMainObject + ".ZC9993 = '1' "; } } strWhere = strCondition; strCondition = dealRequery.ReQuery(m_strMainObject, strTBL, strFLD, strASS, strCondition); return strCondition; //�����Ԫ���� //sequenceRow } catch (Exception ee) { return ""; //return "getsql " + ee.Message; } }