Exemplo n.º 1
0
        /// <summary>
        /// 根据生产订单编号取得BOM拆分后的物料需求
        /// </summary>
        /// <param name="li"></param>
        /// <returns></returns>
        public DataTable GetStockOne(ArrayList li)
        {
            Hownet.DAL.MaterielDemand  dalMD  = new Hownet.DAL.MaterielDemand();
            Hownet.DAL.ProduceTaskMain dalPTM = new Hownet.DAL.ProduceTaskMain();
            Hownet.DAL.MaterielList    dalML  = new Hownet.DAL.MaterielList();

            DataTable dt = new DataTable();

            dt.Columns.Add("DemandID", typeof(int));
            dt.Columns.Add("MaterielID", typeof(int));
            dt.Columns.Add("ColorID", typeof(int));
            dt.Columns.Add("ColorOneID", typeof(int));
            dt.Columns.Add("ColorTwoID", typeof(int));
            dt.Columns.Add("SizeID", typeof(int));
            dt.Columns.Add("stockAmount", typeof(decimal));
            dt.Columns.Add("stockNotAmount", typeof(decimal));
            dt.Columns.Add("MeasureID", typeof(int));
            dt.Columns.Add("ProduceTaskNum", typeof(string));
            dt.Columns.Add("ProduceName", typeof(int));

            DataTable dtMD = dt.Clone();
            DataTable dtPL = new DataTable();

            dtPL.TableName = "dtPL";
            dtPL.Columns.Add("DemandID", typeof(int));
            dtPL.Columns.Add("MaterielID", typeof(int));
            dtPL.Columns.Add("ColorID", typeof(int));
            dtPL.Columns.Add("ColorOneID", typeof(int));
            dtPL.Columns.Add("ColorTwoID", typeof(int));
            dtPL.Columns.Add("SizeID", typeof(int));
            dtPL.Columns.Add("ColorNum", typeof(string));
            dtPL.Columns.Add("GuiGe1", typeof(string));
            dtPL.Columns.Add("GuiGe2", typeof(string));
            //dtPL.Columns.Add("MListID", typeof(int));
            dtPL.Columns.Add("stockAmount", typeof(decimal));
            dtPL.Columns.Add("stockNotAmount", typeof(decimal));
            dtPL.Columns.Add("NowAmount", typeof(decimal));
            dtPL.Columns.Add("TemAmount", typeof(decimal));
            dtPL.Columns.Add("MeasureID", typeof(int));
            dtPL.Columns.Add("A", typeof(string));
            dtPL.Columns.Add("ProduceTaskNum", typeof(string));
            dtPL.Columns.Add("ProduceName", typeof(int));
            for (int i = 0; i < li.Count; i++)
            {
                int TaskID = int.Parse(li[i].ToString());
                //TaskID = dalPTM.GetID(TaskID);
                DataSet ds = dalMD.GetStock(TaskID);
                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    DataRow dr = dt.NewRow();
                    dr.ItemArray = ds.Tables[0].Rows[j].ItemArray;
                    dt.Rows.Add(dr);
                }
            }


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                // Hownet.Model.MaterielList modML = dalML.GetModel(int.Parse(dt.DefaultView[i]["MListID"].ToString()));
                DataRow dr = dtPL.NewRow();
                dr["DemandID"]       = dt.DefaultView[i]["DemandID"];
                dr["MaterielID"]     = dt.DefaultView[i]["MaterielID"];
                dr["ColorID"]        = dt.DefaultView[i]["ColorID"];
                dr["ColorOneID"]     = dt.DefaultView[i]["ColorOneID"];
                dr["ColorTwoID"]     = dt.DefaultView[i]["ColorTwoID"];
                dr["SizeID"]         = dt.DefaultView[i]["SizeID"];
                dr["stockAmount"]    = dt.DefaultView[i]["stockAmount"];
                dr["stockNotAmount"] = dt.DefaultView[i]["stockNotAmount"];
                dr["TemAmount"]      = dt.DefaultView[i]["stockNotAmount"];
                dr["MeasureID"]      = dt.DefaultView[i]["MeasureID"];
                dr["ProduceTaskNum"] = dt.DefaultView[i]["ProduceTaskNum"];
                dr["ProduceName"]    = dt.DefaultView[i]["ProduceName"];
                //  dr["DemandID"] = dt.DefaultView[i]["DemandID"];
                dtPL.Rows.Add(dr);
            }
            return(dtPL);
        }
