private static bool readModel(string dir = null, string FileName = "TSmatchINFO.xlsx") { Log.set("readModel(" + dir + ", " + FileName + ")"); bool ok = false; //!! Docs.setDocTemplate(Decl.TEMPL_TMP, dir); Docs tmp = Docs.getDoc(Decl.TMP_RAW); Docs tmpINFO = Docs.getDoc(Decl.TMP_MODELINFO); //!! List<TS.AttSet> diff = new List<TS.AttSet>(); throw new NotImplementedException(); //!!!!!!!!!!!!!!!!!!!!!!!!!!! //!! elm = diff; //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Log.exit(); return(ok); }
private void getSavedGroups() { docReport = Docs.getDoc(Decl.TSMATCHINFO_REPORT); // 9/4/17 для отладки пока берем группы прямо из Tekla Read(); getGroups(); //////////////elmGroups.Clear(); //////////////int grCount = docReport.Body.iEOL() - docReport.i0; //9/4/17//////for (int i = docReport.i0; i < grCount; i++) //////////////{ ////////////// elmGroups.Add() ////////////// string mat = docReport.Body.Strng(i, 2); ////////////// string prf = docReport.Body.Strng(i, 3); ////////////// string totalPrice = docReport.Body.Strng(i, 11); //////////////} }
/// <summary> /// saveModel(Model md) - записываем измененную модель в файловую систему /// </summary> /// <param name="name">имя модели для записи.</param> /// <history>6.8.16 -- nonstatic method</history> public Model saveModel(string name) { Log.set("saveModel(\"" + name + "\")"); Docs doc = Docs.getDoc(Decl.MODELS); doc.Reset("Now"); Models.Sort(); foreach (var m in Models) { string t = Lib.timeStr(m.date); doc.wrDoc(1, t, m.name, m.dir, m.Made, m.Phase, m.MD5, m.strListRules); } doc.isChanged = true; Docs.saveDoc(doc); Log.exit(); return(getModel(name)); }
public bool getSavedReport(bool doRead = false) { //9/4 getModelInfo(); Docs doc = Docs.getDoc(Decl.TSMATCHINFO_MODELINFO); if (isChangedStr(name, doc, 2, 2)) { return(false); } date = Lib.getDateTime(doc.Body.Strng(5, 2)); if (doRead) { Read(); Handler(); Report(); } getSavedGroups(); return(true); }
public static Model RecentModel() { string date = "1.1.52"; int iMod = 0; Docs doc = Docs.getDoc(Decl.MODELS); for (int i = doc.i0; i <= doc.il; i++) { if (doc.Body[i, Decl.MODEL_NAME] != null) { string modDate = doc.Body.Strng(i, Decl.MODEL_DATE); if (Lib.getDateTime(modDate) > Lib.getDateTime(date)) { date = modDate; iMod = i; } } } return(new Model(iMod, doInit: false)); }
//-- get cs doc from TOC by cs_name and Supplier in TSmatch.xlsx/Rule private Docs getCSdoc(Supl supplier, string _name) { string docName = string.Empty; Docs toc = Docs.getDoc(); for (int i = toc.i0; i <= toc.il; i++) { string suplName = toc.Body.Strng(i, Decl.DOC_SUPPLIER); string csSheet = toc.Body.Strng(i, Decl.DOC_SHEET); if (suplName != Supplier.name || csSheet != name) { continue; } docName = toc.Body.Strng(i, Decl.DOC_NAME); break; } if (string.IsNullOrEmpty(docName)) { Msg.F("CompSet not found price list"); } return(Docs.getDoc(docName)); }
/// <summary> /// Model.Start() - начинает работу со списком моделей, инициализирует структуры данных /// </summary> /// <returns></returns> /// <history>12.2.2016<\history> public static List <Model> Start() { Log.set("Model.Start"); Models.Clear(); Docs doc = Docs.getDoc(Decl.MODELS); for (int i = doc.i0; i <= doc.il; i++) { if (doc.Body[i, Decl.MODEL_NAME] != null) { Models.Add(new Model(doc, i)); } } List <string> strLst = new List <string>(); foreach (var m in Models) { strLst.Add(m.name); } strLst.Sort(); Log.exit(); return(Models); }
public void wrModel(string doc_name) { Log.set("Model.wrModel(" + doc_name + ")"); DateTime t0 = DateTime.Now; Docs doc = Docs.getDoc(doc_name); switch (doc_name) { case WR_MODEL_INFO: // общая информация о модели: имя, директория, MD5 и др doc.wrDocSetForm("HDR_ModelINFO", 1, AutoFit: true); doc.wrDocForm(name, dir, "фаза?", date, MD5, Elm.Elements.Count); break; case WR_MODEL_RAW: // элементы с атрибутами, как они прочитаны из модели doc.wrDocSetForm("FORM_RawLine", 2, AutoFit: true); foreach (var elm in elements) { double w = elm.weight; // elm.weight - weight [kg]; double v = elm.volume; // / 1000 / 1000 / 1000; // elm.volume [mm3] -> [m3] doc.wrDocForm(elm.guid, elm.mat, elm.mat_type, elm.prf, elm.length, w, v); } break; case WR_MODEL_MATERIALS: // сводка по материалам, их типам (бетон, сталь и др) doc.wrDocSetForm("FORM_Materials", 3, AutoFit: true); foreach (var mGr in elmMgroups) { doc.wrDocForm(mGr.mat, mGr.totalVolume, mGr.totalWeight, mGr.totalPrice); } break; case WR_MODEL_SUPPLIERS: // сводка по поставщикам проекта (контакты, URL прайс-листа, закупки) doc.wrDocSetForm("FORM_ModSupplierLine", 4, AutoFit: true); foreach (var s in Suppliers) { doc.wrDocForm(s.name, s.Url, s.City, s.index, s.street, s.telephone); } break; case WR_MODEL_RULES: // перечень Правил, используемых для обработки модели doc.wrDocSetForm("HDR_ModRules", 1, AutoFit: true); doc.wrDocForm(strListRules); doc.wrDocSetForm("FORM_ModRuleLine"); foreach (var rule in Rules) { doc.wrDocForm(rule.Supplier.name, rule.CompSet.name, rule.text); } break; case WR_MODEL_REPORT: // отчет по сопоставлению групп <материал, профиль> c прайс-листами поставщиков doc.wrDocSetForm("FORM_Report", AutoFit: true); int n = 1; foreach (var gr in elmGroups) { string foundDescr = ""; if (gr.match != null && gr.match.ok == Mtch.OK.Match) { foundDescr = gr.match.component.Str(SType.Description); } doc.wrDocForm(n++, gr.mat, gr.prf , gr.totalLength, gr.totalWeight, gr.totalVolume , foundDescr, 0, 0, 0, gr.totalPrice); } //--- string - Summary double sumWgh = 0, sumPrice = 0; int iGr = doc.i0; foreach (var gr in elmGroups) { double?w = doc.Body.Double(iGr, Decl.REPORT_SUPL_WGT); double?p = doc.Body.Double(iGr++, Decl.REPORT_SUPL_PRICE); sumWgh += (w == null) ? 0 : (double)w; sumPrice += (p == null) ? 0 : (double)p; } doc.wrDocSetForm("FORM_Report_Sum", AutoFit: true); doc.wrDocForm(sumWgh, sumPrice); break; } doc.isChanged = true; doc.saveDoc(); log.Info("Время записи в файл \"" + doc_name + "\"\t t= " + (DateTime.Now - t0).ToString() + " сек"); Log.exit(); }
public Model(int i, bool doInit = true) : this(Docs.getDoc(Decl.MODELS), i, doInit) { }