Example #1
0
        public static string GetFilterString(this FilterScheme scheme, Context ctx, FormMetadata metadata)
        {
            if (scheme.Scheme.IsNullOrEmptyOrWhiteSpace())
            {
                return(string.Empty);
            }

            //字段比较条件元数据。
            var filterMetadata = FormMetaDataCache.GetCachedFilterMetaData(ctx);

            //过滤模型:解析过滤方案
            ListFilterModel filterModel = new ListFilterModel();

            filterModel.FilterObject.FilterMetaData = filterMetadata;
            filterModel.SetContext(ctx, metadata.BusinessInfo, metadata.BusinessInfo.GetForm().GetFormServiceProvider());
            filterModel.InitFieldList(metadata, null);

            //把过滤方案的XML内容,反序列化为对象
            DcxmlSerializer dcxmlSerializer = new DcxmlSerializer(new PreInsertDataDcxmlBinder());
            SchemeEntity    schemeEntity    = dcxmlSerializer.DeserializeFromString(scheme.Scheme) as SchemeEntity;

            //利用ListFilterModel, 翻译过滤条件
            filterModel.FilterObject.Setting = schemeEntity.FilterSetting;
            string statement = filterModel.FilterObject.GetFilterSQLString(ctx, TimeServiceHelper.GetSystemDateTime(ctx));

            return(statement);
        } //end metthod
Example #2
0
        public View GetView(OutputFieldMetadata outputField,
                            object value,
                            MyFormHandler myFormHandler,
                            FormMetadata formMetadata,
                            List <FormInputManager> inputsManager)
        {
            this.Layout = new FlexboxLayout(Application.Context);
            var tabstrip   = value.CastTObject <Tabstrip>();
            var currentTab = tabstrip.Tabs.SingleOrDefault(a => a.Form == tabstrip.CurrentTab);

            foreach (var tab in tabstrip.Tabs)
            {
                if (tab != null)
                {
                    var tv = new TextView(Application.Context)
                    {
                        Text = tab.Label
                    };

                    tv.Click += async(sender, args) =>
                    {
                        var metadata = myFormHandler.GetFormMetadata(tab.Form);

                        myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, tab.InputFieldValues));
                    };

                    myFormHandler.ManagersCollection.StyleRegister.ApplyStyle(tab == currentTab ? "Tab CurrentTab" : "Tab", tv);
                    this.Layout.AddView(tv);
                    this.Layout.FlexDirection = FlexboxLayout.FlexDirectionRow;
                    this.Layout.FlexWrap      = FlexboxLayout.FlexWrapWrap;
                }
            }
            return(this.Layout);
        }
Example #3
0
        public DynamicObject GetSimpleExtensionByNumber(String number)
        {
            FormMetadata meta = MetaDataServiceHelper.Load(context, Constant.FormID.WJ_Extension) as FormMetadata;

            // 构建查询参数,设置过滤条件
            QueryBuilderParemeter queryParam = new QueryBuilderParemeter
            {
                FormId       = Constant.FormID.WJ_Extension,
                BusinessInfo = meta.BusinessInfo,

                FilterClauseWihtKey = string.Format(" {0} = '{1}' ",
                                                    meta.BusinessInfo.GetForm().NumberFieldKey,
                                                    number)
            };

            var bdObjs = BusinessDataServiceHelper.Load(context,
                                                        meta.BusinessInfo.GetDynamicObjectType(),
                                                        queryParam);

            if (bdObjs.Length == 1)
            {
                return(bdObjs.FirstOrDefault());
            }
            else if (bdObjs.Length == 0)
            {
                return(null);
            }
            else
            {
                throw new Exception("编码 " + number + " formId " + Constant.FormID.WJ_Extension + "找到多个数据");
            }
        }
Example #4
0
        public UIView GetView(OutputFieldMetadata outputField,
                              object value,
                              MyFormHandler myFormHandler,
                              FormMetadata formMetadata,
                              List <FormInputManager> inputsManager,
                              int yAxis)
        {
            this.OutputView = new UIView();
            var actions = value?.CastTObject <ActionList>();

            if (actions != null)
            {
                int y = 0;
                foreach (var btn in actions.Actions)
                {
                    var button = this.InitializeActionButton(btn, myFormHandler, y);
                    y += 40;
                    this.OutputView.AddSubview(button);
                }
                var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, actions.Actions.Count * 40);
                this.OutputView.Frame = new CGRect(new CGPoint(20, yAxis), size);
            }

            return(this.OutputView);
        }
