Exemple #1
0
 private void Save()
 {
     if (WarehouseId == -1)
     {
         Sql.ExecuteCmd(SaveProcedure, new object[] {
             "@PalletHeight", tHeight.Text,
             "@PalletLength", tLength.Text,
             "@PalletWidth", tWidth.Text,
             "@PalletVolume", NullCheck.IsNullDecimal(tHeight.Text) * NullCheck.IsNullDecimal(tLength.Text) * NullCheck.IsNullDecimal(tWidth.Text)
         });
     }
     else
     {
         Sql.ExecuteCmd(UpdateProcedure, new object[] {
             "@PalletId", WarehouseId,
             "@PalletHeight", tHeight.Text,
             "@PalletLength", tLength.Text,
             "@PalletWidth", tWidth.Text,
             "@PalletVolume", NullCheck.IsNullDecimal(tHeight.Text) * NullCheck.IsNullDecimal(tLength.Text) * NullCheck.IsNullDecimal(tWidth.Text)
         });
     }
     LogAction(WarehouseId == -1 ? SaveProcedure : UpdateProcedure);
     DialogResult = DialogResult.OK;
     this.Close();
 }
        public void LoadData()
        {
            DataTable dt = Sql.GetTable(SelectProcedure, new object[] { "@WarehouseZoneId", WarehouseZoneId });

            if (dt.Rows.Count > 0)
            {
                tFZoneCode.Text  = NullCheck.IsNullString(dt.Rows[0]["ZoneCode"]);
                tFZoneName.Text  = NullCheck.IsNullString(dt.Rows[0]["ZoneName"]);
                tWarehouse.Text  = NullCheck.IsNullString(dt.Rows[0]["WarehouseName"]);
                tCreated.Text    = NullCheck.IsNullDate(dt.Rows[0]["CreateDate"]).ToShortDateString();
                tUpdated.Text    = NullCheck.IsNullDate(dt.Rows[0]["UpdateDate"]).ToShortDateString();
                FZoneParentId    = NullCheck.IsNullInt(dt.Rows[0]["ParentID"]);
                tSpotHeight.Text = NullCheck.IsNullString(dt.Rows[0]["SpotHeight"]);
                tSpotLength.Text = NullCheck.IsNullString(dt.Rows[0]["SpotLength"]);
                tSpotWidth.Text  = NullCheck.IsNullString(dt.Rows[0]["SpotWidth"]);
                tSpotVolume.Text = NullCheck.IsNullString(dt.Rows[0]["SpotVolume"]);
            }


            RemainingVolume = NullCheck.IsNullDecimal(Sql.GetString($"SELECT dbo.RemainingZoneVolume('{WarehouseZoneId}')"));
            if (NullCheck.IsNullDecimal(dt.Rows[0]["SpotVolume"]) != RemainingVolume)
            {
                tSpotHeight.Enabled = false;
                tSpotLength.Enabled = false;
                tSpotVolume.Enabled = false;
                tSpotWidth.Enabled  = false;
            }
        }
        private void RecalculateSpotVolume()
        {
            if (string.IsNullOrEmpty(tSpotLength.Text) || string.IsNullOrEmpty(tSpotWidth.Text) || string.IsNullOrEmpty(tSpotHeight.Text))
            {
                return;
            }

            tSpotVolume.Text = NullCheck.IsNullString(NullCheck.IsNullDecimal(tSpotLength.Text) * NullCheck.IsNullDecimal(tSpotWidth.Text) * NullCheck.IsNullDecimal(tSpotHeight.Text));
        }
Exemple #4
0
 public static decimal CalculateTotalVolume(DataTable dt)
 {
     if (dt != null)
     {
         decimal Total = 0;
         foreach (DataRow row in dt.Rows)
         {
             Total += NullCheck.IsNullDecimal(row["Volume"]) * NullCheck.IsNullDecimal(row["Quantity"]);
         }
         return(Total);
     }
     return(decimal.Zero);
 }
Exemple #5
0
        private void ProcessPickQuantity()
        {
            decimal ScannedAmount = NullCheck.IsNullDecimal(tBoxInput2.Text);

            if (ScannedAmount == Decimal.Zero)
            {
                EnableRows(9);
                SetRow9("Netinkama įvestis", ContentAlignment.MiddleCenter, Color.Red);
                return;
            }
            DataRow row             = ItemList.AsEnumerable().Where(x => x.Field <string>("Barcode") == tBoxInput1.Text).FirstOrDefault();
            decimal RequestedAmount = NullCheck.IsNullDecimal(row["Quantity"]);

            if (ScannedAmount > RequestedAmount)
            {
                EnableRows(9);
                SetRow9("Surinktas didesnis kiekis nei reikia surinkti", ContentAlignment.MiddleCenter, Color.Red);
                return;
            }
            PickingActions.SetWOInProcess(NullCheck.IsNullInt(row["WOrderId"]));
            DisableRows(9);
            decimal LeftQty = RequestedAmount - ScannedAmount;

            if (LeftQty == decimal.Zero)
            {
                PickingActions.CloseWO(NullCheck.IsNullInt(row["WOrderId"]));
                ItemList.Rows.Remove(row);
            }
            else
            {
                row["Quantity"] = LeftQty;
            }
            ClearInput(input1: false);
            if (ItemList.Rows.Count > 0)
            {
                if (LeftQty == Decimal.Zero)
                {
                    SetScanWO();
                }
                processMethod = new Action(ProcessWOScan);
            }
            else
            {
                ClearInput();
                EnableInput();
                ProcessWO();
            }
        }
