Ejemplo n.º 1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            #region//对材料种类、名称、规格、采购总量的校验
            if (!Check.CheckEmpty(cbxKinds.Text.ToString()))
            {
                MessageBox.Show("材料种类不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbxKinds.Focus();
                return;
            }
            if (!Check.CheckEmpty(cbxName.Text.ToString()))
            {
                MessageBox.Show("材料名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbxName.Focus();
                return;
            }
            if (!Check.CheckEmpty(cbxModel.Text.ToString()))
            {
                MessageBox.Show("材料规格不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbxModel.Focus();
                return;
            }
            if (!Check.CheckEmpty(textBox1.Text.ToString()))
            {
                MessageBox.Show("采购总量不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textBox1.Focus();
                return;
            }
            #endregion
            MaterialClass materialmodel = new MaterialClass();
            materialmodel.mnId = Convert.ToInt32(this.cbxName.SelectedValue.ToString());
            materialmodel.mmId = Convert.ToInt32(this.cbxModel.SelectedValue.ToString());

            getStockDetailInfo();
            stockPlanDetail.mId = (long)(purchaseSchedetaillogic.getObj(materialmodel).id);
            purchaseSchedetaillogic.stockPlanDetailAdd(stockPlanDetail, ds.Tables[0], cbxKinds.Text, cbxName.Text, cbxModel.Text);
            clearText();
            cbxKinds.SelectedIndex = -1;
            cbxName.SelectedIndex  = -1;
            cbxModel.SelectedIndex = -1;
        }
Ejemplo n.º 2
0
        public MaterialClass getObj(MaterialClass material)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * from material");
            if (material != null)
            {
                strSql.Append(" where 1=1 ");
                if (material.id != null)
                {
                    strSql.Append(" and id='" + material.id + "'");
                }
                if (material.inputDate != null)
                {
                    strSql.Append(" and inputDate='" + material.inputDate + "'");
                }
                if (material.inputMan != null)
                {
                    strSql.Append(" and inputMan='" + material.inputMan + "'");
                }
                if (material.mnId != null)
                {
                    strSql.Append(" and mnId ='" + material.mnId + "'");
                }
                if (material.mmId != null)
                {
                    strSql.Append(" and mmId='" + material.mmId + "'");
                }
                if (material.density != null)
                {
                    strSql.Append(" and density='" + material.density + "'");
                }
                if (material.remark != null)
                {
                    strSql.Append(" and remark='" + material.remark + "'");
                }
            }
            return(purchadetail.queryObj(strSql.ToString()));
        }
Ejemplo n.º 3
0
        private void btn_detailAdd_Click(object sender, EventArgs e)
        {
            #region//对所有明细信息进行校验
            if (!Check.CheckEmpty(cbm_materialKind.Text.ToString()))
            {
                MessageBox.Show("材料种类不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbm_materialKind.Focus();
                return;
            }
            if (!Check.CheckEmpty(cbm_materialInformation.Text.ToString()))
            {
                MessageBox.Show("材料名称不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbm_materialInformation.Focus();
                return;
            }
            if (!Check.CheckEmpty(cbm_materialModel.Text.ToString()))
            {
                MessageBox.Show("材料规格不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                cbm_materialModel.Focus();
                return;
            }
            if (!Check.CheckEmpty(txtquantity.Text.ToString()))
            {
                MessageBox.Show("采购数量不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtquantity.Focus();
                return;
            }
            else
            {
                if (!Check.CheckFloat(txtquantity.Text.ToString()))
                {
                    MessageBox.Show("采购总数量含非法字符!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtquantity.Clear();
                    txtquantity.Focus();
                    return;
                }
            }
            if (!Check.CheckEmpty(txtunitPrice.Text.ToString()))
            {
                MessageBox.Show("采购单价不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtunitPrice.Focus();
                return;
            }
            else
            {
                if (!Check.CheckFloat(txtunitPrice.Text.ToString()))
                {
                    MessageBox.Show("采购单价含有非法字符!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtunitPrice.Clear();
                    txtunitPrice.Focus();
                    return;
                }
            }

            #endregion
            // 处理两条明细相同时给予提示信息
            if (dgv_detail.Rows.Count != 0)
            {
                foreach (DataGridViewRow dgvr in dgv_detail.Rows)
                {
                    if (dgvr.Cells["sort"].Value.ToString() == cbm_materialKind.Text.ToString() &&
                        dgvr.Cells["materialInformation"].Value.ToString() == cbm_materialInformation.Text.ToString() &&
                        dgvr.Cells["materialModel"].Value.ToString() == cbm_materialModel.Text.ToString())
                    {
                        if (MessageBox.Show("确定添加相同种类名称规格的材料合同明细吗?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                        }
                        else
                        {
                            return;
                        }
                    }
                }
            }
            MaterialClass materialmodel = new MaterialClass();
            materialmodel.mnId = Convert.ToInt32(this.cbm_materialInformation.SelectedValue.ToString());
            materialmodel.mmId = Convert.ToInt32(this.cbm_materialModel.SelectedValue.ToString());

            Indent indent = new Indent();

            indent.mId       = (long)(purchaseSchedetaillogic.getObj(materialmodel).id);
            indent.inputMan  = this.UserName;
            indent.inputDate = DateTime.Now;
            indent.unitPrice = decimal.Parse(this.txtunitPrice.Text.Trim());
            indent.quantity  = decimal.Parse(this.txtquantity.Text.Trim());
            stockContractDetailLogic.indentNewRow(indent, ds.Tables[0], cbm_materialKind.Text, cbm_materialInformation.Text, cbm_materialModel.Text);

            clearComboboxAndTextBox();
            caleTotalMoneyAndTotalWeight();
        }