コード例 #1
0
        public IActionResult Print(string RowNumber)
        {
            IPHostEntry heserver = Dns.GetHostEntry(Dns.GetHostName());
            var         ip       = heserver.AddressList[1].ToString();

            var Log_Select_Print = _context.Log_Select_Print.Where(w => w.opt == "PrintWIPStatus");
            //List<VW_MFC_ProductionDailyReport1> pdr = _context.VW_MFC_ProductionDailyReport1.ToList();
            //List<VW_MFC_ProductionDailyReport1> pdr = _context.VW_MFC_ProductionDailyReport1.ToList();
            var flag = false;

            if (RowNumber != null)
            {
                //HttpContext.Session.SetString("Test", FCode);
                // HttpContext.Session.SetString("fcode", FCode);

                flag = true;
                if (Log_Select_Print.Count() > 0)
                {
                    var oldipaddress = Log_Select_Print.Where(w => w.opt == "PrintWIPStatus" && w.ipaddress == ip);
                    if (oldipaddress.Count() > 0)
                    {
                        var pp_update = _context.Log_Select_Print.FirstOrDefault(f => f.opt == "PrintWIPStatus" && f.ipaddress == ip);
                        pp_update.name      = RowNumber;
                        pp_update.ipaddress = ip;
                        _context.Log_Select_Print.Update(pp_update);
                    }
                    else
                    {
                        var pp_insert = new Log_Select_Print
                        {
                            opt       = "PrintWIPStatus",
                            name      = RowNumber,
                            ipaddress = ip
                        };
                        _context.Log_Select_Print.Add(pp_insert);
                    }

                    _context.SaveChanges();
                }
                else
                {
                    var pp_insert = new Log_Select_Print
                    {
                        opt       = "PrintWIPStatus",
                        name      = RowNumber,
                        ipaddress = ip
                    };
                    _context.Log_Select_Print.Add(pp_insert);
                    _context.SaveChanges();
                }
            }
            //return View(pdr);
            return(Json(flag));
        }
コード例 #2
0
        public IActionResult PrintProductionDailyReport1(string RowNumber, string fromdate, string todate)
        {
            IPHostEntry heserver = Dns.GetHostEntry(Dns.GetHostName());
            var         ip       = heserver.AddressList[1].ToString();

            var Log_Select_Print = _context.Log_Select_Print.Where(w => w.opt == "PrintProduction1");

            var flag = false;

            if (RowNumber != null)
            {
                flag = true;
                if (Log_Select_Print.Count() > 0)
                {
                    var oldipaddress = Log_Select_Print.Where(w => w.opt == "PrintProduction1" && w.ipaddress == ip);
                    if (oldipaddress.Count() > 0)
                    {
                        var pp_update = _context.Log_Select_Print.FirstOrDefault(f => f.opt == "PrintProduction1" && f.ipaddress == ip);
                        pp_update.name      = RowNumber;
                        pp_update.ipaddress = ip;
                        _context.Log_Select_Print.Update(pp_update);
                    }
                    else
                    {
                        var pp_insert = new Log_Select_Print
                        {
                            opt       = "PrintProduction1",
                            name      = RowNumber,
                            ipaddress = ip
                        };
                        _context.Log_Select_Print.Add(pp_insert);
                    }

                    _context.SaveChanges();
                }
                else
                {
                    var pp_insert = new Log_Select_Print
                    {
                        opt       = "PrintFGMovement",
                        name      = RowNumber,
                        ipaddress = ip
                    };
                    _context.Log_Select_Print.Add(pp_insert);
                    _context.SaveChanges();
                }
            }
            //return View(pdr);
            return(Json(flag));
            //return RedirectToAction("Index", "PrintProduction1");
            //return Content("window.open('PrintProduction1/Index')");
        }
コード例 #3
0
ファイル: LogPrint.cs プロジェクト: sutin1990/Nittan
        public static bool Log_Print(string RowNumber, string string_process, string token, string username, NittanDBcontext _context)
        {
            var Log_Select_Print = _context.Log_Select_Print.Where(w => w.opt == string_process);

            var flag = false;

            if (RowNumber != null)
            {
                flag = true;
                if (Log_Select_Print.Count() > 0)
                {
                    var oldipaddress = Log_Select_Print.Where(w => w.opt == string_process && w.username == username);
                    if (oldipaddress.Count() > 0)
                    {
                        var pp_update = _context.Log_Select_Print.FirstOrDefault(f => f.opt == string_process && f.username == username);
                        pp_update.name     = RowNumber;
                        pp_update.token    = token;
                        pp_update.username = username;
                        _context.Log_Select_Print.Update(pp_update);
                    }
                    else
                    {
                        var pp_insert = new Log_Select_Print
                        {
                            opt      = string_process,
                            name     = RowNumber,
                            token    = token,
                            username = username
                        };
                        _context.Log_Select_Print.Add(pp_insert);
                    }
                    _context.SaveChanges();
                }
                else
                {
                    var pp_insert = new Log_Select_Print
                    {
                        opt      = string_process,
                        name     = RowNumber,
                        token    = token,
                        username = username
                    };
                    _context.Log_Select_Print.Add(pp_insert);
                    _context.SaveChanges();
                }
            }
            return(flag);
        }