Exemplo n.º 2
0
        public DataTable GetPeiLiaoOne(ArrayList li, int DepID)
        {
            Hownet.DAL.MaterielDemand  dalMD  = new Hownet.DAL.MaterielDemand();
            Hownet.DAL.ProduceTaskMain dalPTM = new Hownet.DAL.ProduceTaskMain();
            Hownet.DAL.MaterielList    dalML  = new Hownet.DAL.MaterielList();

            DataTable dt = new DataTable();

            dt.Columns.Add("DemandID", typeof(int));
            dt.Columns.Add("MaterielID", typeof(int));
            dt.Columns.Add("ColorID", typeof(int));
            dt.Columns.Add("ColorOneID", typeof(int));
            dt.Columns.Add("ColorTwoID", typeof(int));
            dt.Columns.Add("SizeID", typeof(int));
            dt.Columns.Add("Amount", typeof(decimal));
            dt.Columns.Add("NotAllotAmount", typeof(decimal));
            dt.Columns.Add("MeasureID", typeof(int));
            dt.Columns.Add("ProduceTaskNum", typeof(string));
            dt.Columns.Add("ProduceName", typeof(int));
            dt.Columns.Add("DepID", typeof(int));
            dt.Columns.Add("A", typeof(int));
            dt.Columns.Add("Price", typeof(string));
            DataTable dtPL = new DataTable();

            dtPL.TableName = "dtPL";
            dtPL.Columns.Add("DemandID", typeof(int));
            dtPL.Columns.Add("MaterielID", typeof(int));
            dtPL.Columns.Add("ColorID", typeof(int));
            dtPL.Columns.Add("ColorOneID", typeof(int));
            dtPL.Columns.Add("ColorTwoID", typeof(int));
            dtPL.Columns.Add("SizeID", typeof(int));
            //dtPL.Columns.Add("MListID", typeof(int));
            dtPL.Columns.Add("Amount", typeof(decimal));
            dtPL.Columns.Add("NotAllotAmount", typeof(decimal));
            dtPL.Columns.Add("TemNotAllotAmount", typeof(decimal));
            dtPL.Columns.Add("NowAmount", typeof(decimal));
            dtPL.Columns.Add("TemAmount", typeof(decimal));
            dtPL.Columns.Add("MeasureID", typeof(int));
            dtPL.Columns.Add("A", typeof(string));
            dtPL.Columns.Add("ProduceTaskNum", typeof(string));
            dtPL.Columns.Add("ProduceName", typeof(int));
            dtPL.Columns.Add("DepID", typeof(int));
            dtPL.Columns.Add("RowID", typeof(int));
            dtPL.Columns.Add("ID", typeof(int));
            dtPL.Columns.Add("Price", typeof(string));
            for (int i = 0; i < li.Count; i++)
            {
                int TaskID = int.Parse(li[i].ToString());
                //TaskID = dalPTM.GetID(TaskID);
                DataSet ds = dalMD.GetPeiLiao(TaskID, DepID);
                for (int j = 0; j < ds.Tables[0].Rows.Count; j++)
                {
                    DataRow dr = dt.NewRow();
                    dr.ItemArray = ds.Tables[0].Rows[j].ItemArray;
                    dt.Rows.Add(dr);
                }
            }


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                // Hownet.Model.MaterielList modML = dalML.GetModel(int.Parse(dt.DefaultView[i]["MListID"].ToString()));
                DataRow dr = dtPL.NewRow();
                dr["DemandID"]          = dt.DefaultView[i]["DemandID"];
                dr["MaterielID"]        = dt.DefaultView[i]["MaterielID"];
                dr["ColorID"]           = dt.DefaultView[i]["ColorID"];
                dr["ColorOneID"]        = dt.DefaultView[i]["ColorOneID"];
                dr["ColorTwoID"]        = dt.DefaultView[i]["ColorTwoID"];
                dr["SizeID"]            = dt.DefaultView[i]["SizeID"];
                dr["Amount"]            = dt.DefaultView[i]["Amount"];
                dr["NotAllotAmount"]    = dt.DefaultView[i]["NotAllotAmount"];
                dr["TemNotAllotAmount"] = dt.DefaultView[i]["NotAllotAmount"];
                dr["MeasureID"]         = dt.DefaultView[i]["MeasureID"];
                dr["ProduceTaskNum"]    = ID2Num(dt.DefaultView[i]["ProduceTaskNum"].ToString());
                dr["ProduceName"]       = dt.DefaultView[i]["ProduceName"];
                dr["DepID"]             = dt.DefaultView[i]["DepID"];
                dr["RowID"]             = i;
                dr["A"]         = dt.DefaultView[i]["A"];
                dr["TemAmount"] = dr["ID"] = 0;
                dr["Price"]     = dt.DefaultView[i]["Price"];
                dtPL.Rows.Add(dr);
            }
            dtPL.Columns.Add("MinXi", typeof(string));
            dtPL.Columns.Add("Remark", typeof(string));
            return(dtPL);
        }