using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CCDCount.DLL
{
public class BottingClass
{
// 计数,总粒数
private int KeLiNum = 0;
// 当前第几瓶
private int BottNum = 1;
// 传送带瓶颗粒数量
private int FirstBottCount = 0;
// 旋转阀门颗粒数量
private int SecondBottCount = 0;
// 通道内颗粒数量
private int ThirdBottCount = 0;
// 汽缸阀门上颗粒数量
private int FourthBottCount = 0;
// 一瓶应该多少粒
private int OneBottNum = 30;
///
/// 有一粒进入瓶子
///
///
public bool SetOneActiveToFirstBoot()
{
bool result = false;
KeLiNum++;
FirstBottCount++;
if (FirstBottCount >= OneBottNum)
{
result = true;
}
return result;
}
///
/// 有一粒进入旋转阀门
///
///
public bool SetOneActiveToSecondBoot()
{
bool result = false;
KeLiNum++;
SecondBottCount++;
if (SecondBottCount >= OneBottNum)
{
result = true;
}
return result;
}
///
/// 有一粒进入通道
///
///
public bool SetOneActiveToThirdBoot()
{
bool result = false;
KeLiNum++;
ThirdBottCount++;
if (ThirdBottCount >= OneBottNum)
{
result = true;
}
return result;
}
///
/// 有一粒进入汽缸阀门
///
///
public bool SetOneActiveToFourthBoot()
{
bool result = false;
KeLiNum++;
FourthBottCount++;
if (FourthBottCount >= OneBottNum*0.9)
{
result = true;
}
return result;
}
///
/// 计数清零
///
public void ClearCount()
{
KeLiNum = 0;
BottNum = 1;
FirstBottCount = 0;
SecondBottCount = 0;
ThirdBottCount = 0;
FourthBottCount = 0;
}
///
/// 瓶子计数清零
///
public void ClearFirstBottCount()
{
FirstBottCount = 0;
}
///
/// 旋转阀门计数清零
///
public void ClearSecondBottCount()
{
SecondBottCount = 0;
}
///
/// 通道计数清零
///
public void ClearThirdBottCount()
{
ThirdBottCount = 0;
}
//
/// 汽缸阀门计数清零
///
public void ClearFourthBottCount()
{
FourthBottCount = 0;
}
///
/// 获取瓶子状态
///
///
public bool GetFirstBottState()
{
return FirstBottCount >= OneBottNum;
}
///
/// 获取旋转阀门状态
///
///
public bool GetSecondBottState()
{
return SecondBottCount >= OneBottNum;
}
///
/// 获取通道状态
///
public bool GetThirdBottState()
{
return ThirdBottCount >= OneBottNum;
}
///
/// 获取汽缸阀门状态
///
public bool GetFourthBottState()
{
return FourthBottCount >= (OneBottNum*0.9);
}
///
/// bottle完成一瓶
///
public void FinishOnBott()
{
BottNum++;
}
///
/// 修改每瓶粒数
///
///
public void ChangeOneBottNum(int num)
{
OneBottNum = num;
}
public void MoveFourthToThirdCount()
{
ThirdBottCount += FourthBottCount;
FourthBottCount = 0;
}
}
}