Exemplo n.º 1
0
        public IList<string> WhereUsedComponent(string component)
        {
            try
            {
                IList<string> ret = new List<string>();

                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                mtns::SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        mtns::ModelBOM_NEW cond = new mtns::ModelBOM_NEW();
                        cond.component = component;
                        cond.flag = 1;
                        sqlCtx = mtns::FuncNew.GetConditionedSelect<mtns::ModelBOM_NEW>(tk, null, new string[] { mtns::ModelBOM_NEW.fn_material },
                                   new mtns::ConditionCollection<mtns::ModelBOM_NEW>(new mtns::EqualCondition<mtns::ModelBOM_NEW>(cond)),
                                   mtns::ModelBOM_NEW.fn_cdt);

                    }
                }
                sqlCtx.Param(ModelBOM_NEW.fn_component).Value = component;
                sqlCtx.Param(ModelBOM_NEW.fn_flag).Value = 1;


                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_BOM, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params))
                {
                    if (sqlR != null)
                    {
                        while (sqlR.Read())
                        {
                            ret.Add(g.GetValue_Str(sqlR, 0));
                        }
                    }
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public IList<MoBOMInfo> GetModelBomListByComponents(string[] pnList)
        {
            try
            {
                IList<MoBOMInfo> ret = null;

                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                mtns::SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        mtns::ModelBOM_NEW cond = new mtns::ModelBOM_NEW();
                        cond.component = "[INSET]";
                        mtns::ModelBOM_NEW cond1 = new mtns::ModelBOM_NEW();
                        cond1.flag = 1;
                        sqlCtx = mtns::FuncNew.GetConditionedSelect<mtns::ModelBOM_NEW>(tk, null, null, new mtns::ConditionCollection<mtns::ModelBOM_NEW>(new mtns::InSetCondition<mtns::ModelBOM_NEW>(cond), new EqualCondition<mtns::ModelBOM_NEW>(cond1)), mtns::ModelBOM_NEW.fn_material, mtns::ModelBOM_NEW.fn_component);
                        sqlCtx.Param(ModelBOM_NEW.fn_flag).Value = cond1.flag;
                    }
                }
                string Sentence = sqlCtx.Sentence.Replace(g.DecInSet(mtns::ModelBOM_NEW.fn_component), g.ConvertInSet(new List<string>(pnList)));

                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_BOM, CommandType.Text, Sentence, sqlCtx.Params))
                {
                    ret = mtns::FuncNew.SetFieldFromColumn<mtns::ModelBOM_NEW, MoBOMInfo, MoBOMInfo>(ret, sqlR, sqlCtx);
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }