예제 #1
0
        // GET: Warehouse
        public async System.Threading.Tasks.Task <ActionResult> Index()
        {
            DataSet ds = await Task <DataSet> .Run(() =>
            {
                BizRequest request = ClientMgr.Instance.CreateRequest("config", "MES", "", "GETUSRAPS", new Dictionary <string, string>()
                {
                    { "uid", HttpContext.User.Identity.Name },
                    { "modid", "MESWMS" }
                });
                request.UserId = HttpContext.User.Identity.Name;
                try
                {
                    return(ClientMgr.Instance.RunDbCmd(request.CmdName, request));
                }
                catch (Exception ex)
                {
                }
                return(null);
            });

            if (null != ds)
            {
                ViewBag.Features = ds.Tables["APP_MASTDATA"].Rows;
                Dictionary <object, object> Features = new Dictionary <object, object>();
                foreach (DataRow r in ds.Tables["APP_MASTDATA"].Rows)
                {
                    Features[r["APP_ID"]] = new { p = r["APP_PATH"], n = r["APP_DESCRIPTION"] };
                }
                JavaScriptSerializer jss = new JavaScriptSerializer();
                ViewBag.FeatureStr = jss.Serialize(Features);
            }
            ViewBag.User = User.Identity.Name;
            return(View());
        }
예제 #2
0
        public async Task <JsonResult> Sops(String LINE, String STN, String PARTNO)
        {
            BizRequest req = ClientMgr.Instance.CreateRequest("MES",
                                                              LINE, "ESOP", "LoadESOP", new Dictionary <string, string>()
            {
                { "ln", LINE },
                { "st", STN },
                { "pn", String.IsNullOrEmpty(PARTNO) ? "ALL" : PARTNO }
            });

            req.UserId = User.Identity.Name;

            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                return(ClientMgr.Instance.RunCmd(req.CmdName, req));
            });

            CmdResponse response = new CmdResponse()
            {
                Code = resp.ErrorCode,
                Msg  = resp.ErrorMessage,
                Data = resp.Data
            };

            return(Json(response));
        }
예제 #3
0
        Task <IList <string> > IUserRoleStore <MESUser, string> .GetRolesAsync(MESUser user)
        {
            BizRequest request = ClientMgr.Instance.CreateRequest("config", "MES", "", "GETUSRAPS", new Dictionary <string, string>()
            {
                { "uid", user.Id },
                { "modid", "MESADMIN" }
            });

            request.UserId = user.Id;


            return(Task <List <String> > .Run(() =>
            {
                IList <String> roles = new List <string>();
                try
                {
                    DataSet ds = ClientMgr.Instance.RunDbCmd(request.CmdName, request);
                    foreach (DataRow r in ds.Tables[0].Rows)
                    {
                        roles.Add((String)r["APP_ID"]);
                    }
                }
                catch { }
                return roles;
            }));
        }
예제 #4
0
        public async Task <IHttpActionResult> RunDb([FromBody] CmdRequest request)
        {
            BizRequest req = ClientMgr.Instance.CreateRequest(request.Server, request.Client, request.Entity, request.Cmd, request.Args);

            req.UserId = User.Identity.Name;
            try
            {
                DataSet ds = await Task <IHttpActionResult> .Run(() =>
                {
                    return(ClientMgr.Instance.RunDbCmd(req.CmdName, req));
                });

                return(Ok(ds));
            }
            catch (Exception ex)
            {
                return(this.InternalServerError(ex));
            }
        }
예제 #5
0
        public async Task <ActionResult> Index(SopRequest request)
        {
            ViewBag.Title = ModelName;
            await InitSelect(request.LINE, request.STN, request.PARTNO);

            int    p       = request.FILE.FileName.LastIndexOf(".");
            String fileExt = request.FILE.FileName.Substring(p);
            String path    = Path.GetTempFileName() + fileExt;

            ENG_LINESTATION stn = await db.ENG_LINESTATION
                                  .Where(s => s.LINENAME.Equals(request.LINE) && s.L_STNO.Equals(request.STN))
                                  .SingleOrDefaultAsync();

            BizRequest req = ClientMgr.Instance.CreateRequest("MES",
                                                              String.Format("{0};{1};{2}", stn.LINENAME, stn.L_OPNO, stn.L_STNO),
                                                              "ESOP", "UploadESOP", new Dictionary <string, string>()
            {
                { "ln", stn.LINENAME },
                { "st", stn.L_STNO },
                { "pn", request.PARTNO ?? "ALL" },
                { "f", path }
            });

            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                try
                {
                    request.FILE.SaveAs(path);
                    return(ClientMgr.Instance.RunCmd(req.CmdName, req));
                }
                finally
                {
                    System.IO.File.Delete(path);
                }
            });

            if (!BizResponses.OK.Equals(resp.ErrorCode))
            {
                ModelState.AddModelError("FILE", resp.ErrorMessage);
            }

            return(View(request));
        }
예제 #6
0
        public PartialViewResult Menu()
        {
            BizRequest request = ClientMgr.Instance.CreateRequest("config", "MES", "", "GETUSRAPS", new Dictionary <string, string>()
            {
                { "uid", HttpContext.User.Identity.Name },
                { "modid", "MESADMIN" }
            });

            request.UserId = HttpContext.User.Identity.Name;

            try
            {
                DataSet ds = ClientMgr.Instance.RunDbCmd(request.CmdName, request);

                return(PartialView(ds));
            }catch (Exception ex)
            {
                return(PartialView("MenuError"));
            }
        }
