Esempio n. 1
0
        private void ApplyNameToItem()
        {
            Item item = itemSlot.Item;

            if (!item.IsAir && itemSlot.Valid(item))
            {
                PRItem petItem = item.GetGlobalItem <PRItem>();
                petItem.petName  = commandInput.currentString;
                petItem.petOwner = Main.LocalPlayer.name;
                Main.PlaySound(SoundID.MenuTick);
            }
        }
Esempio n. 2
0
        public void Run(string box, List<string> draws, int number, string comment, string order)
        {
            box = box + ElecVersion;
            //if (!base.isInTrans) base.dbParam.Open();
            QRItem qritem = new QRItem(base.dbParam);
            PRItem pritem = new PRItem(base.dbParam);
            var meifen = 0;
            DEItemMaster2 dossmasterIterOid;
            dossmasterIterOid = qritem.GetItemMaster(box, "DQDOSSIERPRINT", userOid);
            DEBusinessItem dossmaster;
            if (dossmasterIterOid == null)
                dossmaster = CreateDossier(Guid.NewGuid(), box, comment, order);
            else
            {
                if (dossmasterIterOid.State == ItemState.Release)
                {
                    pritem.NewRelease(dossmasterIterOid.Oid, "DQDOSSIERPRINT", null, userOid, true);

                }
                else if (dossmasterIterOid.State == ItemState.CheckIn)
                {
                    pritem.CheckOut(dossmasterIterOid.Oid, "DQDOSSIERPRINT", userOid, true);
                }
                dossmaster = qritem.GetBizItem(dossmasterIterOid.Oid, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem) as DEBusinessItem;
                dossmaster = qritem.GetBizItem(dossmasterIterOid.Oid, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem) as DEBusinessItem;
                dossmaster.Iteration.SetAttrValue("TSSTATUS", "未发打印");
                dossmaster.Iteration.SetAttrValue("TWDMC", "外供图");
                dossmaster.Iteration.SetAttrValue("WKFLINFO", comment + "(" + order + ")");
                dossmaster.Iteration.SetAttrValue("DOCCODE", box);
                dossmaster.Iteration.SetAttrValue("YCT", "其它");
                dossmaster.Iteration.SetAttrValue("NAME", "外供图:" + box);
                dossmaster.Iteration.SetAttrValue("ZDHQMXBYDOC", false);
                dossmaster.Iteration.SetAttrValue("ZDHQMX", false);
                dossmaster.Iteration.SetAttrValue("CJLXMX", false);
                dossmaster.Iteration.SetAttrValue("YQWCSJ", DateTime.Now.AddDays(1));
            }
            dossmasterIterOid = qritem.GetItemMaster(box, "DQDOSSIERPRINT", userOid);
            var masteritem = qritem.GetBizItem(dossmasterIterOid.Oid, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem) as DEBusinessItem;
            var itpLinkList = qritem.GetLinkRelations(masteritem.IterOid, "DQDOSSIERPRINT", "DOSSIRPRINTTODOC", userOid);
            foreach (DERelation2 r in itpLinkList)
            {
                itpLinkList.DeleteLinkRelation(r.RightObj);
            }
            foreach (var draw in draws)
            {
                var drawid = DWGMaster.GetMasterId(draw);
                if (drawid == Guid.Empty) continue;
                IBizItem itemalq = qritem.GetBizItem(drawid, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem);
                var mtzs = Convert.ToInt32(itemalq.GetAttrValue("I", "GZ"));
                if (mtzs < 1) mtzs = 1;
                meifen += mtzs;

                //var itpPartRel = itpLinkList.GetLinkRelation(draw);
                var rel = itpLinkList.GetLinkRelation(itemalq.MasterOid);
                if (rel != null)
                {
                    itpLinkList.DeleteLinkRelation(itemalq.MasterOid);
                }

                var relation = new DERelation2(masteritem.IterOid, "DQDOSSIERPRINT", drawid, itemalq.ClassName, 0,
                              "system", Guid.Empty, "DOSSIRPRINTTODOC");
                relation.SetAttrValue("DOCCODE", draw);
                relation.SetAttrValue("DOCNAME", itemalq.Name);
                relation.SetAttrValue("FS", number);
                relation.SetAttrValue("JSDW", "21储运中心(" + number + ")");
                relation.SetAttrValue("MTZS", mtzs);
                relation.SetAttrValue("ZS", number * mtzs);
                relation.SetAttrValue("DOCREV", itemalq.RevLabel);
                //relation.SetAttrValue("", "");
                itpLinkList.AddLinkRelation(relation
                         );
            }
            pritem.UpdateLinkRelationsDirectly(masteritem.MasterOid, itpLinkList, userOid, null);
            dossmaster.Iteration.SetAttrValue("MTZS", meifen);
            dossmaster.Iteration.SetAttrValue("FS", number);
            dossmaster.Iteration.SetAttrValue("ZS", meifen * number);
            pritem.UpdateItemIteration(dossmaster.Iteration, userOid, null);
            //if (!base.isInTrans) dbParam.Commit();
            //if (!base.isInTrans) dbParam.Close();
        }
