private void btnTR2Start_Click(object sender, EventArgs e) { TestFunctions.SaveMovements( TestFunctions.Check(MovementPlanner.pos.tr2.ToString(","), "", "4,5,100,100"), 22, "new"); }
private void btnTaIn_Click(object sender, EventArgs e) { //if (MessageBox.Show("database will be changed. random mid-size cylinder generated.\r\n Proceed ?", // "Attention", MessageBoxButtons.YesNo) == DialogResult.No) // return; CheckTrolleyCylinders(); Button btn = ((Button)sender); Cylinder cy = null; int ls_nr = 10 + int.Parse(btn.Tag.ToString()); if (ls_nr == 13 && btn.Text.ToLowerInvariant().Contains("big")) { cy = TestFunctions.PutBigNewRandomCylinderOnLoadingStation3a(998); } else { cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_nr); cy.Diameter = 777; if (btn.Text.ToLowerInvariant().Contains("small")) { cy.Diameter = 241; } if (btn.Text.ToLowerInvariant().Contains("big")) { cy.Diameter = 999; } cy.Update(); } if (cy != null) { TransportOrder ta = new TransportOrder(); ta.ID = TransportOrder.GetNextNegativeID(); ta.Cylinder_ID = (int)cy.ID; ta.Diameter = cy.Diameter; ta.JobNumber = "restart inside"; ta.Label = cy.Number; ta.ItemNumber = cy.ItemNumber; ta.TransportSource = TransportOrder.Destinations.Scanned; ta.TransportTarget = TransportOrder.Destinations.Storage; ta.LoadingStation = ls_nr; ta.Insert(); } }
private void testmoves_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (e.ColumnIndex == 5) { TestMoveLine tml = testmoves.Rows[e.RowIndex].DataBoundItem as TestMoveLine; string from = tml.From.ToUpperInvariant(); string to = tml.To.ToUpperInvariant(); int ls_id = 0; int unit_id = 21; bool going_inside = false; string trolley_nr = tml.Unit.ToUpperInvariant().Trim(); if (trolley_nr == "TR1") { unit_id = 21; } if (trolley_nr == "TR2") { unit_id = 22; } if (trolley_nr == "TR3") { unit_id = 23; } if (trolley_nr == "CR1") { unit_id = 31; } if (trolley_nr == "CR2") { unit_id = 32; } if (unit_id >= 21 && unit_id <= 23) { int order_count = Main.Database.ExecuteScalar <int>("SELECT COUNT(*) FROM StorageOrders WHERE ABS(trolley) = @0", unit_id); if (order_count == 0) { CheckTrolleyCylinders(unit_id); } } string left = from.Trim(); string right = to.Trim(); string ls1 = Hook.LS01.ToString(","); string ls2 = Hook.LS02.ToString(","); string ls3 = Hook.LS03.ToString(","); if (trolley_nr.StartsWith("CYL")) { var cyl = TestFunctions.PutNewRandomCylinderOnHook(to); if (from == "SMALL") { cyl.Diameter = 230; cyl.Update(); } return; } if (left == "MOVE") { string pos = ""; if (unit_id == 21) { pos = MovementPlanner.pos.tr1.ToString(","); } if (unit_id == 22) { pos = MovementPlanner.pos.tr2.ToString(","); } if (unit_id == 23) { pos = MovementPlanner.pos.tr3.ToString(","); } if (unit_id == 31) { pos = MovementPlanner.pos.cr1.ToString(","); } if (unit_id == 32) { pos = MovementPlanner.pos.cr2.ToString(","); } if (trolley_nr.StartsWith("CR")) { MoveOrderEntry move = new MoveOrderEntry() { ID = MoveOrderEntry.GetNextId(), Source = "", TargetHook = new Hook(to), Unit_ID = unit_id, WaitMove_ID = 0, Status = "new", Trolley = 0, Carrier = 0 }; move.Insert(); } else { TestFunctions.SaveMovements(TestFunctions.Check(pos, "", to), unit_id, "new"); } LoadGridData(); return; } if (left.Contains(",")) { going_inside = false; from = left; TestFunctions.PutNewRandomCylinderOnHook(from); } if (right.Contains(",")) { going_inside = true; to = right; new Hook(right).ClearID(); } Cylinder cy = null; int diameter = 0; if (tml.Button.ToLowerInvariant().Contains("big")) { diameter = 1001; } if (tml.Button.ToLowerInvariant().Contains("small")) { diameter = 230; } if (left == "LS1") { ls_id = 11; from = ls1; cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_id, diameter); } if (left == "LS2") { ls_id = 12; from = ls2; cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_id, diameter); } if (left == "LS3") { ls_id = 13; from = ls3; cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_id, diameter); } if (right == "LS1") { ls_id = 11; to = ls1; Unit.GetUnit(ls_id).ClearOrderData(); Hook.LoadingStation(ls_id).ClearID(); } if (right == "LS2") { ls_id = 12; to = ls2; Unit.GetUnit(ls_id).ClearOrderData(); Hook.LoadingStation(ls_id).ClearID(); } if (right == "LS3") { ls_id = 13; to = ls3; Unit.GetUnit(ls_id).ClearOrderData(); Hook.LoadingStation(ls_id).ClearID(); } if (left != "MOVE" && cy == null) { cy = TestFunctions.PutNewRandomCylinderOnHook(from); if (ls_id == 0) { new Hook(right).ClearID(); } } if (going_inside) { TransportOrder ta = new TransportOrder(); ta.ID = TransportOrder.GetNextNegativeID(); ta.Cylinder_ID = (int)cy.ID; ta.Diameter = cy.Diameter; ta.JobNumber = "restart inside"; ta.ItemNumber = cy.ItemNumber; ta.TransportSource = ls_id == 0 ? TransportOrder.Destinations.Storage : TransportOrder.Destinations.Scanned; ta.TransportTarget = TransportOrder.Destinations.Storage; ta.TargetHook = right; if (ls_id == 0) { ta.SourceHook = left; ta.JobNumber = "rearrange"; } ta.LoadingStation = ls_id; ta.trolley = -unit_id; var hook = new Hook(right); var rack = hook.GetRack(); if (rack != null) { rack.Order_ID = ta.ID; rack.Update(); } ta.Insert(); } if (!going_inside) // outside { cy = new Hook(left).Cylinder; if (cy != null) { if (ls_id > 0) { Hook ls_in = Hook.LoadingStation(ls_id, inside: true); ls_in.CylinderID = 0; } TransportOrder ta = new TransportOrder(); ta.ID = TransportOrder.GetNextNegativeID(); ta.Cylinder_ID = (int)cy.ID; ta.Diameter = cy.Diameter; ta.JobNumber = cy.JobNumber; ta.ItemNumber = cy.ItemNumber; if (ls_id != 0) { ta.TransportSource = TransportOrder.Destinations.Storage; ta.TransportTarget = TransportOrder.Destinations.Laminator; } else { ta.TransportSource = TransportOrder.Destinations.Storage; ta.TransportTarget = TransportOrder.Destinations.Storage; ta.SourceHook = left; ta.TargetHook = right; } ta.LoadingStation = ls_id; ta.trolley = -unit_id; ta.Insert(); } } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void TestMove(object sender, EventArgs e) { try { string from = ""; string to = ""; int ls_id = 0; int tr_id = 21; bool going_inside = false; string from_to = ((Button)sender).Text; string trolley_nr = ((Button)sender).Tag.ToString(); if (trolley_nr == "1") { tr_id = 21; } if (trolley_nr == "2") { tr_id = 22; } if (trolley_nr == "3") { tr_id = 23; } string left = from_to.Split('-')[0].Trim(); string right = from_to.Split('>')[1].Trim(); string ls1 = Hook.LS01.ToString(","); string ls2 = Hook.LS02.ToString(","); if (left.Contains(",")) { going_inside = false; from = left; TestFunctions.PutNewRandomCylinderOnHook(from); } if (right.Contains(",")) { going_inside = true; to = right; new Hook(right).ClearID(); } Cylinder cy = null; if (left == "LS1") { ls_id = 11; from = ls1; cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_id); } if (left == "LS2") { ls_id = 12; from = ls2; cy = TestFunctions.PutNewRandomCylinderOnLoadingStation(ls_id); } if (right == "LS1") { ls_id = 11; to = ls1; Unit.GetUnit(ls_id).ClearOrderData(); Hook.LoadingStation(ls_id).ClearID(); } if (right == "LS2") { ls_id = 12; to = ls2; Unit.GetUnit(ls_id).ClearOrderData(); Hook.LoadingStation(ls_id).ClearID(); } if (going_inside) { TransportOrder ta = new TransportOrder(); ta.ID = TransportOrder.GetNextNegativeID(); ta.Cylinder_ID = (int)cy.ID; ta.Diameter = cy.Diameter; ta.JobNumber = "restart inside"; ta.ItemNumber = cy.ItemNumber; ta.TransportSource = TransportOrder.Destinations.Scanned; ta.TransportTarget = TransportOrder.Destinations.Storage; ta.TargetHook = right; ta.LoadingStation = ls_id; ta.trolley = -tr_id; var hook = new Hook(right); var rack = hook.GetRack(); rack.Order_ID = ta.ID; rack.Update(); ta.Insert(); } if (!going_inside) // outside { cy = new Hook(left).Cylinder; if (cy != null) { Hook ls_in = Hook.LoadingStation(ls_id, inside: true); ls_in.CylinderID = 0; TransportOrder ta = new TransportOrder(); ta.ID = TransportOrder.GetNextNegativeID(); ta.Cylinder_ID = (int)cy.ID; ta.Diameter = cy.Diameter; ta.JobNumber = cy.JobNumber; ta.ItemNumber = cy.ItemNumber; ta.TransportSource = TransportOrder.Destinations.Storage; ta.TransportTarget = TransportOrder.Destinations.Laminator; ta.LoadingStation = ls_id; ta.trolley = -tr_id; ta.Insert(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnRandomCylinderOnLS1_Click(object sender, EventArgs e) { Button btn = sender as Button; TestFunctions.PutNewRandomCylinderOnLoadingStation(int.Parse(btn.Tag.ToString())); }