public LabelCallLine(CodeLine codeLine, LabelLine labelLine) : base(codeLine.Code, codeLine, codeLine.Strings) { base.Comment = codeLine.Comment; base.Raw = codeLine.Raw; LabelLine = labelLine; }
public LabelLine LabelLine() { if (labelLine == null) { labelLine = new LabelLine(); } return(labelLine); }
public void Visit(LabelLine line) { if (line.Head[0] != '_') { current_function = line.Label; size = annotation.FunctionVarsSize[current_function]; } Code.Add($"\n"); Code.Add($"{line.Label}:"); Code.Add($"li $t9, 0"); }
public LabelCallLine(CodeLine codeLine, LabelLine labelLine) : base(codeLine.Code, codeLine, codeLine.Strings) { LabelLine = labelLine; }
public CallLabel(LabelLine method, int result_variable = -1) { Method = method; Result = result_variable; }
public void Visit(ClassNode node) { string cclass; cclass = VariableManager.CurrentClass = node.TypeClass.Text; IC.Add(new InheritLine(node.TypeClass.Text, Scope.GetType(node.TypeClass.Text).Parent.Text)); //VirtualTable.DefineClass(VariableManager.CurrentClass); int self = VariableManager.VariableCounter = 0; VariableManager.IncrementVariableCounter(); VariableManager.PushVariableCounter(); List <AttributeNode> attributes = new List <AttributeNode>(); List <MethodNode> methods = new List <MethodNode>(); foreach (var f in node.FeatureNodes) { if (f is AttributeNode) { attributes.Add((AttributeNode)f); } else { methods.Add((MethodNode)f); } } foreach (var method in methods) { method.Accept(this); } //begin constructor function IC.Add(new LabelLine(VariableManager.CurrentClass, "constructor")); IC.Add(new ParamLine(self)); //calling first the parent constructor method if (VariableManager.CurrentClass != "Object") { IC.Add(new PushParamLine(self)); LabelLine label = new LabelLine(node.TypeInherit.Text, "constructor"); IC.Add(new CallLabelLine(label)); IC.Add(new PopParamLine(1)); } foreach (var method in methods) { (string, string)label = VirtualTable.GetDefinition(node.TypeClass.Text, method.Id.Text); IC.Add(new CommentLine("set method: " + label.Item1 + "." + label.Item2)); IC.Add(new AssignmentLabelToMemoryLine(self, new LabelLine(label.Item1, label.Item2), VirtualTable.GetOffset(node.TypeClass.Text, method.Id.Text))); //IntermediateCode.Add(new AssignmentVariableToMemoryLine(self, VariableManager.VariableCounter, IntermediateCode.GetVirtualTableOffset(node.TypeClass.Text, attr.Formal.Id.Text))); } foreach (var attr in attributes) { VariableManager.PushVariableCounter(); attr.Accept(this); VariableManager.PopVariableCounter(); IC.Add(new CommentLine("set attribute: " + attr.Formal.Id.Text)); IC.Add(new AssignmentVariableToMemoryLine(self, VariableManager.PeekVariableCounter(), VirtualTable.GetOffset(node.TypeClass.Text, attr.Formal.Id.Text))); } IC.Add(new CommentLine("set class name: " + node.TypeClass.Text)); IC.Add(new AssignmentStringToMemoryLine(0, node.TypeClass.Text, 0)); IC.Add(new CommentLine("set class size: " + VirtualTable.GetSizeClass(node.TypeClass.Text) + " words")); IC.Add(new AssignmentConstantToMemoryLine(0, VirtualTable.GetSizeClass(node.TypeClass.Text), 1)); IC.Add(new CommentLine("set class generation label")); IC.Add(new AssignmentLabelToMemoryLine(0, new LabelLine("_class", node.TypeClass.Text), 2)); IC.Add(new ReturnLine(-1)); VariableManager.PopVariableCounter(); }
/// <summary> /// Cleans up the rows in an equity report, processing labels, and /// removing unused periods. /// </summary> /// <param name="dateFormat">The date format with which to process /// labels on the equity rows.</param> /// <param name="membersXDoc">An XML document containing the members /// within the report.</param> public void CleanupEquityRows(string dateFormat, XmlDocument membersXDoc) { //SOI creates new rows for every instant calendar too - but we only want the durations this.EquityCandidate.Rows.RemoveAll(row => row.EmbedRequirements.Period.PeriodType == Element.PeriodType.instant); //transfer the balance flags foreach (InstanceReportRow row in this.EquityCandidate.Rows) { row.Labels.Clear(); foreach (LabelLine ll in row.EmbedRequirements.ElementRow.Labels) { LabelLine copy = (LabelLine)ll.Clone(); row.Labels.Add(copy); } if (row.EmbedRequirements.IsAdjusted(membersXDoc)) { row.IsEquityAdjustmentRow = true; } if (row.EmbedRequirements.IsAsPreviouslyReported(membersXDoc)) { row.IsEquityPrevioslyReportedAsRow = true; } //=======================Do not update abstracts with dates or labels=================== if (row.IsAbstractGroupTitle) { continue; } if (row.IsBeginningBalance || row.IsEndingBalance || row.IsEquityAdjustmentRow || row.IsEquityPrevioslyReportedAsRow) { row.IsCalendarTitle = true; //apply the balance date... row.ApplyBalanceDate(); //but only show it for the non-adjustments if (!row.IsEquityAdjustmentRow) { row.ApplyBalanceDateLabel(dateFormat); } if (row.EmbedRequirements.Segments == null) { continue; } foreach (Segment seg in row.EmbedRequirements.Segments) { if (seg.IsDefaultForEntity) { continue; } row.ApplySpecialLabel(seg); } } } }
/// <summary> /// 数据初始化 /// </summary> /// <param name="dr">单条数据</param> /// <param name="tags">是否有批次信息</param> /// <param name="lineshow">数据下的分割线是否显示</param> /// <param name="bottomline">药品中的包括线是否显示</param> public void SetInfo(DataRow dr, bool tags, bool lineshow, bool bottomline, bool all, string premode, int batchsave, bool refresh) { // MessageBox.Show(this.Size.ToString()); //this.pvb=pvb; this.premode = premode; this.refresh = refresh; try { if (tags) { //批次 Label_Batch.Text = dr["Batch"].ToString(); //批次颜色(根据数据库中的OrderColor表) Label_Batch.BackColor = System.Drawing.ColorTranslator.FromHtml(dr["OrderColor"].ToString()); Label_Batch.ForeColor = System.Drawing.ColorTranslator.FromHtml(dr["TColor"].ToString()); //是否发送或者是否打印 //***********张建双2014-07-18********************// try { if (dr["IVStatus"].ToString() == "已打印" && batchsave == 0) { batchsaved = false; Label_BatchSaved.Text = "已打印"; Label_BatchSaved.ForeColor = Color.White; Label_BatchSaved.BackColor = Color.Gray; } else if (dr["BatchSaved"].ToString() == "已发送" && batchsave == 0) { batchsaved = true; Label_BatchSaved.Text = "已发送"; Label_BatchSaved.ForeColor = Color.White; Label_BatchSaved.BackColor = Color.Gray; } else if (dr["IVStatus"].ToString() == "已打印") { batchsaved = false; Label_BatchSaved.Text = "已打印"; } else if (dr["BatchSaved"].ToString() == "已发送") { batchsaved = true; Label_BatchSaved.Text = "已发送"; } else { batchsaved = false; Label_BatchSaved.Text = "未发送"; } } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10023:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } //***********张建双2014-07-18********************// //if (dr["IVStatus"].ToString() == "已打印") || dr["BatchSaved"].ToString() == "已发送") //{ // batchsaved = true; // if (dr["BatchSaved"].ToString() == "已发送") // { // Label_BatchSaved.Text = dr["IVStatus"].ToString(); // } // else // { // Label_BatchSaved.Text = dr["BatchSaved"].ToString(); // } //} //else //{ // batchsaved = false; // Label_BatchSaved.Text = "已打印"; //} try { //频次 Label_FreqName.Text = dr["FreqName"].ToString(); //药品名 Panel_DrugInfo_DrugName.Text = dr["DrugName"].ToString(); //药品名全 //this.toolTip1.SetToolTip(this.Panel_DrugInfo_DrugName, dr["DrugName"].ToString()); //剂量+剂量单位 if ((dr["Dosage"].ToString().Trim() == dr["Remark9"].ToString().Trim() && dr["DosageUnit"].ToString() == dr["CapacityUnit"].ToString()) || dr["Remark9"].ToString().Trim() == "0") { Panel_DrugInfo_DrugDosage.Text = dr["Dosage"].ToString() + dr["DosageUnit"].ToString(); } else { Panel_DrugInfo_DrugDosage.Text = dr["Dosage"].ToString() + dr["DosageUnit"].ToString().Trim() + "(" + dr["Remark9"].ToString().Trim() + dr["CapacityUnit"].ToString() + ")"; } } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10020:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } try { //规格 Panel_DrugInfo_DrugSpec.Text = dr["Spec"].ToString(); //批次规则 BatchRule = dr["BatchRule"].ToString(); //批次(纯数量) Teamter = dr["TeamNumber"].ToString(); //瓶签号 LabelNo = dr["LabelNo"].ToString(); Label_LabelNo.Text = LabelNo; //病人Code PetCode = dr["PatCode"].ToString(); //组号 Label_GroupNo.Text = dr["GroupNo"].ToString(); //接受时间 Label_InsertDt.Text = dr["InsertDT"].ToString(); //药品分割线 LabelLine.Parent = this; //匚 中的上面一横显示 Label_Linetop.Visible = true; //药品分割线置顶 LabelLine.BringToFront(); //用法 laUsageCode.Text = dr["UsageName"].ToString(); } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10021:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } } else { try { //匚 中的下面一横 Label_Linebottom.Visible = bottomline; //不显示重复信息(批次,频次,发送状态等) Panel_Batch.Controls.Clear(); //this.Controls.Remove(Panel_Batch); //药品 Panel_DrugInfo_DrugName.Text = dr["DrugName"].ToString().Trim(); //this.toolTip1.SetToolTip(this.Panel_DrugInfo_DrugName, dr["DrugName"].ToString().Trim()); Panel_DrugInfo_DrugDosage.Text = dr["Dosage"].ToString() + dr["DosageUnit"].ToString(); Panel_DrugInfo_DrugSpec.Text = dr["Spec"].ToString(); } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10022:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } } try { //如果是两个药品之间不显示分割线 if (!lineshow) { this.Controls.Remove(LabelLine); } else { LabelLine.Width = LabelLine.Width - 10; } //如果是一个药品的。匚 都显示 if (all) { Label_Linetop.Visible = true; Label_Linebottom.Visible = true; } } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10024:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } } catch (Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10008:" + ex.ToString() + " " + DateTime.Now.ToString() + "\r\n"); } ////定位 if (this.Width != 0 && this.Height != 0) { try { if (premode == "0") { if (this.Width > 524) { this.panel2.Visible = true; Panel_DrugInfo.Width = this.Width - (this.panel2.Width + Label_FreqName.Location.X + Label_FreqName.Width); Panel_DrugInfo.Location = new Point(Label_FreqName.Location.X + Label_FreqName.Width, Panel_DrugInfo.Location.Y); } else { this.panel2.Visible = false; Panel_DrugInfo.Width = this.Width - (Label_FreqName.Location.X + Label_FreqName.Width); Panel_DrugInfo.Location = new Point(Label_FreqName.Location.X + Label_FreqName.Width, Panel_DrugInfo.Location.Y); } } //else //{ // if (this.Width > 633) // { // Panel_DrugInfo.Width = this.Width - (laUsageCode.Location.X + laUsageCode.Width); // Panel_DrugInfo.Location = new Point(laUsageCode.Location.X + laUsageCode.Width, Panel_DrugInfo.Location.Y); // } // else // { // Panel_DrugInfo.Width = this.Width - (laUsageCode.Location.X + laUsageCode.Width); // Panel_DrugInfo.Location = new Point(laUsageCode.Location.X + laUsageCode.Width, Panel_DrugInfo.Location.Y); // } //} } catch (System.Exception ex) { File.AppendAllText(Application.StartupPath + "\\Log\\PivasBatchMX" + DateTime.Now.ToString("yyyyMMdd") + ".txt", "10002:" + ex.Message + " " + DateTime.Now.ToString() + "\r\n"); } } }
protected bool SaveImagesLabels(string[] labels, List <string> selectedFiles, int storeId) { Boolean isNewLabelExists = false; try { foreach (var label in labels) { if (label.ToInt() > 0) { foreach (var m in selectedFiles) { LabelLine labelLine = new LabelLine(); labelLine.ItemId = m.ToInt(); labelLine.ItemType = StoreConstants.Files; labelLine.LabelId = label.ToInt(); LabelLineRepository.Add(labelLine); } } else { var existingLabel = LabelRepository.GetLabelByName(label, storeId); int labelId = 0; if (existingLabel == null) { if (!String.IsNullOrEmpty(label)) { var newLabel = new Label(); newLabel.StoreId = storeId; newLabel.Name = label; newLabel.ParentId = 1; newLabel.State = true; newLabel.Ordering = 1; newLabel.CreatedDate = DateTime.Now; newLabel.UpdatedDate = DateTime.Now; LabelRepository.Add(newLabel); LabelRepository.Save(); labelId = newLabel.Id; } } else { labelId = existingLabel.Id; } if (labelId > 0) { isNewLabelExists = true; foreach (var m in selectedFiles) { var labelLine = new LabelLine(); labelLine.ItemId = m.ToInt(); labelLine.ItemType = StoreConstants.Files; labelLine.LabelId = labelId; LabelLineRepository.Add(labelLine); } } } } try { LabelLineRepository.Save(); } catch (Exception ex) { Logger.Error(ex, "Error is " + ex.StackTrace, storeId, labels); } } catch (Exception ex) { Logger.Error(ex, "Unable to save labels:" + ex.StackTrace); } return(isNewLabelExists); }