123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- using Aitex.Core.Common;
- using Aitex.Core.RT.Log;
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Xml;
- using System.Xml.Linq;
- using MECF.Framework.Common.Equipment;
- using System.IO;
- namespace Aitex.Sorter.Common
- {
- [DataContract]
- [Serializable]
- public class JZFLDRecipeXml : INotifyPropertyChanged
- {
- public event PropertyChangedEventHandler PropertyChanged;
- public void OnPropertyChanged(string propertyName)
- {
- if (PropertyChanged != null)
- {
- PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- private string name;
- [DataMember]
- public string Name
- {
- get
- {
- return name;
- }
- set
- {
- name = value;
- OnPropertyChanged("Name");
- }
- }
- private string _subRecipeName;
- public string SubRecipeName
- {
- get { return _subRecipeName; }
- set
- {
- _subRecipeName = value;
- OnPropertyChanged("SubRecipeName");
- }
- }
- private int _unloaderSlotsNumber = 25;
- [DataMember]
- public int UnloaderSlotsNumber
- {
- get { return _unloaderSlotsNumber; }
- set
- {
- _unloaderSlotsNumber = value;
- OnPropertyChanged("UnloaderSlotsNumber");
- }
- }
- private bool _isLP1Loader;
- [DataMember]
- public bool IsLP1Loader
- {
- get { return _isLP1Loader; }
- set
- {
- _isLP1Loader = value;
- OnPropertyChanged("IsLP1Loader");
- }
- }
- private bool _isLP2Loader;
- [DataMember]
- public bool IsLP2Loader
- {
- get { return _isLP2Loader; }
- set
- {
- _isLP2Loader = value;
- OnPropertyChanged("IsLP2Loader");
- }
- }
- private bool _isLP3Loader;
- [DataMember]
- public bool IsLP3Loader
- {
- get { return _isLP3Loader; }
- set
- {
- _isLP3Loader = value;
- OnPropertyChanged("IsLP3Loader");
- }
- }
- private bool _isLP4Loader;
- [DataMember]
- public bool IsLP4Loader
- {
- get { return _isLP4Loader; }
- set
- {
- _isLP4Loader = value;
- OnPropertyChanged("IsLP4Loader");
- }
- }
- private bool _isLP5Loader;
- [DataMember]
- public bool IsLP5Loader
- {
- get { return _isLP5Loader; }
- set
- {
- _isLP5Loader = value;
- OnPropertyChanged("IsLP5Loader");
- }
- }
- private bool _isLP6Loader;
- [DataMember]
- public bool IsLP6Loader
- {
- get { return _isLP6Loader; }
- set
- {
- _isLP6Loader = value;
- OnPropertyChanged("IsLP6Loader");
- }
- }
- private bool _isLP7Loader;
- [DataMember]
- public bool IsLP7Loader
- {
- get { return _isLP7Loader; }
- set
- {
- _isLP7Loader = value;
- OnPropertyChanged("IsLP7Loader");
- }
- }
- private bool _isLP8Loader;
- [DataMember]
- public bool IsLP8Loader
- {
- get { return _isLP8Loader; }
- set
- {
- _isLP8Loader = value;
- OnPropertyChanged("IsLP8Loader");
- }
- }
- private bool _isLP1CollectErrorWafer;
- [DataMember]
- public bool IsLP1CollectErrorWafer
- {
- get { return _isLP1CollectErrorWafer; }
- set
- {
- _isLP1CollectErrorWafer = value;
- OnPropertyChanged("IsLP1CollectErrorWafer");
- }
- }
- private bool _isLP2CollectErrorWafer;
- [DataMember]
- public bool IsLP2CollectErrorWafer
- {
- get { return _isLP2CollectErrorWafer; }
- set
- {
- _isLP2CollectErrorWafer = value;
- OnPropertyChanged("IsLP2CollectErrorWafer");
- }
- }
- private bool _isLP3CollectErrorWafer;
- [DataMember]
- public bool IsLP3CollectErrorWafer
- {
- get { return _isLP3CollectErrorWafer; }
- set
- {
- _isLP3CollectErrorWafer = value;
- OnPropertyChanged("IsLP3CollectErrorWafer");
- }
- }
- private bool _isLP4CollectErrorWafer;
- [DataMember]
- public bool IsLP4CollectErrorWafer
- {
- get { return _isLP4CollectErrorWafer; }
- set
- {
- _isLP4CollectErrorWafer = value;
- OnPropertyChanged("IsLP4CollectErrorWafer");
- }
- }
- private bool _isLP5CollectErrorWafer;
- [DataMember]
- public bool IsLP5CollectErrorWafer
- {
- get { return _isLP5CollectErrorWafer; }
- set
- {
- _isLP5CollectErrorWafer = value;
- OnPropertyChanged("IsLP5CollectErrorWafer");
- }
- }
- private bool _isLP6CollectErrorWafer;
- [DataMember]
- public bool IsLP6CollectErrorWafer
- {
- get { return _isLP6CollectErrorWafer; }
- set
- {
- _isLP6CollectErrorWafer = value;
- OnPropertyChanged("IsLP6CollectErrorWafer");
- }
- }
- private bool _isLP7CollectErrorWafer;
- [DataMember]
- public bool IsLP7CollectErrorWafer
- {
- get { return _isLP7CollectErrorWafer; }
- set
- {
- _isLP7CollectErrorWafer = value;
- OnPropertyChanged("IsLP7CollectErrorWafer");
- }
- }
- private bool _isLP8CollectErrorWafer;
- [DataMember]
- public bool IsLP8CollectErrorWafer
- {
- get { return _isLP8CollectErrorWafer; }
- set
- {
- _isLP8CollectErrorWafer = value;
- OnPropertyChanged("IsLP8CollectErrorWafer");
- }
- }
- private string _unloader1Information;
- public string Unloader1Information
- {
- get { return _unloader1Information; }
- set
- {
- _unloader1Information = value;
- OnPropertyChanged("Unloader1Information");
- }
- }
- private string _unloader2Information;
- public string Unloader2Information
- {
- get { return _unloader2Information; }
- set
- {
- _unloader2Information = value;
- OnPropertyChanged("Unloader2Information");
- }
- }
- private string _unloader3Information;
- public string Unloader3Information
- {
- get { return _unloader3Information; }
- set
- {
- _unloader3Information = value;
- OnPropertyChanged("Unloader3Information");
- }
- }
- private string _unloader4Information;
- public string Unloader4Information
- {
- get { return _unloader4Information; }
- set
- {
- _unloader4Information = value;
- OnPropertyChanged("Unloader4Information");
- }
- }
- private string _unloader5Information;
- public string Unloader5Information
- {
- get { return _unloader5Information; }
- set
- {
- _unloader5Information = value;
- OnPropertyChanged("Unloader5Information");
- }
- }
- private string _unloader6Information;
- public string Unloader6Information
- {
- get { return _unloader6Information; }
- set
- {
- _unloader6Information = value;
- OnPropertyChanged("Unloader6Information");
- }
- }
- private string _unloader7Information;
- public string Unloader7Information
- {
- get { return _unloader7Information; }
- set
- {
- _unloader7Information = value;
- OnPropertyChanged("Unloader7Information");
- }
- }
- private string _unloader8Information;
- public string Unloader8Information
- {
- get { return _unloader8Information; }
- set
- {
- _unloader8Information = value;
- OnPropertyChanged("Unloader8Information");
- }
- }
- public JZFLDRecipeXml(string name = "")
- {
- Name = name;
-
- }
- public JZFLDRecipeXml(string content, string name = "")
- {
- Name = name;
- SetContent(content);
- }
- public bool SetContent(string content)
- {
- try
- {
- var doc = XDocument.Parse(content);
- ParseContent(doc);
- }
- catch (Exception e)
- {
- LOG.Write(e);
- return false;
- }
- return true;
- }
- public string GetContent()
- {
- var doc = new XDocument();
- var root = new XElement("Recipe");
- var element = new XElement("JZFLDRecipe"
- , new XAttribute("SubRecipeName", SubRecipeName??"")
- , new XAttribute("UnloaderSlotsNumber", UnloaderSlotsNumber)
- , new XAttribute("IsLP1Loader", IsLP1Loader.ToString())
- , new XAttribute("IsLP2Loader", IsLP2Loader.ToString())
- , new XAttribute("IsLP3Loader", IsLP3Loader.ToString())
- , new XAttribute("IsLP4Loader", IsLP4Loader.ToString())
- , new XAttribute("IsLP5Loader", IsLP5Loader.ToString())
- , new XAttribute("IsLP6Loader", IsLP6Loader.ToString())
- , new XAttribute("IsLP7Loader", IsLP7Loader.ToString())
- , new XAttribute("IsLP8Loader", IsLP8Loader.ToString())
- , new XAttribute("IsLP1CollectErrorWafer", IsLP1CollectErrorWafer.ToString())
- , new XAttribute("IsLP2CollectErrorWafer", IsLP2CollectErrorWafer.ToString())
- , new XAttribute("IsLP3CollectErrorWafer", IsLP3CollectErrorWafer.ToString())
- , new XAttribute("IsLP4CollectErrorWafer", IsLP4CollectErrorWafer.ToString())
- , new XAttribute("IsLP5CollectErrorWafer", IsLP5CollectErrorWafer.ToString())
- , new XAttribute("IsLP6CollectErrorWafer", IsLP6CollectErrorWafer.ToString())
- , new XAttribute("IsLP7CollectErrorWafer", IsLP7CollectErrorWafer.ToString())
- , new XAttribute("IsLP8CollectErrorWafer", IsLP8CollectErrorWafer.ToString())
- , new XAttribute("Unloader1Information", Unloader1Information?? ",,,,,,,,,")
- , new XAttribute("Unloader2Information", Unloader2Information?? ",,,,,,,,,")
- , new XAttribute("Unloader3Information", Unloader3Information?? ",,,,,,,,,")
- , new XAttribute("Unloader4Information", Unloader4Information?? ",,,,,,,,,")
- , new XAttribute("Unloader5Information", Unloader5Information?? ",,,,,,,,,")
- , new XAttribute("Unloader6Information", Unloader6Information?? ",,,,,,,,,")
- , new XAttribute("Unloader7Information", Unloader7Information?? ",,,,,,,,,")
- , new XAttribute("Unloader8Information", Unloader8Information?? ",,,,,,,,,")
-
- );
- root.Add(element);
- doc.Add(root);
- return doc.ToString();
- }
- private void ParseContent(XDocument doc)
- {
- try
- {
- var node = doc.Root.Element("JZFLDRecipe");
- if (node == null)
- {
- LOG.Write(string.Format("recipe not valid"));
- return;
- }
- string strValue;
- int intValue;
- bool bValue;
- SubRecipeName = (node.Attribute("SubRecipeName") == null? "": node.Attribute("SubRecipeName").Value);
- strValue = node.Attribute("UnloaderSlotsNumber").Value;
-
- int.TryParse(strValue, out intValue);
- UnloaderSlotsNumber = intValue;
- strValue = node.Attribute("IsLP1Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP1Loader = bValue;
- strValue = node.Attribute("IsLP2Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP2Loader = bValue;
- strValue = node.Attribute("IsLP3Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP3Loader = bValue;
- strValue = node.Attribute("IsLP4Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP4Loader = bValue;
- strValue = node.Attribute("IsLP5Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP5Loader = bValue;
- strValue = node.Attribute("IsLP6Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP6Loader = bValue;
- strValue = node.Attribute("IsLP7Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP7Loader = bValue;
- strValue = node.Attribute("IsLP8Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP8Loader = bValue;
- strValue = node.Attribute("IsLP8Loader").Value;
- bool.TryParse(strValue, out bValue);
- IsLP8Loader = bValue;
- if(node.Attribute("IsLP1CollectErrorWafer")!=null)
- {
- strValue = node.Attribute("IsLP1CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP1CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP2CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP2CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP2CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP3CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP3CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP3CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP4CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP4CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP4CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP5CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP5CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP5CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP6CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP6CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP6CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP7CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP7CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP7CollectErrorWafer = bValue;
- }
- if (node.Attribute("IsLP8CollectErrorWafer") != null)
- {
- strValue = node.Attribute("IsLP8CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP8CollectErrorWafer = bValue;
- }
- strValue = node.Attribute("IsLP8CollectErrorWafer").Value;
- bool.TryParse(strValue, out bValue);
- IsLP8CollectErrorWafer = bValue;
- Unloader1Information = node.Attribute("Unloader1Information").Value;
- Unloader2Information = node.Attribute("Unloader2Information").Value;
- Unloader3Information = node.Attribute("Unloader3Information").Value;
- Unloader4Information = node.Attribute("Unloader4Information").Value;
- Unloader5Information = node.Attribute("Unloader5Information").Value;
- Unloader6Information = node.Attribute("Unloader6Information").Value;
- Unloader7Information = node.Attribute("Unloader7Information").Value;
- Unloader8Information = node.Attribute("Unloader8Information").Value;
- }
- catch (Exception ex)
- {
- LOG.Write(ex);
- }
- }
- private T GetValue<T>(XElement element, string Name)
- {
- var attr = element.Attribute(Name);
- if (attr != null)
- {
- return (T)Convert.ChangeType(attr.Value, typeof(T));
- }
- return default(T);
- }
- }
- }
|