Esempio n. 3
0
        private DEBusinessItem CreateDossier(Guid dossId, string ID, string comment, string order)
        {

            var className = "DQDOSSIERPRINT";
            DEBusinessItem doc = new DEBusinessItem()
            {
                Master = new DEItemMaster2(),
                Iteration = new DEItemIteration2(),
                Revision = new DEItemRevision2()
            };

            doc.Master.Oid = dossId;
            doc.Master.Status = 'O';
            doc.Master.LastRevision = 1;
            doc.Master.Id = ID;
            doc.Master.ClassName = className;
            doc.Master.Holder = userOid;
            doc.Master.Phase = Guid.Empty;
            doc.Master.Susbended = false;
            doc.Master.SecurityLevel = 1;
            doc.Master.StartView = Guid.Empty;
            doc.Master.ViewModel = Guid.Empty;
            doc.Master.Group = Guid.Empty;

            doc.Revision.ClassName = className;
            doc.Revision.Oid = Guid.NewGuid();
            doc.Revision.MasterOid = doc.Master.Oid;
            doc.Revision.Revision = 1;
            doc.Revision.LastIteration = 1;
            doc.Revision.Creator = userOid;
            doc.Revision.CreateTime = DateTime.Now;
            doc.Revision.Releaser = userOid;
            doc.Revision.ReleaseTime = DateTime.Now;
            doc.Revision.ReleaseDesc = string.Empty;
            //doc.Revision.RevLabel = ;
            doc.Revision.State = 'A';

            doc.Iteration.ClassName = className;
            doc.Iteration.Oid = Guid.NewGuid();
            doc.Iteration.RevisionOid = doc.Revision.Oid;
            //doc.Iteration.Name = ITP;
            doc.Iteration.Iteration = 1;
            doc.Iteration.Creator = userOid;
            doc.Iteration.CreateTime = DateTime.Now;
            doc.Iteration.CheckInTime = DateTime.Now;
            doc.Iteration.CheckInDesc = string.Empty;
            doc.Iteration.LatestUpdator = userOid;
            doc.Iteration.LatestUpdateTime = DateTime.Now;
            doc.Iteration.SetAttrValue("FTLX", "全套产品图");
            doc.Iteration.SetAttrValue("TSSTATUS", "未发打印");
            doc.Iteration.SetAttrValue("TSTYPE", "随机");
            //doc.Iteration.SetAttrValue("ORGPRINTER", "谢晓霞");
            //doc.Iteration.SetAttrValue("ORGPRINTER", "曾志筠");

            if (ElecVersion == "-电子版") doc.Iteration.SetAttrValue("ORGPRINTER", "王凡");
            else
                if (userPrint.ContainsKey(usernmame))
                    doc.Iteration.SetAttrValue("ORGPRINTER", userPrint[usernmame]);
                else
                    doc.Iteration.SetAttrValue("ORGPRINTER", "邓文斌");

            doc.Iteration.SetAttrValue("TWDMC", "外供图");
            doc.Iteration.SetAttrValue("WKFLINFO", comment /*+ "(" + order + ")"*/);
            doc.Iteration.SetAttrValue("DOCCODE", ID);
            doc.Iteration.SetAttrValue("YCT", "其它");
            //doc.Iteration.SetAttrValue("NAME", "外供图:" + comment + "(" + order + ")");
            doc.Iteration.SetAttrValue("NAME", "外供图:" + ID);

            doc.Iteration.SetAttrValue("ZDHQMXBYDOC", false);
            doc.Iteration.SetAttrValue("ZDHQMX", false);
            doc.Iteration.SetAttrValue("CJLXMX", false);

            PRItem item = new PRItem(base.dbParam);
            var re = item.CreateItem(doc, string.Empty, userOid);
            //设置文档名称
            //re.Iteration.SetAttrValue("", "");
            //item.UpdateItemIteration(re
            //item.CheckIn(dossId, className, userOid, string.Empty);
            //item.Release(itpId, className, userOid, string.Empty, true);
            return re;
        }
