You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
2.1 KiB
C#

using Mesnac.Compressor.Data;
using Mesnac.Compressor.Entity;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
namespace Mesnac.Compressor.Station
{
public class LastStation : Common, IStation
{
public bool HandleData(StationInfo station)
{
try
{
if (!CheckNewData(station, ""))
{
ICSharpCode.Core.LoggingService.Debug("工位:" + station.StationCode + "的RFID" + station.Data.RFIDNo + "数据已上传。条码号:" + station.Data.ProductBarcode + " 任务号:" + station.Data.MaskID.ToString());
return false;
}
//保存数据
base.SaveStationData(station);
UpdateTrace(station);
}
catch (Exception e)
{
ICSharpCode.Core.LoggingService.Error(e.ToString());
return false;
}
return true;
}
public void UpdateTrace(StationInfo station)
{
StringBuilder sb = new StringBuilder();
try
{
DbHandler db = new DbHandler();
db.dbHelper.ClearParameter();
db.dbHelper.CommandType = CommandType.Text;
db.dbHelper.CommandText = "";
string sql = "EXEC SP_Pro_SaveProductionInfo @RFID,@productid";
db.dbHelper.AddParameter("@RFID", station.Data.RFIDNo);
db.dbHelper.AddParameter("@productid", station.Data.machineID);
db.dbHelper.CommandText = sql;
db.dbHelper.ExecuteNonQuery();
ICSharpCode.Core.LoggingService.Debug("结束工位更新条码信息"+ sql+"RFID"+ station.Data.RFIDNo+ "productid"+ station.Data.machineID);
}
catch (Exception e)
{
ICSharpCode.Core.LoggingService.Error("获取条码语句错误:" + sb.ToString() + "/r/n" + e.ToString());
return;
}
}
}
}