コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                string strSql = "select * from Mes_WorkShopWeight where W_Remark = '" + m_strBarcode + "'";
                Mes_WorkShopWeightBLL    WorkShopWeightBLL    = new Mes_WorkShopWeightBLL();
                Mes_WorkShopWeightEntity WorkShopWeightEntity = new Mes_WorkShopWeightEntity();
                DataSet ds = new DataSet();
                ds = WorkShopWeightBLL.GetList_WorkShop(strSql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string  strOrderNo   = ds.Tables[0].Rows[0]["W_OrderNo"].ToString();
                    string  strGoodsCode = ds.Tables[0].Rows[0]["W_SecGoodsCode"].ToString();
                    string  strBatch     = ds.Tables[0].Rows[0]["W_SecBatch"].ToString();
                    string  strQty       = ds.Tables[0].Rows[0]["W_SecQty"].ToString();
                    decimal d            = Convert.ToDecimal(strQty);
                    strQty = d.ToString("0.####");
                    //string strPrice = dataGridView2.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells["价格2"].Value.ToString();
                    string strGoodsName = ds.Tables[0].Rows[0]["W_SecGoodsName"].ToString();
                    string strBarcode   = ds.Tables[0].Rows[0]["W_Remark"].ToString();
                    //string strDate = dataGridView1.Rows[dataGridView1.SelectedCells[0].RowIndex].Cells["W_Price"].Value.ToString();

                    if (MessageBox.Show("物料是否要补写?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
                    {
                        try
                        {
                            this.Enabled   = false;
                            Cursor.Current = Cursors.WaitCursor;

                            GetImg("物料" + strGoodsCode + "批次" + strBatch + "单号" + Globels.strOrderNo, strGoodsName, strQty, strBZQ, strBarcode);
                            //DeleteData(strId);
                            //SaveBarcode(strBarcode, strGoodsCode, strGoodsName, Convert.ToDecimal(strQty), strWorkShop);
                            this.Enabled   = true;
                            Cursor.Current = Cursors.Default;
                        }
                        catch (Exception ex)
                        {
                            this.Enabled   = true;
                            Cursor.Current = Cursors.Default;
                        }
                    }
                }
                else
                {
                    MessageBox.Show("不好意思,您还没有打印过任何标签");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                //lblTS.Text = "系统提示:请选中某一行进行补写";
            }
        }
コード例 #2
0
        private void UpdateGoods()
        {
            //Mes_WorkShopScanBLL WorkShopScanBLL = new Mes_WorkShopScanBLL();
            Mes_WorkShopWeightBLL WorkShopWeightBL = new Mes_WorkShopWeightBLL();

            //string strSql = " where W_WorkShop = '" + cmbWorkShop.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;
            //}



            string strSql = "";

            if (comboBox1.Text == "")
            {
                strSql = " where W_RecordCode = '" + cmbRecord.Text + "' and W_ProceCode = '" + cmbProce.Text + "' and W_WorkShopCode = '" + cmbWorkShop.Text + "' and W_OrderNo = '" + comOrderNo.Text + "' order by W_CreateDate desc";
            }
            else
            {
                strSql = " where W_RecordCode = '" + cmbRecord.Text + "' and W_ProceCode = '" + cmbProce.Text + "' and W_WorkShopCode = '" + cmbWorkShop.Text + "' and W_OrderNo = '" + comOrderNo.Text + "' and W_SecGoodsName = '" + comboBox1.Text + "' order by W_CreateDate desc";
            }
            var row2 = WorkShopWeightBL.GetList_WorkShopWeight(strSql);

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

            for (int i = 0; i < dataGridView2.Rows.Count; i++)
            {
                string strQty = dataGridView2.Rows[i].Cells["数量2"].Value.ToString();
                dataGridView2.Rows[i].Cells["数量2"].Value = Delete0(strQty);
            }
        }
コード例 #3
0
ファイル: frmGoodsConvet.cs プロジェクト: zhouyb1/BeiJing_MES
 private bool DeleteWeightData(string strId)
 {
     try
     {
         Mes_WorkShopWeightBLL WorkShopWeightBLL = new Mes_WorkShopWeightBLL();
         int nRow = WorkShopWeightBLL.DeleteEntity(strId);
         if (nRow > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
 }
コード例 #4
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtGoodsName.Text == "")
            {
                MessageBox.Show("请先选择物料");

                return;
            }
            else
            {
                try
                {
                    if (txtQty.Text == "")
                    {
                        MessageBox.Show("请先称重");
                        return;
                    }
                    if (txtRQQty.Text == "")
                    {
                        MessageBox.Show("请先输入容器重量");
                        return;
                    }
                    if (IsNumberic(txtRQQty.Text) == false)
                    {
                        MessageBox.Show("容器重量应该为数字");
                        return;
                    }
                    if (Convert.ToDecimal(txtRQQty.Text) > Convert.ToDecimal(txtQty.Text))
                    {
                        MessageBox.Show("容器重量不能大于称重重量");
                        return;
                    }


                    this.Enabled   = false;
                    Cursor.Current = Cursors.WaitCursor;
                    string strBarcode = txtCode.Text + DateTime.Now.ToString("yyyyMMddHHmmss");

                    Mes_WorkShopWeightBLL    WorkShopWeightBLL    = new Mes_WorkShopWeightBLL();
                    Mes_WorkShopWeightEntity WorkShopWeightEntity = new Mes_WorkShopWeightEntity();
                    WorkShopWeightEntity.W_CreateBy     = "";
                    WorkShopWeightEntity.W_CreateDate   = DateTime.Now;
                    WorkShopWeightEntity.W_OrderNo      = Globels.strOrderNo;
                    WorkShopWeightEntity.W_ProceCode    = Globels.strProce;
                    WorkShopWeightEntity.W_ProceName    = Globels.strProceName;
                    WorkShopWeightEntity.W_RecordName   = Globels.strRecordName;
                    WorkShopWeightEntity.W_WorkShopName = Globels.strWorkShopName;
                    WorkShopWeightEntity.W_RecordCode   = Globels.strRecord;
                    WorkShopWeightEntity.W_Remark       = "";
                    WorkShopWeightEntity.W_SecBatch     = txtBatch.Text;
                    WorkShopWeightEntity.W_SecGoodsCode = txtCode.Text;
                    WorkShopWeightEntity.W_SecGoodsName = txtGoodsName.Text;
                    WorkShopWeightEntity.W_SecQty       = Convert.ToDecimal(txtQty.Text) - Convert.ToDecimal(txtRQQty.Text);
                    WorkShopWeightEntity.W_SecUnit      = txtUnit.Text;
                    WorkShopWeightEntity.W_Status       = 1;
                    WorkShopWeightEntity.W_WorkShopCode = Globels.strWorkShop;
                    WorkShopWeightEntity.W_Remark       = strBarcode;

                    int nCount = WorkShopWeightBLL.SaveEntity("", WorkShopWeightEntity);
                    if (nCount > 0)
                    {
                        string Barcode = txtCode.Text + DateTime.Now.ToString("yyyyMMddHHmmss");
                        m_strBarcode = Barcode;
                        decimal dTemp = Convert.ToDecimal(txtQty.Text) - Convert.ToDecimal(txtRQQty.Text);
                        GetImg("物料" + txtCode.Text + "批次" + txtBatch.Text.Trim() + "单号" + Globels.strOrderNo, txtGoodsName.Text, dTemp.ToString(), strBZQ, strBarcode);
                        MessageBox.Show("添加成功");
                        SaveBarcode(Barcode, txtCode.Text, txtGoodsName.Text, dTemp, Globels.strWorkShop);
                    }

                    this.Enabled   = true;
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    this.Enabled   = true;
                    Cursor.Current = Cursors.Default;
                }
            }
        }
コード例 #5
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();
                }
            }
        }
