Example #1
0
        /// <summary>
        /// 获取辅料類物料列表
        /// </summary>
        /// <param name="strSONO">銷售單號</param>
        private List<MaterialProfile_mlpf_Info> GetAccessoryMaterials(string strSONO)
        {
            List<MaterialProfile_mlpf_Info> listAccessoryInfos = new List<MaterialProfile_mlpf_Info>();
            try
            {
                string strSql = GetAccessoryMaterialsSQL(strSONO);

                if (!string.IsNullOrEmpty(strSql))
                {
                    using (ICPDBDataContext db = new ICPDBDataContext())
                    {
                        var result = db.ExecuteQuery<MaterialProfile_mlpf_Info>(strSql, new object[] { });
                        if (result != null)
                        {
                            listAccessoryInfos.AddRange(result.ToList());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                mLog.Error("run ICPDBServiceDA.GetAccessoryMaterials", ex);
            }
            return listAccessoryInfos;
        }
Example #2
0
 /// <summary>
 /// 庫存物料搜索
 /// </summary>
 /// <param name="p_objFilter"></param>
 /// <returns></returns>
 public List<MaterialProfile_mlpf_Info> MaterialInventorySearch(ERPMaterialFilter p_objFilter)
 {
     using (ICPDBDataContext db = new ICPDBDataContext())
     {
         var infos = db.ExecuteQuery<MaterialProfile_mlpf_Info>(GetInventoryMaterialSQL(p_objFilter), new object[] { });
         if (infos != null)
         {
             return infos.ToList<MaterialProfile_mlpf_Info>();
         }
     }
     return null;
 }
Example #3
0
 /// <summary>
 /// 獲取物料類型
 /// </summary>
 public List<ValueNameInfo> GetICPDBSort()
 {
     List<ValueNameInfo> retValue = new List<ValueNameInfo>();
     StringBuilder l_strSQL = new StringBuilder();
     l_strSQL.AppendLine("Select Distinct cat_cLevel As ID,cat_cCat As CodeID,cat_cSub1 As Display,cat_cChn As Remark From icpcat");
     using (ICPDBDataContext db = new ICPDBDataContext())
     {
         var infos = db.ExecuteQuery<ValueNameInfo>(l_strSQL.ToString(), new object[] { });
         if (infos != null)
         {
             retValue = infos.ToList<ValueNameInfo>();
         }
     }
     return retValue;
 }
Example #4
0
        /// <summary>
        /// 獲取種類
        /// </summary>
        public List<ValueNameInfo> GetICPDBType()
        {
            List<ValueNameInfo> retValue = new List<ValueNameInfo>();
            StringBuilder l_strSQL = new StringBuilder();
            l_strSQL.AppendLine("Select Distinct  cod_cValue As CodeID,cod_cRmk As Display  From icpcod Where cod_ckey1 = 'itemtype'");
            using (ICPDBDataContext db = new ICPDBDataContext())
            {
                var infos = db.ExecuteQuery<ValueNameInfo>(l_strSQL.ToString(), new object[] { });

                if (infos != null)
                {
                    retValue = infos.ToList<ValueNameInfo>();
                }
            }
            return retValue;
        }
Example #5
0
 /// <summary>
 /// 獲取牌子
 /// </summary>
 public List<ValueNameInfo> GetICPDBBrand(string strMain, string strSub)
 {
     List<ValueNameInfo> retValue = new List<ValueNameInfo>();
     StringBuilder l_strSQL = new StringBuilder();
     l_strSQL.AppendLine("Select Distinct som_cESp As CodeID,som_cCSp As Display From icpsom Where 1=1 And som_cfld='BRAND'");
     if (strMain != string.Empty)
         l_strSQL.AppendLine(" And som_ccat='" + strMain + "'");
     if (strSub != string.Empty)
         l_strSQL.AppendLine(" And som_csub1='" + strSub + "'");
     using (ICPDBDataContext db = new ICPDBDataContext())
     {
         var infos = db.ExecuteQuery<ValueNameInfo>(l_strSQL.ToString(), new object[] { });
         if (infos != null)
         {
             retValue = infos.ToList<ValueNameInfo>();
         }
     }
     return retValue;
 }
Example #6
0
        /// <summary>
        /// 獲取牌子欄位
        /// </summary>
        /// <param name="strMain"></param>
        /// <param name="strSub"></param>
        /// <returns></returns>
        string GetBrandColumn(string strMain, string strSub)
        {
            string retValue = string.Empty;
            StringBuilder strSql = new StringBuilder();
            strSql.AppendLine(" select ");
            strSql.AppendLine("Case When cat_cesp1='BRAND' Then 'itm_cCSp1'");
            strSql.AppendLine("When cat_cesp2='BRAND'  Then 'itm_cCSp2'");
            strSql.AppendLine("When cat_cesp3='BRAND' Then 'itm_cCSp3'");
            strSql.AppendLine("When cat_cesp4='BRAND' Then 'itm_cCSp4'");
            strSql.AppendLine("When cat_cesp5='BRAND' Then 'itm_cCSp5'");
            strSql.AppendLine("When cat_cesp6='BRAND' Then 'itm_cCSp6'");
            strSql.AppendLine("When cat_cesp7='BRAND' Then 'itm_cCSp7'");
            strSql.AppendLine("When cat_cesp8='BRAND' Then 'itm_cCSp8'");
            strSql.AppendLine("When cat_cesp9='BRAND' Then 'itm_cCSp9'");
            strSql.AppendLine("Else 'itm_cCSp10' End As BrandColumn");
            strSql.AppendLine("from icpcat");
            strSql.AppendLine("where cat_cSub1='" + strSub + "' And cat_ccat='" + strMain + "'");

            using (ICPDBDataContext db = new ICPDBDataContext())
            {
                var infos = db.ExecuteQuery<string>(strSql.ToString(), new object[] { });

                if (infos != null)
                {
                    retValue = infos.ToList<string>()[0];
                }
            }
            return retValue;
        }
Example #7
0
 /// <summary>
 /// 跟Job物料搜索
 /// </summary>
 /// <param name="p_objFilter"></param>
 /// <returns></returns>
 public List<MaterialProfile_mlpf_Info> MaterialJobSearch(ERPMaterialFilter p_objFilter)
 {
     //IList<IDomainObject> retValue = new List<IDomainObject>();
     //Database db = DatabaseFactory.CreateDatabase("ICPDB");
     //DbCommand dbCommand = db.GetSqlStringCommand(GetJobMaterialSQL(p_objFilter));
     //MaterialProfile item;
     //using (IDataReader dataReader = db.ExecuteReader(dbCommand))
     //{
     //    while (dataReader.Read())
     //    {
     //        item = new MaterialProfile();
     //        GetERPItemData(dataReader, item);
     //        //GetGroupItemData(dataReader, item);
     //        retValue.Add(item);
     //    }
     //}
     //return retValue;
     using (ICPDBDataContext db = new ICPDBDataContext())
     {
         var infos = db.ExecuteQuery<MaterialProfile_mlpf_Info>(GetJobMaterialSQL(p_objFilter), new object[] { });
         if (infos != null)
         {
             return infos.ToList<MaterialProfile_mlpf_Info>();
         }
     }
     return null;
 }