private string GetFilterSql(SpecialReturnMaterial model, UserInfo user) { try { string strSql = " Where ISNULL(IsDel,1) = 1 "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.InvtID)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (InvtID LIKE '%" + model.InvtID + "%' ) "; hadWhere = true; } //if (!string.IsNullOrEmpty(model.pName)) //{ // strSql = Common_Func.AddWhereAnd(strSql, hadWhere); // strSql += " HouseName LIKE '%" + model.pName + "%' "; // hadWhere = true; //} if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Creater Like '%" + model.Creater + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(OverViewDetailInfo model, UserInfo user) { try { string strSql = " Where ISNULL(MaterialNo,TMaterialNo) is not null "; bool hadWhere = true; if (model.Task_ID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Task_ID = " + model.Task_ID + " "; hadWhere = true; } if (model.Status >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Status = " + model.Status + " "; hadWhere = true; } if (model.IsQualityComp >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " IsQualityComp = " + model.IsQualityComp + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(CheckDetailsInfo model, UserInfo user) { try { string strSql = " Where NVL(IsDel,1) = 1 "; bool hadWhere = true; if (model.ID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ID = " + model.ID + " "; hadWhere = true; } if (model.CheckID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckID = " + model.CheckID + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName LIKE '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName LIKE '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (model.Status >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Status = " + model.Status + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Operator)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Operator Like '%" + model.Operator + "%' "; hadWhere = true; } if (model.ProfitLoss >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ProfitLoss = " + model.ProfitLoss + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Creater Like '%" + model.Creater + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } switch (model.CheckType) { case 1: strSql += " group by CheckID, WarehouseNo, WarehouseName "; break; case 2: strSql += " group by CheckID, WarehouseNo, WarehouseName, HouseNo, HouseName "; break; case 3: strSql += " group by CheckID, WarehouseNo, WarehouseName, HouseNo, HouseName, AreaNo, AreaName "; break; case 4: strSql += " group by CheckID, MaterialNo, MaterialDesc "; break; default: break; } return(strSql); } catch { return(string.Empty); } }
private bool GetSelectListFilterSql(CheckDetailsInfo model, UserInfo user, ref string ViewName, ref string FiltSql, ref string SortSql) { string strSql = string.Empty; bool hadWhere = false; try { if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName LIKE '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName LIKE '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (model.HaveDiff >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " nvl(HaveDiff,2) = " + model.HaveDiff + " "; hadWhere = true; } if (model.CheckYetMonth >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " nvl(CheckTime,to_date('1900-01-01','yyyy-mm-dd')) <= add_months(" + DateTime.Now.Date.ToSqlTimeString() + ",-" + model.CheckYetMonth + ") "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " StockTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " nvl(StockTime,to_date('1900-01-01','yyyy-mm-dd')) <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } } catch { strSql = string.Empty; } switch (model.CheckType) { case 1: if (model.CheckID <= 0) { ViewName = "V_CheckWarehouse V"; } else { ViewName = string.Format("(select (case when t.warehouseno is not null then 2 else 1 end) IsChecked, v.* from V_CheckWarehouse v left join ( select distinct WAREHOUSENO from v_Checkdetails where CheckID = {0}) t on v.WAREHOUSENO = t.warehouseno) V", model.CheckID); } FiltSql = strSql; SortSql = "Order By nvl(StockTime,to_date('1900-01-01','yyyy-mm-dd')) desc,WarehouseNo,WarehouseName"; return(true); case 2: if (model.CheckID <= 0) { ViewName = "V_CheckHouse V"; } else { ViewName = string.Format("(select (case when t.houseno is not null then 2 else 1 end) IsChecked, v.* from V_CheckHouse v left join ( select distinct WAREHOUSENO, HOUSENO from v_Checkdetails where CheckID = {0}) t on v.WAREHOUSENO = t.warehouseno and v.HOUSENO = t.houseno) V", model.CheckID); } FiltSql = strSql; SortSql = "Order By nvl(StockTime,to_date('1900-01-01','yyyy-mm-dd')) desc,HouseNo,HouseName"; return(true); case 3: if (model.CheckID <= 0) { ViewName = "V_CheckArea V"; } else { ViewName = string.Format("(select (case when t.areano is not null then 2 else 1 end) IsChecked, v.* from V_CheckArea v left join ( select distinct WAREHOUSENO, HOUSENO, AREANO from v_Checkdetails where CheckID = {0}) t on v.WAREHOUSENO = t.warehouseno and v.HOUSENO = t.houseno and v.AREANO = t.areano) V", model.CheckID); } FiltSql = strSql; SortSql = "Order By nvl(StockTime,to_date('1900-01-01','yyyy-mm-dd')) desc,AreaNo,AreaName"; return(true); case 4: if (model.CheckID <= 0) { ViewName = "V_CheckMaterial V"; } else { ViewName = string.Format("(select (case when t.materialno is not null then 2 else 1 end) IsChecked, v.* from V_CheckMaterial v left join ( select distinct MATERIALNO from v_Checkdetails where CheckID = {0}) t on v.MATERIALNO = t.materialno) V", model.CheckID); } FiltSql = strSql; SortSql = "Order By nvl(StockTime,to_date('1900-01-01','yyyy-mm-dd')) desc,MaterialNo,MaterialDesc"; return(true); default: return(false); } }
private string GetFilterSql(WarehouseInfo model, UserInfo user) { try { string strSql = " Where ISNULL(IsDel,1) = 1 "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName Like '%" + model.WarehouseNo + "%') "; hadWhere = true; } //if (!string.IsNullOrEmpty(model.WarehouseName)) //{ // strSql = Common_Func.AddWhereAnd(strSql, hadWhere); // strSql += " WarehouseName LIKE '%" + model.WarehouseName + "%' "; // hadWhere = true; //} if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ID In (Select WarehouseID From T_House Where HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName Like '%" + model.HouseNo + "%') "; hadWhere = true; } //if (!string.IsNullOrEmpty(model.HouseName)) //{ // strSql = Common_Func.AddWhereAnd(strSql, hadWhere); // strSql += " ID In (Select WarehouseID From T_House Where HouseName LIKE '%" + model.HouseName + "%') "; // hadWhere = true; //} if (!string.IsNullOrEmpty(model.Address)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Address Like '%" + model.Address + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Creater Like '%" + model.Creater + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(CheckInfo model, UserInfo user) { try { string strSql = " Where ISNULL(IsDel,1) = 1 "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.CheckNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckNo Like '%" + model.CheckNo + "%' "; hadWhere = true; } if (model.CheckType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckType = " + model.CheckType + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DutyUser)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); if (model.CheckStatus == 10) { strSql += string.Format(" (case checktype when 5 then DutyUser when 4 then DutyUser else '{0}' end) = '{0}' ", model.DutyUser); } else { //strSql += " DutyUser Like '%" + model.DutyUser + "%' "; strSql += " DutyUser = '******' "; } hadWhere = true; } if (!string.IsNullOrEmpty(model.CheckDesc)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckDesc Like '%" + model.CheckDesc + "%' "; hadWhere = true; } if (model.CheckStatus >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); if (model.CheckStatus == 10) { strSql += " CheckStatus in (1,2) "; } else { strSql += " CheckStatus = " + model.CheckStatus + " "; } hadWhere = true; } if (!string.IsNullOrEmpty(model.Remarks)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Remarks Like '%" + model.Remarks + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Creater Like '%" + model.Creater + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(ReceiveTransInfo model, UserInfo user) { try { string strSql = " Where SerialNo IS NOT NULL "; bool hadWhere = true; if (model.ReceiveType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ReceiveType = " + model.ReceiveType + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DeliveryNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " DeliveryNo LIKE '%" + model.DeliveryNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.TaskNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " TaskNo LIKE '%" + model.TaskNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.VoucherNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " VoucherNo LIKE '%" + model.VoucherNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialDoc)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " MaterialDoc LIKE '%" + model.MaterialDoc + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SupplierNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (SupplierNo LIKE '%" + model.SupplierNo + "%' OR SupplierName LIKE '%" + model.SupplierNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SerialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (SerialNo LIKE '%" + model.SerialNo + "%' OR Barcode LIKE '%" + model.SerialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SN)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SN LIKE '%" + model.SN + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (Creater LIKE '%" + model.Creater + "%' OR CreaterNo LIKE '%" + model.Creater + "%') "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDate >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDate <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(Stock_Model model, UserInfo user) { try { string strSql = " Where AreaNo is not null "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName LIKE '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName LIKE '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Barcode)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Barcode Like '%" + model.Barcode + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SerialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SerialNo LIKE '%" + model.SerialNo + "%' "; hadWhere = true; } //if (model.BatchNo.Equals("NULL")) //{ // strSql = Common_Func.AddWhereAnd(strSql, hadWhere); // strSql += " BatchNo is null "; // hadWhere = true; //} if (!string.IsNullOrEmpty(model.BatchNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " BatchNo LIKE '%" + model.BatchNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SN)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SN LIKE '%" + model.SN + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(CheckDetailsInfo model, UserInfo user) { try { string strSql = ""; bool hadWhere = false; if (model.ID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ID = " + model.ID + " "; hadWhere = true; } if (model.CheckID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckID = " + model.CheckID + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.AreaNo)) { switch (model.CheckType) { case 1: strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; break; case 2: strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.AreaNo + "%' OR HouseName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; break; case 3: strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.AreaNo + "%' OR WarehouseName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; break; case 4: case 5: strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.AreaNo + "%' OR MaterialDesc LIKE '%" + model.AreaNo + "%') "; hadWhere = true; break; } } if (model.Status >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Status = " + model.Status + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Operator)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Operator Like '%" + model.Operator + "%' "; hadWhere = true; } if (model.ProfitLoss >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ProfitLoss = " + model.ProfitLoss + " "; hadWhere = true; } if (model.HaveDiff >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); if (model.HaveDiff.ToBoolean()) { strSql += " ProfitLoss <> 1 "; } else { strSql += " ProfitLoss = 1 "; } hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " OperationTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " OperationTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private bool GetSelectListFilterSql(CheckDetailsInfo model, UserInfo user, ref string ViewName, ref string FiltSql, ref string SortSql) { string strSql = ""; bool hadWhere = false; try { if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName LIKE '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName LIKE '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%' OR MaterialStd LIKE '%" + model.MaterialNo + "%')"; hadWhere = true; } if (model.HaveDiff >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " HaveDiff = " + model.HaveDiff + " "; hadWhere = true; } if (model.AccountQty >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " AccountQty = " + model.AccountQty + " "; hadWhere = true; } if (model.CheckYetMonth >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ISNULL(CheckTime,cast('1900-01-01' as datetime)) <= add_months(" + DateTime.Now.Date.ToSqlTimeString() + ",-" + model.CheckYetMonth + ") "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Keeper) && model.CheckType == 5) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Keeper = '" + model.Keeper + "' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " StockTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " isnull(StockTime,cast('1900-01-01' as datetime)) <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } } catch { strSql = string.Empty; } switch (model.CheckType) { case 1: ViewName = "V_CheckWarehouse V"; FiltSql = strSql; SortSql = "Order By ISNULL(StockTime,cast('1900-01-01' as datetime)) desc,WarehouseNo,WarehouseName"; return(true); case 2: ViewName = "V_CheckHouse V"; FiltSql = strSql; SortSql = "Order By ISNULL(StockTime,cast('1900-01-01' as datetime)) desc,HouseNo,HouseName"; return(true); case 3: ViewName = "V_CheckArea V"; FiltSql = strSql; SortSql = "Order By ISNULL(StockTime,cast('1900-01-01' as datetime)) desc,AreaNo,AreaName"; return(true); case 4: ViewName = "V_CheckMaterial V"; FiltSql = strSql; SortSql = "Order By ISNULL(StockTime,cast('1900-01-01' as datetime)) desc,MaterialNo,MaterialDesc"; return(true); case 5: GetKeeperMaterial(model); ViewName = "V_CheckKeeper V"; FiltSql = strSql; SortSql = "Order By ISNULL(StockTime,cast('1900-01-01' as datetime)) desc,Keeper,MaterialNo,MaterialDesc"; return(true); default: return(false); } }
private string GetFilterSql(TaskTransInfo model, UserInfo user) { try { string strSql = " Where SerialNo is not null "; bool hadWhere = true; if (model.TaskType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " TaskType = " + model.TaskType + " "; hadWhere = true; } if (model.VoucherType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " VoucherType = " + model.VoucherType + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.FromWarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (FromWarehouseNo LIKE '%" + model.FromWarehouseNo + "%' OR FromWarehouseName LIKE '%" + model.FromWarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ToWarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ToWarehouseNo LIKE '%" + model.ToWarehouseNo + "%' OR ToWarehouseName LIKE '%" + model.ToWarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.FromHouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (FromHouseNo LIKE '%" + model.FromHouseNo + "%' OR FromHouseName LIKE '%" + model.FromHouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ToHouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ToHouseNo LIKE '%" + model.ToHouseNo + "%' OR ToHouseName LIKE '%" + model.ToHouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.FromAreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (FromHouseNo LIKE '%" + model.FromAreaNo + "%' OR FromHouseName LIKE '%" + model.FromAreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ToAreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ToAreaNo LIKE '%" + model.ToAreaNo + "%' OR ToAreaName LIKE '%" + model.ToAreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SerialNo)) { string[] arr = model.SerialNo.Split('@'); if (arr.Length == 4) { model.SerialNo = arr[2]; } strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SerialNo LIKE '%" + model.SerialNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SN)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SN LIKE '%" + model.SN + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.AndalaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " AndalaNo LIKE '%" + model.AndalaNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DeliveryNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " DeliveryNo LIKE '%" + model.DeliveryNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (Creater LIKE '%" + model.Creater + "%' OR CreaterNo LIKE '%" + model.Creater + "%') "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDate >= '" + model.StartTime.ToDateTime().Date.ToString("yyyy-MM-dd 00:00:00") + "' "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDate <= '" + model.EndTime.ToDateTime().AddDays(1).Date.ToString("yyyy-MM-dd 00:00:00") + "' "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(CheckTransInfo model, UserInfo user) { try { string strSql = ""; bool hadWhere = false; if (model.ID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " ID = " + model.ID + " "; hadWhere = true; } if (model.CheckID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckID = " + model.CheckID + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo LIKE '%" + model.AreaNo + "%' OR AreaName LIKE '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo LIKE '%" + model.HouseNo + "%' OR HouseName LIKE '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo LIKE '%" + model.WarehouseNo + "%' OR WarehouseName LIKE '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc LIKE '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Operator)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Operator Like '%" + model.Operator + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " OperationTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " OperationTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return strSql; } catch { return string.Empty; } }
private string GetFilterSql(OverViewExportInfo model, UserInfo user) { try { string strSql = ""; bool hadWhere = false; if (model.TaskType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " TaskType = " + model.TaskType + " "; hadWhere = true; } if (model.VoucherType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " VoucherType = " + model.VoucherType + " "; hadWhere = true; } if (model.TaskStatus >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " TaskStatus = " + model.TaskStatus + " "; hadWhere = true; } if (model.PostStatus >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " PostStatus = " + model.PostStatus + " "; hadWhere = true; } if (model.IsQuality >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " IsQuality = " + model.IsQuality + " "; hadWhere = true; } if (model.IsShelvePost >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " IsShelvePost = " + model.IsShelvePost + " "; hadWhere = true; } if (model.IsReceivePost >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " IsReceivePost = " + model.IsReceivePost + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.TaskNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " TaskNo LIKE '%" + model.TaskNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DeliveryNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (case vouchertype when 50 then taskno when 60 then taskno else deliveryno end) LIKE '%" + model.DeliveryNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialDoc)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " MaterialDoc LIKE '%" + model.MaterialDoc + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ReceiveUserNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ReceiveUserNo LIKE '%" + model.ReceiveUserNo + "%' OR ReceiveUserName LIKE '%" + model.ReceiveUserNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SupCusNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (SupCusNo LIKE '%" + model.SupCusNo + "%' OR SupCusName LIKE '%" + model.SupCusNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Plant)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (Plant LIKE '%" + model.Plant + "%' OR PlantName LIKE '%" + model.Plant + "%') "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateDateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.WarehouseID > 0) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Task_ID IN (SELECT TASK_ID FROM t_taskwarehouse WHERE WAREHOUSE_ID = " + model.WarehouseID + ") "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(ProfitLossInfo model, UserInfo user) { try { string strSql = "where (WarehouseNo is not null or ScanWarehouseNo is not null) "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.CheckNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckNo Like '%" + model.CheckNo + "%' "; hadWhere = true; } if (model.CheckID >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckID = " + model.CheckID + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.WarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (WarehouseNo Like '%" + model.WarehouseNo + "%' or WarehouseName Like '%" + model.WarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.HouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (HouseNo Like '%" + model.HouseNo + "%' or HouseName Like '%" + model.HouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.AreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (AreaNo Like '%" + model.AreaNo + "%' or AreaName Like '%" + model.AreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ScanWarehouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ScanWarehouseNo Like '%" + model.ScanWarehouseNo + "%' or ScanWarehouseName Like '%" + model.ScanWarehouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ScanHouseNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ScanHouseNo Like '%" + model.ScanHouseNo + "%' or ScanHouseName Like '%" + model.ScanHouseNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.ScanAreaNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ScanAreaNo Like '%" + model.ScanAreaNo + "%' or ScanAreaName Like '%" + model.ScanAreaNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (MaterialNo Like '%" + model.MaterialNo + "%' or MaterialDesc Like '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SerialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SerialNo Like '%" + model.SerialNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.BatchNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " BatchNo Like '%" + model.BatchNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SN)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " SN Like '%" + model.SN + "%' "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(CheckInfo model, UserInfo user) { try { string strSql = " Where NVL(IsDel,1) = 1 "; bool hadWhere = true; if (!string.IsNullOrEmpty(model.CheckNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckNo Like '%" + model.CheckNo + "%' "; hadWhere = true; } if (model.CheckType >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckType = " + model.CheckType + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DutyUser)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " DutyUser Like '%" + model.DutyUser + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.CheckDesc)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckDesc Like '%" + model.CheckDesc + "%' "; hadWhere = true; } if (model.CheckStatus >= 1) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CheckStatus = " + model.CheckStatus + " "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Remarks)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Remarks Like '%" + model.Remarks + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.Creater)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " Creater Like '%" + model.Creater + "%' "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString() + " "; hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " CreateTime <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString() + " "; hadWhere = true; } return(strSql); } catch { return(string.Empty); } }
private string GetFilterSql(DeliveryReceive_Model model, UserInfo user) { try { string strSql = ""; bool hadWhere = false; if (!string.IsNullOrEmpty(model.MaterialDoc)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " MaterialDoc Like '%" + model.MaterialDoc + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.VoucherNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " VoucherNo Like '%" + model.VoucherNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.DeliveryNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " DeliveryNo Like '%" + model.DeliveryNo + "%' "; hadWhere = true; } if (!string.IsNullOrEmpty(model.MaterialNo)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (ID || ',' || VOUCHERNO) In (Select (Receive_ID || ',' || VoucherNo) From V_GETQUALITYDETAILINFO Where MaterialNo LIKE '%" + model.MaterialNo + "%' OR MaterialDesc Like '%" + model.MaterialNo + "%') "; hadWhere = true; } if (!string.IsNullOrEmpty(model.SupCode)) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " (SupplierNo Like '%" + model.SupCode + "%' OR SupplierName Like '%" + model.SupCode + "%') "; hadWhere = true; } if (model.StartTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " postdate >= " + model.StartTime.ToDateTime().Date.ToSqlTimeString(); hadWhere = true; } if (model.EndTime != null) { strSql = Common_Func.AddWhereAnd(strSql, hadWhere); strSql += " postdate <= " + model.EndTime.ToDateTime().AddDays(1).Date.ToSqlTimeString(); hadWhere = true; } return(strSql); } catch { return(string.Empty); } }