Example #5
0
        public UIView GetView(OutputFieldMetadata outputField,
                              object value,
                              MyFormHandler myFormHandler,
                              FormMetadata formMetadata,
                              List <FormInputManager> inputsManager,
                              int yAxis)
        {
            var formLink = value.CastTObject <FormLink>();
            var size     = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30);

            this.OutputView = new UITextView
            {
                Text      = outputField.Label + ": " + formLink.Label,
                Frame     = new CGRect(new CGPoint(20, yAxis), size),
                TextColor = UIColor.Blue
            };

            var gesture = new UITapGestureRecognizer();

            gesture.AddTarget(() =>
            {
                var metadata = myFormHandler.GetFormMetadataAsync(formLink.Form);
                myFormHandler.FormWrapper.UpdateView(myFormHandler, new FormParameter(metadata, formLink.InputFieldValues));
            });
            this.OutputView.AddGestureRecognizer(gesture);
            return(this.OutputView);
        }
Example #6
0
 public override void BeginOperationTransaction(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.BeginOperationTransactionArgs e)
 {
     base.BeginOperationTransaction(e);
     if (e.DataEntitys == null || e.DataEntitys.Count() <= 0)
     {
         return;
     }
     foreach (DynamicObject data in e.DataEntitys)
     {
         string        FCONTACTUNITTYPE = Convert.ToString(data["CONTACTUNITTYPE"]);
         int           FCONTACTUNIT_Id  = Convert.ToInt32(data["CONTACTUNIT_Id"]);
         DynamicObject FCONTACTUNIT     = data["CONTACTUNIT"] as DynamicObject;
         DynamicObject FJNFistSaler     = data["FJNFistSaler"] as DynamicObject;
         if (FCONTACTUNITTYPE == "BD_Customer" && FCONTACTUNIT != null && FJNFistSaler == null)
         {
             FormMetadata  formMetadata = MetaDataServiceHelper.Load(this.Context, "BD_Customer") as FormMetadata;
             DynamicObject CustObject   = BusinessDataServiceHelper.LoadSingle(
                 this.Context,
                 FCONTACTUNIT_Id,
                 formMetadata.BusinessInfo.GetDynamicObjectType());
             if (CustObject != null)
             {
                 DynamicObject Saler = CustObject["JN_SalesId"] as DynamicObject;
                 if (Saler != null)
                 {
                     int    Saler_Id = Convert.ToInt32(Saler["id"]);
                     int    billid   = Convert.ToInt32(data["id"]);
                     string strSQL   = string.Format("/*dialect*/update T_AR_RECEIVEBILL set FJNFISTSALER ={0} where fid={1}", Saler_Id, billid);
                     DBUtils.Execute(this.Context, strSQL);
                 }
             }
         }
         //AppServiceContext.SaveService.Save(this.Context, formMetadata.BusinessInfo, dataObjects);
     }
 }
Example #7
0
        //[ResponseCache(CacheProfileName = "Collection")]
        public async Task <ActionResult <Collection <Question> > > GetAllQuestionsByFeedbackType(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <Question, QuestionEntity> sortOptions,
            [FromQuery] SearchOptions <Question, QuestionEntity> searchOptions,
            [FromRoute] string feedbackType,
            CancellationToken ct)
        {
            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            var questions = await _feedback.GetAllByFeedbackTypeAsync(pagingOptions, sortOptions, searchOptions, feedbackType, ct);

            var collection = PagedCollection <Question> .Create <QuestionResponse>(
                Link.ToCollection(nameof(GetAllQuestionsByFeedbackType)),
                questions.Items.ToArray(),
                questions.TotalSize,
                pagingOptions);

            //TODO
            //collection.Answers = Link.ToCollection(nameof(AnswersController.GetItem));
            collection.QuestionForm = FormMetadata.FromModel(
                new QuestionForm(),
                Link.ToForm(nameof(QuestionsController.CreateQuestion),
                            null, relations: Form.Relation));
            collection.QuestionsQuery = FormMetadata.FromResource <Question>(
                Link.ToForm(
                    nameof(GetAllQuestionsByFeedbackType),
                    null,
                    Link.GetMethod,
                    Form.QueryRelation));

            return(collection);
        }
