コード例 #1
0
        public RetMessage <int> PurchasedByUserid(string strTokenid)
        {
            RetMessage <int> rm = new RetMessage <int>();

            strTokenid = ut.getUserIDByToken_og(strTokenid);
            if (strTokenid == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }
            int iRetCode = -1;

            using (organizeEntities db = new organizeEntities())
            {
                var ups = from a in db.payinfo
                          where a.userid == strTokenid
                          select a;
                if (ups != null && ups.ToList().Count > 0)
                {
                    iRetCode = 0;
                }
            }
            List <int> iRetArry = new List <int>();

            rm.RetCode = 0;
            iRetArry.Add(iRetCode);
            rm.data = iRetArry;
            return(rm);
        }
コード例 #2
0
        public RetMessage <string> ogenroll(int dataID, string strTokenid)
        {
            RetMessage <string> rm = new RetMessage <string>();
            string strUserId       = ut.getUserIDByToken_og(strTokenid);

            if (strUserId == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }
            using (organizeEntities db = new organizeEntities())
            {
                recordtel cc = new recordtel();

                cc.userid = strUserId;
                cc.dataid = dataID;
                string strNow = DateTime.Now.ToString("u");
                cc.teldate = strNow.Substring(0, 10);
                cc.teltime = strNow.Substring(10, 8);;
                db.recordtel.Add(cc);
                db.SaveChanges();
            }

            List <string> ListRetArrys = new List <string>();

            ListRetArrys.Add("succed");
            rm.data    = ListRetArrys;
            rm.RetCode = 0;
            return(rm);
        }
コード例 #3
0
 public void deactivate(out RetMessage retMessage)
 {
     try
     {
         if (dev.NotExistHW.LIGHTING)
         {
             retMessage = RetMessage.OK; return;
         }
         if (!comPort.IsOpen)
         {
             retMessage = RetMessage.OK; return;
         }
         comPort.ReadExisting();
         comPort.Close();
         if (comPort.IsOpen)
         {
             retMessage = RetMessage.INVALID; return;
         }
         retMessage = RetMessage.OK;
     }
     catch
     {
         retMessage = RetMessage.INVALID;
     }
 }
