Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1208 #4

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions Amazoom/Amazoom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{6D17A2E5-6EBC-451E-A991-64D440D8FE66}</ProjectGuid>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<RootNamespace>Amazoom</RootNamespace>
<AssemblyName>Amazoom</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
Expand All @@ -32,6 +32,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -46,15 +49,17 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Item\all.cs" />
<Compile Include="Item\dock.cs" />
<Compile Include="Item\goods.cs" />
<Compile Include="Item\inventory.cs" />
<Compile Include="Item\maintest.cs" />
<Compile Include="Motion\main1.cs" />
<Compile Include="Item\order.cs" />
<Compile Include="Item\totalList.cs" />
<Compile Include="Item\Truck.cs" />
<Compile Include="Motion\robot.cs" />
<Compile Include="Motion\robotHelperFunction.cs" />
<Compile Include="Motion\robotics.cs" />
<Compile Include="Motion\warehouseMapInfo.cs" />
<Compile Include="Winform\Alert.cs">
<SubType>Form</SubType>
Expand All @@ -74,12 +79,30 @@
<Compile Include="Winform\customer2.Designer.cs">
<DependentUpon>customer2.cs</DependentUpon>
</Compile>
<Compile Include="Winform\Customer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Winform\Customer.designer.cs">
<DependentUpon>Customer.cs</DependentUpon>
</Compile>
<Compile Include="Winform\manager.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Winform\manager.Designer.cs">
<DependentUpon>manager.cs</DependentUpon>
</Compile>
<Compile Include="Winform\Home.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Winform\Home.Designer.cs">
<DependentUpon>Home.cs</DependentUpon>
</Compile>
<Compile Include="Winform\ManagerNew.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Winform\ManagerNew.Designer.cs">
<DependentUpon>ManagerNew.cs</DependentUpon>
</Compile>
<Compile Include="Winform\managerOverall.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -115,9 +138,18 @@
<EmbeddedResource Include="Winform\customer2.resx">
<DependentUpon>customer2.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Winform\Customer.resx">
<DependentUpon>Customer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Winform\manager.resx">
<DependentUpon>manager.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Winform\Home.resx">
<DependentUpon>Home.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Winform\ManagerNew.resx">
<DependentUpon>ManagerNew.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Winform\managerOverall.resx">
<DependentUpon>managerOverall.cs</DependentUpon>
</EmbeddedResource>
Expand Down
148 changes: 78 additions & 70 deletions Amazoom/Item/Truck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,127 +15,135 @@ public class Truck
// num of load: [2 3 5 6]
// itemontruck: [1 5 4 7] means this truck have item 1,5,4,7 and the number of them is 2 3 5 6
public bool isrestock; // true for restocking truck
public int maxcapacity;
public int itemsIntruck;


public Truck(bool empty, List<int> itemontruck, List<int> numofload, bool isrestock)
public Truck(int maxcapacity, int itemsIntruck)
{
this.isempty = empty;
this.itemontruck = itemontruck; //important! the order of itemontruck and numofload must be aligned.
//i.e. [item1 item2] and [50 100] means there are 50 of item1 and 100 of item2 are on the truck
this.numofload = numofload;
this.isrestock = isrestock;
this.maxcapacity = maxcapacity;
this.itemsIntruck = itemsIntruck;
}


public static bool isready(Truck truckname)
{
bool isok = false;
//check if the truck is ready to leave

if (truckname.isrestock == true)
{
isok = checkempty(truckname);
}
else
{
isok = checkfull(truckname);
}
return isok;
}
//public Truck(bool empty, List<int> itemontruck, List<int> numofload, bool isrestock)
//{
// this.isempty = empty;
// this.itemontruck = itemontruck; //important! the order of itemontruck and numofload must be aligned.
// //i.e. [item1 item2] and [50 100] means there are 50 of item1 and 100 of item2 are on the truck
// this.numofload = numofload;
// this.isrestock = isrestock;
//}


//public static bool isready(Truck truckname)
//{
// bool isok = false;
// //check if the truck is ready to leave

