Ejemplo n.º 1
0
        public DataSet GetView(int TaskID, int OneAmount)
        {
            Hownet.BLL.WorkTicket         bllWT  = new WorkTicket();
            Hownet.BLL.ProductWorkingInfo bllPWI = new ProductWorkingInfo();
            DataTable dt    = bllWT.GetView(TaskID, OneAmount).Tables[0];
            DataTable dtPwi = new DataTable();

            dtPwi = bllPWI.GetGroup(TaskID, OneAmount).Tables[0];
            DataTable dtInfo = dal.GetList("(TaskID=" + TaskID + ")").Tables[0];

            if (dtPwi.Rows.Count > 0)
            {
                for (int i = 0; i < dtPwi.Rows.Count; i++)
                {
                    dt.Columns.Add(dtPwi.Rows[i]["GroupBy"].ToString(), typeof(int));
                }
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                for (int j = 0; j < dtPwi.Rows.Count; j++)
                {
                    DataRow[] drs = dtInfo.Select("(TicketID=" + dt.Rows[i]["ID"] + ") and (GroupBy=" + dtPwi.Rows[j]["GroupBy"] + ")");
                    if (drs.Length > 0)
                    {
                        dt.Rows[i][dtPwi.Rows[j]["GroupBy"].ToString()] = drs[0]["IDCardNo"];
                    }
                }
            }
            DataSet ds = new DataSet();

            ds.Tables.Add(dt.Copy());
            return(ds);
        }
