根据网友要求,将原来在一个项目中的使用了富盛SBO程序开发框架完成的一个简单功能源代码,发表于此,希望能够帮助那些希望建立基于富盛SBO Addon程序开发框架来实现某些业务功能和Addon增强业务模块的朋友们。
 
    public class fsCxFWarehouseSetForm : fsSboBasicForm
    {
        public fsCxFWarehouseSetForm(fsSboCommon fs) : base(fs) { }
        protected override bool AddItems2Form(string strFId, string strTitle)
        {
            Boolean bRet = base.AddItems2Form(strFId, strTitle);
            try
            {
                if (bRet && ShowForm(strFId, strTitle, 40, 350, 600, 360, "64") == 0)
                {
                    Boolean bAllowEdit = fsSbo.IsEnabled4Func("FSCXF", "UM_FSCXFWHSSET", "EDIT");
                    Matrix mtx = fsSbo.AddMatrix2Form(ref oForm, "mtxData", 10, 10, 580, 300);
                    mtx.SelectionMode = BoMatrixSelect.ms_Single;
                    fsSbo.AddColumn2Matrix(ref mtx, new fsMatrixColumnInfo());
                    Column oColumn = fsSbo.AddColumn2Matrix(ref mtx, "whsCode", BoFormItemTypes.it_EDIT, 70, "仓库", false, BoLinkedObject.lf_None);
                    oColumn.DataBind.SetBound(true, "OWHS", "whsCode");
                    oColumn = fsSbo.AddColumn2Matrix(ref mtx, "whsName", BoFormItemTypes.it_EDIT, 200, "仓库名称", bAllowEdit, BoLinkedObject.lf_None);
                    oColumn.DataBind.SetBound(true, "OWHS", "whsName");
                    oColumn = fsSbo.AddColumn2Matrix(ref mtx, "GrpCode", BoFormItemTypes.it_COMBO_BOX, 130, "物料组", bAllowEdit, BoLinkedObject.lf_None);
                    oColumn.DataBind.SetBound(true, "OWHS", "Grp_Code");
                    fsSbo.AddValidValues2Matrix(ref oColumn, "_select ItmsGrpCod, ItmsGrpNam FROM OITB ORDER by ItmsGrpCod");
                    oColumn = fsSbo.AddColumn2Matrix(ref mtx, "IsPosMgt", BoFormItemTypes.it_COMBO_BOX, 70, "启用货位", bAllowEdit, BoLinkedObject.lf_None);
                    oColumn.DataBind.SetBound(true, "OWHS", "U_IsPosMgt");
                    fsSbo.AddValidValues2Matrix(ref oColumn, fsSbo.GetSboFieldValidValues("OWHS", "U_IsPosMgt"));
                    oColumn = fsSbo.AddColumn2Matrix(ref mtx, "IsWhsMgt", BoFormItemTypes.it_COMBO_BOX, 70, "启用仓管", bAllowEdit, BoLinkedObject.lf_None);
                    oColumn.DataBind.SetBound(true, "OWHS", "U_IsWhsMgt");
                    fsSbo.AddValidValues2Matrix(ref oColumn, fsSbo.GetSboFieldValidValues("OWHS", "U_IsWhsMgt"));
                    fsSbo.AddItem2Form(ref oForm, "1", BoFormItemTypes.it_BUTTON, 320, 10, 65, 20, bAllowEdit);
                    fsSbo.AddItem2Form(ref oForm, "2", BoFormItemTypes.it_BUTTON, 320, 80, 65, 20);
                    fsSbo.AddButton2Form(ref oForm, "btnQuery", "刷新", 320, oForm.Width - 110, 70, 20);
                    oForm.DataSources.DBDataSources.Item("OWHS").Query(null);
                    mtx.LoadFromDataSource();
                    EnableNavigatorMenus(false, false, false);
                    oForm.Mode = BoFormMode.fm_OK_MODE;
                }
            }
            catch (Exception ex)
            {
                fsSbo.ShowExceptiontMsg(ex);
                bRet = false;
            }
            return bRet;
        }
        protected override bool DoPostItemEventItemPressed(ref ItemEvent pVal)
        {
            if (pVal.ItemUID == "btnQuery")
            {
                Matrix mtx = (Matrix)oForm.Items.Item("mtxData").Specific;
                oForm.DataSources.DBDataSources.Item(mtx.Columns.Item(1).DataBind.TableName).Query(null);
                mtx.LoadFromDataSource();
            }
            return base.DoPostItemEventItemPressed(ref pVal);
        }
    }