示例#1
0
        public void SaveDepInfo(DataTable dt, int TaskID, int DepTaskID, int BrandID, int MaterielID)
        {
            Hownet.BLL.MaterielAttribute blMa   = new Hownet.BLL.MaterielAttribute();
            Hownet.BLL.ProduceTaskInfo   bllPTI = new ProduceTaskInfo();
            //Hownet.Model.ProduceTaskMain modPTM = new Hownet.Model.ProduceTaskMain();
            Hownet.Model.ProduceTaskInfo    modPTI = new Hownet.Model.ProduceTaskInfo();
            Hownet.BLL.DepartmentTaskInfo   bllDTI = new DepartmentTaskInfo();
            Hownet.Model.DepartmentTaskInfo modDTI = new Hownet.Model.DepartmentTaskInfo();
            Hownet.BLL.MaterielList         bllML  = new MaterielList();
            Hownet.Model.MaterielList       modML  = new Hownet.Model.MaterielList();
            ArrayList ColorList    = new ArrayList();
            ArrayList SizeList     = new ArrayList();
            ArrayList ColorOneList = new ArrayList();
            ArrayList ColorTwoList = new ArrayList();

            ColorList.Clear();
            ColorOneList.Clear();
            ColorTwoList.Clear();
            SizeList.Clear();
            ColorList.Add(0);
            SizeList.Add(0);
            ColorOneList.Add(0);
            ColorTwoList.Add(0);
            for (int r = 1; r < dt.Rows.Count - 1; r++)
            {
                int colorID = 0;
                if (dt.DefaultView[r]["Color"].ToString() != string.Empty)
                {
                    colorID = blMa.GetID(dt.DefaultView[r]["Color"].ToString(), 1);
                }
                ColorList.Add(colorID);
                colorID = 0;
                if (dt.DefaultView[r]["ColorOne"].ToString() != string.Empty)
                {
                    colorID = blMa.GetID(dt.DefaultView[r]["ColorOne"].ToString(), 1);
                }
                ColorOneList.Add(colorID);
                colorID = 0;
                if (dt.DefaultView[r]["ColorTwo"].ToString() != string.Empty)
                {
                    colorID = blMa.GetID(dt.DefaultView[r]["ColorTwo"].ToString(), 1);
                }
                ColorTwoList.Add(colorID);
            }
            for (int c = 1; c < dt.Columns.Count - 3; c++)
            {
                int sizeID = 0;
                if (dt.DefaultView[0][c].ToString() != string.Empty)
                {
                    sizeID = blMa.GetID(dt.DefaultView[0][c].ToString(), 2);
                }
                SizeList.Add(sizeID);
            }
            for (int r = 0; r < ColorList.Count; r++)
            {
                if (ColorList[r].ToString() != "0")
                {
                    for (int c = 0; c < SizeList.Count; c++)
                    {
                        if (SizeList[c].ToString() != "0")
                        {
                            if (dt.DefaultView[r][c].ToString() != string.Empty && dt.DefaultView[r][c].ToString() != "0")
                            {
                                modML.ColorID    = modPTI.ColorID = modDTI.ColorID = int.Parse(ColorList[r].ToString());
                                modML.SizeID     = modPTI.SizeID = modDTI.SizeID = int.Parse(SizeList[c].ToString());
                                modML.ColorOneID = modPTI.ColorOneID = modDTI.ColorOneID = int.Parse(ColorOneList[r].ToString());
                                modML.ColorTwoID = modPTI.ColorTwoID = modDTI.ColorTwoID = int.Parse(ColorTwoList[r].ToString());
                                modML.MaterielID = MaterielID;
                                modML.BrandID    = BrandID;
                                modPTI.Amount    = modDTI.Amount = int.Parse(dt.DefaultView[r][c].ToString());
                                modDTI.MainID    = DepTaskID;
                                modPTI.MainID    = TaskID;
                                modDTI.NotAmount = modDTI.Amount;
                                modDTI.MListID   = bllML.GetID(modML);
                                bllDTI.Add(modDTI);
                                bllPTI.UpNotDepAmount(modPTI);
                            }
                        }
                    }
                }
            }
        }