コード例 #4
0
        public RetMessage <tv_purchased> PutTransLog(string strTokenid)
        {
            RetMessage <tv_purchased> rm = new RetMessage <tv_purchased>();
            string l_strTokenid          = "zb";

            if (strTokenid != null && strTokenid.Trim() != "")
            {
                l_strTokenid = strTokenid;
            }
            l_strTokenid = ut.getUserIDByToken_og(l_strTokenid);
            if (l_strTokenid == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }
            List <tv_purchased> ListRetArrys = new List <tv_purchased>();

            using (organizeEntities db = new organizeEntities())
            {
                var ups = from a in db.tv_purchased
                          where a.userid == l_strTokenid
                          select a;
                if (ups != null && ups.ToList().Count > 0)
                {
                    ListRetArrys = ups.ToList <tv_purchased>();
                }
            }
            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #5
0
 public void motorAbort(out RetMessage retMessage)
 {
     mc.init.success.MG = false;
     Z.abort(out retMessage); if (retMessage != RetMessage.OK)
     {
         return;
     }
     return;
 }
コード例 #6
0
 public void motorDisable(out RetMessage retMessage)
 {
     mc.init.success.MG = false;
     Z.motorEnable(false, out retMessage);
     Z.motorEnable(false, out retMessage); if (retMessage != RetMessage.OK)
     {
         return;
     }
     return;
 }
コード例 #7
0
        public async Task <RetMessage <Token> > Getuseridbywxlogin(string js_code)
        {
            var l_js_code = "0311zLDk1E5afi09g9Ck14DXDk11zLD9";

            if (js_code != null)
            {
                l_js_code = js_code;
            }

            string     APPID      = ut.getAppSetting(11);
            string     SECRET     = ut.getAppSetting(12);
            string     grant_type = ut.getAppSetting(7);
            string     strurl     = @" https://api.weixin.qq.com/sns/jscode2session?appid=" + APPID + "&secret=" + SECRET + "&js_code=" + l_js_code + "&grant_type=" + grant_type;
            HttpClient hc         = new HttpClient();
            //Url httpUrl = new Url(strurl);
            HttpResponseMessage hrm = await hc.GetAsync(strurl);

            RetMessage <Token> rm = new RetMessage <Token>();

            if (hrm.IsSuccessStatusCode)
            {
                string jsonresult = await hrm.Content.ReadAsStringAsync();

                if (jsonresult.Contains("errcode"))
                {
                    rm.RetCode  = -4;
                    rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                }
                else
                {
                    JsonData data = JsonMapper.ToObject(jsonresult);


                    //取到openid,转换token
                    List <Token> tokenArray = new List <Token>();
                    Token        token      = new Token();
                    token.tokenMake(data["openid"].ToString(), data["session_key"].ToString(), 2);
                    rm.RetCode = 0;
                    tokenArray.Add(token);
                    rm.data = tokenArray;
                }
            }
            else
            {
                rm.RetCode  = -5;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
            }
            return(rm);
        }
コード例 #8
0
ファイル: classPusher.cs プロジェクト: lim98729/PSA-10S
 public void activate(axisConfig x, out RetMessage retMessage)
 {
     if (!X.isActivate)
     {
         X.activate(x, out retMessage); if (mpiCheck(UnitCodeAxis.X, 0, retMessage, "", false))
         {
             return;
         }
     }
     if (!homingX.isActivate)
     {
         homingX.activate(x, out retMessage); if (mpiCheck(UnitCodeAxis.X, 0, retMessage, "", false))
         {
             return;
         }
     }
     retMessage = RetMessage.OK;
 }
コード例 #9
0
        public void bright_set(int channel, double bright, out RetMessage retMessage)
        {
            try
            {
                if (dev.NotExistHW.LIGHTING)
                {
                    retMessage = RetMessage.OK; return;
                }
                if (!comPort.IsOpen)
                {
                    retMessage = RetMessage.INVALID; return;
                }
                sData  = System.Text.Encoding.Default.GetString(STX);
                sData += channel.ToString();
                if (bright < 0)
                {
                    bright = 0;
                }
                if (bright > 255)
                {
                    bright = 255;
                }
                if (bright < 10)
                {
                    sData += "00";
                }
                else if (bright < 100)
                {
                    sData += "0";
                }

                sData += bright.ToString();
                sData += System.Text.Encoding.Default.GetString(ETX);


                comPort.WriteLine(sData);
                rcvMsg     = comPort.ReadExisting();
                retMessage = RetMessage.OK;
            }
            catch
            {
                retMessage = RetMessage.INVALID;
            }
        }
コード例 #10
0
        public RetMessage <datainfo> GetDataInfoByQuery(string queryKey, string strTokenid)
        {
            RetMessage <datainfo> rm           = new RetMessage <datainfo>();
            List <datainfo>       ListRetArrys = new List <datainfo>();

            using (organizeEntities db = new organizeEntities())
            {
                IQueryable <datainfo> ups;
                if (queryKey != null)
                {
                    ups = from a in db.datainfo
                          join b in db.r_datacata on a.dataid equals b.dataid
                          join c in db.datacatalog on b.catalogid equals c.catalogid
                          where (a.describe.Contains(queryKey) || a.title.Contains(queryKey) || c.catainfo.Contains(queryKey))
                          select a;
                }
                else
                {
                    ups = from a in db.datainfo
                          join b in db.r_datacata on a.dataid equals b.dataid
                          join c in db.datacatalog on b.catalogid equals c.catalogid
                          select a;
                }


                if (ups != null && ups.ToList().Count > 0)
                {
                    ListRetArrys = ups.ToList <datainfo>();
                }

                //插入查询log
                querylog qlog   = new querylog();
                string   strNow = DateTime.Now.ToString("u");
                qlog.userid = ut.getUserIDByToken_og(strTokenid);
                qlog.qdate  = strNow.Substring(0, 10);
                qlog.qtime  = strNow.Substring(11, 8);
                qlog.strkey = queryKey;
                db.querylog.Add(qlog);
                db.SaveChanges();
            }
            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #11
0
        public RetMessage <datacatalog> Getdatacatalog()
        {
            RetMessage <datacatalog> rm           = new RetMessage <datacatalog>();
            List <datacatalog>       ListRetArrys = new List <datacatalog>();

            using (organizeEntities db = new organizeEntities())
            {
                var ups = from tv_up in db.datacatalog
                          //  where tv_up.userid == strUserID
                          select tv_up;
                if (ups != null && ups.ToList().Count > 0)
                {
                    ListRetArrys = ups.ToList();
                }
            }
            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #12
0
 public void activate(axisConfig z, out RetMessage retMessage)
 {
     if (!Z.isActivate)
     {
         Z.activate(z, out retMessage); if (mpiCheck(UnitCodeAxis.Z, 0, retMessage, "", false))
         {
             return;
         }
     }
     if (!homingZ.isActivate)
     {
         homingZ.activate(z, out retMessage); if (mpiCheck(UnitCodeAxis.Z, 0, retMessage, "", false))
         {
             return;
         }
     }
     mc.UnloaderControl.readconfig();
     retMessage = RetMessage.OK;
 }
コード例 #13
0
        /*提交数据:token
         * 返回:用户提交过的代报名信息和是否付款的信息
         */
        public RetMessage <ViewOgQuestionnaireModel> ogenrollQuery(string tokenId)
        {
            RetMessage <ViewOgQuestionnaireModel> rm           = new RetMessage <ViewOgQuestionnaireModel>();
            List <ViewOgQuestionnaireModel>       ListRetArrys = new List <ViewOgQuestionnaireModel>();

            string userid = ut.getUserIDByToken_og(tokenId);

            if (userid == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }
            using (organizeEntities db = new organizeEntities())
            {
                List <ogquestionnaire> rdArry = new List <ogquestionnaire>();
                rdArry = db.ogquestionnaire.Where(x => x.userid == userid).ToList();

                List <payinfo> payArray = new List <payinfo>();
                payArray = db.payinfo.Where(x => x.userid == userid && x.transaction_id != null && x.transaction_id.Trim() != "").ToList();
                foreach (var xx in rdArry)
                {
                    ViewOgQuestionnaireModel vgo = new ViewOgQuestionnaireModel();
                    vgo.Buyed = -1;
                    vgo.qid   = xx.qid;
                    vgo.name  = xx.name;
                    foreach (var cc in payArray)
                    {
                        if (cc.dataid == xx.qid)
                        {
                            vgo.Buyed = 0;
                        }
                    }
                    ListRetArrys.Add(vgo);
                }
            }


            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #14
0
        public RetMessage <datainfo> GetDataInfo(int CatalogID)
        {
            RetMessage <datainfo> rm     = new RetMessage <datainfo>();
            int             lCatalogID   = CatalogID;
            List <datainfo> ListRetArrys = new List <datainfo>();

            using (organizeEntities db = new organizeEntities())
            {
                var ups = from a in db.datainfo
                          join b in db.r_datacata on a.dataid equals b.dataid
                          join c in db.datacatalog on b.catalogid equals c.catalogid
                          where c.catalogid == lCatalogID
                          select a;

                if (ups != null && ups.ToList().Count > 0)
                {
                    ListRetArrys = ups.ToList <datainfo>();
                }
            }
            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #15
0
 public void deactivate(out RetMessage retMessage)
 {
     Elev.deactivate(out retMessage);
 }
コード例 #16
0
 public void activate(axisConfig z, out RetMessage retMessage)
 {
     Elev.activate(z, out retMessage);
 }
コード例 #17
0
        void control(object sender, out RetMessage retMessage)
        {
            distanceX = mc.para.CAL.ToolSize.x.value / 2 - mc.para.CAL.ToolOffset.value;
            distanceY = mc.para.CAL.ToolSize.y.value / 2 - mc.para.CAL.ToolOffset.value;

            mc.touchProbe.setZero(out ret.b);

            if (sender.Equals(BT_UP))
            {
                distanceX = 0; distanceY = -distanceY;
            }
            if (sender.Equals(BT_LEFT))
            {
                distanceY = 0;
            }
            if (sender.Equals(BT_CENTER))
            {
                distanceX = 0; distanceY = 0;
            }
            if (sender.Equals(BT_RIGHT))
            {
                distanceX = -distanceX; distanceY = 0;
            }
            if (sender.Equals(BT_DOWN))
            {
                distanceX = 0;
            }

            posX = mc.hd.tool.tPos.x[selectedHead].TOUCHPROBE;
            posY = mc.hd.tool.tPos.y[selectedHead].TOUCHPROBE;
            posZ = mc.hd.tool.tPos.z[selectedHead].TOUCHPROBE;

            #region xyz moving
            mc.hd.tool.jogMove(selectedHead, posX + distanceX, posY + distanceY, mc.hd.tool.tPos.z[selectedHead].TOUCHPROBE, mc.hd.tool.tPos.t[selectedHead].ZERO, out retMessage); if (retMessage != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); return;
            }
            #endregion
            mc.idle(1000);

            double value = 0;
            mc.touchProbe.getData(out value, out ret.b);

            if (ret.b == false)
            {
                mc.message.alarm("Touchprobe Error"); retMessage = RetMessage.UNSUPPORTED; goto EXIT;
            }

            double errorPos;
            mc.hd.tool.Z[selectedHead].errorPosition(out errorPos, out ret.message);
            errorPos /= 1000;
            if (sender.Equals(BT_UP))
            {
                touchPosition[1] = /*touchPosition[0] - */ value + errorPos;
            }
            if (sender.Equals(BT_LEFT))
            {
                touchPosition[2] = /*touchPosition[0] - */ value + errorPos;
            }
            if (sender.Equals(BT_CENTER))
            {
                touchPosition[0] = ret.d;
            }
            if (sender.Equals(BT_RIGHT))
            {
                touchPosition[3] = /*touchPosition[0] - */ value + errorPos;
            }
            if (sender.Equals(BT_DOWN))
            {
                touchPosition[4] = /*touchPosition[0] - */ value + errorPos;
            }

EXIT:
            mc.hd.tool.jogMove(selectedHead, mc.coor.MP.HD.Z.XY_MOVING.value, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); return;
            }
            #region  주석
            //    #region z moving
            //    int i, ii;
            //    for (i = 500; i >= -1000; i -= 20)
            //    {
            //        mc.idle(10);
            //        mc.hd.tool.jogMove(posZ + i, out ret.message); if (ret.message != RetMessage.OK) { mc.message.alarm("Motion Error : " + ret.message.ToString()); return; }
            //        mc.touchProbe.getData(out ret.d, out ret.b);
            //        if(ret.b == false) { mc.message.alarm("Touchprobe Error"); retMessage = RetMessage.UNSUPPORTED; return; }
            //        if(ret.d > 0.05)
            //            goto SUCCESS_1ST;
            //    }
            //    mc.message.alarm("Touch 1st Error");
            //    retMessage = RetMessage.UNSUPPORTED;
            //    return;

            //SUCCESS_1ST:
            //    for (ii = 0; ii < 500; ii++)
            //    {
            //        mc.idle(10);
            //        mc.hd.tool.jogMove(posZ + i + ii, out ret.message); if (ret.message != RetMessage.OK) { mc.message.alarm("Motion Error : " + ret.message.ToString()); return; }
            //        mc.touchProbe.getData(out ret.d, out ret.b);
            //        if (ret.b == false) { mc.message.alarm("Touchprobe Error"); retMessage = RetMessage.UNSUPPORTED; return; }
            //        if (ret.d < 0.005)
            //            goto SUCCESS_2ND;
            //    }
            //     mc.message.alarm("Touch 2nd Error");
            //    retMessage = RetMessage.UNSUPPORTED;
            //    return;

            //SUCCESS_2ND:
            //    if (sender.Equals(BT_P1)) { touchPosition[1] = i + ii; }
            //    if (sender.Equals(BT_P2)) { touchPosition[2] = i + ii; }
            //    if (sender.Equals(BT_P3)) { touchPosition[3] = i + ii; }
            //    if (sender.Equals(BT_P4)) { touchPosition[4] = i + ii; }
            //    if (sender.Equals(BT_P5)) { touchPosition[5] = i + ii; }
            //    if (sender.Equals(BT_P6)) { touchPosition[6] = i + ii; }
            //    if (sender.Equals(BT_P7)) { touchPosition[7] = i + ii; }
            //    if (sender.Equals(BT_P8)) { touchPosition[8] = i + ii; }
            //    if (sender.Equals(BT_P9)) { touchPosition[9] = i + ii; }

            //    mc.hd.tool.jogMove(mc.coor.MP.HD.Z.XY_MOVING.value, out ret.message); if (ret.message != RetMessage.OK) { mc.message.alarm("Motion Error : " + ret.message.ToString()); return; }

            //    #endregion
            #endregion
        }
コード例 #18
0
ファイル: utility.cs プロジェクト: newmurk/zzlserver
        public RetMessage <Order> makeOrder(int payflag, int price, string goodid, string title, string openid, string userid)
        {
            RetMessage <Order> rm        = new RetMessage <Order>();
            string             strcode   = null;
            string             total_fee = null;
            int appidclass = -1;

            switch (payflag)
            {
            case 1:
                strcode    = "AIB平台-[" + title + "]";
                total_fee  = (price * 100).ToString();
                appidclass = 16;
                break;
            }
            string wx_appid     = getAppSetting(appidclass);
            string wx_mch_id    = getAppSetting(1);
            string wx_nonce_str = getRandomString(20);

            byte[] buffer              = Encoding.UTF8.GetBytes(strcode);
            string wx_body             = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
            string wx_out_trade_no     = DateTime.Now.ToString("yyyyMMddHHmmss") + getRandomString(10);
            string wx_total_fee        = ((int)(decimal.Parse(total_fee))).ToString();//unit:fen
            string wx_spbill_create_ip = getAppSetting(4);
            string wx_notify_url       = getAppSetting(3);
            string wx_trade_type       = getAppSetting(5);
            var    dic = new Dictionary <string, string> {
                { "appid", wx_appid },
                { "body", wx_body },
                { "mch_id", wx_mch_id },
                { "nonce_str", wx_nonce_str },
                { "notify_url", wx_notify_url },
                { "openid", openid },
                { "out_trade_no", wx_out_trade_no },
                { "spbill_create_ip", wx_spbill_create_ip },
                { "total_fee", wx_total_fee },
                { "trade_type", wx_trade_type }
            };

            dic.Add("sign", GetSignString(dic));
            var sb = new StringBuilder();

            sb.Append("<xml>");
            foreach (var d in dic)
            {
                sb.Append("<" + d.Key + ">" + d.Value + "</" + d.Key + ">");
            }
            sb.Append("</xml>");
            string response = CreatedPostHttpResponse("https://api.mch.weixin.qq.com/pay/unifiedorder", sb);

            byte[]       array = Encoding.UTF8.GetBytes(response);
            MemoryStream ms    = new MemoryStream(array);
            StreamReader sr    = new StreamReader(ms);
            string       html  = sr.ReadToEnd();
            var          xml   = new XmlDocument();

            xml.LoadXml(response);
            var           root   = xml.DocumentElement;
            StringReader  stram  = new StringReader(html);
            XmlTextReader reader = new XmlTextReader(stram);

            System.Data.DataSet ds = new System.Data.DataSet();
            ds.ReadXml(reader);
            string return_code = ds.Tables[0].Rows[0]["return_code"].ToString();

            if (return_code.ToUpper() == "SUCCESS")
            {
                if (payflag == 1)
                {
                    using (masterEntities db = new masterEntities())
                    {
                        string   strNow = DateTime.Now.ToString("u");
                        mpayinfo pi     = new mpayinfo();
                        //pi.dataid = dataId;
                        pi.paydate = strNow.Substring(0, 10);
                        pi.paytime = strNow.Substring(10, 8);
                        //(int)decimal.Parse(total_fee)*100
                        pi.paymount     = total_fee;//total_fee
                        pi.out_trade_no = wx_out_trade_no;
                        pi.masterid     = goodid;
                        pi.userid       = userid;
                        db.mpayinfo.Add(pi);
                        db.SaveChanges();
                    }
                }


                //wx_out_trade_no
                var res = new Dictionary <string, string> {
                    { "appID", wx_appid },
                    { "nonceStr", ds.Tables[0].Rows[0]["nonce_str"].ToString() },
                    { "package", "prepay_id=" + ds.Tables[0].Rows[0]["prepay_id"].ToString() },
                    { "signType", "MD5" },
                    { "timeStamp", GetTimeStamp() },
                };
                res.Add("paySign", GetSignString(res));
                List <Order> orderArray = new List <Order>();
                Order        order      = new Order();
                order.timeStamp       = res["timeStamp"];
                order.nonceStr        = res["nonceStr"];
                order.package         = res["package"];
                order.paySign         = res["paySign"];
                order.wx_out_trade_no = wx_out_trade_no;
                rm.RetCode            = 0;
                orderArray.Add(order);
                rm.data = orderArray;
            }
            else
            {
                rm.RetCode  = -2;
                rm.ErrorMsg = getErrMessage(rm.RetCode);
            }
            return(rm);
        }
コード例 #19
0
        private double getHeight(double targetHeight, out RetMessage retMessage)
        {
            // 1. 무빙 위치로 이동
            int head = selectedHead;

            posZ = mc.hd.tool.tPos.z[head].XY_MOVING;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); retMessage = ret.message; return(0);
            }
            mc.idle(100);

            // 2. 로드셀 초기화 한다.
            mc.loadCell.setZero((int)UnitCodeLoadcell.CAL);
            mc.loadCell.setZero((int)UnitCodeLoadcell.TOP1);
            mc.loadCell.setZero((int)UnitCodeLoadcell.TOP2);

            // 3. 로드셀 위치에서 위로 1000 um 까지 이동
            posZ = mc.hd.tool.tPos.z[head].LOADCELL + 1000;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); retMessage = ret.message; return(0);
            }
            mc.idle(100);

            // 4. 로드셀 위치로 이동
            posZ = mc.hd.tool.tPos.z[head].LOADCELL;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); retMessage = ret.message; return(0);
            }

            // 5. 100 um 단위로 내려가며 찾기 시작
            mc.idle(500);
            double curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
            bool   moveError   = false;

            while (curLoadcell < targetHeight)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                mc.hd.tool.jogMovePlus(head, -100, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    retMessage = ret.message;
                    moveError  = true;
                    break;
                }
                mc.idle(100);
            }

            // 6. 10 um 단위로 올라가며 찾기 시작
            mc.idle(3000);
            curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);

            while (!moveError && curLoadcell > targetHeight)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                mc.hd.tool.jogMovePlus(head, 10, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    retMessage = ret.message;
                    moveError  = true;
                    break;
                }
                mc.idle(500);
            }

            // 7. 1 um 단위로 내려가며 찾기 시작
            mc.idle(3000);
            curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);

            while (!moveError && Math.Abs(curLoadcell - targetHeight) > 0.01)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                mc.hd.tool.jogMovePlus(head, -1, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    retMessage = ret.message;
                    moveError  = true;
                    break;
                }
                mc.idle(500);
            }

            // 8. 현재 위치를 반환한다.
            if (!moveError)
            {
                double heightValue = 0;
                mc.hd.tool.Z[head].actualPosition(out heightValue, out ret.message); if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message); retMessage = ret.message; return(0);
                }

                retMessage = RetMessage.OK;
                return(heightValue);
            }
            else
            {
                retMessage = ret.message;
            }

            return(0);
        }