Example #8
0
        private QueryBuilderParemeter GetQBPara(CheckPara para, string formKey)
        {
            FormMetadata          formMetadata = FormMetaDataCache.GetCachedFormMetaData(this.Context, formKey);
            QueryBuilderParemeter qbPara       = new QueryBuilderParemeter();

            qbPara.FormId = formKey;
            if (formKey == "STK_TransferDirect")
            {
                qbPara.FilterClauseWihtKey = string.Format(" FJNUnitEnzymes <> {0} And FSTOCKORGID ={1} And {2} = {3} And {4}={5} And {6} = '{7}' ",
                                                           para.unitEnzymes, para.orgId, matFldKey, para.matId, "FAuxPropId", para.auxPropId, "FLot.FNumber", para.lotNumber);
            }
            else
            {
                qbPara.FilterClauseWihtKey = string.Format(" FJNUnitEnzymes <> {0} And {1} ={2} And {3} = {4} And {5}={6} And {7} = '{8}' ",
                                                           para.unitEnzymes, formMetadata.BusinessInfo.MainOrgField.FieldName, para.orgId, matFldKey, para.matId, "FAuxPropId", para.auxPropId, "FLot.FNumber", para.lotNumber);
            }

            if (para.currFormKey.EqualsIgnoreCase(formKey))
            {
                qbPara.FilterClauseWihtKey += string.Format(" And {0} <> {1} ", para.currEnFldName, para.currentEntryId);
            }

            qbPara.SelectItems = SelectorItemInfo.CreateItems("FBillNo,FMaterialId.FNumber as FMatNumber,FMaterialId.FName as FMatName,FJNUnitEnzymes");

            return(qbPara);
        }
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                string           SoureFormId     = "SZXY_FHJTRSCJH";
                //获取单据元数据
                FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string  Id       = Convert.ToString(dy["Id"]);
                    decimal Area     = 0;
                    string  RJHFid   = string.Empty;
                    string  RJHRowId = string.Empty;
                    RJHFid   = Convert.ToString(dy["F_SZXY_FIDH"]);
                    Area     = Convert.ToDecimal(dy["F_SZXY_ProdArea"]);
                    RJHRowId = Convert.ToString(dy["F_SZXY_FEntryIDH"]);


                    if (Area > 0 && !RJHFid.IsNullOrEmptyOrWhiteSpace() && Convert.ToInt32(RJHFid) > 0 && Convert.ToInt32(RJHRowId) > 0)
                    {
                        //单据头反写复合日计划实际完成面积

                        string sql1 = $"/*dialect*/update SZXY_t_LSJTRSCJHEntry  set F_SZXY_ProdArea=F_SZXY_ProdArea-{Area} " +
                                      $"  where Fid={RJHFid}" +
                                      $" and FEntryID={RJHRowId} ";
                        DBServiceHelper.Execute(Context, sql1);
                    }
                }
            }
        }
Example #10
0
        public override void OnSetBusinessInfo(SetBusinessInfoArgs e)
        {
            new ExtensionPresenter(this);

            base.OnSetBusinessInfo(e);
            // 创建当前单据元数据副本,避免直接修改原始元数据,并发时串账
            FormMetadata currmetadata = (FormMetadata)ObjectUtils.CreateCopy(
                this.View.OpenParameter.FormMetaData);

            _currBusinessInfo = currmetadata.BusinessInfo;
            _currLayoutInfo   = currmetadata.GetLayoutInfo();

            // 取单据头的元数据模型
            currEntityKey = "FBillHead";
            currEntity    = _currBusinessInfo.GetEntity(currEntityKey);

            // 取配置字段的模板,动态添加的字段,是基于模板字段的一个分身
            modelTextField      = _currBusinessInfo.GetField("FModelText");      //文本模板
            modelDecimalField   = _currBusinessInfo.GetField("FModelDecimal");   //小数模板
            modelF8Field        = _currBusinessInfo.GetField("FModelF8");        //F8模板
            modelAssistantField = _currBusinessInfo.GetField("FModelAssistant"); //辅助资料模板


            var simpleExtension = this.View.OpenParameter.GetCustomParameter("simpleExtension") as DynamicObject;

            presenter.GenerateByJson(simpleExtension["FExtension"] as string);

            _currBusinessInfo.GetDynamicObjectType(true);
            e.BusinessInfo     = _currBusinessInfo;
            e.BillBusinessInfo = _currBusinessInfo;
        }
        public static void GenerateClassFiles(FormMetadata formMetadata, string directoryPath)
        {
            if (formMetadata == null)
            {
                throw new ArgumentNullException(nameof(formMetadata));
            }

            List <Entity>          entities         = formMetadata.BusinessInfo.Entrys;
            string                 formId           = formMetadata.BusinessInfo.GetForm().Id;
            string                 ns               = $"Kingdee.Vincent.Core.BD.{formId}";
            List <ClassDefinition> classDefinitions = new List <ClassDefinition>();

            foreach (Entity entity in entities)
            {
                classDefinitions.AddRange(BuildClassDefinitions(formMetadata.BusinessInfo, entity, ns, formId));
            }

            classDefinitions = FilterClassDefinition(classDefinitions);

            foreach (ClassDefinition definition in classDefinitions)
            {
                string filePath = Path.Combine(directoryPath + definition.Name + ".cs");
                GenerateClassFile(definition, filePath);
            }
        }
