/// <summary> /// Serializes object into a string containing all of its public variables. /// </summary> /// <returns>Serialized object as a string.</returns> public override string Serialize() { var nextID = NextID?.ToString() ?? "-"; var outPort = OutPort?.ToString() ?? "-"; var outLabel = OutLabel?.ToString() ?? "-"; return($"{ID} {Action} {outLabel} {outPort} {nextID}"); }
public void Setup(OutPort Port, NodeInfoDialog NodeInfoDialog) { this.Port = Port; PortName.text = Port.Name; PortType.text = Port.TypesToString(); PortNameButton.onClick.AddListener(() => NodeInfoDialog.SelectDetailsModeFor(this)); }
/// <summary> /// Converts a whole NHLFE entry to a string; used in logs. /// </summary> /// <returns>Converted NHLFE entry to a string.</returns> public override string ToString() { var nextID = NextID?.ToString() ?? "-"; var outPort = OutPort?.ToString() ?? "-"; var outLabel = OutLabel?.ToString() ?? "-"; return($"{nameof(ID)}: {ID}, {nameof(Action)}: {Action}, {nameof(OutLabel)}: {outLabel}, {nameof(OutPort)}: {outPort}, {nameof(NextID)}: {nextID}"); }
/// <summary> /// Generates a hashcode of the entry. /// </summary> /// <returns>Generated hashcode.</returns> public override int GetHashCode() { unchecked { var hashCode = (DestAddress != null ? DestAddress.GetHashCode() : 0); hashCode = (hashCode * 397) ^ OutPort.GetHashCode(); return hashCode; } }
public void OnSubscribe(ISubscription subscription) { var publisher = subscription as TestPublisher; if (publisher != null) { UpstreamModule = publisher.Owner; UpstreamPort = publisher.Port; } }
private void GetPOutPortInfo() { _poutport = new OutPort(pindexno); _poutport.GetCustInfo(); int onesum = 0; int twosum = 0; int threesum = 0; Dictionary <string, Color> ciginfo = _poutport.GetCigInfo(ref onesum, ref twosum, ref threesum); labponesum.Text = onesum.ToString(); labptwosum.Text = twosum.ToString(); labpthreesum.Text = threesum.ToString(); labponetwosum.Text = (onesum + twosum).ToString(); labelX31.Text = _poutport["INDEXNO"]; foreach (Control control in this.panel4.Controls) { if (control is LabelX && control.Tag != null) { if (_poutport.ContainsKey(control.Tag.ToString())) { ((LabelX)control).Text = _poutport[control.Tag.ToString()]; } } } itemPanel2.BeginUpdate(); itemPanel2.Items.Clear(); foreach (var s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Key.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 14); if (s.Key.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = s.Value; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 225; labelItem.Height = 25; //labelItem.WordWrap = true; itemPanel2.Items.Add(labelItem); } itemPanel2.EndUpdate(); }
public override void Connect(int outPortNO, InPort inPort) { if (outPortNO == OutPortCount()) { OutPort outPort = new OutPort($"out{outPortNO}", this); OutPortList.Add(outPort); outPort.Bind(inPort); Results.Add(new Signal(outPort)); } else { base.Connect(outPortNO, inPort); } }
public void PortConnection() { var inPort = new InPort(); var outPort = new OutPort(); outPort.Connect(inPort); var rised = false; inPort.OnRecv += packet => rised = true; outPort.Transmitt(null); Assert.IsTrue(rised); }
/// <summary> /// Position the label and two ports relative to the icon. /// </summary> /// <param name="childchanged"></param> /// <remarks> /// When <see cref="P:Northwoods.Go.GoObject.Initializing" /> is true, this method does nothing. /// This method also does nothing if there is no <see cref="P:Northwoods.Go.GoSimpleNode.Icon" />. /// </remarks> public override void LayoutChildren(GoObject childchanged) { if (base.Initializing) { return; } GoObject icon = Icon; if (icon == null) { return; } if (Orientation == Orientation.Horizontal) { if (Label != null) { Label.SetSpotLocation(32, icon, 128); } if (InPort != null) { InPort.SetSpotLocation(64, icon, 256); } if (OutPort != null) { OutPort.SetSpotLocation(256, icon, 64); } } else { if (Label != null) { Label.SetSpotLocation(256, icon, 64); } if (InPort != null) { InPort.SetSpotLocation(128, icon, 32); } if (OutPort != null) { OutPort.SetSpotLocation(32, icon, 128); } } }
/// <summary> /// Record a wiring between two copied ports, using (and reducing) the port mappings. /// </summary> /// <param name="outPort">TBD</param> /// <param name="inPort">TBD</param> /// <param name="indent">TBD</param> /// <exception cref="ArgumentException">TBD</exception> public void Wire(OutPort outPort, InPort inPort, int indent) { if (Fusing.IsDebug) { Fusing.Log(indent, $"wiring {outPort} ({Hash(outPort)}) -> {inPort} ({Hash(inPort)})"); } var newOut = RemoveMapping(outPort, NewOutputs); if (!newOut.HasValue) { throw new ArgumentException($"wiring {outPort} -> {inPort}", nameof(outPort)); } var newIn = RemoveMapping(inPort, NewInputs); if (!newIn.HasValue) { throw new ArgumentException($"wiring {outPort} -> {inPort}", nameof(inPort)); } Downstreams.Add(newOut.Value, newIn.Value); Upstreams.Add(newIn.Value, newOut.Value); }
public void WritePort(OutPort outPort, DataPointerType pointerType, byte val) { if (deviceComPort_ == null || !deviceComPort_.IsOpen) { System.Windows.Forms.MessageBox.Show( "Внешнее устройство не подключено", "Ошибка!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error); return; } byte[] req_buf = new byte[CMD_REQUEST_PORT_WRITE_LENGTH]; byte[] data_buf = { (byte)outPort, val }; byte data_size = (byte)data_buf.Length; object res; PrepareRequestBuf(ref req_buf, CMD_REQUEST_PORT_WRITE_LENGTH, data_buf, data_size, CMD_PORT_WRITE); CmdSendRecv(ref deviceComPort_, req_buf, out res); }
private void GetNOutPortInfo() { _noutport = new OutPort(nindexno); _noutport.GetCustInfo(); int onesum = 0; int twosum = 0; int threesum = 0; Dictionary <string, Color> ciginfo = _noutport.GetCigInfo(ref onesum, ref twosum, ref threesum); labnonesum.Text = onesum.ToString(); labntwosum.Text = twosum.ToString(); labnthreesum.Text = threesum.ToString(); labnonetwosum.Text = (onesum + twosum).ToString(); labelX29.Text = _noutport["INDEXNO"]; foreach (Control control in this.panel5.Controls) { if (control is LabelX && control.Tag != null) { if (_noutport.ContainsKey(control.Tag.ToString())) { ((LabelX)control).Text = _noutport[control.Tag.ToString()]; } } } if ((!string.IsNullOrEmpty(labncustname.Text)) && (labncustname.Text.Contains("×")) && (labncustname.Text != NCustName)) { NCustName = labncustname.Text; SoundPlayer player = new SoundPlayer(); player.SoundLocation = Application.StartupPath + "\\Sound\\下一订单.wav"; player.Load(); player.Play(); } itemPanel3.BeginUpdate(); itemPanel3.Items.Clear(); foreach (var s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Key.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 14); if (s.Key.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = s.Value; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 225; labelItem.Height = 25; labelItem.WordWrap = true; itemPanel3.Items.Add(labelItem); } itemPanel3.EndUpdate(); }
public TestPublisher(IModule owner, OutPort port) { Owner = owner; Port = port; }
/// <summary> /// 获取上层皮带监控信息 /// </summary> private void GetUpPutInfo() { //上层皮带当前客户信息 GetUpCustIndex(); _outport = new OutPort(upindexno); _outport.GetOutPortInfo(); labelX2.Text = _outport["INDEXNO"]; foreach (Control control in this.panel6.Controls) { if (control is LabelX && control.Tag != null) { if (_outport.ContainsKey(control.Tag.ToString())) { ((LabelX)control).Text = _outport[control.Tag.ToString()]; } } } //上层皮带当前客户的卷烟明细 itemPanel1.BeginUpdate(); itemPanel1.Items.Clear(); _outport = new OutPort(upindexno); LabelItem titlelabelItem = new LabelItem(); titlelabelItem.Text = "当前客户"; titlelabelItem.TextLineAlignment = StringAlignment.Center; titlelabelItem.ItemAlignment = eItemAlignment.Center; titlelabelItem.Width = itemPanel1.Width; titlelabelItem.Font = new System.Drawing.Font("黑体", 20); titlelabelItem.ForeColor = Color.Yellow; titlelabelItem.TextLineAlignment = StringAlignment.Center; titlelabelItem.Width = itemPanel1.Width; titlelabelItem.Height = 35; itemPanel1.Items.Add(titlelabelItem); List <string> ciginfo = _outport.GetUpCigInfo(); foreach (string s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 18); if (s.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = Color.Red; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 305; labelItem.Height = 35; //labelItem.WordWrap = true; itemPanel1.Items.Add(labelItem); } itemPanel1.EndUpdate(); //上层皮带下一客户的卷烟明细 itemPanel2.BeginUpdate(); itemPanel2.Items.Clear(); titlelabelItem = new LabelItem(); titlelabelItem.Text = "下一客户"; titlelabelItem.Font = new System.Drawing.Font("黑体", 20); titlelabelItem.ForeColor = Color.Yellow; titlelabelItem.TextLineAlignment = StringAlignment.Center; titlelabelItem.ItemAlignment = eItemAlignment.Center; titlelabelItem.Width = itemPanel1.Width; titlelabelItem.Height = 35; itemPanel2.Items.Add(titlelabelItem); _poutport = new OutPort(uppindexno); ciginfo = _poutport.GetUpCigInfo(); foreach (string s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 18); if (s.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = Color.Yellow; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 305; labelItem.Height = 35; itemPanel2.Items.Add(labelItem); } itemPanel2.EndUpdate(); }
private void GetDownPutInfo() { GetDownCustIndex(); _outport = new OutPort(downindexno); _outport.GetOutPortInfo(); labelX5.Text = _outport["INDEXNO"]; foreach (Control control in this.panel5.Controls) { if (control is LabelX && control.Tag != null) { if (_outport.ContainsKey(control.Tag.ToString())) { ((LabelX)control).Text = _outport[control.Tag.ToString()]; } } } //下层当前客户卷烟 itemPanel3.BeginUpdate(); itemPanel3.Items.Clear(); _outport = new OutPort(downindexno); LabelItem titlelabelItem = new LabelItem(); titlelabelItem.Text = "当前客户"; titlelabelItem.Font = new System.Drawing.Font("黑体", 20); titlelabelItem.ForeColor = Color.Aqua; titlelabelItem.TextLineAlignment = StringAlignment.Center; titlelabelItem.Width = 305; titlelabelItem.Height = 35; itemPanel3.Items.Add(titlelabelItem); List <string> ciginfo = _outport.GetDownCigInfo(); foreach (string s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 18); if (s.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = Color.Red; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 305; labelItem.Height = 35; labelItem.WordWrap = true; itemPanel3.Items.Add(labelItem); } itemPanel3.EndUpdate(); //下层下一客户卷烟 itemPanel4.BeginUpdate(); itemPanel4.Items.Clear(); titlelabelItem = new LabelItem(); titlelabelItem.Text = "下一客户"; titlelabelItem.Font = new System.Drawing.Font("黑体", 20); titlelabelItem.ForeColor = Color.Aqua; titlelabelItem.TextLineAlignment = StringAlignment.Center; titlelabelItem.Width = 305; titlelabelItem.Height = 35; itemPanel4.Items.Add(titlelabelItem); _noutport = new OutPort(downpindexno); ciginfo = _noutport.GetDownCigInfo(); foreach (string s in ciginfo) { LabelItem labelItem = new LabelItem(); labelItem.Text = s.Replace("(", " ").Replace(")", ""); labelItem.Font = new System.Drawing.Font("黑体", 18); if (s.Contains("*")) { labelItem.ForeColor = Color.Red; } else { labelItem.ForeColor = Color.Aqua; } labelItem.BorderSide = eBorderSide.All; labelItem.BorderType = eBorderType.Bump; labelItem.TextLineAlignment = StringAlignment.Center; labelItem.Width = 305; labelItem.Height = 35; labelItem.WordWrap = true; itemPanel4.Items.Add(labelItem); } itemPanel4.EndUpdate(); }
private LPTPrintSetup printset = new LPTPrintSetup(); //打印类 private void PirintSet(object type) { try { string indexcolname = ""; string custcolname = ""; foreach (DataGridViewColumn column in dgviewnone.Columns) { if (column.DataPropertyName.ToUpper() == "INDEXNO") { indexcolname = column.Name; } if (column.DataPropertyName.ToUpper() == "CUSTCODE") { custcolname = column.Name; } } IEnumerable <DataGridViewRow> rows = dgviewnone.SelectedRows.Cast <DataGridViewRow>(); DataGridViewRow[] Rows = rows.ToArray(); Array.Reverse(Rows); //对颠倒的行再次颠倒 foreach (DataGridViewRow selectedRow in Rows) { string indexcolvalue = selectedRow.Cells[indexcolname].Value.ToString(); string custvalue = selectedRow.Cells[custcolname].Value.ToString(); SortingLineTask sortingLineTask = SortingLineTask.GetSortingLineByIndex(indexcolvalue); //获取常规烟包 List <CigBoxInfo> cigBoxInfoList = CigBoxInfoList.GetBoxInfoByCustiomNo(sortingLineTask.CUSTCODE, sortingLineTask.INDEXNO.ToString(), AppUtil._SortingLineId); //获取异型烟包 int abnoboxcount = CigBoxInfoList.GetAbnoCigBoxNum(sortingLineTask.ORDERDATE, sortingLineTask.SORTINGTASKNO.ToString(), AppUtil._AbnoSortingLineId, sortingLineTask.CUSTCODE); OutPort outPort = new OutPort(Convert.ToInt32(indexcolvalue)); outPort.GetCustSeq(); foreach (CigBoxInfo cigBoxInfo in cigBoxInfoList) { BusinessLogic.Print.PrintInfo PSInfo = new BusinessLogic.Print.PrintInfo(); PSInfo.CustomerName = sortingLineTask.ShortName; PSInfo.CustomerCode = sortingLineTask.CUSTCODE; PSInfo.IndexNo = sortingLineTask.INDEXNO.ToString(); PSInfo.SortingDate = "(" + sortingLineTask.ORDERDATE + ")"; PSInfo.BoxNo = cigBoxInfo.BOXSEQ.ToString() + "/"; PSInfo.BoxCount = cigBoxInfo.BOXCOUNT.ToString(); PSInfo.CurrentNum = cigBoxInfo.BOXQTY.ToString() + "/" + sortingLineTask.SortingLineTaskDetails.GetTotQty().ToString(); //PSInfo.TaskNumber = sortingLineTask.SortingLineTaskDetails.GetTotQty().ToString(); PSInfo.DelivyLine = sortingLineTask.LINENAME; PSInfo.CustomerSqe = "(" + outPort["COUNTLINE"] + "/" + outPort["MAXCOUNTLINE"] + ")户"; //PSInfo.CustomerTotSeq = outPort["MAXCOUNTLINE"]; PSInfo.AbnoBoxCount = "异" + abnoboxcount; PSInfo.Address = cigBoxInfo.Address; PSInfo.BoxIndex = CigBoxInfoList.GetBoxIndex(PSInfo.IndexNo, cigBoxInfo.BOXSEQ.ToString(), AppUtil._SortingLineId); printset.SetupThePrinting(MyPrintDocument, new SYSPrintsettings(), PSInfo); if (Convert.ToInt32(type) == 1) { printPreviewDialog1.PrintPreviewControl.Zoom = 1.0; this.printPreviewDialog1.ShowDialog(); } else { MyPrintDocument.Print(); } } } } catch (Exception) { throw; } }