Exemple #6
0
        private bool ValidateRow(DataGridViewRow row)
        {
            if (NullCheck.IsNullDecimal(row.Cells["Quantity"].Value) <= 0)
            {
                return(false);
            }

            decimal TotalNetto = NullCheck.IsNullDecimal(row.Cells["Quantity"].Value) * NullCheck.IsNullDecimal(row.Cells["NetWeight"].Value);
            decimal TotalBruto = NullCheck.IsNullDecimal(row.Cells["Quantity"].Value) * NullCheck.IsNullDecimal(row.Cells["BrutoWeight"].Value);

            _handle = false;
            row.Cells["TotalNetto"].Value = TotalNetto;
            row.Cells["TotalBruto"].Value = TotalBruto;
            _handle = true;
            return(true);
        }
Exemple #7
0
        private void ProcessItemScan()
        {
            decimal ScannedAmount = NullCheck.IsNullDecimal(tBoxInput1.Text);

            if (ScannedAmount == Decimal.Zero)
            {
                EnableRows(9);
                SetRow9("Netinkama įvestis", ContentAlignment.MiddleCenter, Color.Red);
                return;
            }
            DataRow row             = ItemList.AsEnumerable().Where(x => x.Field <string>("Barcode") == Cache.ReturnValueByKey("@ScanBarcode")).FirstOrDefault();
            decimal RequestedAmount = NullCheck.IsNullDecimal(row["Quantity"]);

            if (ScannedAmount > RequestedAmount)
            {
                EnableRows(9);
                SetRow9("Įvestas didesnis kiekis nei užsakyta", ContentAlignment.MiddleCenter, Color.Red);
                return;
            }
            DisableRows(9);
            decimal LeftQty = NullCheck.IsNullDecimal(row["Quantity"]) - ScannedAmount;

            if (LeftQty == Decimal.Zero)
            {
                ItemList.Rows.Remove(row);
            }
            else
            {
                row["Quantity"] = LeftQty;
            }
            ClearInput();
            if (ItemList.Rows.Count > 0)
            {
                if (LeftQty == Decimal.Zero)
                {
                    SetScanItem();
                }
                processMethod = new Action(ProcessItemScan);
            }
            else
            {
                CheckItemScan();
            }
        }
Exemple #8
0
        private static DataTable ProcessDataTableQuantityById(DataTable dt)
        {
            DataTable clone = dt.Clone();

            foreach (DataRow row in dt.Rows)
            {
                DataRow _row = clone.AsEnumerable().Where(x => x.Field <int>("ItemId") == NullCheck.IsNullInt(row["ItemId"])).FirstOrDefault();

                if (_row == null)
                {
                    clone.Rows.Add(row.ItemArray);
                }
                else
                {
                    _row["Quantity"] = NullCheck.IsNullDecimal(_row["Quantity"]) + NullCheck.IsNullDecimal(row["Quantity"]);
                }
            }

            return(clone);
        }
Exemple #9
0
 public void SaveRow(DataGridViewRow row)
 {
     if (NullCheck.IsNullInt(row.Cells["ItemId"].Value) > 0 && NullCheck.IsNullDecimal(row.Cells["Quantity"].Value) > 0)
     {
         Sql.ExecuteCmd(NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value) <= 0 ? SaveRcvDocDet : UpdateRcvDocDet, new object[]
         {
             "@OrderedItemId", NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value),
             "@Quantity", NullCheck.IsNullDecimal(row.Cells["Quantity"].Value),
             "@Created", DateTime.Now,
             "@Updated", DateTime.Now,
             "@ItemId", NullCheck.IsNullInt(row.Cells["ItemId"].Value),
             "@RcvDocId", CurrentRcvDocId
         });
         _handle = false;
         if (NullCheck.IsNullInt(row.Cells["OrderedItemId"].Value) <= 0)
         {
             ((DataTable)dataGridView2.DataSource).Rows.Add();
         }
         row.Cells["OrderedItemId"].Value = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateDetSave('{NullCheck.IsNullInt(row.Cells["ItemId"].Value)}','{CurrentRcvDocId}')"));
         _handle = true;
     }
 }
