Esempio n. 1
0
 private void txtProductCode_Leave(object sender, EventArgs e)
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(this.txtProductCode.Text.Trim()))
     {
         BaseProductTable product  = new BaseProductTable();
         BProduct         bProduct = new BProduct();
         product = bProduct.GetModel(this.txtProductCode.Text);
         if (product == null || "".Equals(product))
         {
             txtProductCode.Focus();
             txtProductCode.Text = "";
             txtProductName.Text = "";
             MessageBox.Show("商品编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             txtProductCode.Text = product.CODE;
             txtProductName.Text = product.NAME;
         }
     }
     else
     {
         txtProductName.Text = "";
     }
 }
Esempio n. 2
0
 private void txtCode_Leave(object sender, EventArgs e)
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(this.txtCode.Text.Trim()))
     {
         BaseProductTable ProductCode = new BaseProductTable();
         ProductCode = bProduct.GetModel(txtCode.Text);
         if (ProductCode != null)
         {
             txtCode.Focus();
             txtCode.Text = "";
             MessageBox.Show("编号已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 获得当前选中的数据
        /// </summary>
        private void GetCurrentSelectedTable()
        {
            try
            {
                string code = dgvData.SelectedRows[0].Cells["CODE"].Value.ToString();
                if (code != "")
                {
                    _currentProductTable = bProduct.GetModel(code);
                }
            }
            catch (Exception ex) { }

            if (_currentProductTable == null || _currentProductTable.CODE == null || "".Equals(_currentProductTable.CODE))
            {
                _currentProductTable = null;
            }
        }
Esempio n. 4
0
 private void txtProductCode_Leave(object sender, EventArgs e)
 {
     //判断编号是否已存在
     if (!string.IsNullOrEmpty(this.txtWarehouseCode.Text.Trim()) && !string.IsNullOrEmpty(this.txtProductCode.Text.Trim()))
     {
         BaseSafetyStockTable SafetyCode = new BaseSafetyStockTable();
         SafetyCode = bSafetyStock.GetModel(txtWarehouseCode.Text, txtProductCode.Text);
         if (SafetyCode != null)
         {
             txtWarehouseCode.Text = "";
             txtWarehouseName.Text = "";
             txtProductCode.Text   = "";
             txtProductName.Text   = "";
             txtWarehouseCode.Focus();
             MessageBox.Show("仓库编号与商品编号的组合已存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
     if (!string.IsNullOrEmpty(this.txtProductCode.Text.Trim()))
     {
         BaseProductTable product  = new BaseProductTable();
         BProduct         bProduct = new BProduct();
         product = bProduct.GetModel(this.txtProductCode.Text);
         if (product == null || "".Equals(product))
         {
             txtProductCode.Focus();
             txtProductCode.Text = "";
             txtProductName.Text = "";
             MessageBox.Show("商品编号不存在,请重新输入!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             txtProductCode.Text = product.CODE;
             txtProductName.Text = product.NAME;
             txtUnitCode.Text    = product.BASIC_UNIT_CODE;
             txtUnitName.Text    = product.BASIC_UNIT_NAME;
         }
     }
     else
     {
         txtProductName.Text = "";
     }
 }
Esempio n. 5
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";
                }
            }
        }
Esempio n. 6
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);
            }
        }