コード例 #6
0
        private void frmOrgres_Load(object sender, EventArgs e)
        {
            MesProductOrderHeadBLL ProductOrderHeadBLL = new MesProductOrderHeadBLL();
            var row_ProductOrder = ProductOrderHeadBLL.GetListAll();

            for (int i = 0; i < row_ProductOrder.Count; i++)
            {
                //cmb  .Items.Add(row_ProductOrder[i].W_Code);
                comOrderNo.Items.Add(row_ProductOrder[i].P_OrderNo);
            }

            MesWorkShopBLL WorkShopBLL = new MesWorkShopBLL();
            var            rows        = WorkShopBLL.GetList();

            for (int i = 0; i < rows.Count; i++)
            {
                cmbWorkShop.Items.Add(rows[i].W_Code);
                cmbWorkShopName.Items.Add(rows[i].W_Name);
            }

            if (cmbWorkShop.Items.Contains(Globels.strWorkShop))
            {
                cmbWorkShop.Text = Globels.strWorkShop;
            }

            MesRecordBLL RecordBLL   = new MesRecordBLL();
            var          Record_rows = RecordBLL.GetList();

            for (int i = 0; i < Record_rows.Count; i++)
            {
                cmbRecord.Items.Add(Record_rows[i].R_Record);
                cmbRecordName.Items.Add(Record_rows[i].R_Name);
            }


            Mes_ProceBLL ProceBLL = new Mes_ProceBLL();
            var          row      = ProceBLL.GetList_Proce(" where 1 = 1 ");

            for (int i = 0; i < row.Count; i++)
            {
                cmbProce.Items.Add(row[i].P_ProNo);
                cmbProceName.Items.Add(row[i].P_ProName);
            }
            if (cmbProce.Items.Contains(Globels.strProce))
            {
                cmbProce.Text = Globels.strProce;
            }



            Mes_TeamBLL TeamBLL   = new Mes_TeamBLL();
            var         Team_rows = TeamBLL.GetList_Team(" where 1 = 1 ");

            for (int i = 0; i < Team_rows.Count; i++)
            {
                cmbTeam.Items.Add(Team_rows[i].T_Code);
                cmbTeamName.Items.Add(Team_rows[i].T_Name);
            }
            if (cmbTeam.Items.Contains(Globels.strTeam))
            {
                cmbTeam.Text = Globels.strTeam;
            }

            string strSql = "Select distinct W_SecGoodsName from Mes_WorkShopWeight where W_WorkShopCode = '" + cmbWorkShop.Text + "'";
            Mes_WorkShopWeightBLL WorkShopWeightBL = new Mes_WorkShopWeightBLL();
            DataSet ds   = WorkShopWeightBL.GetList_WorkShop(strSql);
            int     nLen = ds.Tables[0].Rows.Count;

            comboBox1.Items.Clear();
            comboBox1.Items.Add("");
            for (int i = 0; i < nLen; i++)
            {
                comboBox1.Items.Add(ds.Tables[0].Rows[i]["W_SecGoodsName"].ToString());
            }
            Search();
        }
コード例 #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();
        }