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 btnCompare_Click(object sender, EventArgs e) { string custId = DbHelperOra.GetSingle("select value from sys_para where code='USERCODE'").ToString(); string dno = ""; if (ViewState["dhd_billno"] != null && !"".Equals(ViewState["dhd_billno"].ToString())) { dno = ViewState["dhd_billno"].ToString(); } string strBeginDate = ""; if (ViewState["beginDate1"] != null && !"".Equals(ViewState["beginDate1"].ToString())) { strBeginDate = ViewState["beginDate1"].ToString(); } string strEndDate = ""; if (ViewState["endDate1"] != null && !"".Equals(ViewState["endDate1"].ToString())) { strEndDate = ViewState["endDate1"].ToString(); } String[] paramArray = { strBeginDate, strEndDate, dno, custId }; //组合要查询的单据号 string strDDBHs = ""; if (GridList.Rows.Count > 0) { for (int i = 0; i < GridList.Rows.Count; i++) { if (i == GridList.Rows.Count - 1) { strDDBHs = strDDBHs + "'" + GridList.Rows[i].Values[1].ToString() + "'"; } else { strDDBHs = strDDBHs + "'" + GridList.Rows[i].Values[1].ToString() + "',"; } } } else { Alert.Show("没有查询到订单,请先查询订单!", "消息提示", MessageBoxIcon.Warning); return; } //根据条件查询eas上调拨单 string result = ApiClientService.QueryEASBill("DHD", paramArray); if (String.IsNullOrWhiteSpace(result) || "-1".Equals(result)) { Alert.Show("与数据中心通讯失败,请稍后再试!", "消息提示", MessageBoxIcon.Warning); return; } 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) { saveDDDocCom(ja);//把下传的单据保存到用于比较的临时表DAT_DD_DOC_COMPARE,DAT_DD_COM_COMPARE } } } //关联DAT_DD_DOC表和DAT_DD_DOC_COMPARE表,重新绑定GridList #region string strSql = @"SELECT NULL MEMO,A.*,B.XDRQ XDRQ_EAS,B.SUBNUM SUBNUM_EAS,B.SUBSUM SUBSUM_EAS FROM (SELECT BILLNO,XDRQ,SUBNUM,SUBSUM,(select VALUE from sys_para where code='USERCODE') CUSTID,SHR,SHRQ FROM DAT_DD_DOC WHERE SEQNO in ({0})) A LEFT JOIN DAT_DD_DOC_COMPARE B ON A.BILLNO=B.SEQNO ORDER BY A.BILLNO"; strSql = string.Format(strSql, strDDBHs); DataTable dt = DbHelperOra.Query(strSql).Tables[0]; string GreenRowsList = ""; string RedRowsList = ""; foreach (DataRow dr in dt.Rows) { Decimal SUBNUM = 0; try { SUBNUM = Convert.ToDecimal(dr["SUBNUM"]); } catch { SUBNUM = 0; } Decimal SUBNUM_EAS = 0; if (dr["SUBNUM_EAS"] != null && !"".Equals(dr["SUBNUM_EAS"].ToString())) { try { SUBNUM_EAS = Convert.ToDecimal(dr["SUBNUM_EAS"]); } catch { SUBNUM_EAS = 0; } } else { dr["MEMO"] = "ERP有EAS没有"; continue; } if (SUBNUM == SUBNUM_EAS) { dr["MEMO"] = "完全匹配"; GreenRowsList += dt.Rows.IndexOf(dr).ToString() + ","; } else { dr["MEMO"] = "条目数不匹配"; RedRowsList += dt.Rows.IndexOf(dr).ToString() + ","; } } GridList.DataSource = dt; GridList.DataBind(); PageContext.RegisterStartupScript("onGridDataLoad('" + RedRowsList + "','" + GreenRowsList + "','" + GridList.ClientID + "');"); #endregion }