コード例 #20
0
        public RetMessage <ViewDataInfoModel> GetDataInfobyID(int dataID, string strTokenid)
        {
            RetMessage <ViewDataInfoModel> rm = new RetMessage <ViewDataInfoModel>();
            int    ldataID   = dataID;
            string strUserId = ut.getUserIDByToken_og(strTokenid);

            if (strUserId == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }

            List <ViewDataInfoModel> vdmArray = new List <ViewDataInfoModel>();
            ViewDataInfoModel        vdm      = new ViewDataInfoModel();

            using (organizeEntities db = new organizeEntities())
            {
                //取资料主档信息
                datainfo cc = new datainfo();
                cc = db.datainfo.Find(ldataID);
                if (cc != null && cc.dataid > 0)
                {
                    vdm.amount    = cc.amount;
                    vdm.dataid    = cc.dataid;
                    vdm.describe  = cc.describe;
                    vdm.signature = cc.signature;
                    vdm.title     = cc.title;
                    vdm.type      = cc.type;
                    vdm.url       = cc.url;
                    vdm.Buyed     = -1;
                    vdm.picurd    = cc.picurd;
                    vdm.picurs    = cc.picurs;
                    //取关系表
                    List <r_datacata> rdArry = new List <r_datacata>();
                    rdArry = db.r_datacata.Where(x => x.dataid == ldataID).ToList();
                    List <int> CatalogIDArry = new List <int>();
                    foreach (var xx in rdArry)
                    {
                        CatalogIDArry.Add(xx.catalogid);
                    }
                    //取标签
                    // dc = db.datacatalog.Where(x => CatalogIDArry.Contains(x.catalogid)&& x.sid == 99).ToList();
                    List <datacatalog> dc = new List <datacatalog>();
                    dc = db.datacatalog.Where(x => CatalogIDArry.Contains(x.catalogid)).ToList();
                    List <DataCatalogs> dcss = new List <DataCatalogs>();
                    foreach (var gg in dc)
                    {
                        DataCatalogs dcs = new DataCatalogs();
                        dcs.catainfo  = gg.catainfo;
                        dcs.catalogid = gg.catalogid;
                        dcs.sid       = gg.sid;
                        dcss.Add(dcs);
                    }
                    vdm.DataCatalogArry = dcss;
                    vdm.Buyed           = 0;
                    var ReadCount = 0;

                    /*
                     * var rc = db.readcount.Where(x => x.dataid == dataID).ToList();
                     * if (rc != null)
                     * {
                     *  ReadCount = (int)rc.Sum(x => x.rcount);
                     *  var rcs = rc.Where(x => x.userid == strUserId).FirstOrDefault();
                     *  if (rcs != null)
                     *  {
                     *      rcs.rcount++;
                     *      db.SaveChanges();
                     *  }
                     *  else
                     *  {
                     *      readcount rt = new readcount();
                     *      rt.rcount = 1;
                     *      rt.dataid = dataID;
                     *      rt.userid = strUserId;
                     *      db.readcount.Add(rt);
                     *      db.SaveChanges();
                     *  }
                     *
                     * }
                     * else
                     * {
                     *  readcount rt = new readcount();
                     *  rt.rcount = 1;
                     *  rt.dataid = dataID;
                     *  rt.userid = strUserId;
                     *  db.readcount.Add(rt);
                     *  db.SaveChanges();
                     *  ReadCount = 1;
                     * }
                     */

                    vdm.BuyedCount = int.Parse(ut.getAppSetting(9)) + dataID + ReadCount;
                    List <string> userArry = new List <string>();
                    vdm.UserPicUrl = userArry;
                }
            }
            rm.RetCode = 0;
            vdmArray.Add(vdm);
            rm.data = vdmArray;
            return(rm);
        }
