XmlResultWrapper.java 7.3 KB
package StSys.RoyoTech;


import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by sunke on 2019/10/30.
 */
@XmlRootElement(name = "XmlResult")
public class XmlResultWrapper {

    @XmlElement
    public XmlResult XmlResult;


    public static class XmlResult {
        public String Errorcode;
        public String Message;

        public XmlResult() {

        }

        public XmlResult(String errorcode, String message) {
            Errorcode = errorcode;
            Message = message;
        }


        @XmlElementWrapper(name = "Data")
        @XmlElement(name = "TowerDetialImforation")
        public List<TowerDetialImforation> allTowerDetails;

        @XmlElementWrapper(name = "Data")
        @XmlElement(name = "TowerDetailInformation")
        public List<TowerBaseInformation> detailTowers;

        @XmlElement(name = "Data")
        public TowerObj TowerObj;

        @XmlElementWrapper(name = "Data")
        @XmlElement(name = "TowerBaseInformation")
        public List<TowerBaseInformation> baseTowers;


        @XmlElementWrapper(name = "Data")
        @XmlElement(name = "JobListInformation")
        public List<JobListInformation> jobLists;


        @XmlElementWrapper(name = "Data")
        @XmlElement(name = "CarrierInformation")
        public List<CarrierInformation> carriers;

    }

    public static class TowerObj{

        public TowerObj(List<TowerBaseInformation> towers) {
            baseTowers = towers;
        }

        @XmlElementWrapper(name = "ArrayOfTowerBaseInformation")
        @XmlElement(name = "TowerBaseInformation")
        public List<TowerBaseInformation> baseTowers;
    }


    /**
     * <TowerDetailInformation> <TowerId>000800</TowerId> <TowerName>000800</TowerName> <OnlineStatus>Online</OnlineStatus> <StatusText>Bereit</StatusText> <StatusCode>26</StatusCode> <Temperature>23.52</Temperature> <Humidity>49.42</Humidity>
     <Slots> <Slot>
     <Slotname>s78</Slotname> <Slots_used>208</Slots_used> <Slots_free>266</Slots_free>
     </Slot> <Slot>
     <Slotname>s712</Slotname> <Slots_used>4</Slots_used> <Slots_free>36</Slots_free>
     </Slot> .
     . </Slots>
     </TowerDetailInformation>
     */
    public static class TowerBaseInformation {
        public TowerBaseInformation() {
        }

        public TowerBaseInformation(int towerId) {
            TowerId = towerId;
        }

        public int TowerId;
        public String TowerName;
        public String OnlineStatus;
        public String StatusText;
        public String StatusCode;
        public String Temperature;
        public String Humidity;


        @XmlElementWrapper(name = "Slots")
        @XmlElement(name = "Slot")
        public List<Slot> Slots;


    }

    public static class Slot{
        public String Slotname;
        public int Slots_used;
        public int Slots_free;

    }

    public static class Pos{
        public String Dia; //料卷直径
        public String Thinkness; //料卷厚度
        public int SlotsFree; //剩余储位数量
        public int SlotsUsed; //已用储位数量
    }


    public static class CarrierInformation{
        public int ID;
        public String Carrier;
        public String CreateDate;
        public String CreateUser="";
        public int Article = 0;
        /**
         * 000800.72.03其中000800为TowerId
         */
        public String Depot;
        public int DepotOld = 0;
        public String DepotDate;
        public String DepotUser = "";
        public String Traybox = "";

        public int Stock;
        public int StockMin = 0;
        public int StockNew = 0;
        public int StockUsed = 0;
        public int StockTPSys = 0;
        public boolean Guessed = false;
        public int Cycles = 0;
        public int Outtime = 0;
        public boolean Unleaded = false;
        public int PriceP = 0;
        public int Height;
        public int HCode = 0;
        public int Diameter;
        public int Supply = 0;
        public String Pin1 = "";
        public String Magazine = "";
        public String Feeder = "";
        public int StepWidth = 0;
        public String ZACC = "";
        public String YACC = "";
        public int Duration = 0;

        public int Frequency = 0;
        public int Amplitude = 0;

        public String Lock = "";
        public String MSL = "";
        public boolean MSLWatch = false;
        public String MSLDate = "2016-09-23T00:00:00";
        public String DryDate = "2016-09-23T00:00:00";
        public String Expiry = "0001-01-01T00:00:00";
        public int Core = 0;
        public int TapeHeight = 0;
        public String C_Order = "";
        /**
         * 唯一码后面的几个字符串
         */
        public String Manufactur = "";
        public String MReference = "";
        public String MBarcode = "";
        public String Batch;
        /**
         * 使用条码中的最后一个字段
         */
        public String Custom1;
        public String Custom2 = "";
        public String Custom3 = "";
        public String Custom4 = "";
        public String Custom5 = "";
        public String Custom6 = "";
    }

    public static class JobListInformation{
        public String ID;
        public String Name;
        public String CreateDate;
        public String CreateTime;

        @XmlElementWrapper(name = "List")
        @XmlElement(name = "JobListItem")
        public List<JobListItem> jobListItems;

        public void addItem(String barcode, String pn){
            if(jobListItems == null){
                jobListItems = new ArrayList<>();
            }
            JobListItem item = new JobListItem();
            item.Article = pn;
            item.Carrier = barcode;
            jobListItems.add(item);
        }

    }

    public static class JobListItem{
        public String Article;
        public String Carrier;
    }

    //Tower详细信息
    public static class TowerDetialImforation
    {
        public String TowerID; //机台编号
        public boolean DoorIsClosed; //机台门已关上
        public boolean LightYellow; //机台三色灯_黄灯
        public boolean LightGreen; //机台三色灯_绿灯
        public boolean LightRed; //机台三色灯_红灯
        public int StatusCode; //机台状态代码(厂商自行定义 Ex:1.Ready、2.未开机、3.卡料、……)
        public String StatusDescription; //机台状态描述(对上述状态代码的描述)
        public MaterialState Material; //入料口料状态信息(详细内容见MaterialState类)

        @XmlElementWrapper(name = "Slots")
        @XmlElement(name = "Slot")
        public List<Pos> Storages; //机台仓储信息(详细内容见Slot类)
    }
    //入料口料状态信息
    public static class MaterialState
    {
        public boolean Exist; //入料口有料感应
        public String State; //入料口料状态(枚举States:Loading/Unloading/Unloaded/LoadNG)
        public String Barcode2D; //入料口料二维码(出料时要有)
        public String Message; //LoadNG入料失败原因
    }
    //入料口料卷状态
    public static enum States
    {
        Loading, //正在入料
        Unloading, //正在出料
        Unloaded, //出料完成
        LoadNG//入料失败
    }

}