|
|
using Mesnac.Compressor.Entity;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
|
|
|
namespace Mesnac.Compressor.Station
|
|
|
{
|
|
|
public class ChangeLineStation : Common, IStation
|
|
|
{
|
|
|
//public bool HandleData(StationInfo station)
|
|
|
//{
|
|
|
// try
|
|
|
// {
|
|
|
// if (string.IsNullOrEmpty(station.Data.ProductBarcode))
|
|
|
// {
|
|
|
// ICSharpCode.Core.LoggingService.Error(station.StationCode + "换线工位:条码为空");
|
|
|
// return false;
|
|
|
// }
|
|
|
// string mainbarcode = GetMainBarcode(station.Data.ProductBarcode);
|
|
|
// base.UpdateTray(station.Data.RFIDNo, mainbarcode, station.Data.ProductBarcode);
|
|
|
// InsertHistoryTray(station.Data.RFIDNo, station.Data.ProductBarcode, station.stationID);
|
|
|
// //保存数据
|
|
|
// base.SaveStationData(station);
|
|
|
// }
|
|
|
// catch (Exception e)
|
|
|
// {
|
|
|
// ICSharpCode.Core.LoggingService.Error(e.ToString());
|
|
|
// return false;
|
|
|
// }
|
|
|
// return true;
|
|
|
//}
|
|
|
|
|
|
|
|
|
public bool HandleData(StationInfo station)
|
|
|
{
|
|
|
try
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Debug("换线工位:" + station.stationID + ",托盘号:" + station.Data.RFIDNo + ",条码:" + station.Data.ProductBarcode +"命令序号:"+ station.Data.MaskID);
|
|
|
if (string.IsNullOrEmpty(station.Data.ProductBarcode))
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error(station.StationCode + "换线工位:条码为空");
|
|
|
return false;
|
|
|
}
|
|
|
station.Data.semibacode= getSemiBacode(station.Data.ProductBarcode);
|
|
|
|
|
|
if (!CheckNewData(station, station.Data.semibacode))
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Debug("工位:" + station.StationCode + "的RFID:" + station.Data.RFIDNo + "数据已上传。 任务号:" + station.Data.MaskID.ToString());
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
string mainBarcode;
|
|
|
if (station.Data.Restart)
|
|
|
{
|
|
|
mainBarcode = base.CreatNewProduct(station);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
mainBarcode = GetMainBarcode(station.Data.semibacode);
|
|
|
}
|
|
|
base.UpdateTray(station.Data.RFIDNo, mainBarcode, station.Data.semibacode);
|
|
|
InsertHistoryTray(station.Data.RFIDNo, station.Data.semibacode, station.stationID);
|
|
|
//保存数据
|
|
|
base.SaveStationData(station);
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
|
ICSharpCode.Core.LoggingService.Error(e.ToString());
|
|
|
return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}
|