private string GetExportFilterSql(T_OutStockTaskInfo model) { string strSql = " where isnull(isDel,0) != 2 "; string strAnd = " and "; strSql += strAnd; strSql += "TaskType = 2 "; if (model.ID > 0) { strSql += strAnd; strSql += " id = '" + model.ID + "'"; } 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.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.Trim() + "%' "; } if (model.VoucherType > 0) { strSql += strAnd; strSql += " vouchertype ='" + model.VoucherType + "' "; } if (!string.IsNullOrEmpty(model.TaskNo)) { strSql += strAnd; strSql += " TaskNo ='" + model.TaskNo + "' "; } return(strSql); }
public bool GetOutStockAndDetailsModelByNo(string erpNo, ref BILWeb.OutStockTask.T_OutStockTaskInfo head, ref List <BILWeb.OutStockTask.T_OutStockTaskDetailsInfo> lstDetail, ref string ErrMsg) { try { string strSql = ""; head = new BILWeb.OutStockTask.T_OutStockTaskInfo(); strSql = "select m.erpbarcode,t.materialno,t.materialdesc,t.edate,t.batchno,t.erpvoucherno,sum(t.qty) as sumQty,count(t.serialno) as countQty from t_tasktrans t " + " inner join t_material m on m.id = t.materialnoid " + " where t.tasktype=12 and t.vouchertype=24 and t.erpvoucherno in (" + erpNo + ") " + " group by t.erpvoucherno,m.erpbarcode,t.materialno,t.materialdesc,t.edate,t.batchno " + " order by t.erpvoucherno,t.materialno,t.batchno "; lstDetail = new List <BILWeb.OutStockTask.T_OutStockTaskDetailsInfo>(); using (IDataReader dr = dbFactory.ExecuteReader(strSql)) { while (dr.Read()) { lstDetail.Add(new BILWeb.OutStockTask.T_OutStockTaskDetailsInfo() { MaterialNo = dr["materialno"].ToDBString(), MaterialDesc = dr["materialdesc"].ToDBString(), TaskQty = dr["sumQty"].ToDecimal(), //合计数量 QualityQty = dr["countQty"].ToDecimal(), //合计件数 ErpDocNo = dr["erpvoucherno"].ToDBString(), //销货单号 BatchNo = dr["batchno"].ToDBString(), //批号 Remark = dr["erpbarcode"].ToDBString(), //条码 CompleteDateTime = dr["edate"].ToDateTime() //产品限用日期 }); } } if (lstDetail.Count <= 0) { ErrMsg = "没有拣货单明细数据!"; return(false); } return(true); } catch (Exception ex) { ErrMsg = ex.Message; return(false); } }
public List <T_OutStockTaskDetailsInfo> GetExportTaskDetail(T_OutStockTaskInfo model) { try { List <T_OutStockTaskDetailsInfo> modelList = new List <T_OutStockTaskDetailsInfo>(); string strSql = "select * from V_OUTTASKDETAIL " + GetExportFilterSql(model); using (IDataReader reader = dbFactory.ExecuteReader(strSql)) { modelList = base.ToModels(reader); } return(modelList); } catch (Exception ex) { throw ex; } }
public bool GetExportTaskDetail(T_OutStockTaskInfo model, ref List <T_OutStockTaskDetailsInfo> modelList, ref string strErrMsg) { try { T_OutTaskDetails_DB tdb = new T_OutTaskDetails_DB(); modelList = tdb.GetExportTaskDetail(model); if (modelList == null || modelList.Count == 0) { strErrMsg = "获取导出数据为空!"; return(false); } return(true); } catch (Exception ex) { strErrMsg = ex.Message; return(false); } }