void BindGrid() { List <RzViewContent> rz1 = RZSource.Init.GetRzSourceByType("产品认证", ""); List <RzViewContent> rz1_tp = new List <RzViewContent>(); for (int i = 0; (i < 10 && i < rz1.Count); i++) { rz1_tp.Add(rz1[i]); } GridList1.DataSource = rz1_tp; GridList1.DataBind(); List <RzViewContent> rz2 = RZSource.Init.GetRzSourceByType("体系认证", ""); List <RzViewContent> rz2_tp = new List <RzViewContent>(); for (int i = 0; (i < 10 && i < rz2.Count); i++) { rz2_tp.Add(rz2[i]); } GridList2.DataSource = rz2_tp; GridList2.DataBind(); }
protected void btnSearch2_Click(object sender, EventArgs e) { if (lstLRRQ11.SelectedDate == null || lstLRRQ22.SelectedDate == null) { Alert.Show("请输入条件【录入日期】!"); return; } else if (lstLRRQ11.SelectedDate > lstLRRQ22.SelectedDate) { Alert.Show("开始日期大于结束日期,请重新输入!"); return; } DateTime lrrq1Value = (DateTime)lstLRRQ11.SelectedDate; DateTime lrrq2Value = (DateTime)lstLRRQ22.SelectedDate; string custId = DbHelperOra.GetSingle("select value from sys_para where code='USERCODE'").ToString(); string dno = txtBillNo2.Text.Trim(); string strBeginDate = lrrq1Value.ToString("yyyy-MM-dd"); string strEndDate = lrrq2Value.ToString("yyyy-MM-dd"); String[] paramArray = { strBeginDate, strEndDate, dno, custId }; //查询eas上调拨入库单 string result = ApiClientService.QueryEASBill("DRK", paramArray); if (String.IsNullOrWhiteSpace(result) || "-1".Equals(result)) { Alert.Show("与数据中心通讯失败,请稍后再试!", "消息提示", MessageBoxIcon.Warning); return; } string strBillNos = ""; JArray jaResult = JArray.Parse(result);//多单据数组 foreach (JToken jt in jaResult) { JObject jResult = (JObject)jt;//单单据对象 if ("success".Equals(jResult.Value <String>("result"))) { JArray ja = jResult.Value <JArray>("data"); if (ja.Count > 0) { strBillNos = strBillNos + "'" + saveRKDocCom(ja) + "',";//把下传的单据保存到用于比较的临时表DAT_RK_DOC_COMPARE,DAT_RK_COM_COMPARE } } } if (!String.IsNullOrWhiteSpace(strBillNos)) { strBillNos = strBillNos.TrimEnd(','); string strSql = @"SELECT SEQNO,DDBH,NULL DHRQ,DHRQ DHRQ_EAS,NULL SUBNUM,SUBNUM SUBNUM_EAS,NULL SUBSUM,SUBSUM SUBSUM_EAS,(select VALUE from sys_para where code='USERCODE') CUSTID from DAT_RK_DOC_COMPARE where BILLNO IN (" + strBillNos + ") order by seqno"; GridList2.DataSource = DbHelperOra.Query(strSql).Tables[0]; } else { Alert.Show("没有查询到订单!", "消息提示", MessageBoxIcon.Warning); return; } GridList2.DataBind(); GridDetail2.DataSource = null; GridDetail2.DataBind(); }
protected void btnCompare2_Click(object sender, EventArgs e) { string strDDBHs = ""; if (GridList2.Rows.Count > 0) { for (int i = 0; i < GridList2.Rows.Count; i++) { if (i == GridList2.Rows.Count - 1) { strDDBHs = strDDBHs + "'" + GridList2.Rows[i].Values[1].ToString() + "'"; } else { strDDBHs = strDDBHs + "'" + GridList2.Rows[i].Values[1].ToString() + "',"; } } } else { Alert.Show("没有查询到入库单,请先查询入库单!", "消息提示", MessageBoxIcon.Warning); return; } //取得查询条件 DateTime lrrq1Value = (DateTime)lstLRRQ11.SelectedDate; DateTime lrrq2Value = (DateTime)lstLRRQ22.SelectedDate; string strBeginDate = lrrq1Value.ToString("yyyy-MM-dd"); string strEndDate = lrrq2Value.ToString("yyyy-MM-dd"); string dno = txtBillNo2.Text.Trim(); string strWhere = ""; if (!String.IsNullOrWhiteSpace(dno)) { strWhere = " seqno like '%" + dno + "%'"; } else { strWhere = " DHRQ>=to_date('" + strBeginDate + "','YYYY-MM-DD') and DHRQ<=to_date('" + strEndDate + "','YYYY-MM-DD')"; } #region 关联DAT_RK_DOC表和DAT_RK_DOC_COMPARE表,重新绑定GridList2 // string strSql = @"select A.*,B.LRRQ,B.SUBNUM,B.SUBSUM // from (SELECT BILLNO,TO_CHAR(LRRQ,'YYYY-MM-DD') LRRQ_EAS,SUBNUM SUBNUM_EAS,SUBSUM SUBSUM_EAS,(select VALUE from sys_para where code='USERCODE') CUSTID from DAT_RK_DOC_COMPARE // WHERE BILLNO in ({0})) A LEFT JOIN DAT_RK_DOC B ON A.BILLNO=B.SEQNO"; string strSql = @"select null MEMO,c.* from (select a.*,B.DHRQ DHRQ_EAS,B.SUBNUM SUBNUM_EAS from (select SEQNO,DHrq,subnum from dat_rk_doc where MEMO='FROM_PLATFORM' AND {0} ) a left join (select SEQNO,DHrq,subnum from dat_rk_doc_compare where {0} ) b on a.seqno=b.seqno union select a.seqno,null DHRQ,null subnum,a.DHRQ DHRQ_EAS,A.subnum subnum_eas from (select SEQNO,DHRQ,subnum from dat_rk_doc_compare where {0} ) a where not EXISTS ( select * from (select SEQNO,DHrq,subnum from dat_rk_doc where MEMO='FROM_PLATFORM' AND {0} ) b where a.seqno=b.seqno)) c order by c.seqno asc"; strSql = string.Format(strSql, strWhere); DataTable dt = DbHelperOra.Query(strSql).Tables[0]; string GreenRowsList = ""; string RedRowsList = ""; string YellowRowsList = ""; foreach (DataRow dr in dt.Rows) { string strDHRQ = ""; if (dr["DHRQ"] != null && !"".Equals(dr["DHRQ"].ToString())) { strDHRQ = dr["DHRQ"].ToString(); } else { //如果DHRQ是NULL或者空值,说明DAT_RK_DOC中没有该单据,标识黄色 YellowRowsList += dt.Rows.IndexOf(dr).ToString() + ","; dr["MEMO"] = "ERP没有EAS有"; continue; } string strDHRQ_EAS = ""; if (dr["DHRQ_EAS"] != null && !"".Equals(dr["DHRQ_EAS"].ToString())) { strDHRQ_EAS = dr["DHRQ_EAS"].ToString(); } else { //如果DHRQ_EAS是NULL或者空值,说明DAT_RK_DOC_COMPARE中没有该单据,标识白色 dr["MEMO"] = "ERP有EAS没有"; continue; } Decimal SUBNUM = 0; if (dr["SUBNUM"] != null && !"".Equals(dr["SUBNUM"].ToString())) { try { SUBNUM = Convert.ToDecimal(dr["SUBNUM"]); } catch { } } Decimal SUBNUM_EAS = Convert.ToDecimal(dr["SUBNUM_EAS"]); if (SUBNUM == SUBNUM_EAS) { GreenRowsList += dt.Rows.IndexOf(dr).ToString() + ","; dr["MEMO"] = "完全匹配"; } else { RedRowsList += dt.Rows.IndexOf(dr).ToString() + ","; dr["MEMO"] = "条数不匹配"; } } GridList2.DataSource = dt; GridList2.DataBind(); PageContext.RegisterStartupScript("onGridDataLoad2('" + RedRowsList + "','" + GreenRowsList + "','" + YellowRowsList + "','" + GridList2.ClientID + "');"); #endregion }