public static string printtestHas_getWLName(string id, string zfj, string erweima, bool iscd, string getWLName, string getWLName123)
        {
            GetModel getmodel = new GetModel();

            var print = px_PrintBLL.Querypx_PrintList().Where(s => s.PXID.Equals(erweima)).ToList();

            if (print.Count > 0)
            {
                List <GetIndex> pxlist = new List <GetIndex>();
                foreach (var item in print)
                {
                    GetIndex gi = new GetIndex();
                    gi.订单号   = item.orderid;
                    gi.车身号   = item.orderid;
                    gi.主副驾   = item.XF;
                    gi.等级    = item.cartype;
                    gi.零件号   = item.LingjianHao;
                    gi.零件号描述 = item.ordername;
                    pxlist.Add(gi);
                }
                bool flag = CallPrint.PrintM(pxlist, erweima, getWLName123, getWLName, false);
                if (flag)
                {
                    return("1");
                }

                return("0");
            }
            else
            {
                List <GetIndex> pxlist     = getmodel.GetIndexWJ(id, zfj);
                List <GetIndex> searchlist = new List <GetIndex>();
                searchlist = pxlist.Where(s => s.mg_partorder_ordertype == 4).ToList();
                searchlist.AddRange(pxlist.ToList());
                pxlist = searchlist;
                bool flag = CallPrint.PrintM(pxlist, erweima, zfj + id, getWLName);
                if (flag)
                {
                    return("1");
                }

                return("0");
            }
        }
Ejemplo n.º 2
0
        public void AutoPrintSent()
        {
            //获取所有未打印集合
            //var listindex = getmodel.GetListModels().Where(s => s.IsPrint == 0).ToList();

            List <px_PanrameterModel> panrameter = null;

            try
            {
                panrameter = px_PanrameterDAL.QueryPanrameterListForPart().ToList();
            }
            catch { Thread.Sleep(200); panrameter = px_PanrameterDAL.QueryPanrameterListForPart().ToList(); }
            List <GetIndex> list = null;
            var             internetprintnamelist = px_InternetPrinterDAL.QueryInternetPrinterListForPart().ToList();

            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "坐垫面套").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "坐垫面套");
                if (wf.flag)
                {
                    wf.flag = false;
                    int    number  = panrameter.FirstOrDefault(s => s.Name == "坐垫面套").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("坐垫面套", "前排").ToList();
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排坐垫面套", ToDataTable.getWLName("坐垫面套", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "坐垫面套").IsAutoSend)
                            {
                                Send("前排坐垫面套", erweima);
                            }
                        }
                    }
                }
            }

            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "靠背面套").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "靠背面套");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "靠背面套").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("靠背面套", "前排");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排靠背面套", ToDataTable.getWLName("靠背面套", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "靠背面套").IsAutoSend)
                            {
                                Send("前排靠背面套", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "坐垫骨架").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "坐垫骨架");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "坐垫骨架").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("坐垫骨架", "前排");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);
                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排坐垫骨架", ToDataTable.getWLName("坐垫骨架", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "坐垫骨架").IsAutoSend)
                            {
                                Send("前排坐垫骨架", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "靠背骨架").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "靠背骨架");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "靠背骨架").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("靠背骨架", "前排");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);
                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排靠背骨架", ToDataTable.getWLName("靠背骨架", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "靠背骨架").IsAutoSend)
                            {
                                Send("前排靠背骨架", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "线束").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "线束");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "线束").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("线束", "前排");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排线束", ToDataTable.getWLName("线束", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "线束").IsAutoSend)
                            {
                                Send("前排线束", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "大背板").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "大背板");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "大背板").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("大背板", "前排");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "前排大背板", ToDataTable.getWLName("大背板", "前排"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "大背板").IsAutoSend)
                            {
                                Send("前排大背板", erweima);
                            }
                        }
                    }
                }
            }

            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "40靠背").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "40靠背");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "40靠背").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("靠背面套", "后40");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后40靠背面套", ToDataTable.getWLName("靠背面套", "后40"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "40靠背").IsAutoSend)
                            {
                                Send("后40靠背面套", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "40侧头枕").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "40侧头枕");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "40侧头枕").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("侧头枕", "后40");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后40侧头枕", ToDataTable.getWLName("侧头枕", "后40"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "40侧头枕").IsAutoSend)
                            {
                                Send("后40侧头枕", erweima);
                            }
                        }
                    }
                }
            }



            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后排中央扶手").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "后排中央扶手");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "后排中央扶手").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("扶手", "后60");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后60扶手", ToDataTable.getWLName("扶手", "后60"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后排中央扶手").IsAutoSend)
                            {
                                Send("后60扶手", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后排中央头枕").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "后排中央头枕");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "后排中央头枕").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("中头枕", "后60");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后60中头枕", ToDataTable.getWLName("中头枕", "后60"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后排中央头枕").IsAutoSend)
                            {
                                Send("后60中头枕", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "60靠背").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "60靠背");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "60靠背").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("靠背面套", "后60");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后60靠背面套", ToDataTable.getWLName("靠背面套", "后60"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "60靠背").IsAutoSend)
                            {
                                Send("后60靠背面套", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "60侧头枕").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "60侧头枕");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "60侧头枕").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("侧头枕", "后60");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后60侧头枕", ToDataTable.getWLName("侧头枕", "后60"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "60侧头枕").IsAutoSend)
                            {
                                Send("后60侧头枕", erweima);
                            }
                        }
                    }
                }
            }
            if (GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后坐垫").IsAutoPrint == true)
            {
                WlFlag wf = boolflag.FirstOrDefault(s => s.name == "后坐垫");
                if (wf.flag)
                {
                    wf.flag = false;


                    int    number  = panrameter.FirstOrDefault(s => s.Name == "后坐垫").Number;
                    string erweima = getpara();
                    list = getmodel.GetIndexWJ("坐垫面套", "后坐垫");
                    if (list != null && list.Count >= number)
                    {
                        list = Getmg_partorder_ordertype_ProcessData(list, number);

                        if (list.Count > 0)
                        {
                            bool flag = CallPrint.PrintM(list, erweima, "后坐垫坐垫面套", ToDataTable.getWLName("坐垫面套", "后坐垫"));
                            if (flag && GetBtnClass.BtnClassList.FirstOrDefault(s => s.SortName == "后坐垫").IsAutoSend)
                            {
                                Send("后坐垫坐垫面套", erweima);
                            }
                        }
                    }
                }
            }


            int autocount = GetBtnClass.BtnClassList.Where(s => s.IsAutoPrint == true).ToList().Count();
            int wfcount   = boolflag.Where(s => s.flag == false).ToList().Count();

            if (autocount == wfcount)
            {
                foreach (var item in boolflag)
                {
                    item.flag = true;
                }
            }
        }