示例#1
0
        private void SetViewBag(KanbanRequest data)
        {
            if (LoginInfo.RoleId == 2)                                                   //user manufacture
            {
                ViewBag.PartFGList = FrmHelp.GetPartFGListByLine((int)LoginInfo.LineId); //hanya dapat menampilkan part FG dari line nya
            }
            else
            {
                ViewBag.PartFGList = FrmHelp.GetPartFGList(); //menampilkan semua part FG
            }
            ViewBag.PartFGName = "";
            ViewBag.LineNo     = "";
            ViewBag.LineName   = "";
            MsPartFG partFG = DbContext.MsPartFG.Where(a => a.PartFGId == data.PartFGId).FirstOrDefault();

            if (partFG != null)
            {
                ViewBag.PartFGNo   = partFG.PartFGNo;
                ViewBag.PartFGName = partFG.PartFGName;
                MsLine line = DbContext.MsLine.Where(a => a.LineId == partFG.LineId).FirstOrDefault();
                if (line != null)
                {
                    ViewBag.LineNo   = line.LineNo;
                    ViewBag.LineName = line.LineName;
                }
                ViewBag.Action      = "edit";
                ViewBag.KanbanReqId = data.KanbanReqId;
            }
            else
            {
                ViewBag.Action = "add";
            }
        }
        public string GetPartFGName(int id)
        {
            var      name = "-";
            MsPartFG data = Db.MsPartFG.Where(a => a.PartFGId == id).FirstOrDefault();

            if (data != null)
            {
                name = data.PartFGName;
            }
            return(name);
        }
 public void Initialize(string authorizationToken)
 {
     lock (locker)
     {
         List <KanbanRequest> reqList  = DbContext.KanbanRequest.Where(a => a.StatusId == 3).ToList();
         List <KanbanItem>    reqItems = new List <KanbanItem>();
         foreach (KanbanRequest request in reqList)
         {
             short    lineNo   = 0;
             string   lineName = "";
             MsPartFG fg       = DbContext.MsPartFG.Where(a => a.PartFGId == request.PartFGId).FirstOrDefault();
             if (fg != null)
             {
                 MsLine line = DbContext.MsLine.Where(a => a.LineId == fg.LineId).FirstOrDefault();
                 if (line != null)
                 {
                     lineNo   = line.LineNo;
                     lineName = line.LineName;
                 }
             }
             List <KanbanReqItem> items = DbContext.KanbanReqItem.Where(a => a.KanbanReqId == request.KanbanReqId).ToList();
             foreach (KanbanReqItem item in items)
             {
                 MsPart part = DbContext.MsPart.Where(a => a.PartId == item.PartId).FirstOrDefault();
                 if (part != null)
                 {
                     KanbanItem kanbanItem = new KanbanItem();
                     kanbanItem.ReqItemId   = item.ReqItemId;
                     kanbanItem.KanbanReqId = request.KanbanReqId;
                     kanbanItem.RequestNo   = request.TagRequestNo;
                     kanbanItem.RequestDate = request.RequestDateTime.AddMilliseconds(-request.RequestDateTime.Millisecond);
                     kanbanItem.ReqNo       = request.TagRequestNo;
                     kanbanItem.PartId      = item.PartId;
                     kanbanItem.PartNo      = part.PartNo;
                     kanbanItem.LotSize     = part.LotSize;
                     kanbanItem.Zone        = part.Zone;
                     kanbanItem.LineNo      = lineNo;
                     kanbanItem.LineName    = lineName;
                     kanbanItem.OrderQty    = item.ReqKanban;
                     reqItems.Add(kanbanItem);
                 }
             }
         }
         ReqItems.Add(authorizationToken,
                      Tuple.Create(DateTime.UtcNow.AddHours(1), reqItems));
     }
 }
示例#4
0
        public IActionResult GetPartFGData(int partFGId)
        {
            string partFGName = "";
            string lineNo     = "";
            string lineName   = "";

            MsPartFG partFG = DbContext.MsPartFG.Where(a => a.PartFGId == partFGId).FirstOrDefault();

            if (partFG != null)
            {
                partFGName = partFG == null ? "" : partFG.PartFGName;
                MsLine line = DbContext.MsLine.Where(a => a.LineId == partFG.LineId).FirstOrDefault();
                if (line != null)
                {
                    lineNo   = line.LineNo.ToString();
                    lineName = line.LineName;
                }
            }
            return(Json(new { partFGName, lineNo, lineName }));
        }
示例#5
0
        public async Task <IActionResult> Delete(int id)
        {
            KanbanRequest model = await DbContext.KanbanRequest.Where(a => a.KanbanReqId == id).FirstOrDefaultAsync();

            try
            {
                ViewBag.PartFGNo   = "";
                ViewBag.PartFGName = "";
                ViewBag.LineNo     = "";
                ViewBag.LineName   = "";
                ViewBag.StatusName = "";
                if (model != null)
                {
                    MsPartFG partFG = DbContext.MsPartFG.Where(a => a.PartFGId == model.PartFGId).FirstOrDefault();
                    if (partFG != null)
                    {
                        ViewBag.PartFGNo   = partFG.PartFGNo;
                        ViewBag.PartFGName = partFG.PartFGName;
                        MsLine line = DbContext.MsLine.Where(a => a.LineId == partFG.LineId).FirstOrDefault();
                        if (line != null)
                        {
                            ViewBag.LineNo   = line.LineNo;
                            ViewBag.LineName = line.LineName;
                        }
                    }
                    ViewBag.StatusName = FrmHelp.GetKanbanStatusName(model.StatusId);
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception e)
            {
                LogHelp.WriteErrorLog(e);
            }
            return(View(model));
        }