Beispiel #1
0
        private void tb_matuo_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                //Matuo comes
                try
                {
                    if (this.tb_matuo.Text != "")
                    {
                        API.APIRE_Package apk = API.APIWorker.getCheckPalletSn(this.tb_matuo.Text);

                        this.lb_info.Text = "包裹数量:" + apk.num.ToString();
                        int count = apk.list.Count();
                        for (int i = 0; i < count; i++)
                        {
                            this.listBox1.Items.Add(apk.list[i].tracking_number);
                            this.listBox1.Items.Add(apk.list[i].shipping_name);
                        }
                    }
                }
                catch (Exception ex)
                {
                    //MessageBox.Show(ex.Message);
                    this.lb_info.Text = ex.Message;
                }
            }
        }
Beispiel #2
0
        public static API.APIRE_Package checkPalletSn(String matuo)
        {
            try
            {
                String url = "shippment/checkPalletSn";
                //url = "checkPalletSn";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("pallet_sn", matuo);

                HttpWebResponse response = null;
                //HttpWebResponse
                String json = APIWorkerImpl.callApi(url, parameters);

                String  errCode = "0000";
                JObject obj     = APIWorkerImpl.processJSON(json, out errCode);

                if (obj != null)
                {
                    ArrayList list = new ArrayList();

                    API.APIRE_Package apk = new APIRE_Package();

                    JArray array = (JArray)obj["ship"];

                    apk.num = (obj["num"].Value <int>());
                    Console.WriteLine(obj["num"].Value <int>());
                    for (int i = 0; i < array.Count; i++)
                    {
                        APIRE_Ship s = new APIRE_Ship();
                        s.tracking_number = array[i].Value <String>("tracking_number");

                        s.shipping_name = array[i].Value <String>("shipping_name");

                        apk.list.Add(s);
                    }
                    return(apk);
                }
                else
                {
                    throw new Exception("该托盘条码不存在!");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                throw e;
            }
        }