Exemple #1
0
        private void UpdatePrice(string GoodsCode, decimal dPrice)
        {
            //修改价格物价加权平局价格
            MesGoodsBLL GoodsBLL = new MesGoodsBLL();

            GoodsBLL.UpdateEntity(GoodsCode, dPrice);
        }
Exemple #2
0
        private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyValue == 13)
                {
                    string strBarcode = txtBarcode.Text;

                    string[] strTemp = strBarcode.Split(',');


                    //MessageBox.Show(strTemp.Length.ToString());
                    txtCode.Text  = Resolve(strTemp[0].ToString());
                    txtBatch.Text = Resolve(strTemp[1].ToString());
                    txtQty.Text   = Resolve(strTemp[2].ToString());

                    m_strBarcode = strTemp[4].ToString();;

                    MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                    var         Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'");
                    int         nLen       = Goods_rows.Count;
                    if (nLen > 0)
                    {
                        txtName.Text = Goods_rows[0].G_Name;
                        txtUnit.Text = Goods_rows[0].G_Unit;
                        //txtPrice.Text = Goods_rows[0].G_Price.ToString();
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("输入法错误");
                txtBarcode.Clear();
            }
        }
Exemple #3
0
        private void textBox8_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyValue == 13)
                {
                    string strBarcode = txtBarcode.Text;
                    if (strBarcode.IndexOf('*') > 0)
                    {
                        string[] strTemp      = strBarcode.Split('*');
                        string   strGoodsCode = strTemp[0].ToString();
                        if (cmbGoodsCode.Items.Contains(strGoodsCode))
                        {
                            cmbGoodsCode.Text = strTemp[0].ToString();
                            cmbPc.Text        = strTemp[1].ToString();
                            txtQty.Text       = strTemp[2].ToString();

                            MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                            var         Goods_rows = GoodsBLL.GetList(strTemp[0].ToString(), "");
                            int         nLen       = Goods_rows.Count;
                            if (nLen > 0)
                            {
                                txtName.Text  = Goods_rows[0].G_Name;
                                txtPrice.Text = Goods_rows[0].G_Price.ToString();
                                strUnit       = Goods_rows[0].G_Unit.ToString();
                            }
                        }
                    }
                    else
                    {
                        string[] strTemp = strBarcode.Split(',');


                        string strGoodsCode = Resolve(strTemp[0].ToString());
                        if (cmbGoodsCode.Items.Contains(strGoodsCode))
                        {
                            cmbGoodsCode.Text = Resolve(strTemp[0].ToString());
                            cmbPc.Text        = Resolve(strTemp[1].ToString());
                            txtQty.Text       = Resolve(strTemp[2].ToString());

                            MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                            var         Goods_rows = GoodsBLL.GetList(cmbGoodsCode.Text, "");
                            int         nLen       = Goods_rows.Count;
                            if (nLen > 0)
                            {
                                txtName.Text  = Goods_rows[0].G_Name;
                                txtPrice.Text = Goods_rows[0].G_Price.ToString();
                                strUnit       = Goods_rows[0].G_Unit.ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #4
0
        private void comGoods_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                string[]    strGoods = comGoods.Text.ToString().Split('$');
                MesGoodsBLL GoodsBLL = new MesGoodsBLL();
                //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity();
                var Goods_rows = GoodsBLL.GetList(strGoods[0], strGoods[1]);
                if (Goods_rows == null || Goods_rows.Count < 1 || Goods_rows[0].G_Kind == 2)
                {
                    untCommon.InfoMsg("输入的物料编码错误,请重新输入!");
                    return;
                }
                if (Goods_rows[0].G_Kind == 1)
                {
                    //txtGoodsCode.Text = Goods_rows[0].G_Code;
                    //txtGoodsName.Text = Goods_rows[0].G_Name;
                    txtUnit.Text = Goods_rows[0].G_Unit.ToString();
                    Itox         = Goods_rows[0].G_Itax;
                    //txtPrice.Text = Goods_rows[0].G_Price.ToString();
                    if (Goods_rows[0].G_Kind == 1)
                    {
                        txtKind.Text = "原物料";
                    }
                    txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");


                    Mes_InPriceBLL InPriceBLL  = new Mes_InPriceBLL();
                    var            InPrice_row = InPriceBLL.GetList_Mes_Price(" where P_GoodsCode = '" + strGoods[0] + "' and P_SupplyCode = '" + Globels.strSupplyCode + "'");
                    if (InPrice_row.Count > 0)
                    {
                        txtPrice.Text = InPrice_row[0].P_InPrice.ToString();
                    }
                    else
                    {
                        untCommon.InfoMsg("请先维护商品的入库价格");
                        return;
                    }

                    txtQty.Focus();
                }
                else
                {
                    untCommon.InfoMsg("输入的物料编码不是原物料,请重新输入!");
                    //txtGoodsCode.Text = "";
                    //txtGoodsCode.Focus();
                }
            }
            catch (Exception Exception)
            {
                MessageBox.Show(Exception.ToString());
            }
        }
Exemple #5
0
        private void comGoods_SelectedIndexChanged(object sender, EventArgs e)
        {
            string[]    strGoods = comGoods.Text.ToString().Split('$');
            MesGoodsBLL GoodsBLL = new MesGoodsBLL();
            //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity();
            var Goods_rows = GoodsBLL.GetList(strGoods[0], strGoods[1]);

            if (Goods_rows == null || Goods_rows.Count < 1 || Goods_rows[0].G_Kind == 2)
            {
                untCommon.InfoMsg("输入的物料编码错误,请重新输入!");
                return;
            }
            if (Goods_rows[0].G_Kind == 1)
            {
                //txtGoodsCode.Text = Goods_rows[0].G_Code;
                //txtGoodsName.Text = Goods_rows[0].G_Name;
                txtUnit.Text  = Goods_rows[0].G_Unit;
                txtPrice.Text = Goods_rows[0].G_Price.ToString();
                if (Goods_rows[0].G_Kind == 1)
                {
                    txtKind.Text = "原物料";
                }
                txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");

                cmbSupply.Items.Clear();
                Mes_InPriceBLL InPriceBLL  = new Mes_InPriceBLL();
                var            InPrice_row = InPriceBLL.GetList_Mes_Price("where P_GoodsCode = '" + strGoods[0] + "'");
                if (InPrice_row.Count > 0)
                {
                    for (int i = 0; i < InPrice_row.Count; i++)
                    {
                        cmbSupply.Items.Add(InPrice_row[i].P_SupplyCode);
                    }
                    if (InPrice_row.Count == 1)
                    {
                        cmbSupply.Text = InPrice_row[0].P_SupplyCode;
                    }
                }
                else
                {
                    untCommon.InfoMsg("请先维护商品的入库价格");
                    return;
                }

                txtQty.Focus();
            }
            else
            {
                untCommon.InfoMsg("输入的物料编码不是原物料,请重新输入!");
                //txtGoodsCode.Text = "";
                //txtGoodsCode.Focus();
            }
        }
Exemple #6
0
        private int BZQ(string strGoodsCode)
        {
            int         dd         = 0;
            MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
            var         Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + strGoodsCode + "'");
            int         nLen       = Goods_rows.Count;

            if (nLen > 0)
            {
                dd = Goods_rows[0].G_Period * 24;
            }
            return(dd);
        }
Exemple #7
0
        private void frmStorageEdit_Load(object sender, EventArgs e)
        {
            checkBox1.Checked = true;
            comGoods.Items.Clear();
            MesGoodsBLL GoodsBLL = new MesGoodsBLL();
            var         row      = GoodsBLL.GetData(" and G_Kind = 1 and G_StockCode = '" + M_StockCode + "'");

            for (int i = 0; i < row.Count; i++)
            {
                comGoods.Items.Add(row[i].G_Code + "$" + row[i].G_Name);
            }

            txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");
        }
Exemple #8
0
        private void cmbGoodsCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                cmbBatch.Items.Clear();
                MesInventoryBLL InventoryBLL = new MesInventoryBLL();
                var             row          = InventoryBLL.GetData("where I_StockCode = '" + cmbStock.Text + "' and I_GoodsCode = '" + cmbGoodsCode.Text + "' and I_Qty > 0");
                for (int i = 0; i < row.Count; i++)
                {
                    cmbBatch.Items.Add(row[i].I_Batch);
                }
                if (row.Count == 1)
                {
                    cmbBatch.Text = row[0].I_Batch;
                    txtQty.Text   = row[0].I_Qty.ToString();
                }



                MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                var         Goods_rows = GoodsBLL.GetList(cmbGoodsCode.Text, "");
                int         nLen       = Goods_rows.Count;
                if (nLen > 0)
                {
                    cmbGoodsName.Text = Goods_rows[0].G_Name;

                    txtUnit.Text = Goods_rows[0].G_Unit.ToString();
                    dPrice       = Goods_rows[0].G_Price;
                    //int nKind = Goods_rows[0].G_Kind;
                    //if (nKind == 1)
                    //{
                    //    label17.Visible = true;
                    //    cmbSupplyName.Visible = true;


                    //}
                    //else
                    //{
                    //    ;
                    //}
                }
            }
            catch (Exception ex)
            {
                //lblTS.Text = "ex.ToString()";
            }
        }