Example #12
0
        public void BuildF8(ExtensionItem extension)
        {
            BaseDataField propField = (BaseDataField)ObjectUtils.CreateCopy(modelF8Field);

            propField.DynamicProperty = null;
            propField.ChildrenFields.Clear();
            propField.EntityKey = currEntityKey;
            propField.Entity    = currEntity;
            if (propField.UpdateActions != null)
            {
                propField.UpdateActions.Clear();
            }

            // 必改属性,涉及到数据的加载
            propField.Key                    = extension.Key;
            propField.FieldName              = extension.Key.ToUpperInvariant();
            propField.PropertyName           = extension.Key;
            propField.Name                   = new LocaleValue(extension.Name);
            propField.LookUpObject.FormId    = extension.F8FormId;
            propField.LookUpObject.TableName = extension.F8TableName;

            FormMetadata materialMetada =
                MetaDataServiceHelper.Load(this.Context, extension.F8FormId) as FormMetadata;


            propField.RefFormDynamicObjectType = materialMetada.BusinessInfo.GetDynamicObjectType();
            propField.TableName = extension.F8TableName;
            //  propField.RefFormDynamicObjectType = new DynamicObjectType(extension.F8FormId);

            _currBusinessInfo.Add(propField);
        }
Example #13
0
        private Button CreateLoadMoreButton(MyFormHandler myFormHandler,
                                            FormMetadata formMetadata,
                                            OutputFieldMetadata outputField,
                                            ListView listView,
                                            List <FormInputManager> inputsManager,
                                            Dictionary <string, FormMetadata> allFormsMetadata)
        {
            var btnLoadMore = new Button(Application.Context)
            {
                Text = "Load More"
            };

            btnLoadMore.Click += async(sender, args) =>
            {
                this.PageIndex++;
                var paginator = inputsManager.Find(a => a.Input.Type == "paginator");
                paginator.Manager.SetValue(new Paginator
                {
                    PageSize  = 10,
                    PageIndex = this.PageIndex
                });
                var response = await myFormHandler.HandleFormAsync(formMetadata, inputsManager);

                object responsevalue;
                if (response.Data.GetType() == typeof(JObject))
                {
                    var jsonObj = (JObject)response.Data;
                    responsevalue = jsonObj.GetValue(outputField.Id, StringComparison.OrdinalIgnoreCase);
                }
                else
                {
                    var propertyInfo = response.Data.GetType().GetProperty(outputField.Id);
                    responsevalue = propertyInfo?.GetValue(response.Data, null);
                }

                var paginatedData = responsevalue.CastTObject <PaginatedData <object> >();
                var newList       = paginatedData.Results.ToList();

                if (newList.Any())
                {
                    foreach (var item in newList)
                    {
                        this.ItemList.Add(item);
                    }
                }
                //// Appending new data to menuItems ArrayList
                listView.Refresh(this.ItemList, outputField, myFormHandler, allFormsMetadata);

                // Setting new scroll position
                listView.SetSelectionFromTop(10 * (this.PageIndex - 1), 0);
                listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth());

                if (this.ItemList.Count == this.TotalCount)
                {
                    btnLoadMore.Visibility = ViewStates.Invisible;
                }
            };

            return(btnLoadMore);
        }
Example #14
0
        }//end static method

        public static Context CreateInstanceFromCache(this Context ctx, string dataCenterId, long userId)
        {
            Context contextByDataCenterId = DataCenterService.GetDataCenterContextFromCache(dataCenterId);

            //处理用户登录名
            {
                FormMetadata metadata     = FormMetaDataCache.GetCachedFormMetaData(contextByDataCenterId, FormIdConst.SEC_User);
                BusinessInfo businessInfo = metadata.BusinessInfo.GetSubBusinessInfo(new List <string> {
                    "FNumber", "FUserAccount", "FName"
                });
                DynamicObject dataObject = BusinessDataServiceHelper.LoadFromCache(contextByDataCenterId, new object[] { userId }, businessInfo.GetDynamicObjectType()).FirstOrDefault();
                contextByDataCenterId.UserId = dataObject.PkId <long>();
                if (businessInfo.GetField("FNumber") != null)
                {
                    contextByDataCenterId.LoginName = dataObject.FieldProperty <string>(businessInfo.GetField("FNumber"));
                }
                if (businessInfo.GetField("FUserAccount") != null)
                {
                    contextByDataCenterId.LoginName = dataObject.FieldProperty <string>(businessInfo.GetField("FUserAccount"));
                }
                contextByDataCenterId.UserName = dataObject.FieldProperty <string>(businessInfo.GetField("FName"));
            }

            return(contextByDataCenterId);
        }//end static method
