using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using wcftest.orm;
|
|
namespace wcftest.BussinessExtension.Handle
|
{
|
public class Base_EquipmentHandler
|
{
|
/// <summary>
|
/// 验证叠盘机是否已满
|
/// </summary>
|
/// <param name="mod"></param>
|
/// <param name="plateType"></param>
|
/// <param name="equipment"></param>
|
/// <returns>true:已满</returns>
|
public static bool FoldingPlateMachine_IsFull(dbModel mod, int plateType, ref Base_Equipment equipment)
|
{
|
try
|
{
|
var diePanJiModel = ExtendHelper.GetDeviceCodeForDiePanJi(plateType);
|
if (diePanJiModel != null)
|
{
|
equipment = mod.Base_Equipment.Where(x => x.DeviceCode == diePanJiModel.DeviceCode).FirstOrDefault();
|
if (equipment != null)
|
{
|
if (Convert.ToInt32(equipment.SurplusQuantity) >= Convert.ToInt32(diePanJiModel.FullQuantity))
|
{//说明已经是满状态了
|
return true;
|
}
|
}
|
}
|
|
}
|
catch (Exception)
|
{
|
|
}
|
return false;
|
}
|
|
/// <summary>
|
/// 更新数量为0
|
/// </summary>
|
/// <param name="mod"></param>
|
/// <param name="plateType"></param>
|
public static void FoldingPlateMachine_UpdateCurQuantityZero(dbModel mod, int plateType)
|
{
|
try
|
{
|
var diePanJiModel = ExtendHelper.GetDeviceCodeForDiePanJi(plateType);
|
if (diePanJiModel != null)
|
{
|
var equipment = mod.Base_Equipment.Where(x => x.DeviceCode == diePanJiModel.DeviceCode).FirstOrDefault();
|
if (equipment != null)
|
{
|
equipment.SurplusQuantity = 0;//更新为0
|
equipment.Modifier = "调度";
|
equipment.ModifyDate = DateTime.Now;
|
equipment.Remark = "叠盘机已空,数量改为0";
|
}
|
}
|
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
|
/// <summary>
|
/// 更新数量+1
|
/// </summary>
|
/// <param name="mod"></param>
|
/// <param name="plateType"></param>
|
public static void FoldingPlateMachine_UpdateCurQuantityAddOne(dbModel mod, Base_Equipment equipment)
|
{
|
try
|
{
|
if (equipment != null)
|
{
|
equipment.SurplusQuantity = Convert.ToInt32(equipment.SurplusQuantity) + 1;//增加数量1
|
equipment.Modifier = "调度";
|
equipment.ModifyDate = DateTime.Now;
|
equipment.Remark = "叠盘+1,修改数量为" + equipment.SurplusQuantity;
|
}
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
}
|
}
|