/// <summary> /// Author: liyi /// Date: 2019/09/11 /// Description: 检查胶水状态 /// 1.刷新胶水剩余寿命 /// 2.刷新胶水剩余量 /// 3.判断是否预警(剩余量和时间) /// 4.判断胶水是否可以继续使用(剩余量和时间) /// </summary> public void CheckGlueStatue() { GlueManagePrm prm = GlueManagePrmMgr.Instance.FindBy(this.key); if (!prm.UseGlueManage || (Machine.Instance.Setting.ValveSelect != ValveSelection.双阀 && this.key == 1)) { return; } double remainLife = prm.GlueRemainLife; double remainWeight = prm.RemainWeight; double totalWeight = prm.TotalWeight; double thawTime = prm.GlueThawTime; DateTime deliverTime = prm.GlueDeliverTime; double lifeWarningTime = prm.LifeWarningTime; double WarningWeight = prm.TotalWeight * prm.WarningPercentage / 100; int warningCode = 0; // 胶水寿命到期 if (remainLife < 1) { // 报警停机 warningCode = 1; } else if (remainLife < lifeWarningTime) { // 寿命预警提示 warningCode = 2; } // 胶水剩余量用完 if (remainWeight < 10) { // 报警停机 warningCode = 1; } else if (remainWeight < WarningWeight) { // 重量预警提示 warningCode = 2; } // 胶水回温时间不够 if ((DateTime.Now - deliverTime).TotalMinutes < thawTime) { // 胶水回温时间不足,禁止运行 } }
/// <summary> /// 更新胶水参数(时间参数,重量参数由外部点胶控制) /// 1.寿命时间 /// 2.使用时间 /// 3.回温时间 /// </summary> public void UpdatePrm() { GlueManagePrm prm = GlueManagePrmMgr.Instance.FindBy(this.key); if (!prm.UseGlueManage || (Machine.Instance.Setting.ValveSelect != ValveSelection.双阀 && this.key == 1)) { return; } double glueLife = prm.GlueLife; DateTime glueDeliverTime = prm.GlueDeliverTime; double remainLife = glueLife - (DateTime.Now - glueDeliverTime).TotalMinutes; if (remainLife < 1) { prm.GlueRemainLife = 0; } else { prm.GlueRemainLife = remainLife; } }