Exemple #9
0
        private void cmbGoodsCode_SelectedIndexChanged(object sender, EventArgs e)
        {
            MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
            var         Goods_rows = GoodsBLL.GetListCondit("where G_Name = '" + txtGoodsName.Text + "'");
            int         nLen       = Goods_rows.Count;

            if (nLen > 0)
            {
                txtCode.Text = Goods_rows[0].G_Code;
                txtUnit.Text = Goods_rows[0].G_Unit;
                int dd = Goods_rows[0].G_Period * 24;
                strBZQ = dd.ToString();
            }
            txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");


            //ShowYWL(txtCode.Text);
        }
Exemple #10
0
 private void txtGoodsName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)//如果输入的是回车键
     {
         MesGoodsBLL GoodsBLL = new MesGoodsBLL();
         //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity();
         var Goods_rows = GoodsBLL.GetList("", txtGoodsName.Text.Trim());
         if (Goods_rows == null || Goods_rows.Count < 1)
         {
             untCommon.InfoMsg("输入的物料名称错误,请重新输入!");
         }
         else
         {
             txtGoodsCode.Text = Goods_rows[0].G_Code;
             txtGoodsName.Text = Goods_rows[0].G_Name;
             txtUnit.Text      = Goods_rows[0].G_Unit;
         }
     }
 }