Exemple #10
0
        public static string GetSuggestedReceivingZone()
        {
            DataTable dt          = GetReceivingItemList();
            decimal   TotalVolume = CalculateTotalVolume(dt);

            return(Sql.GetString($"SELECT dbo.GetFirstReceivingLocation('{GlobalUser.CurrentWarehouseId}','{TotalVolume + NullCheck.IsNullDecimal(Cache.ReturnValueByKey("@PalletType"))}')"));
        }
Exemple #11
0
        private bool ValidInput()
        {
            string errorMsg = string.Empty;

            if (string.IsNullOrEmpty(tItemCode.Text))
            {
                tItemCode.Invalidate();
                errorMsg += "Negalimas prekės kodas\n";
            }
            if (string.IsNullOrEmpty(tItemName.Text))
            {
                tItemName.Invalidate();
                errorMsg += "Negalimas prekės pavadinimas\n";
            }
            if (string.IsNullOrEmpty(tNetWeight.Text))
            {
                tNetWeight.Invalidate();
                errorMsg += "Negalimas prekės neto svoris\n";
            }
            if (string.IsNullOrEmpty(tBrutoWeight.Text))
            {
                tBrutoWeight.Invalidate();
                errorMsg += "Negalimas prekės bruto svoris\n";
            }
            if (string.IsNullOrEmpty(tVolume.Text))
            {
                tItemCode.Invalidate();
                errorMsg += "Negalimas prekės tūris\n";
            }

            if (string.IsNullOrEmpty(tBarcode.Text))
            {
                tBarcode.Invalidate();
                errorMsg += "Negalimas prekės barkodas\n";
            }

            if (string.IsNullOrEmpty(tHeight.Text))
            {
                tHeight.Invalidate();
                errorMsg += "Negalimas prekės aukštis\n";
            }

            if (string.IsNullOrEmpty(tWidth.Text))
            {
                tWidth.Invalidate();
                errorMsg += "Negalimas prekės plotas\n";
            }

            if (NullCheck.IsNullDecimal(tWidth.Text) <= 0)
            {
                tWidth.Invalidate();
                errorMsg += "Prekės plotis negali būti lygus ar mažesnis už 0\n";
            }
            if (NullCheck.IsNullDecimal(tHeight.Text) <= 0)
            {
                tHeight.Invalidate();
                errorMsg += "Prekės aukštis negali būti lygus ar mažesnis už 0\n";
            }

            if (!string.IsNullOrEmpty(tNetWeight.Text) && !string.IsNullOrEmpty(tBrutoWeight.Text) && NullCheck.IsNullDecimal(tNetWeight.Text) > NullCheck.IsNullDecimal(tBrutoWeight.Text))
            {
                errorMsg += "Neto svoris negali būti didesnis už bruto svorį\n";
            }

            if (NullCheck.IsNullDecimal(tNetWeight.Text) <= 0)
            {
                errorMsg += "Neto svoris negali būti lygus 0 arba mažesnei reikšmei\n";
            }

            if (NullCheck.IsNullDecimal(tBrutoWeight.Text) <= 0)
            {
                errorMsg += "Bruto svoris negali būti lygus 0 arba mažesnei reikšmei\n";
            }

            int Exists = NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.ValidateItem('{tItemCode.Text}', '{tItemName.Text}')"));

            if (Exists > 0 && ItemId < 0)
            {
                errorMsg += "Prekės kodo ir pavadinimo kombinacija nėra unikali\n";
            }

            if (Exists > 0 && ItemId > 0)
            {
                if (NullCheck.IsNullInt(Sql.GetString($"SELECT dbo.CheckIfItemIsUnique('{ItemId}','{tItemName.Text}','{tItemCode.Text}')")) == 0)
                {
                    errorMsg += "Prekės kodo ir pavadinimo kombinacija nėra unikali\n";
                }
            }

            if (!string.IsNullOrEmpty(errorMsg))
            {
                MessageBox.Show("Negalima išsaugoti prekės kortelės:\n" + errorMsg, "Klaida", MessageBoxButtons.OK);
                return(false);
            }
            return(true);
        }
Exemple #12
0
 private void ScanPutLocation()
 {
     DisableInfo();
     ClearInput();
     EnableInput(input1: true);
     EnableRows(3);
     SetRow3("Nuskenuokite vietą kur norite padėti paletę", ContentAlignment.MiddleCenter);
     EnableRows(5);
     SetRow5($"Siūloma vieta: {Sql.GetString($"SELECT dbo.GetSuggestedStaging('{TotalVolume + NullCheck.IsNullDecimal(Cache.ReturnValueByKey("@PalletType"))}')")}");
     EnableBoxDescriptionRows(row1: true);
     SetTextBoxLabel1("Vieta:");
     FocusInput1();
     processMethod = new Action(PutCU);
 }