Example #15
0
        public FormMetadata GetFormMetadata(string form)
        {
            FormMetadata formMetadata = null;

            if (this.AllFormsMetadata != null && this.AllFormsMetadata.ContainsKey(form))
            {
                formMetadata = this.AllFormsMetadata[form];
            }
            else if (this.UiMetadataWebApi != null)
            {
                try
                {
                    var result = Task.Run(
                        () => this.GetFormMetadataAsync(form));
                    formMetadata = result.Result;
                }
                catch (AggregateException ex)
                {
                    ex.ThrowInnerException();
                }
            }
            else
            {
                formMetadata = this.FormRegister.GetFormInfo(form)?.Metadata;
            }

            return(formMetadata);
        }
Example #16
0
        public async Task <IActionResult> GetRoomsAsync(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <Room, RoomEntity> sortOptions,
            [FromQuery] SearchOptions <Room, RoomEntity> searchOptions,
            CancellationToken cancellationToken)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            var rooms = await _roomService.GetRoomsAsync(pagingOptions, sortOptions, searchOptions, cancellationToken);

            var collection = PagedCollection <Room> .Create <RoomsResponse>(
                Link.ToCollection(nameof(GetRoomsAsync)),
                rooms.Items.ToArray(),
                rooms.TotalSize,
                pagingOptions);

            collection.Openings   = Link.ToCollection(nameof(GetAllRoomOpeningsAsync));
            collection.RoomsQuery = FormMetadata.FromResource <Room>(
                Link.ToForm(
                    nameof(GetRoomsAsync), null,
                    Link.GetMethod, Form.QueryRelation
                    )
                );

            return(Ok(collection));
        }
Example #17
0
        public View GetView(OutputFieldMetadata outputField,
                            object value,
                            MyFormHandler myFormHandler,
                            FormMetadata formMetadata,
                            List <FormInputManager> inputsManager)
        {
            this.OutputList = new LinearLayout(Application.Context)
            {
                Orientation = Orientation.Vertical
            };
            var label = new TextView(Application.Context)
            {
                Text = outputField.Label
            };

            label.LayoutParameters = label.WrapContent();
            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label);
            this.OutputList.AddView(label);
            var list     = value.CastTObject <ObjectList <object> >();
            var listView = new ListView(Application.Context);
            var adapter  = new ListCustomAdapter <object>(list.Items.ToList(), list.Metadata, myFormHandler);

            listView.Adapter          = adapter;
            listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth());
            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("ListView", listView);
            this.OutputList.AddView(listView);
            return(this.OutputList);
        }
        public async Task <ActionResult <Collection <FishData> > > GetFish(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <FishData, FishEntity> sortOptions,
            [FromQuery] SearchOptions <FishData, FishEntity> searchOptions)
        {
            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            PagedResults <FishData> fish = await _fishService.GetFishAsync(
                pagingOptions, sortOptions, searchOptions);

            FishResponse collection = PagedCollection <FishData> .Create <FishResponse>(
                Link.ToCollection(nameof(GetFish)),
                fish.Items.ToArray(),
                fish.TotalSize,
                pagingOptions);

            collection.FishQuery = FormMetadata.FromResource <FishData>(
                Link.ToForm(
                    nameof(GetFish),
                    null,
                    Link.GetMethod,
                    Form.QueryRelation));

            foreach (FishData link in collection.Value)
            {
                link.Href = Url.Link(nameof(GetFishById), new { link.Id });
            }

            return(collection);
        }
Example #19
0
        public UIView GetView(OutputFieldMetadata outputField,
                              object value,
                              MyFormHandler myFormHandler,
                              FormMetadata formMetadata,
                              List <FormInputManager> inputsManager,
                              int yAxis)
        {
            var list       = ((IEnumerable <object>)value).ToList();
            var properties = list[0].GetType().GetProperties();
            var height     = properties.Length * 25 * list.Count;

            this.OutputList = new UIView();
            var size = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, height + 30);

            this.OutputList.Frame = new CGRect(new CGPoint(20, yAxis), size);
            var label = new UITextView {
                Text = outputField.Label
            };
            var labelSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, 30);

            label.Frame = new CGRect(new CGPoint(0, 0), labelSize);
            this.OutputList.AddSubview(label);
            var listViewSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, height);
            var listView     = new UITableView(new CGRect(new CGPoint(10, 30), listViewSize))
            {
                //Source = new CustomTableViewController(list)
            };

            this.OutputList.AddSubview(listView);

            return(this.OutputList);
        }
Example #20
0
        public View GetView(OutputFieldMetadata outputField,
                            object value,
                            MyFormHandler myFormHandler,
                            FormMetadata formMetadata,
                            List <FormInputManager> inputsManager)
        {
            var formLink = value.CastTObject <FormLink>();

            this.Layout = new LinearLayout(Application.Context)
            {
                Orientation = Orientation.Horizontal
            };
            var link = new TextView(Application.Context)
            {
                Text = outputField.Label + ": "
            };

            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", link);
            this.Layout.AddView(link);

            if (formLink != null)
            {
                var text = this.InitializeLink(formLink, myFormHandler);
                myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("Link", text);
                this.Layout.AddView(text);
            }

            return(this.Layout);
        }