예제 #7
0
        public async Task <IHttpActionResult> Run([FromBody] CmdRequest request)
        {
            BizRequest req = ClientMgr.Instance.CreateRequest(request.Server, request.Client, request.Entity, request.Cmd, request.Args);

            req.UserId = User.Identity.Name;
            BizResponse resp = await Task <BizResponse> .Run(() =>
            {
                return(ClientMgr.Instance.RunCmd(req.CmdName, req));
            });

            CmdResponse response = new CmdResponse()
            {
                Code  = resp.ErrorCode,
                Msg   = resp.ErrorMessage,
                Code2 = resp.ReturnCode,
                Msg2  = resp.ReturnMessage,
                Data  = resp.Data
            };

            return(Ok(response));
        }
예제 #8
0
        private async Task <ActionResult> ShowStn(StnModel stn)
        {
            ViewBag.Line = db.Lines.Where(l => l.Name.Equals(stn.Line)).SingleOrDefault();

            DataSet ds = await Task <DataSet> .Run(() =>
            {
                BizRequest request = ClientMgr.Instance.CreateRequest("config", "MES", "", "GETUSRAPS", new Dictionary <string, string>()
                {
                    { "uid", HttpContext.User.Identity.Name },
                    { "modid", "STADMIN" }
                });
                request.UserId = HttpContext.User.Identity.Name;
                try
                {
                    return(ClientMgr.Instance.RunDbCmd(request.CmdName, request));
                }
                catch (Exception ex)
                {
                    ViewBag.Exception = ex;
                }
                return(null);
            });

            if (null != ds)
            {
                ViewBag.Features = ds.Tables["APP_MASTDATA"].Rows;
                Dictionary <object, object> Features = new Dictionary <object, object>();
                foreach (DataRow r in ds.Tables["APP_MASTDATA"].Rows)
                {
                    Features[r["APP_ID"]] = new { p = r["APP_PATH"], n = r["APP_DESCRIPTION"] };
                }
                JavaScriptSerializer jss = new JavaScriptSerializer();
                ViewBag.FeatureStr = jss.Serialize(Features);
            }
            ViewBag.User = User.Identity.Name;

            return(View(stn));
        }
        //public List<RoleDTO> GetProcessAdminRoles(int processID)
        //{
        //    BizProcess bizProcess = new BizProcess();
        //    return bizProcess.GetProcessAdminRoles(processID);
        //}

        //private void DoStateActivity(MyProjectEntities context, StateActivity stateActivity)
        //{

        //}
        //private void DoTransitionActivity(MyProjectEntities context, TransitionActivity TransitionActivity)
        //{

        //}
        //private int GetInitialState(MyProjectEntities context, int processID)
        //{
        //    var process = context.Process.First(x => x.ID == processID);
        //    return process.State.First().ID;
        //}

        public List <OutgoingTransitoinActionsDTO> GetOutgoingTransitoinActionPosts(int nextstateID, int requestID, int entityID, List <EntityInstanceProperty> keyProperties, int requesterOrganizaiotnPostID, List <int> requrtAdminIds)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetOutgoingTransitoinActionPosts(nextstateID, requestID, entityID, keyProperties, requesterOrganizaiotnPostID, requrtAdminIds));
        }
        public RequestDiagramDTO GetRequestDiagram(int requestID, DR_Requester requester)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetRequestDiagram(requestID, requester));
        }
        public void SaveRequestFile(RequestFileDTO requestFile, DR_Requester requester)
        {
            BizRequest bizRequest = new BizRequest();

            bizRequest.SaveRequestFile(requestFile, requester);
        }
        public WorkflowRequestDTO GetRequest(int requestID)
        {
            BizRequest bizRequest = new BizRequest();

            bizRequest.GetWorkflowRequests(requestNote, requester);
        }
        public List <Tuple <TransitionActionDTO, List <RequestActionDTO> > > GetRequestActions(DR_Requester requester, List <int> requestActionIDs)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetRequestActions(requester, requestActionIDs));
        }
        //public List<PossibleTransitionActionDTO> GetNextPossibleTransitionActionByActionID(int actionID, int requestID)
        //{
        //    BizRequest bizRequest = new BizRequest();
        //    return bizRequest.GetNextPossibleTransitionActionByActionID(actionID, requestID);
        //}
        public PossibleTransitionActionResult GetNextPossibleTransitionActionByStateID(int stateID)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetNextPossibleTransitionActionByStateID(stateID));
        }
        public List <WorkflowRequestDTO> SearchWorkflows(DR_Requester requester, int processID, DateTime?fromData, DateTime?toDate, DP_DataRepository data, WFStateDTO currentState, WFStateDTO historyState, TransitionActionDTO selectedAction, int userID)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.SearchWorkflows(requester, processID, fromData, toDate, data, currentState, historyState, selectedAction, userID));
        }
        public List <RequestNoteDTO> GetRequestNotes(int requestID)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetRequestNotes(requestID));
        }
        public RequestFileDTO GetRequestFile(int requestFileID)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetRequestFile(requestFileID));
        }
        //public List<TransitionActionDTO> GetRequestPossibleTransitionActions(DR_Requester dR_Requester, int requestID)
        //{
        //    BizRequest bizRequest = new BizRequest();
        //    return bizRequest.GetRequestPossibleTransitionActions(dR_Requester, requestID);
        //}
        //public List<int> GetProcessAdmins(int processID)
        //{
        //    BizProcess bizProcess = new BizProcess();
        //    return bizProcess.GetProcessAdmins(processID);
        //}

        public List <RequestNoteDTO> GetRequestNotes(int requestID, bool withRequestActionDescriptions)
        {
            BizRequest bizRequest = new BizRequest();

            return(bizRequest.GetRequestNotes(requestID, withRequestActionDescriptions));
        }