Ejemplo n.º 1
0
 public void PCCThreadFunc(object obj)
 {
     try
     {
         PeiCan lastModel = null;
         int[]  XmlIndex  = getXmlIndex();
         while (true)
         {
             if (IsStart)
             {
                 PeiCan thisModel = PccBll.GetPccModel();
                 if (thisModel != null)
                 {
                     setCarData(lastModel, thisModel, XmlIndex);
                     lastModel = thisModel;
                 }
             }
             Thread.Sleep(ThreadTime);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        public static PeiCan DataRowToModel(DataRow row)
        {
            PeiCan model = new PeiCan();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = uint.Parse(row["id"].ToString());
                }
                if (row["source"] != null && row["source"].ToString() != "")
                {
                    model.source = uint.Parse(row["source"].ToString());
                }
                if (row["target"] != null && row["target"].ToString() != "")
                {
                    model.target = uint.Parse(row["target"].ToString());
                }
                if (row["target_z"] != null && row["target_z"].ToString() != "")
                {
                    model.target_z = uint.Parse(row["target_z"].ToString());
                }
                if (row["currentlocation"] != null && row["currentlocation"].ToString() != "")
                {
                    model.currentlocation = long.Parse(row["currentlocation"].ToString());
                }
                if (row["Carstate"] != null && row["Carstate"].ToString() != "")
                {
                    model.Carstate = uint.Parse(row["Carstate"].ToString());
                }
                if (row["Palletstate"] != null && row["Palletstate"].ToString() != "")
                {
                    model.Palletstate = uint.Parse(row["Palletstate"].ToString());
                }
                if (row["TaskState"] != null && row["TaskState"].ToString() != "")
                {
                    model.TaskState = uint.Parse(row["TaskState"].ToString());
                }
                if (row["ComplateState"] != null && row["ComplateState"].ToString() != "")
                {
                    model.ComplateState = uint.Parse(row["ComplateState"].ToString());
                }
                if (row["Time"] != null && row["Time"].ToString() != "")
                {
                    model.Time = DateTime.Parse(row["Time"].ToString());
                }
                if (row["Additional"] != null)
                {
                    model.Additional = row["Additional"].ToString();
                }
            }
            return(model);
        }
Ejemplo n.º 3
0
        private void setCarData(PeiCan lastData, PeiCan thisData, int[] xmlIndex)
        {
            int PCC_ATTRI01_IN_TGT          = xmlIndex[0];
            int PCC_ATTRI01_IN_ORI          = xmlIndex[1];
            int PCC_ATTRI01_IN_L_OR_R       = xmlIndex[2];
            int PCC_ATTRI01_IN_STATE        = xmlIndex[3];
            int PCC_ATTRI01_IN_TASK_STATE   = xmlIndex[4];
            int PCC_ATTRI01_IN_PALLET_STATE = xmlIndex[5];

            if (lastData == null)
            {
                ComTCPLib.SetOutputAsREAL32(1, PCC_ATTRI01_IN_TGT, thisData.target * 1.40f + 0.37f);
                ComTCPLib.SetOutputAsREAL32(1, PCC_ATTRI01_IN_ORI, thisData.source * 1.40f + 0.37f);
                ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_L_OR_R, thisData.target_z);
                ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_TASK_STATE, thisData.TaskState);
                ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_PALLET_STATE, thisData.Palletstate);
                ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_STATE, thisData.Carstate);
            }
            else if (!thisData.Equals(lastData))
            {
                if (thisData.target != lastData.target)
                {
                    ComTCPLib.SetOutputAsREAL32(1, PCC_ATTRI01_IN_TGT, thisData.target * 1.40f + 0.37f);
                }
                if (thisData.source != lastData.source)
                {
                    ComTCPLib.SetOutputAsREAL32(1, PCC_ATTRI01_IN_ORI, thisData.source * 1.40f + 0.37f);
                }
                if (thisData.target_z != lastData.target_z)
                {
                    ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_L_OR_R, thisData.target_z);
                }
                if (thisData.TaskState != lastData.TaskState)
                {
                    ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_TASK_STATE, thisData.TaskState);
                }
                if (thisData.Palletstate != lastData.Palletstate)
                {
                    ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_PALLET_STATE, thisData.Palletstate);
                }
                if (thisData.Carstate != lastData.Carstate)
                {
                    ComTCPLib.SetOutputAsUINT(1, PCC_ATTRI01_IN_STATE, thisData.Carstate);
                }
            }
        }