Example #21
0
        public View GetView(OutputFieldMetadata outputField,
                            object value,
                            MyFormHandler myFormHandler,
                            FormMetadata formMetadata,
                            List <FormInputManager> inputsManager)
        {
            this.OutputView = new LinearLayout(Application.Context)
            {
                Orientation = Orientation.Vertical
            };
            var label = new TextView(Application.Context)
            {
                Text = outputField.Label
            };

            label.LayoutParameters = label.WrapContent();
            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label);
            this.OutputView.AddView(label);
            var formInstance = value.CastTObject <FormInstanceModel>();

            foreach (var formInstanceValue in formInstance.Values)
            {
                var textView = new TextView(Application.Context)
                {
                    Text = formInstanceValue.Label + ": " + formInstanceValue.Value
                };
                textView.LayoutParameters = textView.WrapContent();
                myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", textView);
                this.OutputView.AddView(textView);
            }
            return(this.OutputView);
        }
        public async Task <ActionResult <Collection <CityData> > > GetCities(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <CityData, CityEntity> sortOptions,
            [FromQuery] SearchOptions <CityData, CityEntity> searchOptions)
        {
            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            PagedResults <CityData> cities = await _cityService.GetCitiesAsync(
                pagingOptions, sortOptions, searchOptions);

            CityResponse collection = PagedCollection <CityData> .Create <CityResponse>(
                Link.ToCollection(nameof(GetCities)),
                cities.Items.ToArray(),
                cities.TotalSize,
                pagingOptions);

            collection.CityQuery = FormMetadata.FromResource <CityData>(
                Link.ToForm(
                    nameof(GetCities),
                    null,
                    Link.GetMethod,
                    Form.QueryRelation));

            foreach (CityData link in collection.Value)
            {
                link.Href = Url.Link(nameof(GetCityById), new { link.Id });
            }

            return(collection);
        }
Example #23
0
        /// <summary>
        ///累加日计划面积
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(EndOperationTransactionArgs e)
        {
            base.EndOperationTransaction(e);
            IViewService Services = ServiceHelper.GetService <IViewService>();

            if (selectedRows != null && selectedRows.Count() != 0)
            {
                IMetaDataService metadataService = Kingdee.BOS.App.ServiceHelper.GetService <IMetaDataService>();
                string           SoureFormId     = "SZXY_FHJTRSCJH";
                //获取单据元数据
                FormMetadata BilMetada = metadataService.Load(Context, SoureFormId) as FormMetadata;

                foreach (DynamicObject dy in selectedRows)
                {
                    string Id       = Convert.ToString(dy["Id"]);
                    string RJHFid   = string.Empty;
                    string RJHRowId = string.Empty;

                    if (dy["SZXY_XYFHEntry"] is DynamicObjectCollection Entrys)
                    {
                        foreach (var item in Entrys.Where(op => !Convert.ToString(op["F_SZXY_PlasticNo"]).IsNullOrEmptyOrWhiteSpace()))
                        {
                            string LyNo = Convert.ToString(item["F_SZXY_PlasticNo"]);
                            //改写流转状态
                            string UpdateStateSql = string.Format("/*dialect*/update SZXY_t_XYLYEntry set  F_SZXY_CirculationState={0}   where F_SZXY_PlasticNo='{1}' ", 0, LyNo);
                            int    res            = DBServiceHelper.Execute(Context, UpdateStateSql);
                        }
                    }
                }
            }
        }
Example #24
0
        public async Task <IActionResult> GetMeetsAsync(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <Meet, MeetEntity> sortOptions,
            [FromQuery] SearchOptions <Meet, MeetEntity> searchOptions,
            CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            var meets = await _meetService.GetMeetsAsync(
                pagingOptions,
                sortOptions,
                searchOptions,
                ct);

            var collection = PagedCollection <Meet> .Create <MeetsResponse>(
                Link.ToCollection(nameof(GetMeetsAsync)),
                meets.Items.ToArray(),
                meets.TotalSize,
                pagingOptions);

            collection.MeetsQuery = FormMetadata.FromResource <Meet>(
                Link.ToForm(nameof(GetMeetsAsync), null,
                            Link.GetMethod, Form.QueryRelation));


            return(Ok(collection));
        }
