Beispiel #1
0
        public static List<FisBomItem> GetFisBomItem(string connectionDB, int dbIndex, string TxnId)
        {
            List<FisBomItem> retList = new List<FisBomItem>();

            string strSQL = @"select TxnId, ItemNo, AltGroup, Component, Qty, Unit, 
                                     SAPErrorDescr, Editor, Cdt, Udt
                              from BOM_Compare_Item
                              where TxnId=@TxnId 
                              order by ItemNo";

            DataTable dt = SQLHelper.ExecuteDataFill(SQLHelper.GetDBConnectionString(connectionDB, dbIndex),
                                                     System.Data.CommandType.Text,
                                                     strSQL,
                                                    SQLHelper.CreateSqlParameter("@TxnId", TxnId));
            int i = 1;
            foreach (DataRow dr in dt.Rows)
            {
                FisBomItem item = new FisBomItem();
                //item.ID = (int)dr["ID"];
                item.TxnId  = TxnId;
                item.ItemNo = dr["ItemNo"].ToString().Trim(); 
                item.AltGroup = (dr["AltGroup"] == null ? "" : dr["AltGroup"].ToString().Trim());
                item.Component = dr["Component"].ToString().Trim();
                item.Qty = dr["Qty"].ToString().Trim();
                item.Unit = dr["Unit"].ToString().Trim();
                item.SAPErrorDescr = dr["SAPErrorDescr"].ToString().Trim();
                item.Editor = dr["Editor"].ToString().Trim();
                item.Cdt = (DateTime)dr["Cdt"];
                item.Udt = (DateTime)dr["Udt"];

                retList.Add(item);

                i++;
            }
            return retList;
        }
Beispiel #2
0
/*
        public static List<FisBomList> GetFisBomData(string connectionDB, int dbIndex, string spName, string Model)
        {
            List<FisBomList> retList = new List<FisBomList>();

            string strSQL = @"exec @spName @Model";

            DataTable dt = SQLHelper.ExecuteDataFill(SQLHelper.GetDBConnectionString(connectionDB, dbIndex),
                                                     System.Data.CommandType.Text,
                                                     strSQL,
                                                    SQLHelper.CreateSqlParameter("@spName", spName),
                                                    SQLHelper.CreateSqlParameter("@Model", 16, Model));
            int i = 1;
            foreach (DataRow dr in dt.Rows)
            {
                FisBomList item = new FisBomList();
                item.ItemNo = i;
                item.AltGroup = (dr["AltGroup"] == null ? "":dr["AltGroup"].ToString().Trim());
                item.Component = dr["Component"].ToString().Trim();
                item.Qty = (int)dr["Qty"];
                item.Unit = dr["Unit"].ToString().Trim();

                retList.Add(item);

                i++;
            }
            return retList;
        }
*/
        public static List<FisBomItem> GetFisBomData(string connectionDB, int dbIndex, string spName, string Model, string TxnId)
        {
            List<FisBomItem> retList = new List<FisBomItem>();

            string strSQL = @"exec @spName @Model";

            DataTable dt = SQLHelper.ExecuteDataFill(SQLHelper.GetDBConnectionString(connectionDB, dbIndex),
                                                     System.Data.CommandType.Text,
                                                     strSQL,
                                                    SQLHelper.CreateSqlParameter("@spName", spName),
                                                    SQLHelper.CreateSqlParameter("@Model", 16, Model));
            int i = 1;
            int iQty = 0;
            foreach (DataRow dr in dt.Rows)
            {
                FisBomItem item = new FisBomItem();
                item.TxnId = TxnId;
                item.ItemNo = i.ToString().PadLeft(4, '0');
                item.AltGroup = (dr["AltGroup"] == null ? "" : dr["AltGroup"].ToString().Trim());
                item.Component = dr["Component"].ToString().Trim();
                iQty = (int)dr["Qty"];
                item.Qty = iQty.ToString() + ".000";
                item.Unit = dr["Unit"].ToString().Trim();
                item.SAPErrorDescr = "";
                item.Editor = "FIS";
                item.Cdt = DateTime.Now;
                item.Udt = DateTime.Now;

                retList.Add(item);

                i++;
            }
            return retList;
        }