Example #1
0
        public ActionResult UpdateLotNum(FGReduceModel obj)
        {
            FGReduceModel fgReduceModel = (FGReduceModel)Session["FGReduce"];

            fgReduceModel.ModifiedQty = obj.ModifiedQty;

            string msg    = "";
            string status = "";

            try
            {
                HttpResponseMessage response = GlobalVariables.WebApiClient.PostAsJsonAsync("FGReduce", fgReduceModel).Result;
                if (response.IsSuccessStatusCode)
                {
                    string msgJson = "";
                    msgJson             = response.Content.ReadAsStringAsync().Result;
                    Session["FGReduce"] = null;
                    status = "Success";

                    try
                    {
                        JObject jObject = JObject.Parse(msgJson);
                        string  msgJ    = (string)jObject.SelectToken("Message");
                        string  msgDtl  = (string)jObject.SelectToken("MessageDetail");
                        if (msgDtl == null)
                        {
                            msg = msgJ;
                        }
                        else
                        {
                            msg = msgDtl;
                        }
                    }
                    catch (Exception ex)
                    {
                        msg = msgJson;
                    }
                }
                else
                {
                    msg    = response.Content.ReadAsStringAsync().Result;
                    status = "Fail";
                }
            }
            catch (Exception ex)
            {
                msg    = ex.ToString();
                status = "Fail";
            }

            return(Json(new { Message = msg, Status = status }, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        public ActionResult CheckLotNum(string Company, string LotNum)
        {
            Session["FGReduce"] = null;

            string  msg             = "";
            string  status          = "";
            decimal onhandQty       = 0;
            string  PartDescription = "";

            FGReduceModel fgReduceModel = new FGReduceModel();

            try
            {
                string qry = $"FGReduce?Company={Company}&LotNum={LotNum}";
                HttpResponseMessage response = GlobalVariables.WebApiClient.GetAsync(qry).Result;
                if (response.IsSuccessStatusCode)
                {
                    fgReduceModel       = response.Content.ReadAsAsync <FGReduceModel>().Result;
                    Session["FGReduce"] = fgReduceModel;
                    onhandQty           = fgReduceModel.OnhandQty;
                    PartDescription     = fgReduceModel.PartDescription;

                    msg    = "Lot Num Exist";
                    status = "Success";
                }
                else
                {
                    onhandQty = 0;
                    msg       = response.Content.ReadAsStringAsync().Result;
                    status    = "Fail";
                }
            }
            catch (Exception ex)
            {
                msg    = ex.ToString();
                status = "Fail";
            }

            return(Json(new { Message = msg, Status = status, OnhandQty = onhandQty, PartDescription = PartDescription }, JsonRequestBehavior.AllowGet));
        }