Example #25
0
        public override void BeforeExecuteOperationTransaction(BeforeExecuteOperationTransaction e)
        {
            base.BeforeExecuteOperationTransaction(e);

            if (e.DataEntitys.Count() < 1)
            {
                return;
            }
            var dataEntities = e.DataEntitys.ToArray();

            foreach (DynamicObject dataEntry in dataEntities)
            {
                DynamicObject BillEntry = dataEntry["BillEntry"].AsType <DynamicObjectCollection>().First();
                //获取收货通知数据
                string OrginBillNo  = BillEntry["OriginBillNo"].ToString();
                string OriginFormId = "BAH_WMS_InNotice";

                FormMetadata          meta       = MetaDataServiceHelper.Load(this.Context, OriginFormId) as FormMetadata;
                QueryBuilderParemeter queryParam = new QueryBuilderParemeter();
                queryParam.FormId       = OriginFormId;
                queryParam.BusinessInfo = meta.BusinessInfo;

                queryParam.FilterClauseWihtKey = string.Format(" {0} = '{1}' ", meta.BusinessInfo.GetBillNoField().Key, OrginBillNo);

                var objs = BusinessDataServiceHelper.Load(this.Context, meta.BusinessInfo.GetDynamicObjectType(), queryParam);

                if (objs[0]["FBAHGenTargetStatus"].ToString().Equals('B') == true)
                {
                    throw new Exception(string.Format("编号为{0}的收货通知已生成目标单据,不允许反审核!", OrginBillNo));
                }
            }
        }
Example #26
0
        public View GetView(OutputFieldMetadata outputField,
                            object value,
                            MyFormHandler myFormHandler,
                            FormMetadata formMetadata,
                            List <FormInputManager> inputsManager)
        {
            this.OutputList = new LinearLayout(Application.Context)
            {
                Orientation = Orientation.Vertical
            };
            if (!string.IsNullOrEmpty(outputField.Label))
            {
                var label = new TextView(Application.Context)
                {
                    Text = outputField.Label + ": "
                };
                label.LayoutParameters = label.WrapContent();
                myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("TextView", label);
                this.OutputList.AddView(label);
            }
            var list     = value.CastTObject <IList <object> >();
            var listView = list.IntializeListView(outputField, myFormHandler);

            listView.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, listView.GetListHeigth());
            myFormHandler.ManagersCollection.StyleRegister.ApplyStyle("ListView", listView);
            this.OutputList.AddView(listView);
            return(this.OutputList);
        }
Example #27
0
        public async Task <ActionResult <Collection <Room> > > GetAllRooms(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <Room, RoomEntity> sortOptions,
            [FromQuery] SearchOptions <Room, RoomEntity> searchOptions)
        {
            pagingOptions = pagingOptions ?? new PagingOptions();

            pagingOptions.Offset = pagingOptions.Offset ?? defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? defaultPagingOptions.Limit;

            var rooms = await roomService.GetRoomsAsync(pagingOptions, sortOptions, searchOptions);

            var collection = PagedCollection <Room> .Create <RoomsResponse>(
                Link.ToCollection(nameof(GetAllRooms)),
                rooms.Items.ToArray(),
                rooms.TotalSize,
                pagingOptions);

            collection.Openings   = Link.ToCollection(nameof(GetAllRoomOpenings));
            collection.RoomsQuery = FormMetadata.FromResource <Room>(
                Link.ToForm(nameof(GetAllRooms),
                            null,
                            Link.GetMethod,
                            Form.QueryRelation));
            return(collection);
        }
Example #28
0
        public async Task <ActionResult <Collection <Opening> > > GetAllRoomOpenings(
            [FromQuery] PagingOptions pagingOptions,
            [FromQuery] SortOptions <Opening, OpeningEntity> sortOptions,
            [FromQuery] SearchOptions <Opening, OpeningEntity> searchOptions)
        {
            pagingOptions.Offset = pagingOptions.Offset ?? _defaultPagingOptions.Offset;
            pagingOptions.Limit  = pagingOptions.Limit ?? _defaultPagingOptions.Limit;

            var openings = await _openingService.GetOpeningsAsync(
                pagingOptions, sortOptions, searchOptions);

            var collection = PagedCollection <Opening> .Create <OpeningsResponse>(
                Link.ToCollection(nameof(GetAllRoomOpenings)),
                openings.Items.ToArray(),
                openings.TotalSize,
                pagingOptions);

            collection.OpeningsQuery = FormMetadata.FromResource <Opening>(
                Link.ToForm(
                    nameof(GetAllRoomOpenings),
                    null,
                    Link.GetMethod,
                    Form.QueryRelation));


            return(collection);
        }
