Ejemplo n.º 1
0
        private void FrmMaterialMoveAdd_Load(object sender, EventArgs e)
        {
            string    strSql     = string.Format(" select Storage_SN,Storage_Name from  T_Bllb_Storage_tbs");
            DataTable dt_Storage = NMS.QueryDataTable(PubUtils.uContext, strSql);

            cbo_SourceStorage.DataSource    = dt_Storage;
            cbo_SourceStorage.DisplayMember = "Storage_Name";
            cbo_SourceStorage.ValueMember   = "Storage_SN";

            string    strTarget  = string.Format(" select Storage_SN,Storage_Name from  T_Bllb_Storage_tbs");
            DataTable dt_TargetS = NMS.QueryDataTable(PubUtils.uContext, strTarget);

            cbo_TargetStorage.DataSource    = dt_TargetS;
            cbo_TargetStorage.DisplayMember = "Storage_Name";
            cbo_TargetStorage.ValueMember   = "Storage_SN";

            txt_DOC_NO.Text = Bll_Bllb_StorageDoc_tbsd.Get_MaterialMove_Doc();
            if (_IsAddOrEdit)
            {
                txt_DOC_NO.Text        = Doc.S_Doc_NO;       //单据号
                cbo_SourceStorage.Text = Doc.Source_Storage; //原仓库
                cbo_TargetStorage.Text = Doc.Target_Storage; //目的仓库
                txt_memo.Text          = Doc.Memo;           //备注
                string materialCode = DocM.MaterialCode;     //料号

                //string strWhere = string.Format("Where b.S_Doc_NO ='{0}' AND Storage_SN='{1}' AND a.MaterialCode='{2}'", txt_DOC_NO.Text.Trim(), cbo_SourceStorage.SelectedValue, materialCode);
                ////dt_MaterialMove = Bll_Bllb_StorageDocMaterial_tsdm.Select(strWhere);
                //DataTable dt = Bll_Bllb_StorageDocMaterial_tsdm.Select(strWhere);
                //    if (dt.Rows.Count > 0)
                //{
                //    dgv_MaterialMoveAdd.DataSource = dt;
                //    dgv_MaterialMoveAdd.ClearSelection();
                //}
                //else
                //{
                //    string strcmd = string.Format("S_Doc_NO='{0}' AND MaterialCode='{1}'", txt_DOC_NO.Text.Trim(),materialCode);
                //    dt_MaterialMove = Bll_Bllb_StorageDocMaterial_tsdm.Query(strcmd);
                //    dgv_MaterialMoveAdd.DataSource = dt_MaterialMove;
                //    dgv_MaterialMoveAdd.ClearSelection();

                //}
                string strcmd = string.Format("S_Doc_NO='{0}' ", txt_DOC_NO.Text.Trim());
                dt_MaterialMove = Bll_Bllb_StorageDocMaterial_tsdm.Query(strcmd);
                dgv_MaterialMoveAdd.DataSource = dt_MaterialMove;
                dgv_MaterialMoveAdd.ClearSelection();

                txt_DOC_NO.ReadOnly       = true;
                cbo_SourceStorage.Enabled = false;
                cbo_TargetStorage.Enabled = false;
                txt_memo.ReadOnly         = true;

                GetQty();
            }
        }