Beispiel #1
0
        public void reviseItem(ModelObject obj) //throws ServiceException
        {
            DataManagementService dmService = DataManagementService.getService(Session.getConnection());
            ReviseInfo            rev       = new ReviseInfo();

            rev.BaseItemRevision = new ItemRevision(null, obj.Uid);
            rev.ClientId         = "Maxtt_Test" + "--" + "01";
            rev.Description      = "describe testRevise";
            rev.Name             = "testRevise";
            rev.NewRevId         = "01";

            //额外的表单属性
            PropertyNameValueInfo info = new PropertyNameValueInfo();

            info.PropertyName   = "object_desc";
            info.PropertyValues = new string[] { "newid1" };

            rev.NewItemRevisionMasterProperties.PropertyValueInfo = new PropertyNameValueInfo[] { info };
            //rev.NewItemRevisionMasterProperties.Form = new Teamcenter.Soa.Client.Model.Strong.Form(null, obj.Uid);

            // *****************************
            // Execute the service operation
            // *****************************
            ReviseResponse2 revised = dmService.Revise2(new ReviseInfo[] { rev });

            // before control is returned the ChangedHandler will be called with
            // newly created Item and ItemRevisions



            // The AppXPartialErrorListener is logging the partial errors returned
            // In this simple example if any partial errors occur we will throw a

            // ServiceException
            if (revised.ServiceData.sizeOfPartialErrors() > 0)
            {
                throw new ServiceException("DataManagementService.revise returned a partial error.");
            }
        }
Beispiel #2
0
        public void reviseItem(ModelObject obj, String Name, String longDetail, String productionType, String item_revision_id) //throws ServiceException
        {
            String newVersionNumber = (int.Parse(item_revision_id) + 1).ToString().PadLeft(2, '0');

            DataManagementService dmService = DataManagementService.getService(Session2.getConnection());



            ReviseInfo rev = new ReviseInfo();

            rev.BaseItemRevision = new ItemRevision(null, obj.Uid);
            rev.ClientId         = Name + "/" + newVersionNumber;
            rev.Description      = "";
            rev.Name             = Name;
            rev.NewRevId         = newVersionNumber;

            //额外的表单属性
            PropertyNameValueInfo info = new PropertyNameValueInfo();

            info.PropertyName   = cfg.get("exAttr_productionType");
            info.PropertyValues = new string[] { productionType };

            PropertyNameValueInfo info2 = new PropertyNameValueInfo();

            info2.PropertyName   = cfg.get("exAttr_detail");
            info2.PropertyValues = new string[] { longDetail };


            rev.NewItemRevisionMasterProperties.PropertyValueInfo = new PropertyNameValueInfo[] { info, info2 };

            // *****************************
            ReviseResponse2 revised = dmService.Revise2(new ReviseInfo[] { rev });

            if (revised.ServiceData.sizeOfPartialErrors() > 0)
            {
                throw new ServiceException("DataManagementService.revise returned a partial error." + revised.ServiceData.GetPartialError(0).Messages[0]);
            }
        }