Example #29
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="FormID"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        public IOperationResult SubmitBill(Context ctx, string FormID, object[] ids)
        {
            IMetaDataService metaService  = ServiceHelper.GetService <IMetaDataService>(); //元数据服务
            FormMetadata     Meta         = metaService.Load(ctx, FormID) as FormMetadata; //获取元数据
            OperateOption    submitOption = OperateOption.Create();
            IOperationResult submitResult = BusinessDataServiceHelper.Submit(ctx, Meta.BusinessInfo, ids, "Submit", submitOption);

            return(submitResult);

            //IMetaDataService metaService = ServiceHelper.GetService<IMetaDataService>();
            //FormMetadata targetBillMeta = metaService.Load(ctx, FormID) as FormMetadata;
            //// 构建保存操作参数:设置操作选项值,忽略交互提示
            //OperateOption submitOption = OperateOption.Create();
            //// 忽略全部需要交互性质的提示,直接保存;
            ////saveOption.SetIgnoreWarning(true);              // 忽略交互提示
            ////saveOption.SetInteractionFlag(this.Option.GetInteractionFlag());        // 如果有交互,传入用户选择的交互结果
            //// using Kingdee.BOS.Core.Interaction;
            ////saveOption.SetIgnoreInteractionFlag(this.Option.GetIgnoreInteractionFlag());
            ////// 如下代码,强制要求忽略交互提示(演示案例不需要,注释掉)
            //submitOption.SetIgnoreWarning(true);
            ////// using Kingdee.BOS.Core.Interaction;
            //submitOption.SetIgnoreInteractionFlag(true);
            //// 调用保存服务,自动保存
            //ISubmitService submitService = ServiceHelper.GetService<ISubmitService>();
            //IOperationResult submitResult = submitService.Submit(ctx, targetBillMeta.BusinessInfo, ids, "Submit", submitOption);
            //return submitResult;
        }
Example #30
0
        /// <summary>
        /// 操作执行后逻辑处理
        /// </summary>
        /// <param name="e"></param>
        public override void EndOperationTransaction(Kingdee.BOS.Core.DynamicForm.PlugIn.Args.EndOperationTransactionArgs e)
        {
            var         billGroups   = e.DataEntitys.GroupBy(o => Convert.ToString(o["BillTypeId_Id"]));
            List <long> lstNewMtrlId = new List <long>();
            List <long> lstNewBomId  = new List <long>();

            foreach (var billGroup in billGroups)
            {
                var billTypeParaObj = AppServiceContext.GetService <ISysProfileService>().LoadBillTypeParameter(this.Context, this.BusinessInfo.GetForm().Id, billGroup.Key);
                if (billTypeParaObj == null)
                {
                    continue;
                }

                bool bSupportNoMtrlQuote = Convert.ToBoolean(billTypeParaObj["F_JN_NoMtrlIdQuotation"]);

                if (bSupportNoMtrlQuote)
                {
                    ExtendedDataEntitySet dataEntitySet = new ExtendedDataEntitySet();
                    dataEntitySet.Parse(billGroup.ToArray(), this.BusinessInfo);

                    var quoteEntryRows = dataEntitySet.FindByEntityKey("FQUOTATIONENTRY")
                                         .Where(o => !o["F_JN_ProductName"].IsEmptyPrimaryKey())
                                         .ToArray();
                    if (quoteEntryRows.Any() == false)
                    {
                        continue;
                    }

                    lstNewMtrlId.AddRange(quoteEntryRows.Select(o => (long)o["MaterialId_Id"])
                                          .Distinct()
                                          .Where(o => o > 0));
                    lstNewBomId.AddRange(quoteEntryRows.Select(o => (long)o["BomId_Id"])
                                         .Distinct()
                                         .Where(o => o > 0));
                }
            }

            //反禁用关联的物料及物料清单
            OperateOption mtrlOption = OperateOption.Create();

            mtrlOption.SetVariableValue("IsList", true);
            FormMetadata mtrlMetadata = AppServiceContext.MetadataService.Load(this.Context, "BD_MATERIAL") as FormMetadata;
            var          mtrlOpRet    = AppServiceContext.SetStatusService.SetBillStatus(this.Context, mtrlMetadata.BusinessInfo,
                                                                                         lstNewMtrlId.Select(o => new KeyValuePair <object, object>(o, null)).ToList(),
                                                                                         null, "Enable", mtrlOption);

            this.OperationResult.MergeResult(mtrlOpRet);

            OperateOption bomOption = OperateOption.Create();

            bomOption.SetVariableValue("IsList", true);
            FormMetadata bomMetadata = AppServiceContext.MetadataService.Load(this.Context, "ENG_BOM") as FormMetadata;
            var          bomOpRet    = AppServiceContext.SetStatusService.SetBillStatus(this.Context, bomMetadata.BusinessInfo,
                                                                                        lstNewBomId.Select(o => new KeyValuePair <object, object>(o, null)).ToList(),
                                                                                        null, "Enable", bomOption);

            this.OperationResult.MergeResult(bomOpRet);
        }