/// <summary>
        /// 数据查询,绑定
        /// </summary>
        private void BindData(int currentPage)
        {
            DataSet ds = bPurchaseOrder.GetPartsList(txtProductCode.Text.Trim(), "", (currentPage - 1) * PageSize + 1, currentPage * PageSize);

            dgvData.Rows.Clear();
            foreach (DataRow rows in ds.Tables[0].Rows)
            {
                int             currentRowIndex = dgvData.Rows.Add(1);
                DataGridViewRow row             = dgvData.Rows[currentRowIndex];
                row.Cells[1].Selected           = true;
                row.Cells["No"].Value           = rows["Row"];
                row.Cells["PARTS_CODE"].Value   = rows["PRODUCT_PART_CODE"];
                row.Cells["PARTS_NAME"].Value   = bCommon.GetBaseMaster("PRODUCT", rows["PRODUCT_PART_CODE"].ToString()).Name;
                row.Cells["MIN_QUANTITY"].Value = rows["QUANTITY"];
                row.Cells["QUANTITY"].Value     = Convert.ToDecimal(rows["QUANTITY"]) * Convert.ToDecimal(txtQunitity.Text.Trim());

                BaseStockTable stock = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(txtWarehouseCode.Text.Trim(), rows["PRODUCT_PART_CODE"].ToString());
                row.Cells["STOCK_QUANTITY"].Value = stock.QUANTITY;
                row.Cells["UNIT_NAME"].Value      = bCommon.GetBaseMaster("UNIT", stock.UNIT_CODE).Name;

                row.Cells["PURCHASE_QUANTITY"].Value = bPurchaseOrder.GetPurchaseQuantity(txtWarehouseCode.Text.Trim(), rows["PRODUCT_PART_CODE"].ToString());
            }
            if (ds.Tables[0].Rows.Count < PageSize * currentPage)
            {
                dgvData.Rows.Add(PageSize - ds.Tables[0].Rows.Count);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(BaseStockTable stockTable)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BASE_STOCK(");
            strSql.Append("WAREHOUSE_CODE,PRODUCT_CODE,UNIT_CODE,QUANTITY,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER)");
            strSql.Append(" values (");
            strSql.Append("@WAREHOUSE_CODE,@PRODUCT_CODE,@UNIT_CODE,@QUANTITY,@STATUS_FLAG,@CREATE_USER,GETDATE(),GETDATE(),@LAST_UPDATE_USER)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WAREHOUSE_CODE",   SqlDbType.VarChar, 20),
                new SqlParameter("@PRODUCT_CODE",     SqlDbType.VarChar, 20),
                new SqlParameter("@UNIT_CODE",        SqlDbType.VarChar, 20),
                new SqlParameter("@QUANTITY",         SqlDbType.Decimal,  9),
                new SqlParameter("@STATUS_FLAG",      SqlDbType.Int,      4),
                new SqlParameter("@CREATE_USER",      SqlDbType.VarChar, 20),
                new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = stockTable.WAREHOUSE_CODE;
            parameters[1].Value = stockTable.PRODUCT_CODE;
            parameters[2].Value = stockTable.UNIT_CODE;
            parameters[3].Value = stockTable.QUANTITY;
            parameters[4].Value = stockTable.STATUS_FLAG;
            parameters[5].Value = stockTable.CREATE_USER;
            parameters[6].Value = stockTable.LAST_UPDATE_USER;

            return(DbHelperSQL.ExecuteSql(strSql.ToString(), parameters));
        }
Beispiel #3
0
        /// <summary>
        /// 数据查询,绑定
        /// </summary>
        private void BindData(int currentPage)
        {
            string  strWhere = GetConduction();
            DataSet ds       = bProductBuild.GetBilldList(strWhere, "", (currentPage - 1) * PageSize + 1, currentPage * PageSize);

            dgvData.Rows.Clear();

            foreach (DataRow rows in ds.Tables[0].Rows)
            {
                int             currentRowIndex = dgvData.Rows.Add(1);
                DataGridViewRow row             = dgvData.Rows[currentRowIndex];

                row.Cells[1].Selected           = false;
                row.Cells["No"].Value           = rows["Row"];
                row.Cells["PARTS_CODE"].Value   = rows["PRODUCT_PART_CODE"];
                row.Cells["MIN_QUANTITY"].Value = rows["QUANTITY"];
                row.Cells["PARTS_NAME"].Value   = rows["PRODUCT_PART_NAME"];
                row.Cells["SPEC"].Value         = rows["SPEC"];
                row.Cells["UNIT_CODE"].Value    = rows["UNIT_CODE"];
                row.Cells["UNIT_NAME"].Value    = rows["UNIT_NAME"];

                //BAlloation bAlloation = new BAlloation();
                decimal        alloationQuantity = bAlloation.GetAlloationQuantity(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                BaseStockTable stock             = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                row.Cells["NO_ALLOATION"].Value = stock.QUANTITY - alloationQuantity;


                row.Cells["PURCHASE_QUANTITY"].Value = CConvert.ToDecimal(rows["QUANTITY"]) * CConvert.ToDecimal(txtQuantity.Text.Trim());

                if (CConvert.ToDecimal(row.Cells["NO_ALLOATION"].Value) >= CConvert.ToDecimal(row.Cells["PURCHASE_QUANTITY"].Value))
                {
                    row.Cells["STATUE_FLAG"].Value = "OK";
                }
                else
                {
                    row.Cells["STATUE_FLAG"].Value = "NG";
                }
                double p   = Convert.ToDouble(CConvert.ToDecimal(row.Cells["NO_ALLOATION"].Value) / CConvert.ToDecimal(row.Cells["MIN_QUANTITY"].Value));
                int    old = (int)Math.Floor(p);
                if (CConvert.ToInt32(rows["Row"]) == 1)
                {
                    possible = old;
                }
                else if (possible >= old)
                {
                    possible = old;
                }
            }
            if (ds.Tables[0].Rows.Count < PageSize * currentPage)
            {
                dgvData.Rows.Add(PageSize - ds.Tables[0].Rows.Count);
            }
        }
Beispiel #4
0
 private void btnCalculate_Click(object sender, EventArgs e)
 {
     if (CalculateCheck())
     {
         BAlloation     bAlloation        = new BAlloation();
         decimal        alloationQuantity = bAlloation.GetAlloationQuantity(txtWarehouse.Text.Trim(), txtProduct.Text.Trim());
         BaseStockTable stock             = new BaseStockTable();
         stock = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), txtProduct.Text.Trim());
         txtNoAlloation.Text = CConvert.ToString(stock.QUANTITY - alloationQuantity);
     }
 }
Beispiel #5
0
        private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == dgvData.Columns["BtnProduct"].Index)
                {
                    FrmMasterSearch frm = new FrmMasterSearch("PRODUCT", "");
                    if (frm.ShowDialog(this) == DialogResult.OK)
                    {
                        if (frm.BaseMasterTable != null)
                        {
                            DataGridViewRow  dr           = dgvData.Rows[e.RowIndex];
                            string           code         = frm.BaseMasterTable.Code;
                            BaseProductTable productTable = bProduct.GetModel(code);
                            BaseStockTable   stock        = bStock.GetModel(txtWarehouseCode.Text.Trim(), productTable.CODE);
                            if (productTable != null)
                            {
                                dr.Cells["PRODUCT_CODE"].Value = productTable.CODE;
                                dr.Cells["PRODUCT_NAME"].Value = productTable.NAME;
                                dr.Cells["SPEC"].Value         = productTable.SPEC + " " + productTable.MODEL_NUMBER;
                                if (stock != null)
                                {
                                    dr.Cells["QUANTITY"].Value = CConvert.ToString(stock.QUANTITY);
                                }
                                else
                                {
                                    dr.Cells["QUANTITY"].Value = 0;
                                }
                                if (!string.IsNullOrEmpty(productTable.BASIC_UNIT_CODE))
                                {
                                    dr.Cells["UNIT_NAME"].Value = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                                    dr.Cells["UNIT_CODE"].Value = productTable.BASIC_UNIT_CODE;
                                }
                                dr.Cells["SANCTION_NUMBER"].Value = "1";

                                //DataGridViewComboBoxColumn cbo = (DataGridViewComboBoxColumn)this.dgvData.Columns["REASON"];
                                //MessageBox.Show(cbo.Items[0]);
                            }
                            else
                            {
                                MessageBox.Show("商品不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                                dr.Cells["QUANTITY"].Value = "0";
                                dr.Cells["CODE"].Selected  = true;
                            }
                        }
                    }
                    frm.Dispose();
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #6
0
        public void setDatagridView(int currentPage)
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat(" SLIP_NUMBER like '{0}%'", slipnumber);
            _inventoryTable = bInventory.GetInventoryModel(slipnumber);
            DataSet ds = bInventory.GetEndInventoryList(sb.ToString(), "", (currentPage - 1) * PageSize + 1, currentPage * PageSize);

            txtSlipNumber.Text    = _inventoryTable.SLIP_NUMBER;
            txtStartDate.Value    = _inventoryTable.START_DATE;
            txtWarehouseCode.Text = _inventoryTable.WAREHOUSE_CODE;
            txtWarehouseName.Text = bCommon.GetBaseMaster("WAREHOUSE", _inventoryTable.WAREHOUSE_CODE).Name;

            dgvData.Rows.Clear();
            foreach (DataRow rows in ds.Tables[0].Rows)
            {
                int             currentRowIndex = dgvData.Rows.Add(1);
                DataGridViewRow row             = dgvData.Rows[currentRowIndex];
                row.Cells[1].Selected = false;

                row.Cells["No"].Value           = rows["LINE_NUMBER"];
                row.Cells["PRODUCT_CODE"].Value = rows["PRODUCT_CODE"];


                string           code         = rows["PRODUCT_CODE"].ToString();
                BaseProductTable productTable = bProduct.GetModel(code);
                if (productTable != null)
                {
                    row.Cells["SPEC"].Value         = productTable.SPEC;
                    row.Cells["PRODUCT_NAME"].Value = productTable.NAME;
                }

                BaseStockTable stock = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(rows["WAREHOUSE_CODE"].ToString(), rows["PRODUCT_CODE"].ToString());
                if (stock != null)
                {
                    row.Cells["STOCK_QUANTITY"].Value    = rows["STOCK_QUANTITY"];
                    row.Cells["TRUE_QUANTITY"].Value     = rows["TRUE_QUANTITY"];
                    row.Cells["OLD_TRUE_QUANTITY"].Value = rows["TRUE_QUANTITY"];
                    row.Cells["UNIT_NAME"].Value         = bCommon.GetBaseMaster("UNIT", stock.UNIT_CODE).Name;
                }
            }

            if (ds.Tables[0].Rows.Count < 14 * currentPage)
            {
                dgvData.Rows.Add(14 - ds.Tables[0].Rows.Count);
            }

            this.Left = (int)((Screen.PrimaryScreen.Bounds.Width - this.Width) / 2);
            this.Top  = (int)((Screen.PrimaryScreen.Bounds.Height - this.Height) / 2);
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvData_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex != -1)
            {
                DataGridViewRow dgvr = dgvData.Rows[e.RowIndex];
                if (e.ColumnIndex == dgvData.Columns["DEPARTUAL_WAREHOUSE"].Index)
                {
                    string warehouseCode   = CConvert.ToString(dgvr.Cells["DEPARTUAL_WAREHOUSE"].Value);
                    string productCode     = CConvert.ToString(dgvr.Cells["PRODUCT_CODE"].Value);
                    string orderSlipNumber = CConvert.ToString(txtSlipNumber.Text);

                    BaseStockTable stockTable = bStock.GetModel(warehouseCode, productCode);
                    decimal        stock      = 0;
                    if (stockTable != null)
                    {
                        stock = CConvert.ToDecimal(stockTable.QUANTITY);
                    }

                    stock -= bAlloation.GetAlloationQuantity(orderSlipNumber, warehouseCode, productCode);

                    dgvr.Cells["STOCK"].Value = stock;

                    decimal quantity = CConvert.ToDecimal(dgvr.Cells["QUANTITY"].Value);

                    decimal alloationQuantity = CConvert.ToDecimal(dgvr.Cells["ALLOATION_QUANTITY"].Value);

                    if (alloationQuantity > stock)
                    {
                        dgvr.Cells["IS_ALLOATION"].Value = "NG";
                        dgvr.DefaultCellStyle.BackColor  = COLOR_NG;
                    }
                    else
                    {
                        dgvr.Cells["IS_ALLOATION"].Value = "OK";

                        if (e.RowIndex % 2 == 0)
                        {
                            dgvr.DefaultCellStyle.BackColor = Color.White;
                        }
                        else
                        {
                            dgvr.DefaultCellStyle.BackColor = COLOR_DIFF_ROW;
                        }
                    }
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BaseStockTable GetModel(string WAREHOUSE_CODE, string PRODUCT_CODE)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 WAREHOUSE_CODE,PRODUCT_CODE,UNIT_CODE,QUANTITY,STATUS_FLAG,CREATE_USER,CREATE_DATE_TIME,LAST_UPDATE_TIME,LAST_UPDATE_USER from BASE_STOCK ");
            strSql.Append(" where WAREHOUSE_CODE=@WAREHOUSE_CODE and PRODUCT_CODE=@PRODUCT_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WAREHOUSE_CODE", SqlDbType.VarChar, 50),
                new SqlParameter("@PRODUCT_CODE",   SqlDbType.VarChar, 50)
            };
            parameters[0].Value = WAREHOUSE_CODE;
            parameters[1].Value = PRODUCT_CODE;

            BaseStockTable model = new BaseStockTable();
            DataSet        ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.WAREHOUSE_CODE = ds.Tables[0].Rows[0]["WAREHOUSE_CODE"].ToString();
                model.PRODUCT_CODE   = ds.Tables[0].Rows[0]["PRODUCT_CODE"].ToString();
                model.UNIT_CODE      = ds.Tables[0].Rows[0]["UNIT_CODE"].ToString();
                if (ds.Tables[0].Rows[0]["QUANTITY"].ToString() != "")
                {
                    model.QUANTITY = decimal.Parse(ds.Tables[0].Rows[0]["QUANTITY"].ToString());
                }
                if (ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString() != "")
                {
                    model.STATUS_FLAG = int.Parse(ds.Tables[0].Rows[0]["STATUS_FLAG"].ToString());
                }
                model.CREATE_USER = ds.Tables[0].Rows[0]["CREATE_USER"].ToString();
                if (ds.Tables[0].Rows[0]["CREATE_DATE_TIME"].ToString() != "")
                {
                    model.CREATE_DATE_TIME = DateTime.Parse(ds.Tables[0].Rows[0]["CREATE_DATE_TIME"].ToString());
                }
                if (ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString() != "")
                {
                    model.LAST_UPDATE_TIME = DateTime.Parse(ds.Tables[0].Rows[0]["LAST_UPDATE_TIME"].ToString());
                }
                model.LAST_UPDATE_USER = ds.Tables[0].Rows[0]["LAST_UPDATE_USER"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #9
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            _currentDt = bProductBuild.GetBuildPrintList(GetConduction()).Tables[0];
            _currentDt.Columns.Add("PURCHASE_QUANTITY");
            _currentDt.Columns.Add("NO_ALLOATION");
            _currentDt.Columns.Add("STATUE_FLAG");

            foreach (DataRow rows in _currentDt.Rows)
            {
                rows["PURCHASE_QUANTITY"] = CConvert.ToDecimal(rows["QUANTITY"]) * CConvert.ToDecimal(txtQuantity.Text.Trim());
                decimal        alloationQuantity = bAlloation.GetAlloationQuantity(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                BaseStockTable stock             = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), CConvert.ToString(rows["PRODUCT_PART_CODE"]));
                rows["NO_ALLOATION"] = stock.QUANTITY - alloationQuantity;
                if (CConvert.ToDecimal(rows["NO_ALLOATION"]) >= CConvert.ToDecimal(rows["PURCHASE_QUANTITY"]))
                {
                    rows["STATUE_FLAG"] = "OK";
                }
                else
                {
                    rows["STATUE_FLAG"] = "NG";
                }
            }
            if (_currentDt.Rows.Count > 0 && isSearch)
            {
                SaveFileDialog sf = new SaveFileDialog();
                sf.FileName = "HD_BUILD_PRINT_" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls";
                sf.Filter   = "(文件)|*.xls;*.xlsx";

                string header = "组成品编号\t组成品名称\t材料编号\t材料名称\t材料规格\t单位编号\t单位名称\t最小构成数量\t需求数量\t未引当数量\t状况\t\n";
                if (sf.ShowDialog(this) == DialogResult.OK)
                {
                    if (_currentDt != null)
                    {
                        int result = CExport.DataTableToCsv(_currentDt, header, sf.FileName);
                        if (result == 0)
                        {
                            MessageBox.Show("成功!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
            }
        }
Beispiel #10
0
 private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex == dgvData.Columns["BtnProduct"].Index)
         {
             FrmMasterSearch frm = new FrmMasterSearch("PRODUCT", "");
             if (frm.ShowDialog(this) == DialogResult.OK)
             {
                 if (frm.BaseMasterTable != null)
                 {
                     DataGridViewRow  dr           = dgvData.Rows[e.RowIndex];
                     string           code         = frm.BaseMasterTable.Code;
                     BaseProductTable productTable = bProduct.GetModel(code);
                     BaseStockTable   stock        = bStock.GetModel(txtDepartualCode.Text.Trim(), productTable.CODE);
                     BAlloation       bAlloation   = new BAlloation();
                     if (productTable != null)
                     {
                         dr.Cells["PRODUCT_CODE"].Value = productTable.CODE;
                         dr.Cells["PRODUCT_NAME"].Value = productTable.NAME;
                         decimal alloationQuantity = bAlloation.GetAlloationQuantity(txtDepartualCode.Text.Trim(), productTable.CODE);
                         dr.Cells["QUANTITY"].Value          = stock.QUANTITY - alloationQuantity;
                         dr.Cells["UNIT_NAME"].Value         = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                         dr.Cells["UNIT_CODE"].Value         = productTable.BASIC_UNIT_CODE;
                         dr.Cells["TRANSFER_QUANTITY"].Value = "1";
                     }
                     else
                     {
                         MessageBox.Show("商品不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                         dr.Cells["QUANTITY"].Value = "0";
                         dr.Cells["CODE"].Selected  = true;
                     }
                 }
             }
             frm.Dispose();
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(BaseStockTable stockTable)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BASE_STOCK set ");
            strSql.Append("UNIT_CODE=@UNIT_CODE,");
            strSql.Append("QUANTITY=QUANTITY-@QUANTITY,");
            strSql.Append("STATUS_FLAG=@STATUS_FLAG,");
            strSql.Append("LAST_UPDATE_TIME=GETDATE(),");
            strSql.Append("LAST_UPDATE_USER=@LAST_UPDATE_USER");
            strSql.Append(" where WAREHOUSE_CODE=@WAREHOUSE_CODE and PRODUCT_CODE=@PRODUCT_CODE ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@WAREHOUSE_CODE",   SqlDbType.VarChar, 20),
                new SqlParameter("@PRODUCT_CODE",     SqlDbType.VarChar, 20),
                new SqlParameter("@UNIT_CODE",        SqlDbType.VarChar, 20),
                new SqlParameter("@QUANTITY",         SqlDbType.Decimal,  9),
                new SqlParameter("@STATUS_FLAG",      SqlDbType.Int,      4),
                new SqlParameter("@LAST_UPDATE_USER", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = stockTable.WAREHOUSE_CODE;
            parameters[1].Value = stockTable.PRODUCT_CODE;
            parameters[2].Value = stockTable.UNIT_CODE;
            parameters[3].Value = stockTable.QUANTITY;
            parameters[4].Value = stockTable.STATUS_FLAG;
            parameters[5].Value = stockTable.LAST_UPDATE_USER;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #12
0
        private void btnRelieve_Click(object sender, EventArgs e)
        {
            if (RelieveCheck())
            {
                BllProductBuildTable     PBModel  = new BllProductBuildTable();
                BllProductBuildLineTable PBLModel = null;
                int i = 1;

                PBModel.SLIP_NUMBER = CConvert.ToString(CConvert.ToInt32(bProductBuild.GetBuildMaxSlipNumber()) + 1).PadLeft(4, '0');
                BaseProductTable product = bProduct.GetModel(txtProduct.Text.Trim());
                PBModel.PRODUCT_CODE   = txtProduct.Text.Trim();
                PBModel.WAREHOUSE_CODE = txtWarehouse.Text.Trim();
                PBModel.QUANTITY       = CConvert.ToDecimal(txtRelieveQuantity.Text.Trim());
                PBModel.COMPANY_CODE   = _userInfo.COMPANY_CODE;
                PBModel.BUILD_DATE     = txtSlipDate.Value;

                BaseStockTable stock = new BaseStockTable();
                stock                    = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), txtProduct.Text.Trim());
                PBModel.UNIT_CODE        = stock.UNIT_CODE;
                PBModel.STATUS_FLAG      = CConstant.RELIEVE_STATUS;
                PBModel.CREATE_USER      = _userInfo.CODE;
                PBModel.LAST_UPDATE_USER = _userInfo.CODE;

                DataSet ds = bProductBuild.getParts(txtProduct.Text.Trim());
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    PBLModel                    = new BllProductBuildLineTable();
                    PBLModel.SLIP_NUMBER        = PBModel.SLIP_NUMBER;
                    PBLModel.LINE_NUMBER        = i;
                    PBLModel.PRODUCT_PARTS_CODE = CConvert.ToString(row["PRODUCT_PART_CODE"]);
                    PBLModel.PARTS_QUANTITY     = CConvert.ToDecimal(row["QUANTITY"]) * PBModel.QUANTITY;
                    BaseStockTable stock1 = new BaseStockTable();
                    stock1               = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), PBLModel.PRODUCT_PARTS_CODE);
                    PBLModel.UNIT_CODE   = stock1.UNIT_CODE;
                    PBLModel.STATUS_FLAG = CConstant.INIT_STATUS;

                    if (PBLModel.SLIP_NUMBER != null)
                    {
                        PBModel.AddItem(PBLModel);
                    }
                    i++;
                }

                int result = 0;
                try
                {
                    result = bProductBuild.AddRelieve(PBModel);
                    if (result <= 0)
                    {
                        string errorLog = "解除失败,请重试或与管理员联系.";
                        MessageBox.Show(errorLog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        txtWarehouse.Text       = "";
                        txtWarehouseName.Text   = "";
                        txtProduct.Text         = "";
                        txtProductName.Text     = "";
                        txtNoAlloation.Text     = "";
                        txtRelieveQuantity.Text = "";
                        txtSlipDate.Value       = DateTime.Now;
                        MessageBox.Show("保存成功", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("保存失败,系统错误,请与管理员联系.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Logger.Error("组成失败!", ex);
                }
            }
        }
Beispiel #13
0
 public bool UpdateStock(BaseStockTable stockTable)
 {
     return(dal.UpdateStock(stockTable));
 }
Beispiel #14
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(BaseStockTable model)
 {
     return(dal.Update(model));
 }
Beispiel #15
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(BaseStockTable model)
 {
     return(dal.Add(model));
 }
Beispiel #16
0
        private void dgvData_CellValidated(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                DataGridViewRow dr = dgvData.Rows[e.RowIndex];
                if (e.ColumnIndex == dgvData.Columns["PRODUCT_CODE"].Index)
                {
                    string           code         = dr.Cells["PRODUCT_CODE"].Value.ToString().Trim();
                    BaseProductTable productTable = bProduct.GetModel(code);

                    if (productTable != null)
                    {
                        dr.Cells["PRODUCT_CODE"].Value = productTable.CODE;
                        dr.Cells["PRODUCT_NAME"].Value = productTable.NAME;

                        BaseStockTable stock             = bStock.GetModel(txtDepartualCode.Text.Trim(), productTable.CODE);
                        BAlloation     bAlloation        = new BAlloation();
                        decimal        alloationQuantity = bAlloation.GetAlloationQuantity(txtDepartualCode.Text.Trim(), productTable.CODE);
                        dr.Cells["QUANTITY"].Value          = stock.QUANTITY - alloationQuantity;
                        dr.Cells["UNIT_NAME"].Value         = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                        dr.Cells["UNIT_CODE"].Value         = productTable.BASIC_UNIT_CODE;
                        dr.Cells["TRANSFER_QUANTITY"].Value = "1";
                    }
                    else
                    {
                        MessageBox.Show("商品不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        dr.Cells["PRODUCT_CODE"].Value      = null;
                        dr.Cells["PRODUCT_NAME"].Value      = null;
                        dr.Cells["QUANTITY"].Value          = "0";
                        dr.Cells["UNIT_NAME"].Value         = null;
                        dr.Cells["UNIT_CODE"].Value         = null;
                        dr.Cells["TRANSFER_QUANTITY"].Value = "0";
                        dr.Cells["CODE"].Selected           = true;
                    }
                }
                else if (e.ColumnIndex == dgvData.Columns["TRANSFER_QUANTITY"].Index)
                {
                    if (dr.Cells["TRANSFER_QUANTITY"].Value == null)
                    {
                        dr.Cells["TRANSFER_QUANTITY"].Value = 0;
                        MessageBox.Show("调拨数量不能为空!");
                    }
                    else
                    {
                        Int32 price;
                        if (!Int32.TryParse(CConvert.ToString(dr.Cells["TRANSFER_QUANTITY"].Value),
                                            System.Globalization.NumberStyles.Integer,
                                            System.Globalization.NumberFormatInfo.CurrentInfo, out price))
                        {
                            MessageBox.Show("调拨数量只能为整数,请重新输入!");
                            dr.Cells["TRANSFER_QUANTITY"].Value    = "0";
                            dr.Cells["TRANSFER_QUANTITY"].Selected = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show("PRODUCT_CODE");
                Logger.Error(ex.Message, ex);
            }
        }
Beispiel #17
0
        private void FrmAlloation_Load(object sender, EventArgs e)
        {
            BllOrderHeaderTable headerTable = bOrderHeader.GetModel(_slipNumber);

            this.txtSlipNumber.Text        = headerTable.SLIP_NUMBER;
            this.txtCustomerCode.Text      = headerTable.CUSTOMER_CODE;
            this.txtCustomerName.Text      = headerTable.CUSTOMER_NAME;
            this.txtEndCustomerCode.Text   = headerTable.ENDER_CUSTOMER_CODE;
            this.txtEndCustomerName.Text   = headerTable.ENDER_CUSTOMER_NAME;
            this.txtDeliveryPointCode.Text = headerTable.DELIVERY_POINT_CODE;
            this.txtDeliveryPointName.Text = headerTable.DELIVERY_POINT_NAME;
            this.txtOwnerPoNumber.Text     = headerTable.CUSTOMER_PO_NUMBER;
            this.txtSlipDate.Text          = CConvert.DateTimeToString(headerTable.SLIP_DATE, "yyyy-MM-dd");
            this.txtDepartualDate.Text     = CConvert.DateTimeToString(headerTable.DEPARTUAL_DATE, "yyyy-MM-dd");

            DataGridViewComboBoxColumn co = this.dgvData.Columns["DEPARTUAL_WAREHOUSE"] as DataGridViewComboBoxColumn;

            co.DataSource    = CCacheData.WAREHOUSE.Copy();
            co.DisplayMember = "NAME";
            co.ValueMember   = "CODE";

            foreach (BllOrderLineTable lineModel in headerTable.Items)
            {
                decimal         quantity        = CConvert.ToDecimal(lineModel.QUANTITY) - CConvert.ToDecimal(lineModel.SHIPMENT_QUANTITY);
                int             currentRowIndex = dgvData.Rows.Add(1);
                DataGridViewRow dgvr            = dgvData.Rows[currentRowIndex];
                dgvr.Cells["NO"].Value           = lineModel.LINE_NUMBER;
                dgvr.Cells["PRODUCT_CODE"].Value = lineModel.PRODUCT_CODE;
                dgvr.Cells["PRODUCT_NAME"].Value = lineModel.PRODUCT_NAME;
                dgvr.Cells["PRODUCT_SPEC"].Value = lineModel.PRODUCT_SPEC;
                dgvr.Cells["QUANTITY"].Value     = quantity;
                dgvr.Cells["UNIT_CODE"].Value    = lineModel.UNIT_NAME;
                dgvr.Cells["UNIT_NAME"].Value    = lineModel.UNIT_NAME;
                dgvr.Cells["REF_STOCK"].Value    = "参照";

                //当前己引当的仓库的取得
                BaseWarehouseTable warehouseTable = bAlloation.GetAlloationWarehouse(headerTable.SLIP_NUMBER, lineModel.LINE_NUMBER);
                string             warehouseCode  = warehouseTable.CODE;
                if (warehouseCode != null && warehouseCode != "")
                {
                    ((DataGridViewComboBoxCell)dgvr.Cells["DEPARTUAL_WAREHOUSE"]).Style.NullValue = warehouseTable.NAME + " ";
                }
                else
                {
                    warehouseCode = headerTable.DEPARTUAL_WAREHOUSE_CODE;
                    ((DataGridViewComboBoxCell)dgvr.Cells["DEPARTUAL_WAREHOUSE"]).Style.NullValue = headerTable.DEPARTUAL_WAREHOUSE_NAME + " ";
                }
                dgvr.Cells["DEFAULT_WAREHOUSE_CODE"].Value = warehouseCode;

                //当前仓库实际库存的取得
                BaseStockTable stockTable = bStock.GetModel(warehouseCode, lineModel.PRODUCT_CODE);
                decimal        stock      = 0;
                if (stockTable != null)
                {
                    stock = CConvert.ToDecimal(stockTable.QUANTITY);
                }

                //己使用的引当数量,当前订单除外,己出库数量除外
                stock -= bAlloation.GetAlloationQuantity(headerTable.SLIP_NUMBER, warehouseCode, lineModel.PRODUCT_CODE);

                dgvr.Cells["STOCK"].Value = stock;

                dgvr.Cells["ALLOATION_QUANTITY"].Value = quantity;
                BaseProductTable pTable = null;
                if (lineModel.PRODUCT_CODE.Length >= 4 && lineModel.PRODUCT_CODE.Substring(0, 4) == "9999")
                {
                    pTable = bProduct.GetModel(lineModel.PRODUCT_CODE.Substring(0, 4));
                }
                else
                {
                    pTable = bProduct.GetModel(lineModel.PRODUCT_CODE);
                }
                if (pTable.STOCK_FLAG == 2)
                {
                    dgvr.Cells["IS_ALLOATION"].Value = "OK";
                }
                else if (quantity > stock)
                {
                    dgvr.Cells["IS_ALLOATION"].Value = "NG";
                }
                else
                {
                    dgvr.Cells["IS_ALLOATION"].Value = "OK";
                }
            }
        }
Beispiel #18
0
 private void dgvData_CellValidated(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         DataGridViewRow dr = dgvData.Rows[e.RowIndex];
         if (e.ColumnIndex == dgvData.Columns["PRODUCT_CODE"].Index)
         {
             string           code         = dr.Cells["PRODUCT_CODE"].Value.ToString().Trim();
             BaseProductTable productTable = bProduct.GetModel(code);
             if (productTable != null)
             {
                 dr.Cells["PRODUCT_CODE"].Value    = productTable.CODE;
                 dr.Cells["PRODUCT_NAME"].Value    = productTable.NAME;
                 dr.Cells["SPEC"].Value            = productTable.SPEC + " " + productTable.MODEL_NUMBER;
                 dr.Cells["UNIT_NAME"].Value       = bCommon.GetBaseMaster("UNIT", productTable.BASIC_UNIT_CODE).Name;
                 dr.Cells["UNIT_CODE"].Value       = productTable.BASIC_UNIT_CODE;
                 dr.Cells["SANCTION_NUMBER"].Value = "1";
                 BaseStockTable stock = bStock.GetModel(txtWarehouseCode.Text.Trim(), productTable.CODE);
                 if (stock == null)
                 {
                     dr.Cells["QUANTITY"].Value = "0";
                 }
                 else
                 {
                     dr.Cells["QUANTITY"].Value = stock.QUANTITY;
                 }
             }
             else
             {
                 MessageBox.Show("商品不存在.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 dr.Cells["PRODUCT_CODE"].Value    = null;
                 dr.Cells["PRODUCT_NAME"].Value    = null;
                 dr.Cells["SPEC"].Value            = null;
                 dr.Cells["QUANTITY"].Value        = "0";
                 dr.Cells["UNIT_NAME"].Value       = null;
                 dr.Cells["UNIT_CODE"].Value       = null;
                 dr.Cells["SANCTION_NUMBER"].Value = "0";
                 dr.Cells["CODE"].Selected         = true;
             }
         }
         else if (e.ColumnIndex == dgvData.Columns["SANCTION_NUMBER"].Index)
         {
             if (dr.Cells["SANCTION_NUMBER"].Value == null)
             {
                 dr.Cells["SANCTION_NUMBER"].Value = "0";
                 MessageBox.Show("修改数量不能为空!");
             }
             else
             {
                 //Int32 price;
                 //if (!Int32.TryParse(CConvert.ToString(dr.Cells["SANCTION_NUMBER"].Value),
                 //    System.Globalization.NumberStyles.Integer,
                 //    System.Globalization.NumberFormatInfo.CurrentInfo, out price))
                 //{
                 //    MessageBox.Show("处分数只能为整数,请重新输入!");
                 //    dr.Cells["SANCTION_NUMBER"].Value = "0";
                 //    dr.Cells["SANCTION_NUMBER"].Selected = true;
                 //}
                 decimal sanctionNumber = CConvert.ToDecimal(dr.Cells["SANCTION_NUMBER"].Value);
                 decimal quantity       = CConvert.ToDecimal(dr.Cells["QUANTITY"].Value);
                 if ((sanctionNumber + quantity) < 0)
                 {
                     MessageBox.Show("库存数量与修改数量之和不能小于0!");
                     dr.Cells["SANCTION_NUMBER"].Value = "0";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         //MessageBox.Show("PRODUCT_CODE");
         Logger.Error(ex.Message, ex);
     }
 }
Beispiel #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (isSearch)
            {
                if (saveCheck())
                {
                    BllProductBuildTable     PBModel  = new BllProductBuildTable();
                    BllProductBuildLineTable PBLModel = null;

                    //组成编号
                    PBModel.SLIP_NUMBER = CConvert.ToString(CConvert.ToInt32(bProductBuild.GetBuildMaxSlipNumber()) + 1).PadLeft(4, '0');
                    //仓库
                    PBModel.WAREHOUSE_CODE = txtWarehouse.Text.Trim();
                    PBModel.PRODUCT_CODE   = txtProduct.Text.Trim();
                    PBModel.QUANTITY       = CConvert.ToDecimal(txtQuantity.Text.Trim());
                    PBModel.BUILD_DATE     = txtFormDate.Value;
                    PBModel.COMPANY_CODE   = _userInfo.COMPANY_CODE;

                    BaseStockTable stock = new BaseStockTable();
                    stock                    = bPurchaseOrder.GetStockModel(txtWarehouse.Text.Trim(), txtProduct.Text.Trim());
                    PBModel.UNIT_CODE        = stock.UNIT_CODE;
                    PBModel.STATUS_FLAG      = CConstant.BUILD_STATUS;
                    PBModel.CREATE_USER      = _userInfo.CODE;
                    PBModel.LAST_UPDATE_USER = _userInfo.CODE;

                    foreach (DataGridViewRow row in dgvData.Rows)
                    {
                        if (row.Cells["PARTS_CODE"].Value != null)
                        {
                            PBLModel                    = new BllProductBuildLineTable();
                            PBLModel.SLIP_NUMBER        = PBModel.SLIP_NUMBER;
                            PBLModel.LINE_NUMBER        = row.Index + 1;
                            PBLModel.PRODUCT_PARTS_CODE = CConvert.ToString(row.Cells["PARTS_CODE"].Value);
                            PBLModel.PARTS_QUANTITY     = CConvert.ToDecimal(row.Cells["MIN_QUANTITY"].Value) * PBModel.QUANTITY;
                            PBLModel.UNIT_CODE          = CConvert.ToString(row.Cells["UNIT_CODE"].Value);
                            PBLModel.STATUS_FLAG        = CConstant.INIT;
                            if (PBLModel.SLIP_NUMBER != null)
                            {
                                PBModel.AddItem(PBLModel);
                            }
                        }
                    }

                    int result = 0;
                    try
                    {
                        result = bProductBuild.AddBuild(PBModel);
                        if (result <= 0)
                        {
                            string errorLog = "保存失败,请重试或与管理员联系.";
                            MessageBox.Show(errorLog, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            dgvData.Rows.Clear();
                            init();
                            txtWarehouse.Text        = "";
                            txtWarehouseName.Text    = "";
                            txtProduct.Text          = "";
                            txtProductName.Text      = "";
                            txtQuantity.Text         = "";
                            txtPossibleQuantity.Text = "";
                            txtFormDate.Value        = DateTime.Now;
                            MessageBox.Show("保存成功", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("保存失败,系统错误,请与管理员联系.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Logger.Error("组成失败!", ex);
                    }
                }
            }
        }
Beispiel #20
0
        public override string[] doUpdateDB()
        {
            BaseStockTable StockTable     = null;
            BStock         bStock         = new BStock();
            StringBuilder  strError       = new StringBuilder();
            int            successData    = 0;
            int            failureData    = 0;
            string         errorFilePath  = "";
            string         backupFilePath = "";

            //数据导入处理
            foreach (DataRow dr in _csvDataTable.Rows)
            {
                StringBuilder str = new StringBuilder();
                //仓库编号
                str.Append(CheckWarehouse(CConvert.ToString(GetValue(dr, "WAREHOUSE_CODE")), "仓库编号"));
                //商品编号
                if (CConvert.ToString(GetValue(dr, "PRODUCT_CODE")).Length > 20)
                {
                    string product = GetValue(dr, "PRODUCT_CODE").ToString().Substring(0, 20);
                    str.Append(CheckProduct(product, "商品编号"));
                }
                else
                {
                    str.Append(CheckProduct(CConvert.ToString(GetValue(dr, "PRODUCT_CODE")), "商品编号"));
                }
                //单位
                if (!string.IsNullOrEmpty(CConvert.ToString(GetValue(dr, "UNIT_CODE"))))
                {
                    str.Append(CheckUnit(CConvert.ToString(GetValue(dr, "UNIT_CODE")), "单位"));
                }
                //数量
                str.Append(CheckDecimal(GetValue(dr, "QUANTITY", 0), 12, 2, "数量"));
                //状态
                str.Append(CheckInt(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL), 9, "状态"));

                if (str.ToString().Trim().Length > 0)
                {
                    strError.Append(GetStringBuilder(dr, str.ToString().Trim()));
                    failureData++;
                    continue;
                }
                try
                {
                    int ret = 0;
                    StockTable = new BaseStockTable();
                    StockTable.WAREHOUSE_CODE = CConvert.ToString(GetValue(dr, "WAREHOUSE_CODE"));
                    if (GetValue(dr, "PRODUCT_CODE").ToString().Length > 20)
                    {
                        StockTable.PRODUCT_CODE = CConvert.ToString(GetValue(dr, "PRODUCT_CODE")).Substring(0, 20);
                    }
                    else
                    {
                        StockTable.PRODUCT_CODE = CConvert.ToString(GetValue(dr, "PRODUCT_CODE"));
                    }
                    StockTable.UNIT_CODE        = CConvert.ToString(GetValue(dr, "UNIT_CODE"));
                    StockTable.QUANTITY         = CConvert.ToDecimal(GetValue(dr, "QUANTITY", 0));
                    StockTable.STATUS_FLAG      = CConvert.ToInt32(GetValue(dr, "STATUS_FLAG", CConstant.NORMAL));
                    StockTable.CREATE_USER      = _userInfo.CODE;
                    StockTable.LAST_UPDATE_USER = _userInfo.CODE;

                    if (!bStock.Exists(StockTable.WAREHOUSE_CODE, StockTable.PRODUCT_CODE))
                    {
                        bStock.Add(StockTable);
                    }
                    else
                    {
                        bStock.UpdateStock(StockTable);
                    }
                    successData++;
                }
                catch
                {
                    strError.Append(GetStringBuilder(dr, " 数据导入失败,请与系统管理员联系!").ToString());
                    failureData++;
                }
            }
            //错误记录处理
            if (strError.Length > 0)
            {
                errorFilePath = WriteFile(strError.ToString());
            }

            //备份处理
            backupFilePath = BackupFile();

            return(new string[] { successData.ToString(), failureData.ToString(), errorFilePath, backupFilePath });
        }
Beispiel #21
0
        public void OperateInit(int currentPage)
        {
            BllProductBuildTable PBModel = bProductBuild.GetModel(_slip_number);

            txtWarehouse.Text        = PBModel.WAREHOUSE_CODE;
            txtWarehouseName.Text    = bCommon.GetBaseMaster("WAREHOUSE", PBModel.WAREHOUSE_CODE).Name;
            txtProduct.Text          = PBModel.PRODUCT_CODE;
            txtProductName.Text      = bCommon.GetBaseMaster("PRODUCT", PBModel.PRODUCT_CODE).Name;
            txtQuantity.Text         = CConvert.ToString(PBModel.QUANTITY);
            txtPossibleQuantity.Text = CConvert.ToString(PBModel.QUANTITY);
            txtFormDate.Value        = PBModel.BUILD_DATE;

            dgvData.Rows.Clear();
            //foreach (BllProductBuildLineTable LModel in PBModel.Items)
            //{
            //    int currentRowIndex = dgvData.Rows.Add(1);
            //    DataGridViewRow row = dgvData.Rows[currentRowIndex];
            //    row.Cells[1].Selected = false;
            //    row.Cells["No"].Value = LModel.LINE_NUMBER;
            //    row.Cells["PARTS_CODE"].Value = LModel.PRODUCT_PARTS_CODE;

            //    BaseProductTable product = new BaseProductTable();
            //    BProduct bProduct = new BProduct();
            //    product = bProduct.GetModel(LModel.PRODUCT_PARTS_CODE);
            //    row.Cells["PARTS_NAME"].Value = product.NAME;
            //    row.Cells["SPEC"].Value = product.SPEC;

            //    BAlloation bAlloation = new BAlloation();
            //    decimal alloationQuantity = bAlloation.GetAlloationQuantity(PBModel.WAREHOUSE_CODE, LModel.PRODUCT_PARTS_CODE);
            //    BaseStockTable stock = new BaseStockTable();
            //    stock = bPurchaseOrder.GetStockModel(PBModel.WAREHOUSE_CODE, LModel.PRODUCT_PARTS_CODE);
            //    row.Cells["NO_ALLOATION"].Value = stock.QUANTITY - alloationQuantity;
            //    row.Cells["UNIT_CODE"].Value = PBModel.UNIT_CODE;
            //    row.Cells["UNIT_NAME"].Value = bCommon.GetBaseMaster("UNIT", PBModel.UNIT_CODE).Name;

            //    row.Cells["PURCHASE_QUANTITY"].Value = LModel.PARTS_QUANTITY;

            //    row.Cells["STATUE_FLAG"].Value = "OK";

            //}
            for (int i = (currentPage - 1) * PageSize + 1; i <= PBModel.Items.Count && (i - (currentPage - 1) * PageSize) < PageSize; i++)
            {
                int             currentRowIndex = dgvData.Rows.Add(1);
                DataGridViewRow row             = dgvData.Rows[currentRowIndex];
                row.Cells[1].Selected           = false;
                row.Cells["No"].Value           = PBModel.Items[i - 1].LINE_NUMBER;
                row.Cells["PARTS_CODE"].Value   = PBModel.Items[i - 1].PRODUCT_PARTS_CODE;
                row.Cells["MIN_QUANTITY"].Value = PBModel.Items[i - 1].PARTS_QUANTITY / PBModel.QUANTITY;
                BaseProductTable product  = new BaseProductTable();
                BProduct         bProduct = new BProduct();
                product = bProduct.GetModel(PBModel.Items[i - 1].PRODUCT_PARTS_CODE);
                row.Cells["PARTS_NAME"].Value = product.NAME;
                row.Cells["SPEC"].Value       = product.SPEC;

                BAlloation     bAlloation        = new BAlloation();
                decimal        alloationQuantity = bAlloation.GetAlloationQuantity(PBModel.WAREHOUSE_CODE, PBModel.Items[i - 1].PRODUCT_PARTS_CODE);
                BaseStockTable stock             = new BaseStockTable();
                stock = bPurchaseOrder.GetStockModel(PBModel.WAREHOUSE_CODE, PBModel.Items[i - 1].PRODUCT_PARTS_CODE);
                row.Cells["NO_ALLOATION"].Value = stock.QUANTITY - alloationQuantity;
                row.Cells["UNIT_CODE"].Value    = PBModel.UNIT_CODE;
                row.Cells["UNIT_NAME"].Value    = bCommon.GetBaseMaster("UNIT", PBModel.UNIT_CODE).Name;

                row.Cells["PURCHASE_QUANTITY"].Value = PBModel.Items[i - 1].PARTS_QUANTITY;

                row.Cells["STATUE_FLAG"].Value = "OK";
            }

            if (PBModel.Items.Count < PageSize * currentPage)
            {
                dgvData.Rows.Add(PageSize - PBModel.Items.Count);
            }
        }