Example #1
0
 public ReceiveArticleDialog(StoreInPlanDetail model, SessionInfo _session, int LineReceive, decimal WeightReceive)
 {
     InitializeComponent();
     this._repo = new StoreInPlanRepo();
     this.ArticleList = new List<StoreInPlanDetail>();
     this.lineNum = model;
     this.numofline = LineReceive;
     this.WeightRcv = WeightReceive;
     this.DataFlag = false;
     epiSession = _session;
 }
Example #2
0
        private void butArticleDetail_Click(object sender, EventArgs e)
        {
            bool ErrorFlag = false;
            if (HeadContent.InsertState)
            {
                MessageBox.Show("Please save store in plan no : " + this.txtStoreInPlanNum.Text.ToString() + " before to adding article line.", "Please save.", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                ErrorFlag = true;
            }
            else
            {
                if (string.IsNullOrEmpty(txtPoNumber.Text))
                {
                    errorProvider1.SetError(txtPoNumber, "Please fill the required field.");
                    ErrorFlag = true;
                }

                if (string.IsNullOrEmpty(txtPoLine.Text))
                {
                    errorProvider1.SetError(txtPoLine, "Please fill the required field.");
                    ErrorFlag = true;
                }

                if (Convert.ToInt32(string.IsNullOrEmpty(txtNumberOfArticle.Text.Trim()) ? "0" : txtPoLine.Text.Trim()) <= 0)
                {
                    errorProvider1.SetError(txtNumberOfArticle, "Please fill the required field.");
                    ErrorFlag = true;
                }

                if (Convert.ToDecimal(string.IsNullOrEmpty(txtReceiptWeight.Text.Trim()) ? "0" : txtReceiptWeight.Text.Trim()) <= 0)
                {
                    errorProvider1.SetError(txtReceiptWeight, "Please fill the required field.");
                    ErrorFlag = true;
                }
            }

            if (!ErrorFlag)
            {
                StoreInPlanDetail paramModel = new StoreInPlanDetail();
                //decimal ReceiptWeight = Convert.ToDecimal(string.IsNullOrEmpty(txtReceiptWeight.Text.Trim()) ? "0" : txtReceiptWeight.Text.Trim());
                paramModel = _repo.GetPoLineDetail(txtPoNumber.Text.Trim(), Convert.ToInt32(txtPoLine.Text.Trim()));

                if (paramModel == null)
                {
                    MessageBox.Show("This PO line dose not exist.", "Invalid value.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                paramModel.PONumber = txtPoNumber.Text.Trim();
                paramModel.StoreInPlanId = HeadContent.StoreInPlanId;
                paramModel.PONum = POTrans.PONum;
                paramModel.PackingNumber = HeadContent.InvoiceNum;
                paramModel.POLine = Convert.ToInt32(txtPoLine.Text.Trim());
                paramModel.WeightBalnce = _repo.GetReceivedWeight(paramModel.PONum, paramModel.POLine);
                paramModel.POAllowance = _repo.GetMCSSAllowance(paramModel.PartNum);
                int NumberOfArt = Convert.ToInt32(string.IsNullOrEmpty(txtNumberOfArticle.Text.Trim()) ? "0" : txtNumberOfArticle.Text.Trim());
                decimal decAllowance = (POTrans.BalanceWeight * paramModel.POAllowance) / 100;
                if (Convert.ToDecimal(txtReceiptWeight.Text) <= (POTrans.BalanceWeight + decAllowance))
                {
                    ReceiveArticleDialog frm = new ReceiveArticleDialog(paramModel, epiSession, NumberOfArt, Convert.ToDecimal(txtReceiptWeight.Text));
                    frm.ShowDialog();
                    SetHeaderContent(HeadContent);
                    ClearPOLineTrans();
                }
                else
                {
                    MessageBox.Show("Receipt weight must be less than or equal Remaining weight.", "Invalid value.", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
Example #3
0
        private void UpdateArticleLine()
        {
            if (HeadContent.ImportFlag == 2)
            {
                for (int i = 0; (this.dataGridView2.Rows.Count) > i; i++)
                {
                    if (!string.IsNullOrEmpty(dataGridView2.Rows[i].Cells["id1"].Value.GetString()))
                    {
                        StoreInPlanDetail param = new StoreInPlanDetail();
                        param.SeqId = Convert.ToInt32(dataGridView2.Rows[i].Cells["lineid"].Value);
                        param.StoreInPlanId = HeadContent.StoreInPlanId;
                        param.LineID = Convert.ToInt32(dataGridView2.Rows[i].Cells["id1"].Value);
                        param.ArticleNo = dataGridView2.Rows[i].Cells["article"].Value.GetString();
                        param.CommodityCode = dataGridView2.Rows[i].Cells["commodity1"].Value.GetString();
                        param.SpecCode = dataGridView2.Rows[i].Cells["spec1"].Value.GetString();
                        param.CoatingCode = dataGridView2.Rows[i].Cells["Coating"].Value.GetString();
                        param.Thick = Convert.ToDecimal(dataGridView2.Rows[i].Cells["thick"].Value);
                        param.Width = Convert.ToDecimal(dataGridView2.Rows[i].Cells["width"].Value);
                        param.Length = Convert.ToDecimal(dataGridView2.Rows[i].Cells["length"].Value);
                        param.Quantity = Convert.ToDecimal(dataGridView2.Rows[i].Cells["quantity2"].Value);
                        param.Weight = Convert.ToDecimal(dataGridView2.Rows[i].Cells["weight2"].Value);
                        param.Place = dataGridView2.Rows[i].Cells["place1"].Value.GetString();
                        param.PackingNumber = dataGridView2.Rows[i].Cells["packingno1"].Value.GetString();
                        param.Category = dataGridView2.Rows[i].Cells["category"].Value.GetString();
                        param.SaleContract = dataGridView2.Rows[i].Cells["mksale"].Value.GetString();
                        param.Note = dataGridView2.Rows[i].Cells["note1"].Value.GetString();

                        _repo.SaveArticle(param, epiSession);
                    }
                }
            }
            else
            {
                for (int i = 0; (this.dataGridView1.Rows.Count) > i; i++)
                {
                    if (dataGridView1.Columns[10].Name == "edit" && (bool)dataGridView1[10, i].EditedFormattedValue)
                    {
                        StoreInPlanDetail param = new StoreInPlanDetail();
                        param.SeqId = Convert.ToInt32(dataGridView1.Rows[i].Cells["SeqId"].Value);
                        param.StoreInPlanId = HeadContent.StoreInPlanId;
                        param.LineID = Convert.ToInt32(dataGridView1.Rows[i].Cells["id"].Value);
                        param.ArticleNo = dataGridView1.Rows[i].Cells["articleno"].Value.GetString();
                        param.Quantity = Convert.ToDecimal(dataGridView1.Rows[i].Cells["quantity1"].Value);
                        param.Weight = Convert.ToDecimal(dataGridView1.Rows[i].Cells["weight1"].Value);
                        param.Place = dataGridView1.Rows[i].Cells["place"].Value.GetString();

                        _repo.SaveArticle(param, epiSession);
                    }
                }
            }
        }
Example #4
0
        private void tlbSave_Click(object sender, EventArgs e)
        {
            tlbInactive_Click(sender, e);
            if (!DataFlag)
            {
                MessageBox.Show("Plaes validate data before save.", "Invalid data.", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (DataFlag)
            {
                for (int i = 0; (this.dataGridView1.Rows.Count) > i; i++)
                {
                    StoreInPlanDetail param = new StoreInPlanDetail();
                    param.SeqId = Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value.ToString().Trim());
                    param.StoreInPlanId = lineNum.StoreInPlanId;
                    param.LineID = 0;
                    param.PONumber = lineNum.PONumber;
                    param.PONum = lineNum.PONum;
                    param.POLine = lineNum.POLine;
                    param.SpecCode = lineNum.SpecCode;
                    param.Thick = lineNum.Thick;
                    param.Width = lineNum.Width;
                    param.Length = lineNum.Length;
                    param.ArticleNo = dataGridView1.Rows[i].Cells[6].Value.ToString().Trim();
                    param.Quantity = Convert.ToDecimal(dataGridView1.Rows[i].Cells[7].Value.ToString().Trim());
                    param.Weight = Convert.ToDecimal(dataGridView1.Rows[i].Cells[8].Value.ToString().Trim());
                    param.Place = dataGridView1.Rows[i].Cells[9].Value.ToString().Trim();
                    param.PackingNumber = dataGridView1.Rows[i].Cells[10].Value.ToString().Trim();
                    param.Note = dataGridView1.Rows[i].Cells[11].Value.ToString().Trim();
                    param.EndUserID = dataGridView1.Rows[i].Cells[12].Value.ToString().Trim();

                    _repo.SaveArticle(param, epiSession);
                }
                this.Close();
            }
        }