public async void PostToIon()
        {
            IonReponse     result         = new IonReponse();
            JArray         items          = new JArray();
            PackController packController = new PackController();
            string         url            = Constant.ION_SKU_ENTERPRISE_URL_SOUTH;

            items = this.Create_ModelSku();
            DataTable dtToken = DAL.GetNewToken();

            if (dtToken.Rows.Count > 0)
            {
                token   = dtToken.Rows[0]["AccessToken"].ToString();
                endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
            }
            foreach (JObject item in items)
            {
                DateTime now     = DateTime.Now;
                int      resDate = DateTime.Compare(endTime, now);
                if (resDate < 0 || resDate == 0)
                {
                    dtToken = DAL.GetNewToken();
                    if (dtToken.Rows.Count > 0)
                    {
                        token   = dtToken.Rows[0]["AccessToken"].ToString();
                        endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
                    }
                }
                System.Threading.Thread.Sleep(3000);
                string category = "Sku_Interprise_South";
                string sku_code = item.GetValue("sku").ToString().Trim();
                sku_code = DAL.GetString(sku_code, 8);

                bool checkPack = await packController.PostPack_ToIon_South(token, sku_code, "NEW");

                //if (checkPack)
                //{
                result = await ClientHttpController.Post(item, url, token);

                if (!result.check)
                {
                    result.RecordResultAPI(category, sku_code);
                    continue;
                }
                else
                {
                    this.PostToIon_Warehouse(item, token, sku_code);
                }

                //}
                //else
                //{
                //    DAL.UpdateStatus(sku_code, "ERROR_PACK", "SKU_SOUTH");
                //    continue;
                //}
            }
        }
Beispiel #2
0
        public async void PostToIon_Xdock()
        {
            IonReponse result = new IonReponse();
            JArray     jArray = new JArray();

            string url      = Constant.ION_SO_URL_NORTH;
            string category = "XDOCK";

            jArray = this.Create_ModelSO_Xdock();

            DataTable dtToken = DAL.GetNewToken();

            if (dtToken.Rows.Count > 0)
            {
                token   = dtToken.Rows[0]["AccessToken"].ToString();
                endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
            }

            foreach (JObject so in jArray)
            {
                DateTime now     = DateTime.Now;
                int      resDate = DateTime.Compare(endTime, now);
                if (resDate < 0 || resDate == 0)
                {
                    dtToken = DAL.GetNewToken();
                    if (dtToken.Rows.Count > 0)
                    {
                        token   = dtToken.Rows[0]["AccessToken"].ToString();
                        endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
                    }
                }
                System.Threading.Thread.Sleep(3000);
                var orderkey_mm = so.GetValue("orderkey").ToString().Trim();
                var pokey_mm    = so.GetValue("pokey").ToString().Trim();

                orderkey_mm = DAL.GetString(orderkey_mm, 17);
                pokey_mm    = DAL.GetString(pokey_mm, 17);

                result = await ClientHttpController.Post(so, url, token);

                if (result.check)
                {
                    DAL.UpdateStatus(pokey_mm, orderkey_mm, category);
                }
                else
                {
                    result.RecordResultAPI("XDOCK_NORTH", orderkey_mm);
                }
            }
        }
Beispiel #3
0
        public async void PostToIon_North()
        {
            IonReponse result    = new IonReponse();
            JArray     suppliers = new JArray();

            string url = Constant.ION_SUPPLIER_URL_NORTH;

            suppliers = this.CreateModelSupplier("NORTH");

            DataTable dtToken = DAL.GetNewToken();

            if (dtToken.Rows.Count > 0)
            {
                token   = dtToken.Rows[0]["AccessToken"].ToString();
                endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
            }

            foreach (JObject supplier in suppliers)
            {
                DateTime now     = DateTime.Now;
                int      resDate = DateTime.Compare(endTime, now);

                if (resDate < 0 || resDate == 0)
                {
                    if (dtToken.Rows.Count > 0)
                    {
                        token   = dtToken.Rows[0]["AccessToken"].ToString();
                        endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
                    }
                }
                System.Threading.Thread.Sleep(3000);

                string supplier_code = supplier.GetValue("storerkey").ToString().Trim();

                supplier_code = DAL.GetString(supplier_code, 6);

                string category = "Supplier_North";

                result = await ClientHttpController.Post(supplier, url, token);

                if (result.check)
                {
                    DAL.UpdateStatus(supplier_code, "OK", category);
                }
                else
                {
                    result.RecordResultAPI(category, supplier_code);
                }
            }
        }
        public async void PostToIon()
        {
            IonReponse result = new IonReponse();
            JArray     Pos    = new JArray();

            string category = "PO";
            string url      = Constant.ION_PO_URL_SOUTH;

            Pos = this.Create_ModelPo();
            DataTable dtToken = DAL.GetNewToken();

            if (dtToken.Rows.Count > 0)
            {
                token   = dtToken.Rows[0]["AccessToken"].ToString();
                endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
            }

            foreach (JObject po in Pos)
            {
                DateTime now     = DateTime.Now;
                int      resDate = DateTime.Compare(endTime, now);

                if (resDate < 0 || resDate == 0)
                {
                    if (dtToken.Rows.Count > 0)
                    {
                        token   = dtToken.Rows[0]["AccessToken"].ToString();
                        endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
                    }
                }

                System.Threading.Thread.Sleep(3000);
                var pokey_mm    = po.GetValue("externpokey").ToString().Trim();
                var pokey_infor = po.GetValue("pokey").ToString().Trim();

                result = await ClientHttpController.Post(po, url, token);

                if (result.check)
                {
                    DAL.UpdateStatus(pokey_mm, pokey_infor, category);
                }
                else
                {
                    //DAL.UpdateStatus(pokey_mm, "ERROR", category);
                    result.RecordResultAPI("PO_SOUTH", pokey_mm);
                }
            }
        }
Beispiel #5
0
        public async void PostToIon()
        {
            IonReponse result = new IonReponse();
            JArray     asns   = new JArray();

            string category = "ASN_SOUTH";
            string url      = Constant.ION_ASN_URL_SOUTH;

            asns = this.Create_ModelAsn();
            DataTable dtToken = DAL.GetNewToken();

            if (dtToken.Rows.Count > 0)
            {
                token   = dtToken.Rows[0]["AccessToken"].ToString();
                endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
            }

            foreach (JObject asn in asns)
            {
                DateTime now     = DateTime.Now;
                int      resDate = DateTime.Compare(endTime, now);
                if (resDate < 0 || resDate == 0)
                {
                    dtToken = DAL.GetNewToken();
                    if (dtToken.Rows.Count > 0)
                    {
                        token   = dtToken.Rows[0]["AccessToken"].ToString();
                        endTime = DateTime.Parse(dtToken.Rows[0]["EndTime"].ToString());
                    }
                }
                System.Threading.Thread.Sleep(3000);
                var pokey_mm = asn.GetValue("pokey").ToString().Trim();
                pokey_mm = DAL.GetString(pokey_mm, 17);
                var receiptkey = asn.GetValue("receiptkey").ToString().Trim();

                result = await ClientHttpController.Post(asn, url, token);

                if (result.check)
                {
                    DAL.UpdateStatus(pokey_mm, receiptkey, category);
                }
                else
                {
                    result.RecordResultAPI(category, pokey_mm);
                }
            }
        }