public Case_Load CreateCaseLoad(BaseCaseData caseData) { MeshInfo boxInfo = new MeshInfo() { color = caseData.colour, filename = Case_Load.GraphicsMesh, length = caseData.Length, width = caseData.Width, height = caseData.Height }; Case_Load load = new Case_Load(boxInfo); CaseData DatComData = caseData as CaseData; if (DatComData == null) { Log.Write("ERROR: Bad cast to CaseData in CreateCaseLoad", Color.Red); return(null); } load.Weight = caseData.Weight; load.Identification = DatComData.ULID; load.Case_Data = DatComData; return(load); }
void GetLengthWidthHeightWeight(CaseData caseload, out string length, out string width, out string height, out string weight) { length = (caseload.Width * 1000).ToString("0000"); //Unit Load Length (x-axis) width = (caseload.Length * 1000).ToString("0000"); //Unit Load Width (z-axis) height = (caseload.Height * 1000).ToString("0000"); weight = (caseload.Weight * 1000).ToString("000000"); if (caseload.MissionTelegram != null && caseload.MissionTelegram.Length > 16) { //just return what was received in mission telegram? if (caseload.MissionTelegram[10] == caseload.ULID) { length = caseload.MissionTelegram[12]; width = caseload.MissionTelegram[13]; height = caseload.MissionTelegram[14]; weight = caseload.MissionTelegram[15]; } else if (caseload.MissionTelegram.Length > 26 && caseload.MissionTelegram[21] == caseload.ULID) { length = caseload.MissionTelegram[23]; width = caseload.MissionTelegram[24]; height = caseload.MissionTelegram[25]; weight = caseload.MissionTelegram[26]; } } }
private string GetLoadIDFromCaseData(CaseData cData) { if (cData != null) { return(cData.ULID); } return(string.Empty); }
private void SetCaseData(string[] splittelegram, out CaseData cDataA, out CaseData cDataB) { if (splittelegram[7].Datcom_X_horizontal() == "001") { //first dataset is position 1 cDataA = SetUpCaseMissionDataSet(splittelegram, 1); cDataB = SetUpCaseMissionDataSet(splittelegram, 2); } else { //first dataset is position 2 cDataA = SetUpCaseMissionDataSet(splittelegram, 2); cDataB = SetUpCaseMissionDataSet(splittelegram, 1); } }
/// <summary> /// Creates a PS to DS task for the elevator /// Loads always travel from A to B /// </summary> /// <param name="originA">Load A origin</param> /// <param name="destA">Load A destination</param> /// <param name="cDataA">case data for load A</param> /// <param name="originB">Load B origin</param> /// <param name="destB">Load B destination</param> /// <param name="cDataB"> case data for load B</param> /// <param name="loadCycle">The load cycle type</param> /// <param name="unloadCycle">The unload cycle type</param> public void CreateElevatorTask(string originA, string destA, CaseData cDataA, string originB, string destB, CaseData cDataB, Cycle loadCycle, Cycle unloadCycle) { ElevatorTask eT = new ElevatorTask(GetLoadIDFromCaseData(cDataA), GetLoadIDFromCaseData(cDataB)); eT.SourceLoadB = string.Format("{0}{1}{2}{3}B", originB.Datcom_Aisle(), originB.Datcom_Side(), originB.Datcom_Y_Vertical(), (char)ConveyorTypes.Pick); eT.DestinationLoadB = string.Format("{0}{1}{2}{3}A", destB.Datcom_Aisle(), destB.Datcom_Side(), destB.Datcom_Y_Vertical(), (char)ConveyorTypes.Drop); eT.caseDataB = cDataB; ((Case_Load)Load.Get(cDataB.ULID)).Case_Data = cDataB; //Should always have a set of B data but no always a set of A data. if (cDataA != null) { eT.SourceLoadA = string.Format("{0}{1}{2}{3}A", originA.Datcom_Aisle(), originA.Datcom_Side(), originA.Datcom_Y_Vertical(), (char)ConveyorTypes.Pick); eT.DestinationLoadA = string.Format("{0}{1}{2}{3}A", destA.Datcom_Aisle(), destA.Datcom_Side(), destA.Datcom_Y_Vertical(), (char)ConveyorTypes.Drop); eT.caseDataA = cDataA; ((Case_Load)Load.Get(cDataA.ULID)).Case_Data = cDataA; } eT.LoadCycle = loadCycle; eT.UnloadCycle = unloadCycle; eT.Flow = TaskType.Infeed; string elevatorName = string.Format("{0}{1}", destB.Datcom_Side(), destB.Datcom_Aisle()); theMultishuttle.elevators.First(x => x.ElevatorName == elevatorName).ElevatorTasks.Add(eT); }
/// <summary> /// Sets up the casedata for a Mission Data Set - see Dematic Multi-Shuttle Control principles 3.7 /// this is valid for message types 01,02,04,05,06,20,21,22,31. /// </summary> /// <param name="splitTelegram"></param> /// <param name="blockNumber">The number of data sets in the telegram</param> /// <returns> CaseData : Case_Load has a property of type casedata to hold specific information mainly regarding telegrams</returns> private CaseData SetUpCaseMissionDataSet(string[] splitTelegram, int blockNumber) { int dataSetOffset = 7 + datcomVersionIndexOffset; // If 2 data sets then splitTelegram are seperated by an index depending on the veraion of datcom with regard to splitTelegram array CaseData caseData = null; if (blockNumber == 1) { dataSetOffset = 0; } try { caseData = new CaseData() { OriginalPosition = splitTelegram[6 + dataSetOffset], CurrentPosition = splitTelegram[7 + dataSetOffset], DestinationPosition = splitTelegram[8 + dataSetOffset], MissionStatus = splitTelegram[9 + dataSetOffset], ULID = splitTelegram[10 + dataSetOffset], ULType = splitTelegram[11 + dataSetOffset], Length = float.Parse(splitTelegram[12 + dataSetOffset]) / 1000f, Width = float.Parse(splitTelegram[13 + dataSetOffset]) / 1000f, Height = float.Parse(splitTelegram[14 + dataSetOffset]) / 1000f, Weight = float.Parse(splitTelegram[15 + dataSetOffset]) / 1000f, TimeStamp = splitTelegram[16 + dataSetOffset], MissionTelegram = splitTelegram }; if (DatcomVersion == "3.0") { caseData.Length = 0.6f; caseData.Width = 0.4f; caseData.Height = 0.25f; caseData.Weight = 1; caseData.TimeStamp = "0000000000"; } } catch (Exception ex) { Log.Write("Error in Mission Data Set, maybe length, width, height or weight are not valid to be parsed to a float!", Color.Red); Log.Write(ex.Message, Color.Red); } return(caseData); }
public string CreateMissionDataSetBody(CaseData cData) { string body = ""; string length, width, height, weight; GetLengthWidthHeightWeight(cData, out length, out width, out height, out weight); if (DatcomVersion == "3.0") { body = string.Format("{0},{1},{2},{3},{4},{5},0000000000", cData.OriginalPosition, cData.CurrentPosition, cData.DestinationPosition, cData.MissionStatus, cData.ULID, cData.ULType); } else if (DatcomVersion == "3.7") { body = string.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}", cData.OriginalPosition, cData.CurrentPosition, cData.DestinationPosition, cData.MissionStatus, cData.ULID, cData.ULType, length, width, height, weight, cData.TimeStamp); } return(body); }
public void RoutingTableUpdateRecieved(string[] telegramFields, ushort number_of_blocks) { //This message creates new entries in the Routing Table for specific ULs or updates existing records in the Routing Table for specific ULs. int count = RoutingTable.Count; int offset = NumberOfDestWords + 1; for (ushort block = 0; block < number_of_blocks; block++) { string SSCCBarcode = telegramFields[6 + block * offset]; //Case_Load caseload = Case_Load.GetCaseFromSSCCBarcode(SSCCBarcode); Case_Load caseload = Case_Load.GetCaseFromIdentification(SSCCBarcode); //Check if the load has a datcom case data, if not create it as it may have come from a different system that has different case data e.g. DCI multishuttle if (caseload != null && caseload.Case_Data.GetType() != typeof(CaseData)) { CaseData caseData = new CaseData(); caseData.Length = caseload.Case_Data.Length; caseData.Width = caseload.Case_Data.Width; caseData.Height = caseload.Case_Data.Height; caseData.Weight = caseload.Case_Data.Weight; caseData.colour = caseload.Case_Data.colour; caseload.SSCCBarcode = caseload.Identification; caseload.Case_Data = caseData; } RoutingTable[SSCCBarcode] = new UInt16[NumberOfDestWords]; for (int k = 7; k < 7 + NumberOfDestWords; k++) { string word = telegramFields[k + block * offset]; RoutingTable[SSCCBarcode][k - 7] = UInt16.Parse(word); } //Remove if destinations is 0 //To explicitly delete all entries for a specific UL from the Routing Table the destination fields for the UL will be set to all zero ('0'). ushort[] dest = RoutingTable[SSCCBarcode]; bool delete = true; for (int i = 0; i < dest.Length; i++) { if (dest[i] != 0) { delete = false; } } if (delete) { RoutingTable.Remove(SSCCBarcode); } //Update caseload if it exists if (caseload != null) { if (caseload.CurrentActionPoint != null) { //if (caseload.CurrentActionPoint.UserData is RapidPick5400StationA6) //{ // //tote is on inpoint to rapid pick. Let rapid pick decide if the tote can be released. // RapidPick5400StationA6 rapid = caseload.CurrentActionPoint.UserData as RapidPick5400StationA6; // rapid.ReleaseInPoint(); // return; //} } if (((CaseData)caseload.Case_Data).CallforwardWait) { return; //Tote is waiting to be called forward. Do not release } ((CaseData)caseload.Case_Data).RoutingTableUpdateWait = false; } } int newcount = RoutingTable.Count; if (newcount > MaxRoutingTableEntries && newcount > count) { //New entry added to the routing table and routing table exceeds limit. string status = "01"; //Status 01 means routing Table critically full. SendTelegram("10", status, 1); } }
private void Telegram01Recieved(string[] splittelegram, int datasets) { MultiShuttle ms = GetMultishuttleFromAisleNum(splittelegram); #region Case on Pos2 is the first in dataset, Case on Pos1 is the second in dataset CaseData cData = new CaseData(); cData.UserData = string.Empty; if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "R") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "O")) { //From rack to outfeed rack conveyor cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateShuttleTask(splittelegram[7], splittelegram[8], cData, ShuttleTaskTypes.RackToConv); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "R") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "R")) { //Shuffle move from rack loc to rack loc cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateShuttleTask(splittelegram[7], splittelegram[8], cData, ShuttleTaskTypes.Shuffle); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "O") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "D") && datasets == 1) { //Outfeed rack to Drop Station single load cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(null, null, null, splittelegram[7], splittelegram[8], cData, Cycle.Single, Cycle.Single, TaskType.Outfeed); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "O") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "D") && datasets == 2) { //Outfeed rack to Drop Station double load CaseData cDataA = SetUpCaseMissionDataSet(splittelegram, 2); CaseData cDataB = SetUpCaseMissionDataSet(splittelegram, 1); cDataA.UserData = cDataA.ULID + "," + cDataB.ULID; //Tag double loads for the correct 02 at the dropstation cDataB.UserData = cDataA.UserData; Cycle unloadcycle = Cycle.Double; if (splittelegram[8].Datcom_Y_Vertical() != splittelegram[15 + datcomVersionIndexOffset].Datcom_Y_Vertical()) { unloadcycle = Cycle.Single; } Cycle loadcycle = Cycle.Double; if (splittelegram[6].Datcom_Y_Vertical() != splittelegram[13 + datcomVersionIndexOffset].Datcom_Y_Vertical()) { loadcycle = Cycle.Single; } if (unloadcycle == Cycle.Single && loadcycle == Cycle.Single) { } ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(splittelegram[14 + datcomVersionIndexOffset], splittelegram[15 + datcomVersionIndexOffset], cDataA, splittelegram[7], splittelegram[8], cDataB, loadcycle, unloadcycle, TaskType.Outfeed); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "P") && ((splittelegram[7].Length > 0 && splittelegram[8].Substring(0, 1) == "D"))) { //Pick Station to drop station if (datasets == 1) { cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(null, null, null, splittelegram[7], splittelegram[8], cData, Cycle.Single, Cycle.Single); } else if (datasets == 2) { cData = SetUpCaseMissionDataSet(splittelegram, 1); CaseData cDataA = SetUpCaseMissionDataSet(splittelegram, 2); cDataA.UserData = cDataA.ULID + "," + cData.ULID; //Tag double loads for the correct 02 at the dropstation cData.UserData = cDataA.UserData; ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(splittelegram[18], splittelegram[19], cDataA, splittelegram[7], splittelegram[8], cData, Cycle.Double, Cycle.Double); } } else if (splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "P" && datasets == 1) { cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(null, null, null, splittelegram[7], splittelegram[8], cData, Cycle.Single, Cycle.Single, TaskType.Infeed); } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "I") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "R")) { //From infeed conveyor to rack location cData = SetUpCaseMissionDataSet(splittelegram, 1); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateShuttleTask(splittelegram[7], splittelegram[8], cData, ShuttleTaskTypes.ConvToRack); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "P") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "I") && datasets == 2 && splittelegram[8].Length > 0 && splittelegram[8].Datcom_Y_Vertical() == splittelegram[15 + datcomVersionIndexOffset].Datcom_Y_Vertical()) { CaseData cDataA; CaseData cDataB; SetCaseData(splittelegram, out cDataA, out cDataB); // CaseData cDataA = SetUpCaseMissionDataSet(splittelegram, 2); // CaseData cDataB = SetUpCaseMissionDataSet(splittelegram, 1); // cDataA.UserData = cDataA.ULID + "," + cDataB.ULID; //Tag double loads for the correct 02 at the dropstation // cDataB.UserData = cDataA.UserData; ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(splittelegram[14 + datcomVersionIndexOffset], splittelegram[15 + datcomVersionIndexOffset], cDataA, splittelegram[7], splittelegram[8], cDataB, Cycle.Double, Cycle.Double, TaskType.Infeed); return; } else if ((splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) == "P") && (splittelegram[8].Length > 0 && splittelegram[8].Substring(0, 1) == "I") && datasets == 2 && splittelegram[8].Length > 0 && splittelegram[8].Datcom_Y_Vertical() != splittelegram[15 + datcomVersionIndexOffset].Datcom_Y_Vertical()) { CaseData cDataA; CaseData cDataB; SetCaseData(splittelegram, out cDataA, out cDataB); ((MHEControl_MultiShuttle)ms.ControllerProperties).CreateElevatorTask(splittelegram[14 + datcomVersionIndexOffset], splittelegram[15 + datcomVersionIndexOffset], cDataA, splittelegram[7], splittelegram[8], cDataB, Cycle.Double, Cycle.Single, TaskType.Infeed); return; } else { Log.Write(string.Join(",", splittelegram)); Log.Write("ERROR: 01 not handled by Experior.Catalog.Dematic.DatcomUK.Assemblies.MHEController_Multishuttle.Telegram01Recieved", Color.Red); } //Doesn't seem to do anything //if (datasets == 2 && splittelegram[7].Length > 0 && splittelegram[7].Substring(0, 1) != "R" && splittelegram[14 + datcomVersionIndexOffset].Length > 0 && splittelegram[14 + datcomVersionIndexOffset].Substring(0, 1) != "R") //{ // //switch D, E, I, O pos2 & pos1 // if (splittelegram[7].Contains("001") && splittelegram[14 + datcomVersionIndexOffset].Contains("002")) // { // //switch around! // string temp17 = splittelegram[13 + datcomVersionIndexOffset]; // string temp18 = splittelegram[14 + datcomVersionIndexOffset]; // string temp19 = splittelegram[15 + datcomVersionIndexOffset]; // string temp20 = splittelegram[26 + datcomVersionIndexOffset]; // string temp21 = splittelegram[27 + datcomVersionIndexOffset]; // splittelegram[13 + datcomVersionIndexOffset] = splittelegram[6]; // splittelegram[14 + datcomVersionIndexOffset] = splittelegram[7]; // splittelegram[15 + datcomVersionIndexOffset] = splittelegram[8]; // splittelegram[16 + datcomVersionIndexOffset] = splittelegram[9]; // splittelegram[17 + datcomVersionIndexOffset] = splittelegram[10]; // splittelegram[6] = temp17; // splittelegram[7] = temp18; // splittelegram[8] = temp19; // splittelegram[9] = temp20; // splittelegram[10] = temp21; // } //} #endregion //string originalPosition2; //string currentPosition2; //string destinationPosition2; //string missionStatus2; //string ULID2; //string originalPosition1; //string currentPosition1; //string destinationPosition1; //string missionStatus1; //string ULID1; //MultiShuttle multishuttle; //Case_Load caseload1, caseload2; //if (!VerifyReceivedMission(splittelegram, datasets, out originalPosition2, out currentPosition2, out destinationPosition2, out missionStatus2, out ULID2, // out originalPosition1, out currentPosition1, out destinationPosition1, out missionStatus1, out ULID1, out multishuttle, out caseload1, out caseload2)) //{ // return; //Reason is written to log in VerifyReceivedMission method //} }
private void SendULData() { foreach (MultiShuttle ms in multishuttles) { var dematicActionPoints = ms.ConveyorLocations.FindAll(x => x.Active); var caseLoads = dematicActionPoints.Select(x => x.ActiveLoad); foreach (Case_Load caseload in caseLoads) { CaseData cData = (CaseData)caseload.Case_Data; if (cData.CurrentPosition.Length == 0) { continue; } //MSC sends type 31 for every place (other than the PS) which has unit load data if (cData.CurrentPosition.Datcom_Location() == "P") { continue; } string body = CreateMissionDataSetBody(cData); SendTelegram("31", body, 1); if (cData.CurrentPosition.Length >= 10 && cData.CurrentPosition.Datcom_Location() == "I" && cData.CurrentPosition.Datcom_X_horizontal() == "002" && cData.DestinationPosition.Datcom_Location() != "I") { //Caseload is on infeed rack conveyor position 002. Destination is not Infeed so shuttle car has got a mission. Send 31 with current position = shuttle car and status 02 pending. //Remap will be sent from two locations: //1. From Rack Conveyor, present location is rack conveyor (pos2), status ‘00’ //2. From shuttle car, present location is shuttle car with mission status ‘02’ (Pending) //If mission is not also remapped from shuttle, MFH should re-send mission. //If mission reported from shuttle but status is not ’02’, remap should be failed. //If mission is remapped from shuttle only with status ‘02’. This should also cause remap failure. //Create telegram body with mission status 02 pending and current is shuttlecar string current = cData.CurrentPosition; string level = current.Substring(8, 2); cData.CurrentPosition = "S" + ms.AisleNumber + " " + level; cData.MissionStatus = "02"; body = CreateMissionDataSetBody(cData); //Restore current and mission status cData.CurrentPosition = current; cData.MissionStatus = "00"; SendTelegram("31", body, 1); } } foreach (PickStationConveyor conv in ms.PickStationConveyors) { //MSC sends type 35 for Pick Station unit loads DematicActionPoint ap1 = conv.LocationA; DematicActionPoint ap2 = conv.LocationB; if (ap2.Active) { Case_Load caseload2 = ap2.ActiveLoad as Case_Load; conv.psTimeoutTimer.Stop(); caseload2.Stop(); //update current position ((CaseData)caseload2.Case_Data).CurrentPosition = string.Format("P{0}{1}{2}001{3}", ap2.LocName.AisleNumber().ToString().PadLeft(2, '0'), ms.ElevatorGroup(ap2.LocName), (char)(ap2.LocName.Side()), //ap2.LocName.ConvPosition(), ap2.LocName.Level()); //TODO elevator group Case_Load caseload1 = ap1.ActiveLoad as Case_Load; if (caseload1 != null) { //update current position //update current position ((CaseData)caseload1.Case_Data).CurrentPosition = string.Format("P{0}{1}{2}002{3}", ap1.LocName.AisleNumber().ToString().PadLeft(2, '0'), ms.ElevatorGroup(ap1.LocName), (char)(ap1.LocName.Side()), //ap1.LocName.Datcom_X_horizontal(), ap1.LocName.Level()); //TODO elevator group } string body = CreatePickStationDataSetBody(caseload2, caseload1); SendTelegram("35", body, 1); } } } }
//aasyyxz: a=aisle, s = side, y = level, x = conv type see enum ConveyorTypes, Z = loc A or B e.g. 01R05OA //TODO refactor this nastyness public void CreateElevatorTask(string originA, string destA, CaseData cDataA, string originB, string destB, CaseData cDataB, Cycle loadCycle, Cycle unloadCycle, TaskType taskType) { ElevatorTask eT = new ElevatorTask(GetLoadIDFromCaseData(cDataA), GetLoadIDFromCaseData(cDataB)); char sourceConvType, destConvType; if (taskType == TaskType.Outfeed) { sourceConvType = (char)ConveyorTypes.OutfeedRack; destConvType = (char)ConveyorTypes.Drop; } else { sourceConvType = (char)ConveyorTypes.Pick; destConvType = (char)ConveyorTypes.InfeedRack; } eT.SourceLoadB = string.Format("{0}{1}{2}{3}B", originB.Datcom_Aisle(), originB.Datcom_Side(), originB.Datcom_Y_Vertical(), sourceConvType); eT.DestinationLoadB = string.Format("{0}{1}{2}{3}A", destB.Datcom_Aisle(), destB.Datcom_Side(), destB.Datcom_Y_Vertical(), destConvType); // eT.LoadB_ID = cDataB.ULID; eT.caseDataB = cDataB; var locB = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadB); if (locB != null && locB.Active) { ((Case_Load)locB.ActiveLoad).Case_Data = cDataB; // locB.ActiveLoad.Identification = cDataB.ULID; } else { Log.Write(string.Format("Multishuttle {0}: Cannot create elevator task as source location does not have load", originB.Datcom_Aisle())); } if (loadCycle == Cycle.Double) //just assuming that if you have a double load cycle then you have all the rest of the informatiom to go with it { eT.SourceLoadA = string.Format("{0}{1}{2}{3}A", originA.Datcom_Aisle(), originA.Datcom_Side(), originA.Datcom_Y_Vertical(), sourceConvType); eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B", destA.Datcom_Aisle(), destA.Datcom_Side(), destA.Datcom_Y_Vertical(), destConvType); //eT.LoadA_ID = cDataA.ULID; eT.caseDataA = cDataA; // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA; var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA); if (locA != null && locA.Active) { ((Case_Load)locA.ActiveLoad).Case_Data = cDataA; locA.ActiveLoad.Identification = cDataA.ULID; } } else if (loadCycle == Cycle.Single && unloadCycle == Cycle.Double) { eT.SourceLoadA = string.Format("{0}{1}{2}{3}B", originA.Datcom_Aisle(), originA.Datcom_Side(), originA.Datcom_Y_Vertical(), sourceConvType); eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B", destA.Datcom_Aisle(), destA.Datcom_Side(), destA.Datcom_Y_Vertical(), destConvType); // eT.LoadA_ID = cDataA.ULID; eT.caseDataA = cDataA; // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA; var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA); if (locA != null && locA.Active) { ((Case_Load)locA.ActiveLoad).Case_Data = cDataA; locA.ActiveLoad.Identification = cDataA.ULID; } } else if (loadCycle == Cycle.Single && unloadCycle == Cycle.Single && cDataA != null && cDataB != null) { eT.SourceLoadA = string.Format("{0}{1}{2}{3}B", originA.Datcom_Aisle(), originA.Datcom_Side(), originA.Datcom_Y_Vertical(), sourceConvType); eT.DestinationLoadA = string.Format("{0}{1}{2}{3}B", destA.Datcom_Aisle(), destA.Datcom_Side(), destA.Datcom_Y_Vertical(), destConvType); // eT.LoadA_ID = cDataA.ULID; eT.caseDataA = cDataA; // Case_Load.GetCaseFromULID(cDataA.ULID).Case_Data = cDataA; var locA = theMultishuttle.ConveyorLocations.Find(x => x.LocName == eT.SourceLoadA); if (locA != null && locA.Active) { ((Case_Load)locA.ActiveLoad).Case_Data = cDataA; locA.ActiveLoad.Identification = cDataA.ULID; } } eT.LoadCycle = loadCycle; eT.UnloadCycle = unloadCycle; eT.Flow = taskType; string elevatorName = string.Format("{0}{1}", destB.Datcom_Side(), destB.Datcom_Aisle()); theMultishuttle.elevators.First(x => x.ElevatorName == elevatorName).ElevatorTasks.Add(eT); //theMultishuttle.elevators[elevatorName].ElevatorTasks.Add(eT); }
/// Rack Location for an ElevatorTask takes the form: aasyyxz: a=aisle, s = side, y = level, x = input or output, Z = loc A or B e.g. 01R05OA /// Source location for a shuttleTask takes the form: sxxxyydd: Side, xxx location, yy = level, dd = depth public bool CreateShuttleTask(string origin, string dest, CaseData cData, ShuttleTaskTypes taskType) { ShuttleTask sT = new ShuttleTask(); if (taskType == ShuttleTaskTypes.RackToConv) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}{3}", origin.Datcom_Side(), origin.Datcom_X_horizontal(), origin.Datcom_Y_Vertical(), origin.Datcom_GroupOrDepth().PadLeft(2, '0')); sT.Destination = string.Format("{0}{1}{2}OA", dest.Datcom_Aisle(), dest.Datcom_Side(), dest.Datcom_Y_Vertical()); } else if (taskType == ShuttleTaskTypes.ConvToRack) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}IB", origin.Datcom_Aisle(), origin.Datcom_Side(), origin.Datcom_Y_Vertical()); sT.Destination = string.Format("{0}{1}{2}{3}", dest.Datcom_Side(), dest.Datcom_X_horizontal(), dest.Datcom_Y_Vertical(), dest.Datcom_GroupOrDepth().PadLeft(2, '0')); var loc = theMultishuttle.ConveyorLocations.Find(x => x.LocName == sT.Source); if (loc != null && loc.LocName.ConvType() == ConveyorTypes.InfeedRack && loc.Active && cData.ULID == loc.ActiveLoad.Identification) { ((Case_Load)loc.ActiveLoad).Case_Data = cData; } else { Log.Write(loc + " does not have an active load or the load is incorrect, ignoring message", Color.Red); //possibly an issue with VFC! return(false); } } else if (taskType == ShuttleTaskTypes.Shuffle) { int l = 0; int.TryParse(origin.Datcom_Y_Vertical(), out l); sT.Level = l; sT.Source = string.Format("{0}{1}{2}{3}", origin.Datcom_Side(), origin.Datcom_X_horizontal(), origin.Datcom_Y_Vertical(), origin.Datcom_GroupOrDepth().PadLeft(2, '0')); sT.Destination = string.Format("{0}{1}{2}{3}", dest.Datcom_Side(), dest.Datcom_X_horizontal(), dest.Datcom_Y_Vertical(), dest.Datcom_GroupOrDepth().PadLeft(2, '0')); } sT.LoadID = cData.ULID; sT.caseData = cData; sT.caseData.colour = Color.Blue; theMultishuttle.shuttlecars[sT.Source.LevelasInt()].ShuttleTasks.Add(sT); return(true); }