Esempio n. 1
0
        //public ActionResult ResetToolLifeCounterAdmin(string id, string resetreason)
        //{
        //    int toolLifeopId = 0;
        //    if (id == "0" || id == "" || id == null)
        //    {
        //    }
        //    else
        //    {
        //        toolLifeopId = Convert.ToInt32(id);

        //        #region//updation in tbltoollife operator in server and tab

        //        var updateTabTool = _UWcontext.tabtbltoollifeoperators.Find(toolLifeopId);
        //        var updateServerTool = _ServerContext.tbltoollifeoperators.Find(updateTabTool.ToolIDAdmin);

        //        updateTabTool.IsReset = 1;
        //        _UWcontext.SaveChanges();
        //        updateServerTool.IsReset = 1;
        //        _ServerContext.SaveChanges();

        //        #endregion

        //        #region // insertion in tbltoollifeoperator in server and tab

        //        var itemTool = _UWcontext.tabtbltoollifeoperators.Find(toolLifeopId);
        //        var serVeritemTool = _ServerContext.tbltoollifeoperators.Find(itemTool.ToolIDAdmin);

        //        //addding in server
        //        tbltoollifeoperator ServertabTLO = new tbltoollifeoperator();

        //        ServertabTLO.MachineID = serVeritemTool.MachineID;
        //        ServertabTLO.ToolNo = serVeritemTool.ToolNo;
        //        ServertabTLO.ToolName = serVeritemTool.ToolName;
        //        ServertabTLO.ToolCTCode = serVeritemTool.ToolCTCode;
        //        ServertabTLO.StandardToolLife = serVeritemTool.StandardToolLife;
        //        ServertabTLO.toollifecounter = 0;
        //        ServertabTLO.InsertedOn = DateTime.Now;
        //        ServertabTLO.InsertedBy = serVeritemTool.InsertedBy;
        //        ServertabTLO.IsReset = 0;
        //        ServertabTLO.IsDeleted = 0;
        //        ServertabTLO.ResetCounter = 0;
        //        ServertabTLO.HMIID = serVeritemTool.HMIID;
        //        ServertabTLO.Sync = 1;
        //        ServertabTLO.ResetReason = resetreason;
        //        ServertabTLO.IsCompleted = false;
        //        _ServerContext.tbltoollifeoperators.Add(ServertabTLO);
        //        _ServerContext.SaveChanges();

        //        int serverTLOp = ServertabTLO.ToolLifeID;
        //        //adding to tab
        //        tabtbltoollifeoperator tabTLO = new tabtbltoollifeoperator();
        //        tabTLO.MachineID = itemTool.MachineID;
        //        tabTLO.ToolNo = itemTool.ToolNo;
        //        tabTLO.ToolName = itemTool.ToolName;
        //        tabTLO.ToolCTCode = itemTool.ToolCTCode;
        //        tabTLO.StandardToolLife = itemTool.StandardToolLife;
        //        tabTLO.toollifecounter = 0;
        //        tabTLO.InsertedOn = DateTime.Now;
        //        tabTLO.InsertedBy = itemTool.StandardToolLife;
        //        tabTLO.IsReset = 0;
        //        tabTLO.IsDeleted = 0;
        //        tabTLO.ResetCounter = 0;
        //        tabTLO.HMIID = itemTool.HMIID;
        //        tabTLO.TabHMIID = itemTool.TabHMIID;
        //        tabTLO.Sync = 1;
        //        tabTLO.ToolIDAdmin = serverTLOp;
        //        tabTLO.ResetReason = resetreason;
        //        tabTLO.IsCompleted = false;
        //        _UWcontext.tabtbltoollifeoperators.Add(tabTLO);
        //        _UWcontext.SaveChanges();
        //        #endregion
        //    }
        //    return RedirectToAction("ToolLife");
        //}

        public JsonResult RefreshData(int machineId)
        {
            List <string> retValList = new List <string>();
            GetMode       GM         = new GetMode();
            String        IPAddress  = GM.GetIPAddressofTabSystem();

            int MachineID = machineId;

            Session["MachineID"] = MachineID;
            GM.UpdateOperatorHeader(MachineID);
            retValList = new List <string>();

            var HeaderDet = _ServerContext.tblOperatorHeaders.Where(m => m.MachineID == MachineID).SingleOrDefault();

            retValList.Add(HeaderDet.tblmachinedetail.MachineDisplayName); //0
            retValList.Add(HeaderDet.TabConnecStatus);                     //1
            retValList.Add(HeaderDet.ServerConnecStatus);                  //2
            retValList.Add(HeaderDet.MachineMode);                         //3

            retValList.Add(HeaderDet.Shift);                               //4
            retValList.Add(MachineID.ToString());
            retValList.Add(IPAddress);
            //string errormessage = Session["setuperror"].ToString();

            var result = new { RetVal = retValList };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ReadStatus Get(ref Lsn lsn, ref DbEntry data, GetMode mode)
        {
            DbRetVal ret;

            lock (rscLock) {
                DB_LOGC *logcp = CheckDisposed();
                fixed(byte *dataBufP = data.Buffer)
                {
                    data.dbt.data = dataBufP + data.Start;
                    ret           = LogcGet(logcp, ref lsn.lsn, ref data.dbt, unchecked ((UInt32)mode));
                }
            }
            switch (ret)
            {
            case DbRetVal.NOTFOUND: break;

            case DbRetVal.BUFFER_SMALL: break;

            default:
                Util.CheckRetVal(ret);
                break;
            }
            data.SetReturnType(DbType.Unknown, 0);
            return((ReadStatus)ret);
        }
 public ReadStatus Get(ref Lsn lsn, ref DbEntry data, GetMode mode) {
   DbRetVal ret;
   lock (rscLock) {
     DB_LOGC* logcp = CheckDisposed();
     fixed (byte* dataBufP = data.Buffer) {
       data.dbt.data = dataBufP + data.Start;
       ret = LogcGet(logcp, ref lsn.lsn, ref data.dbt, unchecked((UInt32)mode));
     }
   }
   switch (ret) {
     case DbRetVal.NOTFOUND: break;
     case DbRetVal.BUFFER_SMALL: break;
     default:
       Util.CheckRetVal(ret);
       break;
   }
   data.SetReturnType(DbType.Unknown, 0);
   return (ReadStatus)ret;
 }
Esempio n. 4
0
    // Update is called once per frame
    void Update()
    {
        if (point == null)
        {
            trs.stopTRSGizmo();
            return;
        }

        if (selected != null && Input.GetMouseButton(0))
        {
            ChangeMaterialOnMouseOver change = (ChangeMaterialOnMouseOver)selected.GetComponent(typeof(ChangeMaterialOnMouseOver));
            change.displaySelected();
            currentMousePosition = Input.mousePosition;

            GetDimensionType dimension = (GetDimensionType)selected.GetComponent(typeof(GetDimensionType));

            //print (selected.name);


            if (dimension == null)
            {
                GyzmoTransformScript gyzmoScript = (GyzmoTransformScript)transform.parent.GetComponent(typeof(GyzmoTransformScript));


                if (selected.name == "TranslateMode")
                {
                    gyzmoScript.setActiveMode(0);
                }
                if (selected.name == "RotateMode")
                {
                    gyzmoScript.setActiveMode(1);
                }
                if (selected.name == "ScaleMode")
                {
                    gyzmoScript.setActiveMode(2);
                }

                return;
            }

            int dimensionType = dimension.returnDimension();

            //print ("current Dimension Type is "+dimensionType);

            if (dimensionType == 0)
            {
                gapValue = getXgap();
            }
            if (dimensionType == 1)
            {
                gapValue = getYgap();
            }
            if (dimensionType == 2)
            {
                gapValue = getXgap();
            }

            GetMode mode = (GetMode)selected.GetComponent(typeof(GetMode));
            modeValue = mode.returnMode();

            //TRANSLATE MODE
            if (modeValue == 0)
            {
                Vector3 rightDirection   = gyzmo.transform.right * XtranslationSpeed * gapValue;
                Vector3 upDirection      = gyzmo.transform.up * YtranslationSpeed * gapValue;
                Vector3 forwardDirection = gyzmo.transform.forward * ZtranslationSpeed * gapValue;

                if (myCamera.transform.position.z > point.transform.position.z)
                {
                    rightDirection *= -1;
                    //orwardDirection*=-1;
                }
                float distanceScale = scaleCamera.returnDistance() / 2;
                distanceScale = Mathf.Clamp(distanceScale, 1, 4);
                //distanceScale = 1;

                if (dimensionType == 0)
                {
                    TranslateObject(rightDirection * distanceScale);
                }
                if (dimensionType == 1)
                {
                    TranslateObject(upDirection * distanceScale);
                }
                if (dimensionType == 2)
                {
                    TranslateObject(-forwardDirection * distanceScale);
                }
            }

            //ROTATE MODE
            if (modeValue == 1)
            {
                currentTranslation = new Vector3(0, 0, 0);
                gapValue           = getXgap();
                Vector3 rightDirection   = gyzmo.transform.right * XrotationSpeed * gapValue;
                Vector3 upDirection      = gyzmo.transform.up * YrotationSpeed * gapValue;
                Vector3 forwardDirection = gyzmo.transform.forward * ZrotationSpeed * gapValue;

                previousEuler = currentEuler;

                if (dimensionType == 0)
                {
                    currentEuler = forwardDirection;
                }
                if (dimensionType == 1)
                {
                    currentEuler = rightDirection;
                }
                if (dimensionType == 2)
                {
                    currentEuler = upDirection;
                }

                RotateObject(currentEuler - previousEuler);
            }


            //SCALING MODE
            if (modeValue == 2)
            {
                currentTranslation = new Vector3(0, 0, 0);
                gapValue           = getXgap();
                //Vector3 rightDirection = gyzmo.transform.right * XrotationSpeed * gapValue ;
                //Vector3 upDirection = gyzmo.transform.up * YrotationSpeed * gapValue ;
                //Vector3 forwardDirection = gyzmo.transform.forward * ZrotationSpeed * gapValue ;

                previousEuler = currentEuler;

                if (dimensionType == 0)
                {
                    ScaleObject((float)gapValue / (float)10 * (float)scalingSpeed);
                }
                if (dimensionType == 1)
                {
                    ScaleObject((float)gapValue / (float)10 * (float)scalingSpeed);
                }
                if (dimensionType == 2)
                {
                    ScaleObject((float)gapValue / (float)10 * (float)scalingSpeed);
                }
            }
        }

        if (Input.GetMouseButtonUp(0) && trs.isActive())
        {
            saveRotation = point.transform.rotation;

            if (modeValue == 2)
            {
                GyzmoTransformScript gyzmo = trs.returnGyzmoTransform();
                //trs
                gyzmo.NormalizeScaling();
            }


            if (selected != null)
            {
                //myCamera.transform.Translate(currentTranslation);
                currentTranslation = new Vector3(0, 0, 0);
                //	myCamera.transform.LookAt(point.transform.position);

                unselect();
            }
        }
    }