private string GetSqlWhere() { string sqlWhere = ""; //批次号 if (!string.IsNullOrEmpty(hidPCH.Value)) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND PCH like '%" + hidPCH.Value + "%'"; } else { sqlWhere += " and PCH like '%" + hidPCH.Value + "%'"; } } //生产线 if (!string.IsNullOrEmpty(this.hidSCX.Value)) { string tempStr = "ACCTRUE"; string strSCXID = WGDQuery.GetSCXID(this.hidSCX.Value.Trim()); if (!string.IsNullOrEmpty(strSCXID)) { tempStr = strSCXID; } if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND SCX" + (this.Drptj.SelectedValue.Trim()) + "'" + tempStr + "'"; } else { sqlWhere += " and SCX " + this.Drptj.SelectedValue.Trim() + "'" + tempStr + "'"; } } if (this.chkyzj.Checked) { sqlWhere += " and zjbz=1 "; } else { sqlWhere += " and zjbz=0 "; } sqlWhere = " and wcbz=0 " + sqlWhere; return(sqlWhere); }
private string CreateUrl() { StringBuilder sb = new StringBuilder(); sb.Append("PrintWGD.aspx?TYPE=1"); if (this.grvWGD.Columns[1].Visible == false) { sb.Append("&ISWGDH=true"); } if (this.grvWGD.Columns[2].Visible == false) { sb.Append("&ISSCX=true"); } if (this.grvWGD.Columns[3].Visible == false) { sb.Append("&ISPC=true"); } if (this.grvWGD.Columns[4].Visible == false) { sb.Append("&ISPCSX=true"); } if (this.grvWGD.Columns[5].Visible == false) { sb.Append("&ISTSXX=true"); } if (this.grvWGD.Columns[6].Visible == false) { sb.Append("&ISPCLX=true"); } if (this.grvWGD.Columns[7].Visible == false) { sb.Append("&ISPH=true"); } if (this.grvWGD.Columns[8].Visible == false) { sb.Append("&ISGG=true"); } if (this.grvWGD.Columns[9].Visible == false) { sb.Append("&ISWLH=true"); } if (this.grvWGD.Columns[10].Visible == false) { sb.Append("&ISWLMC=true"); } if (this.grvWGD.Columns[11].Visible == false) { sb.Append("&ISZXBZ=true"); } if (this.grvWGD.Columns[12].Visible == false) { sb.Append("&ISFZDW=true"); } if (this.grvWGD.Columns[13].Visible == false) { sb.Append("&ISPCXH=true"); } if (this.grvWGD.Columns[14].Visible == false) { sb.Append("&ISZJBZ=true"); } if (this.grvWGD.Columns[15].Visible == false) { sb.Append("&ISPGSM=true"); } if (this.grvWGD.Columns[16].Visible == false) { sb.Append("&ISJSSJ=true"); } if (this.grvWGD.Columns[17].Visible == false) { sb.Append("&ISSCWC=true"); } if (this.grvWGD.Columns[18].Visible == false) { sb.Append("&ISRKWC=true"); } if (this.grvWGD.Columns[19].Visible == false) { sb.Append("&ISDJZT=true"); } if (this.grvWGD.Columns[20].Visible == false) { sb.Append("&ISBB=true"); } if (!string.IsNullOrEmpty(hidWGDH.Value)) { sb.Append("&WGDH=" + hidWGDH.Value); } //批次号 if (!string.IsNullOrEmpty(hidPCH.Value)) { sb.Append("&PCH=" + hidPCH.Value); } //质检人 if (!string.IsNullOrEmpty(this.hidZJR.Value)) { string[] strZJR = this.hidZJR.Value.Split('|'); sb.Append("&ZJR=" + strZJR[0].Trim()); } //特殊信息 if (!string.IsNullOrEmpty(this.hidTSXX.Value)) { sb.Append("&TSXX=" + this.hidTSXX.Value); } //批次类型 if (!string.IsNullOrEmpty(hidPLX.Value)) { sb.Append("&PCLX=" + this.hidPLX.Value); } //批次属性 if (!string.IsNullOrEmpty(hidPCSX.Value)) { sb.Append("&PCSX=" + this.hidPCSX.Value); } //物料号 if (!string.IsNullOrEmpty(hidWLH.Value)) { sb.Append("&WLH=" + this.hidWLH.Value); } //生产线 if (!string.IsNullOrEmpty(this.hidSCX.Value)) { string tempStr = "ACCTRUE"; string strSCXID = WGDQuery.GetSCXID(this.hidSCX.Value.Trim()); if (!string.IsNullOrEmpty(strSCXID)) { tempStr = strSCXID; } sb.Append("&SCX=" + tempStr); } //完成标志 if (!string.IsNullOrEmpty(this.hidWCBZ.Value)) { sb.Append("&WCBZ=" + hidWCBZ.Value); } //牌号 if (!string.IsNullOrEmpty(this.hidPH.Value)) { sb.Append("&PH=" + hidPH.Value); } //待判 if (!string.IsNullOrEmpty(this.hidDPP.Value)) { sb.Append("&DP=" + this.hidDPP.Value); } //规格 if (!string.IsNullOrEmpty(hidGG.Value)) { sb.Append("&GG=" + this.hidGG.Value); } //生产开始时间 if (this.chkPTime.Checked && !string.IsNullOrEmpty(txtPStartTime.Text.Trim())) { string startTime = this.txtPStartTime.Text.Trim() + " 00:00:00"; sb.Append("&SCKS=" + startTime); } //生产结束时间 if (this.chkPTime.Checked && !string.IsNullOrEmpty(txtPEndTime.Text.Trim())) { string endTime = this.txtPEndTime.Text.Trim() + " 23:59:59"; sb.Append("&SCJS=" + endTime); } //入库完成时间 if (this.chkRTime.Checked && !string.IsNullOrEmpty(txtRStartTime.Text.Trim())) { string startTime = this.txtRStartTime.Text.Trim() + " 00:00:00"; sb.Append("&RKWC=" + startTime); } //入库结束时间 if (this.chkRTime.Checked && !string.IsNullOrEmpty(txtREndTime.Text.Trim())) { string endTime = this.txtREndTime.Text.Trim() + " 23:59:59"; sb.Append("&RKJS=" + endTime); } if (this.chkPaoGou.Checked) { sb.Append("&PGBZ=1"); } return(sb.ToString()); }
//获取查询条件 private string GetSqlWhere() { string sqlWhere = ""; if (!string.IsNullOrEmpty(hidWGDH.Value) && this.chkWGDH.Checked) { sqlWhere += "a.WGDH like '%" + hidWGDH.Value + "%' "; } else { this.hidWGDH.Value = ""; this.drpWGDH.Text = ""; } //批次号 if (!string.IsNullOrEmpty(hidPCH.Value) && this.chkPCH.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PCH like '%" + hidPCH.Value + "%'"; } else { sqlWhere += " a.PCH like '%" + hidPCH.Value + "%'"; } } else { this.hidPCH.Value = ""; this.drpPCH.Text = ""; } //质检人 if (!string.IsNullOrEmpty(this.hidZJR.Value)) { string[] strZJR = this.hidZJR.Value.Split('|'); if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.NCWLBMID ='" + strZJR[0].Trim() + "'"; } else { sqlWhere += " a.NCWLBMID ='" + strZJR[0].Trim() + "'"; } } //特殊信息 if (!string.IsNullOrEmpty(this.hidTSXX.Value) && this.chkTSXX.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.pcinfo like '%" + this.hidTSXX.Value.Trim() + "%'"; } else { sqlWhere += " a.pcinfo like '%" + this.hidTSXX.Value.Trim() + "%'"; } } else { this.hidTSXX.Value = ""; this.drpTSXX.Text = ""; } //批次类型 if (!string.IsNullOrEmpty(hidPLX.Value)) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PCLX=" + hidPLX.Value.Trim(); } else { sqlWhere += " a.PCLX =" + hidPLX.Value.Trim(); } } //批次属性 if (!string.IsNullOrEmpty(hidPCSX.Value)) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PCSX='" + hidPCSX.Value.Trim() + "'"; } else { sqlWhere += " a.PCSX ='" + hidPCSX.Value.Trim() + "'"; } } //物料号 if (!string.IsNullOrEmpty(hidWLH.Value) && this.chkWLH.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.WLH like '%" + hidWLH.Value.Trim() + "%'"; } else { sqlWhere += " a.WLH like '%" + hidWLH.Value.Trim() + "%'"; } } else { this.hidWLH.Value = ""; this.drpWLH.Text = ""; } //生产线 if (!string.IsNullOrEmpty(this.hidSCX.Value)) { string tempStr = "ACCTRUE"; string strSCXID = WGDQuery.GetSCXID(this.hidSCX.Value.Trim()); if (!string.IsNullOrEmpty(strSCXID)) { tempStr = strSCXID; } if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.SCX='" + tempStr + "'"; } else { sqlWhere += " a.SCX ='" + tempStr + "'"; } } //完成标志 if (!string.IsNullOrEmpty(this.hidWCBZ.Value)) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.wcbz=" + this.hidWCBZ.Value.Trim(); } else { sqlWhere += " a.wcbz =" + this.hidWCBZ.Value.Trim(); } } //牌号 if (!string.IsNullOrEmpty(this.hidPH.Value) && this.chkPH.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PH like '%" + this.hidPH.Value.Trim() + "%'"; } else { sqlWhere += " a.PH like '%" + this.hidPH.Value.Trim() + "%'"; } } else { this.hidPH.Value = ""; this.drpPH.Text = ""; } //待判 if (!string.IsNullOrEmpty(this.hidDPP.Value)) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.pcsx ='DP' and a.zpdjbz='" + this.hidDPP.Value.Trim() + "'"; } else { sqlWhere += " a.pcsx ='DP' and a.zpdjbz='" + this.hidDPP.Value.Trim() + "'"; } } //规格 if (!string.IsNullOrEmpty(hidGG.Value) && this.chkGG.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.GG like '%" + hidGG.Value.Trim() + "%'"; } else { sqlWhere += " a.GG like '%" + hidGG.Value.Trim() + "%'"; } } else { this.hidGG.Value = ""; this.drpGG.Text = ""; } //生产开始时间 if (this.chkPTime.Checked && !string.IsNullOrEmpty(txtPStartTime.Text.Trim())) { string startTime = this.txtPStartTime.Text.Trim() + " 00:00:00"; if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PEnd_Time >='" + startTime + "'"; } else { sqlWhere += " a.PEnd_Time >='" + startTime + "'"; } } //生产结束时间 if (this.chkPTime.Checked && !string.IsNullOrEmpty(txtPEndTime.Text.Trim())) { string endTime = this.txtPEndTime.Text.Trim() + " 23:59:59"; if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.PEnd_Time<='" + endTime + "'"; } else { sqlWhere += " a.PEnd_Time<='" + endTime + "'"; } } //入库完成时间 if (this.chkRTime.Checked && !string.IsNullOrEmpty(txtRStartTime.Text.Trim())) { string startTime = this.txtRStartTime.Text.Trim() + " 00:00:00"; if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.End_Time >='" + startTime + "'"; } else { sqlWhere += " a.End_Time >='" + startTime + "'"; } } //入库结束时间 if (this.chkRTime.Checked && !string.IsNullOrEmpty(txtREndTime.Text.Trim())) { string endTime = this.txtREndTime.Text.Trim() + " 23:59:59"; if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " AND a.End_Time<='" + endTime + "'"; } else { sqlWhere += " a.End_Time<='" + endTime + "'"; } } if (this.chkPaoGou.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " and a.PGBZ > 0 "; } else { sqlWhere += " a.PGBZ > 0 "; } } if (this.chkFree1.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " and a.vfree0 like '%" + this.txtFree1.Text + "%'"; } else { sqlWhere += " a.vfree0 like '%" + this.txtFree1.Text + "%'"; } } if (this.chkFree2.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " and a.vfree1 like '%" + this.txtFree2.Text + "%'"; } else { sqlWhere += " a.vfree1 like '%" + this.txtFree2.Text + "%'"; } } if (this.chkFree3.Checked) { if (!string.IsNullOrEmpty(sqlWhere)) { sqlWhere += " and a.vfree2 like '%" + this.txtFree3.Text + "%'"; } else { sqlWhere += " a.vfree2 like '%" + this.txtFree3.Text + "%'"; } } return(sqlWhere); }