Exemple #11
0
        private void BracodePrintf_Load(object sender, EventArgs e)
        {
            MesBasketBLL BasketBLL   = new MesBasketBLL();
            var          Basket_rows = BasketBLL.GetList();

            for (int i = 0; i < Basket_rows.Count; i++)
            {
                comBasketType.Items.Add(Basket_rows[i].B_BasketName);
            }

            checkBox1.Checked = true;
            comGoods.Items.Clear();
            MesGoodsBLL GoodsBLL = new MesGoodsBLL();
            var         row      = GoodsBLL.GetList("", "");

            for (int i = 0; i < row.Count; i++)
            {
                comGoods.Items.Add(row[i].G_Code + "$" + row[i].G_Name);
            }

            txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");
        }
Exemple #12
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         int         nLen2        = listView1.SelectedIndices[0];
         string      strGoodsName = listView1.Items[nLen2].SubItems[0].Text.ToString();
         MesGoodsBLL GoodsBLL     = new MesGoodsBLL();
         var         Goods_rows   = GoodsBLL.GetListCondit("where G_Name = '" + strGoodsName + "'");
         int         nLen         = Goods_rows.Count;
         if (nLen > 0)
         {
             txtCode.Text      = Goods_rows[0].G_Code;
             txtGoodsName.Text = Goods_rows[0].G_Name;
             txtUnit.Text      = Goods_rows[0].G_Unit;
             int dd = Goods_rows[0].G_Period * 24;
             strBZQ = dd.ToString();
         }
         txtBatch.Text = DateTime.Now.ToString("yyyyMMdd");
     }
     catch (Exception ex)
     {
         ;
     }
 }