Esempio n. 4
0
        public override void OnInitialize()
        {
            Width.Pixels  = width;
            Height.Pixels = height;
            Top.Pixels    = int.MaxValue / 2;
            Left.Pixels   = int.MaxValue / 2;

            float nextElementY = -PaddingTop / 2;

            titleText = new UIText("Rename Pet")
            {
                Top    = { Pixels = nextElementY },
                HAlign = 0.5f
            };
            Append(titleText);

            nextElementY += 20;
            string name = string.Empty;

            itemSlot = new VanillaItemSlotWrapper(ItemSlot.Context.BankItem, 1f)
            {
                Left          = { Pixels = 0f },
                Top           = { Pixels = nextElementY },
                HAlign        = 0.5f,
                ValidItemFunc = item => item.IsAir || PetRenamer.IsPetItem(item)
            };
            itemSlot.OnEmptyMouseover += (timer) =>
            {
                Main.hoverItemName = "Place a pet summoning item here";
                if (timer > 60)
                {
                    Main.hoverItemName = "1. Place a pet summoning item here"
                                         + "\n2. Type a name into the text box"
                                         + "\n2. (optional) Press 'Clear' to delete the text"
                                         + "\n2. (optional) Press 'Random' for a random name"
                                         + "\n3. Press 'Apply' to set the text from the text box as the name for the pet"
                                         + "\n3. (optional) Take out the item"
                                         + "\n4. Press 'X' to close. Item will be returned to you if it's still in the UI"
                                         + "\nNote: If you leave the UI with the item in it open and close the game, it will appear again next time you play";
                }
                else if (timer > 3600)
                {
                    Main.hoverItemName = "Santa isn't real";
                }
            };
            Append(itemSlot);

            nextElementY += 49 + 6;             //49 is the size of an item slot, 6 is for visual gap

            Item uiItem    = Main.mouseItem;
            bool skipCheck = false;

            Item renamePetUIItem = Main.LocalPlayer.GetModPlayer <PRPlayer>().renamePetUIItem;

            if (!renamePetUIItem.IsAir)
            {
                skipCheck = true;
                uiItem    = renamePetUIItem;
            }

            if (skipCheck || !uiItem.IsAir && itemSlot.Valid(uiItem))
            {
                if (uiItem.type != ModContent.ItemType <MysteryItem>())
                {
                    PRItem petItem = uiItem.GetGlobalItem <PRItem>();
                    name = petItem.petName;
                }
                itemSlot.Item = uiItem.Clone();
                uiItem.TurnToAir();                 //The previous item reference (mouse item or saved item) gets cleared
            }

            commandInput = new UIBetterTextBox("Enter Name Here", name)
            {
                BackgroundColor = Color.White,
                Top             = { Pixels = nextElementY },
                Width           = { Precent = 1f },
                Height          = { Pixels = 30f }
            };
            if (!itemSlot.Item.IsAir)
            {
                commandInput.Focus();
            }
            Append(commandInput);

            nextElementY += 36;

            float ratioFromCenter = 0.22f;

            applyButton = new UIPanel()
            {
                Top             = { Pixels = nextElementY },
                Width           = { Pixels = 60f },
                Height          = { Pixels = 30f },
                HAlign          = 0.5f - ratioFromCenter,
                BackgroundColor = bgColor
            };
            applyButton.OnClick += (evt, element) => { ApplyNameToItem(); };

            UIText applyButonText = new UIText("Apply")
            {
                Top  = { Pixels = -4f },
                Left = { Pixels = -2f }
            };

            applyButton.Append(applyButonText);
            Append(applyButton);

            randomizeButton = new UIPanel()
            {
                Top             = { Pixels = nextElementY },
                Width           = { Pixels = 82f },
                Height          = { Pixels = 30f },
                HAlign          = 0.5f,
                BackgroundColor = bgColor
            };
            randomizeButton.OnClick += (evt, element) => { RandomizeText(); };

            UIText randomizeButtonText = new UIText("Random")
            {
                Top  = { Pixels = -4f },
                Left = { Pixels = -2f }
            };

            randomizeButton.Append(randomizeButtonText);
            Append(randomizeButton);

            clearButton = new UIPanel()
            {
                Top             = { Pixels = nextElementY },
                Width           = { Pixels = 60f },
                Height          = { Pixels = 30f },
                HAlign          = 0.5f + ratioFromCenter,
                BackgroundColor = bgColor
            };
            clearButton.OnClick += (evt, element) => { ClearTextField(); };

            UIText clearButtonText = new UIText("Clear")
            {
                Top  = { Pixels = -4f },
                Left = { Pixels = -2f }
            };

            clearButton.Append(clearButtonText);
            Append(clearButton);

            UIQuitButton quitButton = new UIQuitButton("Close");

            //Using initializer pattern here didn't work for some reason with the Width
            quitButton.Top.Pixels  = -PaddingTop / 2;
            quitButton.Left.Pixels = width - PaddingRight - quitButton.Width.Pixels - 8;
            quitButton.OnClick    += (evt, element) => { PetRenamer.CloseRenamePetUI(); };
            Append(quitButton);
        }