コード例 #21
0
            public void jogMove(double posZ, out RetMessage retMessage)
            {
                bool safe = true;

                Z.move(posZ, out retMessage); if (retMessage != RetMessage.OK)
                {
                    goto FAIL;
                }
                #region endcheck
                dwell.Reset();
                while (true)
                {
                    mc.idle(10);
                    if (dwell.Elapsed > 20000)
                    {
                        retMessage = RetMessage.TIMEOUT; goto FAIL;
                    }

                    if (!isAreaSafe())
                    {
                        Z.stop(out ret.message);
                        safe = false;
                        break;
                    }

                    Z.AT_TARGET(out ret.b, out retMessage); if (retMessage != RetMessage.OK)
                    {
                        goto FAIL;
                    }
                    if (ret.b)
                    {
                        break;
                    }
                }
                dwell.Reset();
                while (safe)
                {
                    mc.idle(10);
                    if (dwell.Elapsed > 500)
                    {
                        retMessage = RetMessage.TIMEOUT; goto FAIL;
                    }
                    Z.AT_DONE(out ret.b, out retMessage); if (retMessage != RetMessage.OK)
                    {
                        goto FAIL;
                    }
                    if (ret.b)
                    {
                        break;
                    }
                }

                if (!safe)
                {
                    string tmpStr;
                    mc.idle(1000);
                    Z.reset(out ret.message);
                    mc.unloader.directErrorCheck(out tmpStr, ERRORCODE.MG, ALARM_CODE.E_MAGAZINE_IO_AREA_SENSOR_DETECT);
                    mc.error.set(mc.error.MG, ALARM_CODE.E_MAGAZINE_IO_AREA_SENSOR_DETECT, tmpStr, false);
                    mc.error.CHECK();
                }
                return;

                #endregion
FAIL:
                mc.init.success.MG = false;
                return;
            }
