예제 #1
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;
            }
        }
예제 #2
0
 public static Boolean appLogout()
 {
     try
     {
         String url = "appLogout";
         Dictionary <string, string> parameters = new Dictionary <string, string>();
         HttpWebResponse             response   = null;
         String  json    = APIWorkerImpl.callApi(url, parameters);
         String  errCode = "0000";
         JObject obj     = APIWorkerImpl.processJSON(json, out errCode);
         return(obj != null);
     }
     catch (Exception e)
     {
         Console.WriteLine("TO Logout for " + UserSessionAgent.token);
         Console.WriteLine(e);
         return(false);
     }
 }
예제 #3
0
        public static List <API.APIRE_PhysicalWarehouse> appIndex()
        {
            try
            {
                string tagUrl = "appIndex";

                Dictionary <string, string> parameters = new Dictionary <string, string>();

                HttpWebResponse response = null;

                String json = APIWorkerImpl.callApi(tagUrl, parameters);

                String  errCode = "0000";
                JObject obj     = APIWorkerImpl.processJSON(json, out errCode);
                if (obj != null)
                {
                    JArray array = (JArray)obj["pwarehouseList"];


                    List <API.APIRE_PhysicalWarehouse> list = new List <APIRE_PhysicalWarehouse>();
                    for (int i = 0; i < array.Count; i++)
                    {
                        API.APIRE_PhysicalWarehouse pw = new API.APIRE_PhysicalWarehouse();
                        pw.warehouse_name        = array[i]["warehouse_name"].Value <String>();
                        pw.physical_warehouse_id = (array[i]["physical_warehouse_id"].Value <int>());
                        list.Add(pw);
                    }

                    return(list);
                }
                else
                {
                    throw new Exception(errCode);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
                throw e;
            }
        }
예제 #4
0
        public static String appLogin(int facility_code, String username, String password, String mid, out String errCode)
        {
            try
            {
                String url = "appLogin";
                Dictionary <string, string> parameters = new Dictionary <string, string>();
                parameters.Add("username", username);
                parameters.Add("password", password);
                //parameters.Add("sid", "");
                parameters.Add("hardwareCode", mid);
                parameters.Add("physical_warehouse_id", ("" + facility_code));

                HttpWebResponse response = null;
                String          json     = APIWorkerImpl.callApi(url, parameters);
                Console.WriteLine(json);
                errCode = "0000";
                JObject obj = APIWorkerImpl.processJSON(json, out errCode);
                if (obj != null)
                {
                    String token = obj["sid"].Value <String>();
                    if (token != null)
                    {
                        return(token);
                    }
                    else
                    {
                        throw new Exception("Empty Token Error");
                    }
                }
                else
                {
                    throw new Exception("JSON Response Parse Error");
                }
            }
            catch (Exception e)
            {
                errCode = e.Message;
                return(null);
            }
        }