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.
141 lines
6.2 KiB
C#
141 lines
6.2 KiB
C#
using Rs.Controls;
|
|
using Rs.MotionPlat.Commom;
|
|
using Rs.MotionPlat.Entitys;
|
|
using Rs.MotionPlat.Flow.NormalFlow;
|
|
using Rs.MotionPlat.Flow.SafePosFlow;
|
|
using Rs.MotionPlat.Flow.SubFlow;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Text.RegularExpressions;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Rs.MotionPlat.SysConfig
|
|
{
|
|
public partial class SelectProductFrm : BaseFormHeader
|
|
{
|
|
string logInfo = string.Empty;
|
|
public SelectProductFrm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void btnSelect_Click(object sender, EventArgs e)
|
|
{
|
|
if(!string.IsNullOrEmpty(txtSn.Text))
|
|
{
|
|
ThreePointLocationFlow.Instance.Location(ETrayType.ReTest,false);
|
|
}
|
|
SelectProduct();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 挑料流程
|
|
/// </summary>
|
|
void SelectProduct()
|
|
{
|
|
this.dataGridView1.Rows.Clear();
|
|
Task.Run(() => {
|
|
string fileName = string.Empty;
|
|
string selectDir = $"d:\\Select\\{DateTime.Now.ToString("yyyyMMdd")}";
|
|
if (!Directory.Exists(selectDir))
|
|
{
|
|
Directory.CreateDirectory(selectDir);
|
|
}
|
|
//获取这个文件夹下面的所有文件
|
|
string[] files = Directory.GetFiles(selectDir);
|
|
if (files != null && files.Length > 0)
|
|
{
|
|
//List<int> fint = new List<int>();
|
|
//foreach (string file in files)
|
|
//{
|
|
// string fname = Path.GetFileName(file);
|
|
// string[] items = fname.Split('-');
|
|
// int index =int.Parse(Path.GetFileNameWithoutExtension(items[1]));
|
|
// fint.Add(index);
|
|
//}
|
|
fileName = $"{DateTime.Now.ToString("yyyyMMdd")}-{files.Length+1}.csv";
|
|
}
|
|
else
|
|
{
|
|
fileName = $"{DateTime.Now.ToString("yyyyMMdd")}-1.csv";
|
|
}
|
|
for (int i = 0; i < 256; i++)
|
|
{
|
|
bool exit = false;
|
|
while (!exit)
|
|
{
|
|
ProductLocationResult fixtureret = FixedGrabProductFlow.Instance.TakePicture(ETrayType.Grr, i+1,1);
|
|
if (fixtureret != null)
|
|
{
|
|
if (fixtureret.Result == EOneGrabSixteenResult.Ok)
|
|
{
|
|
logInfo = $"{i + 1},{fixtureret.SN}\r\n";
|
|
File.AppendAllText(Path.Combine(selectDir, fileName), logInfo);
|
|
Invoke(new Action(() => {
|
|
dataGridView1.Rows.Add(i + 1, fixtureret.SN);
|
|
}));
|
|
|
|
if(txtSn.Text.IndexOf(fixtureret.SN)>=0)
|
|
{
|
|
//ProductLocationResult ret = OneGrabSixteenManager.Instance.GetResultByIndex(0);
|
|
//ret.SlotIndex = i+1;
|
|
//ret.SN= fixtureret.SN;
|
|
//ret.OffsetX = fixtureret.OffsetX;
|
|
//ret.OffsetY = fixtureret.OffsetY;
|
|
StockTakeFlow.Instance.Take( ETrayType.Grr, i + 1, 1, EStockScanBarcodeMode.Single, fixtureret,false);
|
|
TraySlot slot = GlobalTray.RetestTray.GetSlot(Rs.Controls.ESlotStatus.NotHave);
|
|
StockPlaceFlow.Instance.Place(ETrayType.ReTest, slot.Index, 1,false);
|
|
}
|
|
exit = true;
|
|
}
|
|
else if (fixtureret.Result == EOneGrabSixteenResult.LocationOkScanBarcodeFail)
|
|
{
|
|
EButtonType buttonSelect = Msgbox.ShowTipDialog(EButtonType.Retry | EButtonType.Skip, $"slot{i + 1} scan barcode fail","scan fail",true);
|
|
if (buttonSelect == EButtonType.Skip)
|
|
{
|
|
logInfo = $"{i + 1},NG\r\n";
|
|
Invoke(new Action(() => {
|
|
dataGridView1.Rows.Add(i + 1, "NG");
|
|
}));
|
|
|
|
File.AppendAllText(Path.Combine(selectDir, fileName), logInfo);
|
|
exit = true;
|
|
}
|
|
}
|
|
else if (fixtureret.Result == EOneGrabSixteenResult.Slant)
|
|
{
|
|
EButtonType buttonSelect = Msgbox.ShowTipDialog(EButtonType.Retry | EButtonType.EndInput | EButtonType.Skip, $"slot{i + 1} location fail","location fail",true);
|
|
if (buttonSelect == EButtonType.EndInput)
|
|
{
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
exit = true;
|
|
return;
|
|
}
|
|
else if (buttonSelect == EButtonType.Skip)
|
|
{
|
|
logInfo = $"{i + 1},\r\n";
|
|
Invoke(new Action(() => {
|
|
dataGridView1.Rows.Add(i + 1, "");
|
|
}));
|
|
|
|
File.AppendAllText(Path.Combine(selectDir, fileName), logInfo);
|
|
exit = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
DischargeModuleGoSafePosFlow.Instance.GoSafePostion();
|
|
});
|
|
|
|
}
|
|
}
|
|
}
|