锐腾搅拌上料功能
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.

814 lines
32 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Linq;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.BandedGrid;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid;
using System.IO;
using System.Threading;
using ICSSoft.Base.Language.Tool;
using ICSSoft.Base.Config.AppConfig;
using ICSSoft.Base.UserControl.MessageControl;
using ICSSoft.Base.Config.DBHelper;
using ICSSoft.Base.Report.Filter;
using ICSSoft.Base.UserControl.FormControl;
using ICSSoft.Base.Report.GridReport;
using ICSSoft.Base.ReferForm.AppReferForm;
using ICSSoft.Frame.Data.BLL;
using DevExpress.XtraEditors;
using ICSSoft.Frame.Data.Entity;
using ICSSoft.Frame.Data.BLL;
using ICSSoft.Base.Config.AppConfig;
using ICSSoft.Base.Config.DBHelper;
using ICSSoft.Base.ReferForm.AppReferForm;
using System.Text.RegularExpressions;
namespace ICSSoft.Frame.APP
{
public partial class FormICSASNIQCDETAIL : DevExpress.XtraEditors.XtraForm
{
private string sqlconn = "";
String id = "";
String guid = "";
ICSASNIQCDETAIL entity = new ICSASNIQCDETAIL();
#region 构造函数
public FormICSASNIQCDETAIL()
{
InitializeComponent();
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
this.WindowState = FormWindowState.Maximized;
}
public FormICSASNIQCDETAIL(String id)
{
guid = id;
InitializeComponent();
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
this.WindowState = FormWindowState.Maximized;
FormICSCREW_Load(null, null);
string stdstatus = "";
for (int i = 0; i < grvDetail.RowCount; i++)
{
stdstatus = grvDetail.GetRowCellValue(i, STDSTATUS).ToString();
id = grvDetail.GetRowCellValue(i, MID).ToString();
}
if (stdstatus != "待检" && stdstatus != "CheckUnStorage" && stdstatus != "已检未入库")
{
ICSBaseSimpleCode.AppshowMessageBox("数据为[待检][已检未入库]状态才可以维护!");
return;
}
NewValue(id);
}
#endregion
#region 操作权限
public DataTable RightOfExute()
{
DataTable rData = new DataTable();
rData.Columns.Add("BtnName");
rData.Columns.Add("ActionName");
//查看权限(必须有)
DataRow seeRow = rData.NewRow();
seeRow["BtnName"] = "see";
seeRow["ActionName"] = "查看";
rData.Rows.Add(seeRow);
List<Control> ControlList = new List<Control>();
ControlList.Add(btnOutPut);
foreach (Control ctr in ControlList)
{
if (ctr.GetType() == typeof(SimpleButton))
{
DataRow dr = rData.NewRow();
dr["BtnName"] = ctr.Name;
dr["ActionName"] = ctr.Text;
rData.Rows.Add(dr);
}
}
rData.AcceptChanges();
return rData;
}
public DataTable RightOfData()// 数据权限
{
DataTable rData = new DataTable();
rData.Columns.Add("BodyName");
rData.Columns.Add("ControlName");
rData.Columns.Add("ControlCaption");
rData.AcceptChanges();
return rData;
}
#endregion
#region 退出
private void btnClose_Click(object sender, EventArgs e)
{
AppConfig.CloseFormShow(this.Text);
this.Close();
}
private void btnExit_Click(object sender, EventArgs e)
{
AppConfig.CloseFormShow(this.Text);
this.Close();
}
#endregion
#region 移动窗体
private const int WM_NCHITTEST = 0x84;
private const int HTCLIENT = 0x1;
private const int HTCAPTION = 0x2;
//首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
//系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
//假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
//同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
//重写窗体,使窗体可以不通过自带标题栏实现移动
protected override void WndProc(ref Message m)
{
//当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
//当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
//这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
//注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
switch (m.Msg)
{
case WM_NCHITTEST:
base.WndProc(ref m);
if ((int)m.Result == HTCLIENT)
m.Result = (IntPtr)HTCAPTION;
return;
}
//拦截双击标题栏、移动窗体的系统消息
if (m.Msg != 0xA3)
{
base.WndProc(ref m);
}
}
#endregion
#region 列表
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
{
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
e.Info.DisplayText = (e.RowHandle + 1).ToString();
}
#endregion
#region 刷新
private void btnRefresh_Click(object sender, EventArgs e)
{
if (sqlconn == null || sqlconn == "")
{
return;
}
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
try
{
_wait.Show();
FormICSCREW_Load(null,null);
_wait.Close();
}
catch (Exception ex)
{
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
_wait.Close();
}
}
#endregion
#region 页面加载
private void grdDetail_Load(object sender, EventArgs e)
{
FormICSCREW_Load(null, null);
}
private void FormICSCREW_Load(object sender, EventArgs e)
{
try
{
string sql = "select a.ID as MID,a.*,b.INVDESC,b.INVCONTROLTYPE from ICSASNIQCDETAIL as a,ICSINVENTORY as b where a.ITEMCODE=b.INVCODE and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "' and a.IQCID='" + guid + "'";
DataTable ddf = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
grdDetail.DataSource = ddf;
}
catch (Exception ex)
{
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
#endregion
#region 导出
private void btnOutPut_Click_1(object sender, EventArgs e)
{
FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
foe.ShowDialog();
}
#endregion
#region 赋初始值NewValue
public void NewValue(string id)
{
string sql = "select * from ICSASNIQCDETAIL where ID='" + id + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dtn = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
foreach (DataRow dr in dtn.Rows)
{
txtCODE.Text=dr["IQCNO"].ToString();
}
string st = "select * from ICSINVENTORY where INVCODE='" + dtn.Rows[0][5].ToString() + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dm = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, st).Tables[0];
foreach (DataRow dd in dm.Rows)
{
if (dd["INVCONTROLTYPE"] == null)
{
comCONTROLTYPE.Items.Clear();
comCONTROLTYPE.Items.Add("批次管控");
comCONTROLTYPE.Items.Add("单件管控");
comCONTROLTYPE.Items.Add("不管控");
}
else
{
comCONTROLTYPE.Text = dd["INVCONTROLTYPE"].ToString();
comCONTROLTYPE.Items.Clear();
comCONTROLTYPE.Items.Add("批次管控");
comCONTROLTYPE.Items.Add("单件管控");
comCONTROLTYPE.Items.Add("不管控");
}
}
//赋值
txtMUSER.Text = AppConfig.UserCode;
txtMTIME.Text = DateTime.Now.ToString();
txtID.Text = id;
foreach (DataRow dr in dtn.Rows)
{
//采购订单号
//entity.ORDERNO =
//采购订单行
//entity.ORDERLINE =
if (dr["INSType"].ToString() == "全检")
{
radALLCHECK.Checked = true;
}
else if(dr["INSType"].ToString() == "抽检")
{
radPARTCHECK.Checked = true;
}
if (dr["CHECKSTATUS"].ToString() == "合格")
{
radQUA.Checked = true;
}
else if (dr["CHECKSTATUS"].ToString() == "不合格")
{
radNOTQUA.Checked = true;
}
//采购备注
//entity.PurchaseMEMO=
rDESC.Text = dr["MEMO"].ToString();
txtQUADESC.Text = dr["MEMOEX"].ToString();
comSAMPLE.Text = dr["isSample"].ToString();
txtECG.Text = dr["TSErrorCodeGroup"].ToString();
btnEC.Text = dr["TSErrorCode"].ToString();
comACCWAY.Text = dr["TYPE"].ToString();
comAQLNORM.Text = dr["AQL"].ToString();
if (dr["SAMPLEQTY"].ToString()!="")
{
txtPARTAMOUNT.Text = Convert.ToInt32(double.Parse(dr["SAMPLEQTY"].ToString())).ToString();
}
txtITEMCODE.Text = dr["CheckGroup"].ToString();
txtVALUEMIN.Text=dr["PIC"].ToString();
//if (comAQLNORM.Text != "")
//{
// txtPARTAMOUNT_TextChanged(null, null);
//}
if (dr["NGQTY"].ToString()!="")
{
txtECNUM.Text = Convert.ToInt32(double.Parse(dr["NGQTY"].ToString())).ToString();
}
rSTEPDESC.Text = dr["ACTION"].ToString();
if (dr["concessionStatus"].ToString() == "是")
{
cheACC.Checked = true;
}
else
{
cheACC.Checked = false; ;
}
cheACC_CheckedChanged(null,null);
if (dr["concessionQTY"].ToString()!="")
{
txtACCAMOUNT.Text = Convert.ToInt32(double.Parse(dr["concessionQTY"].ToString())).ToString();
}
txtACCNUM.Text=dr["concessionNO"].ToString();
rACCDESC.Text=dr["concessionMemo"].ToString();
txtDUTYPER.Text = dr["IQCDepartment"].ToString();
txtTESTPER.Text=dr["DINSPECTOR"].ToString();
dTESTTIME.Text=dr["DINSPDATE"].ToString();
}
txtECG.Enabled = false;
txtACCAMOUNT.Enabled = false;
txtACCNUM.Enabled = false;
rACCDESC.Enabled = false;
if (radQUA.Checked == true)
{
//txtSAMAMOUNT.Enabled = false;//样本数量
//txtPARTAMOUNT.Enabled = false;//抽样数
cheACC.Enabled = false;
txtQUADESC.Enabled = false;//不合格说明
btnEC.Enabled = false;
}
if (radNOTQUA.Checked == true)
{
cheACC.Enabled = true;
if (cheACC.Checked == true)
{
txtACCAMOUNT.Enabled = true;
txtACCNUM.Enabled = true;
rACCDESC.Enabled = true;
}
}
comSAMPLE.Items.Clear();
comSAMPLE.Items.Add("是");
comSAMPLE.Items.Add("否");
comACCWAY.Items.Clear();
comACCWAY.Items.Add("正常");
comACCWAY.Items.Add("特采");
comACCWAY.Items.Add("代用");
string str = "select DISTINCT AQLLEVEL from ICSAQL where WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable ddf = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, str).Tables[0];
comAQLNORM.Items.Clear();
if (ddf.Rows.Count != 0)
{
foreach (DataRow dk in ddf.Rows)
{
comAQLNORM.Items.Add(dk[0].ToString());
}
}
if (comAQLNORM.Text != "")
{
comAQLNORM_SelectedIndexChanged(null,null);
}
}
#endregion
#region 新增 修改
private void save_Click(object sender, EventArgs e)
{
int f = 0;
string stq = "select RECEIVEQTY from dbo.ICSASNIQCDETAIL where ID='" + txtID.Text + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dmq = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, stq).Tables[0];
if (dmq.Rows.Count > 0)
{
f = int.Parse(dmq.Rows[0][0].ToString().Split('.')[0]);
}
Regex rex = new Regex(@"^\d+$|^\d+\.\d+$");
int i = 0;
int j = 0;
if (cheACC.Checked == true)
{
if (txtACCAMOUNT.Text == "" || txtACCNUM.Text=="")
{
i++;
}
j++;
}
if (txtCODE.Text.Trim() == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[送检运单号]不可为空!");
}
else if(radALLCHECK.Checked==false&&radPARTCHECK.Checked==false)
{
ICSBaseSimpleCode.AppshowMessageBox("[全检抽检]不可为空!");
}
else if(radQUA.Checked==false&&radNOTQUA.Checked==false)
{
ICSBaseSimpleCode.AppshowMessageBox("[合格不合格]不可为空!");
}
else if (comACCWAY.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[接收方式]不可为空!");
}
else if (comAQLNORM.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[AQL标准]不可为空!");
}
else if (txtPARTAMOUNT.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[抽样数]不可为空!");
}
else if (txtECNUM.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[不良数]不可为空!");
}
else if (txtITEMCODE.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[测试项目组]不可为空!");
}
else if (comCONTROLTYPE.Text=="")
{
ICSBaseSimpleCode.AppshowMessageBox("[管控类型]不可为空!");
}
else if (txtECNUM.Text=="")
{
ICSBaseSimpleCode.AppshowMessageBox("[不良数]不可为空!");
}
else if(i!=0)
{
ICSBaseSimpleCode.AppshowMessageBox("让步接收时[数量][号码]必填!");
}
else if (!rex.Match(txtPARTAMOUNT.Text).Success && txtPARTAMOUNT.Text!="")
{
ICSBaseSimpleCode.AppshowMessageBox("[抽样数]为空或正整数!");
}
else if (!rex.Match(txtSAMAMOUNT.Text).Success && txtSAMAMOUNT.Text != "")
{
ICSBaseSimpleCode.AppshowMessageBox("[样本数量]为空或正整数!");
}
else if (!rex.Match(txtECNUM.Text).Success && txtECNUM.Text != "")
{
ICSBaseSimpleCode.AppshowMessageBox("[不良数]为正整数!");
}
else if (!rex.Match(txtACCAMOUNT.Text).Success && txtACCAMOUNT.Text != "" && j != 0)
{
ICSBaseSimpleCode.AppshowMessageBox("[让步接收数量]为空或正整数!");
}
else if (int.Parse(txtECNUM.Text) >= int.Parse(txtPARTAMOUNT.Text))
{
ICSBaseSimpleCode.AppshowMessageBox("[不良数]不能大于等于[样本数量]!");
}
else if (txtACCAMOUNT.Text!="" && int.Parse(txtACCAMOUNT.Text)>f)
{
ICSBaseSimpleCode.AppshowMessageBox("[让步接收数量]不能大于[收货数量]!");
}
else if (int.Parse(txtPARTAMOUNT.Text)>f)
{
ICSBaseSimpleCode.AppshowMessageBox("[样本数量]不能大于[收货数量]");
}
else
{
try
{
ICSASNIQC asn = new ICSASNIQC();
string sql = "select a.*,b.PLANQTY from ICSASNIQCDETAIL as a,ICSINVReceiptDetail as b where a.ID='" + txtID.Text + "' and b.ReceiptNO=a.STNO and a.STLINE=b.ReceiptLine and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
foreach (DataRow dr in dt.Rows)
{
string st = "select * from ICSINVENTORY where INVCODE='" + dr["ITEMCODE"] + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dm = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, st).Tables[0];
entity.ID = txtID.Text;
entity.IQCID=dr["IQCID"].ToString();
entity.IQCNO = dr["IQCNO"].ToString();
entity.STNO = dr["STNO"].ToString();
if (dr["STLINE"].ToString()!="")
{
entity.STLINE = int.Parse(dr["STLINE"].ToString());
}
entity.ITEMCODE = dr["ITEMCODE"].ToString();
//采购订单号
//entity.ORDERNO =
//采购订单行
//entity.ORDERLINE =
entity.STDSTATUS = "已检未入库";
if (dr["PLANQTY"].ToString() != "")
{
entity.RECEIVEQTY = int.Parse(double.Parse(dr["PLANQTY"].ToString()).ToString());
}
if (radQUA.Checked == true)
{
entity.CHECKSTATUS = "合格";
}
else
{
entity.CHECKSTATUS = "不合格";
}
entity.UNIT=dm.Rows[0][4].ToString();
//采购备注
//entity.PurchaseMEMO=
entity.MEMO = rDESC.Text;
entity.MEMOEX = txtQUADESC.Text;
if (txtPARTAMOUNT.Text != "")
{
entity.SAMPLEQTY = int.Parse(txtPARTAMOUNT.Text);
}
if (txtECNUM.Text != "")
{
entity.NGQTY = int.Parse(txtECNUM.Text);
}
entity.PIC = txtVALUEMIN.Text;
entity.ACTION = rSTEPDESC.Text;
if (radALLCHECK.Checked == true)
{
entity.INSType = "全检";
}
else
{
entity.INSType = "抽检";
}
if (dTESTTIME.Text != "")
{
entity.DINSPDATE = DateTime.Parse(dTESTTIME.Text);
}
entity.DINSPECTOR = txtTESTPER.Text;
entity.ATTRIBUTE = "正常";
entity.Type = comACCWAY.Text;
entity.StorageID = dr["StorageID"].ToString();
if (cheACC.Checked == true)
{
entity.concessionStatus = "是";
}
else
{
entity.concessionStatus = "否";
}
entity.IQCDepartment = txtDUTYPER.Text;
if (txtACCAMOUNT.Text!="")
{
entity.concessionQTY = int.Parse(txtACCAMOUNT.Text);
}
entity.concessionNO = txtACCNUM.Text;
entity.concessionMemo = rACCDESC.Text;
entity.WORKPOINT = AppConfig.WorkPointCode;
entity.MUSER = txtMUSER.Text;
entity.MUSERNAME = AppConfig.UserName;
if (txtMTIME.Text!="")
{
entity.MTIME =Convert.ToDateTime(txtMTIME.Text);
}
entity.isSample=comSAMPLE.Text;
entity.AQL=comAQLNORM.Text;
entity.CheckGroup=txtITEMCODE.Text;
entity.TSErrorCodeGroup=txtECG.Text;
entity.TSErrorCode=btnEC.Text;
entity.IQCDepartment = txtDUTYPER.Text;
ICSASNIQCDETAILBLL.AddAndEdit(entity, AppConfig.AppConnectString);
//检验完成后,修改入库单检验结果 修改合格数量
double qualify = 0;
if (entity.CHECKSTATUS == "合格")
{
qualify = double.Parse(entity.RECEIVEQTY.ToString().Split('.')[0].ToString()) - double.Parse(entity.NGQTY.ToString());
}
ICSASNIQCDETAILBLL.UpdateICSINVReceiptDetailState(entity.CHECKSTATUS, qualify, txtCODE.Text);
//所有子表检验完成,修改主表状态
int m=ICSASNIQCDETAILBLL.SelectCount(entity.IQCNO);
if (m == 0)
{
ICSASNIQCDETAILBLL.Set(entity.IQCNO);
}
}
ICSBaseSimpleCode.AppshowMessageBox("操作成功!");
FormICSCREW_Load(null, null);
}
catch (Exception ex)
{
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
}
}
}
#endregion
#region 取消
private void can_Click(object sender, EventArgs e)
{
this.Close();
}
#endregion
#region 不良代码
private void btnEC_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
btnEC.Text = "";
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select a.ECODE as [不良代码],b.ECDESC as [描述]
from dbo.ICSECG2EC as a,ICSEC as b
where a.ECGCODE='" + txtECG.Text + "' and b.ID=a.ECID and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "不良代码信息";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("ID");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
reForm.FilterKey = btn.Text; //grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
btnEC.Text = dr["不良代码"].ToString();
}
}
}
#endregion
#region 测试项目组 按钮点击事件
private void txtITEMCODE_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
txtITEMCODE.Text = "";
ButtonEdit btn = (ButtonEdit)sender;
string sql = @"select CKGROUP as [检验项目组],ID as [ID],CKGROUPDESC as [描述]
from ICSOQCCKGROUP
where WorkPoint='" + AppConfig.WorkPointCode + "'";
sql = string.Format(sql);
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
FormDataRefer reForm = new FormDataRefer();
reForm.FormTitle = "检验项目信息";
DataTable menuData = data;
reForm.DataSource = menuData;
reForm.MSelectFlag = false;
reForm.RowIndexWidth = 35;
reForm.HideCols.Add("ID");
reForm.FormWidth = 800;
reForm.FormHeight = 600;
reForm.FilterKey = btn.Text; //grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, grvDetail.FocusedColumn).ToString().Trim();
if (reForm.ShowDialog() == DialogResult.OK)
{
DataTable retData = reForm.ReturnData;
foreach (DataRow dr in retData.Rows)
{
txtITEMCODE.Text = dr["检验项目组"].ToString();
}
}
}
#endregion
#region AQL标准 下拉框值 改变事件
private void comAQLNORM_SelectedIndexChanged(object sender, EventArgs e)
{
if (comAQLNORM.Text != "" && txtPARTAMOUNT.Text != "")
{
try
{
string code = "";
string s = "select SampleSize,LOTSIZEMIN,LOTSIZEMAX from ICSAQL where AQLLEVEL='" + comAQLNORM.Text + "' and WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dy = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, s).Tables[0];
string st = "select RECEIVEQTY from ICSASNIQCDETAIL where IQCNO='"+txtCODE.Text+"'";
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, st).Tables[0];
if(dt.Rows.Count!=0)
{
code=dt.Rows[0][0].ToString().Split('.')[0].ToString();
}
if (dy.Rows.Count != 0)
{
foreach (DataRow dr in dy.Rows)
{
if (int.Parse(code) <= int.Parse(dr["LOTSIZEMAX"].ToString()) && int.Parse(code) >= int.Parse(dr["LOTSIZEMIN"].ToString()))
{
txtSAMAMOUNT.Text = dr["SampleSize"].ToString();
}
}
}
}
catch(Exception ex)
{
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
}
}
}
#endregion
#region 让步接收 按钮值 改变时
private void cheACC_CheckedChanged(object sender, EventArgs e)
{
if (cheACC.Checked == true)
{
txtACCAMOUNT.Enabled = true;
txtACCNUM.Enabled = true;
rACCDESC.Enabled = true;
}
else if (cheACC.Checked == false)
{
txtACCAMOUNT.Enabled = false;
txtACCNUM.Enabled = false;
rACCDESC.Enabled = false;
}
}
#endregion
#region 合格 按钮值 合格时
private void radQUA_CheckedChanged(object sender, EventArgs e)
{
if (radQUA.Checked == true)
{
txtQUADESC.Text = "";
txtECG.Text = "";
btnEC.Text = "";
cheACC.Text = "";
if (cheACC.Checked == true)
{
cheACC.Checked = false;
txtACCAMOUNT.Text="";
txtACCNUM.Text="";
rACCDESC.Text = "";
}
txtQUADESC.Enabled = false;
txtECG.Enabled = false;
btnEC.Enabled = false;
cheACC.Enabled = false;
}
else
{
txtQUADESC.Enabled = true;
txtECG.Enabled = true;
txtECNUM.Enabled = true;
txtSAMAMOUNT.Enabled = true;
txtPARTAMOUNT.Enabled = true;
btnEC.Enabled = true;
cheACC.Enabled = true;
comAQLNORM.Enabled = true;
}
}
#endregion
#region 不合格按钮值 改变时
private void radNOTQUA_CheckedChanged(object sender, EventArgs e)
{
if (radNOTQUA.Checked == true)
{
string s = "select ECGCODE from ICSECG as a,ICSASNIQCDETAIL as b where b.ID='" + guid + "' and b.ITEMCODE=a.RESCODE and a.WorkPoint='" + AppConfig.WorkPointCode + "' and b.WorkPoint='" + AppConfig.WorkPointCode + "'";
DataTable dy = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, s).Tables[0];
if (dy.Rows.Count!=0)
{
txtECG.Text = dy.Rows[0][0].ToString();
}
}
else
{
txtECG.Text = "";
}
}
#endregion
#region 检验项目
private void btnSERVER_Click(object sender, EventArgs e)
{
if (txtITEMCODE.Text == "")
{
ICSBaseSimpleCode.AppshowMessageBox("[测试项目组]的值无效!");
}
else
{
//FormLISTAdd add = new FormLISTAdd(txtITEMCODE.Text);
FormLISTAdd add = new FormLISTAdd(txtCODE.Text,txtITEMCODE.Text);
add.ShowDialog();
}
}
#endregion
}
}