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.

76 lines
3.0 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using Mesnac.Compressor.Data;
using Mesnac.Compressor.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Mesnac.Compressor.Station
{
public class FirstStation : Common, IStation
{
public bool HandleData(StationInfo station)
{
try
{
//if (!CheckNewData(station, station.Data.semibacode))
//{
// ICSharpCode.Core.LoggingService.Debug("工位:" + station.StationCode + "的RFID" + station.Data.RFIDNo + "数据已上传过。任务号:" + station.Data.MaskID.ToString());
// return false;
//}
if (station.Data.Restart)
{
ICSharpCode.Core.LoggingService.Debug("重投数据");
station.Data.semibacode = getSemiBacode(station.Data.ProductBarcode);
}
else
{
station.Data.semibacode = CreatNewSemibarcode(station.barcodeHead,station.lineID);
ICSharpCode.Core.LoggingService.Debug("非重投Head:"+ station.barcodeHead+ "支线ID:"+ station.lineID+"生成支线条码:"+ station.Data.semibacode);
}
string mainBarcode = "";
if (station.IfMainline)
{
ICSharpCode.Core.LoggingService.Debug("主线");
//创建新的产品
mainBarcode = CreatNewProduct(station);
DbHandler db = new DbHandler();
db.InsertTrace(mainBarcode, station.Data.semibacode, station.Data.machineID.ToString());
}
InsertHistoryTray(station.Data.RFIDNo, station.Data.semibacode, station.stationID);
base.UpdateTray(station.Data.RFIDNo, mainBarcode,station.Data.semibacode);
ICSharpCode.Core.LoggingService.Debug("更新托盘信息:"+station.Data.RFIDNo+"+"+ mainBarcode + "+"+ station.Data.semibacode);
//保存数据
base.SaveStationData(station);
}
catch(Exception e)
{
ICSharpCode.Core.LoggingService.Error(e.ToString());
return false;
}
return true;
}
//private bool InsertHistoryTray(string RFID, string barcode,string stationid)
//{
// try
// {
// StringBuilder sb = new StringBuilder();
// sb.Append("INSERT INTO dbo.T_RP_WorkTrayHistoryInfo(barCode,RFIDNum,CurrentStation) VALUES('");
// sb.Append(barcode).Append("', '").Append(RFID).Append("', '").Append(stationid).Append("')");
// DbHandler db = new DbHandler();
// db.ExecSql(sb.ToString());
// return true;
// }
// catch
// {
// return false;
// }
//}
}
}