using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Configuration;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Windows.Forms;
|
|
namespace M423project
|
{
|
public partial class FormCheck : Form
|
{
|
public static bool _pickNow;
|
public static int _pickCount;
|
public static int _lastProductQty;
|
public static int _lastBreakProductQty;
|
public static int _totalQty;
|
public static int _finishedQty;
|
public SpotCheckData _spotData;
|
public static SpotCheckDetail _detail = new SpotCheckDetail();
|
|
public FormCheck()
|
{
|
InitializeComponent();
|
_spotData = new SpotCheckData();
|
LoadInfo();
|
}
|
|
public void LoadInfo()
|
{
|
gridDetail.AutoGenerateColumns = false;
|
grid.AutoGenerateColumns = false;
|
gridDetail.DataSource = _spotData.GetTodayFinishedSpot();
|
grid.DataSource = _spotData.GetTodayCheckPlan();
|
}
|
|
private void btnClose_Click(object sender, EventArgs e)
|
{
|
Close();
|
}
|
|
private void txtTime_KeyPress(object sender, KeyPressEventArgs e)
|
{
|
if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
|
{
|
e.Handled = true;
|
}
|
}
|
|
private void txtQty_KeyPress(object sender, KeyPressEventArgs e)
|
{
|
if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
|
{
|
e.Handled = true;
|
}
|
}
|
|
private void btnConfirm_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
if (_spotData.IsSpotCheck())
|
{
|
MessageBox.Show("今日已有抽检计划");
|
return;
|
}
|
double timeHour = Convert.ToDouble(txtTime.Text);
|
if (DateTime.Now.AddHours(timeHour).Day!=DateTime.Now.Day)
|
{
|
MessageBox.Show("不允许跨天抽检");
|
return;
|
}
|
_totalQty = Convert.ToInt32(txtQty.Text);
|
double timeSecond = timeHour * 60 * 60 * 0.8;
|
_pickCount = Convert.ToInt32(timeSecond / 4 / _totalQty);
|
|
|
SpotCheck spotCheck = new SpotCheck();
|
spotCheck.TotalQty = _totalQty;
|
spotCheck.FinishedQty = 0;
|
_finishedQty = 0;
|
spotCheck.PickCount = _pickCount;
|
spotCheck.LastBreakProductQty = 0;
|
spotCheck.LastProductQty = 0;
|
_spotData.SaveSpotCheck(spotCheck);
|
}
|
catch (Exception)
|
{
|
}
|
|
Close();
|
}
|
|
private void btnNow_Click(object sender, EventArgs e)
|
{
|
_pickNow = true;
|
Close();
|
}
|
}
|
}
|