123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192 |
- 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;
- /// <summary>
- /// 有一粒进入瓶子
- /// </summary>
- /// <returns></returns>
- public bool SetOneActiveToFirstBoot()
- {
- bool result = false;
- KeLiNum++;
- FirstBottCount++;
- if (FirstBottCount >= OneBottNum)
- {
- result = true;
- }
- return result;
- }
- /// <summary>
- /// 有一粒进入旋转阀门
- /// </summary>
- /// <returns></returns>
- public bool SetOneActiveToSecondBoot()
- {
- bool result = false;
- KeLiNum++;
- SecondBottCount++;
- if (SecondBottCount >= OneBottNum)
- {
- result = true;
- }
- return result;
- }
- /// <summary>
- /// 有一粒进入通道
- /// </summary>
- /// <returns></returns>
- public bool SetOneActiveToThirdBoot()
- {
- bool result = false;
- KeLiNum++;
- ThirdBottCount++;
- if (ThirdBottCount >= OneBottNum)
- {
- result = true;
- }
- return result;
- }
- /// <summary>
- /// 有一粒进入汽缸阀门
- /// </summary>
- /// <returns></returns>
- public bool SetOneActiveToFourthBoot()
- {
- bool result = false;
- KeLiNum++;
- FourthBottCount++;
- if (FourthBottCount >= OneBottNum*0.9)
- {
- result = true;
- }
- return result;
- }
- /// <summary>
- /// 计数清零
- /// </summary>
- public void ClearCount()
- {
- KeLiNum = 0;
- BottNum = 1;
- FirstBottCount = 0;
- SecondBottCount = 0;
- ThirdBottCount = 0;
- FourthBottCount = 0;
- }
- /// <summary>
- /// 瓶子计数清零
- /// </summary>
- public void ClearFirstBottCount()
- {
- FirstBottCount = 0;
- }
- /// <summary>
- /// 旋转阀门计数清零
- /// </summary>
- public void ClearSecondBottCount()
- {
- SecondBottCount = 0;
- }
- /// <summary>
- /// 通道计数清零
- /// </summary>
- public void ClearThirdBottCount()
- {
- ThirdBottCount = 0;
- }
- // <summary>
- /// 汽缸阀门计数清零
- /// </summary>
- public void ClearFourthBottCount()
- {
- FourthBottCount = 0;
- }
- /// <summary>
- /// 获取瓶子状态
- /// </summary>
- /// <returns></returns>
- public bool GetFirstBottState()
- {
- return FirstBottCount >= OneBottNum;
- }
- /// <summary>
- /// 获取旋转阀门状态
- /// </summary>
- /// <returns></returns>
- public bool GetSecondBottState()
- {
- return SecondBottCount >= OneBottNum;
- }
- /// <summary>
- /// 获取通道状态
- /// </summary>
- public bool GetThirdBottState()
- {
- return ThirdBottCount >= OneBottNum;
- }
- /// <summary>
- /// 获取汽缸阀门状态
- /// </summary>
- public bool GetFourthBottState()
- {
- return FourthBottCount >= (OneBottNum*0.9);
- }
- /// <summary>
- /// bottle完成一瓶
- /// </summary>
- public void FinishOnBott()
- {
- BottNum++;
- }
- /// <summary>
- /// 修改每瓶粒数
- /// </summary>
- /// <param name="num"></param>
- public void ChangeOneBottNum(int num)
- {
- OneBottNum = num;
- }
- public void MoveFourthToThirdCount()
- {
- ThirdBottCount += FourthBottCount;
- FourthBottCount = 0;
- }
- }
- }
|