Exemple #1
0
        async void LoadSelectedRef(string Ref)
        {
            // var progressDialog = ProgressDialog.Show(this, null, "Please Wait.", true);
            // new Thread(new ThreadStart(() =>
            //{
            var list = await repo.GetProductionList(bitopiApplication.User.UserCode, DBAccess.Database.RecentHistory.Result.ProcessID,
                                                    DBAccess.Database.RecentHistory.Result.LocationID, SelectedPRStatus, 1, Ref);

            if (list.Count == 0)
            {
                return;
            }
            ProductionAccountingDBModel model = list.First();

            //RunOnUiThread(() =>
            //{
            tvOrderQty.Text    = model.OrderQty.ToString("N0");
            tvBalanceQty.Text  = model.BalanceQty.ToString("N0");
            tvProducedQty.Text = model.ProducedQty.ToString("N0");
            txtWIPQty.Text     = model.WIP == -99999 ? "N/A" : model.WIP.ToString("N0");
            txtPeriod.Text     = model.Period;
            atvReference.Text  = tvRef.Text = Ref;
            //progressDialog.Dismiss();
            if (model.HourlyProduction == null)
            {
                model.HourlyProduction = new HourlyProduction();
            }
            LoadHourlyProduction(model.HourlyProduction);
            //});
            //})).Start();
        }
Exemple #2
0
        public int Set(ProductionAccountingDBModel model)
        {
            string xmlString = ConvertToXML(model.OperationList);

            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@Ref", model.RefNo),
                new SqlParameter("@ProdDateTime", model.ProdDateTime),
                new SqlParameter("@LocationRef", model.LocationRef),
                new SqlParameter("@Qty", model.ProducedQty),
                new SqlParameter("@xmlString", xmlString),
                new SqlParameter("@AddedBy", model.AddedBy),
            };

            try
            {
                string sql   = toSqlString(param, "bimob.dbo.USP_Productionentry ");
                int    count = ExecuteNonQuery(CommandType.StoredProcedure, "bimob.dbo.USP_Productionentry", param);

                return(count);
            }
            catch (Exception ex)
            {
                //ErrorSignal.FromCurrentContext().Raise(ex);
                throw ex;
            }
        }
Exemple #3
0
        public List <ProductionAccountingDBModel> Get(string UserCode, string ProcessID, string LocationID,
                                                      string PRStatus, int EntryType, string RefID)
        {
            SqlParameter[] param = new SqlParameter[] {
                new SqlParameter("@UserCode", UserCode),
                new SqlParameter("@ProcessID", ProcessID),
                new SqlParameter("@LocationID", LocationID),
                new SqlParameter("@PRStatus", PRStatus),
                new SqlParameter("@EntryType", EntryType),
                new SqlParameter("@RefID", RefID)
            };
            string sql = toSqlString(param, "bimob.dbo.sp_productionAccounting");
            List <ProductionAccountingDBModel> _DBModelList = new List <ProductionAccountingDBModel>();

            try
            {
                DataTable dt = ExecuteDataTable("bimob.dbo.sp_productionAccounting", param);
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        ProductionAccountingDBModel _DBModel = new ProductionAccountingDBModel();
                        _DBModel.RefNo        = dr["RefNO"].ToString();
                        _DBModel.LocationRef  = dr["LocationRef"].ToString();
                        _DBModel.LocationName = dr["LocationName"].ToString();
                        _DBModel.Style        = dr["Style"].ToString();
                        _DBModel.PR           = dr["PR"].ToString();
                        _DBModel.EO           = dr["EO"].ToString();
                        _DBModel.Buyer        = dr["Buyer"].ToString();
                        _DBModel.DeliveryDate = dr["DeliveryDate"].ToString();
                        _DBModel.Color        = dr["Color"].ToString();
                        _DBModel.BalanceQty   = Convert.ToInt32(dr["BalanceQty"]);
                        _DBModel.OrderQty     = Convert.ToInt32(dr["OrderQty"]);
                        _DBModel.ProducedQty  = Convert.ToInt32(dr["ProducedQty"]);
                        _DBModel.WIP          = Convert.ToInt32(dr["WIP"]);
                        _DBModel.Size         = dr["Size"].ToString();
                        _DBModel.Period       = dr["Period"].ToString();
                        string hourly = dr["Hourly"].ToString();
                        if (!String.IsNullOrEmpty(hourly))
                        {
                            _DBModel.HourlyProduction = DesrializeFromXml <HourlyProduction>(hourly, new HourlyProduction(), "HourlyProduction");
                        }
                        _DBModelList.Add(_DBModel);
                    }
                }
                return(_DBModelList);
            }
            catch (Exception ex)
            {
                //ErrorSignal.FromCurrentContext().Raise(ex);
                return(_DBModelList);
            }
            finally
            {
                _DBModelList = null;
            }
        }
        //public int SetProduction(string RefNO, int Qty, string LocationRef, string AddedBy,List<Operation> OperationList)
        //{

        //        string url = RepositorySettings.BaseURl + "ProdcutionAccounting?RefNO="
        //            + RefNO + "&Qty=" + Qty + "&ProdDateTime=" + DateTime.Now.ToString("yyyy-MM-dd HH:mm: ss.fff") + " &AddedBy=" + AddedBy
        //            + "&LocationRef=" + LocationRef;

        //        HttpClient client = new HttpClient();
        //        HttpResponseMessage result =  client.GetAsync(url).Result;
        //        var aproves = JsonConvert.DeserializeObject<int>(result.Content.ReadAsStringAsync().Result);

        //        return aproves;

        //}
        public async Task <int> SetProduction(string RefNO, int Qty, string LocationRef, string AddedBy, List <Operation> OperationList)
        {
            ProductionAccountingDBModel model = new ProductionAccountingDBModel
            {
                RefNo         = RefNO,
                ProducedQty   = Qty,
                LocationRef   = LocationRef,
                AddedBy       = AddedBy,
                OperationList = OperationList != null?OperationList.Where(t => t.Qty != 0).ToList() : null,
                                    ProdDateTime = DateTime.Now
            };
            string      url         = RepositorySettings.BaseURl + "ProdcutionAccounting";
            HttpClient  client      = new HttpClient();
            HttpContent contentPost = new StringContent(JsonConvert.SerializeObject(model), Encoding.UTF8,
                                                        "application/json");
            HttpResponseMessage result = await client.PostAsync(url, contentPost);

            var aproves = JsonConvert.DeserializeObject <int>(result.Content.ReadAsStringAsync().Result);

            return(aproves);
        }