コード例 #22
0
        public RetMessage <Order> makeOrder(string tokenId, int dataId)
        {
            RetMessage <Order> rm = new RetMessage <Order>();

            if (tokenId != null)
            {
                string useridandopenid = ut.getUserIDAndOpenIDByToken_og(tokenId);


                if (useridandopenid == null)
                {
                    //错误返回;
                    rm.RetCode  = -7;
                    rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                }
                else
                {
                    string[] buff      = useridandopenid.Split('|');
                    string   userid    = buff[0];
                    string   openid    = buff[1];
                    string   strcode   = null;
                    string   total_fee = null;
                    using (organizeEntities db = new organizeEntities())
                    {
                        //取资料主档信息
                        ogquestionnaire cc = new  ogquestionnaire();
                        cc = db.ogquestionnaire.Find(dataId);
                        if (cc == null)
                        {
                            rm.RetCode  = -6;
                            rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                            return(rm);
                        }
                        string[] levelBuff = cc.level.Split(',');
                        strcode   = "全国BIM等级考试缴费[" + cc.level + "]";
                        total_fee = (int.Parse(ut.getAppSetting(13)) * levelBuff.Count() * 100).ToString();
                    }
                    string wx_appid        = ut.getAppSetting(11);
                    string wx_mch_id       = ut.getAppSetting(1);
                    string wx_nonce_str    = ut.getRandomString(20);
                    byte[] buffer          = Encoding.UTF8.GetBytes(strcode);
                    string wx_body         = Encoding.UTF8.GetString(buffer, 0, buffer.Length);
                    string wx_out_trade_no = DateTime.Now.ToString("yyyyMMddHHmmss") + ut.getRandomString(10);
                    string wx_total_fee    = ((int)(decimal.Parse(total_fee))).ToString();//unit:fen
                    //string wx_total_fee = "1";//unit:fen
                    //string wx_spbill_create_ip = GetWebClientIp();
                    //string wx_spbill_create_ip = "59.110.164.24";
                    string wx_spbill_create_ip = ut.getAppSetting(4);
                    string wx_notify_url       = ut.getAppSetting(3);
                    string wx_trade_type       = ut.getAppSetting(5);
                    var    dic = new Dictionary <string, string> {
                        { "appid", wx_appid },
                        { "body", wx_body },
                        { "mch_id", wx_mch_id },
                        { "nonce_str", wx_nonce_str },
                        { "notify_url", wx_notify_url },
                        { "openid", openid },
                        { "out_trade_no", wx_out_trade_no },
                        { "spbill_create_ip", wx_spbill_create_ip },
                        { "total_fee", wx_total_fee },
                        { "trade_type", wx_trade_type }
                    };
                    dic.Add("sign", ut.GetSignString(dic));
                    var sb = new StringBuilder();
                    sb.Append("<xml>");
                    foreach (var d in dic)
                    {
                        sb.Append("<" + d.Key + ">" + d.Value + "</" + d.Key + ">");
                    }
                    sb.Append("</xml>");
                    string       response = ut.CreatedPostHttpResponse("https://api.mch.weixin.qq.com/pay/unifiedorder", sb);
                    byte[]       array    = Encoding.UTF8.GetBytes(response);
                    MemoryStream ms       = new MemoryStream(array);
                    StreamReader sr       = new StreamReader(ms);
                    string       html     = sr.ReadToEnd();
                    var          xml      = new XmlDocument();
                    xml.LoadXml(response);
                    var                 root   = xml.DocumentElement;
                    StringReader        stram  = new StringReader(html);
                    XmlTextReader       reader = new XmlTextReader(stram);
                    System.Data.DataSet ds     = new System.Data.DataSet();
                    ds.ReadXml(reader);
                    string return_code = ds.Tables[0].Rows[0]["return_code"].ToString();
                    if (return_code.ToUpper() == "SUCCESS")
                    {
                        using (organizeEntities db = new organizeEntities())
                        {
                            string  strNow = DateTime.Now.ToString("u");
                            payinfo pi     = new payinfo();
                            pi.dataid  = dataId;
                            pi.paydate = strNow.Substring(0, 10);
                            pi.paytime = strNow.Substring(10, 8);
                            //(int)decimal.Parse(total_fee)*100
                            pi.paymount     = total_fee;//total_fee
                            pi.out_trade_no = wx_out_trade_no;
                            pi.userid       = userid;
                            db.payinfo.Add(pi);
                            db.SaveChanges();
                        }
                        //wx_out_trade_no
                        var res = new Dictionary <string, string> {
                            { "appID", wx_appid },
                            { "nonceStr", ds.Tables[0].Rows[0]["nonce_str"].ToString() },
                            { "package", "prepay_id=" + ds.Tables[0].Rows[0]["prepay_id"].ToString() },
                            { "signType", "MD5" },
                            { "timeStamp", ut.GetTimeStamp() },
                        };
                        res.Add("paySign", ut.GetSignString(res));
                        List <Order> orderArray = new List <Order>();
                        Order        order      = new Order();
                        order.timeStamp       = res["timeStamp"];
                        order.nonceStr        = res["nonceStr"];
                        order.package         = res["package"];
                        order.paySign         = res["paySign"];
                        order.wx_out_trade_no = wx_out_trade_no;
                        rm.RetCode            = 0;
                        orderArray.Add(order);
                        rm.data = orderArray;
                    }
                    else
                    {
                        rm.RetCode  = -2;
                        rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                    }
                }
            }
            else
            {
                rm.RetCode  = -3;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
            }
            return(rm);
        }
