Esempio n. 1
0
 public JsonResult GetIlocCount()
 {
     string result = "false";
     try
     {
         IlocQuery query = new IlocQuery();
         query.loc_id = Request.Params["loc_id"].ToUpper();
         List<IlocQuery> ilocList = new List<IlocQuery>();
         _IlocMgr = new IlocMgr(mySqlConnectionString);
         if (_IlocMgr.GetIlocCount(query)!="")
         {                    
                 result = "true";
         }
         else
         {
             result = "false";
         }
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
     return Json(new { success = result });
 }
Esempio n. 2
0
        public ActionResult IinvdCheck()
        {
            _IlocMgr = new IlocMgr(mySqlConnectionString);
            StringBuilder strHtml = new StringBuilder();
            string loc_id = Request.Params["loc_id"];
            IlocQuery ilocquery=new IlocQuery();
            ilocquery.loc_id = loc_id;
            loc_id = _IlocMgr.GetIlocCount(ilocquery);
            ViewBag.loc_id = loc_id;
            ViewBag.lcat_id = "";
            ViewBag.upc_id = "";
            ViewBag.iplas = "";
            _iinvd = new IinvdMgr(mySqlConnectionString);
            if (loc_id != "")
            {
                List<IinvdQuery> list = _iinvd.GetIinvdList(loc_id);
                IupcQuery iupc = new IupcQuery();
                _IiupcMgr = new IupcMgr(mySqlConnectionString);
                if (list.Count > 0)
                {
                    ViewBag.product_name = list[0].product_name;
                    ViewBag.spec = list[0].spec;
                    ViewBag.item_id = list[0].item_id.ToString()                                        ;
                    ViewBag.pwy_dte_ctl = list[0].pwy_dte_ctl;
                    iupc.item_id=uint.Parse(ViewBag.item_id);
                    List<IupcQuery> listiupc=new List<IupcQuery>();
                    if (iupc.item_id!=0)
                    {
                        listiupc = _IiupcMgr.GetIupcByItemID(iupc);
                    }
                    if (listiupc.Count > 0)
                    {
                        ViewBag.upc_id = listiupc[0].upc_id;
                    }

                    if (list[0].pwy_dte_ctl == "Y")
                    {
                        ViewBag.count = list.Count;
                    }
                    else
                    {
                        int prod_qty = 0;
                        for (int i = 0; i < list.Count; i++)
                        {
                            prod_qty += list[i].prod_qty;
                        }
                        list[0].prod_qty = prod_qty;
                        ViewBag.count = 1;
                    }
                    ViewBag.data = list;

                    IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id);
                    Iloc iloc = new Iloc();
                    if (lsta_id != null)
                    {
                        if (lsta_id.lsta_id == "F")
                        {
                            iloc.row_id = lsta_id.row_id;
                            iloc.lsta_id = "A";
                            iloc.change_dtim = DateTime.Now;
                            iloc.change_user = (Session["caller"] as Caller).user_id;
                            _IlocMgr.UpdateIlocLock(iloc);
                        }
                    } 
                }
                else {
                    ViewBag.product_name ="";
                    ViewBag.spec = "";
                    ViewBag.item_id = "此料位暫無商品";
                    IinvdQuery iinvd = new IinvdQuery();
                    iinvd.prod_qty = 0;
                    list.Add(iinvd);
                    ViewBag.pwy_dte_ctl = Request.Params["pwy_dte_ctl"]; ;
                    ViewBag.count = 0;
                    ViewBag.data = list;

                    IIlocImplMgr ilocMgr = new IlocMgr(mySqlConnectionString);
                    IplasDao iplas = new IplasDao(mySqlConnectionString);
                    int total = 0;
                    ilocquery.loc_id = loc_id;
                    ilocquery.lcat_id = "0";
                    ilocquery.lsta_id = "";
                    ilocquery.IsPage = false;
                    List<IlocQuery> listiloc = ilocMgr.GetIocList(ilocquery, out total);
                    if (listiloc.Count > 0)
                    {
                        string lcat_id =listiloc.Count==0?"": listiloc[0].lcat_id;
                        if (lcat_id == "S")
                        {
                            string item_id = iplas.Getlocid(loc_id);
                            if (item_id != "")
                            {
                                ViewBag.item_id = item_id;
                                iupc.item_id = uint.Parse(ViewBag.item_id);
                                List<IupcQuery> listiupc = _IiupcMgr.GetIupcByItemID(iupc);
                                if (listiupc.Count > 0)
                                {
                                    ViewBag.upc_id = listiupc[0].upc_id;
                                }
                                DataTable table = iplas.GetProduct(item_id);
                                if (table.Rows.Count > 0)
                                {
                                    ViewBag.product_name = table.Rows[0]["product_name"];
                                    ViewBag.spec = table.Rows[0]["spec"];
                                    ViewBag.lcat_id = lcat_id;
                                }
                                DataTable tablePwy = _iinvd.Getprodubybar(item_id);
                                if (tablePwy.Rows.Count > 0)
                                {
                                    ViewBag.pwy_dte_ctl = tablePwy.Rows[0]["pwy_dte_ctl"].ToString();
                                }
                            }
                            else
                            {
                                IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id);
                                Iloc iloc = new Iloc();
                                if (lsta_id != null)
                                {
                                    if (lsta_id.lsta_id != "H")
                                    {
                                        iloc.row_id = lsta_id.row_id;
                                        iloc.lsta_id = "F";
                                        iloc.change_dtim = DateTime.Now;
                                        iloc.change_user = (Session["caller"] as Caller).user_id;
                                        _IlocMgr.UpdateIlocLock(iloc);
                                    }
                                } 
                                ViewBag.iplas = "false";
                                ViewBag.pwy_dte_ctl = "N";
                            }
                        }
                        else {
                            IlocQuery lsta_id = _IlocMgr.GetIlocLsta_id(loc_id);
                            Iloc iloc = new Iloc();
                            if(lsta_id!=null)
                            {
                                if(lsta_id.lsta_id!="H")
                                {
                                    iloc.row_id=lsta_id.row_id;
                                    iloc.lsta_id = "F";
                                    iloc.change_dtim = DateTime.Now;
                                    iloc.change_user = (Session["caller"] as Caller).user_id;
                                    _IlocMgr.UpdateIlocLock(iloc);
                                }
                            }
                            ViewBag.pwy_dte_ctl = "N";
                        }
                    }
                }
                if (ViewBag.pwy_dte_ctl==null)
                {
                    ViewBag.pwy_dte_ctl = "";
                }
            }
            return View();
        }