コード例 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否保存", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                Mes_WorkShopScanBLL    WorkShopScanBLL    = new Mes_WorkShopScanBLL();
                Mes_WorkShopScanEntity WorkShopScanEntity = new Mes_WorkShopScanEntity();


                WorkShopScanEntity.W_GoodsName  = txtName.Text;
                WorkShopScanEntity.W_WorkShop   = Globels.strWorkShop;
                WorkShopScanEntity.W_RecordCode = Globels.strRecord;

                WorkShopScanEntity.W_GoodsCode = cmbGoodsCode.Text;
                WorkShopScanEntity.W_Batch     = cmbPc.Text;
                WorkShopScanEntity.W_Price     = Convert.ToDecimal(txtPrice.Text);

                WorkShopScanEntity.W_Status = 1;
                WorkShopScanEntity.W_Qty    = Convert.ToDecimal(txtQty.Text);
                WorkShopScanEntity.W_Unit   = txtUnit.Text;
                WorkShopScanEntity.W_Remark = "";
                int nCount = WorkShopScanBLL.SaveEntity("", WorkShopScanEntity);
                if (nCount > 0)
                {
                    MessageBox.Show("添加成功");
                    Init();
                }
            }
        }
コード例 #2
0
ファイル: frmGoodsConvet.cs プロジェクト: zhouyb1/BeiJing_MES
 private bool UpdateData(string strId, decimal dQty)
 {
     try
     {
         Mes_WorkShopScanBLL WorkShopScanBLL = new Mes_WorkShopScanBLL();
         int nRow = WorkShopScanBLL.UpdateEntity(strId, dQty);
         if (nRow > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: frmGoodsConvet.cs プロジェクト: zhouyb1/BeiJing_MES
 private bool DeleteData(string strId)
 {
     try
     {
         Mes_WorkShopScanBLL WorkShopScanBLL = new Mes_WorkShopScanBLL();
         int nRow = WorkShopScanBLL.DeleteEntity(strId);
         if (nRow > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #4
0
        private void UpdateGoods()
        {
            Mes_WorkShopScanBLL WorkShopScanBLL = new Mes_WorkShopScanBLL();

            string strSql = " where W_WorkShop = '" + txtWorkShop.Text + "'";
            var    row    = WorkShopScanBLL.GetList_WorkShopScan(strSql);

            //if (row == null || row.Count < 1)
            //{
            //    untCommon.InfoMsg("没有任何数据!");
            //    return;
            //}
            dataGridView1.DataSource = row;
            int nLen = dataGridView1.Rows.Count;

            for (int i = 0; i < nLen; i++)
            {
                dataGridView1.Rows[i].Cells["实用数量"].Value = dataGridView1.Rows[i].Cells["数量"].Value;
            }
        }
コード例 #5
0
ファイル: frmGoodsConvet.cs プロジェクト: zhouyb1/BeiJing_MES
        private void UpdateGoods()
        {
            Mes_WorkShopScanBLL WorkShopScanBLL = new Mes_WorkShopScanBLL();
            string strSql = "select a.I_GoodsCode,a.I_GoodsName,SUM(a.I_Qty) as I_Qty,a.I_Unit,a.I_StockCode,a.I_StockName,c.G_Price from Mes_Inventory as a left join Mes_Convert as b on b.C_Code = a.I_GoodsCode left join Mes_Goods as c on a.I_GoodsCode = c.G_Code where C_SecCode = '" + txtGoodsCode.Text + "' and a.I_StockCode = '" + Globels.strStockCode + "' and a.I_Qty > 0 GROUP BY a.I_GoodsCode,a.I_GoodsName,a.I_Unit,a.I_StockCode,a.I_StockName,c.G_Price";
            //string strSql = "select a.I_GoodsCode,a.I_GoodsName,a.I_Batch,a.I_Qty,a.I_Unit,a.ID,a.I_StockCode,a.I_StockName,c.G_Price from Mes_Inventory as a left join Mes_Convert as b on b.C_Code = a.I_GoodsCode left join Mes_Goods as c on a.I_GoodsCode = c.G_Code where C_SecCode = '" + txtGoodsCode.Text + "' and a.I_StockCode = '" + Globels.strStockCode + "' and a.I_Qty > 0";
            DataSet ds = new DataSet();

            ds = WorkShopScanBLL.GetList_WorkShopScan2(strSql);


            dataGridView1.DataSource = ds.Tables[0];

            int nLen = dataGridView1.Rows.Count;

            for (int i = 0; i < nLen - 1; i++)
            {
                string strQty = dataGridView1.Rows[i].Cells["数量"].Value.ToString();
                dataGridView1.Rows[i].Cells["数量"].Value = Delete0(strQty);

                dataGridView1.Rows[i].Cells["实用数量"].Value = "0";
                dataGridView1.Rows[i].Cells["车间"].Value   = Globels.strWorkShopName;
            }
        }
コード例 #6
0
        private void btn_upload_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否要提交", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
            {
                try
                {
                    if (cmbTeam.Text == "")
                    {
                        lblTS.Text = "系统提示:先选择班组";
                        return;
                    }
                    Mes_WorkShopScanBLL   WorkShopScanBLL  = new Mes_WorkShopScanBLL();
                    Mes_WorkShopWeightBLL WorkShopWeightBL = new Mes_WorkShopWeightBLL();

                    List <string> insertList  = new List <string>();
                    string        strSecGoods = "";
                    string        strSecPc    = "";
                    string        strSecName  = "";
                    string        strSecUnit  = "";
                    decimal       dSecQty     = 0;
                    int           nLen2       = dataGridView2.Rows.Count;
                    for (int i = 0; i < nLen2; i++)
                    {
                        object obj = dataGridView2.Rows[i].Cells["选择2"].Value;
                        if (Convert.ToString(obj) == "True" || Convert.ToString(obj) == "1")
                        {
                            strSecGoods = dataGridView2.Rows[i].Cells["物料2"].Value.ToString();
                            strSecPc    = dataGridView2.Rows[i].Cells["批次2"].Value.ToString();
                            strSecName  = dataGridView2.Rows[i].Cells["物料名称2"].Value.ToString();
                            strSecUnit  = dataGridView2.Rows[i].Cells["单位2"].Value.ToString();

                            string strSecQty = dataGridView2.Rows[i].Cells["数量2"].Value.ToString();
                            string strTemp   = dataGridView2.Rows[i].Cells["物料2"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["批次2"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["数量2"].Value.ToString();
                            if (insertList.Count > 0)
                            {
                                string[] str = insertList[0].ToString().Split(',');
                                if (str[0].ToString() == strSecGoods)
                                {
                                    if (str[1].ToString() == strSecPc)
                                    {
                                        dSecQty = dSecQty + Convert.ToDecimal(strSecQty);
                                    }
                                    else
                                    {
                                        lblTS.Text = "系统提示:生成的物料只允许同一物料,同一批次";
                                        return;
                                    }
                                }
                                else
                                {
                                    lblTS.Text = "系统提示:生成的物料只允许同一物料,同一批次";
                                    return;
                                }
                            }
                            else
                            {
                                dSecQty = dSecQty + Convert.ToDecimal(strSecQty);
                                insertList.Add(strTemp);
                            }
                        }
                    }

                    List <string> Goods       = new List <string>();
                    List <string> strOldGoods = new List <string>();
                    int           nKind       = 0; //计算有几种原物料
                    int           nLen        = dataGridView1.Rows.Count;
                    for (int i = 0; i < nLen; i++)
                    {
                        object obj = dataGridView1.Rows[i].Cells["选择"].Value;
                        if (Convert.ToString(obj) == "True" || Convert.ToString(obj) == "1")
                        {
                            string strGoods = dataGridView1.Rows[i].Cells["物料"].Value.ToString();
                            string strQty   = dataGridView1.Rows[i].Cells["实用数量"].Value.ToString();
                            string strYLQty = dataGridView1.Rows[i].Cells["数量"].Value.ToString();

                            string strPc    = dataGridView1.Rows[i].Cells["批次"].Value.ToString();
                            string strPrice = dataGridView1.Rows[i].Cells["价格"].Value.ToString();
                            string strName  = dataGridView1.Rows[i].Cells["物料名称"].Value.ToString();
                            string strUnit  = dataGridView1.Rows[i].Cells["单位"].Value.ToString();
                            if (Jud(strGoods, strSecGoods))
                            {
                                if (strOldGoods.Contains(strGoods))
                                {
                                }
                                else
                                {
                                    nKind = nKind + 1;
                                    strOldGoods.Add(strGoods);
                                }
                                bool bRet = false;
                                for (int j = 0; j < Goods.Count; j++)
                                {
                                    string   strTemp      = Goods[j].ToString();
                                    string[] str          = strTemp.Split(',');
                                    string   strTempGoods = str[0].ToString();
                                    string   strTempPc    = str[2].ToString();
                                    string   strTempQty   = str[3].ToString();
                                    if (strTempGoods == strGoods && strTempPc == strPc)
                                    {
                                        decimal dQty = Convert.ToDecimal(strQty) + Convert.ToDecimal(strTempQty);
                                        Goods[j] = strGoods + "," + dQty.ToString() + "," + strPc + "," + strPrice + "," + strName + "," + strUnit;
                                        bRet     = true;
                                    }
                                }
                                if (bRet == false)
                                {
                                    Goods.Add(strGoods + "," + strQty + "," + strPc + "," + strPrice + "," + strName + "," + strUnit);
                                }
                            }
                            else
                            {
                                lblTS.Text = "系统提示:选择的物料生成不了下一个物料,请核对";
                                return;
                            }
                        }
                    }

                    if (!Jud2(nKind, strSecGoods))
                    {
                        lblTS.Text = "系统提示:选择的转换前的物料不够";
                        return;
                    }

                    if (insertList.Count == 0 || Goods.Count == 0)
                    {
                        lblTS.Text = "系统提示:请选择物料";
                        return;
                    }
                    Mes_OrgResHeadBLL      OrgResHeadBLL      = new Mes_OrgResHeadBLL();
                    Mes_OrgResDetailBLL    OrgResDetailBLL    = new Mes_OrgResDetailBLL();
                    Mes_OrgResHeadEntity   OrgResHeadEntity   = new Mes_OrgResHeadEntity();
                    Mes_OrgResDetailEntity OrgResDetailEntity = new Mes_OrgResDetailEntity();

                    string strIn_No = "";

                    MesMaterInHeadBLL MaterInHeadBLL = new MesMaterInHeadBLL();
                    strIn_No = MaterInHeadBLL.GetDH("组装与拆分单");

                    OrgResHeadEntity.O_OrgResNo = strIn_No;
                    OrgResHeadEntity.O_OrderNo  = comOrderNo.Text;

                    OrgResHeadEntity.O_CreateBy     = Globels.strUser;
                    OrgResHeadEntity.O_CreateDate   = DateTime.Now;
                    OrgResHeadEntity.O_OrderDate    = txtOrderDate.Text;
                    OrgResHeadEntity.O_Remark       = "";
                    OrgResHeadEntity.O_Status       = 1;
                    OrgResHeadEntity.O_WorkShopCode = cmbWorkShop.Text;
                    OrgResHeadEntity.O_WorkShopName = cmbWorkShopName.Text;
                    OrgResHeadEntity.O_Record       = cmbRecord.Text;
                    OrgResHeadEntity.O_ProCode      = cmbProce.Text;
                    OrgResHeadEntity.O_TeamCode     = cmbTeam.Text;
                    OrgResHeadEntity.O_TeamName     = cmbTeamName.Text;

                    int     nRow      = OrgResHeadBLL.SaveEntity("", OrgResHeadEntity);
                    decimal dSecPrice = 0;
                    decimal dTotal    = 0;
                    for (int i = 0; i < Goods.Count; i++)
                    {
                        string[] strTemp = Goods[i].ToString().Split(',');
                        dTotal = dTotal + (Convert.ToDecimal(strTemp[3].ToString()) * Convert.ToDecimal(strTemp[1].ToString()));
                    }
                    dSecPrice = dTotal / dSecQty;


                    for (int i = 0; i < Goods.Count; i++)
                    {
                        OrgResDetailEntity.O_OrgResNo     = strIn_No;
                        OrgResDetailEntity.O_SecGoodsCode = strSecGoods;
                        OrgResDetailEntity.O_SecGoodsName = strSecName;
                        OrgResDetailEntity.O_SecPrice     = 0;
                        OrgResDetailEntity.O_SecQty       = dSecQty;
                        OrgResDetailEntity.O_SecUnit      = strSecUnit;
                        OrgResDetailEntity.O_SecBatch     = strSecPc;

                        string[] strTemp = Goods[i].ToString().Split(',');

                        string         strGoodsCode   = strTemp[0].ToString();
                        Mes_ConvertBLL ConvertBLL     = new Mes_ConvertBLL();
                        var            Convert_rows   = ConvertBLL.GetList_Mes_Convert(" where C_SecCode = '" + strGoodsCode + "'");
                        string         strC_GoodsCode = "";
                        if (Convert_rows.Count > 0)
                        {
                            strC_GoodsCode = Convert_rows[0].C_Code;
                        }

                        OrgResDetailEntity.O_GoodsCode = strTemp[0].ToString();
                        OrgResDetailEntity.O_GoodsName = strTemp[4].ToString();
                        OrgResDetailEntity.O_Price     = Convert.ToDecimal(strTemp[3].ToString());
                        OrgResDetailEntity.O_Qty       = Convert.ToDecimal(strTemp[1].ToString());
                        OrgResDetailEntity.O_Unit      = strTemp[5].ToString();
                        OrgResDetailEntity.O_Batch     = strTemp[2].ToString();
                        OrgResDetailEntity.O_SecPrice  = dSecPrice;
                        nRow = OrgResDetailBLL.SaveEntity("", OrgResDetailEntity);
                    }
                    Upload(strIn_No);
                    MessageBox.Show("保存成功");
                    lblTS.Text = "";
                    //UpdatePrice(strSecGoods, dSecPrice);  已经在存储过程中处理
                    Delete();
                    UpdateGoods();
                }
                catch (Exception ex)
                {
                    lblTS.Text = "系统提示:" + ex.ToString();
                }
            }
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            Mes_WorkShopScanBLL   WorkShopScanBLL  = new Mes_WorkShopScanBLL();
            Mes_WorkShopWeightBLL WorkShopWeightBL = new Mes_WorkShopWeightBLL();

            List <string> insertList  = new List <string>();
            string        strID       = "";
            string        strSecGoods = "";
            string        strSecPc    = "";
            string        strSecName  = "";
            string        strSecUnit  = "";
            decimal       dSecQty     = 0;
            int           nLen2       = dataGridView2.Rows.Count;

            for (int i = 0; i < nLen2; i++)
            {
                object obj = dataGridView2.Rows[i].Cells["选择2"].Value;
                if (Convert.ToString(obj) == "True" || Convert.ToString(obj) == "1")
                {
                    if (strID == "")
                    {
                        strID = dataGridView2.Rows[i].Cells["ID2"].Value.ToString();
                    }
                    else
                    {
                        strID = strID + "," + dataGridView2.Rows[i].Cells["ID2"].Value.ToString();
                    }
                    strSecGoods = dataGridView2.Rows[i].Cells["物料2"].Value.ToString();
                    strSecPc    = dataGridView2.Rows[i].Cells["批次2"].Value.ToString();
                    strSecName  = dataGridView2.Rows[i].Cells["物料名称2"].Value.ToString();
                    strSecUnit  = dataGridView2.Rows[i].Cells["单位2"].Value.ToString();

                    string strSecQty = dataGridView2.Rows[i].Cells["数量2"].Value.ToString();
                    string strTemp   = dataGridView2.Rows[i].Cells["物料2"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["批次2"].Value.ToString() + "," + dataGridView2.Rows[i].Cells["数量2"].Value.ToString();
                    if (insertList.Count > 0)
                    {
                        string[] str = insertList[0].ToString().Split(',');
                        if (str[0].ToString() == strSecGoods)
                        {
                            if (str[1].ToString() == strSecPc)
                            {
                                dSecQty = dSecQty + Convert.ToDecimal(strSecQty);
                            }
                            else
                            {
                                lblTS.Text = "系统提示:生成的物料只允许同一物料,同一批次";
                                return;
                            }
                        }
                        else
                        {
                            lblTS.Text = "系统提示:生成的物料只允许同一物料,同一批次";
                            return;
                        }
                    }
                    else
                    {
                        dSecQty = dSecQty + Convert.ToDecimal(strSecQty);
                        insertList.Add(strTemp);
                    }
                }
            }
            Globels.strGoodsMessase = strSecGoods + "," + strSecName + "," + strSecPc + "," + dSecQty + "," + strSecUnit;
            Globels.strID           = strID;

            Globels.strWorkShop     = cmbWorkShop.Text;
            Globels.strWorkShopName = cmbWorkShopName.Text;
            Globels.strProce        = cmbProce.Text;
            Globels.strTeam         = cmbTeam.Text;
            Globels.strTeamName     = cmbTeamName.Text;

            frmGoodsConvet frm = new frmGoodsConvet();

            frm.ShowDialog();
            frm.Dispose();

            UpdateGoods();
        }