using HslCommunication;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using yunneiWCS.EnumDefine;
|
|
namespace yunneiWCS.data
|
{
|
/// <summary>
|
/// 输送线服务
|
/// </summary>
|
public class TransService
|
{
|
/// <summary>
|
/// 写入上料完成信号
|
/// </summary>
|
public static void LoadMaterialConfirm(int index)
|
{
|
//首先写入 地址记忆
|
var address_GJJY = convDBS.convDBs[index].W_GJJY;
|
OperateResult result = Form1.siemensTcpNet_tran.Write(address_GJJY, true);
|
if (result.IsSuccess == false)
|
{
|
throw new Exception("写入地址" + address_GJJY + "的值true失败," + result.Message);
|
}
|
//其次写入 放料完成信号
|
var address_LoadMaterialConfirm = convDBS.convDBs[index].W_LoadMaterialConfirm;
|
result = Form1.siemensTcpNet_tran.Write(address_LoadMaterialConfirm, true);
|
if (result.IsSuccess == false)
|
{
|
throw new Exception("写入地址" + address_LoadMaterialConfirm + "的值true失败," + result.Message);
|
}
|
}
|
|
/// <summary>
|
/// 清除工件记忆信号
|
/// </summary>
|
public static void ClearGJJY(int index)
|
{
|
//首先写入 地址记忆
|
var address_GJJY = convDBS.convDBs[index].W_GJJY;
|
OperateResult result = Form1.siemensTcpNet_tran.Write(address_GJJY, false);
|
if (result.IsSuccess == false)
|
{
|
throw new Exception("写入地址" + address_GJJY + "的值false失败," + result.Message);
|
}
|
}
|
|
/// <summary>
|
/// 写入产量
|
/// </summary>
|
/// <param name="allQty"></param>
|
/// <param name="todayQty"></param>
|
public static void WriteQty(int allQty, int todayQty, int monthQty)
|
{
|
try
|
{
|
int index = 0;
|
var address_W_All_Qty = convDBS.convDBs[index].W_All_Qty;
|
if (Form1.siemensTcpNet_tran == null)
|
{
|
return;
|
}
|
OperateResult result = Form1.siemensTcpNet_tran.Write(address_W_All_Qty, allQty);
|
|
var address_W_Today_Qty = convDBS.convDBs[index].W_Today_Qty;
|
result = Form1.siemensTcpNet_tran.Write(address_W_Today_Qty, todayQty);
|
|
var address_W_Month_Qty = convDBS.convDBs[index].W_Month_Qty;
|
result = Form1.siemensTcpNet_tran.Write(address_W_Month_Qty, monthQty);
|
}
|
catch
|
{
|
//吞掉异常
|
throw;
|
}
|
}
|
}
|
}
|