示例#2
0
        /// <summary>
        /// 显示分配到班组的数量
        /// </summary>
        /// <param name="TaskID"></param>
        /// <returns></returns>
        public DataTable ShowDepAmount(int TaskID, int DepTaskID)
        {
            Hownet.BLL.DepartmentTaskInfo bllDTI = new DepartmentTaskInfo();
            Hownet.BLL.ProduceTaskInfo    pti    = new ProduceTaskInfo();
            Hownet.Model.ProduceTaskInfo  modPti = new Hownet.Model.ProduceTaskInfo();
            DataTable dtInfo = bllDTI.GetList("(MainID=" + DepTaskID + ")").Tables[0];
            DataTable dt     = new DataTable();

            dt.Columns.Add("Color", typeof(string));
            dt.Rows.Add(dt.NewRow());
            dt.Rows[0]["Color"] = "颜色\\尺码";
            SqlDataReader myReader = pti.GetSize(TaskID);

            int       i            = 1;
            ArrayList ColorList    = new ArrayList();
            ArrayList SizeList     = new ArrayList();
            ArrayList ColorOneList = new ArrayList();
            ArrayList ColorTwoList = new ArrayList();

            ColorList.Clear();
            ColorOneList.Clear();
            ColorTwoList.Clear();
            SizeList.Clear();
            ColorList.Add(0);
            SizeList.Add(0);
            ColorOneList.Add(0);
            ColorTwoList.Add(0);
            while (myReader.Read())
            {
                dt.Columns.Add("Columns" + i);
                dt.Rows[0][i] = myReader[0].ToString();
                SizeList.Add(int.Parse(myReader[1].ToString()));
                i++;
            }
            myReader.Close();
            //for (int c = dt.Columns.Count; c < 12; c++)
            //{
            //    dt.Columns.Add("Columns" + c);
            //}
            dt.Columns.Add("Columns" + dt.Columns.Count);
            dt.Columns.Add("SumNum");
            dt.Rows[0]["SumNum"] = "合计";
            dt.Columns.Add("ColorOne", typeof(string));
            dt.Columns.Add("ColorTwo", typeof(string));
            dt.Rows[0]["ColorOne"] = "插色一";
            dt.Rows[0]["ColorTwo"] = "插色二";
            SqlDataReader ColorReader = pti.GetColor(TaskID);

            i = 1;
            while (ColorReader.Read())
            {
                dt.Rows.Add(dt.NewRow());
                dt.Rows[i][0] = ColorReader[0].ToString();
                dt.Rows[i][dt.Columns.Count - 2] = ColorReader[3].ToString();
                dt.Rows[i][dt.Columns.Count - 1] = ColorReader[5].ToString();
                ColorList.Add(int.Parse(ColorReader[1].ToString()));
                ColorOneList.Add(int.Parse(ColorReader[4].ToString()));
                ColorTwoList.Add(int.Parse(ColorReader[6].ToString()));
                i++;
            }
            ColorReader.Close();
            for (int r = 1; r < SizeList.Count; r++)
            {
                for (int c = 1; c < ColorList.Count; c++)
                {
                    modPti.ColorID = int.Parse(ColorList[c].ToString());

                    modPti.SizeID     = int.Parse(SizeList[r].ToString());
                    modPti.ColorOneID = int.Parse(ColorOneList[c].ToString());
                    modPti.ColorTwoID = int.Parse(ColorTwoList[c].ToString());
                    modPti.MainID     = TaskID;
                    string    sql = "(SizeID=" + modPti.SizeID + ") and (ColorID=" + modPti.ColorID + ") and (ColorOneID=" + modPti.ColorOneID + ") and (ColorTwoID=" + modPti.ColorTwoID + ")";
                    DataRow[] drs = dtInfo.Select(sql);
                    if (drs.Length > 0)
                    {
                        dt.Rows[c][r] = drs[0]["NotAmount"];
                    }
                }
            }
            dt.Rows.Add(dt.NewRow());
            return(dt);
        }