| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | using System;using System.Collections.Generic;using System.Linq;using System.Text;using WCS.Data;using WCS.Data.Models;using WCS.Data.Utils;using WCS.PLC;using WCS.PLC.Model.Equipment;namespace WCS.Workflow{    public class InitWorkflow    {        public static void InitData()        {            try            {                Current.InitData(BaseCurrent.WcsSystem);                //var routes = EquRouteHelper.QueryRoute("2235", "2381");                //var item = routes.FirstOrDefault(v => v.ROUTE_STARTPOS == "2235");                //int num1 = 1512;                //int num2 = 1520;                //int index = 511;                //for (int temp = num1; temp <= num2; temp++)                //{                //    var equipment = new WCS_EQUIPMENTINFO();                //    equipment.Equ_Id = Guid.NewGuid().ToString("N");                //    equipment.Equ_No = temp.ToString();                //    equipment.Equ_PlcName = "conveyor02";                //    equipment.Equ_Sequence = index;                //    equipment.Equ_Area = "A";                //    equipment.Equ_Type = "conveyor";                //    equipment.Equ_ReadWriteDB_Sequence = index.ToString();                //    equipment.Equ_ReadWriteDB_Length = 22;                //    equipment.Equ_ReadDB_Sequence = index.ToString();                //    equipment.Equ_ReadDB_Length = 22;                //    equipment.Equ_StatusDB_Sequence = index.ToString();                //    equipment.Equ_StatusDB_Length = 10;                //    //if (temp == 2235)                //    //{                //    //    equipment.Equ_BarCodeDB_Sequence = "0";                //    //    equipment.Equ_BarCodeDB_Length = 80;                //    //}                //    //else if (temp == 2238)                //    //{                //    //    equipment.Equ_BarCodeDB_Sequence = "1";                //    //    equipment.Equ_BarCodeDB_Length = 80;                //    //}                //    //else if (temp == 2246)                //    //{                //    //    equipment.Equ_BarCodeDB_Sequence = "2";                //    //    equipment.Equ_BarCodeDB_Length = 80;                //    //}                //    //else if (temp == 2359)                //    //{                //    //    equipment.Equ_BarCodeDB_Sequence = "3";                //    //    equipment.Equ_BarCodeDB_Length = 80;                //    //}                //    SugarBase.DB.Insertable(equipment).ExecuteCommand();                //    index++;                //}                #region 实例化堆垛机,输送机,穿梭车                foreach (var plc in Current.PlcSet)                {                    if (plc.PLC_EQUIPMENTTYPE == EquipmentType.srm.ToString())                    {                        if (plc.PLC_NAME == "srm01" || plc.PLC_NAME == "srm06")                        {                            plc.EquPlc = new SrmTray();                        }                        else                        {                            //实例化堆垛机类                            plc.EquPlc = new SRM_Tray();                        }                    }                    else if (plc.PLC_EQUIPMENTTYPE == EquipmentType.rgv.ToString())                    {                        if (plc.PLC_NAME == "rgv1195")                        {                            plc.EquPlc = new Rgv04();                        }                        else if (plc.PLC_NAME == "rgv1089" || plc.PLC_NAME == "rgv1091")                        {                            plc.EquPlc = new Rgv03();                        }                        else                        {                            plc.EquPlc = new Rgv02();                        }                    }                    //else if (plc.PLC_EQUIPMENTTYPE == EquipmentType.rgv.ToString())                    //{                    //    if (plc.PLC_NAME == "rgv2062" || plc.PLC_NAME == "rgv2044" || plc.PLC_NAME == "rgv2029" || plc.PLC_NAME == "rgv2019" ||                    //        plc.PLC_NAME == "rgv2189" || plc.PLC_NAME == "rgv2163" || plc.PLC_NAME == "rgv2143" || plc.PLC_NAME == "rgv2125")                    //    {                    //        plc.EquPlc = new Rgv02();                    //    }                    //}                    else if (plc.PLC_EQUIPMENTTYPE == EquipmentType.conveyor.ToString())                    {                        if (plc.PLC_NAME == "conveyor01") plc.EquPlc = new ConveyorPlc01();                        if (plc.PLC_NAME == "conveyor02") plc.EquPlc = new ConvPlc02();                        if (plc.PLC_NAME == "conveyor03") plc.EquPlc = new ConvPlc03();                        if (plc.PLC_NAME == "conveyor04") plc.EquPlc = new ConvPlc04();                    }                    if (plc.EquPlc != null) plc.EquPlc.WCS_PLCItem = plc;                }                      #endregion;            }            catch (Exception ex)            {                LogMessageHelper.RecordLogMessage(ex);            }        }    }}
 |