public static bool checkempty(Truck truckname)
{
bool isempty = false;
// if (truckname.isrestock == true)
// {
// isok = checkempty(truckname);
// }
// else
// {
// isok = checkfull(truckname);
// }
// return isok;
//}


if (truckname.numofload.Take(truckname.numofload.Count).Sum() == 0)
{

isempty = true;
//public static bool checkempty(Truck truckname)
//{
// bool isempty = false;

}

// if (truckname.numofload.Take(truckname.numofload.Count).Sum() == 0)
// {

// isempty = true;

// }

return isempty;
}


public static bool checkfull(Truck truckname)
{

bool isfull = false;
int capacity = 10; //note this maybe user-dependent or might be changed by the program
// return isempty;
//}


if (truckname.numofload.Take(truckname.numofload.Count).Sum() == capacity)
{
//public static bool checkfull(Truck truckname)
//{

isfull = true;
// bool isfull = false;
// int capacity = 10; //note this maybe user-dependent or might be changed by the program

}

// if (truckname.numofload.Take(truckname.numofload.Count).Sum() == capacity)
// {

// isfull = true;

// }

return isfull;


}

// return isfull;

/* public static int totaltime(int[] numofload, bool isrestock) {

int totalt=0;
//}

for (int i = 0; i < numofload.Length; i++) {

if (isrestock)
{
totalt += numofload[i];
}
else {
totalt += numofload[i];
///* public static int totaltime(int[] numofload, bool isrestock) {

}
// int totalt=0;

}
// for (int i = 0; i < numofload.Length; i++) {

return totalt;
}*/
// if (isrestock)
// {
// totalt += numofload[i];
// }
// else {
// totalt += numofload[i];

// }

public static void changeload(Truck truckname, int pickupnum, goods itemtochange, bool isstock)
{
//if isstock is true, means it is a restocking truck and we are trying to pickup from the truck,
//so decrease the goods number from the truck --> and add load to the robot
//how many items and which item is picked up needs to be specified
//if isstock is false, means it is a delivery truck and we are trying to add items to the truck
//so increase the goods --> decrease the load of the robot near it.
//also need to add goods
// }

if (isstock)
{
// return totalt;
// }*/


//robot load ++
//public static void changeload(Truck truckname, int pickupnum, goods itemtochange, bool isstock)
//{
// //if isstock is true, means it is a restocking truck and we are trying to pickup from the truck,
// //so decrease the goods number from the truck --> and add load to the robot
// //how many items and which item is picked up needs to be specified
// //if isstock is false, means it is a delivery truck and we are trying to add items to the truck
// //so increase the goods --> decrease the load of the robot near it.
// //also need to add goods

}
else
{
// if (isstock)
// {


// //robot load ++

// }
// else
// {

}



// }

}



//}



Expand Down
89 changes: 89 additions & 0 deletions Amazoom/Item/all.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Amazoom.Item
{
class all
{
public int posX;
public int posY;
public string name;


goods item1 = new goods(1, "item1", 1, 1);
goods item2 = new goods(1, "item2", 3, 2);
goods item3 = new goods(1, "item3", 5, 4);
goods item4 = new goods(1, "item4", 7, 1);
goods item5 = new goods(1, "item5", 2, 3);
goods item6 = new goods(1, "item6", 4, 3);

List<goods> allItems = new List<goods>();
List<goods> items = new List<goods>();

public List<goods> addStocks(int num, int mapX, int mapY)
{
int X = -1, Y = 0;

for(int i = 0; i < num; i++)
{
int quantity = 1;
string name = "item" + i.ToString();



if (X >= mapX-1)
{
Y++;
X = 0;
if (Y > mapY-1)
{
Y = 0;
}
}
else
{
//Y++;
X++;
if (Y > mapY-1)
{
Y = 0;
X = 0;
}


}

items.Add(new goods(quantity, name, X, Y));
}

return items;
}


public void Initialize()
{
allItems.Add(item1);
allItems.Add(item2);
allItems.Add(item3);
allItems.Add(item4);
allItems.Add(item5);
allItems.Add(item6);
}

public List<goods> addItems(int num, string name, int x, int y)
{
allItems.Add(new goods(num, name, x, y));
return allItems;
}


public List<goods> getAll()
{
return allItems;
}
}

}
Loading