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(); }
internal void RunFence(string fence) { if (!base.isInTrans) base.dbParam.Open(); QRItem qritem = new QRItem(base.dbParam); var all = new List<string>(); var fenceMaster = qritem.GetItemMaster(fence, "FENCE", userOid); var fenceItem = qritem.GetBizItem(fenceMaster.Oid, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem) as DEBusinessItem; var number = fenceItem.GetAttrValue("I", "TZZS"); var comment = fenceItem.GetAttrValue("I", "PROJECTNAME"); var heziList = qritem.GetLinkRelations(fenceItem.IterOid, "FENCE", "PARTTOPART", userOid); foreach (DERelation2 hezirel in heziList) { var order = hezirel.GetAttrValue("ORDER"); var heziItem = qritem.GetBizItem(hezirel.RightObj, 0, 0, Guid.Empty, userOid, BizItemMode.BizItem) as DEBusinessItem; var content = heziItem.GetAttrValue("I", "WGTQD") as byte[]; //draws.AddRange(PassWGTQD(Encoding.UTF8.GetString(content))); var draws = PassWGTQD(Encoding.UTF8.GetString(content)); all.AddRange(draws); Run(heziItem.Id, draws, Convert.ToInt32(number), (string)comment, Convert.ToInt32(order).ToString()); //break; } Run(fenceItem.Id + "(PLT)", all, Convert.ToInt32(number), (string)comment, "PLT"); if (!base.isInTrans) dbParam.Commit(); if (!base.isInTrans) dbParam.Close(); }