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

98 lines
3.2 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace PaintingPC
{
public partial class FrmAddProCol : Form
{
DataTable dtWaitAdd = new DataTable();
bool canStart = false;
public FrmAddProCol()
{
InitializeComponent();
}
private void FrmAddProCol_Load(object sender, EventArgs e)
{
dtWaitAdd = Function.SearchWaitAddPro();
}
private void button1_Click(object sender, EventArgs e)
{
button1.BackColor = Color.Yellow;
button2.BackColor = Color.LightPink;
canStart = true;
AddProCol(canStart);
}
private void button2_Click(object sender, EventArgs e)
{
button1.BackColor = Color.LightGreen;
button2.BackColor = Color.Yellow;
canStart = false;
AddProCol(canStart);
}
private void AddProCol(bool canStart)
{
Regex regex = new Regex(@"^(-)?\d+(\.\d+)?$");
if (canStart && (dtWaitAdd != null) && (dtWaitAdd.Rows.Count > 0))
{
//取barcode,看质检结果有没有,取最后一条,没有,查老外库,update
for (int i = 0; i < dtWaitAdd.Rows.Count; i++)
{
string barcode = dtWaitAdd.Rows[i][0].ToString();
string productInfo = "";
if (Function.BarCodeValid(barcode) && regex.IsMatch(barcode))
{
DataTable dtInspect = Function.GetInspectInfoByBarCode(barcode);
if (dtInspect != null && dtInspect.Rows.Count > 0)
{
for (int j = 0; j < dtInspect.Rows.Count; j++)
{
if (!string.IsNullOrWhiteSpace(dtInspect.Rows[j]["productInfo"].ToString()))
{
productInfo = dtInspect.Rows[0]["productInfo"].ToString().Trim(); //产品信息
break;
}
}
if (string.IsNullOrWhiteSpace(productInfo))
{
productInfo = Function.GetProductInfo(barcode);
}
}
else
{
productInfo = Function.GetProductInfo(barcode);
}
Function.AddProColInfo(barcode, productInfo);
}
}
AddProCol(true);
}
else
{
button1.BackColor = Color.LightGreen;
button2.BackColor = Color.LightPink;
}
}
private void button3_Click(object sender, EventArgs e)
{
Function.GetPosition("22000001512308011024");
}
}
}