-
Notifications
You must be signed in to change notification settings - Fork 0
/
PutAway.cs
112 lines (95 loc) · 3.05 KB
/
PutAway.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace LMSWarehouse
{
public partial class FrmPutAway : Form
{
private Wrapper WS = new Wrapper();
private int WarehouseID;
private int ProductID;
private int Qty;
private int BinID;
public string SKU;
public FrmPutAway(int fWarehouseID, int fProductID, int fQty)
{
InitializeComponent();
WarehouseID = fWarehouseID;
ProductID = fProductID;
Qty = fQty;
BinID = 0;
SKU = "";
FRefresh();
}
private void FRefresh()
{
try
{
DataSet ds = WS.GetPutStockLine(WarehouseID, ProductID, SKU);
txtQty.Text = Qty.ToString();
SKU = ds.Tables[0].Rows[0]["SKU"].ToString();
lblProduct.Text = SKU + ": " + ds.Tables[0].Rows[0]["ProductDescription"].ToString();
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
}
private void toolStripButtonClose_Click(object sender, EventArgs e)
{
Close();
}
private void toolStripButtonPutAway_Click(object sender, EventArgs e)
{
if (int.TryParse(txtQty.Text, out Qty) && (BinID > 0))
{
DataSet dp = WS.GetStockOrderQty(WarehouseID, ProductID);
int tmpQty = Qty;
for (int i = 0; i < dp.Tables[0].Rows.Count; i++)
{
int QtyStock = int.Parse(dp.Tables[0].Rows[i]["QTYFinal"].ToString());
if (QtyStock > tmpQty)
{
QtyStock = tmpQty;
}
if (QtyStock > 0)
{
WS.SetStockFromPutAway(WarehouseID, BinID, QtyStock, int.Parse(dp.Tables[0].Rows[i]["StockOrderDetail_ID"].ToString()));
tmpQty = tmpQty - QtyStock;
}
}
Close();
}
else
{
MessageBox.Show("Qty or Bin is not valid.");
}
}
private void cbBin_Enter(object sender, EventArgs e)
{
DataSet ds = WS.GetBins(WarehouseID);
DataRow dr = ds.Tables[0].NewRow();
dr["Description"] = "Select All";
dr["BarCode"] = 0;
ds.Tables[0].Rows.InsertAt(dr, 0);
cbBin.DataSource = ds.Tables[0];
cbBin.ValueMember = "BarCode";
cbBin.DisplayMember = "Description";
}
private void cbBin_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
BinID = int.Parse(cbBin.SelectedValue.ToString());
}
catch
{
BinID = 0;
}
}
}
}