コード例 #23
0
        public RetMessage <string> ogenroll()
        {
            RetMessage <string> rm = new RetMessage <string>();
            string tokenId         = "";

            try
            {
                tokenId = HttpContext.Current.Request["tokenId"];
            }
            catch
            {
                rm.RetCode  = 98;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }

            string userid = ut.getUserIDByToken_og(tokenId);

            if (userid == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }

            HttpFileCollection files   = HttpContext.Current.Request.Files;
            string             fileurl = "";

            foreach (string f in files.AllKeys)
            {
                HttpPostedFile file = files[f];
                fileurl = file.FileName;

                if (string.IsNullOrEmpty(file.FileName) == false)
                {
                    file.SaveAs(HttpContext.Current.Server.MapPath("~/App_Data/") + file.FileName);
                }
            }
            int ogquestionnaireID = 0;

            using (organizeEntities db = new organizeEntities())
            {
                ogquestionnaire cc = new ogquestionnaire();
                cc.name         = HttpContext.Current.Request["name"].ToString();
                cc.birthday     = HttpContext.Current.Request["birthday"].ToString();
                cc.sex          = HttpContext.Current.Request["sex"].ToString();
                cc.nativeplace  = HttpContext.Current.Request["nativeplace"].ToString();
                cc.nations      = HttpContext.Current.Request["nations"].ToString();
                cc.level        = HttpContext.Current.Request["level"].ToString();
                cc.identitycard = HttpContext.Current.Request["identitycard"].ToString();
                cc.educated     = HttpContext.Current.Request["educated"].ToString();
                cc.unit         = HttpContext.Current.Request["unit"].ToString();
                cc.address      = HttpContext.Current.Request["address"].ToString();
                cc.mobile       = HttpContext.Current.Request["mobile"].ToString();
                cc.membersflag  = int.Parse(HttpContext.Current.Request["membersflag"].ToString());
                cc.place        = HttpContext.Current.Request["place"].ToString();
                cc.qqid         = HttpContext.Current.Request["qqid"].ToString();
                cc.picurl       = fileurl;
                cc.userid       = userid;
                db.ogquestionnaire.Add(cc);
                db.SaveChanges();
                ogquestionnaireID = cc.qid;
            }

            List <string> ListRetArrys = new List <string>();

            ListRetArrys.Add(ogquestionnaireID.ToString());
            rm.data    = ListRetArrys;
            rm.RetCode = 0;
            return(rm);
        }
コード例 #24
0
            public void deactivate(out RetMessage retMessage)
            {
                Z.deactivate(out retMessage);

                homingZ.deactivate(out retMessage);
            }
コード例 #25
0
        public void activate(string portName, int baudRate, Parity parity, int dataBits, StopBits stopBits, out RetMessage retMessage)
        {
            try
            {
                if (dev.NotExistHW.LIGHTING)
                {
                    retMessage = RetMessage.OK; return;
                }
                if (isActivate)
                {
                    retMessage = RetMessage.OK; return;
                }
                //comPort = new SerialPort(portName, baudRate, parity, dataBits, stopBits);
                comPort.PortName = portName;
                comPort.BaudRate = baudRate;
                comPort.Parity   = parity;
                comPort.DataBits = dataBits;
                comPort.StopBits = stopBits;

                comPort.WriteBufferSize = 2048;
                STX[0] = 0x02;
                ETX[0] = 0x03;
                comPort.Open();
                if (!comPort.IsOpen)
                {
                    retMessage = RetMessage.INVALID; return;
                }
                rcvMsg     = comPort.ReadExisting();
                retMessage = RetMessage.OK;
                isActivate = true;
            }
            catch
            {
                retMessage = RetMessage.INVALID;
                isActivate = false;
            }
        }
