Ejemplo n.º 1
0
        /// <summary>
        /// 根据工单把产品,产品别信息取出来
        /// </summary>
        private void txtMoCode_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
        {
            if (e.KeyChar == '\r')
            {
                string mocode = this.txtMoCode.Text.Trim().ToUpper();
                if (mocode.Length == 0)
                {
                    return;
                }

                BenQGuru.eMES.MOModel.MOFacade  facade = new MOFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.MO mo     = facade.GetMO(mocode) as BenQGuru.eMES.Domain.MOModel.MO;
                if (mo == null || mo.MOCode == null)
                {
                    ErrorMsg("$CS_MO_Not_Exist");
                    this.txtMoCode.Focus();
                    return;
                }

                BenQGuru.eMES.MOModel.ModelFacade  modelfacade = new ModelFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.Model model       = modelfacade.GetModelByItemCode(mo.ItemCode) as BenQGuru.eMES.Domain.MOModel.Model;

                if (model == null)
                {
                    ErrorMsg("$CS_Model_Lost");
                    return;
                }
                BenQGuru.eMES.MOModel.ItemFacade  itemfacade = new ItemFacade(this.DataProvider);
                BenQGuru.eMES.Domain.MOModel.Item item       = itemfacade.GetItem(mo.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID) as BenQGuru.eMES.Domain.MOModel.Item;
                if (item == null)
                {
                    ErrorMsg("$Error_ItemCode_NotExist");
                    return;
                }

                this.cbxModel.SetSelectItem(model.ModelCode);
                this.cbxItemCode.SetSelectItem(mo.ItemCode);
                this.txtItemDesc.Value = item.ItemDescription;

                this.txtNum.Focus();
            }
        }
Ejemplo n.º 2
0
        //Bind产品别下拉列表
        private void BindModel(BenQGuru.eMES.Common.Domain.IDomainDataProvider provider, UserControl.UCLabelCombox cbx)
        {
            cbx.ComboBoxData.Items.Clear();
            this.cbxItemCode.ComboBoxData.Items.Clear();
            this.txtItemDesc.InnerTextBox.Text = string.Empty;

            //只列出可入库的产品别
            object[] objs = new BenQGuru.eMES.Material.InventoryFacade(this.DataProvider).GetInventoryModel();
            if (objs != null)
            {
                foreach (object obj in objs)
                {
                    BenQGuru.eMES.Domain.MOModel.Model model = obj as BenQGuru.eMES.Domain.MOModel.Model;
                    if (model != null)
                    {
                        cbx.AddItem(model.ModelCode, model.ModelCode);
                    }
                }
            }
        }