Пример #1
0
        /// <summary>
        /// 克隆
        /// </summary>
        /// <returns>返回BOM的LINQ数据集</returns>
        public Bom Clone()
        {
            Bom bom = new Bom(Id, ParentCode, PartCode, PartName, Spec, Counts,
                              AssemblyFlag, Remark, UserCode, FillData, Version);

            return(bom);
        }
Пример #2
0
        /// <summary>
        /// 克隆Bom表
        /// </summary>
        /// <param name="edition">版本号</param>
        /// <param name="listBom">Bom列表</param>
        /// <returns>返回克隆的Bom表</returns>
        public Dictionary <string, List <Bom> > Clone(string edition, List <Bom> listBom)
        {
            Bom[] arrayBom = new Bom[listBom.Count];

            listBom.CopyTo(arrayBom);

            List <Bom> bomList = new List <Bom>();

            bomList.AddRange(arrayBom);

            Dictionary <string, List <Bom> > dicBom = new Dictionary <string, List <Bom> >();

            dicBom.Add(edition, bomList);

            return(new Dictionary <string, List <Bom> >(dicBom));
        }
Пример #3
0
        /// <summary>
        /// 获取某一版本的Bom
        /// </summary>
        /// <param name="edition">总成型号</param>
        /// <param name="sysVersion">版本号</param>
        /// <param name="dic">Bom字典</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功获取某一版本的Bom</returns>
        public bool GetBom(string edition, string sysVersion, out Dictionary <string, List <Bom> > dic, out string error)
        {
            dic   = null;
            error = null;

            Hashtable paramTable = new Hashtable();
            DataSet   ds         = new DataSet();

            paramTable.Add("@Edition", edition);
            paramTable.Add("@SysVersion", sysVersion);

            Dictionary <OperateCMD, object> dicOperateCMD = m_dbOperate.RunProc_CMD("SelAllP_ProductBom", ds, paramTable);

            if (!Convert.ToBoolean(dicOperateCMD[OperateCMD.Return_OperateResult]))
            {
                error = Convert.ToString(dicOperateCMD[OperateCMD.Return_Errmsg]);
                return(false);
            }

            m_dicBom.Clear();

            DataTable bomTable = ds.Tables[0];

            if (bomTable.Rows.Count > 0)
            {
                List <Bom> listBom = new List <Bom>();
                Bom[]      bom     = new Bom[bomTable.Rows.Count];

                for (int i = 0; i < bomTable.Rows.Count; i++)
                {
                    string spec = "";

                    if (bomTable.Rows[i][4] != null)
                    {
                        spec = bomTable.Rows[i][4].ToString();
                    }

                    bom[i] = new Bom(Convert.ToInt32(bomTable.Rows[i][0]), bomTable.Rows[i][1].ToString(),
                                     bomTable.Rows[i][2].ToString(), bomTable.Rows[i][3].ToString(),
                                     spec, Convert.ToInt32(bomTable.Rows[i][5]), Convert.ToBoolean(bomTable.Rows[i][7]),
                                     bomTable.Rows[i][8].ToString(), bomTable.Rows[i][9].ToString(),
                                     (DateTime)bomTable.Rows[i][10], bomTable.Rows[i][6].ToString());
                    listBom.Add(bom[i]);
                }

                if (m_dicBom.ContainsKey(edition))
                {
                    m_dicBom.Remove(edition);
                }

                m_dicBom.Add(edition, listBom);

                dic = new Dictionary <string, List <Bom> >(m_dicBom);

                return(true);
            }
            else
            {
                error = "数据库中该版本的Bom为空";
                return(false);
            }
        }