Exemplo n.º 1
0
        private bool SendToErp(string url, string methodName, string paramStr)
        {
            try
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();
                dic.Add("method", methodName);
                dic.Add("param", paramStr);
                string restr   = APIRequst.Send("POST", url, dic);
                var    jObject = JObject.Parse(restr);
                int    total   = int.Parse(jObject["Total"].ToString());
                string desc    = jObject["Desc"].ToString();
                string log     = "发送数据:" + paramStr + ",erp返回:" + restr;

                this.iWmsFrame.WriteLog("应用主程序逻辑", "上报ERP", EnumLoglevel.提示.ToString(), log);
                if (total > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                this.iWmsFrame.WriteLog("应用主程序逻辑", "上报ERP", EnumLoglevel.错误.ToString(), "向ERP发送数据失败:数据" + paramStr + ",系统报错:" + ex.Message);
                return(false);
            }
        }
Exemplo n.º 2
0
 private string SendToErp(string url, string methodName, string paramStr)
 {
     try
     {
         Dictionary <string, string> dic = new Dictionary <string, string>();
         dic.Add("method", methodName);
         dic.Add("param", paramStr);
         string restr = APIRequst.Send("POST", url, dic);
         string log   = "发送数据:" + paramStr + ",erp返回:" + restr;
         return(log);
     }
     catch (Exception ex)
     {
         return("");
     }
 }
Exemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            string str = "";
            bool   ob  = WCFHelper.WebHttpPost(this.tb_SvrAddr.Text.Trim(), this.tb_json.Text.Trim(), out str);
            Dictionary <string, string> dic = new Dictionary <string, string>();

            //dic.Add("method","puApi");

            dic.Add("method", "produceApi");
            dic.Add("param", this.tb_json.Text.Trim());
            str = APIRequst.Send("POST", this.tb_SvrAddr.Text.Trim(), dic);

            str = SendToErp(this.tb_SvrAddr.Text.Trim(), "MaterialInfo", this.tb_json.Text.Trim());
            //var jObject = JObject.Parse(str);
            //string desc = jObject["Desc"].ToString();
            //if(desc!="")
            //{ }
            //ErpResponse erpRes = (ErpResponse)Newtonsoft.Json.JsonConvert.DeserializeObject(str);
            MessageBox.Show(str);
        }