コード例 #26
0
        public RetMessage <ViewPayInfoModel> GetDataInfoOwn(string strTokenid)
        {
            RetMessage <ViewPayInfoModel> rm = new RetMessage <ViewPayInfoModel>();
            string l_strTokenid = "zb";

            if (strTokenid != null && strTokenid.Trim() != "")
            {
                l_strTokenid = strTokenid;
            }
            l_strTokenid = ut.getUserIDByToken_og(strTokenid);
            if (l_strTokenid == null)
            {
                rm.RetCode  = 99;
                rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
                return(rm);
            }

            //已购买的后台方法
            List <ViewPayInfoModel> ListRetArrys = new List <ViewPayInfoModel>();

            using (organizeEntities db = new organizeEntities())
            {
                List <payinfo> ups = new List <payinfo>();
                ups = db.payinfo.Where(x => x.userid == l_strTokenid && x.transaction_id != null).ToList();
                if (ups != null && ups.ToList().Count > 0)
                {
                    List <int> dataids = new List <int>();
                    foreach (var vps in ups)
                    {
                        dataids.Add((int)vps.dataid);
                    }

                    List <datainfo> datainfos = new List <datainfo>();
                    datainfos = db.datainfo.Where(x => dataids.Contains(x.dataid)).ToList();

                    foreach (var pi in ups)
                    {
                        ViewPayInfoModel vpm = new ViewPayInfoModel();
                        vpm.dataid   = pi.dataid;
                        vpm.paydate  = pi.paydate;
                        vpm.payid    = pi.payid;
                        vpm.paymount = pi.paymount;
                        vpm.paytime  = pi.paytime;
                        vpm.userid   = null;
                        foreach (var cc in datainfos)
                        {
                            if (cc.dataid == vpm.dataid)
                            {
                                vpm.dataInfo  = cc.title;
                                vpm.picurd    = cc.picurd;
                                vpm.picurs    = cc.picurs;
                                vpm.signature = cc.signature;
                                vpm.url       = cc.url;
                            }
                        }
                        ListRetArrys.Add(vpm);
                    }
                }
            }
            rm.RetCode = 0;
            rm.data    = ListRetArrys;
            return(rm);
        }
コード例 #27
0
ファイル: classPusher.cs プロジェクト: lim98729/PSA-10S
        public void jogMove(double posX, out RetMessage retMessage)
        {
            pusher_finish = false;
            X.move(posX, out retMessage); if (retMessage != RetMessage.OK)
            {
                goto FAIL;
            }
            #region endcheck
            dwell.Reset();
            while (true)
            {
                mc.idle(10);
                //mc.IN.PS.JAM_IN(out ret.b2, out ret.message);
                //if (ret.b2)
                //{
                //    X.stop(out ret.message);
                //    retMessage = RetMessage.JAM_SENSOR_DETECT_ERROR;
                //    goto FAIL;
                //}
                if (dwell.Elapsed > 20000)
                {
                    retMessage = RetMessage.TIMEOUT; goto FAIL;
                }
                X.AT_TARGET(out ret.b, out retMessage); if (retMessage != RetMessage.OK)
                {
                    goto FAIL;
                }
                if (ret.b)
                {
                    break;
                }
            }
            dwell.Reset();
            while (true)
            {
                mc.idle(10);
                //mc.IN.PS.JAM_IN(out ret.b2, out ret.message);
                //if (ret.b2)
                //{
                //    X.stop(out ret.message);
                //    retMessage = RetMessage.JAM_SENSOR_DETECT_ERROR;
                //    goto FAIL;
                //}
                if (dwell.Elapsed > 500)
                {
                    retMessage = RetMessage.TIMEOUT; goto FAIL;
                }
                X.AT_DONE(out ret.b, out retMessage); if (retMessage != RetMessage.OK)
                {
                    goto FAIL;
                }
                if (ret.b)
                {
                    break;
                }
            }
            return;

            #endregion
FAIL:
            mc.init.success.PS = false;
            return;
        }
コード例 #28
0
ファイル: RobotController.cs プロジェクト: newmurk/zzlserver
        public RetMessage <string> getAnswers()
        {
            RetMessage <string> rm = new RetMessage <string>();

            /*
             * byte[] byts = new byte[HttpContext.Current.Request.InputStream.Length];
             * System.Web.HttpContext.Current.Request.InputStream.Position = 0;
             * HttpContext.Current.Request.InputStream.Read(byts, 0, byts.Length);
             * string req = Encoding.UTF8.GetString(byts);
             * byte[] array = Encoding.UTF8.GetBytes(req);
             * MemoryStream ms = new MemoryStream(array);
             * StreamReader sr = new StreamReader(ms);
             * string html = sr.ReadToEnd();
             *
             * JsonData data = JsonMapper.ToObject(html);
             * string tokenId = data["tokenId"].ToString();
             *
             * string userid = ut.getUserIDByToken(tokenId);
             * if (userid == null)
             * {
             *  rm.RetCode = 99;
             *  rm.ErrorMsg = ut.getErrMessage(rm.RetCode);
             *  return rm;
             *
             * }*/
            /*
             *  var url = 'http://www.tuling123.com/openapi/api?key=eeec171e907553c15aa3131562f75903&info=' + info;
             * wx.request( {
             * url: url,
             * data: {
             *
             * },
             * header: {
             * 'Content-Type': 'application/json'
             * },
             * success: function( res ) {
             * console.log( res.data )
             * typeof cb == "function" && cb( res.data )
             * }
             */
            /*
             * API地址:
             * http://www.tuling123.com/openapi/api
             * APIkey:
             * 5efbdf4d27bf4b4a9cb709caf7c83a31
             * secret:
             * 47526d089c54663e
             * ON
             *
             *
             *  //生成密钥
             *  String keyParam = secret+timestamp+apiKey;
             *  String key = Md5.MD5(keyParam);
             */
            /*
             * string timestamp=ut.GetTimeStamp();
             * const string secret= "47526d089c54663e";
             *
             * string keyParam = secret + timestamp + aPIkey;
             * MD5 md5 = new MD5CryptoServiceProvider();
             * byte[] result = Encoding.UTF8.GetBytes(keyParam);
             * byte[] output = md5.ComputeHash(result);
             * string str = BitConverter.ToString(output);
             * Aes.Create(str);
             *
             * rebotUrlObject rbuo = new rebotUrlObject();
             * rbuo.key = aPIkey;
             * rbuo.timestamp = timestamp;
             * rbuo.data = str;*/
            const string aPIkey   = "5efbdf4d27bf4b4a9cb709caf7c83a31";
            var          sb       = new StringBuilder();
            var          formVars = new Dictionary <string, string>();

            formVars.Add("key", aPIkey);
            formVars.Add("info", "bim是什么");
            foreach (var d in formVars)
            {
                sb.Append(d.Key + ":" + d.Value);
            }
            string response = ut.CreatedPostHttpResponse("http://www.tuling123.com/openapi/api", sb);



            JsonData jd = new JsonData();

            jd["key"] = aPIkey;
            //         jd["timestamp"] = timestamp;//**新添加一层关系时,需要再次 new** JsonData()
            jd["info"] = "bim是什么";


            var content = new FormUrlEncodedContent(formVars);

            var client  = new HttpClient();
            var postUrl = "http://www.tuling123.com/openapi/api";
            var task    = client.PostAsync(postUrl, content).Result; //参数未进行序列化
            var cc      = task.RequestMessage.ToString();



            //http://www.tuling123.com/openapi/api?key=5efbdf4d27bf4b4a9cb709caf7c83a31&info=bim是什么
            var url        = "http://www.tuling123.com/openapi/api";
            var httpClient = new HttpClient();
            // var responseJson = httpClient.PostAsJsonAsync(url, jd.ToString()).Result.Content.ReadAsStringAsync().Result;
            var responseJson = httpClient.PostAsJsonAsync(url, jd.ToString()).Result.Content.ReadAsStringAsync().Result;

            /*
             * using (dataserverEntities db = new dataserverEntities())
             * {
             *  syslog sl = new syslog();
             *  sl.logcontent = html;
             *  db.syslog.Add(sl);
             *  db.SaveChanges();
             *  int dataid = 0;
             *  if (data["dataid"] != null)
             *      dataid = int.Parse(data["dataid"].ToString());
             *  questionnaire cc = new questionnaire();
             *  cc.name = data["name"].ToString();
             *  cc.age = data["age"].ToString();
             *  cc.company = data["company"].ToString();
             *  cc.position = data["position"].ToString();
             *  cc.mobile = data["mobile"].ToString();
             *  cc.email = data["email"].ToString();
             *  cc.area = data["area"].ToString();
             *  cc.userid = userid;
             *  cc.dataid = dataid;
             *  db.questionnaire.Add(cc);
             *  db.SaveChanges();
             * }*/
            rm.RetCode = 0;
            return(rm);
        }
