private void btnParentAdd_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow dr in dataGridViewParent.Rows)
            {
                if (dr.Cells["父级物品ID_2"].Value.ToString() == txtParentGoodsCode.Tag.ToString())
                {
                    MessageDialog.ShowPromptMessage("存在相同项,不能添加重复父级图号");
                    return;
                }
            }

            List <View_BASE_BomStruct> listTemp = m_serviceBOMInfo.GetBOMList_Design(Convert.ToInt32(txtParentGoodsCode.Tag));

            foreach (View_BASE_BomStruct item in listTemp)
            {
                View_Business_Base_BomChange_Struct tempLnq = new View_Business_Base_BomChange_Struct();

                tempLnq.单据号    = txtBillNo.Text;
                tempLnq.父级图号   = item.ParentGoodsCode;
                tempLnq.父级物品ID = item.ParentID;
                tempLnq.规格     = item.Spec;
                tempLnq.基数     = item.Usage;
                tempLnq.图号型号   = item.GoodsCode;
                tempLnq.物品ID   = item.GoodsID;
                tempLnq.物品名称   = item.GoodsName;

                m_listStruct.Add(tempLnq);
            }

            dataGridViewParent.Rows.Add(new object[] { txtParentGoodsCode.Text, (int)txtParentGoodsCode.Tag });

            dataGridViewParent.CurrentCell = dataGridViewParent.Rows[dataGridViewParent.Rows.Count - 1].Cells[0];
            dataGridViewParent.FirstDisplayedScrollingRowIndex = dataGridViewParent.Rows.Count - 1;
            dataGridViewParent_CellEnter(sender, new DataGridViewCellEventArgs(0, dataGridViewParent.Rows.Count - 1));
        }
        private void btnStructInput_Click(object sender, EventArgs e)
        {
            FormGoodsSelect frm = new FormGoodsSelect(m_serviceStatement.GetAssemblyInfo());

            if (frm.ShowDialog() == DialogResult.OK)
            {
                List <View_BASE_BomStruct> listTemp = m_serviceBOMInfo.GetBOMList_Design(frm.GoodsInfo.序号);

                string goodsCode = dataGridViewParent.CurrentRow.Cells["父级图号_2"].Value.ToString();
                int    goodsID   = Convert.ToInt32(dataGridViewParent.CurrentRow.Cells["父级物品ID_2"].Value);

                foreach (View_BASE_BomStruct item in listTemp)
                {
                    View_Business_Base_BomChange_Struct tempLnq = new View_Business_Base_BomChange_Struct();

                    tempLnq.单据号    = txtBillNo.Text;
                    tempLnq.父级图号   = goodsCode;
                    tempLnq.父级物品ID = goodsID;
                    tempLnq.规格     = item.Spec;
                    tempLnq.基数     = item.Usage;
                    tempLnq.图号型号   = item.GoodsCode;
                    tempLnq.物品ID   = item.GoodsID;
                    tempLnq.物品名称   = item.GoodsName;

                    m_listStruct.Add(tempLnq);
                }

                List <View_Business_Base_BomChange_Struct> lstTemp = SingleParentGoodsStruct(goodsID);

                foreach (View_Business_Base_BomChange_Struct item in lstTemp)
                {
                    dataGridViewStruct.Rows.Add(new object[] { item.单据号, item.父级图号, item.父级物品ID, item.物品ID,
                                                               item.图号型号, item.物品名称, item.规格, item.基数 });
                }

                string strTemp = GetEndSql();
                foreach (DataGridViewRow dr in dataGridViewStruct.Rows)
                {
                    SetStructShowTextBox(dr, strTemp);
                }

                userControlDataLocalizer1.Init(dataGridViewStruct, this.Name,
                                               UniversalFunction.SelectHideFields(this.Name, dataGridViewStruct.Name, BasicInfo.LoginID));
            }
        }
        private void dataGridViewStruct_Leave(object sender, EventArgs e)
        {
            m_listStruct.RemoveAll(r => r.父级物品ID == (int)dataGridViewParent.CurrentRow.Cells["父级物品ID_2"].Value);

            if (dataGridViewStruct.Rows.Count == 0)
            {
                View_Business_Base_BomChange_Struct tempLnq = new View_Business_Base_BomChange_Struct();

                tempLnq.单据号    = txtBillNo.Text;
                tempLnq.父级图号   = dataGridViewParent.CurrentRow.Cells["父级图号_2"].Value.ToString();
                tempLnq.父级物品ID = Convert.ToInt32(dataGridViewParent.CurrentRow.Cells["父级物品ID_2"].Value);

                m_listStruct.Add(tempLnq);
                return;
            }

            foreach (DataGridViewRow dr in dataGridViewStruct.Rows)
            {
                if (dr.Cells["物品ID"].Value == null || dr.Cells["物品ID"].Value.ToString() == "0")
                {
                    continue;
                }

                View_Business_Base_BomChange_Struct tempLnq = new View_Business_Base_BomChange_Struct();

                tempLnq.单据号    = dr.Cells["单据号"].Value.ToString();
                tempLnq.父级图号   = dr.Cells["父级图号"].Value.ToString();
                tempLnq.父级物品ID = Convert.ToInt32(dr.Cells["父级物品ID"].Value);
                tempLnq.规格     = dr.Cells["规格"].Value.ToString();
                tempLnq.基数     = Convert.ToDecimal(dr.Cells["基数"].Value);
                tempLnq.图号型号   = dr.Cells["图号型号"].Value.ToString();
                tempLnq.物品名称   = dr.Cells["物品名称"].Value.ToString();
                tempLnq.物品ID   = Convert.ToInt32(dr.Cells["物品ID"].Value);

                m_listStruct.Add(tempLnq);
            }
        }