Exemplo n.º 1
0
        private void sendDetailData(string DataType, string jsonText
                                    , string operatType, string id, string remark)
        {
            string appendUrl = @"/" + DataType + @"/" + operatType;
            string urlModel  = txtUrl + appendUrl + @"?Token=";

            //测试账套
            //sendData2Db(urlModel , Token_test, jsonText, id);

            //无锡宏拓
            if (remark.Contains(Token_WXHT.CompanyName) || string.IsNullOrEmpty(remark))
            {
                sendData2Db(urlModel, Token_WXHT, jsonText, id);
            }

            //湖南宏工
            if (remark.Contains(Token_HNHG.CompanyName) || string.IsNullOrEmpty(remark))
            {
                sendData2Db(urlModel, Token_HNHG, jsonText, id);
            }

            //根据id更新推送状态
            string updateSql = string.Format(@"
                    UPDATE TESTDB.DBO.Synchronize_DataTable
                    SET isFinish = 1
                    WHERE ID={0}
                    ", id);

            DBCONN.Query(updateSql);
        }
Exemplo n.º 2
0
        public void sendData2Db(string urlModel, TokenClazz Token, string jsonText, string id)
        {
            //湖南宏工账套项目号不一致
            if (Token.CompanyName.Equals("湖南宏工"))
            {
                urlModel = urlModel.Replace("ItemClass3003", "ItemClass3002");
            }


            string url          = urlModel + Token.getToken();
            string httpResponse = string.Empty;

            byte[] data = System.Text.Encoding.UTF8.GetBytes(jsonText);
            bool   flag = HttpHelper.HttpPost(url, data, out httpResponse, 6000);


            JObject jo = new JObject();

            try
            {
                jo = (JObject)JsonConvert.DeserializeObject(httpResponse);
            }catch (Exception e)
            {
                return;
            }

            string StatusCode = "";
            string Message    = "";
            string Data       = "";

            StatusCode = null == jo["StatusCode"] ? "" : jo["StatusCode"].ToString();
            Message    = null == jo["Message"] ? "" : jo["Message"].ToString();
            Data       = null == jo["Data"] ? "" :  jo["Data"].ToString();

            //根据id更新推送状态
            string updateSql = string.Format(@"
                    INSERT INTO Synchronize_Log 
                    (DbName,SynID,JsonText_Msg,InsDate,SuccessCode,MsgText,DataText)
                    VALUES ( '{0}', {1} , '{2}',CONVERT(VARCHAR(23),GETDATE(),121), '{3}', '{4}', '{5}' )
                    ", Token.CompanyName, id, jo.ToString(), StatusCode, Message, Data);

            DBCONN.Query(updateSql);
        }
Exemplo n.º 3
0
        //同步差异物料组及物料号
        private void SnychronizeError()
        {
            string sql = @"EXEC TESTDB.DBO.Snychronize_error";

            DBCONN.Query(sql);
        }