Exemple #5
0
        void LoadSelectedRef(string Ref)
        {
            //var progressDialog = ProgressDialog.Show(this, null, "Please Wait.", true);
            new Thread(new ThreadStart(() =>
            {
                var list = repo.GetProductionList(bitopiApplication.User.UserCode, DBAccess.Database.RecentHistory.Result.ProcessID,
                                                  DBAccess.Database.RecentHistory.Result.LocationID, SelectedPRStatus, 2, Ref).Result;
                if (list.Count == 0)
                {
                    return;
                }
                ProductionAccountingDBModel model = list.First();
                RunOnUiThread(() =>
                {
                    tvOrderQty.Text    = model.OrderQty.ToString("N0");
                    tvBalanceQty.Text  = model.BalanceQty.ToString("N0");
                    tvProducedQty.Text = model.ProducedQty.ToString("N0");
                    txtWIPQty.Text     = model.WIP.ToString("N0");

                    atvReference.Text = tvRef.Text = Ref;
                    //progressDialog.Dismiss();
                });
            })).Start();
        }
Exemple #6
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            if (atvReference.Text == "")
            {
                Toast.MakeText(this, "Please Select an item first", ToastLength.Long).Show();
                return;
            }

            List <RecentPR> prs = DBAccess.Database.RecentPRs.Result.Where(t => t.EntryType == (int)EntryType.Rejection).ToList();

            if (prs.Where(t => t.RefID == atvReference.Text).Count() == 0)
            {
                DBAccess.Database.SaveRecentPR(new DAL.RecentPR {
                    RefID = atvReference.Text, LocationRef = tvLocation.Text, EntryType = (int)EntryType.Rejection
                });
                prs = DBAccess.Database.RecentPRs.Result.Where(t => t.EntryType == (int)EntryType.Rejection).ToList();
                if (prs.Count == 6)
                {
                    DBAccess.Database.DeleteItemAsync(prs.Where(t => t.ID == 1).FirstOrDefault());
                    foreach (var pr in prs)
                    {
                        pr.ID = pr.ID - 1;
                        DBAccess.Database.SaveRecentPR(pr);
                    }
                }
                PopulateRecentItem();
            }
            ProductionAccountingDBModel model;

            if (list != null)
            {
                model = list.Where(t => t.RefNo == atvReference.Text).First();
            }
            else
            {
                model = new ProductionAccountingDBModel {
                    LocationRef = DBAccess.Database.RecentPRs.Result.Where(t => t.RefID == atvReference.Text).First().LocationRef
                }
            };
            //gifView.Visibility = ViewStates.Visible;

            var progressDialog = ProgressDialog.Show(this, null, "Please Wait.", true);
            var refid          = atvReference.Text;
            var qty            = Convert.ToInt16(etQty.Text);
            var userCode       = bitopiApplication.User.UserCode;
            //new Thread(new ThreadStart(() =>
            //{

            ProductionRejectionDBModel dbmodel = new ProductionRejectionDBModel();

            dbmodel.RefNo       = atvReference.Text;
            dbmodel.LocationRef = DBAccess.Database.RecentHistory.Result.LocationID;
            dbmodel.Grade       = etGrade.Text;
            //dbmodel.SKUCode = Convert.ToInt16(etSKUCode.Text);
            dbmodel.ProducedQty = Convert.ToInt16(etQty.Text);
            dbmodel.AddedBy     = bitopiApplication.User.UserCode;
            var result = repo.SetRejection(dbmodel);

            RunOnUiThread(() =>
            {
                if (result > 0)
                {
                    if (SelectedPRStatus != "")
                    {
                        LoadList(SelectedPRStatus);
                    }
                    LoadSelectedList(atvReference.Text);
                    progressDialog.Dismiss();
                    Toast.MakeText(this, "Successfully Saved", ToastLength.Long).Show();
                }
                else
                {
                    progressDialog.Dismiss();
                    Toast.MakeText(this, "Unsuccessfull operation", ToastLength.Long).Show();
                }
                //gifView.Visibility = ViewStates.Gone;
            });
            //})).Start();
        }
Exemple #7
0
        public int Set(ProductionAccountingDBModel ProductionAccountingDBModel)
        {
            int result = Context.Set(ProductionAccountingDBModel);

            return(result);
        }