Exemple #13
0
        /// <summary>
        /// 称重记录保存
        /// </summary>
        //private void addWeighStorage()
        //{
        //    try
        //    {
        //        MesWeightRecordBLL MesWeightRecordBLL = new MesWeightRecordBLL();
        //        MesMaterInDetailBLL MaterInDetailBLL = new MesMaterInDetailBLL();
        //        var rows = MaterInDetailBLL.GetList_GoodsCode("","");
        //        if (checkInput())
        //        {
        //            rows = MaterInDetailBLL.GetList_GoodsCode(txtGoodsCode.Text,M_MaterInNo);
        //            if (rows[0].M_GoodsCode == txtGoodsCode.Text && rows[0].M_GoodsName == txtGoodsName.Text && rows[0].M_Qty.ToString() == txtQty.Text)
        //            {
        //                untCommon.InfoMsg("称重记录数据错误!");
        //                return;
        //            }



        //            MesWeightRecordEntity MesWeightRecord = new MesWeightRecordEntity();

        //            MesWeightRecord.P_OrderNo = P_OrderNo;
        //            MesWeightRecord.W_Kind = W_Kind;
        //            MesWeightRecord.W_Date = DateTime.Now;
        //            MesWeightRecord.W_GoodsCode = txtGoodsCode.Text;
        //            MesWeightRecord.W_GoodsName = txtGoodsName.Text;
        //            MesWeightRecord.W_Batch = txtBatch.Text;
        //            MesWeightRecord.W_Qty = decimal.Parse(txtQty.Text);
        //            MesWeightRecord.W_Unit = txtUnit.Text;

        //            if (MesWeightRecordBLL.SaveEntity("", MesWeightRecord) > 0)
        //            {
        //                untCommon.InfoMsg("称重记录添加成功!");
        //                whether = 2;
        //                //frmParent.loadData();
        //                frmStorage.Refresh();
        //            }
        //            else
        //            {
        //                untCommon.InfoMsg("称重记录添加失败!");
        //            }
        //        }
        //        rows = MaterInDetailBLL.GetList(M_MaterInNo);
        //        dataGridView.DataSource = rows;
        //    }
        //    catch (Exception ex)
        //    {
        //        untCommon.ErrorMsg("称重数据异常:" + ex.Message);
        //    }
        //}

        /// <summary>
        /// 保存
        /// </summary>
        private void addStorage()
        {
            try
            {
                string[]              strGoods           = comGoods.Text.ToString().Split('$');
                MesWeightRecordBLL    MesWeightRecordBLL = new MesWeightRecordBLL();
                MesMaterInDetailBLL   MaterInDetailBLL   = new MesMaterInDetailBLL();
                MesWeightRecordEntity MesWeightRecord    = new MesWeightRecordEntity();
                var rows = MaterInDetailBLL.GetList_GoodsCode("", "");
                if (checkInput())
                {
                    //rows = MaterInDetailBLL.GetList_GoodsCode(txtGoodsCode.Text,M_MaterInNo);
                    //if (rows[0].M_GoodsCode == txtGoodsCode.Text && rows[0].M_GoodsName == txtGoodsName.Text && rows[0].M_Qty.ToString() == txtQty.Text)
                    //{
                    //    untCommon.InfoMsg("称重记录数据错误!");
                    //    return;
                    //}

                    MesWeightRecord.P_OrderNo   = P_OrderNo;
                    MesWeightRecord.W_Kind      = W_Kind;
                    MesWeightRecord.W_Date      = DateTime.Now;
                    MesWeightRecord.W_GoodsCode = strGoods[0];
                    MesWeightRecord.W_GoodsName = strGoods[1];
                    MesWeightRecord.W_Batch     = txtBatch.Text;
                    MesWeightRecord.W_Qty       = decimal.Parse(txtQty.Text);
                    MesWeightRecord.W_Unit      = txtUnit.Text;

                    MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity();
                    MesGoodsBLL            GoodsBLL      = new MesGoodsBLL();
                    //MesMaterInDetailEntity MaterInDetail = new MesMaterInDetailEntity();
                    var Goods_rows = GoodsBLL.GetList(strGoods[0], "");

                    string cz = "";//是否存在相同物料

                    MaterInDetail.M_MaterInNo = txtMaterInNo.Text;
                    MaterInDetail.M_GoodsCode = strGoods[0];
                    MaterInDetail.M_GoodsName = strGoods[1];
                    MaterInDetail.M_Batch     = txtBatch.Text;
                    MaterInDetail.M_Price     = Convert.ToDecimal(txtPrice.Text);
                    MaterInDetail.M_GoodsItax = Itox;

                    if (checkBox1.Checked == true)
                    {
                        drqQty = decimal.Parse(txtBasketQty.Text);
                        MaterInDetail.M_Qty = decimal.Parse(txtQty.Text) - drqQty;
                    }
                    else
                    {
                        MaterInDetail.M_Qty = decimal.Parse(txtQty.Text);
                    }
                    MaterInDetail.M_Unit = txtUnit.Text;
                    MaterInDetail.M_Kind = Convert.ToString(Goods_rows[0].G_Kind);

                    // MesGoodsBLL GoodsBLL = new MesGoodsBLL();
                    //var Goods_rows = GoodsBLL.GetList(MaterInDetail.M_GoodsCode, MaterInDetail.M_GoodsName);

                    if (Goods_rows == null || Goods_rows.Count < 1)
                    {
                        untCommon.InfoMsg("输入的物料名称错误,请重新输入!");
                        return;
                    }
                    else if (Goods_rows[0].G_Kind == 1)
                    {
                        //txtGoodsCode.Text = Goods_rows[0].G_Code;
                        //txtGoodsName.Text = Goods_rows[0].G_Name;
                        txtUnit.Text = Goods_rows[0].G_Unit;
                    }
                    else
                    {
                        untCommon.InfoMsg("输入的物料名称错误,请重新输入!");
                        return;
                    }

                    int i = dataGridView.Rows.Count;
                    if (dataGridView.RowCount > 0 && dataGridView.DataSource != null)
                    {
                        for (int j = 0; j < i; j++)
                        {
                            if (dataGridView.Rows[j].Cells["物料编码"].Value.ToString() == strGoods[0])
                            {
                                if (dataGridView.Rows[j].Cells["批次"].Value.ToString() == txtBatch.Text.Trim())
                                {
                                    cz = "存在";
                                }
                            }
                        }
                    }
                    if (cz == "存在")
                    {
                        var MaterInDetai_rows = MaterInDetailBLL.GetList_GoodsCode(MaterInDetail.M_GoodsCode, M_MaterInNo);
                        var rowData           = MaterInDetailBLL.GetEntity(MaterInDetai_rows[0].ID);

                        //

                        decimal dPrice = (rowData.M_Price * rowData.M_Qty + MaterInDetail.M_Price * MaterInDetail.M_Qty) / (rowData.M_Qty + MaterInDetail.M_Qty);
                        rowData.M_Price = dPrice;
                        rowData.M_Qty  += MaterInDetail.M_Qty;
                        if (MaterInDetailBLL.SaveEntityTrans(rowData.ID, rowData, "", MesWeightRecord) > 0)//事务
                        {
                            untCommon.InfoMsg("修改成功!");
                            whether = 2;
                            //frmParent.loadData();
                            frmStorage.Refresh();
                        }
                        else
                        {
                            untCommon.InfoMsg("修改失败!");
                        }
                        //if (MaterInDetailBLL.SaveEntity(rowData.ID, rowData) > 0)
                        //{
                        //    untCommon.InfoMsg("修改失败!");
                        //    whether = 2;
                        //    //frmParent.loadData();
                        //    frmStorage.Refresh();
                        //    clear();
                        //}
                        //else
                        //{
                        //    untCommon.InfoMsg("修改失败!");
                        //}
                    }
                    else
                    {
                        if (MaterInDetailBLL.SaveEntityTrans("", MaterInDetail, "", MesWeightRecord) > 0)
                        {
                            untCommon.InfoMsg("添加成功!");
                            //frmParent.loadData();
                            whether = 2;
                            frmStorage.Refresh();
                        }
                        else
                        {
                            untCommon.InfoMsg("添加失败!");
                        }
                    }
                }
                rows = MaterInDetailBLL.GetList(M_MaterInNo);
                dataGridView.DataSource = rows;
            }
            catch (Exception ex)
            {
                untCommon.ErrorMsg("称重保存数据异常:" + ex.Message);
            }
        }
