Exemplo n.º 1
0
        public DataSet GetTicketLine(int TaskID, int PWIID, int TaskDepID, int DPWID)
        {
            DataSet ds = new DataSet();

            Hownet.BLL.ProductWorkingInfo   bllPWI = new ProductWorkingInfo();
            Hownet.Model.ProductWorkingInfo modPWI = new Hownet.Model.ProductWorkingInfo();
            if (TaskDepID == 0)
            {
                modPWI = bllPWI.GetModel(PWIID);
            }
            else
            {
                modPWI = bllPWI.GetModel(DPWID);
            }
            if (!modPWI.IsSpecial)//不是特殊工序
            {
                return(dal.GetTicketLine(TaskID, PWIID, TaskDepID, DPWID));
            }
            else
            {
                return(dal.GetSpecialTicketLine(TaskID, PWIID, TaskDepID, DPWID));
            }
            if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
            {
                ds.Tables.Clear();
                ds = dal.GetSpecialTicketLine(TaskID, PWIID, TaskDepID, DPWID);
            }
            return(ds);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.ProductWorkingInfo model)
 {
     dal.Update(model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.ProductWorkingInfo model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 4
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.ProductWorkingInfo> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.ProductWorkingInfo> modelList = new List <Hownet.Model.ProductWorkingInfo>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.ProductWorkingInfo model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.ProductWorkingInfo();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    if (dt.Rows[n]["WorkingID"].ToString() != "")
                    {
                        model.WorkingID = int.Parse(dt.Rows[n]["WorkingID"].ToString());
                    }
                    else
                    {
                        model.WorkingID = 0;
                    }
                    if (dt.Rows[n]["GroupBy"].ToString() != "")
                    {
                        model.GroupBy = int.Parse(dt.Rows[n]["GroupBy"].ToString());
                    }
                    else
                    {
                        model.GroupBy = 0;
                    }
                    if (dt.Rows[n]["Machine"].ToString() != "")
                    {
                        model.Machine = int.Parse(dt.Rows[n]["Machine"].ToString());
                    }
                    else
                    {
                        model.Machine = 0;
                    }
                    if (dt.Rows[n]["MachinePart"].ToString() != "")
                    {
                        model.MachinePart = int.Parse(dt.Rows[n]["MachinePart"].ToString());
                    }
                    else
                    {
                        model.MachinePart = 0;
                    }
                    if (dt.Rows[n]["LineOne"].ToString() != "")
                    {
                        model.LineOne = int.Parse(dt.Rows[n]["LineOne"].ToString());
                    }
                    else
                    {
                        model.LineOne = 0;
                    }
                    if (dt.Rows[n]["LineTwo"].ToString() != "")
                    {
                        model.LineTwo = int.Parse(dt.Rows[n]["LineTwo"].ToString());
                    }
                    else
                    {
                        model.LineTwo = 0;
                    }
                    if (dt.Rows[n]["Pin"].ToString() != "")
                    {
                        model.Pin = int.Parse(dt.Rows[n]["Pin"].ToString());
                    }
                    else
                    {
                        model.Pin = 0;
                    }
                    if (dt.Rows[n]["Stitch"].ToString() != "")
                    {
                        model.Stitch = int.Parse(dt.Rows[n]["Stitch"].ToString());
                    }
                    else
                    {
                        model.Stitch = 0;
                    }
                    if (dt.Rows[n]["Width"].ToString() != "")
                    {
                        model.Width = int.Parse(dt.Rows[n]["Width"].ToString());
                    }
                    else
                    {
                        model.Width = 0;
                    }
                    if (dt.Rows[n]["StitchWidth"].ToString() != "")
                    {
                        model.StitchWidth = int.Parse(dt.Rows[n]["StitchWidth"].ToString());
                    }
                    else
                    {
                        model.StitchWidth = 0;
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["MakingsOne"].ToString() != "")
                    {
                        model.MakingsOne = int.Parse(dt.Rows[n]["MakingsOne"].ToString());
                    }
                    else
                    {
                        model.MakingsOne = 0;
                    }
                    if (dt.Rows[n]["MakingsTwo"].ToString() != "")
                    {
                        model.MakingsTwo = int.Parse(dt.Rows[n]["MakingsTwo"].ToString());
                    }
                    else
                    {
                        model.MakingsTwo = 0;
                    }
                    if (dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    else
                    {
                        model.MainID = 0;
                    }
                    if (dt.Rows[n]["IsTicket"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsTicket"].ToString() == "1") || (dt.Rows[n]["IsTicket"].ToString().ToLower() == "true"))
                        {
                            model.IsTicket = true;
                        }
                        else
                        {
                            model.IsTicket = false;
                        }
                    }
                    if (dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = decimal.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    else
                    {
                        model.Price = 0;
                    }
                    if (dt.Rows[n]["UseTime"].ToString() != "")
                    {
                        model.UseTime = decimal.Parse(dt.Rows[n]["UseTime"].ToString());
                    }
                    else
                    {
                        model.UseTime = 0;
                    }
                    if (dt.Rows[n]["FastTime"].ToString() != "")
                    {
                        model.FastTime = decimal.Parse(dt.Rows[n]["FastTime"].ToString());
                    }
                    else
                    {
                        model.FastTime = 0;
                    }
                    if (dt.Rows[n]["Orders"].ToString() != "")
                    {
                        model.Orders = int.Parse(dt.Rows[n]["Orders"].ToString());
                    }
                    else
                    {
                        model.Orders = 0;
                    }
                    if (dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    else
                    {
                        model.MaterielID = 0;
                    }
                    if (dt.Rows[n]["ColorID"].ToString() != "")
                    {
                        model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString());
                    }
                    else
                    {
                        model.ColorID = 0;
                    }
                    if (dt.Rows[n]["SpecialWork"].ToString() != "")
                    {
                        model.SpecialWork = int.Parse(dt.Rows[n]["SpecialWork"].ToString());
                    }
                    else
                    {
                        model.SpecialWork = 0;
                    }
                    if (dt.Rows[n]["PWMID"].ToString() != "")
                    {
                        model.PWMID = int.Parse(dt.Rows[n]["PWMID"].ToString());
                    }
                    else
                    {
                        model.PWMID = 0;
                    }
                    if (dt.Rows[n]["PWIID"].ToString() != "")
                    {
                        model.PWIID = int.Parse(dt.Rows[n]["PWIID"].ToString());
                    }
                    else
                    {
                        model.PWIID = 0;
                    }
                    model.CustOder = dt.Rows[n]["CustOder"].ToString();
                    if (dt.Rows[n]["IsCaiC"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsCaiC"].ToString() == "1") || (dt.Rows[n]["IsCaiC"].ToString().ToLower() == "true"))
                        {
                            model.IsCaiC = true;
                        }
                        else
                        {
                            model.IsCaiC = false;
                        }
                    }
                    if (dt.Rows[n]["IsCut"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsCut"].ToString() == "1") || (dt.Rows[n]["IsCut"].ToString().ToLower() == "true"))
                        {
                            model.IsCut = true;
                        }
                        else
                        {
                            model.IsCut = false;
                        }
                    }
                    if (dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    else
                    {
                        model.CompanyID = 0;
                    }
                    if (dt.Rows[n]["IsSpecial"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsSpecial"].ToString() == "1") || (dt.Rows[n]["IsSpecial"].ToString().ToLower() == "true"))
                        {
                            model.IsSpecial = true;
                        }
                        else
                        {
                            model.IsSpecial = false;
                        }
                    }
                    if (dt.Rows[n]["OneAmount"].ToString() != "")
                    {
                        model.OneAmount = int.Parse(dt.Rows[n]["OneAmount"].ToString());
                    }
                    else
                    {
                        model.OneAmount = 0;
                    }
                    if (dt.Rows[n]["IsCanMove"] != null && dt.Rows[n]["IsCanMove"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsCanMove"].ToString() == "1") || (dt.Rows[n]["IsCanMove"].ToString().ToLower() == "true"))
                        {
                            model.IsCanMove = true;
                        }
                        else
                        {
                            model.IsCanMove = false;
                        }
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 5
0
        public bool CheckWorking(int TaskID, int PWIID, int CompanyID)
        {
            Hownet.BLL.ProductWorkingInfo   bllPWI = new ProductWorkingInfo();
            Hownet.BLL.Working              bllW   = new Working();
            Hownet.BLL.WorkTicket           bllWT  = new WorkTicket();
            Hownet.Model.ProductWorkingInfo modPWI = new Hownet.Model.ProductWorkingInfo();
            modPWI = bllPWI.GetModel(PWIID);
            if (!modPWI.IsSpecial)                                      //不是特殊工序
            {
                if (!dal.CheckWorking(TaskID, PWIID, modPWI.OneAmount)) //已生成工票中没有这道工序
                {
                    Hownet.Model.WorkTicketInfo modWTI;
                    DataTable dtWT = new DataTable();
                    dtWT = bllWT.GetList("(TaskID=" + TaskID + ") And (OneAmount=" + modPWI.OneAmount + ")").Tables[0];
                    for (int i = 0; i < dtWT.Rows.Count; i++)
                    {
                        modWTI            = new Hownet.Model.WorkTicketInfo();
                        modWTI.NotAmount  = modWTI.Amount = int.Parse(dtWT.Rows[i]["Amount"].ToString());
                        modWTI.BackID     = 0;
                        modWTI.DateTime   = null;
                        modWTI.EmployeeID = 0;
                        modWTI.IsDel      = false;
                        modWTI.MainID     = int.Parse(dtWT.Rows[i]["ID"].ToString());

                        if (TaskID > 0)
                        {
                            modWTI.TaskID         = TaskID;
                            modWTI.PWorkingInfoID = PWIID;
                        }
                        modWTI.WorkingID = modPWI.WorkingID;
                        Add(modWTI);
                    }
                }
                return(true);
            }
            else
            {
                DataTable dtTem = bllPWI.GetList("(PWIID=" + modPWI.ID + ")").Tables[0];
                List <Hownet.Model.ProductWorkingInfo> li = bllPWI.DataTableToList(dtTem);//是特殊工序时,查找其构成的普通工序
                if (li.Count == 0)
                {
                    return(false);
                }
                for (int i = 0; i < li.Count; i++)
                {
                    if (dal.CheckWorking(TaskID, li[i].ID, li[i].OneAmount))
                    {
                        return(true);
                    }
                }
                Hownet.Model.WorkTicketInfo modWTI;
                DataTable dtWT = new DataTable();
                dtWT = bllWT.GetList("(TaskID=" + TaskID + ") And (OneAmount=" + li[0].OneAmount + ")").Tables[0];
                DataRow[] drs;
                bool      t = false;
                for (int i = 0; i < dtWT.Rows.Count; i++)
                {
                    t                 = false;
                    modWTI            = new Hownet.Model.WorkTicketInfo();
                    modWTI.NotAmount  = modWTI.Amount = int.Parse(dtWT.Rows[i]["Amount"].ToString());
                    modWTI.BackID     = 0;
                    modWTI.DateTime   = null;
                    modWTI.EmployeeID = 0;
                    modWTI.IsDel      = false;
                    modWTI.MainID     = int.Parse(dtWT.Rows[i]["ID"].ToString());
                    if (TaskID > 0)
                    {
                        modWTI.TaskID = TaskID;
                    }
                    //if (CompanyID > 0)
                    //{
                    drs = dtTem.Select("(CompanyID=" + CompanyID + ") And (ColorID=" + dtWT.Rows[i]["ColorID"] + ") And (MaterielID=" + dtWT.Rows[i]["SizeID"] + ")");//同客户同颜色同尺码
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=" + CompanyID + ") And (ColorID=0) And (MaterielID=" + dtWT.Rows[i]["SizeID"] + ")");    //同客户同尺码无颜色
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=" + CompanyID + ") And (ColorID=" + dtWT.Rows[i]["ColorID"] + ") And (MaterielID=0)");    //同客户同颜色无尺码
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=0) And (ColorID=" + dtWT.Rows[i]["ColorID"] + ") And  (MaterielID=" + dtWT.Rows[i]["SizeID"] + ")");    //无客户同颜色同尺码
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=" + CompanyID + ") And (ColorID=0) And (MaterielID=0)");    //仅客户
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=0) And (ColorID=" + dtWT.Rows[i]["ColorID"] + ") And (MaterielID=0)");    //仅颜色
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=0) And (ColorID=0) And (MaterielID=" + dtWT.Rows[i]["SizeID"] + ")");    //仅尺码
                    }
                    if (drs.Length == 0)
                    {
                        drs = dtTem.Select("(CompanyID=0) And (ColorID=0) And (MaterielID=0)");    //无客户无颜色无尺码
                    }
                    if (drs.Length > 0)
                    {
                        modWTI.WorkingID      = int.Parse(drs[0]["WorkingID"].ToString());
                        modWTI.PWorkingInfoID = int.Parse(drs[0]["ID"].ToString());
                    }
                    else
                    {
                        t = true;
                    }
                    //}
                    //else
                    //{
                    //    drs = dtTem.Select("(CompanyID=0) And (ColorID=" + dtWT.Rows[i]["ColorID"] + ")");
                    //    if (drs.Length == 0)
                    //    {
                    //        drs = dtTem.Select("(CompanyID=0) And (ColorID=0)");
                    //    }
                    //    if (drs.Length > 0)
                    //    {
                    //        modWTI.WorkingID = int.Parse(drs[0]["WorkingID"].ToString());
                    //        modWTI.PWorkingInfoID = int.Parse(drs[0]["ID"].ToString());
                    //    }
                    //    else
                    //    {
                    //        t = true;
                    //    }
                    //}

                    if (!t)
                    {
                        Add(modWTI);
                    }
                }
            }

            return(true);
        }