Ejemplo n.º 2
0
        public string UpWorkEmp(int MainID, string WorkingName, int EmpID)
        {
            string aaa = string.Empty;

            Hownet.BLL.Working bllW = new Working();

            DataTable dtW = bllW.GetList("(Name='" + WorkingName + "')").Tables[0];

            if (dtW.Rows.Count > 0)
            {
                DataTable dt = dal.GetList("(MainID=" + MainID + ") And (WorkingID=" + dtW.Rows[0]["ID"] + ")").Tables[0];
                if (dt.Rows.Count == 1)
                {
                    Hownet.Model.WorkTicketInfo modWTI = GetModel(Convert.ToInt32(dt.Rows[0]["ID"]));
                    modWTI.EmployeeID = EmpID;
                    modWTI.DateTime   = DateTime.Now;
                    Update(modWTI);

                    Hownet.BLL.WorkTicket      bllWT  = new WorkTicket();
                    Hownet.BLL.ProductTaskMain bllPTM = new ProductTaskMain();

                    Hownet.Model.WorkTicket      modWT  = bllWT.GetModel(modWTI.MainID);
                    Hownet.Model.ProductTaskMain modPTM = bllPTM.GetModel(modWT.TaskID);
                    Hownet.BLL.PayInfo           bllPI  = new PayInfo();
                    Hownet.Model.PayInfo         modPI  = new Hownet.Model.PayInfo();
                    modPI.A                = 3;
                    modPI.Amount           = modWTI.Amount;
                    modPI.BoxNum           = modWT.BoxNum;
                    modPI.BreakID          = 1;
                    modPI.ColorID          = modWT.ColorID;
                    modPI.DateTime         = DateTime.Now;
                    modPI.EmployeeID       = EmpID;
                    modPI.ID               = 0;
                    modPI.IsDay            = false;
                    modPI.IsSum            = false;
                    modPI.MaterielID       = modPTM.MaterielID;
                    modPI.OderNum          = modPTM.DateTime.ToString("yyyyMMdd") + modPTM.Num.ToString().PadLeft(3, '0');
                    modPI.Price            = 0;
                    modPI.ProductWorkingID = modWTI.PWorkingInfoID;
                    modPI.SizeID           = modWT.SizeID;
                    modPI.WorkingID        = modWTI.WorkingID;
                    modPI.WorkticketInfoID = modWTI.ID;
                    bllPI.Add(modPI);
                    aaa = DateTime.Now.ToString();
                }
            }
            return(aaa);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 用于显示工序执行情况
 /// </summary>
 /// <param name="TaskID">生产单ID</param>
 /// <returns></returns>
 public DataSet GetWorkListByPW(int TaskID, int PWMID, int MaterielID, int TaskDepID)
 {
     try
     {
         Hownet.BLL.WorkTicket         bllWT  = new WorkTicket();
         Hownet.BLL.ProductWorkingInfo bllPWI = new ProductWorkingInfo();
         DataSet ds = new DataSet();
         //if (TaskDepID == 0)
         ds = dal.GetWorkListByPW(TaskID);
         //else
         //ds = dal.GetDepWorkListByPW(TaskDepID);
         if (ds.Tables[0].Rows.Count > 0)
         {
             ds.Tables[0].Columns.Add("EmpDate", typeof(string));
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             {
                 if (ds.Tables[0].Rows[i]["DateTime"].ToString() != "" && (DateTime)(ds.Tables[0].Rows[i]["DateTime"]) != DateTime.Parse("1900-1-1"))
                 {
                     ds.Tables[0].Rows[i]["EmpDate"] = ds.Tables[0].Rows[i]["EmployeeName"].ToString() + "/" + ((DateTime)(ds.Tables[0].Rows[i]["DateTime"])).ToString();
                 }
                 else
                 {
                     ds.Tables[0].Rows[i]["EmpDate"] = " ";
                 }
             }
         }
         DataTable dtPWI = new DataTable();
         if (TaskDepID == 0)
         {
             dtPWI = bllPWI.GetProWorkListByPW(PWMID, MaterielID).Tables[0];
         }
         else
         {
             Hownet.BLL.DepartmentTaskMain   bllDTM = new DepartmentTaskMain();
             Hownet.Model.DepartmentTaskMain modDtm = bllDTM.GetModel(TaskDepID);
             dtPWI = bllPWI.GetProWorkListByPW(modDtm.PWID, MaterielID).Tables[0];
         }
         DataTable dt = bllWT.GetWorkList(TaskID, TaskDepID).Tables[0].Copy();
         if (dtPWI.Rows.Count > 0)
         {
             for (int i = 0; i < dtPWI.Rows.Count; i++)
             {
                 try
                 {
                     dt.Columns.Add(dtPWI.Rows[i]["WorkingName"].ToString(), typeof(string));
                     for (int j = 0; j < dt.Rows.Count; j++)
                     {
                         object    box = dt.Rows[j]["箱号"];
                         object    wor = dtPWI.Rows[i]["ID"];
                         DataRow[] drs = ds.Tables[0].Select("(MainID=" + dt.Rows[j]["ID"] + ") And (WorkingID=" + dtPWI.Rows[i]["WorkingID"] + ")");
                         if (drs.Length > 0)
                         {
                             object obj = drs[0]["EmpDate"];
                             dt.Rows[j][dtPWI.Rows[i]["WorkingName"].ToString()] = drs[0]["EmpDate"];
                         }
                     }
                 }
                 catch
                 {
                 }
             }
         }
         DataSet dsss = new DataSet();
         dsss.Tables.Add(dt);
         return(dsss);
     }
     catch (Exception ex)
     {
         return(new DataSet());
     }
 }
Ejemplo n.º 5
0
        public void Save(byte[] bb, int ProductWorkID, int TaskID)
        {
            DataTable Main = Hownet.BLL.BaseFile.ZipDt.Byte2Ds(bb).Tables[0];

            Main.Columns.Add("OneAmount", typeof(int));
            for (int i = 0; i < Main.Rows.Count; i++)
            {
                Main.Rows[i]["OneAmount"] = 0;
            }
            Hownet.BLL.ProductWorkingInfo bllPWI    = new ProductWorkingInfo();
            Hownet.BLL.WorkTicket         bllWT     = new WorkTicket();
            Hownet.BLL.WorkTicketInfo     bllWkInfo = new WorkTicketInfo();
            Hownet.Model.WorkTicket       modWK     = new Hownet.Model.WorkTicket();
            Hownet.Model.WorkTicketInfo   modWKI    = new Hownet.Model.WorkTicketInfo();
            Hownet.BLL.ProductTaskMain    bllPTM    = new ProductTaskMain();
            Hownet.Model.ProductTaskMain  modPTM    = bllPTM.GetModel(TaskID);
            Hownet.BLL.AmountInfo         bllPTI    = new AmountInfo();
            Hownet.BLL.MaterielList       bllML     = new MaterielList();
            Hownet.Model.MaterielList     modML     = new Hownet.Model.MaterielList();
            Hownet.BLL.Materiel           bllMat    = new Materiel();
            Hownet.Model.Materiel         modMat    = bllMat.GetModel(modPTM.MaterielID);
            DataTable dtInfo = bllWkInfo.GetListNoA("(ID=0)").Tables[0];

            //DataSet dsPt = bllPTI.GetBoxID(TaskID, 1);

            //DataTable dtPWIAmount = bllPWI.GetOneAmount(ProductWorkID).Tables[0];
            //int _PJAmount = 0, _WAmount = 0;
            ////dtTem.Columns.Add("ColorID", typeof(string));
            ////   dtTem.Columns.Add("SizeID", typeof(string));
            ////   dtTem.Columns.Add("Amount", typeof(string));
            ////   dtTem.Columns.Add("BoxNum", typeof(string));
            //int BoxNum = Main.Rows.Count + 1;
            //int z = 0;
            //int j = 0;
            //for (int g = 0; g < dtPWIAmount.Rows.Count; g++)
            //{
            //    #region 有预设数量分箱
            //    if (Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]) > 0)
            //    {
            //        _PJAmount = Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]);
            //        _WAmount = Convert.ToInt32(_PJAmount * 1.5);
            //        for (int r = 0; r < dsPt.Tables[0].Rows.Count; r++)
            //        {
            //            //某数量少于尾箱数量,直接取该数量
            //            if (int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) < _WAmount)
            //            {
            //                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"],
            //                    dsPt.Tables[0].DefaultView[r]["Amount"], BoxNum, _PJAmount);
            //                BoxNum++;
            //            }
            //            else
            //            {
            //                int x = int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) % _PJAmount;
            //                if (x <= (_WAmount - _PJAmount))
            //                {
            //                    z = 3;
            //                }
            //                if (x == 0)
            //                {
            //                    z = 1;
            //                }
            //                if (x > (_WAmount - _PJAmount))
            //                {
            //                    z = 2;
            //                }
            //                switch (z)
            //                {
            //                    case 1:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + (int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount)); j++)
            //                            {

            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount,
            //                                    j, _PJAmount);
            //                            }
            //                            BoxNum = j;
            //                            break;
            //                        }
            //                    case 2:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount); j++)
            //                            {
            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"],
            //                                    dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount, j, _PJAmount);
            //                            }

            //                            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], x, j, _PJAmount);
            //                            BoxNum = j + 1;
            //                            break;
            //                        }
            //                    case 3:
            //                        {

            //                            for (j = BoxNum; j < (BoxNum + int.Parse(dsPt.Tables[0].DefaultView[r]["Amount"].ToString()) / _PJAmount) - 1; j++)
            //                            {
            //                                //  A,ID,ColorID,ColorOneID,ColorTwoID,SizeID,Amount,BoxNum,TaskID,DepartmentID,P2DInfoID,EligibleAmount,InferiorAmount,P2DDepartmentID,MListID,BrandID
            //                                Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], _PJAmount, j, _PJAmount);
            //                            }
            //                            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"], (_PJAmount + x),
            //                                j, _PJAmount);
            //                            BoxNum = j + 1;
            //                            break;
            //                        }
            //                }
            //            }
            //        }
            //    }
            //    #endregion
            //    #region 各色各码总数分为一箱
            //    if (Convert.ToInt32(dtPWIAmount.Rows[g]["OneAmount"]) == -1)
            //    {
            //        for (int r = 0; r < dsPt.Tables[0].Rows.Count; r++)
            //        {
            //            Main.Rows.Add(dsPt.Tables[0].DefaultView[r]["ColorID"], dsPt.Tables[0].DefaultView[r]["SizeID"],
            //                dsPt.Tables[0].DefaultView[r]["Amount"], BoxNum, -1);
            //            BoxNum++;
            //        }
            //    }
            //    #endregion
            //}
            try
            {
                bool      t         = false;
                DataSet   dsPw      = bllPWI.GetBoxWork(ProductWorkID);
                DataTable dtSpecial = bllPWI.GetList("(MainID=" + ProductWorkID * -1 + ")").Tables[0];//查出特殊工序明细表
                DataRow[] ddrs;
                if (dtSpecial.Rows.Count == 0)
                {
                    #region 没有特殊工序
                    for (int r = 0; r < Main.Rows.Count; r++)
                    {
                        modML              = new Hownet.Model.MaterielList();
                        modML.ColorID      = modWK.ColorID = int.Parse(Main.DefaultView[r]["ColorID"].ToString());
                        modML.SizeID       = modWK.SizeID = int.Parse(Main.DefaultView[r]["SizeID"].ToString());
                        modML.ColorOneID   = modWK.ColorOneID = Convert.ToInt32(Main.DefaultView[r]["ColorOneID"]);
                        modML.ColorTwoID   = modWK.ColorTwoID = Convert.ToInt32(Main.DefaultView[r]["ColorTwoID"]);
                        modWK.BoxNum       = int.Parse(Main.DefaultView[r]["BoxNum"].ToString());
                        modWK.Amount       = int.Parse(Main.DefaultView[r]["Amount"].ToString());
                        modML.MaterielID   = modPTM.MaterielID;
                        modML.BrandID      = modPTM.BrandID;
                        modML.MeasureID    = modMat.MeasureID;
                        modWK.MListID      = bllML.GetID(modML);
                        modWK.TaskID       = TaskID;
                        modWK.DepartmentID = modPTM.DeparmentID;
                        modWK.OneAmount    = Convert.ToInt32(Main.DefaultView[r]["OneAmount"]);
                        int mainID = bllWT.Add(modWK);
                        ddrs = dsPw.Tables[0].Select("(OneAmount=" + modWK.OneAmount + ")");
                        for (int c = 0; c < ddrs.Length; c++)
                        {
                            modWKI.EmployeeID     = 0;
                            modWKI.PWorkingInfoID = int.Parse(ddrs[c]["ID"].ToString());
                            modWKI.WorkingID      = int.Parse(ddrs[c]["WorkingID"].ToString());
                            modWKI.MainID         = mainID;
                            modWKI.OutAmount      = modWKI.Amount = modWKI.NotAmount = modWK.Amount;
                            modWKI.TaskID         = TaskID;

                            //bllWkInfo.Add(modWKI);
                            dtInfo.Rows.Add(0, modWKI.MainID, modWKI.DateTime, modWKI.IsDel, modWKI.PWorkingInfoID, modWKI.EmployeeID, modWKI.BackID, modWKI.Amount, modWKI.NotAmount, modWKI.TaskID, modWKI.WorkingID, modWKI.OutAmount);
                        }
                    }
                }
                #endregion
                #region 特殊工序
                else
                {
                    DataRow[] drs;
                    for (int r = 0; r < Main.Rows.Count; r++)
                    {
                        modML              = new Hownet.Model.MaterielList();
                        modML.ColorID      = modWK.ColorID = int.Parse(Main.DefaultView[r]["ColorID"].ToString());
                        modML.SizeID       = modWK.SizeID = int.Parse(Main.DefaultView[r]["SizeID"].ToString());
                        modML.ColorOneID   = modWK.ColorOneID = Convert.ToInt32(Main.DefaultView[r]["ColorOneID"]);
                        modML.ColorTwoID   = modWK.ColorTwoID = Convert.ToInt32(Main.DefaultView[r]["ColorTwoID"]);
                        modWK.BoxNum       = int.Parse(Main.DefaultView[r]["BoxNum"].ToString());
                        modWK.Amount       = int.Parse(Main.DefaultView[r]["Amount"].ToString());
                        modML.MaterielID   = modPTM.MaterielID;
                        modML.BrandID      = modPTM.BrandID;
                        modML.MeasureID    = modMat.MeasureID;
                        modWK.MListID      = bllML.GetID(modML);
                        modWK.TaskID       = TaskID;
                        modWK.DepartmentID = modPTM.DeparmentID;
                        modWK.OneAmount    = Convert.ToInt32(Main.DefaultView[r]["OneAmount"]);
                        int mainID = bllWT.Add(modWK);
                        for (int c = 0; c < dsPw.Tables[0].Rows.Count; c++)
                        {
                            t = false;
                            modWKI.EmployeeID = 0;
                            int w = int.Parse(dsPw.Tables[0].DefaultView[c]["WorkingID"].ToString());
                            modWKI.WorkingID      = w;
                            modWKI.PWorkingInfoID = int.Parse(dsPw.Tables[0].DefaultView[c]["ID"].ToString());
                            if ((bool.Parse(dsPw.Tables[0].DefaultView[c]["IsSpecial"].ToString())))//判断某道工序是否是特殊工序
                            {
                                //有特定客户、特定尺码、特定颜色的特殊工序
                                drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                if (drs.Length == 0)
                                {
                                    //有特定尺码、特定颜色的特殊工序
                                    drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=0) and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                    if (drs.Length == 0)
                                    {
                                        //有特定尺码、特定客户的特殊工序
                                        drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=0) And (MaterielID=" + Main.Rows[r]["SizeID"] + ")");
                                        if (drs.Length == 0)
                                        {
                                            //有特定客户、特定颜色的特殊工序
                                            drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=" + Main.Rows[r]["ColorID"] + ") And (MaterielID=0)");
                                            if (drs.Length == 0)
                                            {
                                                //只有特定颜色的特殊工序
                                                drs = dtSpecial.Select("(SpecialWork=" + w + ") and (MaterielID=0) And (CompanyID=0) and (ColorID=" + Main.Rows[r]["ColorID"] + ")");
                                                if (drs.Length == 0)
                                                {
                                                    //有只特定客户的特殊工序
                                                    drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=" + modPTM.CompanyID + ") and (ColorID=0) and (MaterielID=0)");
                                                    if (drs.Length == 0)
                                                    {
                                                        //有只特定尺码的特殊工序
                                                        drs = dtSpecial.Select("(SpecialWork=" + w + ") and (MaterielID=" + Main.Rows[r]["SizeID"] + ") and (ColorID=0) and (CompanyID=0)");
                                                        if (drs.Length == 0)
                                                        {
                                                            //不分颜色、客户的特殊工序
                                                            drs = dtSpecial.Select("(SpecialWork=" + w + ") and (CompanyID=0) and (ColorID=0)");
                                                            if (drs.Length == 0)
                                                            {
                                                                t = true;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                                if (drs.Length > 0)
                                {
                                    modWKI.WorkingID      = int.Parse(drs[0]["WorkingID"].ToString());
                                    modWKI.PWorkingInfoID = int.Parse(drs[0]["ID"].ToString());
                                    if (modWKI.WorkingID == 0)
                                    {
                                        t = true;
                                    }
                                }
                            }
                            modWKI.MainID    = mainID;
                            modWKI.OutAmount = modWKI.Amount = modWKI.NotAmount = modWK.Amount;
                            modWKI.TaskID    = TaskID;
                            if (!t)
                            {
                                //bllWkInfo.Add(modWKI);//有特殊工序的普通工序,则添加记录,否则不添加
                                dtInfo.Rows.Add(0, modWKI.MainID, modWKI.DateTime, modWKI.IsDel, modWKI.PWorkingInfoID, modWKI.EmployeeID, modWKI.BackID, modWKI.Amount, modWKI.NotAmount, modWKI.TaskID, modWKI.WorkingID, modWKI.OutAmount);
                            }
                        }
                    }
                }

                #endregion
                DAL.BaseFile.MakeBox.AddWorkTicketInfo(dtInfo);
            }
            catch (Exception ex)
            {
            }
        }