Exemple #14
0
        private void txtBarcode_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyValue == 13)
                {
                    string strBarcode = txtBarcode.Text;
                    if (strBarcode.IndexOf('*') > 0)
                    {
                        string[] strTemp = strBarcode.Split('*');
                        txtCode.Text = strTemp[0].ToString();
                        txtPc.Text   = strTemp[1].ToString();
                        txtQty.Text  = strTemp[2].ToString();


                        MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                        var         Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'");
                        int         nLen       = Goods_rows.Count;
                        if (nLen > 0)
                        {
                            txtName.Text  = Goods_rows[0].G_Name;
                            txtPrice.Text = Goods_rows[0].G_Price.ToString();
                            strUnit       = Goods_rows[0].G_Unit.ToString();
                        }
                    }
                    else
                    {
                        string[] strTemp = strBarcode.Split(',');


                        //MessageBox.Show(strTemp.Length.ToString());
                        txtCode.Text = Resolve(strTemp[0].ToString());
                        txtPc.Text   = Resolve(strTemp[1].ToString());
                        txtQty.Text  = Resolve(strTemp[2].ToString());
                        m_strBarcode = strTemp[4].ToString();
                        Mes_BarcodeBLL BarcodeBLL   = new Mes_BarcodeBLL();
                        var            Barcode_rows = BarcodeBLL.GetList_Mes_Barcode("select * from Mes_Barcode where B_Status = 1 and B_Barcode = '" + m_strBarcode + "'");
                        if (Barcode_rows.Count > 0)
                        {
                        }
                        else
                        {
                            MessageBox.Show("此标签已经入库, 或者状态不对");
                            txtBarcode.Text = "";
                            txtBarcode.Focus();
                            txtBarcode.SelectAll();
                            return;
                        }

                        MesGoodsBLL GoodsBLL   = new MesGoodsBLL();
                        var         Goods_rows = GoodsBLL.GetListCondit("where G_Code = '" + txtCode.Text + "'");
                        int         nLen       = Goods_rows.Count;
                        if (nLen > 0)
                        {
                            txtName.Text  = Goods_rows[0].G_Name;
                            strUnit       = Goods_rows[0].G_Unit;
                            txtPrice.Text = Goods_rows[0].G_Price.ToString();
                        }
                    }

                    Save();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }