优化放料到料仓生成的文件,增加SN和放料时间

master
lhiven 10 months ago
parent 2d33157fe9
commit 5eb1de3c02

@ -136,7 +136,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
//} //}
if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed, EGoWhichSide.StockSide)) if (GroupAxisMove.XY1Y2MovePos(targetPosition, GlobalVar.WholeSpeed, EGoWhichSide.StockSide))
{ {
AxisPosPrint.PrintXY1Y2TargetPos("到料仓拍照位上方,", targetPosition, GetClassName()); AxisPosPrint.PrintXY1Y2TargetPos($"到{trayType}料仓拍照位上方,", targetPosition, GetClassName());
flowStep = EStockPlaceFlowStep.; flowStep = EStockPlaceFlowStep.;
} }
} }
@ -148,7 +148,7 @@ namespace Rs.MotionPlat.Flow.SubFlow
AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName()); AxisPosPrint.PrintXY1Y2CurrentPos("轴loadx,loady1,loady2已停止运动,", GetClassName());
if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2)) if (AxisArrived.LoadXY1Y2IsArrived(targetPosition.X, targetPosition.Y1, targetPosition.Y2))
{ {
AxisPosPrint.PrintXY1Y2CurrentPos("已运动到料仓拍照位上方,", GetClassName()); AxisPosPrint.PrintXY1Y2CurrentPos($"已运动到{trayType}料仓拍照位上方,", GetClassName());
flowStep = EStockPlaceFlowStep.; flowStep = EStockPlaceFlowStep.;
} }
else else
@ -162,16 +162,22 @@ namespace Rs.MotionPlat.Flow.SubFlow
VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation); VisionResult vr = VisionHelper.Grab(Vision.EVisionScene.TrayLocation);
if(vr!=null && vr.Result) if(vr!=null && vr.Result)
{ {
curNozzle = NozzleManager.GetNozzle(nozzleIndex);
slotOffsetX = vr.OffsetX; slotOffsetX = vr.OffsetX;
slotOffsetY=vr.OffsetY; slotOffsetY=vr.OffsetY;
string title = "index,offsetx,offsety\r\n"; string sn = "";
string content = $"{slotIndex},{slotOffsetX},{slotOffsetY}\r\n"; if(curNozzle!=null && curNozzle.Product!=null && !string.IsNullOrEmpty(curNozzle.Product.SN))
string dataDir = $"d://data/placestock"; {
sn = curNozzle.Product.SN;
}
string title = "index,sn,offsetx,offsety,time\r\n";
string content = $"{slotIndex},{sn},{slotOffsetX},{slotOffsetY},{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss fff")}\r\n";
string dataDir = $"d://data/placestock//{DateTime.Now.ToString("yyyy-MM-dd")}";
if(!Directory.Exists(dataDir)) if(!Directory.Exists(dataDir))
{ {
Directory.CreateDirectory(dataDir); Directory.CreateDirectory(dataDir);
} }
string dataFilePath = $"{dataDir}//{DateTime.Now.ToString("yyyy-MM-dd")}.csv"; string dataFilePath = $"{dataDir}//{GlobalVar.LotName}_{trayType}.csv";
if(!File.Exists(dataFilePath)) if(!File.Exists(dataFilePath))
{ {
File.AppendAllText(dataFilePath, title); File.AppendAllText(dataFilePath, title);

Loading…
Cancel
Save