public object[] QueryMultiMOMemo( string itemcodes, string mos, string startRCard, string endRCARD, string startMemo, string endMemo, int inclusive, int exclusive) { string sql = string.Format(@"select {0} from TBLONWIP where action = '{1}' and length(eattribute1)>0 ", DomainObjectUtility.GetDomainObjectFieldsString(typeof(QDOMultiMOMemo)), ActionType.DataCollectAction_GoMO); if (itemcodes != null && itemcodes.Length > 0) { sql += string.Format(" and itemcode in ({0}) ", FormatHelper.ProcessQueryValues(itemcodes)); } if (mos != null && mos.Length > 0) { sql += string.Format(" and MoCode in ({0}) ", FormatHelper.ProcessQueryValues(mos)); } sql += FormatHelper.GetRCardRangeSql("RCARD", startRCard, endRCARD); sql += FormatHelper.GetCodeRangeSql("EAttribute1", startMemo, endMemo); PagerCondition pageCondition = new PagerCondition(sql, "RCARD", inclusive, exclusive); #if DEBUG Log.Info( pageCondition.SQLText); #endif return(this.DataProvider.CustomQuery( typeof(QDOMultiMOMemo), pageCondition)); }
public ActionResult List(PagerCondition condition) { if (condition == null) { condition = new PagerCondition() { PageSize = 10, PageIndex = 1 }; } Swoopo.Model.JsonResult json = new Swoopo.Model.JsonResult(); try { List<ProductEntity> list = new ProductBLL().getPaged(condition); json.value = list; } catch (BllException e) { #if DEBUG json.error = e.InnerException.Message; #else json.error = e.Message; #endif } catch (DalException ex) { #if DEBUG json.error = ex.InnerException.Message; #else json.error = ex.Message; #endif } return Json(json); }
public object[] QueryItemConfigration( string itemcodes, string mos, string startRCard, string endRCARD, string itemConfig, string ConfigCategory, string ConfigCode, int startDate, int enddate, int inclusive, int exclusive) { string sql = string.Format(@"select {0} from TBLONWIPCFGCOLLECT where 1=1 ", DomainObjectUtility.GetDomainObjectFieldsString(typeof(QDOItemConfigration))); if (itemcodes != null && itemcodes.Length > 0) { sql += string.Format(" and itemcode in ({0}) ", FormatHelper.ProcessQueryValues(itemcodes)); } if (mos != null && mos.Length > 0) { sql += string.Format(" and MoCode in ({0}) ", FormatHelper.ProcessQueryValues(mos)); } sql += FormatHelper.GetRCardRangeSql("RCARD", startRCard, endRCARD); if (itemConfig != null && itemConfig.Length > 0) { sql += string.Format(" and ItemConfig like '{0}%' ", itemConfig); } if (ConfigCategory != null && ConfigCategory.Length > 0) { sql += string.Format(" and CatergoryCode like '{0}%' ", ConfigCategory); } if (ConfigCode != null && ConfigCode.Length > 0) { sql += string.Format(" and CheckItemCode like '{0}%' ", ConfigCode); } sql += FormatHelper.GetDateRangeSql("MDATE", startDate, enddate); PagerCondition pageCondition = new PagerCondition(sql, "RCARD", inclusive, exclusive); #if DEBUG Log.Info( pageCondition.SQLText); #endif return(this.DataProvider.CustomQuery( typeof(QDOItemConfigration), pageCondition)); }
public List<AndroidEntity> GetByPaged(AndroidEntity android, PagerCondition pagerCondition) { try { pagerCondition.SelectFields = "ID,UserName,State"; System.Data.Common.DbCommand cmd = db.GetStoredProcCommand("pagination"); db.AddInParameter(cmd, "tblName", DbType.String, tableName); db.AddInParameter(cmd, "strGetFields", DbType.String, pagerCondition.SelectFields); db.AddInParameter(cmd, "fldName", DbType.String, pagerCondition.SortField);//排序字段名 db.AddInParameter(cmd, "PageSize", DbType.Int32, pagerCondition.PageSize); db.AddInParameter(cmd, "PageIndex", DbType.Int32, pagerCondition.PageIndex); db.AddInParameter(cmd, "doCount", DbType.Byte, pagerCondition.doCount); db.AddInParameter(cmd, "OrderType", DbType.Byte, pagerCondition.SortType); db.AddInParameter(cmd, "strWhere", DbType.String, pagerCondition.StrWhere); List<AndroidEntity> list = new List<AndroidEntity>(); string[] fields = pagerCondition.SelectFields.Split(new char[1] { ',' }); using (IDataReader reader = db.ExecuteReader(cmd)) { while (reader.Read()) { list.Add(new AndroidEntity { ID = Convert.ToInt32(reader[0]), UserName = reader[1].ToString(), State = Convert.ToByte(reader[2]) }); } reader.Close(); reader.Dispose(); } return list; } catch (Exception ex) { throw new DalException("系统异常!", ex); } }
public List<UserPriceProductEntity> GetByPaged(ProductEntity product, PagerCondition pagerCondition) { try { System.Data.Common.DbCommand cmd = db.GetStoredProcCommand("pagination"); db.AddInParameter(cmd, "tblName", DbType.String, tableName); db.AddInParameter(cmd, "strGetFields", DbType.String, pagerCondition.SelectFields); db.AddInParameter(cmd, "fldName", DbType.String, pagerCondition.SortField);//排序字段名 db.AddInParameter(cmd, "PageSize", DbType.Int32, pagerCondition.PageSize); db.AddInParameter(cmd, "PageIndex", DbType.Int32, pagerCondition.PageIndex); db.AddInParameter(cmd, "doCount", DbType.Byte, pagerCondition.doCount); db.AddInParameter(cmd, "OrderType", DbType.Byte, pagerCondition.SortType); db.AddInParameter(cmd, "strWhere", DbType.String, pagerCondition.StrWhere); using (IDataReader reader = db.ExecuteReader(cmd)) { reader.Close(); reader.Dispose(); } return null; } catch (Exception ex) { throw new DalException("系统异常!", ex); } }
public object[] QueryECN( string itemCodes, string moCodes, string modelCodes, string startSn, string endSn, string ecn, int inclusive, int exclusive) { string itemCondition = ""; if (itemCodes != "" && itemCodes != null) { itemCondition = string.Format( @" and itemcode in ({0})", FormatHelper.ProcessQueryValues(itemCodes)); } string moCondition = ""; if (moCodes != "" && moCodes != null) { moCondition = string.Format( @" and mocode in ({0})", FormatHelper.ProcessQueryValues(moCodes)); } string modelCondition = ""; if (modelCodes != "" && modelCodes != null) { modelCondition = string.Format( @" and modelcode in ({0})", FormatHelper.ProcessQueryValues(modelCodes)); } string SnCondition = string.Empty; CastDownHelper castDownHelper = new CastDownHelper(this.DataProvider); if (string.Compare(startSn, endSn, true) == 0 && startSn != string.Empty) { ArrayList array = new ArrayList(); array.Add(startSn); castDownHelper.GetAllRCard(ref array, startSn); string[] rCards = (string[])array.ToArray(typeof(System.String)); SnCondition = string.Format(" and rcard in ({0}) ", FormatHelper.ProcessQueryValues(rCards)); } else if (string.Compare(startSn, endSn, true) != 0) { ArrayList array = new ArrayList(); castDownHelper.BuildProcessRcardCondition(ref array, startSn.ToUpper(), endSn.ToUpper()); string rcardCondition = string.Empty; if (array.Count > 0) { for (int i = 0; i < array.Count; i++) { if (i < array.Count - 1) { rcardCondition += array[i].ToString() + " union "; } else { rcardCondition += array[i].ToString(); } } } SnCondition = "and ( 1=1 " + FormatHelper.GetRCardRangeSql("rcard", startSn.ToUpper(), endSn.ToUpper()); if (rcardCondition != string.Empty) { SnCondition += string.Format(" or rcard in ({0}) ", rcardCondition); } SnCondition += " ) "; } string ecnCondition = ""; if (ecn != "" && ecn != null) { ecnCondition = string.Format( @" and ECNNO like '{0}%'", ecn.ToUpper()); } PagerCondition pagerCondition = new PagerCondition(string.Format( @"select distinct {0} from TBLONWIPECN where 1=1 {1}{2}{3}{4}{5}", DomainObjectUtility.GetDomainObjectFieldsString(typeof(OnWIPECN)), itemCondition, moCondition, modelCondition, SnCondition, ecnCondition), "mocode,itemcode,opcode", inclusive, exclusive, true); #if DEBUG Log.Info(pagerCondition.SQLText); #endif object[] objs = this.DataProvider.CustomQuery( typeof(QDOECNList), pagerCondition); if (objs != null) { foreach (QDOECNList obj in objs) { object[] sn = this.DataProvider.CustomQuery(typeof(Simulation), new SQLCondition( string.Format(@"select ProductStatus from TBLSIMULATION where RCARD = '{0}'", obj.RunningCard))); if (sn != null) { object[] sn2 = this.DataProvider.CustomQuery(typeof(Simulation), new SQLCondition( string.Format( @"select tblts.tsstatus as ProductStatus from TBLSIMULATION,tblts where TBLSIMULATION.RCARD = tblts.rcard and tblsimulation.rcardseq = tblts.rcardseq and tblsimulation.mocode = tblts.mocode and TBLSIMULATION.rcard = '{0}' " , obj.RunningCard))); if (sn2 != null) { obj.SNState = (sn2[0] as Simulation).ProductStatus; } else { obj.SNState = (sn[0] as Simulation).ProductStatus; } } else { obj.SNState = ProductStatus.OffLine; } object[] onWip = this.DataProvider.CustomQuery(typeof(OnWIP), new SQLCondition(String.Format( @"select opcode from tblonwip where rcard ='{0}' and (rcardseq,mocode) in (select rcardseq,mocode from (select rcardseq, mocode from tblonwip where rcard = '{0}' order by mdate * 1000000 + mtime desc) where rownum = 1)" , obj.RunningCard))); if (onWip != null) { obj.CollectionOPCODE = obj.OPCode; //采集工位 obj.OPCode = ((OnWIP)onWip[0]).OPCode; //当前工位 } } } return(objs); }