コード例 #29
0
ファイル: FormLoadcellCalib.cs プロジェクト: lim98729/PSA-10S
        private void GetHeightOffset(int head, double targetForce, out RetMessage message)
        {
            #region moving
            double posX = mc.hd.tool.tPos.x[head].LOADCELL;
            double posY = mc.hd.tool.tPos.y[head].LOADCELL;
            double posZ = mc.hd.tool.tPos.z[head].XY_MOVING;
            double posT = mc.para.CAL.toolAngleOffset[head].value;
            mc.hd.tool.jogMove(head, posX, posY, posZ, posT, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); message = ret.message;  return;
            }
            #endregion

            // 1. 무빙 위치로 이동
            posZ = mc.hd.tool.tPos.z[head].XY_MOVING;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); message = ret.message; return;
            }
            mc.idle(100);

            // 2. 로드셀 초기화 한다.
            mc.loadCell.setZero(head);
            mc.loadCell.setZero((int)UnitCodeLoadcell.CAL);

            // 3. 로드셀 위치에서 위로 1000 um 까지 이동
            posZ = mc.hd.tool.tPos.z[head].LOADCELL + 1000;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); message = ret.message; return;
            }
            mc.idle(100);

            // 4. 로드셀 위치로 이동
            posZ = mc.hd.tool.tPos.z[head].LOADCELL;
            mc.hd.tool.jogMove(head, posZ, out ret.message); if (ret.message != RetMessage.OK)
            {
                mc.message.alarmMotion(ret.message); message = ret.message; return;
            }

            // 5. 100 um 단위로 내려가며 찾기 시작
            mc.idle(500);
            double curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
            ret.d1 = mc.loadCell.getData((int)UnitCodeLoadcell.TOP1);

            LB_BottomLC.Text = curLoadcell.ToString("f3");
            LB_HeadLC.Text   = ret.d1.ToString("f3");

            bool moveError = false;
            while (curLoadcell < targetForce)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                ret.d1      = mc.loadCell.getData((int)UnitCodeLoadcell.TOP1);

                LB_BottomLC.Text = curLoadcell.ToString("f3");
                LB_HeadLC.Text   = ret.d1.ToString("f3");

                mc.hd.tool.jogMovePlus(head, -100, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    message   = ret.message;
                    moveError = true;
                    break;
                }
                mc.idle(100);
            }

            // 6. 10 um 단위로 올라가며 찾기 시작
            mc.idle(500);

            curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);

            while (!moveError && curLoadcell > targetForce)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                ret.d1      = mc.loadCell.getData((int)UnitCodeLoadcell.TOP1);

                LB_BottomLC.Text = curLoadcell.ToString("f3");
                LB_HeadLC.Text   = ret.d1.ToString("f3");

                mc.hd.tool.jogMovePlus(head, 10, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    message   = ret.message;
                    moveError = true;
                    break;
                }
                mc.idle(500);
            }

            // 7. 1 um 단위로 내려가며 찾기 시작
            mc.idle(500);
            curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
            ret.d1      = mc.loadCell.getData((int)UnitCodeLoadcell.TOP1);

            LB_BottomLC.Text = curLoadcell.ToString("f3");
            LB_HeadLC.Text   = ret.d1.ToString("f3");

            while (!moveError && Math.Abs(curLoadcell - targetForce) > 0.01)
            {
                curLoadcell = mc.loadCell.getData((int)UnitCodeLoadcell.CAL);
                ret.d1      = mc.loadCell.getData((int)UnitCodeLoadcell.TOP1);

                LB_BottomLC.Text = curLoadcell.ToString("f3");
                LB_HeadLC.Text   = ret.d1.ToString("f3");

                mc.hd.tool.jogMovePlus(head, -1, out ret.message);
                if (ret.message != RetMessage.OK)
                {
                    mc.message.alarmMotion(ret.message);
                    message   = ret.message;
                    moveError = true;
                    break;
                }
                mc.idle(500);
            }

            if (!moveError)
            {
                message = RetMessage.OK;
            }
            else
            {
                message = ret.message;
            }
        }