コード例 #1
0
        private void txtOldName_OnCompleteSearch()
        {
            if (txtOldParentCode.Tag != null)
            {
                DataTable dt = m_serverBom.GetBomStructInfo(Convert.ToInt32(txtOldParentCode.Tag),
                                                            Convert.ToInt32(txtOldName.DataResult["物品ID"]));

                if (dt.Rows.Count == 0)
                {
                    MessageDialog.ShowPromptMessage("BOM表结构不匹配,请重新确认");

                    txtOldName.Text    = "";
                    txtOldName.Tag     = (int?)null;
                    txtOldCode.Text    = "";
                    txtOldSpec.Text    = "";
                    txtOldVersion.Text = "";
                    txtOldCounts.Value = 0;

                    return;
                }

                txtOldCounts.Value = Convert.ToDecimal(dt.Rows[0]["Usage"]);
            }
            else
            {
                txtOldCounts.Value = m_serverBom.GetAllMostUsage(Convert.ToInt32(txtOldName.DataResult["物品ID"]));
            }

            txtOldName.Tag = Convert.ToInt32(txtOldName.DataResult["物品ID"]);

            txtOldCode.Text = txtOldName.DataResult["零部件编码"].ToString();
            txtOldName.Text = txtOldName.DataResult["零部件名称"].ToString();
            txtOldSpec.Text = txtOldName.DataResult["规格"].ToString();

            txtOldVersion.Text = txtOldName.DataResult["版次号"].ToString();

            GetChangeMode();

            if (m_strChangeMode == "修改")
            {
                txtNewParentCode.Text = txtOldParentCode.Text;
                txtNewParentCode.Tag  = txtOldParentCode.Tag;

                txtNewName.Tag = Convert.ToInt32(txtOldName.DataResult["物品ID"]);

                txtNewCode.Text = txtOldName.DataResult["零部件编码"].ToString();
                txtNewName.Text = txtOldName.DataResult["零部件名称"].ToString();
                txtNewSpec.Text = txtOldName.DataResult["规格"].ToString();

                txtNewVersion.Text = txtOldVersion.Text;
                txtNewCounts.Value = txtOldCounts.Value;
            }
        }