public List <T_InStockTaskDetailsInfo> GetExportTaskDetail(T_InStockTaskInfo model) { try { List <T_InStockTaskDetailsInfo> modelList = new List <T_InStockTaskDetailsInfo>(); string strSql = "select * from v_Taskdetail " + GetExportFilterSql(model); using (IDataReader reader = dbFactory.ExecuteReader(strSql)) { modelList = base.ToModels(reader); } return(modelList); } catch (Exception ex) { throw ex; } }
public bool GetExportTaskDetail(T_InStockTaskInfo model, ref List <T_InStockTaskDetailsInfo> modelList, ref string strErrMsg) { try { T_InTaskDetails_DB tdb = new T_InTaskDetails_DB(); modelList = tdb.GetExportTaskDetail(model); if (modelList == null || modelList.Count == 0) { strErrMsg = "获取导出数据为空!"; return(false); } return(true); } catch (Exception ex) { strErrMsg = ex.Message; return(false); } }
private string GetExportFilterSql(T_InStockTaskInfo model) { string strSql = " where isnull(isDel,0) != 2 "; string strAnd = " and "; strSql += strAnd; strSql += "TaskType = 1 "; if (!string.IsNullOrEmpty(model.SupcusCode)) { strSql += strAnd; strSql += " (SupcusCode Like '" + model.SupcusCode + "%' or SupplierName Like '" + model.SupcusCode + "%' )"; } if (model.DateFrom != null) { strSql += strAnd; strSql += " CreateTime >= " + model.DateFrom.ToDateTime().Date.AddDays(-1).ToOracleTimeString() + " "; } if (model.DateTo != null) { strSql += strAnd; strSql += " CreateTime <= " + model.DateTo.ToDateTime().Date.AddDays(1).ToOracleTimeString() + " "; } if (!string.IsNullOrEmpty(model.ErpVoucherNo)) { strSql += strAnd; strSql += " erpvoucherno Like '" + model.ErpVoucherNo + "%' "; } if (model.VoucherType > 0) { strSql += strAnd; strSql += " vouchertype ='" + model.VoucherType + "' "; } if (!string.IsNullOrEmpty(model.TaskNo)) { strSql += strAnd; strSql += " TaskNo ='" + model.TaskNo + "' "; } if (!string.IsNullOrEmpty(model.ReceiveUserNo)) { strSql += strAnd; strSql += " Creater ='" + model.ReceiveUserNo + "' "; } //if (!string.IsNullOrEmpty(model.StrStatus)) //{ // string strStatus = string.Empty; // string[] strSplit = model.StrStatus.Split('&'); // int sLen = strSplit.Length; // foreach (var item in strSplit) // { // switch (item.Trim()) // { // case "新建": // strStatus += "1" + (sLen > 1 ? "," : ""); // break; // case "部分上架": // strStatus += "2" + (sLen > 1 ? "," : ""); // break; // case "全部上架": // strStatus += "3" + (sLen > 1 ? "," : ""); // break; // case "已关闭": // strStatus += "5" + (sLen > 1 ? "," : ""); // break; // default: // strStatus += "0" + (sLen > 1 ? "," : ""); // break; // } // } // strStatus = strStatus.TrimEnd(','); // strSql += strAnd; // strSql += "isnull(linestatus,1) in (" + strStatus + ")"; //} return(strSql); }