public async void PostToIon_Warehouse(JObject model, string token, string sku)
        {
            IonReponse result  = new IonReponse();
            JArray     altSkus = new JArray();

            string url = Constant.ION_SKU_WAREHOUSE_URL_SOUTH;

            altSkus = this.Create_ModelAltSku(sku);

            model.Add("altSkus", altSkus);

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

            string category = "Sku_Warehouse_South";

            if (result.check)
            {
                DAL.UpdateStatus(sku, "OK", "SKU_SOUTH");
            }
            else
            {
                result.RecordResultAPI(category, sku);
                DAL.UpdateStatus(sku, "ERROR_WAREHOUSE", "SKU_SOUTH");
            }
        }
Exemple #2
0
        public async void PostToIon()
        {
            IonReponse     result         = new IonReponse();
            JArray         items          = new JArray();
            PackController packController = new PackController();
            string         url            = Constant.ION_SKU_ENTERPRISE_URL_NORTH;

            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_North";
                string sku_code = item.GetValue("sku").ToString().Trim();
                sku_code = DAL.GetString(sku_code, 8);

                bool checkPack = await packController.PostPack_ToIon(token, sku_code);

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

                    if (!result.check)
                    {
                        result.RecordResultAPI(category, sku_code);
                        DAL.UpdateStatus(sku_code, "ERROR_ENTERPRISE", "SKU_NORTH");
                        continue;
                    }
                    else
                    {
                        this.PostToIon_Warehouse(item, token, sku_code);
                    }
                }
                else
                {
                    DAL.UpdateStatus(sku_code, "ERROR_PACK", "SKU_NORTH");
                    continue;
                }
            }
        }
Exemple #3
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);
                }
            }
        }
Exemple #4
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);
                }
            }
        }
Exemple #6
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);
                }
            }
        }
Exemple #7
0
        public async void Post_Update_Sku_Warehouse(JObject model, string token, string sku)
        {
            IonReponse result  = new IonReponse();
            JArray     altSkus = new JArray();

            string url = Constant.ION_SKU_WAREHOUSE_URL_NORTH;

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

            string category = "Update_Sku_Warehouse_North";

            if (result.check)
            {
                DAL.UpdateStatus(sku, "UPDATE", "SKU_NORTH");
            }
            else
            {
                result.RecordResultAPI(category, sku);
                DAL.UpdateStatus(sku, "ERROR_UPDATE_WAREHOUSE", "SKU_NORTH");
            }
        }